Compare commits

..

123 Commits

Author SHA1 Message Date
Matthias Clasen c640e4a4cc wip: Add a bin with slack
Just an experiment: Make a bin that adds 'slack' around
its child, and avoids resizing unless the child size changes
more than the slack allows.
2020-05-18 21:18:36 -04:00
Matthias Clasen ec2aac5b61 gsk: Document blend modes
Add some information about blend modes, mostly taken
from the css compositing spec.

Fixes: #2739
2020-05-18 18:21:39 -04:00
Matthias Clasen 15f7d2a27d 3.98.4 2020-05-18 16:38:11 -04:00
Matthias Clasen 3dafdcbab0 testsuite: Remove GDK_DEBUG=misc
This snuck in by accident in recent ci setup
changes, and breaks the test runs by adding
stray output.
2020-05-18 16:38:11 -04:00
Matthias Clasen 383fa6b0b0 Merge branch 'matthiasc/for-master' into 'master'
colorscale: Bring back the right-click on slider

See merge request GNOME/gtk!1933
2020-05-18 16:46:12 +00:00
Matthias Clasen f637ab57f1 colorscale: Bring back the right-click on slider
This was lost when we converted the color editor to actions.
2020-05-18 11:31:42 -04:00
Emmanuele Bassi 615b4d8c65 Merge branch 'ebassi/ci-fix' into 'master'
docs: Fix the argument name to match

See merge request GNOME/gtk!1930
2020-05-18 15:10:38 +00:00
Jakub Steiner 9be5c7b0c8 Merge branch 'theme-aligned-combo-labels' into 'master'
Adwaita: Align combo menu labels with the combo button label

See merge request GNOME/gtk!1928
2020-05-18 14:04:19 +00:00
Yuri Chornoivan 670b102553 Update Ukrainian translation 2020-05-18 14:03:41 +00:00
Emmanuele Bassi 9bd9a11de4 docs: Fix the argument name to match
Both gtk-doc and g-i require the name of the argument of a function to
match in the declaration, definition, and gtk-doc stanza.
2020-05-18 14:55:25 +01:00
Jakub Steiner ec26e4f6b4 Merge branch 'theme-checkbutton-padding' into 'master'
Adwaita: Tweak padding in checkbutton & radiobutton

Closes #2697

See merge request GNOME/gtk!1927
2020-05-18 13:12:15 +00:00
nana-4 538ab75002 Adwaita: Align combo menu labels with the combo button label
Apply the same left and right padding to the combo menu items as the
combo button.
2020-05-18 21:52:00 +09:00
nana-4 1c99dbc70e Adwaita: Tweak padding in checkbutton & radiobutton
Since we can now use border-spacing in checkbutton and radiobutton,
we don't need the margin in check and radio for spacing anymore.

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/2697
2020-05-18 20:29:23 +09:00
Timm Bäder afd56517d1 bloatpad: Avoid a few theoretical compiler warnings 2020-05-18 11:30:08 +02:00
Timm Bäder 3c7ba21a6a Add G_GNUC_NORETURN to functions that never return 2020-05-18 11:30:08 +02:00
Timm Bäder 4b655ecd36 examples: Add common_cflags to executables 2020-05-18 11:30:08 +02:00
Daniel Mustieles 028942c8c3 Updated Spanish translation 2020-05-18 10:15:03 +02:00
Matthias Clasen 55b171c986 Merge branch 'shape-apis' into 'master'
Shape apis

See merge request GNOME/gtk!1925
2020-05-18 04:26:01 +00:00
Chun-wei Fan a4416e389a print-editor demo: Fix linking on Visual Studio
We need to pass in '/entry:mainCRTStartup' as we did for the other demo
programs that have 'gui_app: true' in their Meson build settings.
2020-05-18 11:35:52 +08:00
Matthias Clasen d6818475d7 gdk: Simplify gdk_display_supports_input_shapes
Make this a display property, and do away with
the vfunc in favor of a private setter, to match
how we handle other display characteristics.
2020-05-17 22:05:24 -04:00
Matthias Clasen 287c40276a gdk: Drop gdk_display_supports_shapes
The apis to set shapes on surfaces are gone,
so there is no point in providing this information
on GdkDisplay.
2020-05-17 21:52:15 -04:00
Matthias Clasen 5916ae5ec4 x11: Avoid some frontend api use
We can just use our backend information directly.
2020-05-17 21:47:22 -04:00
Matthias Clasen 03829e191e docs: Tweak docs for gdk_surface_set_input_region 2020-05-17 21:46:54 -04:00
Matthias Clasen f958a6ecf7 Merge branch 'coordinate-api' into 'master'
Coordinate api

See merge request GNOME/gtk!1924
2020-05-18 00:08:44 +00:00
Matthias Clasen 71bad81aff gdk: Make gdk_drag_begin take doubles
This is a better fit to the way we treat coordinates
everywhere else.
2020-05-17 17:51:03 -04:00
Matthias Clasen 75d9310986 Change coordinate translation apis to take doubles
Change gtk_widget_translate_coordinates and
gtk_native_get_surface_transform to operate
on doubles. Update all callers.
2020-05-17 17:17:31 -04:00
Matthias Clasen 93d4253c93 native: Make gtk_native_get_surface_transform public
This api is needed to translate between surface
and widget coordinates.
2020-05-17 16:01:08 -04:00
Matthias Clasen c0faf0c6b6 Merge branch 'toplevel-move-resize' into 'master'
Toplevel move resize

See merge request GNOME/gtk!1923
2020-05-17 19:15:46 +00:00
Matthias Clasen b63690aa6b docs: Mention begin_resize_drag in the migration guide 2020-05-17 14:38:10 -04:00
Matthias Clasen 1e8a58e367 gdk: Move the begin_move/resize_drag vfuncs around
Move these from GdkSurface to GdkToplevel, where they
belong. Update all backends.
2020-05-17 14:15:06 -04:00
Benjamin Otte 34d7e25a1f x11: Fix up for last merge 2020-05-17 19:21:28 +02:00
Benjamin Otte b353221185 Merge branch 'wip/otte/monitors' into 'master'
various GDK cleanups

See merge request GNOME/gtk!1920
2020-05-17 16:57:52 +00:00
Matthias Clasen eb6edac4bd gdk: Drop gdk_surface_begin_move/resize_drag
These have been replaced by GdkToplevel api.
2020-05-17 12:49:29 -04:00
Matthias Clasen f316fe0f58 window: Use toplevel begin_move/resize api
The GdkSurface api for this is going away.
2020-05-17 12:49:26 -04:00
Emmanuele Bassi 12854f1428 Merge branch 'ebassi/ci-extends' into 'master'
ci: Use extends instead of YAML anchors

See merge request GNOME/gtk!1908
2020-05-17 16:43:24 +00:00
Matthias Clasen 309a7aa253 gdk: Add gdk_toplevel_begin_move/resize
For now, these are wrappers around the surface apis,
but they are going to replace them, since this operation
is only available on toplevels.
2020-05-17 12:41:16 -04:00
Benjamin Otte 363c88cef7 migration guide: Update paragraph about monitors
Clarify the new handling of monitors via a listmodel of GdkMonitor
instead of int monitor_num.
2020-05-17 18:05:07 +02:00
Timm Bäder 74a1c60dd4 windowhandle: Apply surface transform before passing coords to GDK
Otherwise coordinates are incorrect and the window can jump around after
starting a drag.
2020-05-17 15:30:50 +02:00
Timm Bäder a4bb81b61c inspector: Apply toplevel transform before snapshotting overlays 2020-05-17 15:30:44 +02:00
Timm Bäder 01c0acb707 gl renderer: Apply scaled clip when rendering offscreen clipped child 2020-05-17 15:30:28 +02:00
Timm Bäder afbc1d5b66 shortcutmanager: Fix private header include guard 2020-05-17 15:30:03 +02:00
Timm Bäder 1d9e68245a shortcutcontroller: Don't return a shortcut stope as GdkModifierType 2020-05-17 15:30:03 +02:00
Timm Bäder 9b98641ddd window: Use TRUE/FALSE for boolean values 2020-05-17 15:30:03 +02:00
Timm Bäder 2c1d218749 Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

Closes #1619

See merge request GNOME/gtk!1921
2020-05-17 13:08:26 +00:00
Emin Tufan Çetin 716485113a Update Turkish translation 2020-05-17 11:42:10 +00:00
Matthias Clasen d70feb9165 Apply surface transform in more places
With these fixes, GtkSwitch now works in the presence
of surface transforms.
2020-05-17 02:23:23 -04:00
Matthias Clasen 38af49d4fd inspector: Take surface transform into account 2020-05-17 02:10:56 -04:00
Timm Bäder 007de568c9 gl renderer: Fix an uninitialized value 2020-05-17 08:07:11 +02:00
Matthias Clasen d2913b81cb windowhandle: Take surface transform into account 2020-05-17 02:05:32 -04:00
Matthias Clasen c90078fd4a widget: Fix gtk_widget_get_surface_allocation
As the name implies, this should be surface-relative
coordinates, so it needs to take the surface transform
into account.
2020-05-17 02:04:22 -04:00
Matthias Clasen 428e647238 textview: Fix context menu placement
Take the surface transform into account for
positioning the context menu.
2020-05-17 02:03:41 -04:00
Benjamin Otte 4c7914dc49 display: Remove unneeded getters
Applications can use the listmodel instead.
2020-05-17 07:32:37 +02:00
Matthias Clasen 5e35a4b69a tooltip: Fix positioning
There are a few more places where we were forgetting
to apply the surface->native transform. With these
changes, tooltips are positioned correctly when
the toplevel has padding applied.

Fixes: #1619
2020-05-17 01:22:02 -04:00
Benjamin Otte 9a30019268 display: Remove the monitor signals
Applications can listen to GdkDisplay:monitors::items-changed if they
want to track monitor changes.
2020-05-17 07:10:34 +02:00
Benjamin Otte 972276436f x11: Directly notify surfaces of monitor changes
Do not use signals.
2020-05-17 07:10:34 +02:00
Benjamin Otte e81a1db48c monitor: Add gdk_monitor_set_geometry()
Make it replace gdk_monitor_set_size() and gdk_monitor_set_position()
which used to be called in pairs anyway.
2020-05-17 07:10:34 +02:00
Benjamin Otte 33a4442988 x11: Remove unused change tracking
Change tracking now works automatically via GdkMonitor.
2020-05-17 05:14:24 +02:00
Matthias Clasen 3035bf1e39 widget-factory: Cosmetics
Add a frame around the white background in the background
selection dialog. Otherwise, it is not really visible.
2020-05-16 21:54:14 -04:00
Benjamin Otte 14bf58ec5d x11: Remove XDamage dependency
It's not used.
2020-05-17 02:14:58 +02:00
Matthias Clasen a2a3aab94d Merge branch 'wip/baedert/for-master' into 'master'
Wip/baedert/for master

Closes #2601

See merge request GNOME/gtk!1918
2020-05-16 23:35:51 +00:00
Emmanuele Bassi 7ff9a3f3a0 ci: Allow using "latest" as the image version
Just like the documentation says.
2020-05-17 00:32:22 +01:00
Emmanuele Bassi 8070bac06c ci: Use extends instead of YAML anchors
The `extends` keyword is more readable than YAML's weird anchor syntax,
and we don't have too many anchors in our job definitions anyway.
2020-05-17 00:30:07 +01:00
Benjamin Otte d4731a4ab4 x11: Remove gdk_x11_register_standard_event_type()
It's not used anymore since GdkX11Display::xevent exists.
2020-05-17 01:02:17 +02:00
Benjamin Otte 0c6266fd1a surface: Remove gdk_surface_is_viewable()
It returns the same value as gdk_surface_get_mapped(), so use that
instead.
2020-05-17 00:41:44 +02:00
Timm Bäder 5b0e91844b popover: Fix input shape rendering
Once again, calling gtk_widget_get_allocation() is wrong.

Fixes #2601
2020-05-16 22:34:38 +02:00
Timm Bäder c4363e2706 showrendernode: Set widget overflow 2020-05-16 22:04:00 +02:00
Timm Bäder ccaacfc8c3 texthandle: Remove min-width/height handling
We do that automatically for all widgets.
2020-05-16 22:04:00 +02:00
Timm Bäder 2e9d772e66 natives: Use GtkCssBoxes in get_surface_transform 2020-05-16 22:04:00 +02:00
Timm Bäder bac6e79614 native: Add documenation for get_surface_transform 2020-05-16 22:03:58 +02:00
Timm Bäder 2fd86ef80c popover: Return correct values from get_surface_transform()
We do not (yet) care about the box shadow here, so it's sufficient to
return the css values.
2020-05-16 22:03:58 +02:00
Timm Bäder f9370d7e83 main: Translate coordinates from surface to native before picking
gtk_widget_pick() needs them to be in @self coordinates.
2020-05-16 22:03:55 +02:00
Matthias Clasen bc75965053 Merge branch 'matthiasc/for-master' into 'master'
broadway: Be careful about destroyed surfaces

See merge request GNOME/gtk!1917
2020-05-16 18:27:19 +00:00
Matthias Clasen 77107f70c4 broadway: Be careful about destroyed surfaces
Just because we take a ref on a surface does not
guarantee that it is still usable a second later.
Check if its been destroyed in the meantime.

This is breaking the template tests in ci, since
there is no client behind the Broadway server.
2020-05-16 13:47:18 -04:00
Matthias Clasen b41aeabbec Merge branch 'matthiasc/for-master' into 'master'
broadway: Don't create overlarge images

See merge request GNOME/gtk!1916
2020-05-16 17:01:30 +00:00
Matthias Clasen c0ae36e943 broadway: Create slave devices
The assumption is that the source device in events
is a slave device, so create pointer and keyboard
devices and use them in events.

This fixes the seat test on Broadway.
2020-05-16 12:27:22 -04:00
Matthias Clasen 5851415fca broadway: Don't create overlarge images
Respect that cairo won't create image surfaces larger
than 32767 x 32767.

This makes the one reftest pass that specifically checks
this condition, treeview-crash-too-wide.
2020-05-16 11:27:21 -04:00
Matthias Clasen 36b4b39619 Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

See merge request GNOME/gtk!1915
2020-05-16 15:03:10 +00:00
Yuri Chornoivan d7bf3605b9 Update Ukrainian translation 2020-05-16 14:52:15 +00:00
Matthias Clasen 15211556df Merge branch 'broadway-surface-destroy' into 'master'
Broadway surface destroy

See merge request GNOME/gtk!1914
2020-05-16 14:16:52 +00:00
Matthias Clasen 13f8583934 ci: Don't run opengl renderer tests on Broadway
The test setup mechanism in meson is not flexible
enough to let us run different suites depending
on setup, so just pass in explicitly which suites
we want to skip, depending on the backend.
2020-05-16 10:14:10 -04:00
Matthias Clasen 350110ad9d testsuite: Add a gsk-compare-broadway suite
We have a Broadway renderer, might as well spell
that out in the tests, and make the suite exclude the
3d tests it can't handle.
2020-05-16 10:14:10 -04:00
Matthias Clasen d771aa6fee testsuite: Destroy surfaces
If we don't destroy the surface, it leaks.

GDK backends keep an extra reference on the
surface for the external resources associated
with it, and only drop it in destroy().
2020-05-16 09:12:18 -04:00
Matthias Clasen 4acb56d8c5 broadway: Keep an reference on surfaces
GDK backends are expected to keep a references on
their surfaces as long as they are associated with
external resources, and drop it in destroy().

This showed up as criticals in the shortcuts test
which manually creates and destroys surfaces.
2020-05-16 09:12:07 -04:00
Matthias Clasen afaa9810d1 Merge branch 'matthiasc/for-master' into 'master'
inspector: Use tabular numbers in the fps overlay

See merge request GNOME/gtk!1912
2020-05-16 11:21:00 +00:00
Piotr Drąg 6aa68fcfee Update POTFILES.in and POTFILES.skip 2020-05-16 12:37:01 +02:00
Timm Bäder b2b2070415 Implement diff() for color matrix nodes
This way we don't redraw color matrix nodes all the time.
2020-05-16 08:22:55 +02:00
Matthias Clasen c5b2bbf01b inspector: Use tabular numbers in the fps overlay
It is a lot more readable if it doesn't constantly jitter.
2020-05-15 21:30:14 -04:00
Matthias Clasen f4d3d8e27c Merge branch 'better-ci-reports' into 'master'
ci: Add the backend to the reports

See merge request GNOME/gtk!1911
2020-05-16 00:52:56 +00:00
Matthias Clasen 4f6fa87f00 Merge branch 'wip/carlosg/tablet-disconnects-master' into 'master'
gdk/wayland: Handle disorderly tablet/pad disconnects

See merge request GNOME/gtk!1910
2020-05-15 23:50:54 +00:00
Matthias Clasen 01bd6cfd17 ci: Add the backend to the reports
We want the test names in the junit xml to be
unique across all the tests in a job, so we need
to include the backend in the test name.

And we also want to see the used backend in
the html report.
2020-05-15 19:49:18 -04:00
Carlos Garnacho 000487c36c gdk/wayland: Handle disorderly tablet/pad disconnects
If the tablet gets removed/freed while there are pad events in flight,
we leave a dangling pointer from the pad to the tablet, which may
lead to invalid reads/writes when handling the pad event(s).
2020-05-15 23:40:18 +02:00
Matthias Clasen 5870f1c90a Merge branch 'headless-seatless' into 'master'
gtk: Handle seatless displays

See merge request GNOME/gtk!1905
2020-05-15 21:13:01 +00:00
Matthias Clasen 30ef48143f ci: Ignore Broadway failures
These need some more work, so ignore them for now,
to get the initial multi-backend testsuite into
production.
2020-05-15 15:24:04 -04:00
Matthias Clasen 0232218100 displayclose: Quietly skip if no X available 2020-05-15 14:58:58 -04:00
Matthias Clasen 31cf894092 ci: Run tests with different backends
Run the testsuite under x11, wayland and broadway
in the fedora-x86_64 job. This requires us to use
the v17 image which includes weston.
2020-05-15 14:11:53 -04:00
Matthias Clasen 509db01319 tests: Centralize our test setup a bit
Put all of the constant environment into the
toplevel meson.build file, to reduce repetition
and copy-paste errors.
2020-05-15 14:11:53 -04:00
Matthias Clasen ff4552c842 testsuite: Add test setups for backends
Add test setups that set the GDK_BACKEND and
TEST_OUTPUT_SUBDIR environment variables.

This lets use run
meson test --setup x11 --suite reftest
meson test --setup wayland --suite reftest
and the output will be nicely separated.

We still need to do compositor / display server
setup from the outside.
2020-05-15 14:11:53 -04:00
Matthias Clasen c22af88235 tests: Allow setting a subdir for output
meson seems somewhat weak when it comes to handling
test output. We need to get the output from different
test runs into different locations, and the only
way to communicate from a test setup with the actual
test code seems the environment, so use that.

Make all tests that produce output in files respect
a TEST_OUTPUT_SUBDIR environment variable which specifies
the name of a subdirectory to use. This is combined
with the existing --output argument, which specifies
a per-test location.

Affected tests are reftests, css performance tests
and gsk compare tests.
2020-05-15 14:11:53 -04:00
Matthias Clasen 6719616c36 ci: Fix a typo in the run-docker.sh script 2020-05-15 14:11:53 -04:00
Matthias Clasen 18c7284817 ci: Add weston and weston-libs to the fedora image
We want to run tests under Wayland, using weston
as the compositor. The weston-libs package contains
the headless backend for weston.
2020-05-15 14:11:53 -04:00
Matthias Clasen 8912a6eb75 gtk: Handle seatless displays
If you run weston with the headless backend, you get a Wayland
display with no seat, which is just fine by the protocol.

gdk_display_get_default_seat() returns NULL in this case. Various
widgets assume that we always have a seat with a keyboard and a
pointer, since that is what X guarantees. Make things survive
without that, so we can run the testsuite under a headless
Wayland compositor.
2020-05-15 14:11:53 -04:00
Matthias Clasen 9b7a73268e docs: Clarify gdk_display_get_default_seat() docs
This function can return %NULL if the display
does not have a seat. Document that.
2020-05-15 14:11:53 -04:00
Timm Bäder d4d9644409 Merge branch 'wip/tintou/set_css_classes_array' into 'master'
widget: Add array annotation to set_css_classes

See merge request GNOME/gtk!1907
2020-05-15 11:19:05 +00:00
Corentin Noël 80473ccd69 widget: Add array annotation to set_css_classes
It expects a NULL-terminated array so annotate it.
2020-05-15 12:01:56 +02:00
Jakub Steiner b51a5446ba Merge branch 'wip/jimmac/tabs-again-focus' into 'master'
Adwaita: notebook tab focus tweak

Closes #2721

See merge request GNOME/gtk!1906
2020-05-15 08:17:58 +00:00
Jakub Steiner d7e6fbf8a2 Adwaita: notebook tab focus tweak
Finally fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/2721
2020-05-15 09:34:57 +02:00
Matthias Clasen acae90cc6e Merge branch 'tests-cleanup' into 'master'
Tests cleanup

See merge request GNOME/gtk!1904
2020-05-15 01:38:38 +00:00
Matthias Clasen dcfb4690c3 tests: Drop testdnd3
This has been integrated in gtk4-demo as the
DND example.

See #2738
2020-05-14 20:32:53 -04:00
Matthias Clasen 9e8d845a61 tests: Rename testheaderbar2 to testheaderbar
There is only one headerbar test now.
2020-05-14 20:15:59 -04:00
Matthias Clasen 1e2b5a9c19 tests: Consolidate all headerbar tests
No need to have several binaries for this.

See #2738
2020-05-14 20:15:31 -04:00
Matthias Clasen 4079b782d6 tests: Drop testorientable
Not really that interesting, and it only
tests a single case of orientable, a box.

See #2738
2020-05-14 19:48:08 -04:00
Matthias Clasen dca142d5d2 tests: Drop testemblems
We no longer support emblems on icons.

See #2738
2020-05-14 19:44:54 -04:00
Matthias Clasen 52c630d994 tests: Drop testgiconpixbuf
More a pixbuf test, and we don't support
emblems anymore.

See #2738
2020-05-14 19:44:08 -04:00
Matthias Clasen aadd9ae201 tests: Drop testbuttons
This does not really add much. We have plenty
of different button styles in our demos and
tests.

See #2738
2020-05-14 19:44:05 -04:00
Matthias Clasen 3df0f95ee3 Merge branch 'wip/exalm/kinetic_scrolling' into 'master'
eventcontrollerscroll: Fix the history push condition

See merge request GNOME/gtk!1902
2020-05-14 22:40:54 +00:00
Alexander Mikhaylenko 5dc6194b98 eventcontrollerscroll: Fix the history push condition
Once upon a time, there was a function called gdk_event_get_scroll_deltas().
It returned %TRUE when an event had scroll deltas and that was used as the
condition to decide whether to push scroll deltas to the scroll history,
even when the both deltas are 0 for the stop event at the end of scrolling.

When GtkScrolledWindow kinetic scrolling code was adapted for
GtkEventControllerScroll, it was replaced with a (dx != 0 && dy != 0)
check. This prevented the stop event from getting into the history, and
instead allowed non-smooth scrolling to affect the history as they have
synthetic deltas with one of the values being -1 or 1 and the other on 0.

Instead, check the direction as we already have it as a local variable.
2020-05-15 01:32:04 +05:00
Benjamin Otte d9c0d98871 inspector: Use the monitor list to list monitors 2020-05-13 07:49:56 +02:00
Benjamin Otte dd7d76f389 gdk: Add gdk_display_get_monitors()
Returns a GListModel of GDK_TYPE_MONITOR.

This will replace the current andling of monitors in GdkDisplay.
2020-05-13 07:00:35 +02:00
Benjamin Otte bc88f01165 win32: Use a GListStore for the monitors 2020-05-13 06:45:08 +02:00
Benjamin Otte 7ff69e9356 x11: Use a GListStore for the monitors 2020-05-13 05:22:18 +02:00
Benjamin Otte 188e28e196 display: Remove unused vfunc 2020-05-13 04:51:52 +02:00
Benjamin Otte 3536bdd7a6 wayland: Use a GListStore for the monitors
Guess where this is going...
2020-05-13 04:51:52 +02:00
Benjamin Otte c0c8e93d90 display: Remove gdk_display_get_last_seen_time()
Replace the only usage - in the X11 backend - with an X11-specific call.
2020-05-13 04:48:22 +02:00
163 changed files with 4091 additions and 4603 deletions
+54 -51
View File
@@ -27,14 +27,41 @@ variables:
style-check-diff:
extends: .only-default
image: registry.gitlab.gnome.org/gnome/gtk/fedora:v16
image: registry.gitlab.gnome.org/gnome/gtk/fedora:v17
stage: .pre
allow_failure: true
script:
- .gitlab-ci/run-style-check-diff.sh
.build-fedora-default:
image: registry.gitlab.gnome.org/gnome/gtk/fedora:v17
artifacts:
when: always
reports:
junit:
- "${CI_PROJECT_DIR}/_build/report-x11.xml"
- "${CI_PROJECT_DIR}/_build/report-wayland.xml"
- "${CI_PROJECT_DIR}/_build/report-broadway.xml"
name: "gtk-${CI_COMMIT_REF_NAME}"
paths:
- "${CI_PROJECT_DIR}/_build/meson-logs"
- "${CI_PROJECT_DIR}/_build/report*.xml"
- "${CI_PROJECT_DIR}/_build/report*.html"
- "${CI_PROJECT_DIR}/_build/testsuite/reftests/output/*/*.png"
- "${CI_PROJECT_DIR}/_build/testsuite/gsk/compare/*/*/*.png"
- "${CI_PROJECT_DIR}/_build/testsuite/css/output/*/*.syscap"
cache:
key: "$CI_JOB_NAME"
paths:
- _ccache/
- subprojects/gdk-pixbuf/
- subprojects/glib/
- subprojects/graphene/
- subprojects/libepoxy/
- subprojects/pango/
fedora-x86_64:
image: registry.gitlab.gnome.org/gnome/gtk/fedora:v16
extends: .build-fedora-default
stage: build
variables:
EXTRA_MESON_FLAGS: "--buildtype=debug --default-library=both"
@@ -47,26 +74,12 @@ fedora-x86_64:
-Dprofiler=true
_build
- ninja -C _build
- .gitlab-ci/run-tests.sh _build
artifacts:
when: always
reports:
junit:
- "${CI_PROJECT_DIR}/_build/report.xml"
name: "gtk-${CI_COMMIT_REF_NAME}"
paths:
- "${CI_PROJECT_DIR}/_build/meson-logs"
- "${CI_PROJECT_DIR}/_build/report.xml"
- "${CI_PROJECT_DIR}/_build/report.html"
- "${CI_PROJECT_DIR}/_build/testsuite/reftests/output/*.png"
- "${CI_PROJECT_DIR}/_build/testsuite/gsk/compare/*/*.png"
- "${CI_PROJECT_DIR}/_build/testsuite/css/output/*.syscap"
cache:
key: "$CI_JOB_NAME"
<<: *cache-paths
- .gitlab-ci/run-tests.sh _build x11
- .gitlab-ci/run-tests.sh _build wayland
- .gitlab-ci/run-tests.sh _build broadway
release-build:
image: registry.gitlab.gnome.org/gnome/gtk/fedora:v16
extends: .build-fedora-default
stage: build
variables:
EXTRA_MESON_FLAGS: "--buildtype=release"
@@ -78,25 +91,9 @@ release-build:
-Dvulkan=yes
_build
- ninja -C _build
- .gitlab-ci/run-tests.sh _build
artifacts:
when: always
reports:
junit:
- "${CI_PROJECT_DIR}/_build/report.xml"
name: "gtk-${CI_COMMIT_REF_NAME}"
paths:
- "${CI_PROJECT_DIR}/_build/meson-logs"
- "${CI_PROJECT_DIR}/_build/report.xml"
- "${CI_PROJECT_DIR}/_build/report.html"
- "${CI_PROJECT_DIR}/_build/testsuite/reftests/output/*.png"
- "${CI_PROJECT_DIR}/_build/testsuite/gsk/compare/*/*.png"
- "${CI_PROJECT_DIR}/_build/testsuite/css/output/*.syscap"
cache:
key: "$CI_JOB_NAME"
<<: *cache-paths
- .gitlab-ci/run-tests.sh _build x11
.mingw-defaults: &mingw-defaults
.mingw-defaults:
stage: build
tags:
- win32-ps
@@ -105,15 +102,21 @@ release-build:
- C:\msys64\usr\bin\bash -lc "bash -x ./.gitlab-ci/test-msys2.sh"
cache:
key: "$CI_JOB_NAME"
<<: *cache-paths
paths:
- _ccache/
- subprojects/gdk-pixbuf/
- subprojects/glib/
- subprojects/graphene/
- subprojects/libepoxy/
- subprojects/pango/
msys2-mingw32:
extends: .mingw-defaults
variables:
MSYSTEM: "MINGW32"
CHERE_INVOKING: "yes"
<<: *mingw-defaults
.flatpak-defaults: &flatpak-defaults
.flatpak-defaults:
image: registry.gitlab.gnome.org/gnome/gnome-runtime-images/gnome:master
stage: flatpak
allow_failure: true
@@ -127,45 +130,45 @@ msys2-mingw32:
- bash -x ./.gitlab-ci/flatpak-build.sh "${APPID}"
# Manual jobs, for branches and MRs
.flatpak-manual: &flatpak-manual
<<: *flatpak-defaults
.flatpak-manual:
extends: .flatpak-defaults
when: manual
# Only build Flatpak bundles automatically on master
.flatpak-master: &flatpak-master
<<: *flatpak-defaults
.flatpak-master:
extends: .flatpak-defaults
only:
- master
flatpak-manual:demo:
extends: .flatpak-manual
variables:
APPID: org.gtk.Demo4
<<: *flatpak-manual
flatpak-master:demo:
extends: .flatpak-master
variables:
APPID: org.gtk.Demo4
<<: *flatpak-master
flatpak-manual:widget-factory:
extends: .flatpak-manual
variables:
APPID: org.gtk.WidgetFactory4
<<: *flatpak-manual
flatpak-master:widget-factory:
extends: .flatpak-master
variables:
APPID: org.gtk.WidgetFactory4
<<: *flatpak-master
flatpak-manual:icon-browser:
extends: .flatpak-manual
variables:
APPID: org.gtk.IconBrowser4
<<: *flatpak-manual
flatpak-master:icon-browser:
extends: .flatpak-master
variables:
APPID: org.gtk.IconBrowser4
<<: *flatpak-master
static-scan:
image: registry.gitlab.gnome.org/gnome/gtk/fedora:v16
+2
View File
@@ -78,6 +78,8 @@ RUN dnf -y install \
vulkan-devel \
wayland-devel \
wayland-protocols-devel \
weston \
weston-libs \
which \
xorg-x11-server-Xvfb \
&& dnf clean all
+6 -1
View File
@@ -138,12 +138,13 @@ ul.images li {
</head>
<body>
<header>
<h1>{{ report.project_name }}/{{ report.branch_name }} :: Test Reports</h1>
<h1>{{ report.project_name }}/{{ report.backend }}/{{ report.branch_name }} :: Test Reports</h1>
</header>
<article>
<section>
<div class="report-meta">
<p><strong>Backend:</strong> {{ report.backend }}</p>
<p><strong>Branch:</strong> {{ report.branch_name }}</p>
<p><strong>Date:</strong> <time datetime="{{ report.date.isoformat() }}">{{ report.locale_date }}</time></p>
{% if report.job_id %}<p><strong>Job ID:</strong> {{ report.job_id }}</p>{% endif %}
@@ -259,6 +260,9 @@ aparser = argparse.ArgumentParser(description='Turns a Meson test log into an HT
aparser.add_argument('--project-name', metavar='NAME',
help='The project name',
default='Unknown')
aparser.add_argument('--backend', metavar='NAME',
help='The used backend',
default='unknown')
aparser.add_argument('--job-id', metavar='ID',
help='The job ID for the report',
default=None)
@@ -319,6 +323,7 @@ report = {}
report['date'] = datetime.datetime.utcnow()
report['locale_date'] = report['date'].strftime("%c")
report['project_name'] = args.project_name
report['backend'] = args.backend
report['job_id'] = args.job_id
report['branch_name'] = args.branch
report['total_successes'] = 0
+6 -3
View File
@@ -19,6 +19,9 @@ aparser = argparse.ArgumentParser(description='Turns a Meson test log into a JUn
aparser.add_argument('--project-name', metavar='NAME',
help='The project name',
default='unknown')
aparser.add_argument('--backend', metavar='NAME',
help='The used backend',
default='unknown')
aparser.add_argument('--job-id', metavar='ID',
help='The job ID for the report',
default='Unknown')
@@ -92,18 +95,18 @@ for name, units in suites.items():
for unit in successes:
testcase = ET.SubElement(testsuite, 'testcase')
testcase.set('classname', '{}/{}'.format(args.project_name, unit['suite']))
testcase.set('name', unit['name'])
testcase.set('name', '{}/{}'.format(args.backend, unit['name']))
testcase.set('time', str(unit['duration']))
for unit in failures:
testcase = ET.SubElement(testsuite, 'testcase')
testcase.set('classname', '{}/{}'.format(args.project_name, unit['suite']))
testcase.set('name', unit['name'])
testcase.set('name', '{}/{}'.format(args.backend, unit['name']))
testcase.set('time', str(unit['duration']))
failure = ET.SubElement(testcase, 'failure')
failure.set('classname', '{}/{}'.format(args.project_name, unit['suite']))
failure.set('name', unit['name'])
testcase.set('name', '{}/{}'.format(args.backend, unit['name']))
failure.set('type', 'error')
failure.text = unit['stdout']
+2 -2
View File
@@ -81,7 +81,7 @@ fi
if [ -z $base_version ]; then
base_version="latest"
else
elif [ $base_version != "latest" ]; then
base_version="v$base_version"
fi
@@ -95,7 +95,7 @@ if [ ! -x "$(command -v docker)" ] || [ docker --help |& grep -q podman ]; then
else
echo "Using: Docker"
format=""
CMD="sudo socker"
CMD="sudo docker"
fi
REGISTRY="registry.gitlab.gnome.org"
+57 -12
View File
@@ -5,30 +5,75 @@ set +e
srcdir=$( pwd )
builddir=$1
backend=$2
export GDK_BACKEND=x11
xvfb-run -a -s "-screen 0 1024x768x24" \
meson test -C ${builddir} \
case "${backend}" in
x11)
xvfb-run -a -s "-screen 0 1024x768x24" \
meson test -C ${builddir} \
--print-errorlogs \
--setup=${backend} \
--suite=gtk \
--no-suite=gtk:a11y
--no-suite=gtk:a11y \
--no-suite=gsk-compare-broadway
# Store the exit code for the CI run, but always
# generate the reports
exit_code=$?
# Store the exit code for the CI run, but always
# generate the reports
exit_code=$?
;;
wayland)
export XDG_RUNTIME_DIR="$(mktemp -p $(pwd) -d xdg-runtime-XXXXXX)"
weston --backend=headless-backend.so --socket=wayland-5 &
compositor=$!
export WAYLAND_DISPLAY=wayland-5
meson test -C ${builddir} \
--print-errorlogs \
--setup=${backend} \
--suite=gtk \
--no-suite=gtk:a11y \
--no-suite=gsk-compare-broadway
exit_code=$?
kill ${compositor}
;;
broadway)
export XDG_RUNTIME_DIR="$(mktemp -p $(pwd) -d xdg-runtime-XXXXXX)"
${builddir}/gdk/broadway/gtk4-broadwayd :5 &
server=$!
export BROADWAY_DISPLAY=:5
meson test -C ${builddir} \
--print-errorlogs \
--setup=${backend} \
--suite=gtk \
--no-suite=gtk:a11y \
--no-suite=gsk-compare-opengl
# don't let Broadway failures fail the run, for now
exit_code=0
kill ${server}
;;
esac
cd ${builddir}
$srcdir/.gitlab-ci/meson-junit-report.py \
--project-name=gtk \
--backend=${backend} \
--job-id="${CI_JOB_NAME}" \
--output=report.xml \
meson-logs/testlog.json
--output=report-${backend}.xml \
meson-logs/testlog-${backend}.json
$srcdir/.gitlab-ci/meson-html-report.py \
--project-name=gtk \
--backend=${backend} \
--job-id="${CI_JOB_NAME}" \
--reftest-output-dir="testsuite/reftests/output" \
--output=report.html \
meson-logs/testlog.json
--reftest-output-dir="testsuite/reftests/output/${backend}" \
--output=report-${backend}.html \
meson-logs/testlog-${backend}.json
exit $exit_code
+13 -4
View File
@@ -3,9 +3,9 @@ Overview of Changes in GTK 3.98.4
* Themes
- Refine menu styling
- Add public colors to HighContrast
- Fix scale borders in HighContrast
- Tweak visible focus behavior
- HighConstrast: Add public colors
- HighContrast: Fix scale borders
* CSS:
- Drop the nonstandard -gtk-icon-theme property
@@ -29,6 +29,12 @@ Overview of Changes in GTK 3.98.4
- Drop the homogeneous property
- Add a use-underline property to stack pages
* GtkScale:
- Make area around the trough clickable
* GtkScrolledWindow:
- Fix kinetic scrolling
* GtkTreeView:
- Break reference cycles in unroot
@@ -46,11 +52,13 @@ Overview of Changes in GTK 3.98.4
* Remove gtk_dialog_run
* Wayland:
- Provide a builtin cursor of last resort
* GDK:
- Wayland: Provide a builtin cursor of last resort
- Change the monitor api to use a GListModel
* GSK:
- Don't include renderer-specific headers automatically
- GL: Fix nested rounded clips
* Introspection:
- Assorted annotation fixes
@@ -73,6 +81,7 @@ Overview of Changes in GTK 3.98.4
* Translation updates:
Chinese (Taiwan)
Esperanto
Japanese
Romanian
Spanish
Ukrainian
-3
View File
@@ -146,9 +146,6 @@
/* Have the Xcursor library */
#mesondefine HAVE_XCURSOR
/* Have the XDAMAGE X extension */
#mesondefine HAVE_XDAMAGE
/* Have the XFIXES X extension */
#mesondefine HAVE_XFIXES
+2 -1
View File
@@ -3,4 +3,5 @@ executable('print-editor',
c_args: common_cflags,
dependencies: libgtk_dep,
include_directories: confinc,
gui_app: true)
gui_app: true,
link_args: extra_demo_ldflags)
+1
View File
@@ -1148,6 +1148,7 @@ populate_flowbox (GtkWidget *flowbox)
pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, 110, 70);
gdk_pixbuf_fill (pixbuf, 0xffffffff);
child = gtk_picture_new_for_pixbuf (pixbuf);
gtk_widget_add_css_class (child, "frame");
gtk_flow_box_insert (GTK_FLOW_BOX (flowbox), child, -1);
for (i = 0; i < G_N_ELEMENTS (resources); i++)
+3 -7
View File
@@ -86,14 +86,12 @@ gdk_display_has_pending
gdk_display_is_rgba
gdk_display_is_composited
gdk_display_get_default_group
gdk_display_supports_shapes
gdk_display_supports_input_shapes
gdk_display_get_app_launch_context
gdk_display_notify_startup_complete
gdk_display_get_default_seat
gdk_display_list_seats
gdk_display_get_n_monitors
gdk_display_get_monitor
gdk_display_get_monitors
gdk_display_get_monitor_at_surface
gdk_display_get_clipboard
gdk_display_get_primary_clipboard
@@ -184,11 +182,8 @@ gdk_surface_destroy
gdk_surface_is_destroyed
gdk_surface_get_display
gdk_surface_hide
gdk_surface_is_viewable
gdk_surface_get_mapped
gdk_surface_translate_coordinates
gdk_surface_begin_resize_drag
gdk_surface_begin_move_drag
gdk_surface_beep
gdk_surface_get_scale_factor
gdk_surface_set_opaque_region
@@ -675,6 +670,8 @@ gdk_toplevel_set_deletable
gdk_toplevel_supports_edge_constraints
gdk_toplevel_inhibit_system_shortcuts
gdk_toplevel_restore_system_shortcuts
gdk_toplevel_begin_resize
gdk_toplevel_begin_move
<SUBSECTION Standard>
GDK_TYPE_TOPLEVEL
gdk_toplevel_get_type
@@ -829,7 +826,6 @@ gdk_x11_display_error_trap_pop_ignored
gdk_x11_display_set_cursor_theme
gdk_x11_display_set_surface_scale
gdk_x11_display_get_glx_version
gdk_x11_register_standard_event_type
gdk_x11_screen_get_screen_number
gdk_x11_screen_get_xscreen
gdk_x11_screen_get_window_manager_name
+1
View File
@@ -6617,6 +6617,7 @@ gtk_native_get_for_surface
gtk_native_get_surface
gtk_native_get_renderer
gtk_native_check_resize
gtk_native_get_surface_transform
<SUBSECTION Private>
gtk_native_get_type
+7 -4
View File
@@ -324,7 +324,9 @@
<para>
A number of minor API cleanups have happened in GdkSurface
as well. For example, gdk_surface_input_shape_combine_region()
has been renamed to gdk_surface_set_input_region().
has been renamed to gdk_surface_set_input_region(), and
gdk_surface_begin_resize_drag() has been renamed to
gdk_toplevel_begin_resize().
</para>
</section>
@@ -921,10 +923,11 @@
</section>
<section>
<title>The gtk_window_fullscreen_on_monitor API has changed</title>
<title>Monitor handling has changed</title>
<para>
Instead of a monitor number, gtk_window_fullscreen_on_monitor() now takes a
#GdkMonitor argument.
Instead of a monitor number, #GdkMonitor is now used throughout.
gdk_display_get_monitors() returns the list of monitors that can be queried
or observed for monitors to pass to APIs like gtk_window_fullscreen_on_monitor().
</para>
</section>
+2 -1
View File
@@ -1,3 +1,4 @@
executable('exampleapp',
'exampleapp.c', 'exampleappwin.c', 'main.c',
dependencies: libgtk_dep)
dependencies: libgtk_dep,
c_args: common_cflags)
+2 -1
View File
@@ -4,4 +4,5 @@ app2_resources = gnome.compile_resources('exampleapp2_resources',
executable('exampleapp2',
'exampleapp.c', 'exampleappwin.c', 'main.c', app2_resources,
dependencies: libgtk_dep)
dependencies: libgtk_dep,
c_args: common_cflags)
+2 -1
View File
@@ -4,4 +4,5 @@ app3_resources = gnome.compile_resources('exampleapp3_resources',
executable('exampleapp3',
'exampleapp.c', 'exampleappwin.c', 'main.c', app3_resources,
dependencies: libgtk_dep)
dependencies: libgtk_dep,
c_args: common_cflags)
+2 -1
View File
@@ -4,4 +4,5 @@ app4_resources = gnome.compile_resources('exampleapp4_resources',
executable('exampleapp4',
'exampleapp.c', 'exampleappwin.c', 'main.c', app4_resources,
dependencies: libgtk_dep)
dependencies: libgtk_dep,
c_args: common_cflags)
+2 -1
View File
@@ -6,4 +6,5 @@ app5_schemas = gnome.compile_schemas()
executable('exampleapp5',
'exampleapp.c', 'exampleappwin.c', 'main.c', app5_resources, app5_schemas,
dependencies: libgtk_dep)
dependencies: libgtk_dep,
c_args: common_cflags)
+2 -1
View File
@@ -11,4 +11,5 @@ executable('exampleapp6',
'exampleappprefs.c',
app6_resources,
app6_schemas,
dependencies: libgtk_dep)
dependencies: libgtk_dep,
c_args: common_cflags)
+2 -1
View File
@@ -11,4 +11,5 @@ executable('exampleapp7',
'exampleappprefs.c',
app7_resources,
app7_schemas,
dependencies: libgtk_dep)
dependencies: libgtk_dep,
c_args: common_cflags)
+2 -1
View File
@@ -11,4 +11,5 @@ executable('exampleapp8',
'exampleappprefs.c',
app8_resources,
app8_schemas,
dependencies: libgtk_dep)
dependencies: libgtk_dep,
c_args: common_cflags)
+2 -1
View File
@@ -11,4 +11,5 @@ executable('exampleapp9',
'exampleappprefs.c',
app9_resources,
app9_schemas,
dependencies: libgtk_dep)
dependencies: libgtk_dep,
c_args: common_cflags)
+6 -7
View File
@@ -188,12 +188,11 @@ text_buffer_changed_cb (GtkTextBuffer *buffer,
if (old_n < 3 && n == 3)
{
GNotification *n;
n = g_notification_new ("Three lines of text");
g_notification_set_body (n, "Keep up the good work!");
g_notification_add_button (n, "Start over", "app.clear-all");
g_application_send_notification (G_APPLICATION (app), "three-lines", n);
g_object_unref (n);
GNotification *notification = g_notification_new ("Three lines of text");
g_notification_set_body (notification, "Keep up the good work!");
g_notification_add_button (notification, "Start over", "app.clear-all");
g_application_send_notification (G_APPLICATION (app), "three-lines", notification);
g_object_unref (notification);
}
}
@@ -635,7 +634,7 @@ bloat_pad_class_init (BloatPadClass *class)
}
BloatPad *
static BloatPad *
bloat_pad_new (void)
{
BloatPad *bloat_pad;
-6
View File
@@ -160,12 +160,6 @@ _gdk_broadway_server_new (GdkDisplay *display,
return server;
}
guint32
_gdk_broadway_server_get_last_seen_time (GdkBroadwayServer *server)
{
return 0;
}
static guint32
gdk_broadway_server_send_message_with_size (GdkBroadwayServer *server, BroadwayRequestBase *base,
gsize size, guint32 type, int fd)
-1
View File
@@ -24,7 +24,6 @@ void _gdk_broadway_server_roundtrip (GdkBroadwaySer
gint32 id,
guint32 tag);
gulong _gdk_broadway_server_get_next_serial (GdkBroadwayServer *server);
guint32 _gdk_broadway_server_get_last_seen_time (GdkBroadwayServer *server);
gboolean _gdk_broadway_server_lookahead_event (GdkBroadwayServer *server,
const char *types);
void _gdk_broadway_server_query_mouse (GdkBroadwayServer *server,
-3
View File
@@ -46,9 +46,6 @@ typedef struct _GdkBroadwaySurfaceClass GdkBroadwaySurfaceClass;
GDK_AVAILABLE_IN_ALL
GType gdk_broadway_surface_get_type (void);
GDK_AVAILABLE_IN_ALL
guint32 gdk_broadway_get_last_seen_time (GdkSurface *surface);
G_END_DECLS
#endif /* __GDK_BROADWAY_SURFACE_H__ */
+58 -46
View File
@@ -56,6 +56,8 @@ G_DEFINE_TYPE (GdkBroadwayDisplay, gdk_broadway_display, GDK_TYPE_DISPLAY)
static void
gdk_broadway_display_init (GdkBroadwayDisplay *display)
{
gdk_display_set_input_shapes (GDK_DISPLAY (display), FALSE);
display->id_ht = g_hash_table_new (NULL, NULL);
display->monitor = g_object_new (GDK_TYPE_BROADWAY_MONITOR,
@@ -64,7 +66,7 @@ gdk_broadway_display_init (GdkBroadwayDisplay *display)
gdk_monitor_set_manufacturer (display->monitor, "browser");
gdk_monitor_set_model (display->monitor, "0");
display->scale_factor = 1;
gdk_monitor_set_size (display->monitor, 1024, 768);
gdk_monitor_set_geometry (display->monitor, &(GdkRectangle) { 0, 0, 1024, 768 });
gdk_monitor_set_physical_size (display->monitor, 1024 * 25.4 / 96, 768 * 25.4 / 96);
gdk_monitor_set_scale_factor (display->monitor, 1);
}
@@ -97,7 +99,7 @@ _gdk_broadway_display_size_changed (GdkDisplay *display,
broadway_display->scale_factor = msg->scale;
gdk_monitor_set_size (monitor, msg->width, msg->height);
gdk_monitor_set_geometry (monitor, &(GdkRectangle) { 0, 0, msg->width, msg->height });
gdk_monitor_set_scale_factor (monitor, msg->scale);
gdk_monitor_set_physical_size (monitor, msg->width * 25.4 / 96, msg->height * 25.4 / 96);
@@ -113,7 +115,7 @@ _gdk_broadway_display_size_changed (GdkDisplay *display,
}}
static GdkDevice *
create_core_pointer (GdkDisplay *display)
create_core_pointer (GdkDisplay *display)
{
return g_object_new (GDK_TYPE_BROADWAY_DEVICE,
"name", "Core Pointer",
@@ -125,7 +127,7 @@ create_core_pointer (GdkDisplay *display)
}
static GdkDevice *
create_core_keyboard (GdkDisplay *display)
create_core_keyboard (GdkDisplay *display)
{
return g_object_new (GDK_TYPE_BROADWAY_DEVICE,
"name", "Core Keyboard",
@@ -137,7 +139,31 @@ create_core_keyboard (GdkDisplay *display)
}
static GdkDevice *
create_touchscreen (GdkDisplay *display)
create_pointer (GdkDisplay *display)
{
return g_object_new (GDK_TYPE_BROADWAY_DEVICE,
"name", "Pointer",
"type", GDK_DEVICE_TYPE_SLAVE,
"source", GDK_SOURCE_MOUSE,
"has-cursor", TRUE,
"display", display,
NULL);
}
static GdkDevice *
create_keyboard (GdkDisplay *display)
{
return g_object_new (GDK_TYPE_BROADWAY_DEVICE,
"name", "Keyboard",
"type", GDK_DEVICE_TYPE_SLAVE,
"source", GDK_SOURCE_KEYBOARD,
"has-cursor", FALSE,
"display", display,
NULL);
}
static GdkDevice *
create_touchscreen (GdkDisplay *display)
{
return g_object_new (GDK_TYPE_BROADWAY_DEVICE,
"name", "Touchscreen",
@@ -161,16 +187,23 @@ _gdk_broadway_display_open (const gchar *display_name)
broadway_display->core_pointer = create_core_pointer (display);
broadway_display->core_keyboard = create_core_keyboard (display);
broadway_display->pointer = create_pointer (display);
broadway_display->keyboard = create_keyboard (display);
broadway_display->touchscreen = create_touchscreen (display);
_gdk_device_set_associated_device (broadway_display->core_pointer, broadway_display->core_keyboard);
_gdk_device_set_associated_device (broadway_display->core_keyboard, broadway_display->core_pointer);
_gdk_device_set_associated_device (broadway_display->pointer, broadway_display->core_pointer);
_gdk_device_set_associated_device (broadway_display->keyboard, broadway_display->core_keyboard);
_gdk_device_set_associated_device (broadway_display->touchscreen, broadway_display->core_pointer);
_gdk_device_add_slave (broadway_display->core_pointer, broadway_display->touchscreen);
seat = gdk_seat_default_new_for_master_pair (broadway_display->core_pointer,
broadway_display->core_keyboard);
gdk_display_add_seat (display, seat);
gdk_seat_default_add_slave (GDK_SEAT_DEFAULT (seat), broadway_display->pointer);
gdk_seat_default_add_slave (GDK_SEAT_DEFAULT (seat), broadway_display->keyboard);
gdk_seat_default_add_slave (GDK_SEAT_DEFAULT (seat), broadway_display->touchscreen);
g_object_unref (seat);
@@ -243,13 +276,18 @@ gdk_broadway_display_get_default_group (GdkDisplay *display)
static void
gdk_broadway_display_dispose (GObject *object)
{
GdkBroadwayDisplay *broadway_display = GDK_BROADWAY_DISPLAY (object);
GdkBroadwayDisplay *self = GDK_BROADWAY_DISPLAY (object);
if (broadway_display->event_source)
if (self->event_source)
{
g_source_destroy (broadway_display->event_source);
g_source_unref (broadway_display->event_source);
broadway_display->event_source = NULL;
g_source_destroy (self->event_source);
g_source_unref (self->event_source);
self->event_source = NULL;
}
if (self->monitors)
{
g_list_store_remove_all (self->monitors);
g_clear_object (&self->monitors);
}
G_OBJECT_CLASS (gdk_broadway_display_parent_class)->dispose (object);
@@ -277,18 +315,6 @@ gdk_broadway_display_notify_startup_complete (GdkDisplay *display,
{
}
static gboolean
gdk_broadway_display_supports_shapes (GdkDisplay *display)
{
return FALSE;
}
static gboolean
gdk_broadway_display_supports_input_shapes (GdkDisplay *display)
{
return FALSE;
}
static gulong
gdk_broadway_display_get_next_serial (GdkDisplay *display)
{
@@ -314,22 +340,18 @@ gdk_broadway_display_hide_keyboard (GdkBroadwayDisplay *display)
_gdk_broadway_server_set_show_keyboard (display->server, FALSE);
}
static int
gdk_broadway_display_get_n_monitors (GdkDisplay *display)
static GListModel *
gdk_broadway_display_get_monitors (GdkDisplay *display)
{
return 1;
}
GdkBroadwayDisplay *self = GDK_BROADWAY_DISPLAY (display);
static GdkMonitor *
gdk_broadway_display_get_monitor (GdkDisplay *display,
int monitor_num)
{
GdkBroadwayDisplay *broadway_display = GDK_BROADWAY_DISPLAY (display);
if (self->monitors == NULL)
{
self->monitors = g_list_store_new (GDK_TYPE_MONITOR);
g_list_store_append (self->monitors, self->monitor);
}
if (monitor_num == 0)
return broadway_display->monitor;
return NULL;
return G_LIST_MODEL (self->monitors);
}
static gboolean
@@ -340,12 +362,6 @@ gdk_broadway_display_get_setting (GdkDisplay *display,
return FALSE;
}
static guint32
gdk_broadway_display_get_last_seen_time (GdkDisplay *display)
{
return _gdk_broadway_server_get_last_seen_time (GDK_BROADWAY_DISPLAY (display)->server);
}
typedef struct {
int id;
GdkDisplay *display;
@@ -426,16 +442,12 @@ gdk_broadway_display_class_init (GdkBroadwayDisplayClass * class)
display_class->has_pending = gdk_broadway_display_has_pending;
display_class->queue_events = _gdk_broadway_display_queue_events;
display_class->get_default_group = gdk_broadway_display_get_default_group;
display_class->supports_shapes = gdk_broadway_display_supports_shapes;
display_class->supports_input_shapes = gdk_broadway_display_supports_input_shapes;
display_class->get_next_serial = gdk_broadway_display_get_next_serial;
display_class->notify_startup_complete = gdk_broadway_display_notify_startup_complete;
display_class->create_surface = _gdk_broadway_display_create_surface;
display_class->get_keymap = _gdk_broadway_display_get_keymap;
display_class->get_n_monitors = gdk_broadway_display_get_n_monitors;
display_class->get_monitor = gdk_broadway_display_get_monitor;
display_class->get_monitors = gdk_broadway_display_get_monitors;
display_class->get_setting = gdk_broadway_display_get_setting;
display_class->get_last_seen_time = gdk_broadway_display_get_last_seen_time;
}
+3
View File
@@ -42,6 +42,8 @@ struct _GdkBroadwayDisplay
GdkDevice *core_pointer;
GdkDevice *core_keyboard;
GdkDevice *pointer;
GdkDevice *keyboard;
GdkDevice *touchscreen;
GSource *event_source;
@@ -52,6 +54,7 @@ struct _GdkBroadwayDisplay
GdkBroadwayServer *server;
gpointer move_resize_data;
GListStore *monitors;
GdkMonitor *monitor;
int scale_factor;
+2 -2
View File
@@ -87,8 +87,8 @@ _gdk_broadway_surface_drag_begin (GdkSurface *surface,
GdkDevice *device,
GdkContentProvider *content,
GdkDragAction actions,
gint dx,
gint dy)
double dx,
double dy)
{
GdkDrag *new_context;
+23 -33
View File
@@ -18,7 +18,6 @@
#include "config.h"
#include "gdkeventsource.h"
#include "gdkseat.h"
#include "gdksurfaceprivate.h"
#include "gdkframeclockprivate.h"
@@ -87,13 +86,11 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
BroadwayInputMsg *message)
{
GdkBroadwayDisplay *display_broadway;
GdkSeat *seat;
GdkSurface *surface;
GdkEvent *event = NULL;
GList *node;
display_broadway = GDK_BROADWAY_DISPLAY (display);
seat = gdk_display_get_default_seat (display);
switch (message->base.type) {
case BROADWAY_EVENT_ENTER:
@@ -102,8 +99,8 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
{
event = gdk_crossing_event_new (GDK_ENTER_NOTIFY,
surface,
gdk_seat_get_pointer (seat),
gdk_seat_get_pointer (seat),
display_broadway->core_pointer,
display_broadway->pointer,
message->base.time,
message->pointer.state,
message->pointer.win_x,
@@ -121,8 +118,8 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
{
event = gdk_crossing_event_new (GDK_LEAVE_NOTIFY,
surface,
gdk_seat_get_pointer (seat),
gdk_seat_get_pointer (seat),
display_broadway->core_pointer,
display_broadway->pointer,
message->base.time,
message->pointer.state,
message->pointer.win_x,
@@ -142,8 +139,8 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
if (surface)
{
event = gdk_motion_event_new (surface,
gdk_seat_get_pointer (seat),
gdk_seat_get_pointer (seat),
display_broadway->core_pointer,
display_broadway->pointer,
NULL,
message->base.time,
message->pointer.state,
@@ -169,8 +166,8 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
? GDK_BUTTON_PRESS
: GDK_BUTTON_RELEASE,
surface,
gdk_seat_get_pointer (seat),
gdk_seat_get_pointer (seat),
display_broadway->core_pointer,
display_broadway->pointer,
NULL,
message->base.time,
message->pointer.state,
@@ -189,8 +186,8 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
if (surface)
{
event = gdk_scroll_event_new_discrete (surface,
gdk_seat_get_pointer (seat),
gdk_seat_get_pointer (seat),
display_broadway->core_pointer,
display_broadway->pointer,
NULL,
message->base.time,
0,
@@ -198,7 +195,7 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
? GDK_SCROLL_UP
: GDK_SCROLL_DOWN,
FALSE);
node = _gdk_event_queue_append (display, event);
_gdk_windowing_got_event (display, node, event, message->base.serial);
}
@@ -210,7 +207,6 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
{
GdkEventType event_type = 0;
GdkModifierType state;
GdkDevice *source_device;
switch (message->touch.touch_type) {
case 0:
@@ -230,15 +226,6 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
message->touch.is_emulated && _gdk_broadway_moveresize_handle_event (display, message))
break;
source_device = gdk_seat_get_pointer (seat);
{
GList *devices;
devices = gdk_seat_get_slaves (seat, GDK_SEAT_CAPABILITY_TOUCH);
if (devices)
source_device = GDK_DEVICE (devices->data);
g_list_free (devices);
}
state = message->touch.state;
if (event_type == GDK_TOUCH_BEGIN || event_type == GDK_TOUCH_UPDATE)
state |= GDK_BUTTON1_MASK;
@@ -246,8 +233,8 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
event = gdk_touch_event_new (event_type,
GUINT_TO_POINTER (message->touch.sequence_id),
surface,
gdk_seat_get_pointer (seat),
source_device,
display_broadway->core_pointer,
display_broadway->touchscreen,
message->base.time,
state,
message->touch.win_x,
@@ -275,8 +262,8 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
? GDK_KEY_PRESS
: GDK_KEY_RELEASE,
surface,
gdk_seat_get_keyboard (seat),
gdk_seat_get_keyboard (seat),
display_broadway->core_keyboard,
display_broadway->keyboard,
message->base.time,
message->key.key,
message->key.state,
@@ -291,7 +278,10 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
break;
case BROADWAY_EVENT_GRAB_NOTIFY:
case BROADWAY_EVENT_UNGRAB_NOTIFY:
_gdk_display_device_grab_update (display, gdk_seat_get_pointer (seat), gdk_seat_get_pointer (seat), message->base.serial);
_gdk_display_device_grab_update (display,
display_broadway->core_pointer,
display_broadway->pointer,
message->base.serial);
break;
case BROADWAY_EVENT_CONFIGURE_NOTIFY:
@@ -330,8 +320,8 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
if (surface)
{
event = gdk_focus_event_new (surface,
gdk_seat_get_keyboard (seat),
gdk_seat_get_keyboard (seat),
display_broadway->core_keyboard,
display_broadway->keyboard,
FALSE);
node = _gdk_event_queue_append (display, event);
@@ -341,8 +331,8 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
if (surface)
{
event = gdk_focus_event_new (surface,
gdk_seat_get_keyboard (seat),
gdk_seat_get_keyboard (seat),
display_broadway->core_keyboard,
display_broadway->keyboard,
TRUE);
node = _gdk_event_queue_append (display, event);
+2 -2
View File
@@ -51,8 +51,8 @@ GdkDrag * _gdk_broadway_surface_drag_begin (GdkSurface *surface,
GdkDevice *device,
GdkContentProvider *content,
GdkDragAction actions,
gint dx,
gint dy);
double dx,
double dy);
void _gdk_broadway_surface_translate (GdkSurface *surface,
cairo_region_t *area,
gint dx,
+26 -43
View File
@@ -86,7 +86,7 @@ gdk_broadway_surface_finalize (GObject *object)
broadway_display = GDK_BROADWAY_DISPLAY (gdk_surface_get_display (GDK_SURFACE (impl)));
g_hash_table_remove (broadway_display->id_ht, GINT_TO_POINTER(impl->id));
g_hash_table_remove (broadway_display->id_ht, GINT_TO_POINTER (impl->id));
if (impl->cursor)
g_object_unref (impl->cursor);
@@ -99,7 +99,8 @@ gdk_broadway_surface_finalize (GObject *object)
static gboolean
thaw_updates_cb (GdkSurface *surface)
{
gdk_surface_thaw_updates (surface);
if (!GDK_SURFACE_DESTROYED (surface))
gdk_surface_thaw_updates (surface);
g_object_unref (surface);
return G_SOURCE_REMOVE;
}
@@ -271,6 +272,8 @@ _gdk_broadway_display_create_surface (GdkDisplay *display,
surface->height);
g_hash_table_insert (broadway_display->id_ht, GINT_TO_POINTER(impl->id), surface);
g_object_ref (surface);
if (!surface->parent)
broadway_display->toplevels = g_list_prepend (broadway_display->toplevels, impl);
@@ -320,7 +323,6 @@ _gdk_broadway_surface_destroy (GdkSurface *surface,
g_hash_table_remove (broadway_display->id_ht, GINT_TO_POINTER (impl->id));
_gdk_broadway_server_destroy_surface (broadway_display->server, impl->id);
}
void
@@ -585,7 +587,6 @@ static void
show_popup (GdkSurface *surface)
{
gdk_synthesize_surface_state (surface, GDK_SURFACE_STATE_WITHDRAWN, 0);
_gdk_surface_update_viewable (surface);
gdk_broadway_surface_show (surface, FALSE);
gdk_surface_invalidate_rect (surface, NULL);
}
@@ -777,7 +778,6 @@ gdk_broadway_surface_maximize (GdkSurface *surface)
{
GdkBroadwaySurface *impl;
GdkDisplay *display;
GdkMonitor *monitor;
GdkRectangle geom;
if (GDK_SURFACE_DESTROYED (surface))
@@ -798,8 +798,7 @@ gdk_broadway_surface_maximize (GdkSurface *surface)
impl->pre_maximize_height = surface->height;
display = gdk_surface_get_display (surface);
monitor = gdk_display_get_monitor (display, 0);
gdk_monitor_get_geometry (monitor, &geom);
gdk_monitor_get_geometry (GDK_BROADWAY_DISPLAY (display)->monitor, &geom);
gdk_broadway_surface_move_resize (surface,
geom.x, geom.y,
@@ -1193,18 +1192,17 @@ calculate_unmoving_origin (MoveResizeData *mv_resize)
}
static void
gdk_broadway_surface_begin_resize_drag (GdkSurface *surface,
GdkSurfaceEdge edge,
GdkDevice *device,
gint button,
gint x,
gint y,
guint32 timestamp)
gdk_broadway_toplevel_begin_resize (GdkToplevel *toplevel,
GdkSurfaceEdge edge,
GdkDevice *device,
int button,
double x,
double y,
guint32 timestamp)
{
GdkSurface *surface = GDK_SURFACE (toplevel);
GdkBroadwaySurface *impl = GDK_BROADWAY_SURFACE (surface);
MoveResizeData *mv_resize;
GdkBroadwaySurface *impl;
impl = GDK_BROADWAY_SURFACE (surface);
if (GDK_SURFACE_DESTROYED (surface))
return;
@@ -1236,17 +1234,16 @@ gdk_broadway_surface_begin_resize_drag (GdkSurface *surface,
}
static void
gdk_broadway_surface_begin_move_drag (GdkSurface *surface,
GdkDevice *device,
gint button,
gint x,
gint y,
guint32 timestamp)
gdk_broadway_toplevel_begin_move (GdkToplevel *toplevel,
GdkDevice *device,
int button,
double x,
double y,
guint32 timestamp)
{
GdkSurface *surface = GDK_SURFACE (toplevel);
GdkBroadwaySurface *impl = GDK_BROADWAY_SURFACE (surface);
MoveResizeData *mv_resize;
GdkBroadwaySurface *impl;
impl = GDK_BROADWAY_SURFACE (surface);
if (GDK_SURFACE_DESTROYED (surface))
return;
@@ -1282,15 +1279,6 @@ gdk_broadway_surface_beep (GdkSurface *surface)
return FALSE;
}
guint32
gdk_broadway_get_last_seen_time (GdkSurface *surface)
{
GdkDisplay *display;
display = gdk_surface_get_display (surface);
return _gdk_broadway_server_get_last_seen_time (GDK_BROADWAY_DISPLAY (display)->server);
}
static void
gdk_broadway_surface_class_init (GdkBroadwaySurfaceClass *klass)
{
@@ -1307,8 +1295,6 @@ gdk_broadway_surface_class_init (GdkBroadwaySurfaceClass *klass)
impl_class->set_input_region = gdk_broadway_surface_set_input_region;
impl_class->destroy = _gdk_broadway_surface_destroy;
impl_class->beep = gdk_broadway_surface_beep;
impl_class->begin_resize_drag = gdk_broadway_surface_begin_resize_drag;
impl_class->begin_move_drag = gdk_broadway_surface_begin_move_drag;
impl_class->destroy_notify = gdk_broadway_surface_destroy_notify;
impl_class->drag_begin = _gdk_broadway_surface_drag_begin;
impl_class->get_scale_factor = gdk_broadway_surface_get_scale_factor;
@@ -1578,15 +1564,10 @@ show_surface (GdkSurface *surface)
if (!was_mapped)
gdk_synthesize_surface_state (surface, GDK_SURFACE_STATE_WITHDRAWN, 0);
_gdk_surface_update_viewable (surface);
gdk_broadway_surface_show (surface, FALSE);
if (!was_mapped)
{
if (gdk_surface_is_viewable (surface))
gdk_surface_invalidate_rect (surface, NULL);
}
gdk_surface_invalidate_rect (surface, NULL);
}
static gboolean
@@ -1663,6 +1644,8 @@ gdk_broadway_toplevel_iface_init (GdkToplevelInterface *iface)
iface->lower = gdk_broadway_toplevel_lower;
iface->focus = gdk_broadway_toplevel_focus;
iface->show_window_menu = gdk_broadway_toplevel_show_window_menu;
iface->begin_resize = gdk_broadway_toplevel_begin_resize;
iface->begin_move = gdk_broadway_toplevel_begin_move;
}
typedef struct
+1 -1
View File
@@ -18,7 +18,7 @@ void gdk_pre_parse (void);
void gdk_surface_freeze_toplevel_updates (GdkSurface *surface);
void gdk_surface_thaw_toplevel_updates (GdkSurface *surface);
guint32 gdk_display_get_last_seen_time (GdkDisplay *display);
gboolean gdk_surface_supports_edge_constraints (GdkSurface *surface);
void gdk_display_set_double_click_time (GdkDisplay *display,
guint msec);
+57 -115
View File
@@ -71,6 +71,7 @@ enum
PROP_0,
PROP_COMPOSITED,
PROP_RGBA,
PROP_INPUT_SHAPES,
LAST_PROP
};
@@ -81,8 +82,6 @@ enum {
CLOSED,
SEAT_ADDED,
SEAT_REMOVED,
MONITOR_ADDED,
MONITOR_REMOVED,
SETTING_CHANGED,
LAST_SIGNAL
};
@@ -115,6 +114,10 @@ gdk_display_get_property (GObject *object,
g_value_set_boolean (value, gdk_display_is_rgba (display));
break;
case PROP_INPUT_SHAPES:
g_value_set_boolean (value, gdk_display_supports_input_shapes (display));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
@@ -195,6 +198,19 @@ gdk_display_class_init (GdkDisplayClass *class)
TRUE,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
/**
* GdkDisplay:input-shapes:
*
* %TRUE if the display supports input shapes. See
* gdk_display_supports_input_shapes() for details.
*/
props[PROP_INPUT_SHAPES] =
g_param_spec_boolean ("input-shapes",
P_("Input shapes"),
P_("Input shapes"),
TRUE,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
g_object_class_install_properties (object_class, LAST_PROP, props);
/**
@@ -264,38 +280,6 @@ gdk_display_class_init (GdkDisplayClass *class)
NULL,
G_TYPE_NONE, 1, GDK_TYPE_SEAT);
/**
* GdkDisplay::monitor-added:
* @display: the objedct on which the signal is emitted
* @monitor: the monitor that was just added
*
* The ::monitor-added signal is emitted whenever a monitor is
* added.
*/
signals[MONITOR_ADDED] =
g_signal_new (g_intern_static_string ("monitor-added"),
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST,
0, NULL, NULL,
NULL,
G_TYPE_NONE, 1, GDK_TYPE_MONITOR);
/**
* GdkDisplay::monitor-removed:
* @display: the object on which the signal is emitted
* @monitor: the monitor that was just removed
*
* The ::monitor-removed signal is emitted whenever a monitor is
* removed.
*/
signals[MONITOR_REMOVED] =
g_signal_new (g_intern_static_string ("monitor-removed"),
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST,
0, NULL, NULL,
NULL,
G_TYPE_NONE, 1, GDK_TYPE_MONITOR);
/**
* GdkDisplay::setting-changed:
* @display: the object on which the signal is emitted
@@ -356,6 +340,7 @@ gdk_display_init (GdkDisplay *display)
display->composited = TRUE;
display->rgba = TRUE;
display->input_shapes = TRUE;
}
static void
@@ -1128,23 +1113,6 @@ gdk_display_get_primary_clipboard (GdkDisplay *display)
return display->primary_clipboard;
}
/**
* gdk_display_supports_shapes:
* @display: a #GdkDisplay
*
* Returns %TRUE if gdk_surface_shape_combine_mask() can
* be used to create shaped windows on @display.
*
* Returns: %TRUE if shaped windows are supported
*/
gboolean
gdk_display_supports_shapes (GdkDisplay *display)
{
g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
return GDK_DISPLAY_GET_CLASS (display)->supports_shapes (display);
}
/**
* gdk_display_supports_input_shapes:
* @display: a #GdkDisplay
@@ -1159,7 +1127,21 @@ gdk_display_supports_input_shapes (GdkDisplay *display)
{
g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
return GDK_DISPLAY_GET_CLASS (display)->supports_input_shapes (display);
return display->input_shapes;
}
void
gdk_display_set_input_shapes (GdkDisplay *display,
gboolean input_shapes)
{
g_return_if_fail (GDK_IS_DISPLAY (display));
if (display->input_shapes == input_shapes)
return;
display->input_shapes = input_shapes;
g_object_notify_by_pspec (G_OBJECT (display), props[PROP_INPUT_SHAPES]);
}
static GdkAppLaunchContext *
@@ -1497,7 +1479,10 @@ gdk_display_remove_seat (GdkDisplay *display,
*
* Returns the default #GdkSeat for this display.
*
* Returns: (transfer none): the default seat.
* Note that a display may not have a seat. In this case,
* this function will return %NULL.
*
* Returns: (transfer none) (nullable): the default seat.
**/
GdkSeat *
gdk_display_get_default_seat (GdkDisplay *display)
@@ -1529,44 +1514,25 @@ gdk_display_list_seats (GdkDisplay *display)
}
/**
* gdk_display_get_n_monitors:
* @display: a #GdkDisplay
* gdk_display_get_monitors:
* @self: a #GdkDisplay
*
* Gets the number of monitors that belong to @display.
* Gets the list of monitors associated with this display.
*
* The returned number is valid until the next emission of the
* #GdkDisplay::monitor-added or #GdkDisplay::monitor-removed signal.
* Subsequent calls to this function will always return the same list for the
* same display.
*
* Returns: the number of monitors
* You can listen to the GListModel::items-changed signal on this list
* to monitor changes to the monitor of this display.
*
* Returns: (transfer none): a #GListModel of #GdkMonitor
*/
int
gdk_display_get_n_monitors (GdkDisplay *display)
GListModel *
gdk_display_get_monitors (GdkDisplay *self)
{
g_return_val_if_fail (GDK_IS_DISPLAY (display), 0);
g_return_val_if_fail (GDK_IS_DISPLAY (self), NULL);
if (GDK_DISPLAY_GET_CLASS (display)->get_n_monitors == NULL)
return 1;
return GDK_DISPLAY_GET_CLASS (display)->get_n_monitors (display);
}
/**
* gdk_display_get_monitor:
* @display: a #GdkDisplay
* @monitor_num: number of the monitor
*
* Gets a monitor associated with this display.
*
* Returns: (nullable) (transfer none): the #GdkMonitor, or %NULL if
* @monitor_num is not a valid monitor number
*/
GdkMonitor *
gdk_display_get_monitor (GdkDisplay *display,
gint monitor_num)
{
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
return GDK_DISPLAY_GET_CLASS (display)->get_monitor (display, monitor_num);
return GDK_DISPLAY_GET_CLASS (self)->get_monitors (self);
}
/**
@@ -1585,7 +1551,8 @@ gdk_display_get_monitor_at_surface (GdkDisplay *display,
GdkSurface *surface)
{
GdkRectangle win;
int n_monitors, i;
GListModel *monitors;
guint i;
int area = 0;
GdkMonitor *best = NULL;
GdkDisplayClass *class;
@@ -1605,14 +1572,14 @@ gdk_display_get_monitor_at_surface (GdkDisplay *display,
gdk_surface_get_geometry (surface, &win.x, &win.y, &win.width, &win.height);
gdk_surface_get_origin (surface, &win.x, &win.y);
n_monitors = gdk_display_get_n_monitors (display);
for (i = 0; i < n_monitors; i++)
monitors = gdk_display_get_monitors (display);
for (i = 0; i < g_list_model_get_n_items (monitors); i++)
{
GdkMonitor *monitor;
GdkRectangle mon, intersect;
int overlap;
monitor = gdk_display_get_monitor (display, i);
monitor = g_list_model_get_item (monitors, i);
gdk_monitor_get_geometry (monitor, &mon);
gdk_rectangle_intersect (&win, &mon, &intersect);
overlap = intersect.width *intersect.height;
@@ -1621,26 +1588,12 @@ gdk_display_get_monitor_at_surface (GdkDisplay *display,
area = overlap;
best = monitor;
}
g_object_unref (monitor);
}
return best;
}
void
gdk_display_monitor_added (GdkDisplay *display,
GdkMonitor *monitor)
{
g_signal_emit (display, signals[MONITOR_ADDED], 0, monitor);
}
void
gdk_display_monitor_removed (GdkDisplay *display,
GdkMonitor *monitor)
{
g_signal_emit (display, signals[MONITOR_REMOVED], 0, monitor);
gdk_monitor_invalidate (monitor);
}
void
gdk_display_emit_opened (GdkDisplay *display)
{
@@ -1678,17 +1631,6 @@ gdk_display_setting_changed (GdkDisplay *display,
g_signal_emit (display, signals[SETTING_CHANGED], 0, name);
}
guint32
gdk_display_get_last_seen_time (GdkDisplay *display)
{
g_return_val_if_fail (GDK_IS_DISPLAY (display), GDK_CURRENT_TIME);
if (GDK_DISPLAY_GET_CLASS (display)->get_last_seen_time)
return GDK_DISPLAY_GET_CLASS (display)->get_last_seen_time (display);
return GDK_CURRENT_TIME;
}
void
gdk_display_set_double_click_time (GdkDisplay *display,
guint msec)
+3 -8
View File
@@ -65,6 +65,8 @@ GDK_AVAILABLE_IN_ALL
gboolean gdk_display_is_composited (GdkDisplay *display);
GDK_AVAILABLE_IN_ALL
gboolean gdk_display_is_rgba (GdkDisplay *display);
GDK_AVAILABLE_IN_ALL
gboolean gdk_display_supports_input_shapes (GdkDisplay *display);
GDK_AVAILABLE_IN_ALL
GdkEvent* gdk_display_get_event (GdkDisplay *display);
@@ -87,10 +89,6 @@ GdkClipboard * gdk_display_get_clipboard (GdkDisplay
GDK_AVAILABLE_IN_ALL
GdkClipboard * gdk_display_get_primary_clipboard (GdkDisplay *display);
GDK_AVAILABLE_IN_ALL
gboolean gdk_display_supports_shapes (GdkDisplay *display);
GDK_AVAILABLE_IN_ALL
gboolean gdk_display_supports_input_shapes (GdkDisplay *display);
GDK_AVAILABLE_IN_ALL
void gdk_display_notify_startup_complete (GdkDisplay *display,
const gchar *startup_id);
@@ -107,10 +105,7 @@ GDK_AVAILABLE_IN_ALL
GList * gdk_display_list_seats (GdkDisplay *display);
GDK_AVAILABLE_IN_ALL
int gdk_display_get_n_monitors (GdkDisplay *display);
GDK_AVAILABLE_IN_ALL
GdkMonitor * gdk_display_get_monitor (GdkDisplay *display,
int monitor_num);
GListModel * gdk_display_get_monitors (GdkDisplay *self) G_GNUC_PURE;
GDK_AVAILABLE_IN_ALL
GdkMonitor * gdk_display_get_monitor_at_surface (GdkDisplay *display,
GdkSurface *surface);
+6 -13
View File
@@ -102,6 +102,7 @@ struct _GdkDisplay
#endif /* GDK_RENDERING_VULKAN */
guint rgba : 1;
guint composited : 1;
guint input_shapes : 1;
GdkDebugFlags debug_flags;
@@ -123,9 +124,7 @@ struct _GdkDisplayClass
gboolean (*has_pending) (GdkDisplay *display);
void (*queue_events) (GdkDisplay *display);
void (*make_default) (GdkDisplay *display);
GdkSurface * (*get_default_group) (GdkDisplay *display);
gboolean (*supports_shapes) (GdkDisplay *display);
gboolean (*supports_input_shapes) (GdkDisplay *display);
GdkSurface * (*get_default_group) (GdkDisplay *display);
GdkAppLaunchContext * (*get_app_launch_context) (GdkDisplay *display);
@@ -155,16 +154,12 @@ struct _GdkDisplayClass
GdkSeat * (*get_default_seat) (GdkDisplay *display);
int (*get_n_monitors) (GdkDisplay *display);
GdkMonitor * (*get_monitor) (GdkDisplay *display,
int index);
GdkMonitor * (*get_primary_monitor) (GdkDisplay *display);
GdkMonitor * (*get_monitor_at_surface) (GdkDisplay *display,
GListModel * (*get_monitors) (GdkDisplay *self);
GdkMonitor * (*get_monitor_at_surface) (GdkDisplay *display,
GdkSurface *surface);
gboolean (*get_setting) (GdkDisplay *display,
const char *name,
GValue *value);
guint32 (*get_last_seen_time) (GdkDisplay *display);
void (*set_cursor_theme) (GdkDisplay *display,
const char *name,
int size);
@@ -237,15 +232,13 @@ void gdk_display_set_rgba (GdkDisplay *display
gboolean rgba);
void gdk_display_set_composited (GdkDisplay *display,
gboolean composited);
void gdk_display_set_input_shapes (GdkDisplay *display,
gboolean input_shapes);
void gdk_display_add_seat (GdkDisplay *display,
GdkSeat *seat);
void gdk_display_remove_seat (GdkDisplay *display,
GdkSeat *seat);
void gdk_display_monitor_added (GdkDisplay *display,
GdkMonitor *monitor);
void gdk_display_monitor_removed (GdkDisplay *display,
GdkMonitor *monitor);
void gdk_display_emit_opened (GdkDisplay *display);
void gdk_display_setting_changed (GdkDisplay *display,
+2 -2
View File
@@ -76,8 +76,8 @@ GdkDrag * gdk_drag_begin (GdkSurface *surface,
GdkDevice *device,
GdkContentProvider *content,
GdkDragAction actions,
gint dx,
gint dy);
double dx,
double dy);
GDK_AVAILABLE_IN_ALL
void gdk_drag_drop_done (GdkDrag *drag,
+15 -1
View File
@@ -175,7 +175,6 @@ void gdk_surface_invalidate_region (GdkSurface *surface,
const cairo_region_t *region);
void _gdk_surface_clear_update_area (GdkSurface *surface);
void _gdk_surface_update_size (GdkSurface *surface);
gboolean _gdk_surface_update_viewable (GdkSurface *surface);
GdkGLContext * gdk_surface_get_paint_gl_context (GdkSurface *surface,
GError **error);
void gdk_surface_get_unscaled_size (GdkSurface *surface,
@@ -366,6 +365,21 @@ GdkSurface * gdk_surface_new_temp (GdkDisplay *display,
GdkKeymap * gdk_display_get_keymap (GdkDisplay *display);
void gdk_surface_begin_resize_drag (GdkSurface *surface,
GdkSurfaceEdge edge,
GdkDevice *device,
gint button,
gint x,
gint y,
guint32 timestamp);
void gdk_surface_begin_move_drag (GdkSurface *surface,
GdkDevice *device,
gint button,
gint x,
gint y,
guint32 timestamp);
G_END_DECLS
#endif /* __GDK_INTERNALS_H__ */
+9 -43
View File
@@ -31,10 +31,9 @@
* @Short_description: Object representing an output
*
* GdkMonitor objects represent the individual outputs that are
* associated with a #GdkDisplay. GdkDisplay has APIs to enumerate
* monitors with gdk_display_get_n_monitors() and gdk_display_get_monitor(), and
* to find particular monitors with gdk_display_get_primary_monitor() or
* gdk_display_get_monitor_at_surface().
* associated with a #GdkDisplay. GdkDisplay keeps a #GListModel to enumerate
* and monitor monitors with gdk_display_get_monitors().
* You can use gdk_display_get_monitor_at_surface() to find a particular monitor.
*/
/**
@@ -531,47 +530,14 @@ gdk_monitor_set_connector (GdkMonitor *monitor,
}
void
gdk_monitor_set_position (GdkMonitor *monitor,
int x,
int y)
gdk_monitor_set_geometry (GdkMonitor *monitor,
const GdkRectangle *geometry)
{
g_object_freeze_notify (G_OBJECT (monitor));
if (gdk_rectangle_equal (&monitor->geometry, geometry))
return;
if (monitor->geometry.x != x)
{
monitor->geometry.x = x;
g_object_notify (G_OBJECT (monitor), "geometry");
}
if (monitor->geometry.y != y)
{
monitor->geometry.y = y;
g_object_notify (G_OBJECT (monitor), "geometry");
}
g_object_thaw_notify (G_OBJECT (monitor));
}
void
gdk_monitor_set_size (GdkMonitor *monitor,
int width,
int height)
{
g_object_freeze_notify (G_OBJECT (monitor));
if (monitor->geometry.width != width)
{
monitor->geometry.width = width;
g_object_notify (G_OBJECT (monitor), "geometry");
}
if (monitor->geometry.height != height)
{
monitor->geometry.height = height;
g_object_notify (G_OBJECT (monitor), "geometry");
}
g_object_thaw_notify (G_OBJECT (monitor));
monitor->geometry = *geometry;
g_object_notify (G_OBJECT (monitor), "geometry");
}
void
+2 -6
View File
@@ -61,12 +61,8 @@ void gdk_monitor_set_model (GdkMonitor *monitor,
const char *model);
void gdk_monitor_set_connector (GdkMonitor *monitor,
const char *connector);
void gdk_monitor_set_position (GdkMonitor *monitor,
int x,
int y);
void gdk_monitor_set_size (GdkMonitor *monitor,
int width,
int height);
void gdk_monitor_set_geometry (GdkMonitor *monitor,
const GdkRectangle *geometry);
void gdk_monitor_set_physical_size (GdkMonitor *monitor,
int width_mm,
int height_mm);
+24 -131
View File
@@ -148,11 +148,13 @@ get_monitor_for_rect (GdkDisplay *display,
GdkMonitor *monitor;
GdkRectangle workarea;
GdkRectangle intersection;
gint i;
GListModel *monitors;
guint i;
for (i = 0; i < gdk_display_get_n_monitors (display); i++)
monitors = gdk_display_get_monitors (display);
for (i = 0; i < g_list_model_get_n_items (monitors); i++)
{
monitor = gdk_display_get_monitor (display, i);
monitor = g_list_model_get_item (monitors, i);
gdk_monitor_get_workarea (monitor, &workarea);
if (gdk_rectangle_intersect (&workarea, rect, &intersection))
@@ -163,6 +165,7 @@ get_monitor_for_rect (GdkDisplay *display,
best_monitor = monitor;
}
}
g_object_unref (monitor);
}
return best_monitor;
@@ -960,28 +963,6 @@ gdk_surface_get_mapped (GdkSurface *surface)
return GDK_SURFACE_IS_MAPPED (surface);
}
/**
* gdk_surface_is_viewable:
* @surface: a #GdkSurface
*
* Check if the surface and all ancestors of the surface are
* mapped. (This is not necessarily "viewable" in the X sense, since
* we only check as far as we have GDK surface parents, not to the root
* surface.)
*
* Returns: %TRUE if the surface is viewable
**/
gboolean
gdk_surface_is_viewable (GdkSurface *surface)
{
g_return_val_if_fail (GDK_IS_SURFACE (surface), FALSE);
if (surface->destroyed)
return FALSE;
return surface->viewable;
}
GdkGLContext *
gdk_surface_get_shared_data_gl_context (GdkSurface *surface)
{
@@ -1253,7 +1234,7 @@ gdk_surface_process_updates_internal (GdkSurface *surface)
surface->active_update_area = surface->update_area;
surface->update_area = NULL;
if (gdk_surface_is_viewable (surface))
if (GDK_SURFACE_IS_MAPPED (surface))
{
cairo_region_t *expose_region;
gboolean handled;
@@ -1321,10 +1302,7 @@ gdk_surface_invalidate_rect (GdkSurface *surface,
g_return_if_fail (GDK_IS_SURFACE (surface));
if (GDK_SURFACE_DESTROYED (surface))
return;
if (!surface->viewable)
if (!GDK_SURFACE_IS_MAPPED (surface))
return;
if (!rect)
@@ -1400,10 +1378,10 @@ gdk_surface_invalidate_region (GdkSurface *surface,
g_return_if_fail (GDK_IS_SURFACE (surface));
if (GDK_SURFACE_DESTROYED (surface))
if (!GDK_SURFACE_IS_MAPPED (surface))
return;
if (!surface->viewable || cairo_region_is_empty (region))
if (cairo_region_is_empty (region))
return;
r.x = 0;
@@ -1694,25 +1672,6 @@ gdk_surface_get_device_position (GdkSurface *surface,
*mask = tmp_mask;
}
/* Returns TRUE If the native surface was mapped or unmapped */
static gboolean
set_viewable (GdkSurface *w,
gboolean val)
{
if (w->viewable == val)
return FALSE;
w->viewable = val;
return FALSE;
}
gboolean
_gdk_surface_update_viewable (GdkSurface *surface)
{
return set_viewable (surface, GDK_SURFACE_IS_MAPPED (surface));
}
/**
* gdk_surface_hide:
* @surface: a #GdkSurface
@@ -1746,10 +1705,14 @@ gdk_surface_hide (GdkSurface *surface)
/* May need to break grabs on children */
display = surface->display;
seat = gdk_display_get_default_seat (display);
devices = gdk_seat_get_slaves (seat, GDK_SEAT_CAPABILITY_ALL);
devices = g_list_prepend (devices, gdk_seat_get_keyboard (seat));
devices = g_list_prepend (devices, gdk_seat_get_pointer (seat));
if (seat)
{
devices = gdk_seat_get_slaves (seat, GDK_SEAT_CAPABILITY_ALL);
devices = g_list_prepend (devices, gdk_seat_get_keyboard (seat));
devices = g_list_prepend (devices, gdk_seat_get_pointer (seat));
}
else
devices = NULL;
for (d = devices; d; d = d->next)
{
@@ -2079,17 +2042,14 @@ gdk_surface_get_root_coords (GdkSurface *surface,
* corresponds to an unset bit in the mask will be passed on the
* surface below @surface.
*
* An input shape is typically used with RGBA surfaces.
* An input region is typically used with RGBA surfaces.
* The alpha channel of the surface defines which pixels are
* invisible and allows for nicely antialiased borders,
* and the input shape controls where the surface is
* and the input region controls where the surface is
* “clickable”.
*
* On the X11 platform, this requires version 1.1 of the
* shape extension.
*
* On the Win32 platform, this functionality is not present and the
* function does nothing.
* Use gdk_display_support_input_shapes() to find out if
* a particular backend supports input regions.
*/
void
gdk_surface_set_input_region (GdkSurface *surface,
@@ -2396,71 +2356,6 @@ gdk_surface_create_similar_surface (GdkSurface * surface,
return similar_surface;
}
/**
* gdk_surface_begin_resize_drag:
* @surface: a toplevel #GdkSurface
* @edge: the edge or corner from which the drag is started
* @device: the device used for the operation
* @button: the button being used to drag, or 0 for a keyboard-initiated drag
* @x: surface X coordinate of mouse click that began the drag
* @y: surface Y coordinate of mouse click that began the drag
* @timestamp: timestamp of mouse click that began the drag (use gdk_event_get_time())
*
* Begins a surface resize operation (for a toplevel surface).
* You might use this function to implement a “window resize grip,”
*/
void
gdk_surface_begin_resize_drag (GdkSurface *surface,
GdkSurfaceEdge edge,
GdkDevice *device,
gint button,
gint x,
gint y,
guint32 timestamp)
{
if (device == NULL)
{
GdkSeat *seat = gdk_display_get_default_seat (surface->display);
if (button == 0)
device = gdk_seat_get_keyboard (seat);
else
device = gdk_seat_get_pointer (seat);
}
GDK_SURFACE_GET_CLASS (surface)->begin_resize_drag (surface, edge, device, button, x, y, timestamp);
}
/**
* gdk_surface_begin_move_drag:
* @surface: a toplevel #GdkSurface
* @device: the device used for the operation
* @button: the button being used to drag, or 0 for a keyboard-initiated drag
* @x: surface X coordinate of mouse click that began the drag
* @y: surface Y coordinate of mouse click that began the drag
* @timestamp: timestamp of mouse click that began the drag
*
* Begins a surface move operation (for a toplevel surface).
*/
void
gdk_surface_begin_move_drag (GdkSurface *surface,
GdkDevice *device,
gint button,
gint x,
gint y,
guint32 timestamp)
{
if (device == NULL)
{
GdkSeat *seat = gdk_display_get_default_seat (surface->display);
if (button == 0)
device = gdk_seat_get_keyboard (seat);
else
device = gdk_seat_get_pointer (seat);
}
GDK_SURFACE_GET_CLASS (surface)->begin_move_drag (surface, device, button, x, y, timestamp);
}
/* This function is called when the XWindow is really gone.
*/
void
@@ -2500,8 +2395,8 @@ gdk_drag_begin (GdkSurface *surface,
GdkDevice *device,
GdkContentProvider *content,
GdkDragAction actions,
gint dx,
gint dy)
double dx,
double dy)
{
g_return_val_if_fail (GDK_IS_SURFACE (surface), NULL);
g_return_val_if_fail (GDK_IS_DEVICE (device), NULL);
@@ -2783,8 +2678,6 @@ gdk_surface_set_state (GdkSurface *surface,
mapped = GDK_SURFACE_IS_MAPPED (surface);
sticky = GDK_SURFACE_IS_STICKY (surface);
_gdk_surface_update_viewable (surface);
if (GDK_IS_TOPLEVEL (surface))
g_object_notify (G_OBJECT (surface), "state");
-20
View File
@@ -160,9 +160,6 @@ GDK_AVAILABLE_IN_ALL
void gdk_surface_set_input_region (GdkSurface *surface,
cairo_region_t *region);
GDK_AVAILABLE_IN_ALL
gboolean gdk_surface_is_viewable (GdkSurface *surface);
GDK_AVAILABLE_IN_ALL
gboolean gdk_surface_get_mapped (GdkSurface *surface);
@@ -208,23 +205,6 @@ cairo_surface_t *
GDK_AVAILABLE_IN_ALL
void gdk_surface_beep (GdkSurface *surface);
GDK_AVAILABLE_IN_ALL
void gdk_surface_begin_resize_drag (GdkSurface *surface,
GdkSurfaceEdge edge,
GdkDevice *device,
gint button,
gint x,
gint y,
guint32 timestamp);
GDK_AVAILABLE_IN_ALL
void gdk_surface_begin_move_drag (GdkSurface *surface,
GdkDevice *device,
gint button,
gint x,
gint y,
guint32 timestamp);
GDK_AVAILABLE_IN_ALL
void gdk_surface_queue_expose (GdkSurface *surface);
+6 -20
View File
@@ -71,7 +71,6 @@ struct _GdkSurface
guint destroyed : 2;
guint support_multidevice : 1;
guint viewable : 1; /* mapped and all parents mapped */
guint in_update : 1;
guint frame_clock_events_paused : 1;
guint autohide : 1;
@@ -149,26 +148,13 @@ struct _GdkSurfaceClass
/* optional */
gboolean (* beep) (GdkSurface *surface);
void (* begin_resize_drag) (GdkSurface *surface,
GdkSurfaceEdge edge,
GdkDevice *device,
gint button,
gint root_x,
gint root_y,
guint32 timestamp);
void (* begin_move_drag) (GdkSurface *surface,
GdkDevice *device,
gint button,
gint root_x,
gint root_y,
guint32 timestamp);
void (* destroy_notify) (GdkSurface *surface);
GdkDrag * (* drag_begin) (GdkSurface *surface,
GdkDevice *device,
GdkContentProvider*content,
GdkDragAction actions,
gint dx,
gint dy);
GdkDrag * (* drag_begin) (GdkSurface *surface,
GdkDevice *device,
GdkContentProvider *content,
GdkDragAction actions,
double dx,
double dy);
gint (* get_scale_factor) (GdkSurface *surface);
void (* get_unscaled_size) (GdkSurface *surface,
+81
View File
@@ -23,6 +23,8 @@
#include "gdk-private.h"
#include "gdktoplevelprivate.h"
#include <math.h>
/**
* SECTION:gdktoplevel
* @Short_description: Interface for toplevel surfaces
@@ -512,3 +514,82 @@ gdk_toplevel_restore_system_shortcuts (GdkToplevel *toplevel)
GDK_TOPLEVEL_GET_IFACE (toplevel)->restore_system_shortcuts (toplevel);
}
/**
* gdk_toplevel_begin_resize:
* @toplevel: a #GdkToplevel
* @edge: the edge or corner from which the drag is started
* @device: (nullable): the device used for the operation
* @button: the button being used to drag, or 0 for a keyboard-initiated drag
* @x: surface X coordinate of mouse click that began the drag
* @y: surface Y coordinate of mouse click that began the drag
* @timestamp: timestamp of mouse click that began the drag (use gdk_event_get_time())
*
* Begins an interactive resize operation (for a toplevel surface).
* You might use this function to implement a window resize grip.
*/
void
gdk_toplevel_begin_resize (GdkToplevel *toplevel,
GdkSurfaceEdge edge,
GdkDevice *device,
int button,
double x,
double y,
guint32 timestamp)
{
g_return_if_fail (GDK_IS_TOPLEVEL (toplevel));
if (device == NULL)
{
GdkSeat *seat = gdk_display_get_default_seat (GDK_SURFACE (toplevel)->display);
if (button == 0)
device = gdk_seat_get_keyboard (seat);
else
device = gdk_seat_get_pointer (seat);
}
GDK_TOPLEVEL_GET_IFACE (toplevel)->begin_resize (toplevel,
edge,
device,
button,
x, y,
timestamp);
}
/**
* gdk_toplevel_begin_move:
* @toplevel: a #GdkToplevel
* @device: the device used for the operation
* @button: the button being used to drag, or 0 for a keyboard-initiated drag
* @x: surface X coordinate of mouse click that began the drag
* @y: surface Y coordinate of mouse click that began the drag
* @timestamp: timestamp of mouse click that began the drag
*
* Begins an interactive move operation (for a toplevel surface).
* You might use this function to implement draggable titlebars.
*/
void
gdk_toplevel_begin_move (GdkToplevel *toplevel,
GdkDevice *device,
int button,
double x,
double y,
guint32 timestamp)
{
g_return_if_fail (GDK_IS_TOPLEVEL (toplevel));
if (device == NULL)
{
GdkSeat *seat = gdk_display_get_default_seat (GDK_SURFACE (toplevel)->display);
if (button == 0)
device = gdk_seat_get_keyboard (seat);
else
device = gdk_seat_get_pointer (seat);
}
GDK_TOPLEVEL_GET_IFACE (toplevel)->begin_move (toplevel,
device,
button,
x, y,
timestamp);
}
+17
View File
@@ -95,6 +95,23 @@ void gdk_toplevel_inhibit_system_shortcuts (GdkToplevel *toplevel,
GDK_AVAILABLE_IN_ALL
void gdk_toplevel_restore_system_shortcuts (GdkToplevel *toplevel);
GDK_AVAILABLE_IN_ALL
void gdk_toplevel_begin_resize (GdkToplevel *toplevel,
GdkSurfaceEdge edge,
GdkDevice *device,
int button,
double x,
double y,
guint32 timestamp);
GDK_AVAILABLE_IN_ALL
void gdk_toplevel_begin_move (GdkToplevel *toplevel,
GdkDevice *device,
int button,
double x,
double y,
guint32 timestamp);
G_END_DECLS
+13
View File
@@ -24,6 +24,19 @@ struct _GdkToplevelInterface
void (* inhibit_system_shortcuts) (GdkToplevel *toplevel,
GdkEvent *event);
void (* restore_system_shortcuts) (GdkToplevel *toplevel);
void (* begin_resize) (GdkToplevel *toplevel,
GdkSurfaceEdge edge,
GdkDevice *device,
int button,
double x,
double y,
guint32 timestamp);
void (* begin_move) (GdkToplevel *toplevel,
GdkDevice *device,
int button,
double x,
double y,
guint32 timestamp);
};
typedef enum
+8
View File
@@ -2788,6 +2788,14 @@ _gdk_wayland_seat_remove_tablet (GdkWaylandSeat *seat,
gdk_seat_device_removed (GDK_SEAT (seat), tablet->eraser_device);
gdk_seat_device_removed (GDK_SEAT (seat), tablet->master);
while (tablet->pads)
{
GdkWaylandTabletPadData *pad = tablet->pads->data;
pad->current_tablet = NULL;
tablet->pads = g_list_remove (tablet->pads, pad);
}
zwp_tablet_v2_destroy (tablet->wp_tablet);
_gdk_device_set_associated_device (tablet->master, NULL);
+54 -86
View File
@@ -741,7 +741,8 @@ gdk_wayland_display_finalize (GObject *object)
display_wayland->cursor_theme = NULL;
}
g_ptr_array_free (display_wayland->monitors, TRUE);
g_list_store_remove_all (display_wayland->monitors);
g_object_unref (display_wayland->monitors);
if (display_wayland->settings)
g_hash_table_destroy (display_wayland->settings);
@@ -847,18 +848,6 @@ gdk_wayland_display_get_default_group (GdkDisplay *display)
return NULL;
}
static gboolean
gdk_wayland_display_supports_shapes (GdkDisplay *display)
{
return FALSE;
}
static gboolean
gdk_wayland_display_supports_input_shapes (GdkDisplay *display)
{
return TRUE;
}
static gulong
gdk_wayland_display_get_next_serial (GdkDisplay *display)
{
@@ -931,10 +920,13 @@ gdk_wayland_display_notify_startup_complete (GdkDisplay *display,
static GdkKeymap *
_gdk_wayland_display_get_keymap (GdkDisplay *display)
{
GdkSeat *seat;
GdkDevice *core_keyboard = NULL;
static GdkKeymap *tmp_keymap = NULL;
core_keyboard = gdk_seat_get_keyboard (gdk_display_get_default_seat (display));
seat = gdk_display_get_default_seat (display);
if (seat)
core_keyboard = gdk_seat_get_keyboard (seat);
if (core_keyboard && tmp_keymap)
{
@@ -951,24 +943,12 @@ _gdk_wayland_display_get_keymap (GdkDisplay *display)
return tmp_keymap;
}
static int
gdk_wayland_display_get_n_monitors (GdkDisplay *display)
static GListModel *
gdk_wayland_display_get_monitors (GdkDisplay *display)
{
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (display);
GdkWaylandDisplay *self = GDK_WAYLAND_DISPLAY (display);
return display_wayland->monitors->len;
}
static GdkMonitor *
gdk_wayland_display_get_monitor (GdkDisplay *display,
int monitor_num)
{
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (display);
if (monitor_num < 0 || monitor_num >= display_wayland->monitors->len)
return NULL;
return (GdkMonitor *)display_wayland->monitors->pdata[monitor_num];
return G_LIST_MODEL (self->monitors);
}
static GdkMonitor *
@@ -977,7 +957,7 @@ gdk_wayland_display_get_monitor_at_surface (GdkDisplay *display,
{
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (display);
struct wl_output *output;
int i;
guint i, n;
g_return_val_if_fail (GDK_IS_WAYLAND_SURFACE (window), NULL);
@@ -985,9 +965,12 @@ gdk_wayland_display_get_monitor_at_surface (GdkDisplay *display,
if (output == NULL)
return NULL;
for (i = 0; i < display_wayland->monitors->len; i++)
n = g_list_model_get_n_items (G_LIST_MODEL (display_wayland->monitors));
for (i = 0; i < n; i++)
{
GdkMonitor *monitor = display_wayland->monitors->pdata[i];
GdkMonitor *monitor = g_list_model_get_item (G_LIST_MODEL (display_wayland->monitors), i);
g_object_unref (monitor);
if (gdk_wayland_monitor_get_wl_output (monitor) == output)
return monitor;
@@ -1024,8 +1007,6 @@ gdk_wayland_display_class_init (GdkWaylandDisplayClass *class)
display_class->has_pending = gdk_wayland_display_has_pending;
display_class->queue_events = _gdk_wayland_display_queue_events;
display_class->get_default_group = gdk_wayland_display_get_default_group;
display_class->supports_shapes = gdk_wayland_display_supports_shapes;
display_class->supports_input_shapes = gdk_wayland_display_supports_input_shapes;
display_class->get_app_launch_context = _gdk_wayland_display_get_app_launch_context;
display_class->get_next_serial = gdk_wayland_display_get_next_serial;
display_class->get_startup_notification_id = gdk_wayland_display_get_startup_notification_id;
@@ -1035,8 +1016,7 @@ gdk_wayland_display_class_init (GdkWaylandDisplayClass *class)
display_class->make_gl_context_current = gdk_wayland_display_make_gl_context_current;
display_class->get_n_monitors = gdk_wayland_display_get_n_monitors;
display_class->get_monitor = gdk_wayland_display_get_monitor;
display_class->get_monitors = gdk_wayland_display_get_monitors;
display_class->get_monitor_at_surface = gdk_wayland_display_get_monitor_at_surface;
display_class->get_setting = gdk_wayland_display_get_setting;
display_class->set_cursor_theme = gdk_wayland_display_set_cursor_theme;
@@ -1047,7 +1027,7 @@ gdk_wayland_display_init (GdkWaylandDisplay *display)
{
display->xkb_context = xkb_context_new (0);
display->monitors = g_ptr_array_new_with_free_func (g_object_unref);
display->monitors = g_list_store_new (GDK_TYPE_MONITOR);
}
GList *
@@ -2201,16 +2181,21 @@ update_scale (GdkDisplay *display)
}
static void
gdk_wayland_display_init_xdg_output (GdkWaylandDisplay *display_wayland)
gdk_wayland_display_init_xdg_output (GdkWaylandDisplay *self)
{
int i;
guint i, n;
GDK_NOTE (MISC,
g_message ("init xdg-output support, %d monitor(s) already present",
display_wayland->monitors->len));
g_list_model_get_n_items (G_LIST_MODEL (self->monitors))));
for (i = 0; i < display_wayland->monitors->len; i++)
gdk_wayland_display_get_xdg_output (display_wayland->monitors->pdata[i]);
n = g_list_model_get_n_items (G_LIST_MODEL (self->monitors));
for (i = 0; i < n; i++)
{
GdkWaylandMonitor *monitor = g_list_model_get_item (G_LIST_MODEL (self->monitors), i);
gdk_wayland_display_get_xdg_output (monitor);
g_object_unref (monitor);
}
}
static gboolean
@@ -2251,8 +2236,10 @@ apply_monitor_change (GdkWaylandMonitor *monitor)
monitor->x, monitor->y,
monitor->width, monitor->height));
gdk_monitor_set_position (GDK_MONITOR (monitor), monitor->x, monitor->y);
gdk_monitor_set_size (GDK_MONITOR (monitor), monitor->width, monitor->height);
gdk_monitor_set_geometry (GDK_MONITOR (monitor),
&(GdkRectangle) {
monitor->x, monitor->y,
monitor->width, monitor->height });
gdk_monitor_set_connector (GDK_MONITOR (monitor), monitor->name);
monitor->wl_output_done = FALSE;
monitor->xdg_output_done = FALSE;
@@ -2486,9 +2473,6 @@ gdk_wayland_display_add_output (GdkWaylandDisplay *display_wayland,
monitor->output = output;
monitor->version = version;
g_ptr_array_add (display_wayland->monitors, monitor);
gdk_display_monitor_added (GDK_DISPLAY (display_wayland), GDK_MONITOR (monitor));
wl_output_add_listener (output, &output_listener, monitor);
GDK_NOTE (MISC,
@@ -2497,45 +2481,24 @@ gdk_wayland_display_add_output (GdkWaylandDisplay *display_wayland,
if (display_has_xdg_output_support (display_wayland))
gdk_wayland_display_get_xdg_output (monitor);
}
struct wl_output *
gdk_wayland_display_get_wl_output (GdkDisplay *display,
gint monitor_num)
{
GdkWaylandMonitor *monitor;
g_list_store_append (display_wayland->monitors, monitor);
monitor = GDK_WAYLAND_DISPLAY (display)->monitors->pdata[monitor_num];
return monitor->output;
g_object_unref (monitor);
}
static GdkWaylandMonitor *
get_monitor_for_id (GdkWaylandDisplay *display_wayland,
guint32 id)
{
int i;
for (i = 0; i < display_wayland->monitors->len; i++)
{
GdkWaylandMonitor *monitor = display_wayland->monitors->pdata[i];
if (monitor->id == id)
return monitor;
}
return NULL;
}
static GdkWaylandMonitor *
get_monitor_for_output (GdkWaylandDisplay *display_wayland,
get_monitor_for_output (GdkWaylandDisplay *self,
struct wl_output *output)
{
int i;
guint i, n;
for (i = 0; i < display_wayland->monitors->len; i++)
n = g_list_model_get_n_items (G_LIST_MODEL (self->monitors));
for (i = 0; i < n; i++)
{
GdkWaylandMonitor *monitor = display_wayland->monitors->pdata[i];
GdkWaylandMonitor *monitor = g_list_model_get_item (G_LIST_MODEL (self->monitors), i);
g_object_unref (monitor);
if (monitor->output == output)
return monitor;
@@ -2552,18 +2515,23 @@ gdk_wayland_display_get_monitor_for_output (GdkDisplay *display,
}
static void
gdk_wayland_display_remove_output (GdkWaylandDisplay *display_wayland,
gdk_wayland_display_remove_output (GdkWaylandDisplay *self,
guint32 id)
{
GdkWaylandMonitor *monitor;
guint i, n;
monitor = get_monitor_for_id (display_wayland, id);
if (monitor != NULL)
n = g_list_model_get_n_items (G_LIST_MODEL (self->monitors));
for (i = 0; i < n; i++)
{
g_object_ref (monitor);
g_ptr_array_remove (display_wayland->monitors, monitor);
gdk_display_monitor_removed (GDK_DISPLAY (display_wayland), GDK_MONITOR (monitor));
update_scale (GDK_DISPLAY (display_wayland));
GdkWaylandMonitor *monitor = g_list_model_get_item (G_LIST_MODEL (self->monitors), i);
if (monitor->id == id)
{
g_list_store_remove (self->monitors, i);
gdk_monitor_invalidate (GDK_MONITOR (monitor));
update_scale (GDK_DISPLAY (self));
}
g_object_unref (monitor);
}
}
+1 -1
View File
@@ -141,7 +141,7 @@ struct _GdkWaylandDisplay
struct xkb_context *xkb_context;
GPtrArray *monitors;
GListStore *monitors;
gint64 last_bell_time_ms;
+2 -2
View File
@@ -352,8 +352,8 @@ _gdk_wayland_surface_drag_begin (GdkSurface *surface,
GdkDevice *device,
GdkContentProvider *content,
GdkDragAction actions,
gint dx,
gint dy)
double dx,
double dy)
{
GdkWaylandDrag *drag_wayland;
GdkDrag *drag;
+2 -4
View File
@@ -103,8 +103,8 @@ GdkDrag *_gdk_wayland_surface_drag_begin (GdkSurface *surface,
GdkDevice *device,
GdkContentProvider *content,
GdkDragAction actions,
gint dx,
gint dy);
double dx,
double dy);
void _gdk_wayland_surface_offset_next_wl_buffer (GdkSurface *surface,
int x,
int y);
@@ -161,8 +161,6 @@ int gdk_wayland_display_get_output_refresh_rate (GdkWaylandDisplay *display_wayl
struct wl_output *output);
guint32 gdk_wayland_display_get_output_scale (GdkWaylandDisplay *display_wayland,
struct wl_output *output);
struct wl_output *gdk_wayland_display_get_wl_output (GdkDisplay *display,
int monitor_num);
GdkMonitor *gdk_wayland_display_get_monitor_for_output (GdkDisplay *display,
struct wl_output *output);
+59 -48
View File
@@ -744,9 +744,15 @@ _gdk_wayland_display_create_surface (GdkDisplay *display,
g_object_ref (surface);
/* More likely to be right than just assuming 1 */
if (display_wayland->compositor_version >= WL_SURFACE_HAS_BUFFER_SCALE &&
gdk_display_get_n_monitors (display) > 0)
impl->scale = gdk_monitor_get_scale_factor (gdk_display_get_monitor (display, 0));
if (display_wayland->compositor_version >= WL_SURFACE_HAS_BUFFER_SCALE)
{
GdkMonitor *monitor = g_list_model_get_item (gdk_display_get_monitors (display), 0);
if (monitor)
{
impl->scale = gdk_monitor_get_scale_factor (monitor);
g_object_unref (monitor);
}
}
gdk_wayland_surface_set_title (surface, get_default_title ());
@@ -2686,11 +2692,13 @@ gdk_wayland_surface_hide (GdkSurface *surface)
GdkSeat *seat;
seat = gdk_display_get_default_seat (surface->display);
if (seat)
{
if (surface->autohide)
gdk_seat_ungrab (seat);
if (surface->autohide)
gdk_seat_ungrab (seat);
gdk_wayland_seat_clear_touchpoints (GDK_WAYLAND_SEAT (seat), surface);
gdk_wayland_seat_clear_touchpoints (GDK_WAYLAND_SEAT (seat), surface);
}
gdk_wayland_surface_hide_surface (surface);
_gdk_surface_clear_update_area (surface);
}
@@ -2923,28 +2931,34 @@ gdk_wayland_surface_present_popup (GdkSurface *surface,
{
if (surface->autohide)
{
GrabPrepareData data;
GdkGrabStatus result;
GdkSeat *seat;
data = (GrabPrepareData) {
.width = width,
.height = height,
.layout = layout,
};
result = gdk_seat_grab (gdk_display_get_default_seat (surface->display),
surface,
GDK_SEAT_CAPABILITY_ALL,
TRUE,
NULL, NULL,
show_grabbing_popup, &data);
if (result != GDK_GRAB_SUCCESS)
seat = gdk_display_get_default_seat (surface->display);
if (seat)
{
const char *grab_status[] = {
"success", "already grabbed", "invalid time",
"not viewable", "frozen", "failed"
GrabPrepareData data;
GdkGrabStatus result;
data = (GrabPrepareData) {
.width = width,
.height = height,
.layout = layout,
};
g_warning ("Grab failed: %s", grab_status[result]);
result = gdk_seat_grab (seat,
surface,
GDK_SEAT_CAPABILITY_ALL,
TRUE,
NULL, NULL,
show_grabbing_popup, &data);
if (result != GDK_GRAB_SUCCESS)
{
const char *grab_status[] = {
"success", "already grabbed", "invalid time",
"not viewable", "frozen", "failed"
};
g_warning ("Grab failed: %s", grab_status[result]);
}
}
}
else
@@ -3612,14 +3626,15 @@ gdk_wayland_surface_unfullscreen (GdkSurface *surface)
}
static void
gdk_wayland_surface_begin_resize_drag (GdkSurface *surface,
GdkSurfaceEdge edge,
GdkDevice *device,
gint button,
gint x,
gint y,
guint32 timestamp)
gdk_wayland_toplevel_begin_resize (GdkToplevel *toplevel,
GdkSurfaceEdge edge,
GdkDevice *device,
int button,
double x,
double y,
guint32 timestamp)
{
GdkSurface *surface = GDK_SURFACE (toplevel);
GdkWaylandSurface *impl;
GdkWaylandDisplay *display_wayland;
GdkEventSequence *sequence;
@@ -3664,7 +3679,7 @@ gdk_wayland_surface_begin_resize_drag (GdkSurface *surface,
break;
default:
g_warning ("gdk_surface_begin_resize_drag: bad resize edge %d!", edge);
g_warning ("gdk_toplevel_begin_resize: bad resize edge %d!", edge);
return;
}
@@ -3698,13 +3713,14 @@ gdk_wayland_surface_begin_resize_drag (GdkSurface *surface,
}
static void
gdk_wayland_surface_begin_move_drag (GdkSurface *surface,
GdkDevice *device,
gint button,
gint x,
gint y,
guint32 timestamp)
gdk_wayland_toplevel_begin_move (GdkToplevel *toplevel,
GdkDevice *device,
int button,
double x,
double y,
guint32 timestamp)
{
GdkSurface *surface = GDK_SURFACE (toplevel);
GdkWaylandSurface *impl;
GdkWaylandDisplay *display_wayland;
GdkEventSequence *sequence;
@@ -3887,8 +3903,6 @@ gdk_wayland_surface_class_init (GdkWaylandSurfaceClass *klass)
impl_class->destroy = gdk_wayland_surface_destroy;
impl_class->beep = gdk_wayland_surface_beep;
impl_class->begin_resize_drag = gdk_wayland_surface_begin_resize_drag;
impl_class->begin_move_drag = gdk_wayland_surface_begin_move_drag;
impl_class->destroy_notify = gdk_wayland_surface_destroy_notify;
impl_class->drag_begin = _gdk_wayland_surface_drag_begin;
impl_class->get_scale_factor = gdk_wayland_surface_get_scale_factor;
@@ -4603,15 +4617,10 @@ show_surface (GdkSurface *surface)
if (!was_mapped)
gdk_synthesize_surface_state (surface, GDK_SURFACE_STATE_WITHDRAWN, 0);
_gdk_surface_update_viewable (surface);
gdk_wayland_surface_show (surface, FALSE);
if (!was_mapped)
{
if (gdk_surface_is_viewable (surface))
gdk_surface_invalidate_rect (surface, NULL);
}
gdk_surface_invalidate_rect (surface, NULL);
}
static gboolean
@@ -4771,6 +4780,8 @@ gdk_wayland_toplevel_iface_init (GdkToplevelInterface *iface)
iface->supports_edge_constraints = gdk_wayland_toplevel_supports_edge_constraints;
iface->inhibit_system_shortcuts = gdk_wayland_toplevel_inhibit_system_shortcuts;
iface->restore_system_shortcuts = gdk_wayland_toplevel_restore_system_shortcuts;
iface->begin_resize = gdk_wayland_toplevel_begin_resize;
iface->begin_move = gdk_wayland_toplevel_begin_move;
}
static void
+45 -95
View File
@@ -169,11 +169,12 @@ _gdk_win32_display_find_matching_monitor (GdkWin32Display *win32_display,
{
int i;
for (i = 0; i < win32_display->monitors->len; i++)
for (i = 0; i < g_list_model_get_n_items (win32_display->monitors); i++)
{
GdkWin32Monitor *m;
m = GDK_WIN32_MONITOR (g_ptr_array_index (win32_display->monitors, i));
m = g_list_model_get_item (win32_display->monitors, i);
g_object_unref (m);
if (_gdk_win32_monitor_compare (m, GDK_WIN32_MONITOR (needle)) == 0)
return GDK_MONITOR (m);
@@ -182,17 +183,21 @@ _gdk_win32_display_find_matching_monitor (GdkWin32Display *win32_display,
return NULL;
}
gboolean
void
_gdk_win32_display_init_monitors (GdkWin32Display *win32_display)
{
GdkDisplay *display = GDK_DISPLAY (win32_display);
GPtrArray *new_monitors;
gint i;
gboolean changed = FALSE;
GdkWin32Monitor *primary_to_move = NULL;
for (i = 0; i < win32_display->monitors->len; i++)
GDK_WIN32_MONITOR (g_ptr_array_index (win32_display->monitors, i))->remove = TRUE;
for (i = 0; i < g_list_model_get_n_items (win32_display->monitors); i++)
{
GdkWin32Monitor *m;
m = g_list_model_get_item (win32_display->monitors, i);
m->remove = TRUE;
g_object_unref (m);
}
new_monitors = _gdk_win32_display_get_monitor_list (win32_display);
@@ -202,7 +207,7 @@ _gdk_win32_display_init_monitors (GdkWin32Display *win32_display)
GdkMonitor *m;
GdkWin32Monitor *w32_ex_monitor;
GdkMonitor *ex_monitor;
GdkRectangle geometry, ex_geometry;
GdkRectangle geometry;
GdkRectangle workarea, ex_workarea;
w32_m = GDK_WIN32_MONITOR (g_ptr_array_index (new_monitors, i));
@@ -213,7 +218,6 @@ _gdk_win32_display_init_monitors (GdkWin32Display *win32_display)
if (ex_monitor == NULL)
{
w32_m->add = TRUE;
changed = TRUE;
continue;
}
@@ -223,22 +227,15 @@ _gdk_win32_display_init_monitors (GdkWin32Display *win32_display)
primary_to_move = w32_ex_monitor;
gdk_monitor_get_geometry (m, &geometry);
gdk_monitor_get_geometry (ex_monitor, &ex_geometry);
gdk_monitor_get_workarea (m, &workarea);
gdk_monitor_get_workarea (ex_monitor, &ex_workarea);
if (memcmp (&workarea, &ex_workarea, sizeof (GdkRectangle)) != 0)
{
w32_ex_monitor->work_rect = workarea;
changed = TRUE;
}
if (memcmp (&geometry, &ex_geometry, sizeof (GdkRectangle)) != 0)
{
gdk_monitor_set_size (ex_monitor, geometry.width, geometry.height);
gdk_monitor_set_position (ex_monitor, geometry.x, geometry.y);
changed = TRUE;
}
gdk_monitor_set_geometry (ex_monitor, &geometry);
if (gdk_monitor_get_width_mm (m) != gdk_monitor_get_width_mm (ex_monitor) ||
gdk_monitor_get_height_mm (m) != gdk_monitor_get_height_mm (ex_monitor))
@@ -246,86 +243,78 @@ _gdk_win32_display_init_monitors (GdkWin32Display *win32_display)
gdk_monitor_set_physical_size (ex_monitor,
gdk_monitor_get_width_mm (m),
gdk_monitor_get_height_mm (m));
changed = TRUE;
}
if (g_strcmp0 (gdk_monitor_get_model (m), gdk_monitor_get_model (ex_monitor)) != 0)
{
gdk_monitor_set_model (ex_monitor,
gdk_monitor_get_model (m));
changed = TRUE;
}
if (g_strcmp0 (gdk_monitor_get_manufacturer (m), gdk_monitor_get_manufacturer (ex_monitor)) != 0)
{
gdk_monitor_set_manufacturer (ex_monitor,
gdk_monitor_get_manufacturer (m));
changed = TRUE;
}
if (gdk_monitor_get_refresh_rate (m) != gdk_monitor_get_refresh_rate (ex_monitor))
{
gdk_monitor_set_refresh_rate (ex_monitor, gdk_monitor_get_refresh_rate (m));
changed = TRUE;
}
if (gdk_monitor_get_scale_factor (m) != gdk_monitor_get_scale_factor (ex_monitor))
{
gdk_monitor_set_scale_factor (ex_monitor, gdk_monitor_get_scale_factor (m));
changed = TRUE;
}
if (gdk_monitor_get_subpixel_layout (m) != gdk_monitor_get_subpixel_layout (ex_monitor))
{
gdk_monitor_set_subpixel_layout (ex_monitor, gdk_monitor_get_subpixel_layout (m));
changed = TRUE;
}
}
for (i = win32_display->monitors->len - 1; i >= 0; i--)
for (i = g_list_model_get_n_items (win32_display->monitors) - 1; i >= 0; i--)
{
GdkWin32Monitor *w32_ex_monitor;
GdkMonitor *ex_monitor;
w32_ex_monitor = GDK_WIN32_MONITOR (g_ptr_array_index (win32_display->monitors, i));
w32_ex_monitor = GDK_WIN32_MONITOR (g_list_model_get_item (win32_display->monitors, i));
g_object_unref (w32_ex_monitor);
ex_monitor = GDK_MONITOR (w32_ex_monitor);
if (!w32_ex_monitor->remove)
continue;
changed = TRUE;
gdk_display_monitor_removed (display, ex_monitor);
g_ptr_array_remove_index (win32_display->monitors, i);
g_list_store_remove (G_LIST_STORE (win32_display->monitors), i);
gdk_monitor_invalidate (ex_monitor);
}
for (i = 0; i < new_monitors->len; i++)
{
GdkWin32Monitor *w32_m;
GdkMonitor *m;
w32_m = GDK_WIN32_MONITOR (g_ptr_array_index (new_monitors, i));
m = GDK_MONITOR (w32_m);
if (!w32_m->add)
continue;
gdk_display_monitor_added (display, m);
if (i == 0)
g_ptr_array_insert (win32_display->monitors, 0, g_object_ref (w32_m));
g_list_store_insert (G_LIST_STORE (win32_display->monitors), 0, w32_m);
else
g_ptr_array_add (win32_display->monitors, g_object_ref (w32_m));
g_list_store_append (G_LIST_STORE (win32_display->monitors), w32_m);
}
g_ptr_array_free (new_monitors, TRUE);
if (primary_to_move)
{
g_ptr_array_remove (win32_display->monitors, g_object_ref (primary_to_move));
g_ptr_array_insert (win32_display->monitors, 0, primary_to_move);
changed = TRUE;
guint pos;
g_object_ref (primary_to_move);
if (g_list_store_find (G_LIST_STORE (win32_display->monitors), primary_to_move, &pos))
g_list_store_remove (G_LIST_STORE (win32_display->monitors), pos);
g_list_store_insert (G_LIST_STORE (win32_display->monitors), 0, primary_to_move);
g_object_unref (primary_to_move);
}
return changed;
}
@@ -633,23 +622,6 @@ gdk_win32_display_get_default_group (GdkDisplay *display)
return NULL;
}
static gboolean
gdk_win32_display_supports_shapes (GdkDisplay *display)
{
g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
return TRUE;
}
static gboolean
gdk_win32_display_supports_input_shapes (GdkDisplay *display)
{
g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
/* Partially supported, see WM_NCHITTEST handler. */
return TRUE;
}
static void
gdk_win32_display_beep (GdkDisplay *display)
{
@@ -706,7 +678,8 @@ gdk_win32_display_finalize (GObject *object)
_gdk_win32_dnd_exit ();
_gdk_win32_lang_notification_exit ();
g_ptr_array_free (display_win32->monitors, TRUE);
g_list_store_remove_all (G_LIST_STORE (display_win32->monitors));
g_object_unref (display_win32->monitors);
while (display_win32->filters)
_gdk_win32_message_filter_unref (display_win32, display_win32->filters->data);
@@ -911,7 +884,7 @@ gdk_win32_display_init (GdkWin32Display *display)
{
const gchar *scale_str = g_getenv ("GDK_SCALE");
display->monitors = g_ptr_array_new_with_free_func (g_object_unref);
display->monitors = G_LIST_MODEL (g_list_store_new (GDK_TYPE_MONITOR));
_gdk_win32_enable_hidpi (display);
@@ -959,37 +932,25 @@ gdk_win32_display_notify_startup_complete (GdkDisplay *display,
/* nothing */
}
static int
gdk_win32_display_get_n_monitors (GdkDisplay *display)
{
GdkWin32Display *win32_display = GDK_WIN32_DISPLAY (display);
return win32_display->monitors->len;
}
static GdkMonitor *
gdk_win32_display_get_monitor (GdkDisplay *display,
int monitor_num)
{
GdkWin32Display *win32_display = GDK_WIN32_DISPLAY (display);
if (monitor_num < 0 || monitor_num >= win32_display->monitors->len)
return NULL;
return (GdkMonitor *) g_ptr_array_index (win32_display->monitors, monitor_num);
}
GdkMonitor *
gdk_win32_display_get_primary_monitor (GdkDisplay *display)
{
GdkWin32Display *win32_display = GDK_WIN32_DISPLAY (display);
GdkWin32Display *self = GDK_WIN32_DISPLAY (display);
GdkMonitor *result;
/* We arrange for the first monitor in the array to also be the primiary monitor */
if (win32_display->monitors->len > 0)
return (GdkMonitor *) g_ptr_array_index (win32_display->monitors, 0);
/* We arrange for the first monitor in the array to also be the primary monitor */
result = g_list_model_get_item (self->monitors, 0);
g_object_unref (result);
return NULL;
return result;
}
static GListModel *
gdk_win32_display_get_monitors (GdkDisplay *display)
{
GdkWin32Display *self = GDK_WIN32_DISPLAY (display);
return self->monitors;
}
guint
@@ -1083,12 +1044,6 @@ gdk_win32_display_get_setting (GdkDisplay *display,
return _gdk_win32_get_setting (name, value);
}
static guint32
gdk_win32_display_get_last_seen_time (GdkDisplay *display)
{
return GetMessageTime ();
}
static void
gdk_win32_display_class_init (GdkWin32DisplayClass *klass)
{
@@ -1108,9 +1063,6 @@ gdk_win32_display_class_init (GdkWin32DisplayClass *klass)
display_class->queue_events = _gdk_win32_display_queue_events;
display_class->get_default_group = gdk_win32_display_get_default_group;
display_class->supports_shapes = gdk_win32_display_supports_shapes;
display_class->supports_input_shapes = gdk_win32_display_supports_input_shapes;
//? display_class->get_app_launch_context = _gdk_win32_display_get_app_launch_context;
display_class->get_next_serial = gdk_win32_display_get_next_serial;
@@ -1120,8 +1072,7 @@ gdk_win32_display_class_init (GdkWin32DisplayClass *klass)
display_class->get_keymap = _gdk_win32_display_get_keymap;
display_class->make_gl_context_current = _gdk_win32_display_make_gl_context_current;
display_class->get_n_monitors = gdk_win32_display_get_n_monitors;
display_class->get_monitor = gdk_win32_display_get_monitor;
display_class->get_monitors = gdk_win32_display_get_monitors;
#ifdef GDK_RENDERING_VULKAN
display_class->vk_context_type = GDK_TYPE_WIN32_VULKAN_CONTEXT;
@@ -1129,7 +1080,6 @@ gdk_win32_display_class_init (GdkWin32DisplayClass *klass)
#endif
display_class->get_setting = gdk_win32_display_get_setting;
display_class->get_last_seen_time = gdk_win32_display_get_last_seen_time;
display_class->set_cursor_theme = gdk_win32_display_set_cursor_theme;
_gdk_win32_surfaceing_init ();
+2 -2
View File
@@ -82,7 +82,7 @@ struct _GdkWin32Display
guint gl_version;
HWND gl_hwnd;
GPtrArray *monitors;
GListModel *monitors;
guint hasWglARBCreateContext : 1;
guint hasWglEXTSwapControl : 1;
@@ -120,7 +120,7 @@ struct _GdkWin32DisplayClass
GdkDisplayClass display_class;
};
gboolean _gdk_win32_display_init_monitors (GdkWin32Display *display);
void _gdk_win32_display_init_monitors (GdkWin32Display *display);
GPtrArray *_gdk_win32_display_get_monitor_list (GdkWin32Display *display);
+4 -4
View File
@@ -1709,8 +1709,8 @@ _gdk_win32_surface_drag_begin (GdkSurface *surface,
GdkDevice *device,
GdkContentProvider *content,
GdkDragAction actions,
gint dx,
gint dy)
double dx,
double dy)
{
GdkDrag *drag;
GdkWin32Drag *drag_win32;
@@ -1731,8 +1731,8 @@ _gdk_win32_surface_drag_begin (GdkSurface *surface,
GDK_NOTE (DND, g_print ("_gdk_win32_surface_drag_begin\n"));
gdk_device_get_position (device, &px, &py);
x_root = round (px) + dx;
y_root = round (py) + dy;
x_root = round (px + dx);
y_root = round (py + dy);
drag_win32->start_x = x_root;
drag_win32->start_y = y_root;
+2 -3
View File
@@ -710,8 +710,7 @@ enum_monitor (HMONITOR hmonitor,
rect.y = monitor_info.rcMonitor.top / scale;
rect.width = (monitor_info.rcMonitor.right - monitor_info.rcMonitor.left) / scale;
rect.height = (monitor_info.rcMonitor.bottom - monitor_info.rcMonitor.top) / scale;
gdk_monitor_set_position (mon, rect.x, rect.y);
gdk_monitor_set_size (mon, rect.width, rect.height);
gdk_monitor_set_geometry (mon, &rect);
if (monitor_info.dwFlags & MONITORINFOF_PRIMARY && i != 0)
{
@@ -819,7 +818,7 @@ _gdk_win32_display_get_monitor_list (GdkWin32Display *win32_display)
gdk_monitor_get_geometry (GDK_MONITOR (m), &rect);
rect.x += _gdk_offset_x;
rect.y += _gdk_offset_y;
gdk_monitor_set_position (GDK_MONITOR (m), rect.x, rect.y);
gdk_monitor_set_geometry (GDK_MONITOR (m), &rect);
m->work_rect.x += _gdk_offset_x;
m->work_rect.y += _gdk_offset_y;
+2 -2
View File
@@ -395,8 +395,8 @@ GdkDrag *_gdk_win32_surface_drag_begin (GdkSurface *window,
GdkDevice *device,
GdkContentProvider *content,
GdkDragAction actions,
gint x_root,
gint y_root);
double x_root,
double y_root);
/* Stray GdkWin32Screen members */
gboolean _gdk_win32_get_setting (const gchar *name, GValue *value);
+6 -7
View File
@@ -46,23 +46,22 @@ G_DEFINE_TYPE (GdkWin32Screen, gdk_win32_screen, G_TYPE_OBJECT)
static void
init_root_window_size (GdkWin32Screen *screen)
{
GdkRectangle result;
GdkRectangle result = { 0, };
int i;
GdkDisplay *display = _gdk_display;
int monitor_count;
GListModel *monitors;
GdkMonitor *monitor;
monitor_count = gdk_display_get_n_monitors (display);
monitor = gdk_display_get_monitor (display, 0);
gdk_monitor_get_geometry (monitor, &result);
monitors = gdk_display_get_monitors (display);
for (i = 1; i < monitor_count; i++)
for (i = 1; i < g_list_model_get_n_items (monitors); i++)
{
GdkRectangle rect;
monitor = gdk_display_get_monitor (display, i);
monitor = g_list_model_get_item (monitors, i);
gdk_monitor_get_geometry (monitor, &rect);
gdk_rectangle_union (&result, &rect, &result);
g_object_unref (monitor);
}
screen->width = result.width;
+56 -54
View File
@@ -1327,7 +1327,6 @@ show_popup (GdkSurface *surface)
{
gdk_win32_surface_raise (surface);
gdk_synthesize_surface_state (surface, GDK_SURFACE_STATE_WITHDRAWN, 0);
_gdk_surface_update_viewable (surface);
show_window_internal (surface, FALSE, FALSE);
gdk_surface_invalidate_rect (surface, NULL);
}
@@ -2052,21 +2051,22 @@ static void
calculate_aerosnap_regions (GdkW32DragMoveResizeContext *context)
{
GdkDisplay *display;
gint n_monitors, monitor_idx, other_monitor_idx;
GListModel *monitors;
gint monitor_idx, other_monitor_idx;
GdkWin32Surface *impl = GDK_WIN32_SURFACE (context->window);
#if defined(MORE_AEROSNAP_DEBUGGING)
gint i;
#endif
display = gdk_display_get_default ();
n_monitors = gdk_display_get_n_monitors (display);
monitors = gdk_display_get_monitors (display);
#define _M_UP 0
#define _M_DOWN 1
#define _M_LEFT 2
#define _M_RIGHT 3
for (monitor_idx = 0; monitor_idx < n_monitors; monitor_idx++)
for (monitor_idx = 0; monitor_idx < g_list_model_get_n_items (monitors); monitor_idx++)
{
GdkRectangle wa;
GdkRectangle geometry;
@@ -2077,12 +2077,13 @@ calculate_aerosnap_regions (GdkW32DragMoveResizeContext *context)
gint thickness, trigger_thickness;
GdkMonitor *monitor;
monitor = gdk_display_get_monitor (display, monitor_idx);
monitor = g_list_model_get_item (monitors, monitor_idx);
g_object_unref (monitors);
gdk_monitor_get_workarea (monitor, &wa);
gdk_monitor_get_geometry (monitor, &geometry);
for (other_monitor_idx = 0;
other_monitor_idx < n_monitors &&
other_monitor_idx < g_list_model_get_n_items (monitors) &&
(move_edge[_M_UP] || move_edge[_M_LEFT] ||
move_edge[_M_RIGHT] || resize_edge[_M_DOWN]);
other_monitor_idx++)
@@ -2093,7 +2094,8 @@ calculate_aerosnap_regions (GdkW32DragMoveResizeContext *context)
if (other_monitor_idx == monitor_idx)
continue;
other_monitor = gdk_display_get_monitor (display, other_monitor_idx);
other_monitor = g_list_model_get_item (monitors, other_monitor_idx);
g_object_unref (other_monitor);
gdk_monitor_get_workarea (other_monitor, &other_wa);
/* An edge triggers AeroSnap only if there are no
@@ -2473,6 +2475,7 @@ _gdk_win32_surface_handle_aerosnap (GdkSurface *window,
{
GdkWin32Surface *impl;
GdkDisplay *display;
GListModel *monitors;
gint n_monitors;
GdkSurfaceState surface_state = gdk_toplevel_get_state (GDK_TOPLEVEL (window));
gboolean minimized = surface_state & GDK_SURFACE_STATE_MINIMIZED;
@@ -2482,7 +2485,8 @@ _gdk_win32_surface_handle_aerosnap (GdkSurface *window,
impl = GDK_WIN32_SURFACE (window);
display = gdk_surface_get_display (window);
n_monitors = gdk_display_get_n_monitors (display);
monitors = gdk_display_get_monitors (display);
n_monitors = g_list_model_get_n_items (monitors);
monitor = gdk_display_get_monitor_at_surface (display, window);
if (minimized && maximized)
@@ -2528,10 +2532,15 @@ _gdk_win32_surface_handle_aerosnap (GdkSurface *window,
}
else if (impl->snap_state == GDK_WIN32_AEROSNAP_STATE_HALFLEFT)
{
GdkMonitor *other;
unsnap (window, monitor);
snap_right (window,
monitor,
(gdk_win32_display_get_primary_monitor (monitor->display) == monitor) ? monitor : gdk_display_get_monitor (display, n_monitors - 1));
if (gdk_win32_display_get_primary_monitor (monitor->display) == monitor)
other = g_object_ref (monitor);
else
other = g_list_model_get_item (monitors, n_monitors - 1);
snap_right (window, monitor, other);
g_object_unref (other);
}
else if (impl->snap_state == GDK_WIN32_AEROSNAP_STATE_HALFRIGHT)
{
@@ -2554,24 +2563,21 @@ _gdk_win32_surface_handle_aerosnap (GdkSurface *window,
}
else if (impl->snap_state == GDK_WIN32_AEROSNAP_STATE_HALFRIGHT)
{
GdkMonitor *other;
gint i;
unsnap (window, monitor);
if (n_monitors == 1 ||
monitor == gdk_display_get_monitor (display, n_monitors - 1))
{
snap_left (window, monitor, monitor);
}
else
{
for (i = 0; i < n_monitors; i++)
{
if (monitor == gdk_display_get_monitor (display, i))
break;
}
for (i = 0; i < n_monitors; i++)
{
other = g_list_model_get_item (monitors, i);
g_object_unref (other);
if (monitor == other)
break;
}
snap_left (window, monitor, gdk_display_get_monitor (display, i + 1));
}
other = g_list_model_get_item (monitors, (i + 1) % n_monitors);
snap_left (window, monitor, other);
g_object_unref (other);
}
break;
case GDK_WIN32_AEROSNAP_COMBO_SHIFTUP:
@@ -3120,18 +3126,19 @@ get_monitor_at_point (GdkDisplay *display,
int x,
int y)
{
GListModel *monitors;
GdkMonitor *nearest = NULL;
int nearest_dist = G_MAXINT;
int n_monitors, i;
guint i;
n_monitors = gdk_display_get_n_monitors (display);
for (i = 0; i < n_monitors; i++)
monitors = gdk_display_get_monitors (display);
for (i = 0; i < g_list_model_get_n_items (monitors); i++)
{
GdkMonitor *monitor;
GdkRectangle geometry;
int dist_x, dist_y, dist;
monitor = gdk_display_get_monitor (display, i);
monitor = g_list_model_get_item (monitors, i);
gdk_monitor_get_geometry (monitor, &geometry);
if (x < geometry.x)
@@ -3176,6 +3183,8 @@ get_monitor_at_point (GdkDisplay *display,
nearest = monitor;
}
g_object_unref (monitor);
if (nearest_dist == 0)
break;
}
@@ -4135,18 +4144,17 @@ gdk_win32_surface_do_move_resize_drag (GdkSurface *window,
}
static void
gdk_win32_surface_begin_resize_drag (GdkSurface *window,
GdkSurfaceEdge edge,
GdkDevice *device,
gint button,
gint x,
gint y,
guint32 timestamp)
gdk_win32_toplevel_begin_resize (GdkToplevel *toplevel,
GdkSurfaceEdge edge,
GdkDevice *device,
int button,
double x,
double y,
guint32 timestamp)
{
GdkSurface *window = GDK_SURFACE (toplevel);
GdkWin32Surface *impl;
g_return_if_fail (GDK_IS_SURFACE (window));
if (GDK_SURFACE_DESTROYED (window) ||
IsIconic (GDK_SURFACE_HWND (window)))
return;
@@ -4172,17 +4180,16 @@ gdk_win32_surface_begin_resize_drag (GdkSurface *window,
}
static void
gdk_win32_surface_begin_move_drag (GdkSurface *window,
GdkDevice *device,
gint button,
gint x,
gint y,
guint32 timestamp)
gdk_win32_toplevel_begin_move (GdkToplevel *toplevel,
GdkDevice *device,
int button,
double x,
double y,
guint32 timestamp)
{
GdkSurface *window = GDK_SURFACE (toplevel);
GdkWin32Surface *impl;
g_return_if_fail (GDK_IS_SURFACE (window));
if (GDK_SURFACE_DESTROYED (window) ||
IsIconic (GDK_SURFACE_HWND (window)))
return;
@@ -4700,8 +4707,6 @@ gdk_win32_surface_class_init (GdkWin32SurfaceClass *klass)
impl_class->set_shadow_width = gdk_win32_surface_set_shadow_width;
impl_class->begin_resize_drag = gdk_win32_surface_begin_resize_drag;
impl_class->begin_move_drag = gdk_win32_surface_begin_move_drag;
impl_class->destroy_notify = gdk_win32_surface_destroy_notify;
impl_class->drag_begin = _gdk_win32_surface_drag_begin;
impl_class->create_gl_context = _gdk_win32_surface_create_gl_context;
@@ -4990,15 +4995,10 @@ show_surface (GdkSurface *surface)
if (!was_mapped)
gdk_synthesize_surface_state (surface, GDK_SURFACE_STATE_WITHDRAWN, 0);
_gdk_surface_update_viewable (surface);
gdk_win32_surface_show (surface, FALSE);
if (!was_mapped)
{
if (gdk_surface_is_viewable (surface))
gdk_surface_invalidate_rect (surface, NULL);
}
gdk_surface_invalidate_rect (surface, NULL);
}
static gboolean
@@ -5085,6 +5085,8 @@ gdk_win32_toplevel_iface_init (GdkToplevelInterface *iface)
iface->focus = gdk_win32_toplevel_focus;
iface->show_window_menu = gdk_win32_toplevel_show_window_menu;
iface->supports_edge_constraints = gdk_win32_toplevel_supports_edge_constraints;
iface->begin_resize = gdk_win32_toplevel_begin_resize;
iface->begin_move = gdk_win32_toplevel_begin_move;
}
typedef struct
+1 -1
View File
@@ -544,7 +544,7 @@ gdk_x11_clipboard_claim (GdkClipboard *clipboard,
Window xwindow = GDK_X11_DISPLAY (display)->leader_window;
guint32 time;
time = gdk_display_get_last_seen_time (display);
time = gdk_x11_get_server_time (GDK_X11_DISPLAY (display)->leader_gdk_surface);
if (content)
{
+23 -113
View File
@@ -73,10 +73,6 @@
#include <X11/extensions/Xcomposite.h>
#endif
#ifdef HAVE_XDAMAGE
#include <X11/extensions/Xdamage.h>
#endif
#ifdef HAVE_RANDR
#include <X11/extensions/Xrandr.h>
#endif
@@ -209,9 +205,9 @@ G_DEFINE_TYPE_WITH_CODE (GdkX11Display, gdk_x11_display, GDK_TYPE_DISPLAY,
gdk_x11_display_event_translator_init))
static void
gdk_x11_display_init (GdkX11Display *display)
gdk_x11_display_init (GdkX11Display *self)
{
display->monitors = g_ptr_array_new_with_free_func (g_object_unref);
self->monitors = g_list_store_new (GDK_TYPE_MONITOR);
}
static void
@@ -1430,8 +1426,6 @@ gdk_x11_display_open (const gchar *display_name)
display_x11->have_randr15 = TRUE;
#endif
}
gdk_x11_register_standard_event_type (display, display_x11->xrandr_event_base, RRNumberEvents);
}
#endif
@@ -1464,10 +1458,6 @@ gdk_x11_display_open (const gchar *display_name)
&ignore))
{
display_x11->have_xfixes = TRUE;
gdk_x11_register_standard_event_type (display,
display_x11->xfixes_event_base,
XFixesNumberEvents);
}
else
#endif
@@ -1491,21 +1481,6 @@ gdk_x11_display_open (const gchar *display_name)
#endif
display_x11->have_xcomposite = FALSE;
#ifdef HAVE_XDAMAGE
if (XDamageQueryExtension (display_x11->xdisplay,
&display_x11->xdamage_event_base,
&ignore))
{
display_x11->have_xdamage = TRUE;
gdk_x11_register_standard_event_type (display,
display_x11->xdamage_event_base,
XDamageNumberEvents);
}
else
#endif
display_x11->have_xdamage = FALSE;
display_x11->have_shapes = FALSE;
display_x11->have_input_shapes = FALSE;
@@ -1518,6 +1493,8 @@ gdk_x11_display_open (const gchar *display_name)
#endif
}
gdk_display_set_input_shapes (display, display_x11->have_input_shapes);
display_x11->trusted_client = TRUE;
{
Window root, child;
@@ -1940,17 +1917,12 @@ gdk_x11_display_finalize (GObject *object)
/* Leader Window */
XDestroyWindow (display_x11->xdisplay, display_x11->leader_window);
/* List of event window extraction functions */
g_slist_free_full (display_x11->event_types, g_free);
/* input GdkSurface list */
g_list_free_full (display_x11->input_surfaces, g_free);
/* Free all GdkX11Screens */
g_object_unref (display_x11->screen);
g_list_free_full (display_x11->screens, g_object_unref);
g_ptr_array_free (display_x11->monitors, TRUE);
g_list_store_remove_all (display_x11->monitors);
g_object_unref (display_x11->monitors);
g_free (display_x11->startup_notification_id);
@@ -2339,19 +2311,6 @@ gdk_x11_display_get_user_time (GdkDisplay *display)
return GDK_X11_DISPLAY (display)->user_time;
}
static gboolean
gdk_x11_display_supports_shapes (GdkDisplay *display)
{
return GDK_X11_DISPLAY (display)->have_shapes;
}
static gboolean
gdk_x11_display_supports_input_shapes (GdkDisplay *display)
{
return GDK_X11_DISPLAY (display)->have_input_shapes;
}
/**
* gdk_x11_display_get_startup_notification_id:
* @display: (type GdkX11Display): a #GdkDisplay
@@ -2438,39 +2397,6 @@ gdk_x11_display_set_startup_notification_id (GdkDisplay *display,
}
}
/**
* gdk_x11_register_standard_event_type:
* @display: (type GdkX11Display): a #GdkDisplay
* @event_base: first event type code to register
* @n_events: number of event type codes to register
*
* Registers interest in receiving extension events with type codes
* between @event_base and `event_base + n_events - 1`.
* The registered events must have the window field in the same place
* as core X events (this is not the case for e.g. XKB extension events).
*
* GDK may register the events of some X extensions on its own.
*
* This function should only be needed in unusual circumstances, e.g.
* when filtering XInput extension events on the root window.
**/
void
gdk_x11_register_standard_event_type (GdkDisplay *display,
gint event_base,
gint n_events)
{
GdkEventTypeX11 *event_type;
GdkX11Display *display_x11;
display_x11 = GDK_X11_DISPLAY (display);
event_type = g_new (GdkEventTypeX11, 1);
event_type->base = event_base;
event_type->n_events = n_events;
display_x11->event_types = g_slist_prepend (display_x11->event_types, event_type);
}
/* look up the extension name for a given major opcode. grubs around in
* xlib to do it since a) its already cached there b) XQueryExtension
* emits protocol so we cant use it in an error handler.
@@ -2894,30 +2820,17 @@ gdk_x11_display_get_default_seat (GdkDisplay *display)
return NULL;
}
static int
gdk_x11_display_get_n_monitors (GdkDisplay *display)
static GListModel *
gdk_x11_display_get_monitors (GdkDisplay *display)
{
GdkX11Display *x11_display = GDK_X11_DISPLAY (display);
GdkX11Display *self = GDK_X11_DISPLAY (display);
return x11_display->monitors->len;
}
static GdkMonitor *
gdk_x11_display_get_monitor (GdkDisplay *display,
int monitor_num)
{
GdkX11Display *x11_display = GDK_X11_DISPLAY (display);
if (0 <= monitor_num && monitor_num < x11_display->monitors->len)
return (GdkMonitor *)x11_display->monitors->pdata[monitor_num];
return NULL;
return G_LIST_MODEL (self->monitors);
}
/**
* gdk_x11_display_get_primary_monitor:
* @display: a #GdkDisplay
* @self: a #GdkDisplay
*
* Gets the primary monitor for the display.
*
@@ -2935,12 +2848,19 @@ gdk_x11_display_get_monitor (GdkDisplay *display,
GdkMonitor *
gdk_x11_display_get_primary_monitor (GdkDisplay *display)
{
GdkX11Display *x11_display = GDK_X11_DISPLAY (display);
GdkX11Display *self = GDK_X11_DISPLAY (display);
GdkMonitor *monitor;
if (0 <= x11_display->primary_monitor && x11_display->primary_monitor < x11_display->monitors->len)
return x11_display->monitors->pdata[x11_display->primary_monitor];
if (0 <= self->primary_monitor)
return NULL;
return NULL;
monitor = g_list_model_get_item (G_LIST_MODEL (self->monitors), self->primary_monitor);
if (monitor == NULL)
return NULL;
/* because g_list_model_get_item() returns a ref */
g_object_unref (monitor);
return monitor;
}
int
@@ -2975,12 +2895,6 @@ gdk_x11_display_get_toplevel_windows (GdkDisplay *display)
return GDK_X11_DISPLAY (display)->toplevels;
}
static guint32
gdk_x11_display_get_last_seen_time (GdkDisplay *display)
{
return gdk_x11_get_server_time (GDK_X11_DISPLAY (display)->leader_gdk_surface);
}
static gboolean
gdk_boolean_handled_accumulator (GSignalInvocationHint *ihint,
GValue *return_accu,
@@ -3020,8 +2934,6 @@ gdk_x11_display_class_init (GdkX11DisplayClass * class)
display_class->has_pending = gdk_x11_display_has_pending;
display_class->queue_events = _gdk_x11_display_queue_events;
display_class->get_default_group = gdk_x11_display_get_default_group;
display_class->supports_shapes = gdk_x11_display_supports_shapes;
display_class->supports_input_shapes = gdk_x11_display_supports_input_shapes;
display_class->get_app_launch_context = _gdk_x11_display_get_app_launch_context;
display_class->get_next_serial = gdk_x11_display_get_next_serial;
@@ -3034,10 +2946,8 @@ gdk_x11_display_class_init (GdkX11DisplayClass * class)
display_class->get_default_seat = gdk_x11_display_get_default_seat;
display_class->get_n_monitors = gdk_x11_display_get_n_monitors;
display_class->get_monitor = gdk_x11_display_get_monitor;
display_class->get_monitors = gdk_x11_display_get_monitors;
display_class->get_setting = gdk_x11_display_get_setting;
display_class->get_last_seen_time = gdk_x11_display_get_last_seen_time;
display_class->set_cursor_theme = gdk_x11_display_set_cursor_theme;
class->xevent = gdk_event_source_xevent;
+1 -9
View File
@@ -72,8 +72,6 @@ struct _GdkX11Display
gint xfixes_event_base;
gboolean have_xcomposite;
gboolean have_xdamage;
gint xdamage_event_base;
gboolean have_randr12;
gboolean have_randr13;
@@ -99,22 +97,16 @@ struct _GdkX11Display
GdkSurface *leader_gdk_surface;
gboolean leader_window_title_set;
/* List of functions to go from extension event => X window */
GSList *event_types;
/* X ID hashtable */
GHashTable *xid_ht;
/* streams reading selections */
GSList *streams;
/* input GdkSurface list */
GList *input_surfaces;
/* GdkCursor => XCursor */
GHashTable *cursors;
GPtrArray *monitors;
GListStore *monitors;
int primary_monitor;
/* Startup notification */
+7 -7
View File
@@ -665,12 +665,12 @@ is_pointer_within_shape (GdkDisplay *display,
cairo_region_t *input_shape;
child->shape = NULL;
if (gdk_display_supports_shapes (display))
if (display_x11->have_shapes)
child->shape = _gdk_x11_xwindow_get_shape (display_x11->xdisplay,
child->xid, 1, ShapeBounding);
#ifdef ShapeInput
input_shape = NULL;
if (gdk_display_supports_input_shapes (display))
if (display_x11->have_input_shapes)
input_shape = _gdk_x11_xwindow_get_shape (display_x11->xdisplay,
child->xid, 1, ShapeInput);
@@ -1985,8 +1985,8 @@ _gdk_x11_surface_drag_begin (GdkSurface *surface,
GdkDevice *device,
GdkContentProvider *content,
GdkDragAction actions,
gint dx,
gint dy)
double dx,
double dy)
{
GdkX11Drag *x11_drag;
GdkDrag *drag;
@@ -2013,8 +2013,8 @@ _gdk_x11_surface_drag_begin (GdkSurface *surface,
_gdk_device_query_state (device, surface, NULL, &px, &py, NULL);
gdk_x11_surface_get_root_coords (surface,
round (px) + dx,
round (py) + dy,
round (px + dx),
round (py + dy),
&x_root,
&y_root);
@@ -2042,7 +2042,7 @@ _gdk_x11_surface_drag_begin (GdkSurface *surface,
move_drag_surface (drag, x_root, y_root);
x11_drag->timestamp = gdk_display_get_last_seen_time (display);
x11_drag->timestamp = gdk_x11_get_server_time (GDK_X11_DISPLAY (display)->leader_gdk_surface);
xselection = gdk_x11_get_xatom_by_name_for_display (display, "XdndSelection");
XSetSelectionOwner (GDK_DISPLAY_XDISPLAY (display),
xselection,
+2 -2
View File
@@ -223,8 +223,8 @@ GdkDrag * _gdk_x11_surface_drag_begin (GdkSurface *window,
GdkDevice *device,
GdkContentProvider *content,
GdkDragAction actions,
gint dx,
gint dy);
double dx,
double dy);
void gdk_x11_surface_get_root_coords (GdkSurface *surface,
gint x,
+87 -110
View File
@@ -135,12 +135,16 @@ gdk_x11_screen_get_monitor_output (GdkX11Screen *x11_screen,
{
GdkX11Display *x11_display = GDK_X11_DISPLAY (x11_screen->display);
GdkX11Monitor *monitor;
XID output;
g_return_val_if_fail (monitor_num >= 0, None);
g_return_val_if_fail (monitor_num < x11_display->monitors->len, None);
g_return_val_if_fail (monitor_num < g_list_model_get_n_items (G_LIST_MODEL (x11_display->monitors)), None);
monitor = x11_display->monitors->pdata[monitor_num];
return monitor->output;
monitor = g_list_model_get_item (G_LIST_MODEL (x11_display->monitors), monitor_num);
output = monitor->output;
g_object_unref (monitor);
return output;
}
static int
@@ -381,14 +385,35 @@ gdk_x11_screen_get_screen_number (GdkX11Screen *screen)
return screen->screen_num;
}
static void
notify_surface_monitor_change (GdkX11Display *display,
GdkMonitor *monitor)
{
GHashTableIter iter;
GdkSurface *surface;
/* We iterate the surfaces via the hash table here because it's the only
* thing that contains all the surfaces.
*/
if (display->xid_ht == NULL)
return;
g_hash_table_iter_init (&iter, display->xid_ht);
while (g_hash_table_iter_next (&iter, NULL, (gpointer *)&surface))
{
gdk_x11_surface_check_monitor (surface, monitor);
}
}
static GdkX11Monitor *
find_monitor_by_output (GdkX11Display *x11_display, XID output)
{
int i;
for (i = 0; i < x11_display->monitors->len; i++)
for (i = 0; i < g_list_model_get_n_items (G_LIST_MODEL (x11_display->monitors)); i++)
{
GdkX11Monitor *monitor = x11_display->monitors->pdata[i];
GdkX11Monitor *monitor = g_list_model_get_item (G_LIST_MODEL (x11_display->monitors), i);
g_object_unref (monitor);
if (monitor->output == output)
return monitor;
}
@@ -411,7 +436,7 @@ translate_subpixel_order (int subpixel)
}
static gboolean
init_randr15 (GdkX11Screen *x11_screen, gboolean *changed)
init_randr15 (GdkX11Screen *x11_screen)
{
#ifdef HAVE_RANDR15
GdkDisplay *display = GDK_SCREEN_DISPLAY (x11_screen);
@@ -422,7 +447,6 @@ init_randr15 (GdkX11Screen *x11_screen, gboolean *changed)
int i;
XRRMonitorInfo *rr_monitors;
int num_rr_monitors;
int old_primary;
if (!x11_display->have_randr15)
return FALSE;
@@ -439,11 +463,12 @@ init_randr15 (GdkX11Screen *x11_screen, gboolean *changed)
if (!rr_monitors)
return FALSE;
for (i = 0; i < x11_display->monitors->len; i++)
for (i = 0; i < g_list_model_get_n_items (G_LIST_MODEL (x11_display->monitors)); i++)
{
GdkX11Monitor *monitor = x11_display->monitors->pdata[i];
GdkX11Monitor *monitor = g_list_model_get_item (G_LIST_MODEL (x11_display->monitors), i);
monitor->add = FALSE;
monitor->remove = TRUE;
g_object_unref (monitor);
}
for (i = 0; i < num_rr_monitors; i++)
@@ -503,7 +528,7 @@ init_randr15 (GdkX11Screen *x11_screen, gboolean *changed)
NULL);
monitor->output = output;
monitor->add = TRUE;
g_ptr_array_add (x11_display->monitors, monitor);
g_list_store_append (x11_display->monitors, monitor);
}
/* Fetch minimal manufacturer information (PNP ID) from EDID */
@@ -557,17 +582,8 @@ init_randr15 (GdkX11Screen *x11_screen, gboolean *changed)
newgeo.y = rr_monitors[i].y / x11_screen->surface_scale;
newgeo.width = rr_monitors[i].width / x11_screen->surface_scale;
newgeo.height = rr_monitors[i].height / x11_screen->surface_scale;
if (newgeo.x != geometry.x ||
newgeo.y != geometry.y ||
newgeo.width != geometry.width ||
newgeo.height != geometry.height ||
rr_monitors[i].mwidth != gdk_monitor_get_width_mm (GDK_MONITOR (monitor)) ||
rr_monitors[i].mheight != gdk_monitor_get_height_mm (GDK_MONITOR (monitor)) ||
g_strcmp0 (name, gdk_monitor_get_model (GDK_MONITOR (monitor))))
*changed = TRUE;
gdk_monitor_set_position (GDK_MONITOR (monitor), newgeo.x, newgeo.y);
gdk_monitor_set_size (GDK_MONITOR (monitor), newgeo.width, newgeo.height);
gdk_monitor_set_geometry (GDK_MONITOR (monitor), &newgeo);
g_object_notify (G_OBJECT (monitor), "workarea");
gdk_monitor_set_physical_size (GDK_MONITOR (monitor),
rr_monitors[i].mwidth,
@@ -591,29 +607,26 @@ init_randr15 (GdkX11Screen *x11_screen, gboolean *changed)
XRRFreeMonitors (rr_monitors);
XRRFreeScreenResources (resources);
for (i = x11_display->monitors->len - 1; i >= 0; i--)
for (i = g_list_model_get_n_items (G_LIST_MODEL (x11_display->monitors)) - 1; i >= 0; i--)
{
GdkX11Monitor *monitor = x11_display->monitors->pdata[i];
if (monitor->add)
{
gdk_display_monitor_added (display, GDK_MONITOR (monitor));
*changed = TRUE;
}
else if (monitor->remove)
GdkX11Monitor *monitor = g_list_model_get_item (G_LIST_MODEL (x11_display->monitors), i);
notify_surface_monitor_change (x11_display, GDK_MONITOR (monitor));
if (monitor->remove)
{
g_object_ref (monitor);
g_ptr_array_remove (x11_display->monitors, monitor);
gdk_display_monitor_removed (display, GDK_MONITOR (monitor));
g_list_store_remove (x11_display->monitors, i);
gdk_monitor_invalidate (GDK_MONITOR (monitor));
g_object_unref (monitor);
*changed = TRUE;
}
g_object_unref (monitor);
}
old_primary = x11_display->primary_monitor;
x11_display->primary_monitor = 0;
for (i = 0; i < x11_display->monitors->len; ++i)
for (i = 0; i < g_list_model_get_n_items (G_LIST_MODEL (x11_display->monitors)); i++)
{
GdkX11Monitor *monitor = x11_display->monitors->pdata[i];
GdkX11Monitor *monitor = g_list_model_get_item (G_LIST_MODEL (x11_display->monitors), i);
g_object_unref (monitor);
if (monitor->output == primary_output)
{
x11_display->primary_monitor = i;
@@ -633,17 +646,14 @@ init_randr15 (GdkX11Screen *x11_screen, gboolean *changed)
x11_display->primary_monitor = i;
}
if (x11_display->primary_monitor != old_primary)
*changed = TRUE;
return x11_display->monitors->len > 0;
return g_list_model_get_n_items (G_LIST_MODEL (x11_display->monitors)) > 0;
#endif
return FALSE;
}
static gboolean
init_randr13 (GdkX11Screen *x11_screen, gboolean *changed)
init_randr13 (GdkX11Screen *x11_screen)
{
#ifdef HAVE_RANDR
GdkDisplay *display = GDK_SCREEN_DISPLAY (x11_screen);
@@ -652,7 +662,6 @@ init_randr13 (GdkX11Screen *x11_screen, gboolean *changed)
RROutput primary_output = None;
RROutput first_output = None;
int i;
int old_primary;
if (!x11_display->have_randr13)
return FALSE;
@@ -662,11 +671,12 @@ init_randr13 (GdkX11Screen *x11_screen, gboolean *changed)
if (!resources)
return FALSE;
for (i = 0; i < x11_display->monitors->len; i++)
for (i = 0; i < g_list_model_get_n_items (G_LIST_MODEL (x11_display->monitors)); i++)
{
GdkX11Monitor *monitor = x11_display->monitors->pdata[i];
GdkX11Monitor *monitor = g_list_model_get_item (G_LIST_MODEL (x11_display->monitors), i);
monitor->add = FALSE;
monitor->remove = TRUE;
g_object_unref (monitor);
}
for (i = 0; i < resources->noutput; ++i)
@@ -712,7 +722,7 @@ init_randr13 (GdkX11Screen *x11_screen, gboolean *changed)
NULL);
monitor->output = output;
monitor->add = TRUE;
g_ptr_array_add (x11_display->monitors, monitor);
g_list_store_append (x11_display->monitors, monitor);
}
gdk_monitor_get_geometry (GDK_MONITOR (monitor), &geometry);
@@ -722,17 +732,8 @@ init_randr13 (GdkX11Screen *x11_screen, gboolean *changed)
newgeo.y = crtc->y / x11_screen->surface_scale;
newgeo.width = crtc->width / x11_screen->surface_scale;
newgeo.height = crtc->height / x11_screen->surface_scale;
if (newgeo.x != geometry.x ||
newgeo.y != geometry.y ||
newgeo.width != geometry.width ||
newgeo.height != geometry.height ||
output_info->mm_width != gdk_monitor_get_width_mm (GDK_MONITOR (monitor)) ||
output_info->mm_height != gdk_monitor_get_height_mm (GDK_MONITOR (monitor)) ||
g_strcmp0 (name, gdk_monitor_get_model (GDK_MONITOR (monitor))) != 0)
*changed = TRUE;
gdk_monitor_set_position (GDK_MONITOR (monitor), newgeo.x, newgeo.y);
gdk_monitor_set_size (GDK_MONITOR (monitor), newgeo.width, newgeo.height);
gdk_monitor_set_geometry (GDK_MONITOR (monitor), &newgeo);
g_object_notify (G_OBJECT (monitor), "workarea");
gdk_monitor_set_physical_size (GDK_MONITOR (monitor),
output_info->mm_width,
@@ -758,32 +759,28 @@ init_randr13 (GdkX11Screen *x11_screen, gboolean *changed)
/* Which usable multihead data is not returned in non RandR 1.2+ X driver? */
for (i = x11_display->monitors->len - 1; i >= 0; i--)
for (i = g_list_model_get_n_items (G_LIST_MODEL (x11_display->monitors)) - 1; i >= 0; i--)
{
GdkX11Monitor *monitor = x11_display->monitors->pdata[i];
if (monitor->add)
{
gdk_display_monitor_added (display, GDK_MONITOR (monitor));
*changed = TRUE;
}
else if (monitor->remove)
GdkX11Monitor *monitor = g_list_model_get_item (G_LIST_MODEL (x11_display->monitors), i);
notify_surface_monitor_change (x11_display, GDK_MONITOR (monitor));
if (monitor->remove)
{
g_object_ref (monitor);
g_ptr_array_remove (x11_display->monitors, monitor);
gdk_display_monitor_removed (display, GDK_MONITOR (monitor));
g_list_store_remove (x11_display->monitors, i);
gdk_monitor_invalidate (GDK_MONITOR (monitor));
g_object_unref (monitor);
*changed = TRUE;
}
}
old_primary = x11_display->primary_monitor;
x11_display->primary_monitor = 0;
primary_output = XRRGetOutputPrimary (x11_screen->xdisplay,
x11_screen->xroot_window);
for (i = 0; i < x11_display->monitors->len; ++i)
for (i = 0; i < g_list_model_get_n_items (G_LIST_MODEL (x11_display->monitors)); i++)
{
GdkX11Monitor *monitor = x11_display->monitors->pdata[i];
GdkX11Monitor *monitor = g_list_model_get_item (G_LIST_MODEL (x11_display->monitors), i);
g_object_unref (monitor);
if (monitor->output == primary_output)
{
x11_display->primary_monitor = i;
@@ -803,30 +800,27 @@ init_randr13 (GdkX11Screen *x11_screen, gboolean *changed)
x11_display->primary_monitor = i;
}
if (x11_display->primary_monitor != old_primary)
*changed = TRUE;
return x11_display->monitors->len > 0;
return g_list_model_get_n_items (G_LIST_MODEL (x11_display->monitors)) > 0;
#endif
return FALSE;
}
static void
init_no_multihead (GdkX11Screen *x11_screen, gboolean *changed)
init_no_multihead (GdkX11Screen *x11_screen)
{
GdkX11Display *x11_display = GDK_X11_DISPLAY (x11_screen->display);
GdkX11Monitor *monitor;
GdkRectangle geometry;
int width_mm, height_mm;
int width, height;
int i;
for (i = 0; i < x11_display->monitors->len; i++)
for (i = 0; i < g_list_model_get_n_items (G_LIST_MODEL (x11_display->monitors)); i++)
{
monitor = x11_display->monitors->pdata[i];
monitor = g_list_model_get_item (G_LIST_MODEL (x11_display->monitors), i);
monitor->add = FALSE;
monitor->remove = TRUE;
g_object_unref (monitor);
}
monitor = find_monitor_by_output (x11_display, 0);
@@ -839,7 +833,7 @@ init_no_multihead (GdkX11Screen *x11_screen, gboolean *changed)
NULL);
monitor->output = 0;
monitor->add = TRUE;
g_ptr_array_add (x11_display->monitors, monitor);
g_list_store_append (x11_display->monitors, monitor);
}
width_mm = WidthMMOfScreen (x11_screen->xscreen);
@@ -847,54 +841,35 @@ init_no_multihead (GdkX11Screen *x11_screen, gboolean *changed)
width = WidthOfScreen (x11_screen->xscreen);
height = HeightOfScreen (x11_screen->xscreen);
gdk_monitor_get_geometry (GDK_MONITOR (monitor), &geometry);
if (0 != geometry.x ||
0 != geometry.y ||
width != geometry.width ||
height != geometry.height ||
width_mm != gdk_monitor_get_width_mm (GDK_MONITOR (monitor)) ||
height_mm != gdk_monitor_get_height_mm (GDK_MONITOR (monitor)))
*changed = TRUE;
gdk_monitor_set_position (GDK_MONITOR (monitor), 0, 0);
gdk_monitor_set_size (GDK_MONITOR (monitor), width, height);
gdk_monitor_set_geometry (GDK_MONITOR (monitor), &(GdkRectangle) { 0, 0, width, height });
g_object_notify (G_OBJECT (monitor), "workarea");
gdk_monitor_set_physical_size (GDK_MONITOR (monitor), width_mm, height_mm);
gdk_monitor_set_scale_factor (GDK_MONITOR (monitor), x11_screen->surface_scale);
if (x11_display->primary_monitor != 0)
*changed = TRUE;
x11_display->primary_monitor = 0;
for (i = x11_display->monitors->len - 1; i >= 0; i--)
for (i = g_list_model_get_n_items (G_LIST_MODEL (x11_display->monitors)) - 1; i >= 0; i--)
{
monitor = x11_display->monitors->pdata[i];
if (monitor->add)
{
gdk_display_monitor_added (GDK_DISPLAY (x11_display), GDK_MONITOR (monitor));
*changed = TRUE;
}
else if (monitor->remove)
monitor = g_list_model_get_item (G_LIST_MODEL (x11_display->monitors), i);
notify_surface_monitor_change (x11_display, GDK_MONITOR (monitor));
if (monitor->remove)
{
g_object_ref (monitor);
g_ptr_array_remove (x11_display->monitors, monitor);
gdk_display_monitor_removed (GDK_DISPLAY (x11_display), GDK_MONITOR (monitor));
g_list_store_remove (x11_display->monitors, i);
gdk_monitor_invalidate (GDK_MONITOR (monitor));
g_object_unref (monitor);
*changed = TRUE;
}
g_object_unref (monitor);
}
}
static gboolean
static void
init_multihead (GdkX11Screen *screen)
{
gboolean any_changed = FALSE;
if (!init_randr15 (screen, &any_changed) &&
!init_randr13 (screen, &any_changed))
init_no_multihead (screen, &any_changed);
return any_changed;
if (!init_randr15 (screen) &&
!init_randr13 (screen))
init_no_multihead (screen);
}
GdkX11Screen *
@@ -958,11 +933,13 @@ _gdk_x11_screen_set_surface_scale (GdkX11Screen *x11_screen,
_gdk_x11_surface_set_surface_scale (surface, scale);
}
for (i = 0; i < x11_display->monitors->len; i++)
for (i = 0; i < g_list_model_get_n_items (G_LIST_MODEL (x11_display->monitors)); i++)
{
GdkMonitor *monitor = GDK_MONITOR (x11_display->monitors->pdata[i]);
GdkMonitor *monitor = g_list_model_get_item (G_LIST_MODEL (x11_display->monitors), i);
gdk_monitor_set_scale_factor (monitor, scale);
g_object_unref (monitor);
}
/* We re-read the monitor sizes so we can apply the new scale */
+28 -77
View File
@@ -71,10 +71,6 @@
#include <X11/extensions/Xfixes.h>
#endif
#ifdef HAVE_XDAMAGE
#include <X11/extensions/Xdamage.h>
#endif
const int _gdk_x11_event_mask_table[21] =
{
ExposureMask,
@@ -110,10 +106,6 @@ static void set_wm_name (GdkDisplay *display,
const gchar *name);
static void move_to_current_desktop (GdkSurface *surface);
static void gdk_x11_toplevel_state_callback (GdkSurface *surface);
static void gdk_x11_surface_on_monitor_added (GdkSurface *surface,
GdkMonitor *monitor);
static void gdk_x11_surface_on_monitor_removed (GdkSurface *surface,
GdkMonitor *monitor);
/* Return whether time1 is considered later than time2 as far as xserver
* time is concerned. Accounts for wraparound.
@@ -467,13 +459,6 @@ gdk_x11_surface_finalize (GObject *object)
_gdk_x11_display_remove_window (display, impl->xid);
if (impl->toplevel && impl->toplevel->focus_window)
_gdk_x11_display_remove_window (display, impl->toplevel->focus_window);
g_signal_handlers_disconnect_by_func (display,
gdk_x11_surface_on_monitor_added,
GDK_SURFACE (object));
g_signal_handlers_disconnect_by_func (display,
gdk_x11_surface_on_monitor_removed,
GDK_SURFACE (object));
}
g_clear_pointer (&impl->surface_is_on_monitor, g_list_free);
@@ -988,13 +973,6 @@ _gdk_x11_display_create_surface (GdkDisplay *display,
gdk_surface_freeze_updates (surface);
g_signal_connect_swapped (surface->display, "monitor-added",
G_CALLBACK (gdk_x11_surface_on_monitor_added),
surface);
g_signal_connect_swapped (surface->display, "monitor-removed",
G_CALLBACK (gdk_x11_surface_on_monitor_removed),
surface);
return surface;
}
@@ -1515,7 +1493,6 @@ show_popup (GdkSurface *surface)
{
gdk_x11_surface_raise (surface);
gdk_synthesize_surface_state (surface, GDK_SURFACE_STATE_WITHDRAWN, 0);
_gdk_surface_update_viewable (surface);
gdk_x11_surface_show (surface, FALSE);
gdk_surface_invalidate_rect (surface, NULL);
}
@@ -1602,7 +1579,7 @@ gdk_x11_surface_set_is_on_monitor (GdkSurface *surface,
}
}
static void
void
gdk_x11_surface_check_monitor (GdkSurface *surface,
GdkMonitor *monitor)
{
@@ -1628,36 +1605,18 @@ void
gdk_x11_surface_enter_leave_monitors (GdkSurface *surface)
{
GdkDisplay *display = gdk_surface_get_display (surface);
int n_monitors, i;
GListModel *monitors;
guint i;
n_monitors = gdk_display_get_n_monitors (display);
for (i = 0; i < n_monitors; i++)
monitors = gdk_display_get_monitors (display);
for (i = 0; i < g_list_model_get_n_items (monitors); i++)
{
GdkMonitor *monitor = gdk_display_get_monitor (display, i);
GdkMonitor *monitor = g_list_model_get_item (monitors, i);
gdk_x11_surface_check_monitor (surface, monitor);
g_object_unref (monitor);
}
}
static void
gdk_x11_surface_on_monitor_added (GdkSurface *surface,
GdkMonitor *monitor)
{
gdk_x11_surface_check_monitor (surface, monitor);
g_signal_connect_swapped (G_OBJECT (monitor), "notify::geometry",
G_CALLBACK (gdk_x11_surface_check_monitor),
surface);
}
static void
gdk_x11_surface_on_monitor_removed (GdkSurface *surface,
GdkMonitor *monitor)
{
gdk_x11_surface_check_monitor (surface, monitor);
g_signal_handlers_disconnect_by_func (G_OBJECT (monitor),
gdk_x11_surface_check_monitor,
monitor);
}
static void gdk_x11_surface_set_geometry_hints (GdkSurface *surface,
const GdkGeometry *geometry,
GdkSurfaceHints geom_mask);
@@ -3750,7 +3709,7 @@ wmspec_resize_drag (GdkSurface *surface,
break;
default:
g_warning ("gdk_surface_begin_resize_drag: bad resize edge %d!",
g_warning ("gdk_toplevel_begin_resize: bad resize edge %d!",
edge);
return;
}
@@ -4310,14 +4269,15 @@ _should_perform_ewmh_drag (GdkSurface *surface,
}
static void
gdk_x11_surface_begin_resize_drag (GdkSurface *surface,
GdkSurfaceEdge edge,
GdkDevice *device,
gint button,
gint x,
gint y,
guint32 timestamp)
gdk_x11_toplevel_begin_resize (GdkToplevel *toplevel,
GdkSurfaceEdge edge,
GdkDevice *device,
int button,
double x,
double y,
guint32 timestamp)
{
GdkSurface *surface = GDK_SURFACE (toplevel);
int root_x, root_y;
if (GDK_SURFACE_DESTROYED (surface))
@@ -4333,13 +4293,14 @@ gdk_x11_surface_begin_resize_drag (GdkSurface *surface,
}
static void
gdk_x11_surface_begin_move_drag (GdkSurface *surface,
GdkDevice *device,
gint button,
gint x,
gint y,
guint32 timestamp)
gdk_x11_toplevel_begin_move (GdkToplevel *toplevel,
GdkDevice *device,
int button,
double x,
double y,
guint32 timestamp)
{
GdkSurface *surface = GDK_SURFACE (toplevel);
int root_x, root_y;
gint direction;
@@ -4630,8 +4591,6 @@ gdk_x11_surface_class_init (GdkX11SurfaceClass *klass)
impl_class->destroy = gdk_x11_surface_destroy;
impl_class->beep = gdk_x11_surface_beep;
impl_class->begin_resize_drag = gdk_x11_surface_begin_resize_drag;
impl_class->begin_move_drag = gdk_x11_surface_begin_move_drag;
impl_class->destroy_notify = gdk_x11_surface_destroy_notify;
impl_class->drag_begin = _gdk_x11_surface_drag_begin;
impl_class->get_scale_factor = gdk_x11_surface_get_scale_factor;
@@ -4929,6 +4888,7 @@ gdk_x11_toplevel_present (GdkToplevel *toplevel,
GdkSurface *surface = GDK_SURFACE (toplevel);
GdkGeometry geometry;
GdkSurfaceHints mask;
gboolean was_mapped;
gdk_x11_surface_unminimize (surface);
@@ -4964,10 +4924,6 @@ gdk_x11_toplevel_present (GdkToplevel *toplevel,
else
gdk_x11_surface_unfullscreen (surface);
{
gboolean was_mapped;
gboolean did_show;
if (surface->destroyed)
return TRUE;
@@ -4976,16 +4932,10 @@ gdk_x11_toplevel_present (GdkToplevel *toplevel,
if (!was_mapped)
gdk_synthesize_surface_state (surface, GDK_SURFACE_STATE_WITHDRAWN, 0);
did_show = _gdk_surface_update_viewable (surface);
gdk_x11_surface_show (surface, !did_show ? was_mapped : TRUE);
gdk_x11_surface_show (surface, was_mapped);
if (!was_mapped)
{
if (gdk_surface_is_viewable (surface))
gdk_surface_invalidate_rect (surface, NULL);
}
}
gdk_surface_invalidate_rect (surface, NULL);
return TRUE;
}
@@ -5094,6 +5044,8 @@ gdk_x11_toplevel_iface_init (GdkToplevelInterface *iface)
iface->supports_edge_constraints = gdk_x11_toplevel_supports_edge_constraints;
iface->inhibit_system_shortcuts = gdk_x11_toplevel_inhibit_system_shortcuts;
iface->restore_system_shortcuts = gdk_x11_toplevel_restore_system_shortcuts;
iface->begin_resize = gdk_x11_toplevel_begin_resize;
iface->begin_move = gdk_x11_toplevel_begin_move;
}
typedef struct {
@@ -5129,7 +5081,6 @@ gdk_x11_drag_surface_present (GdkDragSurface *drag_surface,
gdk_x11_surface_toplevel_resize (surface, width, height);
gdk_synthesize_surface_state (surface, GDK_SURFACE_STATE_WITHDRAWN, 0);
_gdk_surface_update_viewable (surface);
gdk_x11_surface_show (surface, FALSE);
gdk_surface_invalidate_rect (surface, NULL);
+2 -8
View File
@@ -31,10 +31,6 @@
#include <X11/Xlib.h>
#ifdef HAVE_XDAMAGE
#include <X11/extensions/Xdamage.h>
#endif
#ifdef HAVE_XSYNC
#include <X11/Xlib.h>
#include <X11/extensions/sync.h>
@@ -73,10 +69,6 @@ struct _GdkX11Surface
cairo_surface_t *cairo_surface;
#if defined (HAVE_XCOMPOSITE) && defined(HAVE_XDAMAGE) && defined (HAVE_XFIXES)
Damage damage;
#endif
int abs_x;
int abs_y;
@@ -190,6 +182,8 @@ void gdk_x11_surface_pre_damage (GdkSurface *surface);
void gdk_x11_surface_move (GdkSurface *surface,
gint x,
gint y);
void gdk_x11_surface_check_monitor (GdkSurface *surface,
GdkMonitor *monitor);
G_END_DECLS
+1 -6
View File
@@ -106,7 +106,7 @@ GDK_AVAILABLE_IN_ALL
GdkX11Screen *gdk_x11_display_get_screen (GdkDisplay *display);
GDK_AVAILABLE_IN_ALL
GdkMonitor * gdk_x11_display_get_primary_monitor (GdkDisplay *display);
GdkMonitor * gdk_x11_display_get_primary_monitor (GdkDisplay *self);
GDK_AVAILABLE_IN_ALL
void gdk_x11_display_grab (GdkDisplay *display);
@@ -125,11 +125,6 @@ G_GNUC_WARN_UNUSED_RESULT gint gdk_x11_display_error_trap_pop (GdkDispla
GDK_AVAILABLE_IN_ALL
void gdk_x11_display_error_trap_pop_ignored (GdkDisplay *display);
GDK_AVAILABLE_IN_ALL
void gdk_x11_register_standard_event_type (GdkDisplay *display,
gint event_base,
gint n_events);
GDK_AVAILABLE_IN_ALL
void gdk_x11_set_sm_client_id (const gchar *sm_client_id);
-1
View File
@@ -65,7 +65,6 @@ gdk_x11_deps = [
xext_dep,
x11_dep,
xcursor_dep,
xdamage_dep,
xfixes_dep,
xcomposite_dep,
xrandr_dep,
+8 -1
View File
@@ -756,7 +756,14 @@ gsk_broadway_renderer_add_node (GskRenderer *renderer,
int height = ceil (node->bounds.origin.y + node->bounds.size.height) - y;
int scale = broadway_display->scale_factor;
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, width * scale, height * scale);
#define MAX_IMAGE_SIZE 32767
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
MIN (width * scale, MAX_IMAGE_SIZE),
MIN (height * scale, MAX_IMAGE_SIZE));
#undef MAX_IMAGE_SIZE
cr = cairo_create (surface);
cairo_scale (cr, scale, scale);
cairo_translate (cr, -x, -y);
+12 -3
View File
@@ -1177,18 +1177,27 @@ render_clipped_child (GskGLRenderer *self,
&transformed_clip))
{
/* well fuck */
const float scale = ops_get_scale (builder);
gboolean is_offscreen;
TextureRegion region;
GskRoundedRect scaled_clip;
ops_push_clip (builder, &child_clip);
memset (&scaled_clip, 0, sizeof (GskRoundedRect));
scaled_clip.bounds.origin.x = clip->origin.x * scale;
scaled_clip.bounds.origin.y = clip->origin.y * scale;
scaled_clip.bounds.size.width = clip->size.width * scale;
scaled_clip.bounds.size.height = clip->size.height * scale;
ops_push_clip (builder, &scaled_clip);
if (!add_offscreen_ops (self, builder, &child->bounds,
child,
&region, &is_offscreen,
RESET_OPACITY | RESET_CLIP))
RESET_OPACITY | FORCE_OFFSCREEN))
g_assert_not_reached ();
ops_pop_clip (builder);
ops_set_program (builder, &self->programs->blit_program);
ops_set_texture (builder, region.texture_id);
+19 -14
View File
@@ -98,25 +98,30 @@ typedef enum {
* @GSK_BLEND_MODE_DEFAULT: The default blend mode, which specifies no blending
* @GSK_BLEND_MODE_MULTIPLY: The source color is multiplied by the destination
* and replaces the destination
* @GSK_BLEND_MODE_SCREEN: ...
* @GSK_BLEND_MODE_OVERLAY: ...
* @GSK_BLEND_MODE_DARKEN: ...
* @GSK_BLEND_MODE_LIGHTEN: ...
* @GSK_BLEND_MODE_COLOR_DODGE: ...
* @GSK_BLEND_MODE_COLOR_BURN: ...
* @GSK_BLEND_MODE_HARD_LIGHT: ...
* @GSK_BLEND_MODE_SOFT_LIGHT: ...
* @GSK_BLEND_MODE_DIFFERENCE: ...
* @GSK_BLEND_MODE_EXCLUSION: ...
* @GSK_BLEND_MODE_COLOR: ...
* @GSK_BLEND_MODE_HUE: ...
* @GSK_BLEND_MODE_SATURATION: ...
* @GSK_BLEND_MODE_LUMINOSITY: ...
* @GSK_BLEND_MODE_SCREEN: Multiplies the complements of the destination and source
* color values, then complements the result.
* @GSK_BLEND_MODE_OVERLAY: Multiplies or screens the colors, depending on the
* destination color value. This is the inverse of hard-list
* @GSK_BLEND_MODE_DARKEN: Selects the darker of the destination and source colors
* @GSK_BLEND_MODE_LIGHTEN: Selects the lighter of the destination and source colors
* @GSK_BLEND_MODE_COLOR_DODGE: Brightens the destination color to reflect the source color
* @GSK_BLEND_MODE_COLOR_BURN: Darkens the destination color to reflect the source color
* @GSK_BLEND_MODE_HARD_LIGHT: Multiplies or screens the colors, depending on the source color value
* @GSK_BLEND_MODE_SOFT_LIGHT: Darkens or lightens the colors, depending on the source color value
* @GSK_BLEND_MODE_DIFFERENCE: Subtracts the darker of the two constituent colors from the lighter color
* @GSK_BLEND_MODE_EXCLUSION: Produces an effect similar to that of the difference mode but lower in contrast
* @GSK_BLEND_MODE_COLOR: Creates a color with the hue and saturation of the source color and the luminosity of the destination color
* @GSK_BLEND_MODE_HUE: Creates a color with the hue of the source color and the saturation and luminosity of the destination color
* @GSK_BLEND_MODE_SATURATION: Creates a color with the saturation of the source color and the hue and luminosity of the destination color
* @GSK_BLEND_MODE_LUMINOSITY: Creates a color with the luminosity of the source color and the hue and saturation of the destination color
*
* The blend modes available for render nodes.
*
* The implementation of each blend mode is deferred to the
* rendering pipeline.
*
* See https://www.w3.org/TR/compositing-1/#blending for more information
* on blending and blend modes.
*/
typedef enum {
GSK_BLEND_MODE_DEFAULT = 0,
+23 -1
View File
@@ -2331,6 +2331,28 @@ gsk_color_matrix_node_draw (GskRenderNode *node,
cairo_pattern_destroy (pattern);
}
static void
gsk_color_matrix_node_diff (GskRenderNode *node1,
GskRenderNode *node2,
cairo_region_t *region)
{
GskColorMatrixNode *self1 = (GskColorMatrixNode *) node1;
GskColorMatrixNode *self2 = (GskColorMatrixNode *) node2;
if (!graphene_vec4_equal (&self1->color_offset, &self2->color_offset))
goto nope;
if (!graphene_matrix_equal_fast (&self1->color_matrix, &self2->color_matrix))
goto nope;
gsk_render_node_diff (self1->child, self2->child, region);
return;
nope:
gsk_render_node_diff_impossible (node1, node2, region);
return;
}
/**
* gsk_color_matrix_node_new:
* @child: The node to draw
@@ -4311,7 +4333,7 @@ gsk_render_node_init_types_once (void)
gsk_color_matrix_node_finalize,
gsk_color_matrix_node_draw,
NULL,
NULL,
gsk_color_matrix_node_diff,
};
GType node_type = gsk_render_node_type_register_static (I_("GskColorMatrixNode"), &node_info);
+1 -1
View File
@@ -1043,7 +1043,7 @@ gtk_cell_area_real_event (GtkCellArea *area,
GtkCellRenderer *focus_renderer;
GdkRectangle alloc_area;
double event_x, event_y;
int x, y;
double x, y;
GtkNative *native;
/* We may need some semantics to tell us the offset of the event
+9 -8
View File
@@ -274,6 +274,7 @@ get_child_position (GtkOverlay *overlay,
GtkRequisition req;
GtkAllocation alloc;
gint s, e;
double x, y;
gtk_widget_get_preferred_size (widget, &req, NULL);
@@ -287,11 +288,11 @@ get_child_position (GtkOverlay *overlay,
gtk_widget_translate_coordinates (editor->sv_plane,
gtk_widget_get_parent (editor->grid),
0, -6,
&allocation->x, &allocation->y);
&x, &y);
if (gtk_widget_get_direction (GTK_WIDGET (overlay)) == GTK_TEXT_DIR_RTL)
allocation->x = 0;
x = 0;
else
allocation->x = gtk_widget_get_width (GTK_WIDGET (overlay)) - req.width;
x = gtk_widget_get_width (GTK_WIDGET (overlay)) - req.width;
}
else if (widget == editor->h_popup)
{
@@ -302,12 +303,12 @@ get_child_position (GtkOverlay *overlay,
gtk_widget_translate_coordinates (editor->h_slider,
gtk_widget_get_parent (editor->grid),
- req.width - 6, editor->popup_position - req.height / 2,
&allocation->x, &allocation->y);
&x, &y);
else
gtk_widget_translate_coordinates (editor->h_slider,
gtk_widget_get_parent (editor->grid),
alloc.width + 6, editor->popup_position - req.height / 2,
&allocation->x, &allocation->y);
&x, &y);
}
else if (widget == editor->a_popup)
{
@@ -317,13 +318,13 @@ get_child_position (GtkOverlay *overlay,
gtk_widget_translate_coordinates (editor->a_slider,
gtk_widget_get_parent (editor->grid),
editor->popup_position - req.width / 2, - req.height - 6,
&allocation->x, &allocation->y);
&x, &y);
}
else
return FALSE;
allocation->x = CLAMP (allocation->x, 0, gtk_widget_get_width (GTK_WIDGET (overlay)) - req.width);
allocation->y = CLAMP (allocation->y, 0, gtk_widget_get_height (GTK_WIDGET (overlay)) - req.height);
allocation->x = CLAMP (x, 0, gtk_widget_get_width (GTK_WIDGET (overlay)) - req.width);
allocation->y = CLAMP (y, 0, gtk_widget_get_height (GTK_WIDGET (overlay)) - req.height);
return TRUE;
}
+25
View File
@@ -21,6 +21,7 @@
#include "gtkcolorchooserprivate.h"
#include "gtkgesturelongpress.h"
#include "gtkgestureclick.h"
#include "gtkcolorutils.h"
#include "gtkorientable.h"
#include "gtkrangeprivate.h"
@@ -53,6 +54,12 @@ static void hold_action (GtkGestureLongPress *gesture,
gdouble y,
GtkWidget *scale);
static void click_action (GtkGestureClick *gesture,
guint n_presses,
double x,
double y,
GtkWidget *scale);
G_DEFINE_TYPE_WITH_PRIVATE (GtkColorScale, gtk_color_scale, GTK_TYPE_SCALE)
void
@@ -160,6 +167,12 @@ gtk_color_scale_init (GtkColorScale *scale)
GTK_PHASE_TARGET);
gtk_widget_add_controller (GTK_WIDGET (scale), GTK_EVENT_CONTROLLER (gesture));
gesture = gtk_gesture_click_new ();
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture), GDK_BUTTON_SECONDARY);
g_signal_connect (gesture, "pressed",
G_CALLBACK (click_action), scale);
gtk_widget_add_controller (GTK_WIDGET (scale), GTK_EVENT_CONTROLLER (gesture));
gtk_widget_add_css_class (GTK_WIDGET (scale), "color");
}
@@ -256,6 +269,18 @@ hold_action (GtkGestureLongPress *gesture,
"s", gtk_widget_get_name (scale));
}
static void
click_action (GtkGestureClick *gesture,
guint n_presses,
double x,
double y,
GtkWidget *scale)
{
gtk_widget_activate_action (scale,
"color.edit",
"s", gtk_widget_get_name (scale));
}
static void
scale_finalize (GObject *object)
{
+1 -1
View File
@@ -26,7 +26,7 @@ struct _GtkCssValue {
GTK_CSS_VALUE_BASE
};
static void
static void G_GNUC_NORETURN
gtk_css_value_inherit_free (GtkCssValue *value)
{
/* Can only happen if the unique value gets unreffed too often */
+1 -1
View File
@@ -30,7 +30,7 @@ struct _GtkCssValue {
GTK_CSS_VALUE_BASE
};
static void
static void G_GNUC_NORETURN
gtk_css_value_initial_free (GtkCssValue *value)
{
/* Can only happen if the unique value gets unreffed too often */
+10 -10
View File
@@ -27,6 +27,7 @@
#include "gtkcsstypesprivate.h"
#include "gtknativeprivate.h"
#include "gtkpicture.h"
#include "gtkcssboxesimplprivate.h"
#include "gtkcssnumbervalueprivate.h"
/* for the drag icons */
@@ -119,18 +120,17 @@ gtk_drag_icon_native_get_renderer (GtkNative *native)
static void
gtk_drag_icon_native_get_surface_transform (GtkNative *native,
int *x,
int *y)
double *x,
double *y)
{
GtkCssStyle *style;
GtkCssBoxes css_boxes;
const graphene_rect_t *margin_rect;
style = gtk_css_node_get_style (gtk_widget_get_css_node (GTK_WIDGET (native)));
*x = _gtk_css_number_value_get (style->size->margin_left, 100) +
_gtk_css_number_value_get (style->border->border_left_width, 100) +
_gtk_css_number_value_get (style->size->padding_left, 100);
*y = _gtk_css_number_value_get (style->size->margin_top, 100) +
_gtk_css_number_value_get (style->border->border_top_width, 100) +
_gtk_css_number_value_get (style->size->padding_top, 100);
gtk_css_boxes_init (&css_boxes, GTK_WIDGET (native));
margin_rect = gtk_css_boxes_get_margin_rect (&css_boxes);
*x = - margin_rect->origin.x;
*y = - margin_rect->origin.y;
}
static void
+3 -3
View File
@@ -490,7 +490,7 @@ gtk_drag_source_drag_begin (GtkDragSource *source)
{
GtkWidget *widget;
GdkDevice *device;
int x, y;
double x, y;
GtkNative *native;
GdkSurface *surface;
double px, py;
@@ -509,8 +509,8 @@ gtk_drag_source_drag_begin (GtkDragSource *source)
gtk_widget_translate_coordinates (widget, GTK_WIDGET (native), source->start_x, source->start_y, &x, &y);
gdk_surface_get_device_position (surface, device, &px, &py, NULL);
dx = round (px) - x;
dy = round (py) - y;
dx = round (px - x);
dy = round (py - y);
g_signal_emit (source, signals[PREPARE], 0, source->start_x, source->start_y, &content);
if (!content)
+1 -1
View File
@@ -253,7 +253,7 @@ scroll_to_child (GtkWidget *child)
GtkEmojiChooser *chooser;
GtkAdjustment *adj;
GtkAllocation alloc;
int pos;
double pos;
double value;
double page_size;
+1 -1
View File
@@ -2799,7 +2799,7 @@ gtk_entry_get_icon_at_pos (GtkEntry *entry,
for (i = 0; i < MAX_ICONS; i++)
{
EntryIconInfo *icon_info = priv->icons[i];
int icon_x, icon_y;
double icon_x, icon_y;
if (icon_info == NULL)
continue;
+4 -5
View File
@@ -329,12 +329,11 @@ gtk_event_controller_scroll_handle_event (GtkEventController *controller,
}
if (dx != 0 || dy != 0)
{
g_signal_emit (controller, signals[SCROLL], 0, dx, dy, &handled);
g_signal_emit (controller, signals[SCROLL], 0, dx, dy, &handled);
if (scroll->flags & GTK_EVENT_CONTROLLER_SCROLL_KINETIC)
scroll_history_push (scroll, dx, dy, gdk_event_get_time (event));
}
if (direction == GDK_SCROLL_SMOOTH &&
scroll->flags & GTK_EVENT_CONTROLLER_SCROLL_KINETIC)
scroll_history_push (scroll, dx, dy, gdk_event_get_time (event));
if (scroll->active && gdk_scroll_event_is_stop (event))
{
+9 -6
View File
@@ -1428,6 +1428,7 @@ rename_selected_cb (GtkTreeModel *model,
GtkFileChooserWidget *impl = data;
GdkRectangle rect;
gchar *filename;
double x, y;
gtk_tree_model_get (model, iter,
MODEL_COL_FILE, &impl->rename_file_source_file,
@@ -1442,7 +1443,9 @@ rename_selected_cb (GtkTreeModel *model,
gtk_widget_translate_coordinates (impl->browse_files_tree_view,
GTK_WIDGET (impl),
rect.x, rect.y,
&rect.x, &rect.y);
&x, &y);
rect.x = x;
rect.y = y;
filename = g_file_get_basename (impl->rename_file_source_file);
gtk_editable_set_text (GTK_EDITABLE (impl->rename_file_name_entry), filename);
@@ -2009,9 +2012,10 @@ file_list_show_popover (GtkFileChooserWidget *impl,
gtk_widget_translate_coordinates (impl->browse_files_tree_view,
GTK_WIDGET (impl),
rect.x, rect.y,
&rect.x, &rect.y);
&x, &y);
rect.x = CLAMP (x - 20, 0, bounds.size.width - 40);
rect.y = y;
rect.width = 40;
g_list_free_full (list, (GDestroyNotify) gtk_tree_path_free);
@@ -2113,15 +2117,14 @@ click_cb (GtkGesture *gesture,
GtkFileChooserWidget *impl)
{
PopoverData *pd;
int xx, yy;
pd = g_new (PopoverData, 1);
pd->impl = impl;
gtk_widget_translate_coordinates (impl->browse_files_tree_view,
GTK_WIDGET (impl),
x, y, &xx, &yy);
pd->x = xx;
pd->y = yy;
x, y, &x, &y);
pd->x = x;
pd->y = y;
g_idle_add (file_list_show_popover_in_idle, pd);
}
+4 -1
View File
@@ -354,6 +354,7 @@ notify_cursor_location (GtkIMContextWayland *context)
{
GtkIMContextWaylandGlobal *global;
cairo_rectangle_int_t rect;
double x, y;
global = gtk_im_context_wayland_get_global (context);
if (global == NULL)
@@ -363,8 +364,10 @@ notify_cursor_location (GtkIMContextWayland *context)
gtk_widget_translate_coordinates (context->widget,
GTK_WIDGET (gtk_widget_get_root (context->widget)),
rect.x, rect.y,
&rect.x, &rect.y);
&x, &y);
rect.x = x;
rect.y = y;
zwp_text_input_v3_set_cursor_rectangle (global->text_input,
rect.x, rect.y,
rect.width, rect.height);
+51 -81
View File
@@ -291,10 +291,6 @@ struct _GtkLabel
gint width_chars;
gint max_width_chars;
gint lines;
int min_width, min_height;
int nat_width, nat_height;
int min_baseline, nat_baseline;
};
struct _GtkLabelClass
@@ -1782,42 +1778,7 @@ gtk_label_recalculate (GtkLabel *self)
g_object_notify_by_pspec (G_OBJECT (self), label_props[PROP_MNEMONIC_KEYVAL]);
}
if (self->wrap)
gtk_widget_queue_resize (GTK_WIDGET (self));
else
{
int min_width = self->min_width;
int min_height = self->min_height;
int nat_width = self->nat_width;
int nat_height = self->nat_height;
int min_baseline = self->min_baseline;
int nat_baseline = self->nat_baseline;
gtk_label_measure (GTK_WIDGET (self),
GTK_ORIENTATION_HORIZONTAL,
-1,
&min_width, &nat_width,
NULL, NULL);
gtk_label_measure (GTK_WIDGET (self),
GTK_ORIENTATION_VERTICAL,
-1,
&min_height, &nat_height,
&min_baseline, &nat_baseline);
if (min_width != self->min_width ||
min_height != self->min_height ||
nat_width != self->nat_width ||
nat_height != self->nat_height ||
min_baseline != self->min_baseline ||
nat_baseline != self->nat_baseline)
{
gtk_widget_queue_resize (GTK_WIDGET (self));
}
else
{
gtk_widget_queue_draw (GTK_WIDGET (self));
}
}
gtk_widget_queue_resize (GTK_WIDGET (self));
}
/**
@@ -3215,19 +3176,6 @@ gtk_label_measure (GtkWidget *widget,
}
else
gtk_label_get_preferred_size (widget, orientation, minimum, natural, minimum_baseline, natural_baseline);
if (orientation == GTK_ORIENTATION_HORIZONTAL)
{
self->min_width = *minimum;
self->nat_width = *natural;
}
else
{
self->min_height = *minimum;
self->nat_height = *natural;
self->min_baseline = *minimum_baseline;
self->nat_baseline = *natural_baseline;
}
}
static void
@@ -4989,25 +4937,37 @@ gtk_label_get_single_line_mode (GtkLabel *self)
*/
static void
get_better_cursor (GtkLabel *self,
gint index,
gint *x,
gint *y)
int index,
int *x,
int *y)
{
GdkSeat *seat = gdk_display_get_default_seat (gtk_widget_get_display (GTK_WIDGET (self)));
GdkDevice *device = gdk_seat_get_keyboard (seat);
PangoDirection keymap_direction = gdk_device_get_direction (device);
PangoDirection cursor_direction = get_cursor_direction (self);
GdkSeat *seat;
GdkDevice *keyboard;
PangoDirection keymap_direction;
PangoDirection cursor_direction;
gboolean split_cursor;
PangoRectangle strong_pos, weak_pos;
seat = gdk_display_get_default_seat (gtk_widget_get_display (GTK_WIDGET (self)));
if (seat)
keyboard = gdk_seat_get_keyboard (seat);
else
keyboard = NULL;
if (keyboard)
keymap_direction = gdk_device_get_direction (keyboard);
else
keymap_direction = PANGO_DIRECTION_LTR;
cursor_direction = get_cursor_direction (self);
g_object_get (gtk_widget_get_settings (GTK_WIDGET (self)),
"gtk-split-cursor", &split_cursor,
NULL);
"gtk-split-cursor", &split_cursor,
NULL);
gtk_label_ensure_layout (self);
pango_layout_get_cursor_pos (self->layout, index,
&strong_pos, &weak_pos);
&strong_pos, &weak_pos);
if (split_cursor)
{
@@ -5017,15 +4977,15 @@ get_better_cursor (GtkLabel *self,
else
{
if (keymap_direction == cursor_direction)
{
*x = strong_pos.x / PANGO_SCALE;
*y = strong_pos.y / PANGO_SCALE;
}
{
*x = strong_pos.x / PANGO_SCALE;
*y = strong_pos.y / PANGO_SCALE;
}
else
{
*x = weak_pos.x / PANGO_SCALE;
*y = weak_pos.y / PANGO_SCALE;
}
{
*x = weak_pos.x / PANGO_SCALE;
*y = weak_pos.y / PANGO_SCALE;
}
}
}
@@ -5093,16 +5053,26 @@ gtk_label_move_visually (GtkLabel *self,
NULL);
if (split_cursor)
strong = TRUE;
strong = TRUE;
else
{
GdkSeat *seat = gdk_display_get_default_seat (gtk_widget_get_display (GTK_WIDGET (self)));
GdkDevice *device = gdk_seat_get_keyboard (seat);
PangoDirection keymap_direction = gdk_device_get_direction (device);
{
GdkSeat *seat;
GdkDevice *keyboard;
PangoDirection keymap_direction;
seat = gdk_display_get_default_seat (gtk_widget_get_display (GTK_WIDGET (self)));
if (seat)
keyboard = gdk_seat_get_keyboard (seat);
else
keyboard = NULL;
if (keyboard)
keymap_direction = gdk_device_get_direction (keyboard);
else
keymap_direction = PANGO_DIRECTION_LTR;
strong = keymap_direction == get_cursor_direction (self);
}
strong = keymap_direction == get_cursor_direction (self);
}
if (count > 0)
{
pango_layout_move_cursor_visually (self->layout, strong, index, 0, 1, &new_index, &new_trailing);
+22 -5
View File
@@ -96,6 +96,7 @@
#include "gsk/gskprivate.h"
#include "gsk/gskrendernodeprivate.h"
#include "gtkarrayimplprivate.h"
#include "gtknativeprivate.h"
#include <locale.h>
@@ -1280,8 +1281,10 @@ translate_event_coordinates (GdkEvent *event,
GtkWidget *widget)
{
GtkWidget *event_widget;
GtkNative *native;
graphene_point_t p;
double event_x, event_y;
double native_x, native_y;
*x = *y = 0;
@@ -1289,6 +1292,11 @@ translate_event_coordinates (GdkEvent *event,
return FALSE;
event_widget = gtk_get_event_widget (event);
native = gtk_widget_get_native (event_widget);
gtk_native_get_surface_transform (GTK_NATIVE (native), &native_x, &native_y);
event_x -= native_x;
event_y -= native_y;
if (!gtk_widget_compute_point (event_widget,
widget,
@@ -1424,7 +1432,8 @@ update_pointer_focus_state (GtkWindow *toplevel,
GtkWidget *old_target = NULL;
GdkEventSequence *sequence;
GdkDevice *device;
gdouble x, y;
double x, y;
double nx, ny;
device = gdk_event_get_device (event);
sequence = gdk_event_get_event_sequence (event);
@@ -1433,6 +1442,10 @@ update_pointer_focus_state (GtkWindow *toplevel,
return old_target;
gdk_event_get_position (event, &x, &y);
gtk_native_get_surface_transform (GTK_NATIVE (toplevel), &nx, &ny);
x -= nx;
y -= ny;
gtk_window_update_pointer_focus (toplevel, device, sequence,
new_target, x, y);
@@ -1511,7 +1524,8 @@ handle_pointing_event (GdkEvent *event)
GtkWindow *toplevel;
GdkEventSequence *sequence;
GdkDevice *device;
gdouble x, y;
double x, y;
double native_x, native_y;
GtkWidget *native;
GdkEventType type;
@@ -1522,6 +1536,10 @@ handle_pointing_event (GdkEvent *event)
toplevel = GTK_WINDOW (gtk_widget_get_root (event_widget));
native = GTK_WIDGET (gtk_widget_get_native (event_widget));
gtk_native_get_surface_transform (GTK_NATIVE (native), &native_x, &native_y);
x -= native_x;
y -= native_y;
type = gdk_event_get_event_type (event);
sequence = gdk_event_get_event_sequence (event);
@@ -1555,7 +1573,7 @@ handle_pointing_event (GdkEvent *event)
target = gtk_window_lookup_pointer_focus_implicit_grab (toplevel, device, sequence);
if (!target)
target = gtk_widget_pick (native, x, y, GTK_PICK_DEFAULT);
target = gtk_widget_pick (native, x, y, GTK_PICK_DEFAULT);
if (!target)
target = GTK_WIDGET (native);
@@ -1601,8 +1619,7 @@ handle_pointing_event (GdkEvent *event)
if (type == GDK_BUTTON_RELEASE)
{
GtkWidget *new_target;
new_target = gtk_widget_pick (GTK_WIDGET (native), x, y, GTK_PICK_DEFAULT);
GtkWidget *new_target = gtk_widget_pick (native, x, y, GTK_PICK_DEFAULT);
if (new_target == NULL)
new_target = GTK_WIDGET (toplevel);
gtk_synthesize_crossing_events (GTK_ROOT (toplevel), GTK_CROSSING_POINTER, target, new_target,
+13 -4
View File
@@ -48,8 +48,8 @@ gtk_native_default_get_renderer (GtkNative *self)
static void
gtk_native_default_get_surface_transform (GtkNative *self,
int *x,
int *y)
double *x,
double *y)
{
*x = 0;
*y = 0;
@@ -100,10 +100,19 @@ gtk_native_get_renderer (GtkNative *self)
return GTK_NATIVE_GET_IFACE (self)->get_renderer (self);
}
/**
* gtk_native_get_surface_transform:
* @self: a @GtkNative
* @x: (out): return location for the x coordinate
* @y: (out): return location for the y coordinate
*
* Retrieves the surface transform of @self. This is the translation
* from @self's surface coordinates into @self's widget coordinates.
*/
void
gtk_native_get_surface_transform (GtkNative *self,
int *x,
int *y)
double *x,
double *y)
{
g_return_if_fail (GTK_IS_NATIVE (self));
g_return_if_fail (x != NULL);
+7 -2
View File
@@ -49,8 +49,8 @@ struct _GtkNativeInterface
GskRenderer * (* get_renderer) (GtkNative *self);
void (* get_surface_transform) (GtkNative *self,
int *x,
int *y);
double *x,
double *y);
void (* check_resize) (GtkNative *self);
};
@@ -67,6 +67,11 @@ GdkSurface *gtk_native_get_surface (GtkNative *self);
GDK_AVAILABLE_IN_ALL
GskRenderer *gtk_native_get_renderer (GtkNative *self);
GDK_AVAILABLE_IN_ALL
void gtk_native_get_surface_transform (GtkNative *self,
double *x,
double *y);
G_END_DECLS
#endif /* __GTK_NATIVE_H__ */
-4
View File
@@ -5,10 +5,6 @@
G_BEGIN_DECLS
void gtk_native_get_surface_transform (GtkNative *self,
int *x,
int *y);
G_END_DECLS
#endif /* __GTK_NATIVE_PRIVATE_H__ */
+13 -4
View File
@@ -167,12 +167,20 @@ gtk_password_entry_realize (GtkWidget *widget)
{
GtkPasswordEntry *entry = GTK_PASSWORD_ENTRY (widget);
GtkPasswordEntryPrivate *priv = gtk_password_entry_get_instance_private (entry);
GdkSeat *seat;
GTK_WIDGET_CLASS (gtk_password_entry_parent_class)->realize (widget);
priv->keyboard = gdk_seat_get_keyboard (gdk_display_get_default_seat (gtk_widget_get_display (widget)));
g_signal_connect (priv->keyboard, "notify::caps-lock-state", G_CALLBACK (caps_lock_state_changed), entry);
caps_lock_state_changed (priv->keyboard, NULL, widget);
seat = gdk_display_get_default_seat (gtk_widget_get_display (widget));
if (seat)
priv->keyboard = gdk_seat_get_keyboard (seat);
if (priv->keyboard)
{
g_signal_connect (priv->keyboard, "notify::caps-lock-state",
G_CALLBACK (caps_lock_state_changed), entry);
caps_lock_state_changed (priv->keyboard, NULL, widget);
}
}
static void
@@ -496,7 +504,8 @@ gtk_password_entry_set_show_peek_icon (GtkPasswordEntry *entry,
entry);
}
caps_lock_state_changed (priv->keyboard, NULL, GTK_WIDGET (entry));
if (priv->keyboard)
caps_lock_state_changed (priv->keyboard, NULL, GTK_WIDGET (entry));
g_object_notify_by_pspec (G_OBJECT (entry), props[PROP_SHOW_PEEK_ICON]);
}
+4 -6
View File
@@ -1686,8 +1686,6 @@ drag_motion_callback (GtkDropTarget *target,
if (row != NULL)
{
gint dest_y, dest_x;
g_object_get (row, "order-index", &row_index, NULL);
g_object_get (sidebar->row_placeholder, "order-index", &row_placeholder_index, NULL);
/* We order the bookmarks sections based on the bookmark index that we
@@ -1703,9 +1701,9 @@ drag_motion_callback (GtkDropTarget *target,
row_placeholder_index = row_index;
gtk_widget_translate_coordinates (GTK_WIDGET (sidebar), GTK_WIDGET (row),
x, y,
&dest_x, &dest_y);
&x, &y);
if (dest_y > sidebar->drag_row_height / 2 && row_index > 0)
if (y > sidebar->drag_row_height / 2 && row_index > 0)
row_placeholder_index++;
}
else
@@ -3459,8 +3457,8 @@ on_row_dragged (GtkGestureDrag *gesture,
if (gtk_drag_check_threshold (GTK_WIDGET (row), 0, 0, x, y))
{
gdouble start_x, start_y;
gint drag_x, drag_y;
double start_x, start_y;
double drag_x, drag_y;
GdkContentProvider *content;
GdkSurface *surface;
GdkDevice *device;
+4 -1
View File
@@ -1898,14 +1898,17 @@ on_address_entry_show_help_pressed (GtkPlacesView *view,
GtkEntry *entry)
{
GdkRectangle rect;
double x, y;
/* Setup the auxiliary popover's rectangle */
gtk_entry_get_icon_area (GTK_ENTRY (view->address_entry),
GTK_ENTRY_ICON_SECONDARY,
&rect);
gtk_widget_translate_coordinates (view->address_entry, GTK_WIDGET (view),
rect.x, rect.y, &rect.x, &rect.y);
rect.x, rect.y, &x, &y);
rect.x = x;
rect.y = y;
gtk_popover_set_pointing_to (GTK_POPOVER (view->server_adresses_popover), &rect);
gtk_widget_set_visible (view->server_adresses_popover, TRUE);
}
+33 -99
View File
@@ -115,14 +115,14 @@
#include "gtkmenusectionboxprivate.h"
#include "gdk/gdkeventsprivate.h"
#include "gtkpointerfocusprivate.h"
#include "gtkcsstypesprivate.h"
#include "gtkcssnodeprivate.h"
#include "gtkcsscolorvalueprivate.h"
#include "gtkcssnumbervalueprivate.h"
#include "gtksnapshot.h"
#include "gtkshortcutmanager.h"
#include "gtkbuildable.h"
#include "gtktooltipprivate.h"
#include "gtkcssboxesimplprivate.h"
#include "gtknativeprivate.h"
#include "gtkrender.h"
#include "gtkstylecontextprivate.h"
@@ -218,18 +218,17 @@ gtk_popover_native_get_renderer (GtkNative *native)
static void
gtk_popover_native_get_surface_transform (GtkNative *native,
int *x,
int *y)
double *x,
double *y)
{
GtkCssStyle *style;
GtkCssBoxes css_boxes;
const graphene_rect_t *margin_rect;
style = gtk_css_node_get_style (gtk_widget_get_css_node (GTK_WIDGET (native)));
*x = _gtk_css_number_value_get (style->size->margin_left, 100) +
_gtk_css_number_value_get (style->border->border_left_width, 100) +
_gtk_css_number_value_get (style->size->padding_left, 100);
*y = _gtk_css_number_value_get (style->size->margin_top, 100) +
_gtk_css_number_value_get (style->border->border_top_width, 100) +
_gtk_css_number_value_get (style->size->padding_top, 100);
gtk_css_boxes_init (&css_boxes, GTK_WIDGET (native));
margin_rect = gtk_css_boxes_get_margin_rect (&css_boxes);
*x = - margin_rect->origin.x;
*y = - margin_rect->origin.y;
}
static gboolean
@@ -1158,68 +1157,6 @@ gtk_popover_get_gap_coords (GtkPopover *popover,
*final_y_out = final_y;
}
static void
get_margin (GtkWidget *widget,
GtkBorder *border)
{
GtkCssStyle *style;
style = gtk_css_node_get_style (gtk_widget_get_css_node (widget));
border->top = _gtk_css_number_value_get (style->size->margin_top, 100);
border->right = _gtk_css_number_value_get (style->size->margin_right, 100);
border->bottom = _gtk_css_number_value_get (style->size->margin_bottom, 100);
border->left = _gtk_css_number_value_get (style->size->margin_left, 100);
}
static void
gtk_popover_get_rect_for_size (GtkPopover *popover,
int popover_width,
int popover_height,
GdkRectangle *rect)
{
GtkWidget *widget = GTK_WIDGET (popover);
int x, y, w, h;
GtkBorder margin;
get_margin (widget, &margin);
x = 0;
y = 0;
w = popover_width;
h = popover_height;
x += MAX (TAIL_HEIGHT, margin.left);
y += MAX (TAIL_HEIGHT, margin.top);
w -= x + MAX (TAIL_HEIGHT, margin.right);
h -= y + MAX (TAIL_HEIGHT, margin.bottom);
rect->x = x;
rect->y = y;
rect->width = w;
rect->height = h;
}
static void
gtk_popover_get_rect_coords (GtkPopover *popover,
int *x_out,
int *y_out,
int *w_out,
int *h_out)
{
GtkWidget *widget = GTK_WIDGET (popover);
GdkRectangle rect;
GtkAllocation allocation;
gtk_widget_get_allocation (widget, &allocation);
gtk_popover_get_rect_for_size (popover, allocation.width, allocation.height, &rect);
*x_out = rect.x;
*y_out = rect.y;
*w_out = rect.width;
*h_out = rect.height;
}
static void
get_border (GtkCssNode *node,
GtkBorder *border)
@@ -1263,30 +1200,6 @@ gtk_popover_apply_tail_path (GtkPopover *popover,
cairo_line_to (cr, final_x, final_y);
}
static void
gtk_popover_fill_border_path (GtkPopover *popover,
cairo_t *cr)
{
GtkWidget *widget = GTK_WIDGET (popover);
int x, y, w, h;
GskRoundedRect box;
cairo_set_source_rgba (cr, 0, 0, 0, 1);
gtk_popover_apply_tail_path (popover, cr);
cairo_close_path (cr);
cairo_fill (cr);
gtk_popover_get_rect_coords (popover, &x, &y, &w, &h);
gtk_rounded_boxes_init_for_style (&box,
NULL, NULL,
gtk_css_node_get_style (gtk_widget_get_css_node (widget)),
x, y, w, h);
gsk_rounded_rect_path (&box, cr);
cairo_fill (cr);
}
static void
gtk_popover_update_shape (GtkPopover *popover)
{
@@ -1294,9 +1207,16 @@ gtk_popover_update_shape (GtkPopover *popover)
if (priv->has_arrow)
{
GtkCssBoxes content_css_boxes;
const GskRoundedRect *box;
cairo_surface_t *cairo_surface;
cairo_region_t *region;
cairo_t *cr;
double x, y;
double native_x, native_y;
gtk_native_get_surface_transform (GTK_NATIVE (popover), &native_x, &native_y);
gtk_css_boxes_init (&content_css_boxes, priv->contents_widget);
cairo_surface =
gdk_surface_create_similar_surface (priv->surface,
@@ -1305,7 +1225,21 @@ gtk_popover_update_shape (GtkPopover *popover)
gdk_surface_get_height (priv->surface));
cr = cairo_create (cairo_surface);
gtk_popover_fill_border_path (popover, cr);
cairo_translate (cr, native_x, native_y);
cairo_set_source_rgba (cr, 0, 0, 0, 1);
gtk_popover_apply_tail_path (popover, cr);
cairo_close_path (cr);
cairo_fill (cr);
box = gtk_css_boxes_get_border_box (&content_css_boxes);
gtk_widget_translate_coordinates (priv->contents_widget, GTK_WIDGET (popover),
0, 0,
&x, &y);
cairo_translate (cr, x, y);
gsk_rounded_rect_path (box, cr);
cairo_fill (cr);
cairo_destroy (cr);
region = gdk_cairo_region_create_from_surface (cairo_surface);
+14 -13
View File
@@ -1806,20 +1806,19 @@ update_initial_slider_position (GtkRange *range,
double y)
{
GtkRangePrivate *priv = gtk_range_get_instance_private (range);
int trough_x, trough_y;
gtk_widget_translate_coordinates (GTK_WIDGET (range), priv->trough_widget,
x, y, &trough_x, &trough_y);
x, y, &x, &y);
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
{
priv->slide_initial_slider_position = MAX (0, priv->slider_x);
priv->slide_initial_coordinate_delta = trough_x - priv->slide_initial_slider_position;
priv->slide_initial_coordinate_delta = x - priv->slide_initial_slider_position;
}
else
{
priv->slide_initial_slider_position = MAX (0, priv->slider_y);
priv->slide_initial_coordinate_delta = trough_y - priv->slide_initial_slider_position;
priv->slide_initial_coordinate_delta = y - priv->slide_initial_slider_position;
}
}
@@ -1899,7 +1898,7 @@ gtk_range_click_gesture_pressed (GtkGestureClick *gesture,
(!primary_warps && shift_pressed && button == GDK_BUTTON_PRIMARY) ||
(!primary_warps && button == GDK_BUTTON_MIDDLE)))
{
int slider_range_x, slider_range_y;
double slider_range_x, slider_range_y;
graphene_rect_t slider_bounds;
gtk_widget_translate_coordinates (priv->trough_widget, widget,
@@ -1993,9 +1992,10 @@ update_slider_position (GtkRange *range,
gdouble mark_delta;
gdouble zoom;
gint i;
double x, y;
gtk_widget_translate_coordinates (GTK_WIDGET (range), priv->trough_widget,
mouse_x, mouse_y, &mouse_x, &mouse_y);
mouse_x, mouse_y, &x, &y);
if (priv->zoom &&
gtk_widget_compute_bounds (priv->trough_widget, priv->trough_widget, &trough_bounds))
@@ -2028,15 +2028,15 @@ update_slider_position (GtkRange *range,
zoom_divisor = zoom - 1.0;
if (priv->orientation == GTK_ORIENTATION_VERTICAL)
priv->slide_initial_slider_position = (zoom * (mouse_y - priv->slide_initial_coordinate_delta) - slider_bounds.origin.y) / zoom_divisor;
priv->slide_initial_slider_position = (zoom * (y - priv->slide_initial_coordinate_delta) - slider_bounds.origin.y) / zoom_divisor;
else
priv->slide_initial_slider_position = (zoom * (mouse_x - priv->slide_initial_coordinate_delta) - slider_bounds.origin.x) / zoom_divisor;
priv->slide_initial_slider_position = (zoom * (x - priv->slide_initial_coordinate_delta) - slider_bounds.origin.x) / zoom_divisor;
}
if (priv->orientation == GTK_ORIENTATION_VERTICAL)
delta = mouse_y - (priv->slide_initial_coordinate_delta + priv->slide_initial_slider_position);
delta = y - (priv->slide_initial_coordinate_delta + priv->slide_initial_slider_position);
else
delta = mouse_x - (priv->slide_initial_coordinate_delta + priv->slide_initial_slider_position);
delta = x - (priv->slide_initial_coordinate_delta + priv->slide_initial_slider_position);
c = priv->slide_initial_slider_position + zoom * delta;
@@ -2635,18 +2635,19 @@ gtk_range_calc_marks (GtkRange *range)
{
GtkRangePrivate *priv = gtk_range_get_instance_private (range);
GdkRectangle slider;
double x, y;
gint i;
for (i = 0; i < priv->n_marks; i++)
{
gtk_range_compute_slider_position (range, priv->marks[i], &slider);
gtk_widget_translate_coordinates (priv->trough_widget, GTK_WIDGET (range),
slider.x, slider.y, &slider.x, &slider.y);
slider.x, slider.y, &x, &y);
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
priv->mark_pos[i] = slider.x + slider.width / 2;
priv->mark_pos[i] = x + slider.width / 2;
else
priv->mark_pos[i] = slider.y + slider.height / 2;
priv->mark_pos[i] = y + slider.height / 2;
}
}
+3 -3
View File
@@ -266,7 +266,7 @@ struct _GtkNothingActionClass
G_DEFINE_TYPE (GtkNothingAction, gtk_nothing_action, GTK_TYPE_SHORTCUT_ACTION)
static void
static void G_GNUC_NORETURN
gtk_nothing_action_finalize (GObject *gobject)
{
g_assert_not_reached ();
@@ -438,7 +438,7 @@ struct _GtkActivateActionClass
G_DEFINE_TYPE (GtkActivateAction, gtk_activate_action, GTK_TYPE_SHORTCUT_ACTION)
static void
static void G_GNUC_NORETURN
gtk_activate_action_finalize (GObject *gobject)
{
g_assert_not_reached ();
@@ -513,7 +513,7 @@ struct _GtkMnemonicActionClass
G_DEFINE_TYPE (GtkMnemonicAction, gtk_mnemonic_action, GTK_TYPE_SHORTCUT_ACTION)
static void
static void G_GNUC_NORETURN
gtk_mnemonic_action_finalize (GObject *gobject)
{
g_assert_not_reached ();
+2 -2
View File
@@ -351,7 +351,7 @@ gtk_shortcut_controller_run_controllers (GtkEventController *controller,
native = gtk_widget_get_native (widget);
if (!native ||
!gdk_surface_is_viewable(gtk_native_get_surface (native)))
!gdk_surface_get_mapped (gtk_native_get_surface (native)))
{
g_object_unref (shortcut);
continue;
@@ -866,7 +866,7 @@ gtk_shortcut_controller_set_mnemonics_modifiers (GtkShortcutController *self,
GdkModifierType
gtk_shortcut_controller_get_mnemonics_modifiers (GtkShortcutController *self)
{
g_return_val_if_fail (GTK_IS_SHORTCUT_CONTROLLER (self), GTK_SHORTCUT_SCOPE_LOCAL);
g_return_val_if_fail (GTK_IS_SHORTCUT_CONTROLLER (self), 0);
return self->mnemonics_modifiers;
}
+1 -1
View File
@@ -1,5 +1,5 @@
#ifndef __GTK_SHORTCUT_MANAGER_PRIVATE_H__
#define __GTK_SHORTCUT_MANAGER__PRIVATE_H__
#define __GTK_SHORTCUT_MANAGER_PRIVATE_H__
#include "gtkshortcutmanager.h"
+1 -1
View File
@@ -401,7 +401,7 @@ struct _GtkNeverTriggerClass
G_DEFINE_TYPE (GtkNeverTrigger, gtk_never_trigger, GTK_TYPE_SHORTCUT_TRIGGER)
static void
static void G_GNUC_NORETURN
gtk_never_trigger_finalize (GObject *gobject)
{
g_assert_not_reached ();
+20 -4
View File
@@ -1151,6 +1151,7 @@ gtk_render_insertion_cursor (GtkStyleContext *context,
float aspect_ratio;
PangoRectangle strong_pos, weak_pos;
PangoRectangle *cursor1, *cursor2;
GdkSeat *seat;
GdkDevice *keyboard;
PangoDirection keyboard_direction;
PangoDirection direction2;
@@ -1165,8 +1166,15 @@ gtk_render_insertion_cursor (GtkStyleContext *context,
"gtk-cursor-aspect-ratio", &aspect_ratio,
NULL);
keyboard = gdk_seat_get_keyboard (gdk_display_get_default_seat (priv->display));
keyboard_direction = gdk_device_get_direction (keyboard);
seat = gdk_display_get_default_seat (priv->display);
if (seat)
keyboard = gdk_seat_get_keyboard (seat);
else
keyboard = NULL;
if (keyboard)
keyboard_direction = gdk_device_get_direction (keyboard);
else
keyboard_direction = PANGO_DIRECTION_LTR;
pango_layout_get_cursor_pos (layout, index, &strong_pos, &weak_pos);
@@ -1240,6 +1248,7 @@ gtk_snapshot_render_insertion_cursor (GtkSnapshot *snapshot,
float aspect_ratio;
PangoRectangle strong_pos, weak_pos;
PangoRectangle *cursor1, *cursor2;
GdkSeat *seat;
GdkDevice *keyboard;
PangoDirection keyboard_direction;
PangoDirection direction2;
@@ -1254,8 +1263,15 @@ gtk_snapshot_render_insertion_cursor (GtkSnapshot *snapshot,
"gtk-cursor-aspect-ratio", &aspect_ratio,
NULL);
keyboard = gdk_seat_get_keyboard (gdk_display_get_default_seat (priv->display));
keyboard_direction = gdk_device_get_direction (keyboard);
seat = gdk_display_get_default_seat (priv->display);
if (seat)
keyboard = gdk_seat_get_keyboard (seat);
else
keyboard = NULL;
if (keyboard)
keyboard_direction = gdk_device_get_direction (keyboard);
else
keyboard_direction = PANGO_DIRECTION_LTR;
pango_layout_get_cursor_pos (layout, index, &strong_pos, &weak_pos);

Some files were not shown because too many files have changed in this diff Show More