Commit Graph

9257 Commits

Author SHA1 Message Date
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
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
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
4c7914dc49 display: Remove unneeded getters
Applications can use the listmodel instead.
2020-05-17 07:32:37 +02: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
Benjamin Otte
14bf58ec5d x11: Remove XDamage dependency
It's not used.
2020-05-17 02:14:58 +02: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
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
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
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
Alexander Larsson
fed071ca96 GdkX11DragSurface: set visible state and invalidate on present
Without this we won't actually draw the surface.
2020-05-14 14:33:57 +02:00
Alexander Larsson
bca4af360d X11 dnd: Calculate relative coords right in events
GdkSurface.x/y is mostly 0, we need to look atht GdkX11Surface->abs_x/y.
2020-05-14 11:46:33 +02:00
Alexander Larsson
e702d42597 x11 drag: Fix mapped error
In the gtk-demo drag-and-drop demo i can't drag anything, all I get
is:

(gtk4-demo:358993): Gdk-CRITICAL **: 09:36:19.617: Surface 0x7e1bb0 has not been mapped in GdkSeatGrabPrepareFunc

This is because GdkX11Drag.ipc_surface is not considered mapped, even
though we called gdk_x11_surface_show() on it, because the
GDK_SURFACE_STATE_WITHDRAWN flag is still set.

I added calls to gdk_synthesize_surface_state() to match what
e.g. show_popup() and gdk_x11_toplevel_present() does.
2020-05-14 09:54:34 +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
Matthias Clasen
c66f2ca9eb x11: Avoid a critical in clipboard data transfer
The handler we are calling here asserts that it gets
an interned string as mime_type. So give it one.

Fixes: #2736
2020-05-12 21:31:19 -04:00
Emmanuele Bassi
68682dda89 docs: Remove unnecessary SECTION
The GdkDragSurface definitions fall under the "dnd" section.
2020-05-12 18:44:21 +01:00
Emmanuele Bassi
6ae01f9815 docs: Remove redundant SECTION
We already have a SECTION stanza for gtk-doc.
2020-05-12 18:43:56 +01:00
Carlos Garnacho
e33af5895f gdk/wayland: Drop explicit ungrab after surface move/resize
We now break grabs properly if receiving a .leave event with
active buttons. This is not necessary anymore.
2020-05-12 14:14:39 +02:00
Carlos Garnacho
f7d2985f89 gdk/wayland: Ensure .leave events with active buttons breaks grabs
Instead of silently ending up the grab, make it sure that we emit
a GDK_GRAB_BROKEN event if needed.
2020-05-12 14:14:39 +02:00
Carlos Garnacho
2bd8124b5d gdk/wayland: Keep track of implicit grabs
Tracking of those broke sometime along the gdk cleanups, so we
started missing some GDK_GRAB_BROKEN events from being emitted
(eg. after a button press/implicit grab triggers an active grab).

Implicit grabs are only added if there's no prior grab (either
implicit through other button presses, or explicit), in order to
keep accounting correct, make those prevail.
2020-05-12 14:14:39 +02:00
Corentin Noël
076b2f11d2 docs: Fix several missing references in the documentation
This fixes several typos and missing references
2020-05-11 19:26:20 +02:00
Adrian Perez de Castro
5c4ca1424d
Fix build issue due to missing VK_RESULT_RANGE_SIZE
Conditionally check whether the Vulkan headers version defines
VK_RESULT_RANGE_SIZE, and avoid using it for version >=140. The
following comming in Vulkan-Headers has removed the enum value:

  0c5351f5e9 (diff-4febd94c0666d59030d8b1dd20c72403)
2020-05-11 10:07:41 +03:00
Carlos Garcia Campos
739137ccf9 clipboard: GdkContentProviderUnion should return after writing the first matched format
It continues trying with the other providers due to a missing early
return.
2020-05-07 11:27:45 +02:00
Emmanuele Bassi
ddd113ac98 Annotate gdk_motion_event_get_history() correctly
We moved from returning a list to returning a C array, and this requires
a change in the annotations.
2020-05-06 23:05:19 +01:00
Matthias Clasen
baf82cdf7a keymap: Remove leftover code
When I removed the 0-termination for the entries for
each keyval, I remove the code initializing the key,
but accidentally left the code that adds it to the
array, so gdk_keymap_get_cached_entries_for_keyval
returns one extra, uninitialized value at the end
of the array. Stop doing that.
2020-05-06 13:15:45 -04:00
Timm Bäder
27b4b5ee32 surface: remove double assignment 2020-05-05 08:20:10 +02:00
Timm Bäder
d80c130d7f GdkEvent: Save history in a GArray
Instead of a less efficient GList.
2020-05-05 08:20:09 +02:00
Timm Bäder
85237c8665 gdkdisplay-wayland: Fix a possibly uninitialized out value 2020-05-05 08:20:09 +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
e1b25eaf5a wayland: Fall back to an unthemed default cursor
In the absence of icon themes (such as in a freshly
created toolbox container), we should not just fall back
to "no cursor", since that makes it hard even to close
the application. Fall back to an included default cursor
of last resort.
2020-04-26 14:42:45 -04:00
Matthias Clasen
7eeeb3f229 gdk: Include a default cursor as resource
Provide a fallback cursor of last resort. Otherwise,
we end up with no visible cursor if there is no
cursor theme installed, wihch is less than helpful.
2020-04-26 14:41:52 -04:00
Matthias Clasen
7ca8efa0f5 vulkan: Update error codes enum
Do the silly update exercise.
2020-04-26 14:08:40 -04:00
Carlos Garnacho
41b7f03d55 gdk/wayland: Ensure to clean up stale touchpoint data on surface destroy
If the wl_surface receiving touch events is destroyed, we will get no
wl_touch.up event to remove the touchpoint from our internal accounting.
Check for this, and drop touchpoints happening in surfaces that do
disappear during operation.
2020-04-24 23:11:00 +02:00