Commit Graph

10795 Commits

Author SHA1 Message Date
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
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
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
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
Matthias Clasen
1c99ed542a Add gdk_toplevel_export_handle
This code is backend-specific, and should not live
in gtkwindow.c.
2022-11-09 16:28:29 +01:00
Marc-André Lureau
a92aea4c0e gdk-win32: fix unused variable warnings
../gdk/win32/gdksurface-win32.c: In function 'gdk_win32_get_window_size_and_position_from_client_rect':
../gdk/win32/gdksurface-win32.c:3753:20: warning: unused variable 'impl' [-Wunused-variable]
 3753 |   GdkWin32Surface *impl = GDK_WIN32_SURFACE (window);
      |                    ^~~~
../gdk/win32/gdksurface-win32.c: In function 'gdk_win32_surface_get_queued_window_rect':
../gdk/win32/gdksurface-win32.c:5129:20: warning: unused variable 'impl' [-Wunused-variable]
 5129 |   GdkWin32Surface *impl = GDK_WIN32_SURFACE (surface);

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-11-09 19:19:44 +04:00
Matthias Clasen
956100017c Merge branch 'wayland_display_geometry' into 'main'
wayland: calculate union of geometry of all monitors for toplevel bounds

See merge request GNOME/gtk!4790
2022-11-08 16:29:15 +00:00
Matthias Clasen
514ec8942d Merge branch 'cursor-size' into 'main'
GtkSettings: Provide settings in logical pixels also on X11

Closes #5223 and #5230

See merge request GNOME/gtk!5172
2022-11-08 16:27:06 +00:00
Matthias Clasen
7caa211d6a Merge branch 'wip/carlosg/back-forward-mask' into 'main'
gdk/wayland: Fix button mask calculation on button events

Closes #5301

See merge request GNOME/gtk!5191
2022-11-08 16:14:18 +00:00
Colin Kinloch
293b91e515 wayland: calculate union of geometry of all monitors for toplevel bounds
Signed-off-by: Colin Kinloch <colin.kinloch@collabora.com>
2022-11-07 11:08:18 +00:00
Luca Bacci
440929daea GdkWin32: Add more GDK_NOTE calls for settings 2022-11-04 16:11:27 +01:00
Luca Bacci
1506de5669 GdkWin32: Set the "gtk-hint-font-metrics" property
Helps for https://gitlab.gnome.org/GNOME/gtk/-/issues/5257
2022-11-04 16:03:11 +01:00
Luca Bacci
41f9f1d623 GdkWin32: Set the "gtk-cursor-blink" setting 2022-11-04 15:57:25 +01:00
Luca Bacci
24047d7f61 GdkWin32: Set the "gtk-cursor-theme-size" setting
Note that we have to set the logical value, that's why
we use GetSystemMetrics and not GetSystemMetricsForDpi.
2022-11-04 15:56:20 +01:00
Luca Bacci
45681c4fe5 GdkWin32: Detect the high contrast setting
And set the theme name accordingly ("Default-hc")
2022-11-04 15:54:02 +01:00
Luca Bacci
95c121b6d6 GdkWin32: Fix leak of screen HDC 2022-11-04 15:41:11 +01:00
Luca Bacci
6b569afdfe GdkWin32: Remove special-casing for old Pango versions
We require Pango 1.50 now
2022-11-04 15:35:04 +01:00
Luca Bacci
429017ad16 GdkWin32: Remove old code 2022-11-04 15:31:40 +01:00
Luca Bacci
fe1d86f23c GdkWin32: Sort settings alphabetically 2022-11-04 15:30:12 +01:00
Carlos Garnacho
ece28bea74 gdk/wayland: Fix button mask calculation on button events
There's 2 things broken here:
- The mask was calculated on top of the GDK button (i.e. skipping
  4-7 buttons), so GDK_BUTTON4_MASK and GDK_BUTTON5_MASK were not
  assigned. This is now calculated on the (continuous) BTN_ evcodes
  so it is guaranteed that the next 2 physical buttons (i.e.
  back/forward) get these two places in the mask assigned.
- Furthermore, these buttons would be pushed to places in the
  modifier mask that they didn't belong to. It is now checked hard
  that only the first 5 buttons enable a modifier flag.

Overall, this ensures that no event masks with bonkers values are
forwarded, and that no stale implicit grabs are left after additional
buttons are pressed.

Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/5301
2022-11-02 17:17:43 +01:00
Luca Bacci
ac60bc6095 X11: Provide settings in logical pixels
This makes GtkSettings values on X11 match what we get on
other backends.

Reporting size settings in logical pixels (i.e for scale
== 1) is useful for properly supporting mixed-DPI setups.
As X11 doesn't support mixed-DPI setups anyway, XSettings
doesn't bother providing logical values. Thus we scale
from physical to logical values ourselves.

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/5223
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/5230
2022-11-01 13:09:28 +01:00
Matthias Clasen
16b95939f9 gdk: Bump the jpeg malloc limit
Bump the limit for memory use during jpeg loading
to 1GB, matching what gdk-pixbuf has for this.
2022-10-31 20:35:15 -04:00
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