Commit Graph

8961 Commits

Author SHA1 Message Date
Alexander Larsson
85e59220a5 filechooser portal: Free portal proxy when bus connection closes
This was blocking the clean exit from the testdbus shutdown in
the defaultvalues test. The proxy was keeping the connection alive
which blocks g_test_dbus_down().
2020-02-04 14:08:10 +01:00
Alexander Larsson
a3be0ec5f0 Don't use xsettings or xft defaults in testsuite
This adds a GDK_DEBUG=default-settings flag which disables reads
from xsettings and Xft resources, and enables this for the testsuite.

This is one less way to get different testresults depending on the
environment. In particular, it was failing the css tests for me
due to getting the wrong font size because i have a different dpi.
2020-02-03 15:11:35 +01:00
Alberts Muktupāvels
66af531ff3 display-x11: don't mention gdk_monitor_is_primary in the docs
https://gitlab.gnome.org/GNOME/gtk/merge_requests/1371#note_699272
2020-02-02 19:18:22 +02:00
Matthias Clasen
f84fdfc0c1 Merge branch 'sigma' into 'master'
gdk: Handle small final sigma in gdk_keyval_convert_case

See merge request GNOME/gtk!1351
2020-02-02 12:04:09 +00:00
Matthias Clasen
a46f9af1c0 Remove primary monitor api
We only have implementations of this on X11 and Win32,
so make it available as backend api there.

Update all callers to use either the backend api, or
just monitor 0.
2020-01-30 21:33:37 +01:00
Alexander Larsson
99c89d61e1 Merge branch 'icon-theme-rework' into 'master'
Rework icon themes

See merge request GNOME/gtk!1368
2020-01-30 17:30:10 +00:00
Alexander Larsson
5f8c2b52c6 indentation: fix various alignment issues
Most of these stem from the GtkIconInfo -> GtkIcon rename
2020-01-30 12:27:15 +01:00
Alexander Larsson
2ec51b7010 icon-theme: Update the docs 2020-01-30 10:53:43 +01:00
Matthias Clasen
929d325560 profiler: Exit gracefully on SIGTERM
This is nice, since it lets me quickly launch a test app
and terminate it with Ctrl-C and still produce a usable
sysprof trace.
2020-01-30 10:04:38 +01:00
Alexander Larsson
afa6cc2369 Break out cairo color matrix recoloring to gdk_cairo_image_surface_recolor()
This is useful in some parts of the icon theme APIs.
2020-01-29 19:06:16 +01:00
Alberts Muktupāvels
248883089c x11: add support for _GTK_WORKAREAS_Dn
If window manager supports _GTK_WORKAREAS use per-monitor work areas.

https://mail.gnome.org/archives/wm-spec-list/2018-December/msg00000.html
https://gitlab.freedesktop.org/xdg/xdg-specs/merge_requests/22

https://gitlab.gnome.org/GNOME/gtk/merge_requests/1300
2020-01-29 14:38:08 +02:00
Matthias Clasen
83cccfc984 Merge branch 'gdk-device-leak-fix' into 'master'
GdkDevice leak fix

See merge request GNOME/gtk!1358
2020-01-29 10:44:42 +00:00
Timm Bäder
b3f454ed98 Merge branch 'fix-doc-typo' into 'master'
Fix a doc typo

See merge request GNOME/gtk!1364
2020-01-29 07:49:13 +00:00
Luca Bacci
f0fe2e0743 Fix a doc typo 2020-01-28 20:42:03 +00:00
Sebastian Keller
9c6669be48 gdk/x11: Properly unref removed device in XI2 device manager
When a device is added, there are two references to it by the device
manager, the initial one and the one used for the id_table. Removing a
device only removed the reference added by the id_table resulting in the
GdkDevice being leaked.

https://gitlab.gnome.org/GNOME/gtk/merge_requests/1358
2020-01-27 21:42:34 +01:00
Sebastian Keller
5040d81e03 gdkseatdefault: Unref removed slave devices
Adding a slave device adds a ref, but removing it does not unref it.

https://gitlab.gnome.org/GNOME/gtk/merge_requests/1358
2020-01-27 01:37:14 +01:00
Timm Bäder
77e0d360ed Add pure and const annotations to various functions 2020-01-26 18:21:07 +01:00
Alex Henrie
f15a34c7e4 gdk: Handle small final sigma in gdk_keyval_convert_case 2020-01-24 17:10:07 -07:00
Matthias Clasen
4e58541d52 Make wayland load cursors on demand
Copy just enough of libwayland-cursor to make our own
loading. This lets us drop the dependency on libwayland-cursor,
and changes the startup cost for cursor theme loading
from 25ms to 0.1ms.

At the same time, simplify the handling of scaled cursors -
instead of creating an array of theme objects, just make a
single theme object provide all scaled cursor sizes.
2020-01-24 17:27:45 -05:00
Matthias Clasen
59a31e05bc gdk: Add a profiler mark for paint_idle
This is the big frame clock function where most
signals are emitted, and it can keep us away from
the mainloop for a long time.
2020-01-22 23:44:01 -05:00
Matthias Clasen
527b67af3d wayland: Add a mark for cursor loading
This is much too slow.
2020-01-22 23:44:01 -05:00
Matthias Clasen
3c03d7970a More profiler reshuffling
Add more of the marks without requiring a debug build.
2020-01-22 23:44:01 -05:00
Matthias Clasen
fea42def61 surface: Always dd events to the profiler trace
We want to get this data for release builds as well.
2020-01-22 16:36:54 -05:00
Matthias Clasen
56b8d1dfbe frame clock: Redo the profiler marks
Instead of reporting the frame clock phases as defined,
report the duration of the signal emissions, which is more
useful for tracking down what is taking time.
2020-01-22 16:36:02 -05:00
Matthias Clasen
dfea9bf0e8 wayland: Add profiler marks around surface handling
Add marks for when we do commits, swap buffer or
receive frame events. These are the low-level start
and end points of the frame cycle, and it is useful
to see them in the profiler.
2020-01-22 15:12:03 -05:00
Matthias Clasen
36cb812ad8 surface: Add enter/leave events to profiler traces
These are just as likely to trigger extra work than
other mouse events, so it is useful to show them.
2020-01-22 15:12:03 -05:00
Matthias Clasen
05b98c3834 gdk: Make profiler support unconditional
We are still not providing samples unless debugging is enabled.
That needs a bit more work.
2020-01-21 11:50:12 -05:00
Vlad Zahorodnii
b36258f204 gdk: Subtract base size when checking aspect ratio
According to the ICCCM spec [1], one should subtract the base size from
the window size before checking that the aspect ratio falls in range.

This change fixes shrinking Firefox Picture-in-Picture windows when
running KDE Plasma (with KWin as the window manager).

[1] https://tronche.com/gui/x/icccm/sec-4.html#s-4.1.2.3
2020-01-19 02:22:44 +02:00
Matthias Clasen
46bb1a9b6a wayland: Fix release build warnings 2020-01-18 11:49:16 -05:00
Matthias Clasen
19280db075 x11: Fix release build warnings 2020-01-18 11:49:16 -05:00
Matthias Clasen
69fb3648b2 Tweak the file transfer portal _again_
This is a neverending story. I was seeing problems in tests where
the nested mainloop was picking up unrelated timeouts.

Break down and make this async. This changes the ordering in which
the (de)serializers are registered. If this is causing issues, we
can introduce priorities or something else.
2020-01-17 23:46:37 -05:00
Carlos Garnacho
357e215fb8 gdkdrag/x11: Issue XdndLeave on cancellation
According to XDND "The XdndLeave message cancels the session.",
issue one when cancelling a drag, so the dest side has an opportunity
to forget about the GdkDrop.
2020-01-16 15:03:24 +01:00
Carlos Garnacho
4716c9ae2f gdkdrag/x11: Drop timestamp argument from gdk_drag_do_leave()
This is not necessary for the XdndLeave message, nor used.
2020-01-16 15:02:16 +01:00
Carlos Garnacho
5aad3d7d0e gdk/x11: Ensure to hide DnD surface after failed operation
The drag source might be cached and held alive, only disposed after
future drag begin operations. Ensure the drag surface gets hidden
properly or might might stay transparent but mapped till then.
2020-01-16 13:34:08 +01:00
Carlos Garnacho
fe36c24b07 gdk/x11: Ensure to sync type list after sending XdndEnter
Otherwise we are not ensured the GdkDrop is up-to-date, might even
be a stale one from an older DnD operation.
2020-01-16 13:33:57 +01:00
Carlos Garnacho
682068f887 gdk/x11: Serialize gtype content formats before sending Xdnd enter
This ensures GType handlers get serialized to mimetypes at the time
the drag dest inspects the XdndTypeList property.
2020-01-16 13:31:40 +01:00
Matthias Clasen
82dc7b903c Fix the filetransfer portal initialization
Reusing the cancellable only works if you don't throw
it away after first use.
2020-01-15 10:58:54 -05:00
Matthias Clasen
b020a3fcf9 Try harder to make ci not timeout
Make getting the file transfer portal proxy more
async, and avoid leaking a bus connection. This
causes GTestDBus to hang at the end of the test
run.
2020-01-14 18:32:05 -05:00
Matthias Clasen
806e159b8b Handle lack of file transfer portal
Don't block for 25 seconds trying to get a bus
connection. Give up after 1 second.
2020-01-14 01:03:48 -05:00
Robert Ancell
83867f9cbf Add missing (closure) GIR annotations 2020-01-13 14:26:50 +13:00
Robert Ancell
ea9f0df67b Fix incorrect use of GIR closure annotations.
They were being applied to the callback function, not the data that is passed
to that function.
2020-01-13 14:11:15 +13:00
Robert Ancell
2b6162116d Fix docstring errors with drag and drop code 2020-01-13 12:30:17 +13:00
Matthias Clasen
f5daecf353 Merge branch 'dnd-gestures-2' into 'master'
Add new dnd api

See merge request GNOME/gtk!1278
2020-01-11 06:09:58 +00:00
Alex Samorukov
f0cbd175cd gdk_quartz_keymap_translate_keyboard_state fills consumed_modifiers
incorrectly (closes #2102)

See merge request GNOME/gtk!1225
2020-01-10 22:18:24 +01:00
Matthias Clasen
8d3e1eb314 docs: Fix a typo 2020-01-09 00:31:13 -05:00
Matthias Clasen
187a701a99 content provider impl: Take mime types into account 2020-01-08 18:48:22 -05:00
Matthias Clasen
d116bbf0c8 docs: Expand the GDK dnd docs 2020-01-08 18:48:22 -05:00
Carlos Garnacho
f6f331efe3 gdk/x11: Forward suggested action (if any) to XdndStatus
Go ahead with the suggested action, so the drag source may update
cursor feedback properly, and eventually result in the correct
action.
2020-01-08 18:48:21 -05:00
Matthias Clasen
3080592234 gdk: Make gdk_event_set_coords support dnd events
GTK event propagation code relies on this working.
2020-01-08 18:48:21 -05:00
Matthias Clasen
a76b187a5b drop: Add a convenience api
This is a question that drag-drop handlers frequently
need to answer, so make it easy.
2020-01-08 18:48:20 -05:00
Matthias Clasen
ea9f2abcc4 Add another callback-based provider
This one can be used in cases where data needs
to be served in multiple formats that may not
all be covered by content serializers.
2020-01-08 18:48:19 -05:00
Matthias Clasen
fdcfe0e80a Add a generic callback content provider
This one is convenient to use in cases where a
drag is just serving an existing GType which
is covered by content serializers.
2020-01-08 18:48:19 -05:00
Matthias Clasen
8137dea8c1 Add (de)serializers for GdkRGBA
This is a format that we use in various
color picker widgets, so support it in GDK.
2020-01-08 18:48:19 -05:00
Alex Samorukov
df9d9c1f8a impl_class->set_functions listed twice in the object 2020-01-08 14:15:45 +00:00
Alex Samorukov
d131c8d0e7 move [NSApplication sharedApplication] after _gdk_quartz_events_init() to avoid initialization issues
(cherry picked from commit 46c2451c5a3cd42aa5a94935bfc850a484288ff3)
2020-01-08 14:10:06 +00:00
Timm Bäder
2cbfb0e980 GdkGLContext: check for GL_KHR_debug for GL debug output
This is available in GLES.
2020-01-07 17:27:16 +01:00
Timm Bäder
095a378dbc GdkRGBA: Use floats instead of doubles 2020-01-07 17:27:15 +01:00
Matthias Clasen
2ee9752822 wayland: Remove debug spew 2020-01-06 08:19:01 -05:00
Matthias Clasen
759d53cfa0 wayland: Don't artificially prefer ASK
We were always adding ASK to the list of possible
actions, and preferring it. This was causing the
ask cursor to show up when both the source and
the target support ASK, even though it is only
meant to happen if you hold the Alt modifier.

Instead, use one of the supported actions as
preferred action.
2020-01-04 12:51:32 -05:00
Matthias Clasen
814d20d61a docs: Small clarifications to DND docs
Clear up the documentation around ASK handling
a bit.
2020-01-04 12:48:39 -05:00
Matthias Clasen
6cef520804 wayland: Minor cleanup
Stop storing selected_action, mainly since the name
is confusing. Instead, just pass the value directly
in the 2 places where it is used.
2020-01-04 12:48:39 -05:00
Matthias Clasen
8c77491150 wayland: Fix action handling more
When updating GdkDrop::actions from changes sent by
the compositor, we were inadvertently setting them to 0,
causing drops to appear impossible.
2020-01-04 09:38:31 -05:00
Matthias Clasen
709ebcedd4 wayland: Finish pending offer handling
When creating a new GdkDrop object on drag_enter, take pending
source_actions and action into account. The code to store the
pending actions was already there, they were just not passed
on to the drop object when we create it.
2020-01-04 09:38:01 -05:00
Matthias Clasen
47e6b88555 wayland: Clean up drags
We need to set the drag to NULL in gdk_wayland_drag_drop_done,
otherwise, all future drags will be considered local after the
first local one. Worse, they will also provide the wrong data.
2020-01-04 09:36:38 -05:00
Matthias Clasen
4b818495ca wayland: Fix dnd type negotiation
We need to call gdk_content_formats_union_serialize_mime_types
like GdkClipboard does, in order to get mime types that we can
sent out.
2020-01-01 12:51:19 -05:00
Matthias Clasen
1841ec4f8e contentprovider: cosmetic fix 2020-01-01 12:51:19 -05:00
Matthias Clasen
21708e4352 contentserializer: Fix an annotation 2020-01-01 12:51:19 -05:00
Matthias Clasen
15242d66e1 wayland: Pass root coordinates for dnd events
That is what the api currently requires, so provide it.

This fixes DND to work again, for the most part.
2019-12-30 12:00:53 -05:00
Matthias Clasen
94a0bc01f9 gdk: Populate dnd event coords
The GdkDrop emit... apis take root coordinates.
That should be changed to surface coordinates,
eventually. For now, make the functions fill
the x, y fields.
2019-12-30 11:58:11 -05:00
Matthias Clasen
677c4b140c gdk: Fix coordinates in dnd events
Don't store coordinates as shorts. Use doubles,
as everywhere else. Also add x, y in addition
to x_root, y_root, and actually return those
in gdk_event_get_coords.
2019-12-30 11:56:49 -05:00
Matthias Clasen
0bb9fc65ad Remove gdk_seat_grab
We are no longer using free-standing grabs
in GTK. The replacement is the autohide
functionality of popup surfaces.
2019-12-29 20:31:58 -05:00
Matthias Clasen
ad6fe9d6a0 surface: Only unpause events if we paused them
When a new popup surface is created, it may end up
getting a resume-events signal from its frame clock
without having seen a flush-events first.

Don't unpause events in that case, since it messes
up the displays pause counter.

This was causing criticals with tooltips.
2019-12-29 13:35:36 -05:00
Matthias Clasen
a73947e54f Remove more mir remnants
The mir backend was removed a while ago, so
GDK_WINDOWING_MIR is never defined.
2019-12-28 21:52:34 -05:00
Matthias Clasen
0546fd7c8a Merge branch 'fix.nonunix.builds' into 'master'
Fix non-portal (UNIX) builds

See merge request GNOME/gtk!1252
2019-12-16 17:38:56 +00:00
Chun-wei Fan
3d8d4921af gdk: Build portal bits on *nix only
The newly-added portal items are supported on *nix only, so only build
them on *nix.
2019-12-17 00:52:18 +08:00
Matthias Clasen
721595edea file transfer: Fix build on non-Linux
O_PATH and O_CLOEXEC are not universally available.
2019-12-16 11:38:04 -05:00
Matthias Clasen
bf2c29a36a x11: Only update cursors if we have any
We were accessing an on-demand created hash table
without checking if it had been created first.

Fixes: https://gitlab.gnome.org/GNOME/gtk/issues/2308
2019-12-13 14:46:00 -05:00
Matthias Clasen
a20c8af678 clipboard: file transfer portal support
Implement file-list <-> application/vnd.flatpak.file-list
serialization by talking to the file transfer portal.

See https://github.com/flatpak/xdg-desktop-portal/pull/222
2019-12-12 14:25:33 -05:00
Christoph Reiter
88da95d921 Merge branch 'honor-hotspot-gtk4' into 'master'
gdk/x11: Honor hotspot during drag cancel animation

See merge request GNOME/gtk!1236
2019-12-11 12:59:23 +00:00
Chun-wei Fan
44f9c67466 Merge branch 'vulkan-no-layered-windows' into 'master'
Win32: Do not enable layered windows when using Vulkan

See merge request GNOME/gtk!1217
2019-12-11 06:24:49 +00:00
Robert Mader
7a46378e71 gdk/x11: Honor hotspot during drag cancel animation
Otherwise the icon "jumps" to the cursor position with its top left when
the animation starts.
This is especially visible if the dragged item is big, like when dragging
mails in Thunderbird.
2019-12-09 01:45:30 +01:00
Hubert Figuière
585397937d doc: Cleanup doc removing mentions of gdk_surface_shape_combine_region() 2019-12-05 11:33:09 -05:00
Jonas Ådahl
ba74f41a70 wayland/vulkancontext: Fix present region on HiDPI
VkPresentRegionsKHR is expected to operate in buffer coordinates, but
the region we get passed is in surface coordinates, so it must be scaled.
2019-12-03 16:45:37 +01:00
Jonas Ådahl
d6a6313493 wayland/glcontext: Fix damage region on HiDPI
The passed regions are in surface coordinates, but
eglSwapBuffersWithDamage() is in buffer coordinates.
2019-12-03 16:45:37 +01:00
Emmanuele Bassi
def700739d Use a single compilation symbol
We use a compilation symbol in our build to allow the inclusion of
specific headers while building GTK, to avoid the need to include only
the global header.

Each namespace has its own compilation symbol because we used to have
different libraries, and strict symbol visibility between libraries;
now that we have a single library, and we can use private symbols across
namespaces while building GTK, we should have a single compilation
symbol, and simplify the build rules.
2019-11-27 13:33:43 +00:00
Chun-wei Fan
9c5ea8eba4 gdkvulkancontext-win32.c: Suppress layered Windows on Vulkan
The Vulkan renderer does not work well with layered windows enabled, so
turn it off when we successfully created the Vulkan context on Windows.
2019-11-26 17:00:11 +08:00
Emmanuele Bassi
9a88d17ef2 Merge branch 'gdk-backend-imports' into 'master'
Correct Gdk backend import paths and related gtk-doc

See merge request GNOME/gtk!1197
2019-11-18 10:27:32 +00:00
Andy Holmes
907a86fd93 Correct Gdk backend import paths and related gtk-doc
Correct the paths in the include guard warnings and use the `@Include`
directive for the Gdk backends.
2019-11-18 00:31:38 -08:00
Emmanuele Bassi
1ec4cb7f17 Disable GdkSurface.minimize on Wayland
The existing xdg-shell protocols do not support minimization in a way
that allows us to implement the GdkSurface API; the only minimization
operation does not come with a state notification, nor it comes with
a way to undo itself.

Closes: #67
2019-11-16 20:25:01 +00:00
Emmanuele Bassi
b70e4f6de9 Rename "iconify" to "minimize"
The "iconified" state is mostly an X11-ism; every other platform calls
this state "minimized" because it may not involve turning a window into
an icon at all.
2019-11-16 20:07:37 +00:00
Andy Holmes
d32cd210bb Correct GdkX11 import path in docs and include guards
Update the include directives in the documentation, as well as the
include guards in headers, to point to gdk/x11/gdkx.h.

closes #2254
2019-11-16 01:35:09 -08:00
Benjamin Otte
5d07877b35 Merge branch 'wip/sadiq/fix-leak' into 'master'
selection-output-stream-x11: Fix a memory leak

See merge request GNOME/gtk!1149
2019-11-04 17:46:28 +00:00
Benjamin Otte
4b41dd4eb1 Merge branch 'otte/for-master' into 'master'
Otte/for master

See merge request GNOME/gtk!1153
2019-11-01 14:13:28 +00:00
Benjamin Otte
41beae1956 vulkan: Add missing enum value
Also update comment to point to new header after Vulkan reorganized
their repositories.
2019-11-01 14:52:36 +01:00
Matthias Clasen
cb81a06793 wayland: Drop the keyboard settings object
It is no longer used.
2019-10-29 22:20:57 -04:00
Matthias Clasen
4d9cc483c9 wayland: Rely on server key repeat info
Using gsettings for this information does not work
in sandboxed scenarios, where settings are per-app.
Since the Wayland protocol provides this information
nowadays, just drop the old code for reading
the gsettings.
2019-10-29 21:58:45 -04:00
Mohammed Sadiq
e79d585b00 gdkselectionoutputstream-x11: Fix a memory leak 2019-10-27 14:05:46 +05:30
Carlos Garnacho
075c77325b gdk: Avoid poking possibly freed memory
The event may end up freed after delivery, ensure to keep a ref in order
to emit the matching emulated crossed event matching a proximity event.

Closes: https://gitlab.gnome.org/GNOME/gtk/issues/2157
2019-10-09 10:35:50 +02:00
Carlos Garnacho
f354a7787a gdk: Fix wl_output accounting on tablet devices
The code managing this accounting mixed seat and tablet output lists,
can't bode well. Fixes invalid reads on list elements, as there are
dangling pointers.

Closes: https://gitlab.gnome.org/GNOME/gtk/issues/2157
2019-10-08 17:59:57 +02:00
Georges Basile Stavracas Neto
a795d6635b vulkan/context: Implement VK_KHR_incremental_present
This is the Vulkan version of eglSwapBuffersWithDamage(), and
it's always a good idea to limit the number of pixels we're
pushing to the GPU and/or swapping into the display.
2019-10-05 12:13:22 -03:00