Commit Graph

10799 Commits

Author SHA1 Message Date
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
Ian Douglas Scott
dac7a4f6e7 gdk/wayland/surface: Remove SURFACE_IS_TOPLEVEL
Always defined to `TRUE`.
2022-09-26 14:26:18 -07:00
Ian Douglas Scott
3679207e09 gdk/wayland/surface: Move more members to GdkWaylandToplevel 2022-09-26 14:26:18 -07:00
Ian Douglas Scott
46d1d54f5a gdk/wayland/surface: Make gtk_surface related functions take toplevel
These are only used with `GdkWaylandToplevel`, so it should be a function
taking that, and ultimately move to that struct.
2022-09-26 14:26:18 -07:00
Ian Douglas Scott
3131c50b82 gdk/wayland/surface: Make some toplevel functions take GdkWaylandToplevel 2022-09-26 14:26:18 -07:00
Ian Douglas Scott
c2063a623a gdk/wayland/surface: Move some variables to GdkWaylandPopup 2022-09-26 14:26:16 -07:00
Ian Douglas Scott
3e267c3285 gdk/wayland/surface: Make popup functions take GdkWaylandPopup
This will allow them to use member variables from that struct.
Ultimately, `GdkWaylandPopup` should be moved to its own file.
2022-09-26 14:22:37 -07:00
Ian Douglas Scott
887da8f931 gdk/wayland/surface: Don't wrap gdk_wayland_surface_* for toplevel vfuncs
As far as I'm aware, these only exist with `gdk_wayland_surface_` names
for historical reasons, before these types were split.

This way, those functions will be able to access members of the
`GdkWaylandToplevel` struct. And it just saves a few lines of code.
2022-09-26 14:22:37 -07: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
Matthias Clasen
65adcec82f Merge branch 'detect-stylus' into 'main'
Recognize "stylus" devices as GDK_SOURCE_PEN

Closes #4394

See merge request GNOME/gtk!4776
2022-09-16 12:12:37 +00:00
Matthias Clasen
32f55a74b0 portal: Use the right mimetype for file transfers
The filetransfer protocol says to use
application/vnd.portal.filetransfer, but I used
application/vnd.portal.files when I implemented the
protocol. Oops.

This commit dds the correct mimetype, but we still
support the old one to preserve interoperatibility
with existing flatpaks using GTK 4.6.

Fixes: #5182
2022-09-15 15:18:17 -04:00
Matthias Clasen
e16414b3ac Handle absence of portals
When the documents portal is not on the bus,
we still get an (unowned) proxy, and we need
to handle that situation.
2022-09-07 08:45:31 -04:00
Matthias Clasen
2e42786091 portals: Fix FileTransfer portal calls
We were not passing the right arguments to
the AddFiles call, causing the file transfer
to fail.
2022-09-07 06:47:02 -04:00
Matthias Clasen
b756aa0764 Make the file transfer portal setup sync again
We need to register the portal mime types before
the others to prefer them, doing this call async
messes up that ordering.

This is effectively reverting 69fb3648b2
2022-09-07 06:45:03 -04:00
Matthias Clasen
9654fd451f Stop recursion in registering serializers
This was probably unintentional, and messes up
the ordering of our registration.
2022-09-06 23:35:48 -04:00
Robert Mader
06a51b6ca6 wayland/display: Remove duplicate update_scale() call
`apply_monitor_change()` already calls `update_scale()`.
Note that this only affects old compositor versions (see
`should_update_monitor()`) so it's just a minor cleanup.
2022-09-03 00:53:02 +02:00
Christian Hergert
f5488bb4b2 gdk: fix typo in frame clock docs 2022-09-01 12:16:10 -07:00
Matthias Clasen
137af44f81 Merge branch 'font-chooser-feature-work' into 'main'
fontchooser: Handle font features better

See merge request GNOME/gtk!4984
2022-08-26 22:10:52 +00:00
Matthias Clasen
2017f3debe Some strdup avoidance 2022-08-25 14:33:30 -04:00
Marc-André Lureau
4b08570727 gdk/win32: add missing Since tag for gdk_win32_display_get_egl_display
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-08-25 17:33:25 +04:00
Marc-André Lureau
52e3ed13e2 gdk/win32: deprecate gdk_win32_handle_table_lookup
This function is probably not generally useful for a Gtk+/win32 user,
and it's only used internally by gdk-win32. It's time to deprecate it, I
believe.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-08-24 21:02:57 +04:00
Marc-André Lureau
6cfb6e0c9c gdk/win32: do not expose gdk_win32_*_libgtk_only in public headers
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-08-24 15:44:32 +04:00
Luca Bacci
ef831235fe Merge branch 'win32-gir' into 'main'
win32: various GI annotations and fixes

See merge request GNOME/gtk!4977
2022-08-24 09:41:11 +00:00
Luca Bacci
c11ea42644 GdkWin32: Scale text with DPI like in GTK3 with SYSTEM_DPI_AWARENESS
Right now we only support system DPI awareness in GTK4. In that case
it makes sense to scale text with the DPI of the primary monitor, like
done in GTK3.

We plan to land support for proper fractional scaling in Gdk/Win32, so
in the future the "gtk-xft-dpi" setting will be gathered as intended,
i.e. for text magnification, as an a11y feature.
2022-08-23 19:53:44 +02:00
Marc-André Lureau
0d7a0132bb gdk/win32: annotate gdk_win32_surface_lookup_for_display
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-08-23 17:20:39 +04:00
Marc-André Lureau
cad32636ce gdk/win32: annotate gdk_win32_surface_set_urgency_hint
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-08-23 17:06:48 +04:00
Luca Bacci
d125fcd35a GdkWin32: Position popups on the primary monitor if outside of the visible screen area
Fixes a crash caused by attempting to dereference a NULL GdkMonitor*
in GdkWin32.

See https://gitlab.gnome.org/GNOME/gtk/-/issues/5125
2022-08-23 14:54:01 +02:00
Marc-André Lureau
a6418d5028 gdk/win32: deprecate gdk_win32_surface_get_impl_hwnd
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-08-23 16:35:07 +04:00
Marc-André Lureau
3cbf6c9d6e gdk/win32: annotate gdk_win32_surface_get_handle
And adjust the argument precondition check.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-08-23 16:25:33 +04:00
Marc-André Lureau
a75de5fb90 gdk/win32: correct gdk_win32_surface_get_handle return type
The associated surface window handle is a HWND, not a HGDIOBJ.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-08-23 16:17:19 +04:00
Marc-André Lureau
180dd5fb7f gdk/win32: deprecate gdk_win32_surface_is_win32
The function isn't used by Gtk itself anymore, and does not help much.
It creates extra issues for bindings, as it doesn't fit well with code
doing the same job for other objects.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-08-23 15:34:50 +04:00
Marc-André Lureau
a53650d9da gdk/win32: annotate filter callbacks
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-08-23 12:57:20 +04:00
Luca Bacci
0d4d52d322 Merge branch 'win32-gir' into 'main'
Generate gtk/GdkWin32-4.0.gir

Closes #5112

See merge request GNOME/gtk!4965
2022-08-22 22:26:09 +00:00
Matthias Clasen
d1755337a2 Bump the jpeg memory limit
Commit 59f6c50df8 set the memory limit to 100M,
which turns out to exclude some large, valid jpegs.
So, bump things to 300M, matching what was done
in gdk-pixbuf.
2022-08-22 10:48:00 -04:00
Luca Bacci
749425808d Fix typo
And reword comment
2022-08-19 19:29:17 +02:00
Luca Bacci
5e299cd3d2 GdkWin32: Fix handling of WM_NCHITTEST
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/5114
2022-08-19 19:21:17 +02:00
Marc-André Lureau
8ab57fc8ef build-sys: generate GdkWin32.gir
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-08-19 17:42:30 +04:00
Marc-André Lureau
ff16446b0b build-sys: do not install gdkwin32keys.h
Fixes: commit 89ad7893ad ("gdk: Make GdkKeymap a private api")

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-08-19 11:58:12 +04:00
Marc-André Lureau
82bcebe3de gdk/win32: remove old declaration
The function is gone since commit ea65abc7e2 ("Rewrite
GdkWin32Keymap (load table directly from layout DLL)")

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-08-19 11:58:12 +04:00
Benjamin Otte
a790764a7a Merge branch 'wip/otte/for-main' into 'main'
gdk: Plug a memleak

Closes #5110

See merge request GNOME/gtk!4964
2022-08-19 01:08:59 +00:00
Benjamin Otte
248e33e3c9 gdk: Plug a memleak
Free GdkIOPipe struct when freeing it
Don't just free all its members.

Fixes #5110
2022-08-19 02:38:11 +02:00
Ricardo Maia Louro
6ceacee0f9 GdkWin32: Support high resolution scroll wheel events 2022-08-14 18:30:28 +01:00
Matthias Clasen
0bd15b44f2 wayland: Avoid leaking cursor textures
When we fall back to the default cursor and load it
from a resource, we need to free the texture.
2022-08-13 13:19:49 -04:00
Matthias Clasen
a020cf7534 Merge branch 'matthiasc/for-main' into 'main'
jpeg loader: Limit memory consumption

See merge request GNOME/gtk!4942
2022-08-10 17:57:55 +00:00
Matthias Clasen
59f6c50df8 jpeg loader: Limit memory consumption
This will prevent stupid oom situations with pathological
jpeg files, without affecting our ability to load reasonable
images.
2022-08-10 13:25:17 -04:00
José Expósito
37a561eb53 gdk/x11: Handle high-resolution scroll events 2022-08-10 14:23:58 +00:00
José Expósito
ed0a2a203c gdk/wayland: Handle high-resolution scroll events
Starting with the Wayland protocol wl_pointer >= 8, discrete axis
events have been deprecated in favour of high-resolution scroll event.

Add a listener for high-resolution scroll events and, for backwards
compatibility, handle discrete events as discrete*120.
2022-08-10 14:23:58 +00:00
José Expósito
fc3aca8223 gdk/wayland: Calculate discrete scroll direction in its helper
Refactor, no functional changes.
2022-08-10 14:23:58 +00:00
José Expósito
6ebb38e12e gdk/events: Set discrete scroll deltas in its constructor
Instead of calculating the discrete scroll deltas in
GtkEventControllerScroll, move that code to the event constructor and
access the precalculated values using gdk_scroll_event_get_deltas.

Refactor, no functional changes.
2022-08-10 14:23:58 +00:00
José Expósito
51ca454eef gdk/events: Add constructor for high-resolution scroll events
Starting with Linux Kernel v5.0 two new axes are available for
mice that support high-resolution wheel scrolling: REL_WHEEL_HI_RES and
REL_HWHEEL_HI_RES.

Both axes send data in fractions of 120 where each multiple of 120
amounts to one logical scroll event. Fractions of 120 indicate a wheel
movement less than one detent.

The 120 magic number is a copy of the Windows API, so this new
constructor can be used both in Linux >= 5.0 and Windows >= Vista.
2022-08-10 14:23:58 +00:00
Matthias Clasen
73f634435a Merge branch 'build-fix-glib-2.66' into 'main'
build: fix for use with glib 2.66.0 (2nd try)

See merge request GNOME/gtk!4932
2022-08-07 19:09:04 +00:00
Matthias Clasen
7a306fe32f Merge branch 'wip/carlosg/fixes' into 'main'
Some fixes

Closes #2877 and #5003

See merge request GNOME/gtk!4929
2022-08-07 18:06:28 +00:00
Hannes Müller
703fc51d8e build: fix for use with glib 2.66.0
Add missing #define g_memdup2() for gdksurface-broadway.c in case of enabled
broadway-backend as used otherwise.

Copy static would_drop() replacement for g_log_writer_default_would_drop()
from gtk-builder-tool.c to gtk-reftest.c
2022-08-06 21:11:08 +02:00
Carlos Garnacho
c77b98d716 gdk/wayland: Drop surface checks on wl_pointer.leave handling
Even though the argument is non-nullable, GTK sometimes incurs in that
by itself by destroying the surface while the event is in flight. This
is the case of popping down a GtkDropdown. When this happens we simply
ignore the crossing event, but we should let it through instead, the
compositor did not send it in vain and we possibly still have pointer
state to undo.

Drop the surface checks, so that the event is propagated along GTK.
2022-08-05 19:25:13 +02:00
Carlos Garnacho
6238f97cb6 gdkevent: Give touchpad hold events a sequence
Following what was done for pinch/swipe events, give hold gestures their
own distinct sequence as well. Without this it was NULL, which was already
distinct to other touchpad gestures.
2022-08-05 19:25:13 +02:00
Dr. David Alan Gilbert
dbc4e18bf8 x11: Don't assume valid type
If we get an invalid TARGETS reply, we might not have a valid 'type',
which ends up as NULL and segs in the g_str_equal.

(This is probably fallout from my fix 506566b6a4, which I still
can't reproduce reliably, so the last one just moved the seg a bit
further along, and we still don't know who is sending a bad TARGETS).

This corresponds to:
https://bugzilla.redhat.com/show_bug.cgi?id=2062143
2022-07-30 22:11:59 +01:00
Luca Bacci
924da0e84b Merge branch 'fix-gdk-win32-dnd' into 'main'
Fix DnD on Windows

Closes #4498

See merge request GNOME/gtk!4900
2022-07-29 12:42:57 +00:00