![]() |
![]() |
![]() |
![]() |
The functions in this section are specific to the GDK Wayland backend.
To use them, you need to include the <gdk/gdkwayland.h>
header and use
the Wayland-specific pkg-config files to build your application (either
gdk-wayland-3.0
or gtk+-wayland-3.0
).
To make your code compile with other GDK backends, guard backend-specific
calls by an ifdef as follows. Since GDK may be built with multiple
backends, you should also check for the backend that is in use (e.g. by
using the GDK_IS_WAYLAND_DISPLAY()
macro).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
#ifdef GDK_WINDOWING_WAYLAND if (GDK_IS_WAYLAND_DISPLAY (display)) { // make Wayland-specific calls here } else #endif #ifdef GDK_WINDOWING_X11 if (GDK_IS_X11_DISPLAY (display)) { // make X11-specific calls here } else #endif g_error ("Unsupported GDK backend"); |
struct wl_seat *
gdk_wayland_seat_get_wl_seat (GdkSeat *seat
);
Returns the Wayland wl_seat of a GdkSeat.
Since: 3.20
struct wl_keyboard *
gdk_wayland_device_get_wl_keyboard (GdkDevice *device
);
Returns the Wayland wl_keyboard of a GdkDevice.
Since: 3.10
struct wl_pointer *
gdk_wayland_device_get_wl_pointer (GdkDevice *device
);
Returns the Wayland wl_pointer of a GdkDevice.
Since: 3.10
struct wl_seat *
gdk_wayland_device_get_wl_seat (GdkDevice *device
);
Returns the Wayland wl_seat of a GdkDevice.
Since: 3.10
struct wl_compositor *
gdk_wayland_display_get_wl_compositor (GdkDisplay *display
);
Returns the Wayland global singleton compositor of a GdkDisplay.
Since: 3.8
struct wl_display *
gdk_wayland_display_get_wl_display (GdkDisplay *display
);
Returns the Wayland wl_display of a GdkDisplay.
Since: 3.8
gboolean gdk_wayland_display_query_registry (GdkDisplay *display
,const gchar *global
);
Returns TRUE
if the the interface was found in the display
wl_registry.global handler.
Since: 3.22.27
struct wl_surface *
gdk_wayland_window_get_wl_surface (GdkWindow *window
);
Returns the Wayland surface of a GdkWindow.
Since: 3.8
void
gdk_wayland_window_set_use_custom_surface
(GdkWindow *window
);
Marks a GdkWindow as a custom Wayland surface. The application is expected to register the surface as some type of surface using some Wayland interface.
A good example would be writing a panel or on-screen-keyboard as an out-of-process helper - as opposed to having those in the compositor process. In this case the underlying surface isn’t an xdg_shell surface and the panel or OSK client need to identify the wl_surface as a panel or OSK to the compositor. The assumption is that the compositor will expose a private interface to the special client that lets the client identify the wl_surface as a panel or such.
This function should be called before a GdkWindow is shown. This is best done by connecting to the “realize” signal:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
static void widget_realize_cb (GtkWidget *widget) { GdkWindow *window; struct wl_surface *surface; struct input_panel_surface *ip_surface; window = gtk_widget_get_window (widget); gdk_wayland_window_set_custom_surface (window); surface = gdk_wayland_window_get_wl_surface (window); ip_surface = input_panel_get_input_panel_surface (input_panel, surface); input_panel_surface_set_panel (ip_surface); } static void setup_window (GtkWindow *window) { g_signal_connect (window, "realize", G_CALLBACK (widget_realize_cb), NULL); } |
Since: 3.10
void (*GdkWaylandWindowExported) (GdkWindow *window
,const char *handle
,gpointer user_data
);
Callback that gets called when the handle for a window has been obtained from the Wayland compositor. The handle can be passed to other processes, for the purpose of marking windows as transient for out-of-process surfaces.
window |
the GdkWindow that is exported |
|
handle |
the handle |
|
user_data |
user data that was passed to |
Since: 3.22
gboolean gdk_wayland_window_export_handle (GdkWindow *window
,GdkWaylandWindowExported callback
,gpointer user_data
,GDestroyNotify destroy_func
);
Asynchronously obtains a handle for a surface that can be passed
to other processes. When the handle has been obtained, callback
will be called.
Up until 3.22.15 it was an error to call this function on a window that is
already exported. When the handle is no longer needed,
gdk_wayland_window_unexport_handle()
should be called to clean up resources.
Starting with 3.22.16, calling this function on an already exported window
will cause the callback to be invoked with the same handle as was already
invoked, from an idle callback. To unexport the window,
gdk_wayland_window_unexport_handle()
must be called the same number of times
as gdk_wayland_window_export_handle()
was called. Any 'exported' callback
may still be invoked until the window is unexported or destroyed.
The main purpose for obtaining a handle is to mark a surface
from another window as transient for this one, see
gdk_wayland_window_set_transient_for_exported()
.
Note that this API depends on an unstable Wayland protocol, and thus may require changes in the future.
window |
the GdkWindow to obtain a handle for |
|
callback |
callback to call with the handle |
|
user_data |
user data for |
|
destroy_func |
destroy notify for |
Since: 3.22
void
gdk_wayland_window_unexport_handle (GdkWindow *window
);
Destroys the handle that was obtained with
gdk_wayland_window_export_handle()
.
It is an error to call this function on a window that does not have a handle.
Note that this API depends on an unstable Wayland protocol, and thus may require changes in the future.
Since: 3.22
gboolean gdk_wayland_window_set_transient_for_exported (GdkWindow *window
,char *parent_handle_str
);
Marks window
as transient for the surface to which the given
parent_handle_str
refers. Typically, the handle will originate
from a gdk_wayland_window_export_handle()
call in another process.
Note that this API depends on an unstable Wayland protocol, and thus may require changes in the future.
window |
the GdkWindow to make as transient |
|
parent_handle_str |
an exported handle for a surface |
Since: 3.22