Commit Graph

11721 Commits

Author SHA1 Message Date
Matthias Clasen
3a4c69f370 gdk: Add gdk_rgba_print 2024-05-31 21:29:49 -04:00
Maximiliano Sandoval
2eea911a0f
gdktoplevel: Document TitlebarGesture 2024-05-31 11:47:30 +02:00
Maximiliano Sandoval
ee4a817121
gdk: docs: Document error quarks 2024-05-31 11:47:30 +02:00
Matthias Clasen
7ec4f6e297 Merge branch 'wip/xdg-dialog' into 'main'
gdk/wayland: Implement support for xdg-dialog Wayland protocol

See merge request GNOME/gtk!6837
2024-05-29 23:40:39 +00:00
Matthias Clasen
8841a002ed Merge branch 'build-with-unicode' into 'main'
Windows: Build with UNICODE

See merge request GNOME/gtk!7230
2024-05-29 23:20:01 +00:00
Matthias Clasen
6da606aaad Merge branch 'issue-6401-legacy' into 'main'
Win32 GL: Also force not to use depth/stencil/accum bits on legacy contexts (for issue #6401)

See merge request GNOME/gtk!7176
2024-05-29 23:18:04 +00:00
Chun-wei Fan
5935bc95b7 gdkvulkancontext.c: Use pointers to hash VkShaderModule
VkShaderModule's may or may not be pointers depending on the target
platform, so use pointers to hash those handles to be safe, and retrieve
them from hashes accordingly.

Fixes build on 32-bit Windows at least.
2024-05-29 18:03:13 +08:00
Luca Bacci
7f9363d471 Windows: Build with UNICODE
Build with UNICODE (and _UNICODE) defined when targeting Windows.
2024-05-28 16:37:48 +02:00
Bilal Elmoussaoui
9b42377347 docs: Drop _finish blobs
As they are generated by gi-docgen thanks to the newly added async annotations.
It allows bindings that don't expose the _finish
functions to propose less-confusing docs
2024-05-23 20:39:50 +02:00
Carlos Garnacho
cf8c3be030 gdk/wayland: Implement support for xdg-dialog Wayland protocol
This protocol lifts some functionality from the gtk-shell protocol,
namely the ability to tag dialogs as modal. Ensure to use this
new protocol if available for the task, instead of the gtk-shell
protocol.
2024-05-23 12:40:39 +02:00
Carlos Garnacho
4eb715cf81 build: Support in-tree copies of wayland protocols
Make the info about the required protocols an array of definitions
again (a dict instead of an array this time) and add a field that
may be used for version checks of the wayland-protocols found.

Also, make it possible to have versioned protocols in-tree. Both
of these things will allow us to ship in-tree copies of wayland-protocols
without necessarily having to bump the version we depend on.
2024-05-23 12:40:19 +02:00
Luca Bacci
d4899fdf1f Merge branch 'gdk4_win32_fix_dnd_move_cursor' into 'main'
gdk4-win32: Guarantee dnd-move as a cursor name

See merge request GNOME/gtk!7289
2024-05-23 10:16:30 +00:00
Matthias Clasen
ca442f8641 Merge branch 'css-color-spaces' into 'main'
gdk: Add support for some color conversions

See merge request GNOME/gtk!7285
2024-05-22 22:32:52 +00:00
g.willems
aa057da1ca win32: Guarantee dnd-move as a cursor name
gdk currently falls back to the default cursor, which may not be
approriate for rendering a DnD move.
2024-05-22 20:55:21 +02:00
Matthias Clasen
1de09d59fb css: Support some color spaces
Support the hwb(), oklab() and oklch() functions for specifying
colors in these color spaces.

See https://bottosson.github.io/posts/oklab/ and
https://www.w3.org/TR/css-color-4/.

Some tests included.
2024-05-22 14:31:56 -04:00
Arjan Molenaar
396ef5ebe5 Merge branch 'macos-popup-shadows' into 'main'
macos: Take shadows into account when positioning popups

See merge request GNOME/gtk!7266
2024-05-22 13:15:34 +00:00
Mat
ed8255993f gdkmacossurface: Set surface before accessing it
Silences the following critial:
_gdk_macos_surface_update_fullscreen_state: assertion
'GDK_IS_MACOS_SURFACE (self)' failed
2024-05-19 23:58:35 +03:00
Mat
e1431f31c1 macos: Take shadows into account when positioning popups
Otherwise popups will be misaligned. This becomes noticeable when larger
shadows are used, like in libadwaita.

Regression in 08216dcee9
2024-05-19 23:35:18 +03:00
Benjamin Otte
b3c6a98132 vulkan: Add a missing extension
We need to enable this one, too.

Thanks validation layers!
2024-05-16 02:24:17 +02:00
Dr. David Alan Gilbert
14f1a91bff gdk: Remove unused struct 'XPointerUngrabInfo'
'XPointerUngrabInfo' appears unused since
commit 26cbf87d7d ("New approach for grab tracking code")
Remove it.

Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
2024-05-12 01:06:31 +01:00
Matthias Clasen
c61d8bc188 wayland: Tweak cursor sizing code
We want to take advantage of a viewporter also for named cursors.
2024-05-10 23:10:50 -04:00
Benjamin Otte
4814c5f653 array: Don't overflow array size
Copy what gcc's libstdc++ does for vectors to avoid overflows:

1. Define a max size macro and assert against it
   Note that we don't assert but actually check, because this needs
   to abort even if assertions are disabled.
2. Don't do fancy math to compute new capacity.
   Just size *= 2 instead and be careful about overflow.
2024-05-10 21:22:03 -04:00
Benjamin Otte
bc17dfa83d dmabuf: Ref previous context
In case the context's only reference was held by being the current
context, setting the new context would free it.

Resetting it later would then be a use-after-free.

Fixes #6694
2024-05-07 00:34:47 +02:00
Doğukan Korkmaztürk
7c3de4a2da vulkan: Recreate swapchain when it is necessary or beneficial
Currently, GTK does not check the result of vkAcquireNextImageKHR() and
assumes that it always succeeds. As a result, the vkQueuePresentKHR() is
unconditionally set to wait for the semaphore passed to
vkAcquireNextImageKHR() earlier.

However, if vkAcquireNextImageKHR() fails for some reason, the semaphore
passed to it does not get signalled. This causes the presentation
command to wait for the semaphore to be signalled indefinitely, which
causes GTK to hang.

This change adds error handling around vkAcquireNextImageKHR() to make
GTK recreate the Vulkan swapchain when it is necessary or beneficial and
helps avoiding situations that could cause indefinite waits.
2024-05-04 22:14:33 -04:00
Matthias Clasen
f579b171a9 Merge branch 'gbsneto/more-win32-cleanups' into 'main'
Various cleanups around Win32

See merge request GNOME/gtk!7223
2024-05-03 17:27:05 +00:00
Georges Basile Stavracas Neto
7d2ad604d2 win32/vulkancontext: Remove unused variable
Silences a compiler warning.
2024-05-03 09:52:57 -03:00
Georges Basile Stavracas Neto
45e64b915c win32/wgl: Initialize hwnd to NULL
Otherwise there's a valid code path that may return it uninitialized.
2024-05-03 09:51:46 -03:00
Georges Basile Stavracas Neto
ebaef9f18b win32/cursor: Ignore GdkPixbuf deprecation warning
Seems harmless to ignore this for now, other bits of code also ignore
this.
2024-05-03 09:49:46 -03:00
Robert Ancell
c73fe8ac4a glcontext: Remove duplicate check for GL version 2024-05-03 16:40:01 +12:00
Matthias Clasen
6f42f8ef2c Revert "gdk/frameclock: add mark when we discover frames may drop"
This reverts commit 84a304e66e.

This produces marks that are confusing to me. They don't correlate
with actual gaps in the frame cycle and often overlap with regular
'window presented' marks. Also, the function we are emitting these
marks from is called from the get_frame_time getter, and we
definitely don't want to emit marks from there.
2024-05-01 08:03:16 -04:00
Matthias Clasen
1bbca0cd25 vulkan: Don't forget to update the cache size
In order for the size change check to make sense, vk_pipeline_cache_size
needs to correspond to the size of the cache we last wrote to disk.

We were forgetting to update it after saving the cache, so the
check was ineffective.
2024-04-30 08:28:39 -04:00
Matthias Clasen
83784c17a3 vulkan: Improve logging around caches
Add some more logging around the pipeline cache.
2024-04-30 08:28:39 -04:00
Matthias Clasen
119a07e055 vulkan: Add a profiler mark for pipeline cache save
This is a rare event, and the file isn't small, so show it in profiles.
2024-04-30 07:36:42 -04:00
Matthias Clasen
6022fbcdf8 vulkan: Add profiling to Vulkan initialization
This helps understanding where our startup time is spent.
2024-04-29 18:28:03 -04:00
Matthias Clasen
744016e768 Merge branch 'matthiasc/for-main' into 'main'
gsk: Drop statistics from GSK_DEBUG=renderer

See merge request GNOME/gtk!7203
2024-04-29 18:30:59 +00:00
Matthias Clasen
e540022869 x11: Implement a missing method
Vulkan on X11 was getting spew for missing an empty_frame
implementation.
2024-04-29 12:12:22 -04:00
Benjamin Otte
e6700405c9 dmabuf: Use narrow range instead of full range
It's way more common, and Mutter uses it, too.

Avoid visual glitches when going in/out of offload.

Fixes #6672
2024-04-29 14:30:56 +02:00
Matthias Clasen
08d1353cde loaders: Make it possible to load png options
We want to store some metadata in our symbolic pngs, so make it
possible to get options when loading a png, along with the texture.

Update all callers.
2024-04-28 23:42:02 -04:00
Benjamin Otte
c20e7a0c5d glcontext: Split dmabuf import codepaths
Use different codepaths for known formats vs unknown formats.

Be more careful with unknown formats and always import them as
GL_TEXTURE_EXTERNAL_OES when possible (GL can't do EXTERNAL) to avoid
problems.

This is a more defensive approach towards older drivers that don't
support modifiers.

This fixes importing YUV textures on AMD Gen8.

Another approach would be to check for YUV and never try
GL_TEXTURE_2D with them, but I decided to go this way first.

Fixes #6668
2024-04-28 13:51:42 +02:00
Matthias Clasen
b98c86fb7b wayland: Break out dmabuf feedback code
This will need to be used in surfaces as well, in the future.
Prepare for that by moving this code into its own file and struct.
2024-04-27 11:47:26 -04:00
Matthias Clasen
2711cb8dcd Merge branch 'wip/xdg-activation-token' into 'main'
Improve xdg-activation-token handling for non-dbus activation

See merge request GNOME/gtk!7118
2024-04-26 18:32:08 +00:00
Matthias Clasen
3fc9de7539 offload: Make logging more compact
Use a format of

[XXX] SYMBOL DETAILS

where SYMBOL indicates the offloading status:
 🗙 - no offload
 ▲ - offload above, with background
 △ - offload above, no background
 ▼ - offload below, with background
 ▽ - offload below, no background
2024-04-24 22:01:56 -04:00
Matthias Clasen
492940205e Merge branch 'amolenaar/macos-fix-nsapp-shortcuts' into 'main'
macos: fix in-app native shortcuts (regression)

See merge request GNOME/gtk!7178
2024-04-25 01:35:59 +00:00
Arjan Molenaar
985e4906c8 macos: Add some docs for the different NSEvent getters 2024-04-24 23:49:37 +02:00
Chun-wei Fan
54a86a2a7e Win32 GL: Also force not to use depth/stencil/accum bits on legacy contexts
For completeness' sake, also specifiy in the PIXELFORMATDESCRIPTOR to use no
depth, stencil and accum bits to initializing WGL when we can't (yet) use
wglChoosePixelFormatARB(), as we must always fist have a base legacy WGL
context using ChoosePixelFormat() before we can use that to use
wglChoosePixelFormatARB(), or if wglChoosePixelFormatARB() is somehow not
available for us.

Some drivers, however, enforces enabling depth buffers, so if we can't
acquire a pixel format that disables depth buffers, retry acquiring one
with that, which sadly is not optimal but we must make do.

Attempts to complete fix for issue #6401.
2024-04-24 16:23:17 +08:00
Matthias Clasen
a2854af325 macos: Respect the default-settings debug key
This makes our behavior more consistent across platforms.
The suggestion came up in discussion in #6545.
2024-04-23 07:52:25 -04:00
Arjan Molenaar
f004f14b89 macos: fix in-app native shortcuts (again)
Popping an event of the queue in the IMContext handler
prevents it from being forwarded to the NSApp, in case the
(key) event was not handled by IMContext.

So I reverted to a mix of the original (4.13) and new (4.14.1) behavior
for fetching events: NSEvent lookup for IMContext uses loose matching,
so it can work with rewritten events. When sending events to NSApp, only
we're checking for an exact match.

Now in-app keyboard shortcuts (e.g. Ctrl-F2) work from within text
fields again.
2024-04-23 08:57:09 +02:00
Matthias Clasen
2e0f411de9 Merge branch 'amolenaar/macos-fix-delayed-rendering' into 'main'
macos: Avoid repeatedly sending events back to macOS

See merge request GNOME/gtk!7158
2024-04-22 16:25:57 +00:00
Matthias Clasen
9f358ac655 Merge branch 'matthiasc/for-main' into 'main'
roaring: Fix some ubsan warnings

See merge request GNOME/gtk!7165
2024-04-22 15:52:04 +00:00
Sebastian Wick
6b2b6ceb74 gdk: Consider XDG_ACTIVATION_TOKEN for the startup notification id
We prefer it over the old DESKTOP_STARTUP_ID environment variable if we
have it and it is valid.

We have to stash and unset XDG_ACTIVATION_TOKEN in addition to
DESKTOP_STARTUP_ID now as well. This makes sure that we don't call any
library functions which might rely on some environment variables. This
way unsetting the environment variables is safe and we can then
afterwards validate and print warnings.
2024-04-22 17:13:21 +02:00