Commit Graph

10980 Commits

Author SHA1 Message Date
Benjamin Otte
3d3d22e844 wayland: Remove unused variable
Also, Wayland has get_version() functions, so if we ever need it, we can
use that.
2023-04-01 02:22:21 +02:00
Benjamin Otte
ae2c28af89 wayland: Check correct interface
buffer scale is a surface property, so check the version of the surface
interface, not the compositor one.
2023-04-01 02:22:21 +02:00
Benjamin Otte
c7499a33fd wayland: Use wl_compositor_get_version()
Wayland has functions to check versions, so use those.
2023-04-01 02:22:21 +02:00
Benjamin Otte
c97b489316 wayland: Use proper macro
Wayland has macros to check required versions. Use those instead of
custom ones.
2023-04-01 02:22:21 +02:00
Matthias Clasen
a1c5a806b3 Convert headers to #pragma once
The conversion was done by guard2one.
2023-03-31 15:11:10 -04:00
Georges Basile Stavracas Neto
6e80c8b07e gdk/vulkancontext: Accept Khronos validation layers
The Lunarg validation layers seem to have been deprecated in favour
of the Khronos ones. There's no reason not to have both, to accept
loading both - simultaneously, even.
2023-03-30 17:13:35 -03:00
Georges Basile Stavracas Neto
c0449e3245 gdk/vulkancontext: Pass all painted rects
Instead of passing a single, potentially massive rectangle that is
just the extents of the damage rect, collect and pass all damage
rects individually.
2023-03-30 17:13:35 -03:00
Georges Basile Stavracas Neto
8217b6e484 gdk/wayland/surface: Track and apply buffer scale
Add a new flag to track whether buffer scale is dirty or not,
and centralize calling wl_surface_set_buffer_scale() in a single
place: gdk_wayland_surface_sync_buffer_scale().

gdk_wayland_surface_sync_buffer_scale() is only called by
gdk_wayland_surface_sync(), which itself is called by the GL,
Vulkan, and Cairo contexts, right before submitting a frame.
This ensure that each frame has an up-to-date buffer scale.

This mimics how opaque and input regions are tracked.
2023-03-30 16:32:50 -03:00
Matthias Clasen
65dc4cac86 wayland: Fix corner cases in positioning
We were not handling some cases correctly.
This was making the dropdown in the gtk-demo
image-scaling demo appear in the top left
corner.
2023-03-28 20:37:54 -04:00
Matthias Clasen
ea572227f0 Merge branch 'wayland-popup-anchor' into 'main'
wayland: Comply with protocol requirements

See merge request GNOME/gtk!5723
2023-03-28 15:36:34 +00:00
Matthias Clasen
a8d8724a02 gdk: Avoid a pointless indirection
Don't use g_fprintf if GLib is using system printf
anyway.
2023-03-27 21:56:41 -04:00
Matthias Clasen
321877e94b gdk: Improve logging for backends
Log more when trying backends.
2023-03-27 21:42:10 -04:00
Matthias Clasen
68d629f84d Merge branch 'bilelmoussaoui/gi-docs' into 'main'
docs: Fix various broken links

See merge request GNOME/gtk!5734
2023-03-27 19:53:33 +00:00
Bilal Elmoussaoui
d1c43b94ef docs: Fix various broken links 2023-03-27 21:29:08 +02:00
Jonas Ådahl
c88f2caa04 wayland/popup: Handle late received reposition feedback
If we map, reposition, unmap, remap, the reposition feedback from the
last time a popup was mapped might be received while we're dealing with
the new version of the popup. At this point, the old reposition token
has no meating, so lets drop it. Also reset the reposition tokens when
creating new protocol objects, so that the reposition token are as if
we're in the initial state.

This fixes an issue where we'd get stuck if repeatedly smashing a button
that'd create popups that'd immediately get dismissed by the compositor.
2023-03-27 21:27:44 +02:00
Emmanuele Bassi
506206e1bd Merge branch 'ebassi/compute-size-annotation' into 'main'
Remove wrong annotation for GdkToplevel::compute-size

See merge request GNOME/gtk!5725
2023-03-27 11:43:34 +00:00
Ludovico de Nittis
d2672db648 wayland: Try to open the display even if XDG_RUNTIME_DIR is unset
Since Wayland 1.15, it is now possible to use absolute paths in
"WAYLAND_DISPLAY".
In that scenario, having a valid "XDG_RUNTIME_DIR" is not a requirement
anymore.

For this reason we remove the "XDG_RUNTIME_DIR" check and we let
`wl_display_connect()` decide if our environment is correct.

Signed-off-by: Ludovico de Nittis <ludovico.denittis@collabora.com>
2023-03-27 11:53:57 +02:00
Emmanuele Bassi
8dddddfe8c Remove wrong annotation from GdkDragSurface::compute-size
Just like GdkToplevel::compute-size, the size argument of the signal is
given to the handlers by GDK; it's not an out argument meant to be
allocated by the caller.
2023-03-26 15:50:22 +01:00
Emmanuele Bassi
a08c31e71f Remove wrong annotation for GdkToplevel::compute-size
The size argument is passed to the signal by the GDK surface machinery,
as is: it's not going to be allocated by the caller (since it's a
signal), and it's not an out argument.
2023-03-26 15:48:44 +01:00
Matthias Clasen
3a5282abe1 wayland: Don't crash without xdg_activation_v1
If the compositor does not support this protocol,
we can't use it.

Fixes: #5701
2023-03-26 10:11:14 -04:00
Matthias Clasen
b81f9d3f94 wayland: Comply with protocol requirements
If you send a bad anchor rect to mutter, it crashes.
Thats not great, so lets not do that.
2023-03-26 09:47:46 -04:00
Matthias Clasen
a70b85ef76 Merge branch 'wayland-cursor-size' into 'main'
wayland: Don't crash on cursor size 0

Closes #5700

See merge request GNOME/gtk!5721
2023-03-26 01:01:04 +00:00
Matthias Clasen
7adbbe6f35 wayland: Don't crash on cursor size 0
The cursor-theme-size setting is documented as
'0 means the default size'. Make it so by using
size 24 if we see a 0. Its better than crashing.

Fixes: #5700
2023-03-25 20:25:51 -04:00
Matthias Clasen
0efd6cd23e docs: Add another cross reference
Refer to the new coordinate system overview
from the GdkEvent docs.
2023-03-25 15:06:19 -04:00
Matthias Clasen
c51387d62b Merge branch 'matthiasc/for-main' into 'main'
Fix up criticals from GdkGLTexture

See merge request GNOME/gtk!5712
2023-03-24 15:53:55 +00:00
Matthias Clasen
5c558c0091 Fix up criticals from GdkGLTexture
I broke this in 4291f27b56.
I overlooked that there may not be a current context.
2023-03-24 11:29:38 -04:00
Chun-wei Fan
627ee674e5 GDK-Win32: Add wrapper functions for calling core wgl* functions
We might be dealing with GL contexts from different threads, which have more
gotchas when we are using libepoxy, so in case the function pointers for
these are invalidated by wglMakeCurrent() calls outside of GTK/GDK, such as
in GstGL, we want to use these functions that are directly linked to
opengl32.dll provided by the system/ICD, by linking to opengl32.lib.

This will ensure that we will indeed call the "correct" wgl* functions that
we need.

This should help fix issue #5685.
2023-03-24 18:43:23 +08:00
Matthias Clasen
7cb7e0ab35 gl: Add a private way to query mipmap status
Make GdkGLTexture determine if the texture has
a mipmap, and provide private API to query this
information.

This check is done in gdkgltexture.c instead of
gskgldriver.c, since we're already binding the
texture here for other reasons, so it is easy
to query a few more things.
2023-03-23 23:16:54 -04:00
Matthias Clasen
4291f27b56 gltexture: Try harder to determine the format
We can query these things as long as the texture ID
is valid in the current context.
2023-03-23 22:56:06 -04:00
Matthias Clasen
75f9379cd5 Merge branch 'alatiera/fedora-bump' into 'main'
ci: Use Fedora 38 as the base

See merge request GNOME/gtk!5688
2023-03-20 14:39:15 +00:00
Jordan Petridis
f9b2d3104a vulkan: Update error codes enum 2023-03-20 16:16:30 +02:00
Bilal Elmoussaoui
aa0cd3a553 g-i: Add since annotation to GdkSurfaceSize 2023-03-20 08:14:25 +00:00
Matthias Clasen
88dd6e630e broadway: Don't cause traffic when disconnecting
The recently added transient-for support was causing
roundtrips when a client with transients disconnects,
leading to assertion failures. Avoid that.
2023-03-17 11:00:35 -04:00
Benjamin Otte
ef3c515cf1 rowstrides are gsize, not int
gdk-pixbuf got that wrong, don't repeat that mistake.
2023-03-16 21:40:02 +01:00
Benjamin Otte
707c63c6f9 win32: Fix rowstride math 2023-03-16 21:40:02 +01:00
Ivan Molodetskikh
54e36f6b73 wayland: Reset pending offset in GL path
Otherwise GL surfaces that redraw without changing the hotspot have it
applied on top every frame and quickly slide away.

The cairo path and the X11 backend do not have this bug.
2023-03-15 16:11:40 -07:00
Matthias Clasen
c2965aed35 Merge branch 'dragsurface-resize' into 'main'
Fix drag surfaces ignoring size updates on Wayland and X11

See merge request GNOME/gtk!5597
2023-03-15 02:59:19 +00:00
Ivan Molodetskikh
11d9bbfd6e x11/surface: Get current drag surface size with compute-size signal
Query and update size of drag surfaces, similarly to how it's done for
the Wayland backend in the previous commit.
2023-03-14 19:41:44 -07:00
Ivan Molodetskikh
f63fc91b0e wayland/dragsurface: Get current size with compute-size signal
GdkDragSurface-backed widgets are not parented to an existing widget,
unlike popovers, and like toplevels. This means that there's nobody to
actively call gdk_drag_surface_present() to update the size, and
GdkDragSurface should do it on its own, just like GdkToplevel.

This commit implements this for the Wayland backend.
2023-03-14 19:41:44 -07:00
Ivan Molodetskikh
c3dde05d33 dragsurface: Add compute-size signal
Similarly to GdkToplevel, GdkDragSurface's compute-size should be called
by backends to query the current surface size, and should be connected
to by widget implementations (like GtkDragIcon) to report the current
size.

GdkDragSurface-backed widgets are not parented to an existing widget,
unlike popovers, and like toplevels. This means that there's nobody to
actively call gdk_drag_surface_present() to update the size, and
GdkDragSurface should do it on its own, just like GdkToplevel.
2023-03-14 19:41:44 -07:00
Matthias Clasen
45434d501c Add GdkDragSurfaceSize
This helper type will be used in the next commit for a new compute-size
request on GdkDragSurface. It is analogous in spirit to GdkToplevelSize.
2023-03-14 19:41:44 -07:00
Matthias Clasen
b74d483f01 Merge branch 'matthiasc/for-main' into 'main'
gl: Print max texture size in debug output

See merge request GNOME/gtk!5654
2023-03-15 02:32:37 +00:00
Matthias Clasen
9a2cc79286 gl: Print max texture size in debug output
This is useful information.
2023-03-14 22:13:37 -04:00
Matthias Clasen
98ff6c0d4d gdk: Stop using g_slice 2023-03-14 14:56:42 -04:00
Matthias Clasen
15d73a1adb macos: Stop using g_slice 2023-03-14 14:56:42 -04:00
Matthias Clasen
6f93baf420 win32: Stop using g_slice 2023-03-14 14:56:42 -04:00
Matthias Clasen
5cca7488d4 x11: Stop using g_slice 2023-03-14 14:56:42 -04:00
Matthias Clasen
93edb08094 Start 4.12 development 2023-03-14 11:16:30 -04:00
Bilal Elmoussaoui
23408f6dbf GLTexture: Add GL_RGB format support 2023-03-13 13:59:17 +00:00
Jonas Ådahl
f2a0a8b8be x11/surface: Clear compute_size idle source also when destroying
Doing it on hide() is not enough, since in some edge cases we didn't
ever actually map, we just attempted to compute the size, e.g. in
response to a ConfigureNotify event, then the window was destroyed.

Related: https://gitlab.gnome.org/GNOME/mutter/-/issues/2678
2023-03-10 23:34:50 +01:00