Commit Graph

721 Commits

Author SHA1 Message Date
Jonas Ådahl
2ff74eb667 gdk/toplevel: Negotiate surface size via a compute-size signal
GTK will not up front know how to correctly calculate a size, since it
will not be able to reliably predict the constraints that may exist
where it will be mapped.

Thus, to handle this, calculate the size of the toplevel by having GDK
emitting a signal called 'compute-size' that will contain information
needed for computing a toplevel window size.

This signal may be emitted at any time, e.g. during
gdk_toplevel_present(), or spontaneously if constraints change.

This also drops the max size from the toplevel layout, while moving the
min size from the toplevel layout struct to the struct passed via the
signal,

This needs changes to a test case where we make sure we process
GDK_CONFIGURE etc, which means we also needs to show the window and
process all pending events in the test-focus-chain test case.
2020-08-05 15:49:00 +02:00
Carlos Garnacho
96452a2e46 gdk: Rename gdk_seat_get_physical_devices() to gdk_seat_get_devices()
We don't want to tell what they are, and the distinction is now less
clear. Remove the adjective from the function name.
2020-07-30 18:44:40 +02:00
Carlos Garnacho
46eb054337 gdk: Drop gdk_device_get_device_type()
There is no longer a hierarchy of devices, or none that is seen
on the outside.
2020-07-30 18:44:40 +02:00
Benjamin Otte
4dc2ab61c9 Merge branch 'wip/otte/geometry' into 'master'
Some GdkGeometry cleanups

See merge request GNOME/gtk!2322
2020-07-30 15:31:27 +00:00
Benjamin Otte
3dd0e6d0b1 Remove gravity from GdkGeometry
It's always northwest
2020-07-30 17:06:15 +02:00
Matthias Clasen
7df070d681 gdk: Move default group api to the X11 backend
This is the only place where it is implemented.
2020-07-29 22:58:37 -04:00
Jonas Ådahl
c7c71137b2 gdk/monitor: Remove gdk_monitor_work_area and GdkMonitor::work-area
It's not a portable API, so remove it. The corresponding backend
specific functions are still available, if they were implemented, e.g.
gdk_macos_monitor_get_workarea() and gdk_x11_monitor_get_workarea().
2020-07-29 17:57:30 +02:00
Carlos Garnacho
cab1dcb696 gdk: Conflate GDK devices
Make GdkEvents hold a single GdkDevice. This device is closer to
the logical device conceptually, although it must be sufficient for
device checks (i.e. GdkInputSource), which makes it similar to the
physical devices.

Make the logical devices have a more accurate GdkInputSource where
needed, and conflate the event devices altogether.
2020-07-29 01:27:51 +02:00
Carlos Garnacho
25ea17a6fc gdk: Drop source_device argument from _gdk_display_device_grab_update()
It's just passed around and used nowhere.
2020-07-29 01:27:51 +02:00
Carlos Garnacho
a2876b5cb4 gdkdevice: Remove gdk_device_get_state()
This is not needed nor recommended anymore, all reasons to maybe
need this were all kept within gdk.
2020-07-28 17:36:18 +02:00
Benjamin Otte
3078b180fe Replace "gdouble" with "double" 2020-07-25 00:47:36 +02:00
Benjamin Otte
d375dce9f5 Replace "gchar" with "char" 2020-07-25 00:47:36 +02:00
Benjamin Otte
d7266b25ba Replace "gint" with "int" 2020-07-25 00:47:36 +02:00
Carlos Garnacho
5f29b8fcec gdk: Drop GdkGrabOwnership
We no longer expose such low level tweaks, this is essentially
unused.
2020-06-23 23:42:53 +02:00
Emmanuele Bassi
1c856a208f Rename master and slave device
We already use the "logical/virtual" and "physical" names in the
documentation, there's no reason to use loaded terms just because X11
uses them.
2020-06-18 19:22:20 +01:00
Matthias Clasen
2c82151d65 gdk: Drop axis labels
This was only ever implemented on X11, and the labels
here were atom names, so unlikely to be useful for
anything interesting.
2020-06-10 07:36:30 -04:00
Matthias Clasen
ca1c89c5bd broadway: Drop a pointless vfunc
A vfunc that just returns FALSE is not useful.
2020-06-08 18:24:20 -04:00
Christian Hergert
fa08d848ca device: remove get_toplevel from surface_at_position vfunc
This is not used anymore now that surfaces are always toplevel in the
semantics of GdkWindow where child windows were available. We can drop
that and simplify the vfunc just a bit more.

Fixes #2765
2020-05-19 13:07:38 -07: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
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
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
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
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
Benjamin Otte
4c7914dc49 display: Remove unneeded getters
Applications can use the listmodel instead.
2020-05-17 07:32:37 +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
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
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
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
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
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
Matthias Clasen
99c3928cec keymap: Cache key info
We currently calling gdk_display_map_keyval up to
once per key event per shortcut trigger, and that function
does an expensive loop over the entire keymap and
allocates an array. Avoid this by caching the entries
in a single array, and have a lookup table for finding
the entries for a keyval.

To do this, change the GdkKeymap.get_entries_for_keyval
signature, and change the ::keys-changed signal to be
RUN_FIRST, since we want to clear the cache in the class
handler before running signal handlers. These changes are
possible now, since keymaps are no longer public API.
2020-04-30 13:05:52 -04:00
Matthias Clasen
3c987f073e Remove GdkGeometry from public API
The api to configure surfaces is now GdkToplevelLayout
and GdkPopupLayout. Unfortunately, there's still quite
a bit of internal use of GdkGeometry that will take some
time to clean up, so move it go gdkinternals.h for now.
2020-04-19 10:41:18 -04:00
Emmanuele Bassi
f28aa1ba02 Restructure the GdkEvent type hierarchy
GdkEvent has been a "I-can't-believe-this-is-not-OOP" type for ages,
using a union of sub-types. This has always been problematic when it
comes to implementing accessor functions: either you get generic API
that takes a GdkEvent and uses a massive switch() to determine which
event types have the data you're looking for; or you create namespaced
accessors, but break language bindings horribly, as boxed types cannot
have derived types.

The recent conversion of GskRenderNode (which had similar issues) to
GTypeInstance, and the fact that GdkEvent is now a completely opaque
type, provide us with the chance of moving GdkEvent to GTypeInstance,
and have sub-types for GdkEvent.

The change from boxed type to GTypeInstance is pretty small, all things
considered, but ends up cascading to a larger commit, as we still have
backends and code in GTK trying to access GdkEvent structures directly.
Additionally, the naming of the public getter functions requires
renaming all the data structures to conform to the namespace/type-name
pattern.
2020-04-16 19:54:02 +01:00
Matthias Clasen
e735554ced broadway: Fix the build
We need to depend on gdkenum_h, since we are (indirectly)
including gdkenumtypes.h in the broadway server build.
2020-04-11 16:24:05 -04:00
Matthias Clasen
2486f46c0b Merge branch 'keymap-rework-2' into 'master'
Keymap rework 2

See merge request GNOME/gtk!1635
2020-04-06 20:56:06 +00:00
Matthias Clasen
dce8d251c6 keymap: Remove virtual modifier mapping functions
These are not used anymore.

Drop the vfuncs and their implementations in the
broadway, x11, wayland and win32 backends as well.
2020-04-06 16:32:03 -04:00
Matthias Clasen
da6faf321c Merge branch 'misc-meson-fixes' into 'master'
Reduce useless relinking on configure and fix check for buildtype arguments

See merge request GNOME/gtk!1614
2020-04-06 20:22:01 +00:00
Matthias Clasen
0a96a483c6 gdk: Redo key events
Add all of the keyboard translation results in the key event,
so we can translate the keyboard state at the time the event
is created, and avoid doing state translation at match time.

We actually need to carry two sets of translation results,
since we ignore CapsLock when matching accelerators, in
gdk_event_matches().

At the same time, drop the scancode field - it is only ever
set on win32, and is basically unused in GTK.

Update all callers.
2020-04-06 15:13:54 -04:00
Matthias Clasen
be2a0971c2 broadway: Stop using MOD2..MOD5
These are going away in the GdkModifierType cleanup.
2020-04-06 15:13:53 -04:00
Matthias Clasen
b02db72e17 Rename GDK_MOD1_MASK to GDK_ALT_MASK
We've hardcoded Mod1 = Alt for a long time, there is
no need to keep the confusing naming around anymore.
2020-04-06 01:40:49 -04:00
Olivier Fourdan
4f49d83e43 gdk: Move GdkGrabStatus and GdkGrabOwnership decl.
With the removal of `gdk_seat_grab` we do not need to keep the
definitions of `GdkGrabStatus` and `GdkGrabOwnership` public.

Move those definitions to become internal only.
2020-04-03 15:23:01 +02:00
Nirbheek Chauhan
777435c470 meson: Reduce useless relinking on reconfigure
When we reconfigure, `configure_file()` is called again, and
`*.gresource.xml` files are regenerated, which causes many (all?)
binaries to be relinked. Now we only write those out if the contents
actually changed (or if the output didn't already exist).

This is exactly what Meson already does with `configure_file()` when
`command:` is not used.

While we're at it, also do the same for `gen-c-array.py` and
`gentypefuncs.py` for completeness. Now even if the input to those
changes, re-building of those custom targets may not result in
relinking if the outputted C files have the same contents.
2020-04-03 18:41:55 +05:30
Olivier Fourdan
b22c7b8b77 broadway: Add inhibit shortcut properties
Broadway doesn't have support for inhibit shortcuts, yet it needs to
support the standard set of GdkToplevel properties.

Add support for the "inhibit-list" object property to GdkToplevel on
Broadway.
2020-03-30 18:25:36 +02:00
Benjamin Otte
2244eeb727 gdk: Remove GDK_RELEASE_MASK
It was only ever supported by keybindings and those are gone now.
2020-03-25 23:14:27 -04:00
Matthias Clasen
31db615885 Revert "Merge branch 'disable-window-test' into 'master'"
This reverts commit 3ac4c76b18, reversing
changes made to 6ec96d2e98.
2020-03-19 18:03:16 -04:00
Benjamin Otte
8c23ccd86e gdk: Remove GDK_RELEASE_MASK
It was only ever supported by keybindings and those are gone now.
2020-03-18 23:00:50 -04:00
Matthias Clasen
1576cced0f Drop GdkToplevel:accept-focus/:focus-on-map
These properties were only ever implemented in the
X11 backend. If you want to use them, just use the
X properties directly.
2020-03-14 19:28:00 -04:00