That way, it doesn't ned a specific init function.
Also chain up last, so that the generic initialization code can access a
fully initialized wayland surface.
[30/1038] Compiling C object gdk/win32/libgdk-win32.a.p/gdkmain-win32.c.obj
../gdk/win32/gdkmain-win32.c:146:1: warning: 'gdk_win32_finalize_ole' defined but not used [-Wunused-function]
146 | gdk_win32_finalize_ole (void)
| ^~~~~~~~~~~~~~~~~~~~~~
../gdk/win32/gdkmain-win32.c:113:1: warning: 'gdk_win32_finalize_com' defined but not used [-Wunused-function]
113 | gdk_win32_finalize_com (void)
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
A number of warnings are produced:
[23/1038] Compiling C object gdk/win32/libgdk-win32.a.p/gdkinput-dmanipulation.c.obj
../gdk/win32/gdkinput-dmanipulation.c: In function 'reset_viewport':
../gdk/win32/gdkinput-dmanipulation.c:354:11: warning: variable 'hr' set but not used [-Wunused-but-set-variable]
354 | HRESULT hr;
| ^~
Try to do something sensible instead.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
../gdk/win32/gdkclipdrop-win32.c: In function 'transmute_cf_shell_id_list_to_text_uri_list':
C:/msys64/ucrt64/include/glib-2.0/glib/gstring.h:72:5: warning: ignoring return value of 'g_string_free_and_steal' declared with attribute 'warn_unused_result' [-Wunused-result]
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
In file included from ../gdk/win32/gdkdrag-win32.c:201:
../gdk/win32/gdkprivate-win32.h:45: warning: "GDK_NOTE" redefined
45 | #define GDK_NOTE(type,action) \
|
../gdk/win32/gdkdrag-win32.c:40: note: this is the location of the previous definition
40 | #define GDK_NOTE(a,b)
Fixes: bc159207bd ("gdk: Drop old debug macros")
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
GLES 2.0 version is fine now with current gtk according to B. Otte.
Let's use the same minimum requirement for all implementations.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
When using GDK_DEBUG=gl-egl, we end up using GL, but that is not well supported:
Creating EGL context version 3.0 (debug:no, forward:no, legacy:yes, es:no)
Created EGL context[0000000000000004]
OpenGL version: 0.0 (legacy)
* GLSL version: (NULL)
* Max texture size: -1059701680
* Extensions checked:
- GL_KHR_debug: no
- GL_EXT_unpack_subimage: yes
- OES_vertex_half_float: no
** (gtk4-demo.exe:14324): WARNING **: 19:16:41.468: Compile failure in
vertex shader:
ERROR: 0:7: 'gl_Position' : undeclared identifier
---8<---
Use GLES when EGL implementation is ANGLE.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
X11 does add an extra reference to surfaces that gets released when the
DestroyNotify event arrives.
Wayland doesn't ave such an event, so that reference never gets
released.
This fixes a copy/paste error introduced in commit 590f3dfa1f.
We want to remove the event queue from the list of event queues, not the
surface.
Otherwise the freed queue stays in the list and the next time an event
comes in, we access invalid memory.
Fixes thinko introduced in commit 7fafa5133b.
Luckily, we leak all surfaces, so this problem never occured.
Check if the driver supports MAILBOX and prefer using it; in its
absense, checkif the driver supports IMMEDIATE and prefer using
it; finally, if neither of them are supported, use the guaranteed
to be supported FIFO mode.
We want to keep the wl_surface around, because surfaces create their
resources on construct and keep them until destroyed. See the HWND ond
Windows and the XWindow on X11.
This is relevant for graphics resources, where we want to have access
to the VkSurface and eglSurface while the GdkSurface is hidden.
We also want these surfaces to be permanent and not change during the
lifetime of the GdkSurface.
What we can - and must - destroy however are the xdg surfaces, because
those handle visibility on screen.
And we also need to ensure no buffer is attached, so that during the
next creation of the xdg surface we don't get a protocol error.
gdk_wayland_surface_maybe_resize() just calls
gdk_wayland_surface_update_size(), so make all callers call that one
instead.
The check that it does is done by the other function again.
This workaround - were it ever to trigger - is broken today. It destroys
the wl_surface and all associated structs but does not recreate the
xdg_popup or xdg_toplevel struct, so it would cause a hidden window.
The workaround looked a lot different when it was introduced in commit
83b54bab57, too - both in what it did and
in what the vfuncs did that it called.
Basically what GL does, but without any debug or feature flag
to gatekeep it, since the Vulkan backend itself is experimental
already.
Ceil surface sizes, and floor coordinates, to the fractional scale
value.
Fractional scaling with the GL renderer is
experimental for now, so we disable it unless
GDK_DEBUG=gl-fractional is set.
This will give us time to work out the kinks.
This commit combines changes in the Wayland backend,
the GL context frontend, and the GL renderer to switch
them all to use the fractional scale.
In the Wayland backend, we now use the fractional scale
to size the EGL window.
In the GL frontend code, we use the fractional scale to
scale the damage region and surface in begin/end_frame.
And in the GL renderer, we replace gdk_surface_get_scale_factor()
with gdk_surface_get_scale().
Cairo can do that, so just enable it:
* Create surfaces with the correct fractionally scaled size.
* Set the Cairo surface's device scale to that number.
Instead of setting the buffer scale via the buffer-scale command, set it
via the viewport.
This technically allows setting fractional scales, but we're not doing
that.
April fools!
No, really.
The fractional scale protocol is just a way to track the surface scale,
but not a way to draw fractional content.
This commit uses it for that, so tht we don't rely on tracking outputs.
This also allows magnifiers etc to send us a larger (integer) scale if
they would like that, that is not represented by the outputs.
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.
Instead of passing a single, potentially massive rectangle that is
just the extents of the damage rect, collect and pass all damage
rects individually.
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.
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.
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>
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.
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.
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
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.
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.
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.
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.
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.
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
In certain scenarios, address the issue where gnome.compile_resources
fails to transmit the present source directory. This is most notably
visible with MSBuild.
The split-up of gdksurface-wayland.c introduced a protocol violation
when it didn't make sure xdg_surface was destroyed after the role
objects (xdg_popup / xdg_toplevel). Fix that.
Fixes: 2a463baed0 ("wayland: Rearrange the surface code")
The availability of wl_surface.offset depends on the compositor, so we
can't call it unconditionally. Add a version check to so we only call
offset if we know we won't raise a protocol error.
Fixes: 0eb791eaaa ("Make mask nodes more versatile")
The API docs outline why quite well.
This should make it possible to do saving of textures to image files
without any private API with the same featureset that GTK uses.
Also remove the gsktextureprivate.h include where
gdk_texture_get_format() was the only reason for it.
We no longer need to make much distinction between multiple logical
devices, plus it breaks esp. with the Xwayland input device distribution.
Just iterate across all devices and reset their scroll valuators.
Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/4160
This is a bit spaghetti right now, since seats and devices were
heavily entangled there are a number of crossed private API calls that
should ideally not be there.
Let this be a first step, so more bits may move from the seat
implementation to devices.
This file, event though a clump of input-y objects, has more of
seats than anything else. Rename it so that we can start splitting
these objects out of it.
This is currently just used as a convenience storage of the startup ID
between the GtkApplication and the GtkWindow (after it's ready to notify
on it).
This could be untangled in the GTK layers so there is no involvement
from GDK in keeping the startup ID around, in the mean time just deprecate
these gdk_wayland* API calls.
... and use this check in gdk_gl_context_make_current() and
gdk_gl_context_get_current() to make sure the context really is still
current.
The context no longer being current can happen when external GL
implementations make their own contexts current in the same threads GDK
contexts are used in.
And that can happen for example by WebKit.
Theoretically, this should also allow external EGL code to run in X11
applications when GDK chooses to use GLX, but I didn't try it.
Fixes#5392