Commit Graph

10694 Commits

Author SHA1 Message Date
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
Emmanuele Bassi
dcd549aebe Add constructors for GdkFileList
C API users can keep dealing with the implicit equivalence of
GdkFileList and GSList, but language bindings have no idea that one type
is another, and none of them exposes GSList as a type anyway, so they
will need a way to construct a GdkFileList.

Instead of making GdkFileList mutable, and re-implement GSList, we only
provide a constructors pair that lets you create a GdkFileList from a
linked list or from an array.
2022-07-28 14:41:35 +01:00
darkcutler
64a959dad9 Fix DnD on Windows
DnD under Windows needed 3 fixes to work with Gtk.DropTarget.

1. The droptarget_w32format_contentformat_map list never gets
filled so the gdk_win32_drop_read_async throws
"No compatible transfer format found".
This is an easy fix and done the same way in the win32 clipboard code.

2. After a drop no gdk_drop_emit_leave_event gets emitted.
This causes a second drop to trigger a bunch of assertion
'self->drop == drop' failed because the first drop is still active.
This is also an easy fix and done the same way by the macos backend.

3. Handling gdk_drop_status/gdk_drop_get_actions interaction.
In gtk_drop_target_do_drop the code
```gdk_drop_finish (self->drop, gdk_drop_get_actions (self->drop));```
calls the finish operation with the actions of the drop which triggers
```g_return_if_fail (gdk_drag_action_is_unique (action));```
in gdk_drop_finish. The code assumes that GdkDrop::actions gets
narrowed down by calling gdk_drop_status. This is hard to assure
because at the same time gdk_drop_get_actions is used by
gtk_drop_target_accept to figure out if a drag is accepted.
GdkDrop::actions serves a double purpose here as the supported source
actions and the currently agreed on action. Both the x11 and the
wayland backend get this wrong somewhat too. Under wayland/x11 when
a drag coming from a source that supports both MOVE and COPY is
first hovering a drop target that only supports COPY it is afterwards
no longer accepted by other drop targets only accepting MOVE.
Under x11 this is permanent for this drag but with wayland the drag
recovers when hovering other widgets. The win32 backend now sets the
supported source actions before any enter/move/drop and narrows them
down in gdk_win32_drop_status.

The patch only touches the win32 backend and fixes all three issues,
for me restoring DnD under windows.

Closes #4498
2022-07-25 15:16:23 +00:00
Matthias Clasen
f95f992d32 Merge branch 'wip/carlosg/use-press-serial' into 'main'
gdk/wayland: Use last implicit grab serial for DnD start requests

Closes #5048

See merge request GNOME/gtk!4889
2022-07-18 14:18:22 +00:00
Carlos Garnacho
95cf34ab4c gdk/wayland: Stop storing the last serial in GdkWaylandDisplay
This is not used anymore, so we can drop the serial being stored
here.
2022-07-18 15:21:40 +02:00