Commit Graph

10822 Commits

Author SHA1 Message Date
Carlos Garnacho
7fab1b85ad gdk/x11: Emit "remove" s-n message from gdk_toplevel_set_startup_id
In the way towards deprecating gdk_display_notify_startup_complete(),
make gdk_toplevel_set_startup_id() on X11 perform this piece of messaging
itself. It should be harmless that the message is emitted twice, if
callers do still use that API.
2023-01-03 14:58:25 +01:00
Carlos Garnacho
5aeabdb3d4 gdk/wayland: Perform xdg_activation on gdk_toplevel_set_startup_id
This call has everything to perform activation as specified by the
xdg_activation protocol, notably a surface to activate as opposed to
gdk_display_notify_startup_complete().

Make activation happen here, so that the surface gets activated when
its gets a startup ID assigned.
2023-01-03 14:57:49 +01:00
Maximiliano Sandoval R
b688f47776
gdk_display_open: Mark arg as nullable 2023-01-02 11:49:06 +01:00
Carlos Garnacho
e7f798dcf5 gdk/surface: Handle clicks outside client surfaces
The owner_events=TRUE grab makes GDK on X11 see events happening
outside every client window as received on the grab window.
Additionally check that the pointer is inside the grab window
(i.e. it received GDK_CROSSING_NORMAL crossing events for the
core pointer) in order to handle clicks happening outside client
windows.

These new paths are expected to be a no-op on Wayland, and to
also work for touchscreen input on X11, due to emulated pointer
events.
2022-12-23 16:12:03 +01:00
Ignazio Pillai
8ecb624934 clipboard: improve EOL conversion of plain text
Handle the case of clipboard text with CR line endings
2022-12-22 12:55:30 +01:00
Nirbheek Chauhan
e2291259bb gdk: Fix g_set_str version check
The function was added to glib in 2.75.1. This fixes gtk's build with
the glib main branch.
2022-12-18 11:29:10 +05:30
Christopher Davis
3e86bc65f5 gdkprivate: Add compatibility shim for g_set_str()
Allows us to make use of this API without depending
on bleeding-edge glib
2022-12-16 10:16:52 -05:00
Matthias Clasen
e5560c1535 Add GDK_DEBUG=no-portals
Fixes: #5441
2022-12-14 13:50:20 -05:00
Matthias Clasen
a471a8b57c Merge branch 'ebassi/gidocgen-update' into 'main'
ci: Update the gi-docgen dependencies

See merge request GNOME/gtk!5263
2022-12-14 16:24:48 +00:00
Luca Bacci
48bcae99af Merge branch 'gdk-win32-fix-native-decoration-resize' into 'main'
GdkWin32: Fix resizes with native decorations

Closes #5142, #5088, and #5090

See merge request GNOME/gtk!5096
2022-12-14 13:13:14 +00:00
Luca Bacci
0bdf30dfbf Merge branch 'gdk-win32-modal-handling' into 'main'
GdkWin32: Do not use MA_NOACTIVATEANDEAT

Closes #5297 and #5326

See merge request GNOME/gtk!5208
2022-12-14 10:08:42 +00:00
Corey Berla
e8f70be2c1 Merge branch 'wip/otte/for-5422' into 'main'
contentserializer: Serialize to file:// if possible

Closes #5422

See merge request GNOME/gtk!5330
2022-12-14 01:56:04 +00:00
Benjamin Otte
ea056d261f contentserializer: Serialize to file:// if possible
Try to get a native file:// URI instead of any other GVFS
scheme, for interoperability with apps only handling file:// URIs.

This is what GTK3 Nautilus and Thunar do, so apps should be tuned
for this behavior.

See also https://bugzilla.xfce.org/show_bug.cgi?id=13845

Fixes: #5422
2022-12-14 02:33:45 +01:00
Matthias Clasen
c2c99a163a Merge branch 'stylanydev' into 'main'
Gtk.GestureStylus: implement `anydev` property

See merge request GNOME/gtk!4707
2022-12-13 19:34:12 +00:00
Matthias Clasen
9de963e8b4 Merge branch 'wip/carlosg/stale-timeout' into 'main'
gdk/x11: Clear all data in GdkSurfaceX11 finalization

See merge request GNOME/gtk!5303
2022-12-08 12:18:37 +00:00
Matthias Clasen
5e92c26b9a Merge branch 'macos-unused-vars' into 'main'
macos: remove unused variables from macos code

See merge request GNOME/gtk!5290
2022-12-08 12:17:13 +00:00
Cam Cook
6bfb35f047 Various spelling mistakes across a few domains that show up in documentation. 2022-12-08 12:16:22 +00:00
Luca Bacci
acd7d739f5 GdkWin32: Fix resizes with native decorations
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/5142
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/5088
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/5090
2022-12-08 11:41:05 +01:00
Carlos Garnacho
c24358cfbc gdk/x11: Clear all data in GdkSurfaceX11 finalization
Currently, the GdkSurfaceX11 implementation relies that the upper
layers hid the surface before destruction, and that no
GdkSurfaceClass.compute_resize happened between them. If these
circumstances happened, there would be a compute_size timeout left
dangling after the surface got destroyed, poking at incorrect data
later on. Something that looks like this was reported in the
recent mutter-x11-frames "SSD frames server":

    mutter-x11-frames:423016): GLib-GObject-WARNING **: 19:41:16.869: invalid unclassed pointer in cast to 'GtkWindow'

    Thread 1 "mutter-x11-fram" received signal SIGTRAP, Trace/breakpoint trap.
    g_logv (log_domain=0x7ffff7f7c4f8 "GLib-GObject", log_level=G_LOG_LEVEL_WARNING, format=<optimized out>, args=<optimized out>) at ../../../glib/gmessages.c:1433
    1433	../../../glib/gmessages.c: No such file or directory.
    (gdb) bt
    #0  g_logv (log_domain=0x7ffff7f7c4f8 "GLib-GObject", log_level=G_LOG_LEVEL_WARNING, format=<optimized out>, args=<optimized out>) at ../../../glib/gmessages.c:1433
    #1  0x00007ffff73470ff in g_log (log_domain=log_domain@entry=0x7ffff7f7c4f8 "GLib-GObject", log_level=log_level@entry=G_LOG_LEVEL_WARNING, format=format@entry=0x7ffff7f84da8 "invalid unclassed pointer in cast to '%s'")
        at ../../../glib/gmessages.c:1471
    #2  0x00007ffff7f72892 in g_type_check_instance_cast (type_instance=type_instance@entry=0x5555558e04b0, iface_type=<optimized out>) at ../../../gobject/gtype.c:4144
    #3  0x00007ffff791e77d in toplevel_compute_size (toplevel=<optimized out>, size=0x7fffffffe170, widget=0x5555558e04b0) at ../../../gtk/gtkwindow.c:4227
    #4  0x00007ffff7f4f3b0 in g_closure_invoke (closure=0x555555898cc0, return_value=return_value@entry=0x0, n_param_values=2, param_values=param_values@entry=0x7fffffffdeb0, invocation_hint=invocation_hint@entry=0x7fffffffde30)
        at ../../../gobject/gclosure.c:832
    #5  0x00007ffff7f62076 in signal_emit_unlocked_R
        (node=node@entry=0x55555588feb0, detail=detail@entry=0, instance=instance@entry=0x55555560e990, emission_return=emission_return@entry=0x0, instance_and_params=instance_and_params@entry=0x7fffffffdeb0)
        at ../../../gobject/gsignal.c:3796
    #6  0x00007ffff7f68bf5 in g_signal_emit_valist (instance=<optimized out>, signal_id=<optimized out>, detail=<optimized out>, var_args=var_args@entry=0x7fffffffe050) at ../../../gobject/gsignal.c:3549
    #7  0x00007ffff7f68dbf in <emit signal ??? on instance 0x55555560e990 [GdkX11Toplevel]> (instance=<optimized out>, signal_id=<optimized out>, detail=detail@entry=0) at ../../../gobject/gsignal.c:3606
    #8  0x00007ffff7a8de96 in gdk_toplevel_notify_compute_size (toplevel=<optimized out>, size=size@entry=0x7fffffffe170) at ../../../gdk/gdktoplevel.c:112
    #9  0x00007ffff7a4b15a in compute_toplevel_size (surface=surface@entry=0x55555560e990 [GdkX11Toplevel], update_geometry=update_geometry@entry=1, width=width@entry=0x7fffffffe220, height=height@entry=0x7fffffffe224)
        at ../../../gdk/x11/gdksurface-x11.c:281
    #10 0x00007ffff7a4c3b2 in compute_size_idle (user_data=0x55555560e990) at ../../../gdk/x11/gdksurface-x11.c:356
    #11 0x00007ffff733f67f in g_main_dispatch (context=0x55555563f6e0) at ../../../glib/gmain.c:3444
    #12 g_main_context_dispatch (context=context@entry=0x55555563f6e0) at ../../../glib/gmain.c:4162
    #13 0x00007ffff733fa38 in g_main_context_iterate (context=0x55555563f6e0, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at ../../../glib/gmain.c:4238
    #14 0x00007ffff733fcef in g_main_loop_run (loop=loop@entry=0x5555560874a0) at ../../../glib/gmain.c:4438
    #15 0x0000555555557de0 in main (argc=<optimized out>, argv=<optimized out>) at ../src/frames/main.c:68

It perhaps makes sense to warn in these situations, but either way
it sounds like gdk_surface_x11_finalize() could enforce the correct
behavior by ensuring there is no dangling timeouts/data. This commit
does that.
2022-12-07 13:16:36 +01:00
Arjan Molenaar
097d87e502 Cleanup: remove unused variables from macos code
Remove unused variables. In case if Cairo code it would
allocate memory, which would result in a memory leak.
2022-12-04 12:50:20 +01:00
Luca Bacci
f788e994a9 GLX: Add extra glXMakeContextCurrent () call to work around a DRI issue
Reference: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7808

Fixes #4499, #5387, #5170
2022-12-02 14:20:43 +01:00
Matthias Clasen
ed6798e94c Merge branch 'work/zzag/wl-output-release' into 'main'
gdk/wayland: Prefer wl_output_release() over wl_output_destroy()

See merge request GNOME/gtk!5243
2022-11-27 22:21:29 +00:00
Matthias Clasen
fe56f3413a Don't emit ::notify from a getter
GdkX11Keymap ddetermines the direction of the
keymap on demand, and was emitting notify::direction
2022-11-26 21:53:33 -05:00
Emmanuele Bassi
03db707f3c vulkan: Add missing enumeration
Check for VK_ERROR_COMPRESSION_EXHAUSTED_EXT.
2022-11-26 15:18:42 +00:00
Vlad Zahorodnii
433734de21 gdk/wayland: Improve readability of wl_output binding code
Provide OUTPUT_VERSION macro to indicate the implemented version of
wl_output in gtk rather than use a magical number.
2022-11-23 22:53:00 +02:00
Vlad Zahorodnii
261bcd40bd gdk/wayland: Prefer wl_output_release() over wl_output_destroy()
By using wl_output_release(), GDK lets the compositor to clean up the
output global more nicely.

For example, currently, most compositors remove the global and then
destroy it later after N seconds expire. With this, the compositor could
experiment with destroying the output global once all its resources are
destroyed.
2022-11-22 14:12:22 +02:00
Vlad Zahorodnii
1d94aefe2b gdk/wayland: Clear GdkWaylandMonitor::output using g_clear_pointer()
Use g_clear_pointer() to make tear down code consistent.
2022-11-22 11:23:08 +02:00
Vlad Zahorodnii
e82e7823a8 gdk/wayland: Destroy zxdg_output_v1 upon GdkWaylandMonitor destruction
It prevents potentially leaking memory.
2022-11-22 11:18:32 +02:00
Florian "sp1rit"​
c36685bf60
gdk: gdkevents: added NULL check to gdk_event_get_axes
this is to prevent gdk from causing a segfault, when getting event axes
for events that don't have them (i.e. attempting to get pressure from a
mice input device).
2022-11-22 09:13:32 +01:00
Matthias Clasen
21a69e7107 Merge branch 'wip/carlosg/osk-activation' into 'main'
gtktext: Claim gesture more selectively

Closes #5351

See merge request GNOME/gtk!5230
2022-11-18 19:33:55 +00:00
Matthias Clasen
e53c9e4832 Merge branch 'wayland-foreign-v2' into 'main'
wayland: Also support the v2 of the importer

See merge request GNOME/gtk!5231
2022-11-18 18:00:42 +00:00
Matthias Clasen
b3821b19b5 wayland: Also support the v2 of the importer
Commit 0ba8e16e14 added support for the export
part of zxdg_foreign_v2, but neglected that the importer
has a v2 as well. Support it.
2022-11-18 12:10:56 -05:00
Carlos Garnacho
f1168c5012 gdksurface: Do not consider GDK_TOUCH_END/CANCEL as popup-dismiss worthy
GDK_TOUCH_END deserves the same treatment than GDK_BUTTON_RELEASE, since it's
subject to the same circumstances (popping up a menu on long press would be
immediately dismissed on release if we handled them there). Ideally, we would
want to match releases that we obtained a press for while grabbed, but as
the popup is also dismissed on GDK_BUTTON_PRESS/GDK_TOUCH_BEGIN, there's no
use for this tracking.

And GDK_TOUCH_CANCEL sounds weird as a reason to dismiss popups, just like
crossing events would.

Related: https://gitlab.gnome.org/GNOME/mutter/-/issues/2512
2022-11-18 17:56:14 +01:00
Jonas Ådahl
07a59da6e4 wayland/surface: Set the tiling state from xdg-shell too
We plumbed it from the gtk-shell configure event, but didn't for the
equivalent state passed via xdg_toplevel.configure.
2022-11-18 13:11:25 +01:00
Matthias Clasen
8c1a041104 gdk: Fix possible memory errors
clang complained that we may end up jumping
to the cleanup code without initializing data
in the jpeg code. Always initialize data to
NULL to prevent that eventuality.
2022-11-18 00:04:23 -05:00
Matthias Clasen
ebe6d52252 Drop redundant glib version checks
We require GLib 2.72 now.
2022-11-17 22:49:56 -05:00
Matthias Clasen
60aaf38f39 gdk: Clean up gdkprivate.h
Move apis to more specific headers.
2022-11-17 22:49:56 -05:00
Matthias Clasen
2bab8cca5f gdk: Rename GDK_SURFACE_TEMP
We use this value only for drag surfaces, so call it that.
2022-11-17 22:49:56 -05:00
Matthias Clasen
b12d31d189 Fix spelling errors
These were pointed out by codespell.
2022-11-17 22:49:45 -05:00
Luca Bacci
7c62eaa528 Merge branch 'win32-hotspot' into 'main'
gdk/win32: fix cursor hotspot

See merge request GNOME/gtk!5216
2022-11-17 09:06:55 +00:00
Marc-André Lureau
437a359f1b gdk/win32: fix cursor hotspot
This seems to be a regression from commit c06b1cc103 "Win32: Re-work cursor handling".

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-11-16 11:50:56 +04:00
Matthias Clasen
5aeb6c31c0 events: Drop an unused variable 2022-11-15 10:26:25 +00:00
Matthias Clasen
df5a13806d Merge branch 'gdkwaylandtoplevel' into 'main'
gdk/wayland/surface: Move more members to `GdkWaylandPopup` and `GdkWaylandToplevel`

See merge request GNOME/gtk!4227
2022-11-10 13:58:24 +00:00
Luca Bacci
aebbf7cc61 Merge branch 'win32-inhibit' into 'main'
gdk-win32: implement basic inhibit-system-shortcuts

See merge request GNOME/gtk!5206
2022-11-10 11:18:23 +00:00
Luca Bacci
26c524a578 GdkWin32: Do not use MA_NOACTIVATEANDEAT
GTK knows when a surface is modally blocked and automatically drops
button press and release events, so do not block input in advance
from WM_MOUSEACTIVATE.
2022-11-10 09:27:24 +01:00
Marc-André Lureau
cf04a3c99d gdk-win32: implement basic inhibit-system-shortcuts
This is largely adapted from commit 83027c68f1 ("11: Implement
inhibit_system_shortcuts API"), with similar rationale:

    To implement the inhibit_system_shortcuts API on X11, we emulate the
    same behavior using grabs on the keyboard.

    To avoid keeping active grabs on the keyboard that would affect
    other X11 applications even when the surface isn't focused, the X11
    implementation takes care of releasing the grabs as soon as the
    toplevel loses focus.

Note that Windows has low-level keyboard hooks that could help achieve
the expected behaviour. This is implemented by spice-gtk & gtk-vnc for
example, but correctness isn't obvious. I left a TODO comment.

This patch helps implementing remote desktop widgets with GTK4, since
currently on win32 backend Alt-Tab and such are always left to the
system unless there is keyboard grab (which can't be requested by the
client API anymore, afaict).

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-11-09 19:29:03 +04:00
Matthias Clasen
43d6682e45 wayland: Reimplement export_handle
Reimplement the backend API on top of the new async
calls.
2022-11-09 16:28:30 +01:00
Matthias Clasen
dcc3b638aa wayland: fixups 2022-11-09 16:28:30 +01:00
Matthias Clasen
4b40aeb0c6 wayland: Support the v2 protocol in both places
The old api should better support both versions of the
foreign protocol too.
2022-11-09 16:28:29 +01:00
Matthias Clasen
0ba8e16e14 wayland: Add zxdg_foreign_v2 protocol support 2022-11-09 16:28:29 +01:00