Commit Graph

10747 Commits

Author SHA1 Message Date
Matthias Clasen
1894a8960e wayland: Fix keycode->keyval mapping
We were looping over the levels, but not using
the current level value to obtain the keymap
entries. Oops.

Fixes: #5277
2022-10-19 15:46:27 -04:00
Carlos Garnacho
eeda25ab04 gdk/wayland: Use serial of the latest implicit grab available
When getting the serial for primary/clipboard selections we used a
function that largely relied on a GdkEvent being passed. We have
another available function that looks up the most recent serial
given the ongoing touch/tablet input as well.

This is the second best, compared to actually knowing the
input/device from the event that was received by the UI an triggered
the clipboard operation, and is already in use in other places
(e.g. window dragging). It is valid for these situations too.

Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/5250
2022-10-19 13:54:07 +02:00
Luca Bacci
995f00d23f Merge branch 'forward-port-mr-991-to-gtk4-2' into 'main'
Use native Windows API for converting keystrokes to characters

Closes #2944

See merge request GNOME/gtk!4986
2022-10-17 19:20:08 +00:00
Philip Zander
c84c469b78 Use native Windows API for converting keystrokes to characters 2022-10-17 19:36:48 +02:00
Matthias Clasen
6f5d18a9f5 macos: Fix clipboard data size handling
We were using the allocated memory size, not
the amount of data that has been written.

Fixes: #5261
2022-10-16 23:45:28 -04:00
Luca Bacci
6cc44eb0fe Merge branch 'for-master' into 'main'
For master

See merge request GNOME/gtk!5095
2022-10-12 13:56:51 +00:00
Matthias Clasen
8ba7840528 Merge branch 'wip/corey/file-clipboard' into 'main'
gdkcontentserializer: Use newlines for file separators

Closes #5240

See merge request GNOME/gtk!5107
2022-10-10 21:13:28 +00:00
Corey Berla
3168a3e086 gdkcontentserializer: Use newlines for file separators
Use newlines rather than spaces to separate file paths (or uri's)
when serializing text/plain files.  There isn't a matching
deserializer, so we can do this in isolation.  Newlines
seem to make more sense when pasting into a text editor etc.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/5240
2022-10-10 13:27:07 -07:00
Luca Bacci
d6f7449636 GdkWin32: Return TRUE when processing WM_XBUTTONDOWN/UP messages
As documented on MSDN:

> Unlike the WM_LBUTTONUP, WM_MBUTTONUP, and WM_RBUTTONUP messages, an
> application should return TRUE from this message if it processes it.
2022-10-07 19:05:29 +02:00
Luca Bacci
f4286e8f1a GdkWin32: Use gdk_pixbuf_read_pixels () where applicable
This is an optimization in case of reading unmodifiable GdkPixbufs.
Also replace uses of GLib integral types with <stdlib.h> integral
types.
2022-10-07 19:05:29 +02:00
Po Lu
e967dfed2d
Treat XKB_MOD_NAME_LOGO as super key 2022-10-06 11:19:31 +04:00
Matthias Clasen
8607312fef gdk: Cosmetics
Add a define for each renderer.
2022-10-05 23:01:28 -04:00
Jonas Ådahl
b3a3a6ceb1 toplevel-size: Report zero bounds as infinite
Empty/zero bounds are sent by the Wayland compositor if there are no
valid bounds to report, e.g. if there are no connected monitors. Report
this to GTK, which uses this to clamp calculated sizes, as INT_MAX, so
that clamping isn't done until there are actual valid bounds to clamp
to.

This fixes clients sometimes shrinking to their minimum size during
hotplugs or after having suspended the session.
2022-09-30 09:31:40 +02:00
Jonas Ådahl
148c133674 surface/wayland: Handle no current monitor when calculating bounds
We shouldn't assume there is always a monitor to derive bounds from.
If there is no monitor, pass empty bounds, as this matches what
xdg_toplevel.configure_bounds do in this case.
2022-09-30 09:31:40 +02:00
Matthias Clasen
0c02573c47 Add 4.10 version macros 2022-09-28 13:30:01 -04:00
Matthias Clasen
dd7cd6ffdd Add more names to sources
This helps with identifying things in sysprof logs,
and while debugging.
2022-09-28 12:37:21 -04:00
Matthias Clasen
5f469d8903 Merge branch 'broadway-device-query-state-fix' into 'main'
GTK4 gdk/broadway: correct gdk_broadway_device_query_state() to return pointer coordinates relative to the upper left corner of surface

See merge request GNOME/gtk!5053
2022-09-28 01:38:45 +00:00
Luca Bacci
e2219858ae GdkWin32: Fix subclassing for GdkWin32Clipdrop
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/5207
2022-09-26 14:34:24 +02:00
Matthias Clasen
455eefa854 gdk: Use gnome.mkenums_simple
This lets us avoid template files, and works just as well.
2022-09-24 21:22:53 -04:00
Matthias Clasen
bc661a8ed5 gdk: Rename gdkpixbuf-drawable.c
There is nothing particularly specific to drawables
in there (and we don't have that concept anymore),
so just name the source file to match the header.
Easier for everybody.
2022-09-24 10:03:37 -04:00
Matthias Clasen
9ff549799d gdk: Tweaks to keyname handling
Rename the private header to follow our naming
conventions, and drop the extra gdkkeys.c file.
2022-09-24 10:03:37 -04:00
Matthias Clasen
4aabc45685 Drop gdkintl.h
This header was merely including gi18n-lib.h.
Just do that directly.
2022-09-23 23:33:42 -04:00
Matthias Clasen
a8af7caae1 Rename gdk-private.h to gdkprivate.h
The extra - does not add any value.
2022-09-23 23:23:27 -04:00
Matthias Clasen
7d2c296357 Rename gdkconstructor.h to gdkconstructorprivate.h
This is the naming convention for private headers.
2022-09-23 23:14:08 -04:00
Matthias Clasen
c24a69549d Rename gdkdebug.h to gdkdebugprivate.h
This is the naming convention for private headers.
2022-09-23 23:12:01 -04:00
Matthias Clasen
61a51dea7b gdk: Dissolve gdk-autocleanup.h
Move the autocleanup declarations into their
respective headers.

While we are at it, correct the autocleanup
declaration for GdkEvent to use gdk_event_unref,
not g_object_unref. Oops
2022-09-23 19:49:58 -04:00
Matthias Clasen
f33f55bcbb gtk: Use the new debug macros 2022-09-23 18:12:39 -04:00
Matthias Clasen
bc159207bd gdk: Drop old debug macros
Drop the old GDK_NOTE() and GDK_DISPLAY_NOTE()
macros from gdkdebug.h. Reintroduce them in the
win32 backend, where they are still used.
2022-09-23 18:11:48 -04:00
Matthias Clasen
1f166ae071 macos: Use the new debug macros 2022-09-23 18:11:48 -04:00
Matthias Clasen
ce4c2154f4 x11: Use the new debug macros 2022-09-23 18:11:48 -04:00
Matthias Clasen
71fedee85d wayland: Use the new debug macros 2022-09-23 18:11:48 -04:00
Matthias Clasen
90c2b548e5 broadway: Use the new debug macros 2022-09-23 18:11:48 -04:00
Matthias Clasen
1d48f96fc5 gdk: Use the new debug macros 2022-09-23 18:11:48 -04:00
Matthias Clasen
10255eee72 Introduce new debug macros
Introduce GDK_DISPLAY_DEBUG() and GDK_DEBUG() and
the helper function gdk_debug_message(). This is
meant to clean up the mess of our current debug
statements which wildly mix g_message, g_print
and g_printerr.
2022-09-23 18:11:48 -04:00
Matthias Clasen
c7a7e550dc Only print supported debug flags
It is a bit disorienting to print a lot of unavailable
debug flags, with some working ones mixed in. Just show
the ones that work.
2022-09-21 21:51:58 -04:00
Matthias Clasen
55ab99cb98 Make GL flavor flags always available
No need to restrict this to debug builds.
2022-09-21 21:29:34 -04:00
Matthias Clasen
f50b0a0bcb Make the gl-debug debug flag always available
No need to restrict this to debug builds.
2022-09-21 21:17:16 -04:00
Matthias Clasen
01054c9c79 Make the gl-gles debug flag always available
No need to restrict this to debug builds.
2022-09-21 21:12:22 -04:00
Matthias Clasen
8bd3ec2ba1 Make the gl-legacy debug flag always available
No need to restrict this to debug builds.
2022-09-21 21:09:08 -04:00
Matthias Clasen
e08a9ea9ad Drop the gl-texture-rect debug flag
This was not doing anything.
2022-09-21 21:05:25 -04:00
Matthias Clasen
1987398ec5 Drop the software-gl debug flag
This was not doing anything.
2022-09-21 21:03:40 -04:00
Matthias Clasen
fa0fc9acb8 Make the gl-disable flag always available
No need to restrict this to debug builds.
2022-09-21 20:57:22 -04:00
Matthias Clasen
fa1c461c13 Make the portals debug flag always available
No need to restrict this to debug builds.
2022-09-21 20:55:46 -04:00
Matthias Clasen
a99b05525d Make the nograbs flag always available
No need to restrict this to debug builds.
2022-09-21 20:53:46 -04:00
Matthias Clasen
a337b21a4f Make vulkan-disable always available
There is no need to restrict this to debug builds.
2022-09-21 20:51:35 -04:00
Matthias Clasen
1b96828667 Make vulkan-validate always available
There is no need to restrict this debug builds.
2022-09-21 20:49:53 -04:00
Matthias Clasen
7785c18c56 Fix high-depth handling
We mark this flag as always available, but we
were only checking it in debug builds.
2022-09-21 20:47:26 -04:00
Matthias Clasen
183709c522 Fix default-settings handling
This is meant to be always available, but we
were checking for debug in one place.
2022-09-21 20:45:43 -04:00
Maxim Zakharov
2acd10d7b0 gdk/broadway: correct gdk_broadway_device_query_state() to return pointer
coordinates relative to the upper left corner of surface
2022-09-21 15:42:40 +10:00
Simon McVittie
79285bd63e gdkevents: Don't ignore modifiers that are not currently active
The X11 backend can mark modifiers like Shift as consumed even if they
aren't actually active, which seems to be something to do with making
shortcuts like `<Control><Shift>plus` and `<Control>plus` work as
intended regardless of whether the plus symbol is obtained by pressing
Shift and a key (like `+/=` on American, British or French keyboards)
or not (like `*/+` on German keyboards).

However, this can go badly wrong when the modifier is *not* pressed.
For example, terminals normally have separate bindings for `<Control>c`
(send SIGINT) and `<Control><Shift>c` (copy). If we disregard the
consumed modifiers completely, when the X11 backend marks Shift as
consumed, pressing Ctrl+c would send SIGINT *and* copy to the clipboard,
which is not what was intended.

By masking out the members of `consumed` that are not in `state`, we
get the same interpretation for X11 and Wayland, and ensure that
keyboard shortcuts that explicitly mention Shift can only be triggered
while holding Shift. It continues to be possible to trigger keyboard
shortcuts that do not explicitly mention Shift (such as `<Control>plus`)
while holding Shift, if the backend reports Shift as having been
consumed in order to generate the plus keysym.

Resolves: https://gitlab.gnome.org/GNOME/gtk/-/issues/5095
Bug-Debian: https://bugs.debian.org/1016927
Signed-off-by: Simon McVittie <smcv@debian.org>
2022-09-17 19:40:53 +01:00