wayland: Formatting fixes

This commit is contained in:
Matthias Clasen
2015-02-27 22:28:28 -05:00
parent a0eb0e2346
commit 94c5d691df
14 changed files with 324 additions and 321 deletions

View File

@ -32,15 +32,15 @@
static char * static char *
gdk_wayland_app_launch_context_get_startup_notify_id (GAppLaunchContext *context, gdk_wayland_app_launch_context_get_startup_notify_id (GAppLaunchContext *context,
GAppInfo *info, GAppInfo *info,
GList *files) GList *files)
{ {
return NULL; return NULL;
} }
static void static void
gdk_wayland_app_launch_context_launch_failed (GAppLaunchContext *context, gdk_wayland_app_launch_context_launch_failed (GAppLaunchContext *context,
const char *startup_notify_id) const char *startup_notify_id)
{ {
} }

View File

@ -19,7 +19,7 @@
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog * file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with * files for a list of changes. These files are distributed with
* GTK+ at ftp://ftp.gtk.org/pub/gtk/. * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/ */
#include "config.h" #include "config.h"
@ -83,7 +83,8 @@ _gdk_wayland_display_finalize_cursors (GdkWaylandDisplay *display)
} }
static gboolean static gboolean
set_cursor_from_theme (GdkWaylandCursor *cursor, struct wl_cursor_theme *theme) set_cursor_from_theme (GdkWaylandCursor *cursor,
struct wl_cursor_theme *theme)
{ {
struct wl_cursor *c; struct wl_cursor *c;

View File

@ -253,11 +253,7 @@ gdk_wayland_device_set_window_cursor (GdkDevice *device,
* the default cursor * the default cursor
*/ */
if (!cursor) if (!cursor)
{ cursor = _gdk_wayland_display_get_cursor_for_type (device->display, GDK_LEFT_PTR);
/* FIXME: Is this the best sensible default ? */
cursor = _gdk_wayland_display_get_cursor_for_type (device->display,
GDK_LEFT_PTR);
}
if (cursor == wd->cursor) if (cursor == wd->cursor)
return; return;
@ -282,8 +278,10 @@ gdk_wayland_device_warp (GdkDevice *device,
static void static void
get_coordinates (GdkWaylandDeviceData *data, get_coordinates (GdkWaylandDeviceData *data,
double *x, double *y, double *x,
double *x_root, double *y_root) double *y,
double *x_root,
double *y_root)
{ {
int root_x, root_y; int root_x, root_y;
@ -357,7 +355,6 @@ gdk_wayland_device_grab (GdkDevice *device,
else else
{ {
/* Device is a pointer */ /* Device is a pointer */
if (wayland_device->pointer_grab_window != NULL && if (wayland_device->pointer_grab_window != NULL &&
time_ != 0 && wayland_device->pointer_grab_time > time_) time_ != 0 && wayland_device->pointer_grab_time > time_)
{ {
@ -482,7 +479,7 @@ gdk_wayland_device_init (GdkWaylandDevice *device_core)
* gdk_wayland_device_get_wl_seat: * gdk_wayland_device_get_wl_seat:
* @device: (type GdkWaylandDevice): a #GdkDevice * @device: (type GdkWaylandDevice): a #GdkDevice
* *
* Returns the Wayland wl_seat of a #GdkDevice * Returns the Wayland wl_seat of a #GdkDevice.
* *
* Returns: (transfer none): a Wayland wl_seat * Returns: (transfer none): a Wayland wl_seat
* *
@ -491,7 +488,7 @@ gdk_wayland_device_init (GdkWaylandDevice *device_core)
struct wl_seat * struct wl_seat *
gdk_wayland_device_get_wl_seat (GdkDevice *device) gdk_wayland_device_get_wl_seat (GdkDevice *device)
{ {
g_return_val_if_fail(GDK_IS_WAYLAND_DEVICE (device), NULL); g_return_val_if_fail (GDK_IS_WAYLAND_DEVICE (device), NULL);
return GDK_WAYLAND_DEVICE (device)->device->wl_seat; return GDK_WAYLAND_DEVICE (device)->device->wl_seat;
} }
@ -500,7 +497,7 @@ gdk_wayland_device_get_wl_seat (GdkDevice *device)
* gdk_wayland_device_get_wl_pointer: * gdk_wayland_device_get_wl_pointer:
* @device: (type GdkWaylandDevice): a #GdkDevice * @device: (type GdkWaylandDevice): a #GdkDevice
* *
* Returns the Wayland wl_pointer of a #GdkDevice * Returns the Wayland wl_pointer of a #GdkDevice.
* *
* Returns: (transfer none): a Wayland wl_pointer * Returns: (transfer none): a Wayland wl_pointer
* *
@ -509,7 +506,7 @@ gdk_wayland_device_get_wl_seat (GdkDevice *device)
struct wl_pointer * struct wl_pointer *
gdk_wayland_device_get_wl_pointer (GdkDevice *device) gdk_wayland_device_get_wl_pointer (GdkDevice *device)
{ {
g_return_val_if_fail(GDK_IS_WAYLAND_DEVICE (device), NULL); g_return_val_if_fail (GDK_IS_WAYLAND_DEVICE (device), NULL);
return GDK_WAYLAND_DEVICE (device)->device->wl_pointer; return GDK_WAYLAND_DEVICE (device)->device->wl_pointer;
} }
@ -518,7 +515,7 @@ gdk_wayland_device_get_wl_pointer (GdkDevice *device)
* gdk_wayland_device_get_wl_keyboard: * gdk_wayland_device_get_wl_keyboard:
* @device: (type GdkWaylandDevice): a #GdkDevice * @device: (type GdkWaylandDevice): a #GdkDevice
* *
* Returns the Wayland wl_keyboard of a #GdkDevice * Returns the Wayland wl_keyboard of a #GdkDevice.
* *
* Returns: (transfer none): a Wayland wl_keyboard * Returns: (transfer none): a Wayland wl_keyboard
* *
@ -527,7 +524,7 @@ gdk_wayland_device_get_wl_pointer (GdkDevice *device)
struct wl_keyboard * struct wl_keyboard *
gdk_wayland_device_get_wl_keyboard (GdkDevice *device) gdk_wayland_device_get_wl_keyboard (GdkDevice *device)
{ {
g_return_val_if_fail(GDK_IS_WAYLAND_DEVICE (device), NULL); g_return_val_if_fail (GDK_IS_WAYLAND_DEVICE (device), NULL);
return GDK_WAYLAND_DEVICE (device)->device->wl_keyboard; return GDK_WAYLAND_DEVICE (device)->device->wl_keyboard;
} }
@ -735,6 +732,7 @@ pointer_handle_enter (void *data,
if (!surface) if (!surface)
return; return;
if (!GDK_IS_WINDOW (wl_surface_get_user_data (surface))) if (!GDK_IS_WINDOW (wl_surface_get_user_data (surface)))
return; return;
@ -781,13 +779,14 @@ pointer_handle_leave (void *data,
{ {
GdkWaylandDeviceData *device = data; GdkWaylandDeviceData *device = data;
GdkEvent *event; GdkEvent *event;
GdkWaylandDisplay *wayland_display = GdkWaylandDisplay *wayland_display = GDK_WAYLAND_DISPLAY (device->display);
GDK_WAYLAND_DISPLAY (device->display);
if (!surface) if (!surface)
return; return;
if (!GDK_IS_WINDOW (wl_surface_get_user_data (surface))) if (!GDK_IS_WINDOW (wl_surface_get_user_data (surface)))
return; return;
if (!device->pointer_focus) if (!device->pointer_focus)
return; return;
@ -818,7 +817,7 @@ pointer_handle_leave (void *data,
g_message ("leave, device %p surface %p", g_message ("leave, device %p surface %p",
device, device->pointer_focus)); device, device->pointer_focus));
g_object_unref(device->pointer_focus); g_object_unref (device->pointer_focus);
if (device->cursor) if (device->cursor)
gdk_wayland_device_stop_window_cursor_animation (device); gdk_wayland_device_stop_window_cursor_animation (device);
@ -881,25 +880,24 @@ pointer_handle_button (void *data,
GdkEvent *event; GdkEvent *event;
uint32_t modifier; uint32_t modifier;
int gdk_button; int gdk_button;
GdkWaylandDisplay *wayland_display =
GDK_WAYLAND_DISPLAY (device->display);
if (!device->pointer_focus) if (!device->pointer_focus)
return; return;
_gdk_wayland_display_update_serial (wayland_display, serial); _gdk_wayland_display_update_serial (display, serial);
switch (button) { switch (button)
case 273: {
gdk_button = 3; case 273:
break; gdk_button = 3;
case 274: break;
gdk_button = 2; case 274:
break; gdk_button = 2;
default: break;
gdk_button = button - 271; default:
break; gdk_button = button - 271;
} break;
}
device->time = time; device->time = time;
if (state) if (state)
@ -951,18 +949,19 @@ pointer_handle_axis (void *data,
return; return;
/* get the delta and convert it into the expected range */ /* get the delta and convert it into the expected range */
switch (axis) { switch (axis)
case WL_POINTER_AXIS_VERTICAL_SCROLL: {
delta_x = 0; case WL_POINTER_AXIS_VERTICAL_SCROLL:
delta_y = wl_fixed_to_double (value) / 10.0; delta_x = 0;
break; delta_y = wl_fixed_to_double (value) / 10.0;
case WL_POINTER_AXIS_HORIZONTAL_SCROLL: break;
delta_x = wl_fixed_to_double (value) / 10.0; case WL_POINTER_AXIS_HORIZONTAL_SCROLL:
delta_y = 0; delta_x = wl_fixed_to_double (value) / 10.0;
break; delta_y = 0;
default: break;
g_return_if_reached (); default:
} g_return_if_reached ();
}
device->time = time; device->time = time;
event = gdk_event_new (GDK_SCROLL); event = gdk_event_new (GDK_SCROLL);
@ -1014,18 +1013,18 @@ keyboard_handle_enter (void *data,
{ {
GdkWaylandDeviceData *device = data; GdkWaylandDeviceData *device = data;
GdkEvent *event; GdkEvent *event;
GdkWaylandDisplay *wayland_display = GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (device->display);
GDK_WAYLAND_DISPLAY (device->display);
if (!surface) if (!surface)
return; return;
if (!GDK_IS_WINDOW (wl_surface_get_user_data (surface))) if (!GDK_IS_WINDOW (wl_surface_get_user_data (surface)))
return; return;
_gdk_wayland_display_update_serial (wayland_display, serial); _gdk_wayland_display_update_serial (display, serial);
device->keyboard_focus = wl_surface_get_user_data(surface); device->keyboard_focus = wl_surface_get_user_data (surface);
g_object_ref(device->keyboard_focus); g_object_ref (device->keyboard_focus);
event = gdk_event_new (GDK_FOCUS_CHANGE); event = gdk_event_new (GDK_FOCUS_CHANGE);
event->focus_change.window = g_object_ref (device->keyboard_focus); event->focus_change.window = g_object_ref (device->keyboard_focus);
@ -1049,17 +1048,18 @@ keyboard_handle_leave (void *data,
{ {
GdkWaylandDeviceData *device = data; GdkWaylandDeviceData *device = data;
GdkEvent *event; GdkEvent *event;
GdkWaylandDisplay *wayland_display = GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (device->display);
GDK_WAYLAND_DISPLAY (device->display);
if (!surface) if (!surface)
return; return;
if (!GDK_IS_WINDOW (wl_surface_get_user_data (surface))) if (!GDK_IS_WINDOW (wl_surface_get_user_data (surface)))
return; return;
if (!device->keyboard_focus) if (!device->keyboard_focus)
return; return;
_gdk_wayland_display_update_serial (wayland_display, serial); _gdk_wayland_display_update_serial (display, serial);
event = gdk_event_new (GDK_FOCUS_CHANGE); event = gdk_event_new (GDK_FOCUS_CHANGE);
event->focus_change.window = g_object_ref (device->keyboard_focus); event->focus_change.window = g_object_ref (device->keyboard_focus);
@ -1068,7 +1068,7 @@ keyboard_handle_leave (void *data,
gdk_event_set_device (event, device->master_keyboard); gdk_event_set_device (event, device->master_keyboard);
gdk_event_set_source_device (event, device->keyboard); gdk_event_set_source_device (event, device->keyboard);
g_object_unref(device->keyboard_focus); g_object_unref (device->keyboard_focus);
device->keyboard_focus = NULL; device->keyboard_focus = NULL;
GDK_NOTE (EVENTS, GDK_NOTE (EVENTS,
@ -1078,8 +1078,7 @@ keyboard_handle_leave (void *data,
_gdk_wayland_display_deliver_event (device->display, event); _gdk_wayland_display_deliver_event (device->display, event);
} }
static gboolean static gboolean keyboard_repeat (gpointer data);
keyboard_repeat (gpointer data);
static void static void
translate_keyboard_string (GdkEventKey *event) translate_keyboard_string (GdkEventKey *event)
@ -1100,11 +1099,11 @@ translate_keyboard_string (GdkEventKey *event)
gsize bytes_written; gsize bytes_written;
gint len; gint len;
/* Apply the control key - Taken from Xlib /* Apply the control key - Taken from Xlib */
*/
if (event->state & GDK_CONTROL_MASK) if (event->state & GDK_CONTROL_MASK)
{ {
if ((c >= '@' && c < '\177') || c == ' ') c &= 0x1F; if ((c >= '@' && c < '\177') || c == ' ')
c &= 0x1F;
else if (c == '2') else if (c == '2')
{ {
event->string = g_memdup ("\0\0", 2); event->string = g_memdup ("\0\0", 2);
@ -1112,9 +1111,12 @@ translate_keyboard_string (GdkEventKey *event)
buf[0] = '\0'; buf[0] = '\0';
return; return;
} }
else if (c >= '3' && c <= '7') c -= ('3' - '\033'); else if (c >= '3' && c <= '7')
else if (c == '8') c = '\177'; c -= ('3' - '\033');
else if (c == '/') c = '_' & 0x1F; else if (c == '8')
c = '\177';
else if (c == '/')
c = '_' & 0x1F;
} }
len = g_unichar_to_utf8 (c, buf); len = g_unichar_to_utf8 (c, buf);
@ -1277,7 +1279,6 @@ deliver_key_event (GdkWaylandDeviceData *device,
g_source_remove (device->repeat_timer); g_source_remove (device->repeat_timer);
device->repeat_timer = 0; device->repeat_timer = 0;
} }
device->repeat_timer = device->repeat_timer =
gdk_threads_add_timeout (delay, keyboard_repeat, device); gdk_threads_add_timeout (delay, keyboard_repeat, device);
g_source_set_name_by_id (device->repeat_timer, "[gtk+] keyboard_repeat"); g_source_set_name_by_id (device->repeat_timer, "[gtk+] keyboard_repeat");
@ -1310,14 +1311,13 @@ keyboard_handle_key (void *data,
uint32_t state_w) uint32_t state_w)
{ {
GdkWaylandDeviceData *device = data; GdkWaylandDeviceData *device = data;
GdkWaylandDisplay *wayland_display = GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (device->display);
GDK_WAYLAND_DISPLAY (device->display);
if (!device->keyboard_focus) if (!device->keyboard_focus)
return; return;
device->repeat_count = 0; device->repeat_count = 0;
_gdk_wayland_display_update_serial (wayland_display, serial); _gdk_wayland_display_update_serial (display, serial);
deliver_key_event (data, time, key + 8, state_w); deliver_key_event (data, time, key + 8, state_w);
} }
@ -1439,12 +1439,11 @@ touch_handle_down (void *data,
wl_fixed_t y) wl_fixed_t y)
{ {
GdkWaylandDeviceData *device = data; GdkWaylandDeviceData *device = data;
GdkWaylandDisplay *wayland_display = GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (device->display);
GDK_WAYLAND_DISPLAY (device->display);
GdkWaylandTouchData *touch; GdkWaylandTouchData *touch;
GdkEvent *event; GdkEvent *event;
_gdk_wayland_display_update_serial (wayland_display, serial); _gdk_wayland_display_update_serial (display, serial);
touch = gdk_wayland_device_add_touch (device, id, wl_surface); touch = gdk_wayland_device_add_touch (device, id, wl_surface);
touch->x = wl_fixed_to_double (x); touch->x = wl_fixed_to_double (x);
@ -1467,12 +1466,11 @@ touch_handle_up (void *data,
int32_t id) int32_t id)
{ {
GdkWaylandDeviceData *device = data; GdkWaylandDeviceData *device = data;
GdkWaylandDisplay *wayland_display = GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (device->display);
GDK_WAYLAND_DISPLAY (device->display);
GdkWaylandTouchData *touch; GdkWaylandTouchData *touch;
GdkEvent *event; GdkEvent *event;
_gdk_wayland_display_update_serial (wayland_display, serial); _gdk_wayland_display_update_serial (display, serial);
touch = gdk_wayland_device_get_touch (device, id); touch = gdk_wayland_device_get_touch (device, id);
event = _create_touch_event (device, touch, GDK_TOUCH_END, time); event = _create_touch_event (device, touch, GDK_TOUCH_END, time);
@ -1568,8 +1566,7 @@ seat_handle_capabilities (void *data,
enum wl_seat_capability caps) enum wl_seat_capability caps)
{ {
GdkWaylandDeviceData *device = data; GdkWaylandDeviceData *device = data;
GdkWaylandDeviceManager *device_manager = GdkWaylandDeviceManager *device_manager = GDK_WAYLAND_DEVICE_MANAGER (device->device_manager);
GDK_WAYLAND_DEVICE_MANAGER (device->device_manager);
if ((caps & WL_SEAT_CAPABILITY_POINTER) && !device->wl_pointer) if ((caps & WL_SEAT_CAPABILITY_POINTER) && !device->wl_pointer)
{ {
@ -1689,9 +1686,9 @@ seat_handle_capabilities (void *data,
} }
static void static void
seat_handle_name (void *data, seat_handle_name (void *data,
struct wl_seat *seat, struct wl_seat *seat,
const char *name) const char *name)
{ {
/* We don't care about the name. */ /* We don't care about the name. */
} }
@ -1704,8 +1701,7 @@ static const struct wl_seat_listener seat_listener = {
static void static void
init_devices (GdkWaylandDeviceData *device) init_devices (GdkWaylandDeviceData *device)
{ {
GdkWaylandDeviceManager *device_manager = GdkWaylandDeviceManager *device_manager = GDK_WAYLAND_DEVICE_MANAGER (device->device_manager);
GDK_WAYLAND_DEVICE_MANAGER (device->device_manager);
/* pointer */ /* pointer */
device->master_pointer = g_object_new (GDK_TYPE_WAYLAND_DEVICE, device->master_pointer = g_object_new (GDK_TYPE_WAYLAND_DEVICE,
@ -1832,7 +1828,7 @@ gdk_wayland_device_manager_list_devices (GdkDeviceManager *device_manager,
GdkWaylandDeviceManager *wayland_device_manager; GdkWaylandDeviceManager *wayland_device_manager;
GList *devices = NULL, *l; GList *devices = NULL, *l;
wayland_device_manager = (GdkWaylandDeviceManager *) device_manager; wayland_device_manager = GDK_WAYLAND_DEVICE_MANAGER (device_manager);
for (l = wayland_device_manager->devices; l; l = l->next) for (l = wayland_device_manager->devices; l; l = l->next)
{ {
@ -1849,7 +1845,7 @@ gdk_wayland_device_manager_get_client_pointer (GdkDeviceManager *device_manager)
GdkWaylandDeviceManager *wayland_device_manager; GdkWaylandDeviceManager *wayland_device_manager;
GList *l; GList *l;
wayland_device_manager = (GdkWaylandDeviceManager *) device_manager; wayland_device_manager = GDK_WAYLAND_DEVICE_MANAGER (device_manager);
/* Find the first master pointer device */ /* Find the first master pointer device */
for (l = wayland_device_manager->devices; l != NULL; l = l->next) for (l = wayland_device_manager->devices; l != NULL; l = l->next)
@ -1943,6 +1939,7 @@ gdk_wayland_device_unset_touch_grab (GdkDevice *gdk_device,
GdkWaylandDeviceData *device; GdkWaylandDeviceData *device;
g_return_if_fail (GDK_IS_WAYLAND_DEVICE (gdk_device)); g_return_if_fail (GDK_IS_WAYLAND_DEVICE (gdk_device));
device = GDK_WAYLAND_DEVICE (gdk_device)->device; device = GDK_WAYLAND_DEVICE (gdk_device)->device;
gdk_wayland_device_remove_touch (device, GDK_EVENT_SEQUENCE_TO_SLOT (sequence)); gdk_wayland_device_remove_touch (device, GDK_EVENT_SEQUENCE_TO_SLOT (sequence));
@ -1953,12 +1950,9 @@ gdk_wayland_device_unset_touch_grab (GdkDevice *gdk_device,
struct wl_data_device * struct wl_data_device *
gdk_wayland_device_get_data_device (GdkDevice *gdk_device) gdk_wayland_device_get_data_device (GdkDevice *gdk_device)
{ {
GdkWaylandDeviceData *device;
g_return_val_if_fail (GDK_IS_WAYLAND_DEVICE (gdk_device), NULL); g_return_val_if_fail (GDK_IS_WAYLAND_DEVICE (gdk_device), NULL);
device = GDK_WAYLAND_DEVICE (gdk_device)->device;
return device->data_device; return GDK_WAYLAND_DEVICE (gdk_device)->device->data_device;
} }
void void
@ -1969,6 +1963,7 @@ gdk_wayland_device_set_selection (GdkDevice *gdk_device,
GdkWaylandDisplay *display_wayland; GdkWaylandDisplay *display_wayland;
g_return_if_fail (GDK_IS_WAYLAND_DEVICE (gdk_device)); g_return_if_fail (GDK_IS_WAYLAND_DEVICE (gdk_device));
device = GDK_WAYLAND_DEVICE (gdk_device)->device; device = GDK_WAYLAND_DEVICE (gdk_device)->device;
display_wayland = GDK_WAYLAND_DISPLAY (gdk_device_get_display (gdk_device)); display_wayland = GDK_WAYLAND_DISPLAY (gdk_device_get_display (gdk_device));

View File

@ -140,55 +140,71 @@ static const struct xdg_shell_listener xdg_shell_listener = {
}; };
static void static void
gdk_registry_handle_global(void *data, struct wl_registry *registry, uint32_t id, gdk_registry_handle_global (void *data,
const char *interface, uint32_t version) struct wl_registry *registry,
uint32_t id,
const char *interface,
uint32_t version)
{ {
GdkWaylandDisplay *display_wayland = data; GdkWaylandDisplay *display_wayland = data;
GdkDisplay *gdk_display = GDK_DISPLAY_OBJECT (data); GdkDisplay *gdk_display = GDK_DISPLAY_OBJECT (data);
struct wl_seat *seat; struct wl_seat *seat;
struct wl_output *output; struct wl_output *output;
if (strcmp(interface, "wl_compositor") == 0) { if (strcmp (interface, "wl_compositor") == 0)
display_wayland->compositor = {
wl_registry_bind(display_wayland->wl_registry, id, &wl_compositor_interface, MIN (version, 3)); display_wayland->compositor =
display_wayland->compositor_version = MIN (version, 3); wl_registry_bind (display_wayland->wl_registry, id, &wl_compositor_interface, MIN (version, 3));
} else if (strcmp(interface, "wl_shm") == 0) { display_wayland->compositor_version = MIN (version, 3);
display_wayland->shm = }
wl_registry_bind(display_wayland->wl_registry, id, &wl_shm_interface, 1); else if (strcmp (interface, "wl_shm") == 0)
{
display_wayland->shm =
wl_registry_bind (display_wayland->wl_registry, id, &wl_shm_interface, 1);
/* SHM interface is prerequisite */ /* SHM interface is prerequisite */
_gdk_wayland_display_load_cursor_theme(display_wayland); _gdk_wayland_display_load_cursor_theme (display_wayland);
} else if (strcmp(interface, "xdg_shell") == 0) { }
display_wayland->xdg_shell = else if (strcmp (interface, "xdg_shell") == 0)
wl_registry_bind(display_wayland->wl_registry, id, &xdg_shell_interface, 1); {
xdg_shell_use_unstable_version(display_wayland->xdg_shell, XDG_SHELL_VERSION_CURRENT); display_wayland->xdg_shell =
xdg_shell_add_listener(display_wayland->xdg_shell, &xdg_shell_listener, display_wayland); wl_registry_bind (display_wayland->wl_registry, id, &xdg_shell_interface, 1);
} else if (strcmp(interface, "gtk_shell") == 0) { xdg_shell_use_unstable_version (display_wayland->xdg_shell, XDG_SHELL_VERSION_CURRENT);
display_wayland->gtk_shell = xdg_shell_add_listener (display_wayland->xdg_shell, &xdg_shell_listener, display_wayland);
wl_registry_bind(display_wayland->wl_registry, id, &gtk_shell_interface, 1); }
_gdk_wayland_screen_set_has_gtk_shell (display_wayland->screen); else if (strcmp (interface, "gtk_shell") == 0)
} else if (strcmp(interface, "wl_output") == 0) { {
output = display_wayland->gtk_shell =
wl_registry_bind(display_wayland->wl_registry, id, &wl_output_interface, MIN (version, 2)); wl_registry_bind (display_wayland->wl_registry, id, &gtk_shell_interface, 1);
_gdk_wayland_screen_add_output(display_wayland->screen, id, output, MIN (version, 2)); _gdk_wayland_screen_set_has_gtk_shell (display_wayland->screen);
} else if (strcmp(interface, "wl_seat") == 0) { }
seat = wl_registry_bind(display_wayland->wl_registry, id, &wl_seat_interface, MIN (version, 4)); else if (strcmp (interface, "wl_output") == 0)
_gdk_wayland_device_manager_add_seat (gdk_display->device_manager, id, seat); {
} else if (strcmp(interface, "wl_data_device_manager") == 0) { output =
wl_registry_bind (display_wayland->wl_registry, id, &wl_output_interface, MIN (version, 2));
_gdk_wayland_screen_add_output (display_wayland->screen, id, output, MIN (version, 2));
}
else if (strcmp (interface, "wl_seat") == 0)
{
seat = wl_registry_bind (display_wayland->wl_registry, id, &wl_seat_interface, MIN (version, 4));
_gdk_wayland_device_manager_add_seat (gdk_display->device_manager, id, seat);
}
else if (strcmp (interface, "wl_data_device_manager") == 0)
{
display_wayland->data_device_manager = display_wayland->data_device_manager =
wl_registry_bind(display_wayland->wl_registry, id, wl_registry_bind (display_wayland->wl_registry, id, &wl_data_device_manager_interface, 1);
&wl_data_device_manager_interface, 1); }
} else if (strcmp (interface, "wl_subcompositor") == 0) { else if (strcmp (interface, "wl_subcompositor") == 0)
display_wayland->subcompositor = {
wl_registry_bind (display_wayland->wl_registry, id, display_wayland->subcompositor =
&wl_subcompositor_interface, 1); wl_registry_bind (display_wayland->wl_registry, id, &wl_subcompositor_interface, 1);
} }
} }
static void static void
gdk_registry_handle_global_remove(void *data, gdk_registry_handle_global_remove (void *data,
struct wl_registry *registry, struct wl_registry *registry,
uint32_t id) uint32_t id)
{ {
GdkWaylandDisplay *display_wayland = data; GdkWaylandDisplay *display_wayland = data;
GdkDisplay *display = GDK_DISPLAY (display_wayland); GdkDisplay *display = GDK_DISPLAY (display_wayland);
@ -205,7 +221,7 @@ static const struct wl_registry_listener registry_listener = {
}; };
static void static void
log_handler(const char *format, va_list args) log_handler (const char *format, va_list args)
{ {
g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, format, args); g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, format, args);
} }
@ -224,9 +240,9 @@ _gdk_wayland_display_open (const gchar *display_name)
if (g_getenv ("XDG_RUNTIME_DIR") == NULL) if (g_getenv ("XDG_RUNTIME_DIR") == NULL)
return NULL; return NULL;
wl_log_set_handler_client(log_handler); wl_log_set_handler_client (log_handler);
wl_display = wl_display_connect(display_name); wl_display = wl_display_connect (display_name);
if (!wl_display) if (!wl_display)
return NULL; return NULL;
@ -239,8 +255,8 @@ _gdk_wayland_display_open (const gchar *display_name)
display_wayland->event_source = _gdk_wayland_display_event_source_new (display); display_wayland->event_source = _gdk_wayland_display_event_source_new (display);
_gdk_wayland_display_init_cursors (display_wayland); _gdk_wayland_display_init_cursors (display_wayland);
display_wayland->wl_registry = wl_display_get_registry(display_wayland->wl_display); display_wayland->wl_registry = wl_display_get_registry (display_wayland->wl_display);
wl_registry_add_listener(display_wayland->wl_registry, &registry_listener, display_wayland); wl_registry_add_listener (display_wayland->wl_registry, &registry_listener, display_wayland);
/* Wait until the dust has settled during init... */ /* Wait until the dust has settled during init... */
wl_display_roundtrip (display_wayland->wl_display); wl_display_roundtrip (display_wayland->wl_display);
@ -326,7 +342,7 @@ gdk_wayland_display_sync (GdkDisplay *display)
display_wayland = GDK_WAYLAND_DISPLAY (display); display_wayland = GDK_WAYLAND_DISPLAY (display);
wl_display_roundtrip(display_wayland->wl_display); wl_display_roundtrip (display_wayland->wl_display);
} }
static void static void
@ -335,7 +351,7 @@ gdk_wayland_display_flush (GdkDisplay *display)
g_return_if_fail (GDK_IS_DISPLAY (display)); g_return_if_fail (GDK_IS_DISPLAY (display));
if (!display->closed) if (!display->closed)
wl_display_flush(GDK_WAYLAND_DISPLAY (display)->wl_display); wl_display_flush (GDK_WAYLAND_DISPLAY (display)->wl_display);
} }
static gboolean static gboolean
@ -485,7 +501,7 @@ gdk_wayland_display_pop_error_trap (GdkDisplay *display,
} }
static void static void
gdk_wayland_display_class_init (GdkWaylandDisplayClass * class) gdk_wayland_display_class_init (GdkWaylandDisplayClass *class)
{ {
GObjectClass *object_class = G_OBJECT_CLASS (class); GObjectClass *object_class = G_OBJECT_CLASS (class);
GdkDisplayClass *display_class = GDK_DISPLAY_CLASS (class); GdkDisplayClass *display_class = GDK_DISPLAY_CLASS (class);
@ -591,8 +607,7 @@ _gdk_wayland_display_load_cursor_theme (GdkWaylandDisplay *wayland_display)
else else
name = "default"; name = "default";
gdk_wayland_display_set_cursor_theme (GDK_DISPLAY (wayland_display), gdk_wayland_display_set_cursor_theme (GDK_DISPLAY (wayland_display), name, size);
name, size);
g_value_unset (&v); g_value_unset (&v);
} }
@ -610,30 +625,28 @@ _gdk_wayland_display_update_serial (GdkWaylandDisplay *wayland_display,
} }
/** /**
* gdk_wayland_display_get_wl_display * gdk_wayland_display_get_wl_display:
* @display: (type GdkWaylandDisplay): a #GdkDisplay * @display: (type GdkWaylandDisplay): a #GdkDisplay
* *
* Returns the Wayland wl_display of a #GdkDisplay * Returns the Wayland wl_display of a #GdkDisplay.
* *
* Returns: (transfer none): a Wayland wl_display * Returns: (transfer none): a Wayland wl_display
* *
* Since: 3.8 * Since: 3.8
*/ */
struct wl_display * struct wl_display *
gdk_wayland_display_get_wl_display(GdkDisplay *display) gdk_wayland_display_get_wl_display (GdkDisplay *display)
{ {
GdkWaylandDisplay *wayland_display = GDK_WAYLAND_DISPLAY(display); g_return_val_if_fail (GDK_IS_WAYLAND_DISPLAY (display), NULL);
g_return_val_if_fail (GDK_IS_WAYLAND_DISPLAY(display), NULL); return GDK_WAYLAND_DISPLAY (display)->wl_display;
return wayland_display->wl_display;
} }
/** /**
* gdk_wayland_display_get_wl_compositor * gdk_wayland_display_get_wl_compositor:
* @display: (type GdkWaylandDisplay): a #GdkDisplay * @display: (type GdkWaylandDisplay): a #GdkDisplay
* *
* Returns the Wayland global singleton compositor of a #GdkDisplay * Returns the Wayland global singleton compositor of a #GdkDisplay.
* *
* Returns: (transfer none): a Wayland wl_compositor * Returns: (transfer none): a Wayland wl_compositor
* *
@ -642,18 +655,16 @@ gdk_wayland_display_get_wl_display(GdkDisplay *display)
struct wl_compositor * struct wl_compositor *
gdk_wayland_display_get_wl_compositor (GdkDisplay *display) gdk_wayland_display_get_wl_compositor (GdkDisplay *display)
{ {
GdkWaylandDisplay *wayland_display = GDK_WAYLAND_DISPLAY(display); g_return_val_if_fail (GDK_IS_WAYLAND_DISPLAY (display), NULL);
g_return_val_if_fail (GDK_IS_WAYLAND_DISPLAY(display), NULL); return GDK_WAYLAND_DISPLAY (display)->compositor;
return wayland_display->compositor;
} }
/** /**
* gdk_wayland_display_get_xdg_shell * gdk_wayland_display_get_xdg_shell:
* @display: (type GdkWaylandDisplay): a #GdkDisplay * @display: (type GdkWaylandDisplay): a #GdkDisplay
* *
* Returns the Wayland global singleton shell of a #GdkDisplay * Returns the Wayland global singleton shell of a #GdkDisplay.
* *
* Returns: (transfer none): a Wayland xdg_shell * Returns: (transfer none): a Wayland xdg_shell
* *
@ -662,11 +673,9 @@ gdk_wayland_display_get_wl_compositor (GdkDisplay *display)
struct xdg_shell * struct xdg_shell *
gdk_wayland_display_get_xdg_shell (GdkDisplay *display) gdk_wayland_display_get_xdg_shell (GdkDisplay *display)
{ {
GdkWaylandDisplay *wayland_display = GDK_WAYLAND_DISPLAY(display); g_return_val_if_fail (GDK_IS_WAYLAND_DISPLAY (display), NULL);
g_return_val_if_fail (GDK_IS_WAYLAND_DISPLAY(display), NULL); return GDK_WAYLAND_DISPLAY (display)->xdg_shell;
return wayland_display->xdg_shell;
} }
static const cairo_user_data_key_t gdk_wayland_cairo_key; static const cairo_user_data_key_t gdk_wayland_cairo_key;
@ -737,7 +746,7 @@ create_shm_pool (struct wl_shm *shm,
return NULL; return NULL;
} }
pool = wl_shm_create_pool(shm, fd, size); pool = wl_shm_create_pool (shm, fd, size);
close (fd); close (fd);

View File

@ -1,7 +1,7 @@
/* /*
* gdkdisplay-wayland.h * gdkdisplay-wayland.h
* *
* Copyright 2001 Sun Microsystems Inc. * Copyright 2001 Sun Microsystems Inc.
* *
* Erwann Chenede <erwann.chenede@sun.com> * Erwann Chenede <erwann.chenede@sun.com>
* *
@ -99,4 +99,4 @@ struct _GdkWaylandDisplayClass
G_END_DECLS G_END_DECLS
#endif /* __GDK_WAYLAND_DISPLAY__ */ #endif /* __GDK_WAYLAND_DISPLAY__ */

View File

@ -33,7 +33,8 @@ typedef struct _GdkWaylandEventSource {
static GList *event_sources = NULL; static GList *event_sources = NULL;
static gboolean static gboolean
gdk_event_source_prepare(GSource *base, gint *timeout) gdk_event_source_prepare (GSource *base,
gint *timeout)
{ {
GdkWaylandEventSource *source = (GdkWaylandEventSource *) base; GdkWaylandEventSource *source = (GdkWaylandEventSource *) base;
GdkWaylandDisplay *display = (GdkWaylandDisplay *) source->display; GdkWaylandDisplay *display = (GdkWaylandDisplay *) source->display;
@ -60,7 +61,7 @@ gdk_event_source_prepare(GSource *base, gint *timeout)
} }
static gboolean static gboolean
gdk_event_source_check(GSource *base) gdk_event_source_check (GSource *base)
{ {
GdkWaylandEventSource *source = (GdkWaylandEventSource *) base; GdkWaylandEventSource *source = (GdkWaylandEventSource *) base;
@ -72,9 +73,9 @@ gdk_event_source_check(GSource *base)
} }
static gboolean static gboolean
gdk_event_source_dispatch(GSource *base, gdk_event_source_dispatch (GSource *base,
GSourceFunc callback, GSourceFunc callback,
gpointer data) gpointer data)
{ {
GdkWaylandEventSource *source = (GdkWaylandEventSource *) base; GdkWaylandEventSource *source = (GdkWaylandEventSource *) base;
GdkDisplay *display = source->display; GdkDisplay *display = source->display;
@ -110,7 +111,8 @@ static GSourceFuncs wl_glib_source_funcs = {
}; };
void void
_gdk_wayland_display_deliver_event (GdkDisplay *display, GdkEvent *event) _gdk_wayland_display_deliver_event (GdkDisplay *display,
GdkEvent *event)
{ {
GList *node; GList *node;

View File

@ -95,7 +95,8 @@ gdk_wayland_window_invalidate_for_new_frame (GdkWindow *window,
window_rect.height = gdk_window_get_height (window); window_rect.height = gdk_window_get_height (window);
/* If nothing else is known, repaint everything so that the back /* If nothing else is known, repaint everything so that the back
buffer is fully up-to-date for the swapbuffer */ * buffer is fully up-to-date for the swapbuffer
*/
cairo_region_union_rectangle (update_area, &window_rect); cairo_region_union_rectangle (update_area, &window_rect);
} }
} }
@ -165,7 +166,7 @@ gdk_wayland_gl_context_realize (GdkGLContext *context,
} }
static void static void
gdk_wayland_gl_context_end_frame (GdkGLContext *context, gdk_wayland_gl_context_end_frame (GdkGLContext *context,
cairo_region_t *painted, cairo_region_t *painted,
cairo_region_t *damage) cairo_region_t *damage)
{ {
@ -180,7 +181,7 @@ gdk_wayland_gl_context_end_frame (GdkGLContext *context,
egl_surface = gdk_wayland_window_get_egl_surface (window->impl_window, egl_surface = gdk_wayland_window_get_egl_surface (window->impl_window,
context_wayland->egl_config); context_wayland->egl_config);
// TODO: Use eglSwapBuffersWithDamageEXT if available /* TODO: Use eglSwapBuffersWithDamageEXT if available */
if (display_wayland->have_egl_swap_buffers_with_damage) if (display_wayland->have_egl_swap_buffers_with_damage)
{ {
int i, j, n_rects = cairo_region_num_rectangles (damage); int i, j, n_rects = cairo_region_num_rectangles (damage);

View File

@ -250,7 +250,7 @@ get_xkb_modifiers (struct xkb_keymap *xkb_keymap,
if (state & GDK_MOD1_MASK) if (state & GDK_MOD1_MASK)
mods |= 1 << xkb_keymap_mod_get_index (xkb_keymap, XKB_MOD_NAME_ALT); mods |= 1 << xkb_keymap_mod_get_index (xkb_keymap, XKB_MOD_NAME_ALT);
if (state & GDK_MOD2_MASK) if (state & GDK_MOD2_MASK)
mods |= 1 << xkb_keymap_mod_get_index (xkb_keymap, "Mod2"); mods |= 1 << xkb_keymap_mod_get_index (xkb_keymap, XKB_MOD_NAME_NUM);
if (state & GDK_MOD3_MASK) if (state & GDK_MOD3_MASK)
mods |= 1 << xkb_keymap_mod_get_index (xkb_keymap, "Mod3"); mods |= 1 << xkb_keymap_mod_get_index (xkb_keymap, "Mod3");
if (state & GDK_MOD4_MASK) if (state & GDK_MOD4_MASK)
@ -275,7 +275,7 @@ get_gdk_modifiers (struct xkb_keymap *xkb_keymap,
state |= GDK_CONTROL_MASK; state |= GDK_CONTROL_MASK;
if (mods & (1 << xkb_keymap_mod_get_index (xkb_keymap, XKB_MOD_NAME_ALT))) if (mods & (1 << xkb_keymap_mod_get_index (xkb_keymap, XKB_MOD_NAME_ALT)))
state |= GDK_MOD1_MASK; state |= GDK_MOD1_MASK;
if (mods & (1 << xkb_keymap_mod_get_index (xkb_keymap, "Mod2"))) if (mods & (1 << xkb_keymap_mod_get_index (xkb_keymap, XKB_MOD_NAME_NUM)))
state |= GDK_MOD2_MASK; state |= GDK_MOD2_MASK;
if (mods & (1 << xkb_keymap_mod_get_index (xkb_keymap, "Mod3"))) if (mods & (1 << xkb_keymap_mod_get_index (xkb_keymap, "Mod3")))
state |= GDK_MOD3_MASK; state |= GDK_MOD3_MASK;
@ -457,7 +457,7 @@ update_direction (GdkWaylandKeymap *keymap)
} }
GdkKeymap * GdkKeymap *
_gdk_wayland_keymap_new () _gdk_wayland_keymap_new (void)
{ {
GdkWaylandKeymap *keymap; GdkWaylandKeymap *keymap;
struct xkb_context *context; struct xkb_context *context;
@ -494,12 +494,12 @@ _gdk_wayland_keymap_update_from_fd (GdkKeymap *keymap,
context = xkb_context_new (0); context = xkb_context_new (0);
map_str = mmap(NULL, size, PROT_READ, MAP_SHARED, fd, 0); map_str = mmap (NULL, size, PROT_READ, MAP_SHARED, fd, 0);
if (map_str == MAP_FAILED) if (map_str == MAP_FAILED)
{ {
close(fd); close(fd);
return; return;
} }
xkb_keymap = xkb_keymap_new_from_string (context, map_str, format, 0); xkb_keymap = xkb_keymap_new_from_string (context, map_str, format, 0);
munmap (map_str, size); munmap (map_str, size);
@ -523,12 +523,14 @@ _gdk_wayland_keymap_update_from_fd (GdkKeymap *keymap,
update_direction (keymap_wayland); update_direction (keymap_wayland);
} }
struct xkb_keymap *_gdk_wayland_keymap_get_xkb_keymap (GdkKeymap *keymap) struct xkb_keymap *
_gdk_wayland_keymap_get_xkb_keymap (GdkKeymap *keymap)
{ {
return GDK_WAYLAND_KEYMAP (keymap)->xkb_keymap; return GDK_WAYLAND_KEYMAP (keymap)->xkb_keymap;
} }
struct xkb_state *_gdk_wayland_keymap_get_xkb_state (GdkKeymap *keymap) struct xkb_state *
_gdk_wayland_keymap_get_xkb_state (GdkKeymap *keymap)
{ {
return GDK_WAYLAND_KEYMAP (keymap)->xkb_state; return GDK_WAYLAND_KEYMAP (keymap)->xkb_state;
} }

View File

@ -19,11 +19,11 @@
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog * file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with * files for a list of changes. These files are distributed with
* GTK+ at ftp://ftp.gtk.org/pub/gtk/. * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/ */
/* /*
* Private uninstalled header defining things local to X windowing code * Private uninstalled header defining things local to the Wayland backend
*/ */
#ifndef __GDK_PRIVATE_WAYLAND_H__ #ifndef __GDK_PRIVATE_WAYLAND_H__

View File

@ -223,7 +223,9 @@ gdk_wayland_screen_get_monitor_width_mm (GdkScreen *screen,
gint monitor_num) gint monitor_num)
{ {
GdkWaylandScreen *screen_wayland = GDK_WAYLAND_SCREEN (screen); GdkWaylandScreen *screen_wayland = GDK_WAYLAND_SCREEN (screen);
GdkWaylandMonitor *monitor = g_ptr_array_index(screen_wayland->monitors, monitor_num); GdkWaylandMonitor *monitor;
monitor = g_ptr_array_index (screen_wayland->monitors, monitor_num);
return monitor->width_mm; return monitor->width_mm;
} }
@ -233,7 +235,9 @@ gdk_wayland_screen_get_monitor_height_mm (GdkScreen *screen,
gint monitor_num) gint monitor_num)
{ {
GdkWaylandScreen *screen_wayland = GDK_WAYLAND_SCREEN (screen); GdkWaylandScreen *screen_wayland = GDK_WAYLAND_SCREEN (screen);
GdkWaylandMonitor *monitor = g_ptr_array_index(screen_wayland->monitors, monitor_num); GdkWaylandMonitor *monitor;
monitor = g_ptr_array_index (screen_wayland->monitors, monitor_num);
return monitor->height_mm; return monitor->height_mm;
} }
@ -243,7 +247,9 @@ gdk_wayland_screen_get_monitor_plug_name (GdkScreen *screen,
gint monitor_num) gint monitor_num)
{ {
GdkWaylandScreen *screen_wayland = GDK_WAYLAND_SCREEN (screen); GdkWaylandScreen *screen_wayland = GDK_WAYLAND_SCREEN (screen);
GdkWaylandMonitor *monitor = g_ptr_array_index(screen_wayland->monitors, monitor_num); GdkWaylandMonitor *monitor;
monitor = g_ptr_array_index (screen_wayland->monitors, monitor_num);
return g_strdup (monitor->output_name); return g_strdup (monitor->output_name);
} }
@ -254,7 +260,9 @@ gdk_wayland_screen_get_monitor_geometry (GdkScreen *screen,
GdkRectangle *dest) GdkRectangle *dest)
{ {
GdkWaylandScreen *screen_wayland = GDK_WAYLAND_SCREEN (screen); GdkWaylandScreen *screen_wayland = GDK_WAYLAND_SCREEN (screen);
GdkWaylandMonitor *monitor = g_ptr_array_index(screen_wayland->monitors, monitor_num); GdkWaylandMonitor *monitor;
monitor = g_ptr_array_index (screen_wayland->monitors, monitor_num);
if (dest) if (dest)
*dest = monitor->geometry; *dest = monitor->geometry;
@ -267,10 +275,7 @@ gdk_wayland_screen_get_monitor_scale_factor (GdkScreen *screen,
GdkWaylandScreen *screen_wayland = GDK_WAYLAND_SCREEN (screen); GdkWaylandScreen *screen_wayland = GDK_WAYLAND_SCREEN (screen);
GdkWaylandMonitor *monitor; GdkWaylandMonitor *monitor;
if (monitor_num >= screen_wayland->monitors->len) monitor = g_ptr_array_index (screen_wayland->monitors, monitor_num);
return 1;
monitor = g_ptr_array_index(screen_wayland->monitors, monitor_num);
return monitor->scale; return monitor->scale;
} }
@ -358,17 +363,17 @@ typedef enum
static gdouble static gdouble
get_dpi_from_gsettings (GdkWaylandScreen *screen_wayland) get_dpi_from_gsettings (GdkWaylandScreen *screen_wayland)
{ {
GSettings *interface_settings; GSettings *settings;
gdouble factor; gdouble factor;
interface_settings = g_hash_table_lookup (screen_wayland->settings, settings = g_hash_table_lookup (screen_wayland->settings,
"org.gnome.desktop.interface"); "org.gnome.desktop.interface");
if (interface_settings != NULL) if (settings != NULL)
factor = g_settings_get_double (interface_settings, "text-scaling-factor"); factor = g_settings_get_double (settings, "text-scaling-factor");
else else
factor = 1.0; factor = 1.0;
return 96.0 * factor; return 96.0 * factor;
} }
static void static void
@ -547,7 +552,8 @@ static TranslationEntry translations[] = {
}; };
static TranslationEntry * static TranslationEntry *
find_translation_entry_by_key (GSettings *settings, const gchar *key) find_translation_entry_by_key (GSettings *settings,
const gchar *key)
{ {
guint i; guint i;
gchar *schema; gchar *schema;
@ -750,8 +756,8 @@ set_decoration_layout_from_entry (GdkScreen *screen,
static gboolean static gboolean
set_capability_setting (GdkScreen *screen, set_capability_setting (GdkScreen *screen,
GValue *value, GValue *value,
enum gtk_shell_capability test) enum gtk_shell_capability test)
{ {
GdkWaylandScreen *wayland_screen = GDK_WAYLAND_SCREEN (screen); GdkWaylandScreen *wayland_screen = GDK_WAYLAND_SCREEN (screen);
@ -762,8 +768,8 @@ set_capability_setting (GdkScreen *screen,
static gboolean static gboolean
gdk_wayland_screen_get_setting (GdkScreen *screen, gdk_wayland_screen_get_setting (GdkScreen *screen,
const gchar *name, const gchar *name,
GValue *value) GValue *value)
{ {
TranslationEntry *entry; TranslationEntry *entry;
@ -1017,11 +1023,16 @@ update_screen_size (GdkWaylandScreen *screen_wayland)
} }
static void static void
output_handle_geometry(void *data, output_handle_geometry (void *data,
struct wl_output *wl_output, struct wl_output *wl_output,
int x, int y, int physical_width, int physical_height, int x,
int subpixel, const char *make, const char *model, int y,
int32_t transform) int physical_width,
int physical_height,
int subpixel,
const char *make,
const char *model,
int32_t transform)
{ {
GdkWaylandMonitor *monitor = (GdkWaylandMonitor *)data; GdkWaylandMonitor *monitor = (GdkWaylandMonitor *)data;
@ -1042,8 +1053,8 @@ output_handle_geometry(void *data,
} }
static void static void
output_handle_done(void *data, output_handle_done (void *data,
struct wl_output *wl_output) struct wl_output *wl_output)
{ {
GdkWaylandMonitor *monitor = (GdkWaylandMonitor *)data; GdkWaylandMonitor *monitor = (GdkWaylandMonitor *)data;
@ -1052,9 +1063,9 @@ output_handle_done(void *data,
} }
static void static void
output_handle_scale(void *data, output_handle_scale (void *data,
struct wl_output *wl_output, struct wl_output *wl_output,
int32_t factor) int32_t factor)
{ {
GdkWaylandMonitor *monitor = (GdkWaylandMonitor *)data; GdkWaylandMonitor *monitor = (GdkWaylandMonitor *)data;
@ -1063,12 +1074,12 @@ output_handle_scale(void *data,
} }
static void static void
output_handle_mode(void *data, output_handle_mode (void *data,
struct wl_output *wl_output, struct wl_output *wl_output,
uint32_t flags, uint32_t flags,
int width, int width,
int height, int height,
int refresh) int refresh)
{ {
GdkWaylandMonitor *monitor = (GdkWaylandMonitor *)data; GdkWaylandMonitor *monitor = (GdkWaylandMonitor *)data;
@ -1101,16 +1112,19 @@ _gdk_wayland_screen_add_output (GdkScreen *screen,
guint32 version) guint32 version)
{ {
GdkWaylandScreen *screen_wayland = GDK_WAYLAND_SCREEN (screen); GdkWaylandScreen *screen_wayland = GDK_WAYLAND_SCREEN (screen);
GdkWaylandMonitor *monitor = g_new0(GdkWaylandMonitor, 1); GdkWaylandMonitor *monitor;
monitor = g_new0 (GdkWaylandMonitor, 1);
monitor->id = id; monitor->id = id;
monitor->output = output; monitor->output = output;
monitor->version = version; monitor->version = version;
monitor->screen = screen_wayland; monitor->screen = screen_wayland;
monitor->scale = 1; monitor->scale = 1;
g_ptr_array_add(screen_wayland->monitors, monitor);
wl_output_add_listener(output, &output_listener, monitor); g_ptr_array_add (screen_wayland->monitors, monitor);
wl_output_add_listener (output, &output_listener, monitor);
} }
void void

View File

@ -64,7 +64,8 @@ struct _DataSourceData
GdkAtom selection; GdkAtom selection;
}; };
struct _AsyncWriteData { struct _AsyncWriteData
{
GOutputStream *stream; GOutputStream *stream;
GdkWaylandSelection *selection; GdkWaylandSelection *selection;
gsize index; gsize index;
@ -268,8 +269,9 @@ gdk_wayland_selection_new (void)
atoms[ATOM_DND] = gdk_atom_intern_static_string ("GdkWaylandSelection"); atoms[ATOM_DND] = gdk_atom_intern_static_string ("GdkWaylandSelection");
selection = g_new0 (GdkWaylandSelection, 1); selection = g_new0 (GdkWaylandSelection, 1);
selection->selection_buffers = g_hash_table_new_full (NULL, NULL, NULL, selection->selection_buffers =
(GDestroyNotify) selection_buffer_cancel_and_unref); g_hash_table_new_full (NULL, NULL, NULL,
(GDestroyNotify) selection_buffer_cancel_and_unref);
return selection; return selection;
} }
@ -742,7 +744,8 @@ gdk_wayland_selection_get_data_source (GdkWindow *owner,
} }
void void
gdk_wayland_selection_unset_data_source (GdkDisplay *display, GdkAtom selection) gdk_wayland_selection_unset_data_source (GdkDisplay *display,
GdkAtom selection)
{ {
GdkWaylandSelection *wayland_selection = gdk_wayland_display_get_selection (display); GdkWaylandSelection *wayland_selection = gdk_wayland_display_get_selection (display);
@ -772,7 +775,7 @@ gdk_wayland_selection_unset_data_source (GdkDisplay *display, GdkAtom selection)
GdkWindow * GdkWindow *
_gdk_wayland_display_get_selection_owner (GdkDisplay *display, _gdk_wayland_display_get_selection_owner (GdkDisplay *display,
GdkAtom selection) GdkAtom selection)
{ {
GdkWaylandSelection *wayland_selection = gdk_wayland_display_get_selection (display); GdkWaylandSelection *wayland_selection = gdk_wayland_display_get_selection (display);
@ -786,10 +789,10 @@ _gdk_wayland_display_get_selection_owner (GdkDisplay *display,
gboolean gboolean
_gdk_wayland_display_set_selection_owner (GdkDisplay *display, _gdk_wayland_display_set_selection_owner (GdkDisplay *display,
GdkWindow *owner, GdkWindow *owner,
GdkAtom selection, GdkAtom selection,
guint32 time, guint32 time,
gboolean send_event) gboolean send_event)
{ {
GdkWaylandSelection *wayland_selection = gdk_wayland_display_get_selection (display); GdkWaylandSelection *wayland_selection = gdk_wayland_display_get_selection (display);
@ -809,20 +812,20 @@ _gdk_wayland_display_set_selection_owner (GdkDisplay *display,
void void
_gdk_wayland_display_send_selection_notify (GdkDisplay *dispay, _gdk_wayland_display_send_selection_notify (GdkDisplay *dispay,
GdkWindow *requestor, GdkWindow *requestor,
GdkAtom selection, GdkAtom selection,
GdkAtom target, GdkAtom target,
GdkAtom property, GdkAtom property,
guint32 time) guint32 time)
{ {
} }
gint gint
_gdk_wayland_display_get_selection_property (GdkDisplay *display, _gdk_wayland_display_get_selection_property (GdkDisplay *display,
GdkWindow *requestor, GdkWindow *requestor,
guchar **data, guchar **data,
GdkAtom *ret_type, GdkAtom *ret_type,
gint *ret_format) gint *ret_format)
{ {
SelectionBuffer *buffer_data; SelectionBuffer *buffer_data;
gsize len; gsize len;
@ -864,10 +867,10 @@ _gdk_wayland_display_get_selection_property (GdkDisplay *display,
void void
_gdk_wayland_display_convert_selection (GdkDisplay *display, _gdk_wayland_display_convert_selection (GdkDisplay *display,
GdkWindow *requestor, GdkWindow *requestor,
GdkAtom selection, GdkAtom selection,
GdkAtom target, GdkAtom target,
guint32 time) guint32 time)
{ {
GdkWaylandSelection *wayland_selection = gdk_wayland_display_get_selection (display); GdkWaylandSelection *wayland_selection = gdk_wayland_display_get_selection (display);
SelectionBuffer *buffer_data; SelectionBuffer *buffer_data;
@ -950,11 +953,11 @@ _gdk_wayland_display_convert_selection (GdkDisplay *display,
gint gint
_gdk_wayland_display_text_property_to_utf8_list (GdkDisplay *display, _gdk_wayland_display_text_property_to_utf8_list (GdkDisplay *display,
GdkAtom encoding, GdkAtom encoding,
gint format, gint format,
const guchar *text, const guchar *text,
gint length, gint length,
gchar ***list) gchar ***list)
{ {
GPtrArray *array; GPtrArray *array;
const gchar *ptr; const gchar *ptr;
@ -991,7 +994,7 @@ _gdk_wayland_display_text_property_to_utf8_list (GdkDisplay *display,
gchar * gchar *
_gdk_wayland_display_utf8_to_string_target (GdkDisplay *display, _gdk_wayland_display_utf8_to_string_target (GdkDisplay *display,
const gchar *str) const gchar *str)
{ {
return NULL; return NULL;
} }
@ -1029,7 +1032,8 @@ gdk_wayland_selection_add_targets (GdkWindow *window,
} }
void void
gdk_wayland_selection_clear_targets (GdkDisplay *display, GdkAtom selection) gdk_wayland_selection_clear_targets (GdkDisplay *display,
GdkAtom selection)
{ {
gdk_wayland_selection_unset_data_source (display, selection); gdk_wayland_selection_unset_data_source (display, selection);
} }

View File

@ -19,7 +19,7 @@
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog * file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with * files for a list of changes. These files are distributed with
* GTK+ at ftp://ftp.gtk.org/pub/gtk/. * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/ */
#ifndef __GDK_WAYLAND_H__ #ifndef __GDK_WAYLAND_H__

View File

@ -19,7 +19,7 @@
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog * file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with * files for a list of changes. These files are distributed with
* GTK+ at ftp://ftp.gtk.org/pub/gtk/. * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/ */
#ifndef __GDK_WAYLAND_SELECTION_H__ #ifndef __GDK_WAYLAND_SELECTION_H__

View File

@ -51,11 +51,13 @@
typedef struct _GdkWaylandWindow GdkWaylandWindow; typedef struct _GdkWaylandWindow GdkWaylandWindow;
typedef struct _GdkWaylandWindowClass GdkWaylandWindowClass; typedef struct _GdkWaylandWindowClass GdkWaylandWindowClass;
struct _GdkWaylandWindow { struct _GdkWaylandWindow
{
GdkWindow parent; GdkWindow parent;
}; };
struct _GdkWaylandWindowClass { struct _GdkWaylandWindowClass
{
GdkWindowClass parent_class; GdkWindowClass parent_class;
}; };
@ -218,14 +220,13 @@ _gdk_wayland_screen_create_root_window (GdkScreen *screen,
impl->wrapper = GDK_WINDOW (window); impl->wrapper = GDK_WINDOW (window);
if (wayland_display->compositor_version >= WL_SURFACE_HAS_BUFFER_SCALE && if (wayland_display->compositor_version >= WL_SURFACE_HAS_BUFFER_SCALE &&
gdk_screen_get_n_monitors(screen) > 0) gdk_screen_get_n_monitors (screen) > 0)
impl->scale = gdk_screen_get_monitor_scale_factor (screen, 0); impl->scale = gdk_screen_get_monitor_scale_factor (screen, 0);
/* logical 1x1 fake buffer */ /* logical 1x1 fake buffer */
impl->cairo_surface = impl->cairo_surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
cairo_image_surface_create (CAIRO_FORMAT_ARGB32, impl->scale,
impl->scale, impl->scale);
impl->scale);
cairo_surface_set_device_scale (impl->cairo_surface, impl->scale, impl->scale); cairo_surface_set_device_scale (impl->cairo_surface, impl->scale, impl->scale);
@ -424,15 +425,12 @@ window_update_scale (GdkWindow *window)
for (l = impl->outputs; l != NULL; l = l->next) for (l = impl->outputs; l != NULL; l = l->next)
{ {
guint32 output_scale = guint32 output_scale =
_gdk_wayland_screen_get_output_scale (wayland_display->screen, _gdk_wayland_screen_get_output_scale (wayland_display->screen, l->data);
l->data);
scale = MAX (scale, output_scale); scale = MAX (scale, output_scale);
} }
/* Notify app that scale changed */ /* Notify app that scale changed */
gdk_wayland_window_configure (window, gdk_wayland_window_configure (window, window->width, window->height, scale);
window->width, window->height,
scale);
} }
static void static void
@ -463,15 +461,15 @@ _gdk_wayland_display_create_window_impl (GdkDisplay *display,
window->impl = GDK_WINDOW_IMPL (impl); window->impl = GDK_WINDOW_IMPL (impl);
impl->wrapper = GDK_WINDOW (window); impl->wrapper = GDK_WINDOW (window);
if (window->width > 65535 || if (window->width > 65535)
window->height > 65535)
{ {
g_warning ("Native Windows wider or taller than 65535 pixels are not supported"); g_warning ("Native Windows wider than 65535 pixels are not supported");
window->width = 65535;
if (window->width > 65535) }
window->width = 65535; if (window->height > 65535)
if (window->height > 65535) {
window->height = 65535; g_warning ("Native Windows taller than 65535 pixels are not supported");
window->height = 65535;
} }
g_object_ref (window); g_object_ref (window);
@ -599,7 +597,9 @@ static gboolean
gdk_window_impl_wayland_begin_paint (GdkWindow *window) gdk_window_impl_wayland_begin_paint (GdkWindow *window)
{ {
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
gdk_wayland_window_ensure_cairo_surface (window); gdk_wayland_window_ensure_cairo_surface (window);
if (_gdk_wayland_is_shm_surface (impl->cairo_surface)) if (_gdk_wayland_is_shm_surface (impl->cairo_surface))
return _gdk_wayland_shm_surface_get_busy (impl->cairo_surface); return _gdk_wayland_shm_surface_get_busy (impl->cairo_surface);
else else
@ -621,8 +621,7 @@ gdk_window_impl_wayland_end_paint (GdkWindow *window)
for (i = 0; i < n; i++) for (i = 0; i < n; i++)
{ {
cairo_region_get_rectangle (window->current_paint.region, i, &rect); cairo_region_get_rectangle (window->current_paint.region, i, &rect);
wl_surface_damage (impl->surface, wl_surface_damage (impl->surface, rect.x, rect.y, rect.width, rect.height);
rect.x, rect.y, rect.width, rect.height);
impl->pending_commit = TRUE; impl->pending_commit = TRUE;
} }
} }
@ -893,7 +892,7 @@ xdg_surface_configure (void *data,
gdk_wayland_window_configure (window, width, height, impl->scale); gdk_wayland_window_configure (window, width, height, impl->scale);
} }
wl_array_for_each(p, states) wl_array_for_each (p, states)
{ {
uint32_t state = *p; uint32_t state = *p;
switch (state) switch (state)
@ -921,7 +920,7 @@ xdg_surface_configure (void *data,
} }
static void static void
xdg_surface_close (void *data, xdg_surface_close (void *data,
struct xdg_surface *xdg_surface) struct xdg_surface *xdg_surface)
{ {
GdkWindow *window = GDK_WINDOW (data); GdkWindow *window = GDK_WINDOW (data);
@ -1031,11 +1030,11 @@ gdk_wayland_window_get_fake_root_coords (GdkWindow *window,
} }
static void static void
gdk_wayland_window_create_xdg_popup (GdkWindow *window, gdk_wayland_window_create_xdg_popup (GdkWindow *window,
GdkWindow *parent, GdkWindow *parent,
struct wl_seat *seat) struct wl_seat *seat)
{ {
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (gdk_window_get_display (window)); GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (gdk_window_get_display (window));
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
GdkWindowImplWayland *parent_impl = GDK_WINDOW_IMPL_WAYLAND (parent->impl); GdkWindowImplWayland *parent_impl = GDK_WINDOW_IMPL_WAYLAND (parent->impl);
GdkDeviceManager *device_manager; GdkDeviceManager *device_manager;
@ -1049,7 +1048,7 @@ gdk_wayland_window_create_xdg_popup (GdkWindow *window,
if (!parent_impl->surface) if (!parent_impl->surface)
return; return;
device_manager = gdk_display_get_device_manager (GDK_DISPLAY (display_wayland)); device_manager = gdk_display_get_device_manager (GDK_DISPLAY (display));
device = GDK_WAYLAND_DEVICE (gdk_device_manager_get_client_pointer (device_manager)); device = GDK_WAYLAND_DEVICE (gdk_device_manager_get_client_pointer (device_manager));
gdk_wayland_window_get_fake_root_coords (parent, &parent_x, &parent_y); gdk_wayland_window_get_fake_root_coords (parent, &parent_x, &parent_y);
@ -1063,7 +1062,7 @@ gdk_wayland_window_create_xdg_popup (GdkWindow *window,
y -= parent_impl->margin_top; y -= parent_impl->margin_top;
} }
impl->xdg_popup = xdg_shell_get_xdg_popup (display_wayland->xdg_shell, impl->xdg_popup = xdg_shell_get_xdg_popup (display->xdg_shell,
impl->surface, impl->surface,
parent_impl->surface, parent_impl->surface,
seat, seat,
@ -1607,18 +1606,6 @@ gdk_wayland_window_set_geometry_hints (GdkWindow *window,
impl->geometry_hints = *geometry; impl->geometry_hints = *geometry;
impl->geometry_mask = geom_mask; impl->geometry_mask = geom_mask;
/*
* GDK_HINT_POS
* GDK_HINT_USER_POS
* GDK_HINT_USER_SIZE
* GDK_HINT_MIN_SIZE
* GDK_HINT_MAX_SIZE
* GDK_HINT_BASE_SIZE
* GDK_HINT_RESIZE_INC
* GDK_HINT_ASPECT
* GDK_HINT_WIN_GRAVITY
*/
} }
static void static void
@ -1831,9 +1818,6 @@ static void
gdk_wayland_window_set_group (GdkWindow *window, gdk_wayland_window_set_group (GdkWindow *window,
GdkWindow *leader) GdkWindow *leader)
{ {
g_return_if_fail (GDK_IS_WINDOW (window));
g_return_if_fail (GDK_WINDOW_TYPE (window) != GDK_WINDOW_CHILD);
g_return_if_fail (leader == NULL || GDK_IS_WINDOW (leader));
} }
static void static void
@ -2253,10 +2237,10 @@ _gdk_wayland_window_set_device_grabbed (GdkWindow *window,
} }
/** /**
* gdk_wayland_window_get_wl_surface * gdk_wayland_window_get_wl_surface:
* @window: (type GdkWaylandWindow): a #GdkWindow * @window: (type GdkWaylandWindow): a #GdkWindow
* *
* Returns the Wayland surface of a #GdkWindow * Returns the Wayland surface of a #GdkWindow.
* *
* Returns: (transfer none): a Wayland wl_surface * Returns: (transfer none): a Wayland wl_surface
* *
@ -2265,30 +2249,22 @@ _gdk_wayland_window_set_device_grabbed (GdkWindow *window,
struct wl_surface * struct wl_surface *
gdk_wayland_window_get_wl_surface (GdkWindow *window) gdk_wayland_window_get_wl_surface (GdkWindow *window)
{ {
GdkWindowImplWayland *impl;
g_return_val_if_fail (GDK_IS_WAYLAND_WINDOW (window), NULL); g_return_val_if_fail (GDK_IS_WAYLAND_WINDOW (window), NULL);
impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); return GDK_WINDOW_IMPL_WAYLAND (window->impl)->surface;
return impl->surface;
} }
static struct wl_egl_window * static struct wl_egl_window *
gdk_wayland_window_get_wl_egl_window (GdkWindow *window) gdk_wayland_window_get_wl_egl_window (GdkWindow *window)
{ {
GdkWindowImplWayland *impl; GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
g_return_val_if_fail (GDK_IS_WAYLAND_WINDOW (window), NULL);
impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
if (impl->egl_window == NULL) if (impl->egl_window == NULL)
{ {
impl->egl_window = impl->egl_window =
wl_egl_window_create(impl->surface, wl_egl_window_create (impl->surface,
impl->wrapper->width * impl->scale, impl->wrapper->width * impl->scale,
impl->wrapper->height * impl->scale); impl->wrapper->height * impl->scale);
wl_surface_set_buffer_scale (impl->surface, impl->scale); wl_surface_set_buffer_scale (impl->surface, impl->scale);
} }
@ -2297,9 +2273,9 @@ gdk_wayland_window_get_wl_egl_window (GdkWindow *window)
EGLSurface EGLSurface
gdk_wayland_window_get_egl_surface (GdkWindow *window, gdk_wayland_window_get_egl_surface (GdkWindow *window,
EGLConfig config) EGLConfig config)
{ {
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (gdk_window_get_display (window)); GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (gdk_window_get_display (window));
GdkWindowImplWayland *impl; GdkWindowImplWayland *impl;
struct wl_egl_window *egl_window; struct wl_egl_window *egl_window;
@ -2312,8 +2288,7 @@ gdk_wayland_window_get_egl_surface (GdkWindow *window,
egl_window = gdk_wayland_window_get_wl_egl_window (window); egl_window = gdk_wayland_window_get_wl_egl_window (window);
impl->egl_surface = impl->egl_surface =
eglCreateWindowSurface (display_wayland->egl_display, eglCreateWindowSurface (display->egl_display, config, egl_window, NULL);
config, egl_window, NULL);
} }
return impl->egl_surface; return impl->egl_surface;
@ -2321,9 +2296,9 @@ gdk_wayland_window_get_egl_surface (GdkWindow *window,
EGLSurface EGLSurface
gdk_wayland_window_get_dummy_egl_surface (GdkWindow *window, gdk_wayland_window_get_dummy_egl_surface (GdkWindow *window,
EGLConfig config) EGLConfig config)
{ {
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (gdk_window_get_display (window)); GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (gdk_window_get_display (window));
GdkWindowImplWayland *impl; GdkWindowImplWayland *impl;
g_return_val_if_fail (GDK_IS_WAYLAND_WINDOW (window), NULL); g_return_val_if_fail (GDK_IS_WAYLAND_WINDOW (window), NULL);
@ -2336,8 +2311,7 @@ gdk_wayland_window_get_dummy_egl_surface (GdkWindow *window,
wl_egl_window_create (impl->surface, 1, 1); wl_egl_window_create (impl->surface, 1, 1);
impl->dummy_egl_surface = impl->dummy_egl_surface =
eglCreateWindowSurface (display_wayland->egl_display, eglCreateWindowSurface (display->egl_display, config, impl->dummy_egl_window, NULL);
config, impl->dummy_egl_window, NULL);
} }
return impl->dummy_egl_surface; return impl->dummy_egl_surface;
@ -2412,7 +2386,7 @@ gdk_wayland_window_set_dbus_properties_libgtk_only (GdkWindow *window,
const char *application_object_path, const char *application_object_path,
const char *unique_bus_name) const char *unique_bus_name)
{ {
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (gdk_window_get_display (window)); GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (gdk_window_get_display (window));
GdkWindowImplWayland *impl; GdkWindowImplWayland *impl;
g_return_if_fail (GDK_IS_WAYLAND_WINDOW (window)); g_return_if_fail (GDK_IS_WAYLAND_WINDOW (window));
@ -2423,10 +2397,11 @@ gdk_wayland_window_set_dbus_properties_libgtk_only (GdkWindow *window,
{ {
if (impl->xdg_surface == NULL) if (impl->xdg_surface == NULL)
return; return;
if (display_wayland->gtk_shell == NULL)
if (display->gtk_shell == NULL)
return; return;
impl->gtk_surface = gtk_shell_get_gtk_surface (display_wayland->gtk_shell, impl->surface); impl->gtk_surface = gtk_shell_get_gtk_surface (display->gtk_shell, impl->surface);
} }
gtk_surface_set_dbus_properties (impl->gtk_surface, gtk_surface_set_dbus_properties (impl->gtk_surface,