Remove a boatload of "or %NULL" from nullable parameters
and return values. gi-docgen generates suitable text from
the annotation that we don't need to duplicate.
This adds a few missing nullable annotations too.
Width and height of a GdkMonitor are derived via wl_output which
talks about physical dimensions of a device and compositors usually
implement this as the untransformed values (e.g. weston, wlroots).
Since the GTK client has no way to figure out if a monitor was rotated,
transform the physical dimensions according to the applied wayland
transform to have the physical dimensions match the logical ones.
Mutter flips the physical dimensions itself but doesn't announce the
transform so this shouldn't break anything there.
Rewrite this in a way that doesn't depend on kernel
header defines at the time the wayland scanner was run.
This was causing the build to break on Centos 8, where
a bunch of fourcc formats are missing.
When building for homebrew/linuxbrew on Ubuntu 16.04, memfd_create() is
not available and causes the build to fail.
This adds a proper check for the function.
When we don't get stettings from the portal, the current
fallback is 'awful fonts'. There is no need for that. Instead,
set the fallback values to grayscale antialiasing with slight
hinting.
... until all globals have been received.
The dependency tracking introduced in 4e9be39518 only allows to
specify required globals and processes the closures as soon as
the requirements have been met. There are, however, also optional
dependencies - most notably the primary_selection protocol.
Currently we rely on the fact that compositors like Mutter announce
it before `wl_seat`, even though the order is not specified in
the spec.
Process globals closures only after all globals have been announced,
so optional dependencies can be accommodated.
Closes https://gitlab.gnome.org/GNOME/gtk/-/issues/3791
This lets the NGL backend be selected instead of the Cairo backend on
devices which expose both GL and GLES, but have better support of GLES.
Tested on a PinePhone.
We were leaking buffers. This wasn't caught by valgrind and friends
because it was shared memory (with the compositor), but top(1) would
instantly see memory consumption of the app and the shell go through the
roof.
We were calling _gdk_surface_update_size() every frame, even if the
window size didn't change. This would cause us to discard all cached
buffers and redraw the whole screen.
This was BAD.
These events don't make sense on physical devices (for starters, they
are relative to the logical pointer position). Use this device for
those events, also happens to be what the upper parts expect of them.
Commit 97b5fad131 was a forward port from a gtk3 patch, but the hunk
was applied on the wrong bits of code.
Ensure the initialization paths also do mark settings read from the
portal as valid, so the checks for optional/newer settings actually have
the expected result. It is also desirable to mark settings as valid
after configuration changes (as that patch did effectively do), but not
enough to fix all situations.
Use the infrastructure already available to look up keys, instead.
This does the right thing and looks up the setting across all
sources.
Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/3680
The debug spew for printing out supported buffer
formats was missing a bunch, among them the fp16
formats that are interesting for HDR support.
Add them.
Note that we still only support ARGB8888. But
at least we can print out what don't support.
This adds a "release" destructor for the gtk_surface1 interface which
signals to the server that a surface has been destroyed on the client
side, which the current "destroy" does not do.
Ideally the protocol would have specified a destroy request marked as
destructor to handle this automatically, however this is no longer
possible due to the destroy method being implicitly generated in the
absence of an explicit request in the protocol. Adding a destroy request
marked as destructor now would generate a new destroy method that
unconditionally would send the request to the server, which would break
clients running on servers not supporting that request.
Commit e6209de962 added some checks on TranslationEntry.valid in
order to figure out whether using the new font settings or the
old g-s-d ones. However that's only set in the non-sandboxed case.
This makes sandboxed applications fallback to the old (and also
non-existing with modern g-s-d) settings, possibly resulting in
ugly defaults being picked.
Fix this by also marking TranslationEntry elements as valid when
using the settings portal, precisely those entries that we are able
to read and match with our own table.
When destroying a wl_surface (e.g. when a window or menu is closed), the
surface may continue to exist in the compositor slightly longer than on
the client side. In that case, the surface can still receive input
events, which need to be ignored gracefully.
In particular, this prevents segfaulting on wl_surface_get_user_data()
in that situation.
Reported in
https://gitlab.gnome.org/GNOME/gtk/-/issues/3296
The same issue for pointers/keyboards was reported in
https://bugzilla.gnome.org/show_bug.cgi?id=693338
and fixed with in
bfd7137ffb3625f17857a8fc099a72
In pointer_surface_update_scale(), only rescale the cursor surface when
the scale has actually changed and the cursor is on at least one output.
fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/3350
Right now, this issue is not completely understood, so it might also
involve some questionable handling of cursor surface by sway/wlroots.
However, irrespective of that issue, this patch avoids unnecessary calls to the
compositor, and there should be no drawback: Whenever the pointer enters
a new output, pointer_surface_update_scale() will be called again, such
that correct scaling of the cursor is still ensured.
There is a slight difference: When the cursor leaves the last output,
previously the image was reset to scale factor 1. Now, it keeps whatever
was last. That might be more sensible than the previous behaviour,
assuming that it's likely that when the cursor enter an output again, it
has the same scaling. Alternatively, if one cares about resource usage
at this level, it might make more sense to destroy the surface than
rescaling to 1.
Some GTK based applications such as Qemu UI create and manage
EGLSurfaces associated with the relevant GdkSurfaces. In order to create
an EGLSurface, there needs to be a way to pass the native window
object to eglCreateWindowSurface(). While running in an X environment,
the native window object can be obtained by calling
gdk_x11_surface_get_xid(). Likewise, the native window object can be
obtained by calling gdk_wayland_surface_get_wl_egl_window() while
running in a Wayland environment. Therefore, this API needs to be
exposed to apps.
Signed-off-by: Vivek Kasireddy <vivek.kasireddy@intel.com>
When being fullscreen, and wanting to unfullscreen but not caring about
whether to go unmaximized or maximized (as this information is lost), if
the GdkToplevelLayout represents the full intended state, we won't be
able to do the right thing.
To avoid this issue, make the GdkToplevelLayout API intend based, where
if one e.g. doesn't call gdk_toplevel_set_maximized() with anything, the
backend will not attempt to change the maximized state.
This means we can also remove the old 'initially_maximized' and
'initially_fullscreen' fields from the private GtkWindow struct, as we
only deal with intents now.
It was used by all surfaces to track 'is-mapped', but still part of the
GdkToplevelState, and is now replaced with a separate boolean in the
GdkSurface structure.
It also caused issues when a widget was unmapped, and due to that
unmapped a popover which hid its corresponding surface. When this
surface was hidden, it emitted a state change event, which would then go
back into GTK and queue a resize on popover widget, which would travel
back down to the widget that was originally unmapped, causing confusino
when doing future allocations.
To summarize, one should not hide widgets during allocation, and to
avoid this, make this new is-mapped boolean asynchronous when hiding a
surface, meaning the notification event for the changed mapped state
will be emitted in an idle callback. This avoids the above described
reentry issue.
We only called xdg_toplevel.(un)set_maximize() if the toplevel layout
changed, but this misses the case when the compositor had changed the
maximized state. Change it to call the xdg_toplevel request if either
the local layout changed, or if the layout differs from the current
state.
This fixes an issue where one couldn't unmaximize a window by double
clicking the titlebar that, had previously been maximized e.g. using a
keyboard binding.
Do the same for fullscreen.
If compute_size() returns TRUE, the layout will not be propagated to
GTK. This will be used by the X11 backend to queue asynchronous resizes
that shouldn't yet allocate in GTK.