We maintain offsets for popups, so we can translate
coordinates between surfaces that are attached directly
or indirectly to the same toplevel. Add an api for that.
This api is meant to mimic xdg-popover.grab - we
show the surface, and dismiss it when we get events
on other surfaces. For foreign surfaces, the compositor
handles that for us; for our own, we check outselves
before delivering events to GTK.
We don't need the complicated wrapper system anymore,
since client-side windows are gone. This commit moves
all the vfuncs to GtkSurfaceClass, and changes the
backends to just derive their surface implementation
from GdkSurface.
We want to use a gdk_surface_new_popup for popups,
and align the constructor names with the surface
types, so rename
gdk_surface_new_popup -> gdk_surface_new_temp
gdk_surface_new_popup_full -> gdk_surface_new_popup
The temp surface type will disappear eventually.
We are not creating such surfaces anymore, and
they were only ever meaningfully implemented
on X11. Drop the concept, and the api for determining
if a surface is input-only.
We still need to keep the vfunc around, since the
fallback implementation of gdk_display_get_monitor_at_surface
uses it. So, a GDK backend must either have root coordinates
or always return a monitor from monitor_at_surface.
We still need to keep the vfunc around, since the
fallback implementation for move_to_rect uses it.
So, a GDK backend must either have root coordinates
or implement move_to_rect.
Start by adding a constructor. We have to call it
gdk_surface_new_popup_full for now, since gdk_surface_new_popup
is taken. This may be reshuffled later.
The skip-taskbar, skip-pager and urgency hints were
only ever implemented for X11, and are not very useful
with modern desktops. Relegate the functionality to
x11 backend api, and drop the GtkWindow api.
I've come to the conclusion that we should keep
this state, since not all backends support per-edge
information. Updated the docs to explain how the
tiled state relates to the per-edge states.
This is a very old X session management thing, and you
will be hard-pressed to find a session manager that can
make use of it, and even harder-pressed to find apps
using it to their advantage.
Change the all the begin_drag and begin_move apis in
GdkSurface and GtkWindow to expect surface coordinates.
Update the x11 implementation to translate to root
coordinates where it matters. Wayland is ignoring the
coordinates anyway.
Change gdk_surface_get/set_user_data to private
API and rename them to get/set_widget.
Also remove an unused associated function.
The last two places where the surface API is used
are in gtkroot.c and gtkwidget.c. Make them
use the private api.
In particular, this patch removes:
gdk_surface_get_events()
gdk_surface_set_events()
gdk_surface_get_device_events()
gdk_surface_set_device_events()
Event masks so far still exist for grabs.
This is the API used by GtkMenu to properly position menus on the screen
without requiring GTK to query the menu window's position or the work
area of where the window is positioned. It makes it possible to position
popup windows properly when using Wayland.
Make this API available to external users so custom popup windows can be
positioned properly as well.
Related: https://gitlab.gnome.org/GNOME/gtk/issues/997
As they require a draw context and the draw context is already bound to
the surface, it makes much more sense and reduces abiguity by moving
these APIs to the draw context.
As a side effect, we simplify GdkSurface APIs to a point where
GdkSurface now does not concern itself with drawing anymore at all,
apart from being the object that creates draw contexts.
This does nothing but disallow passing NULL to gdk_surface_begin_paint()
and instead require this context.
The ultimate goal is to split out Cairo drawing into its own source file
so it doesn't clutter up the generic rendering path.
Instead of calling gdk_surface_invalidate_region(), just
gdk_surface_queue_expose() and rely on the renderer computing the diff
from the previous rendering.
If you want transparent region, you can just render them transparent.
If you want input shaping, use gdk_surface_input_shape_combine_region().
Also remove gtk_widget_shape_combine_region().