wayland: move server proxy objects to substructure

This commit moves the server proxy objects to a substructure
for clarity.

https://bugzilla.gnome.org/show_bug.cgi?id=761312
This commit is contained in:
Ray Strode
2016-02-02 11:42:52 -05:00
parent f90db30b9e
commit 3ac78ea0be

View File

@ -95,21 +95,20 @@ struct _GdkWindowImplWayland
GdkWindow *wrapper; GdkWindow *wrapper;
struct {
/* The wl_outputs that this window currently touches */ /* The wl_outputs that this window currently touches */
GSList *outputs; GSList *outputs;
struct wl_surface *wl_surface; struct wl_surface *wl_surface;
struct xdg_surface *xdg_surface; struct xdg_surface *xdg_surface;
struct xdg_popup *xdg_popup; struct xdg_popup *xdg_popup;
struct gtk_surface *gtk_surface; struct gtk_surface *gtk_surface;
struct wl_subsurface *wl_subsurface; struct wl_subsurface *wl_subsurface;
struct wl_egl_window *egl_window; struct wl_egl_window *egl_window;
EGLSurface egl_surface;
struct wl_egl_window *dummy_egl_window; struct wl_egl_window *dummy_egl_window;
} display_server;
EGLSurface egl_surface;
EGLSurface dummy_egl_surface; EGLSurface dummy_egl_surface;
unsigned int mapped : 1; unsigned int mapped : 1;
@ -219,13 +218,13 @@ gdk_wayland_window_update_size (GdkWindow *window,
window->height = height; window->height = height;
impl->scale = scale; impl->scale = scale;
if (impl->egl_window) if (impl->display_server.egl_window)
{ {
wl_egl_window_resize (impl->egl_window, wl_egl_window_resize (impl->display_server.egl_window,
width * scale, width * scale,
height * scale, height * scale,
0, 0); 0, 0);
wl_surface_set_buffer_scale (impl->wl_surface, scale); wl_surface_set_buffer_scale (impl->display_server.wl_surface, scale);
} }
area.x = 0; area.x = 0;
@ -374,12 +373,12 @@ frame_callback (void *data,
return; return;
timings->refresh_interval = 16667; /* default to 1/60th of a second */ timings->refresh_interval = 16667; /* default to 1/60th of a second */
if (impl->outputs) if (impl->display_server.outputs)
{ {
/* We pick a random output out of the outputs that the window touches /* We pick a random output out of the outputs that the window touches
* The rate here is in milli-hertz */ * The rate here is in milli-hertz */
int refresh_rate = _gdk_wayland_screen_get_output_refresh_rate (wayland_display->screen, int refresh_rate = _gdk_wayland_screen_get_output_refresh_rate (wayland_display->screen,
impl->outputs->data); impl->display_server.outputs->data);
if (refresh_rate != 0) if (refresh_rate != 0)
timings->refresh_interval = G_GINT64_CONSTANT(1000000000) / refresh_rate; timings->refresh_interval = G_GINT64_CONSTANT(1000000000) / refresh_rate;
} }
@ -442,11 +441,11 @@ on_frame_clock_after_paint (GdkFrameClock *clock,
impl->pending_frame_counter = gdk_frame_clock_get_frame_counter (clock); impl->pending_frame_counter = gdk_frame_clock_get_frame_counter (clock);
impl->awaiting_frame = TRUE; impl->awaiting_frame = TRUE;
callback = wl_surface_frame (impl->wl_surface); callback = wl_surface_frame (impl->display_server.wl_surface);
wl_callback_add_listener (callback, &frame_listener, window); wl_callback_add_listener (callback, &frame_listener, window);
_gdk_frame_clock_freeze (clock); _gdk_frame_clock_freeze (clock);
wl_surface_commit (impl->wl_surface); wl_surface_commit (impl->display_server.wl_surface);
if (_gdk_wayland_is_shm_surface (impl->cairo_surface)) if (_gdk_wayland_is_shm_surface (impl->cairo_surface))
_gdk_wayland_shm_surface_set_busy (impl->cairo_surface); _gdk_wayland_shm_surface_set_busy (impl->cairo_surface);
@ -468,7 +467,7 @@ window_update_scale (GdkWindow *window)
} }
scale = 1; scale = 1;
for (l = impl->outputs; l != NULL; l = l->next) for (l = impl->display_server.outputs; l != NULL; l = l->next)
{ {
guint32 output_scale = guint32 output_scale =
_gdk_wayland_screen_get_output_scale (wayland_display->screen, l->data); _gdk_wayland_screen_get_output_scale (wayland_display->screen, l->data);
@ -572,7 +571,7 @@ gdk_wayland_window_attach_image (GdkWindow *window)
g_assert (_gdk_wayland_is_shm_surface (impl->cairo_surface)); g_assert (_gdk_wayland_is_shm_surface (impl->cairo_surface));
/* Attach this new buffer to the surface */ /* Attach this new buffer to the surface */
wl_surface_attach (impl->wl_surface, wl_surface_attach (impl->display_server.wl_surface,
_gdk_wayland_shm_surface_get_wl_buffer (impl->cairo_surface), _gdk_wayland_shm_surface_get_wl_buffer (impl->cairo_surface),
impl->pending_buffer_offset_x, impl->pending_buffer_offset_x,
impl->pending_buffer_offset_y); impl->pending_buffer_offset_y);
@ -582,7 +581,7 @@ gdk_wayland_window_attach_image (GdkWindow *window)
/* Only set the buffer scale if supported by the compositor */ /* Only set the buffer scale if supported by the compositor */
display = GDK_WAYLAND_DISPLAY (gdk_window_get_display (window)); display = GDK_WAYLAND_DISPLAY (gdk_window_get_display (window));
if (display->compositor_version >= WL_SURFACE_HAS_BUFFER_SCALE) if (display->compositor_version >= WL_SURFACE_HAS_BUFFER_SCALE)
wl_surface_set_buffer_scale (impl->wl_surface, impl->scale); wl_surface_set_buffer_scale (impl->display_server.wl_surface, impl->scale);
impl->pending_commit = TRUE; impl->pending_commit = TRUE;
} }
@ -593,7 +592,7 @@ gdk_wayland_window_ensure_cairo_surface (GdkWindow *window)
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
/* If we are drawing using OpenGL then we only need a logical 1x1 surface. */ /* If we are drawing using OpenGL then we only need a logical 1x1 surface. */
if (impl->egl_window) if (impl->display_server.egl_window)
{ {
if (impl->cairo_surface && if (impl->cairo_surface &&
_gdk_wayland_is_shm_surface (impl->cairo_surface)) _gdk_wayland_is_shm_surface (impl->cairo_surface))
@ -671,7 +670,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->wl_surface, rect.x, rect.y, rect.width, rect.height); wl_surface_damage (impl->display_server.wl_surface, rect.x, rect.y, rect.width, rect.height);
impl->pending_commit = TRUE; impl->pending_commit = TRUE;
} }
} }
@ -731,7 +730,7 @@ gdk_wayland_window_sync_parent (GdkWindow *window,
GdkWindowImplWayland *impl_parent = NULL; GdkWindowImplWayland *impl_parent = NULL;
struct xdg_surface *parent_surface; struct xdg_surface *parent_surface;
if (!impl->xdg_surface) if (!impl->display_server.xdg_surface)
return; return;
if (impl->transient_for) if (impl->transient_for)
@ -742,15 +741,15 @@ gdk_wayland_window_sync_parent (GdkWindow *window,
if (impl_parent) if (impl_parent)
{ {
/* XXX: Is this correct? */ /* XXX: Is this correct? */
if (!impl_parent->wl_surface) if (!impl_parent->display_server.wl_surface)
return; return;
parent_surface = impl_parent->xdg_surface; parent_surface = impl_parent->display_server.xdg_surface;
} }
else else
parent_surface = NULL; parent_surface = NULL;
xdg_surface_set_parent (impl->xdg_surface, parent_surface); xdg_surface_set_parent (impl->display_server.xdg_surface, parent_surface);
} }
static void static void
@ -783,13 +782,13 @@ gdk_wayland_window_sync_title (GdkWindow *window)
{ {
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
if (!impl->xdg_surface) if (!impl->display_server.xdg_surface)
return; return;
if (!impl->title) if (!impl->title)
return; return;
xdg_surface_set_title (impl->xdg_surface, impl->title); xdg_surface_set_title (impl->display_server.xdg_surface, impl->title);
} }
static void static void
@ -798,7 +797,7 @@ gdk_wayland_window_sync_margin (GdkWindow *window)
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
gint x, y, width, height; gint x, y, width, height;
if (!impl->xdg_surface) if (!impl->display_server.xdg_surface)
return; return;
x = impl->margin_left; x = impl->margin_left;
@ -806,7 +805,7 @@ gdk_wayland_window_sync_margin (GdkWindow *window)
width = window->width - (impl->margin_left + impl->margin_right); width = window->width - (impl->margin_left + impl->margin_right);
height = window->height - (impl->margin_top + impl->margin_bottom); height = window->height - (impl->margin_top + impl->margin_bottom);
xdg_surface_set_window_geometry (impl->xdg_surface, x, y, width, height); xdg_surface_set_window_geometry (impl->display_server.xdg_surface, x, y, width, height);
} }
static struct wl_region * static struct wl_region *
@ -837,14 +836,14 @@ gdk_wayland_window_sync_opaque_region (GdkWindow *window)
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
struct wl_region *wl_region = NULL; struct wl_region *wl_region = NULL;
if (!impl->wl_surface) if (!impl->display_server.wl_surface)
return; return;
if (impl->opaque_region != NULL) if (impl->opaque_region != NULL)
wl_region = wl_region_from_cairo_region (GDK_WAYLAND_DISPLAY (gdk_window_get_display (window)), wl_region = wl_region_from_cairo_region (GDK_WAYLAND_DISPLAY (gdk_window_get_display (window)),
impl->opaque_region); impl->opaque_region);
wl_surface_set_opaque_region (impl->wl_surface, wl_region); wl_surface_set_opaque_region (impl->display_server.wl_surface, wl_region);
if (wl_region != NULL) if (wl_region != NULL)
wl_region_destroy (wl_region); wl_region_destroy (wl_region);
@ -856,14 +855,14 @@ gdk_wayland_window_sync_input_region (GdkWindow *window)
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
struct wl_region *wl_region = NULL; struct wl_region *wl_region = NULL;
if (!impl->wl_surface) if (!impl->display_server.wl_surface)
return; return;
if (impl->input_region != NULL) if (impl->input_region != NULL)
wl_region = wl_region_from_cairo_region (GDK_WAYLAND_DISPLAY (gdk_window_get_display (window)), wl_region = wl_region_from_cairo_region (GDK_WAYLAND_DISPLAY (gdk_window_get_display (window)),
impl->input_region); impl->input_region);
wl_surface_set_input_region (impl->wl_surface, wl_region); wl_surface_set_input_region (impl->display_server.wl_surface, wl_region);
if (wl_region != NULL) if (wl_region != NULL)
wl_region_destroy (wl_region); wl_region_destroy (wl_region);
@ -880,7 +879,7 @@ surface_enter (void *data,
GDK_NOTE (EVENTS, GDK_NOTE (EVENTS,
g_message ("surface enter, window %p output %p", window, output)); g_message ("surface enter, window %p output %p", window, output));
impl->outputs = g_slist_prepend (impl->outputs, output); impl->display_server.outputs = g_slist_prepend (impl->display_server.outputs, output);
window_update_scale (window); window_update_scale (window);
} }
@ -896,7 +895,7 @@ surface_leave (void *data,
GDK_NOTE (EVENTS, GDK_NOTE (EVENTS,
g_message ("surface leave, window %p output %p", window, output)); g_message ("surface leave, window %p output %p", window, output));
impl->outputs = g_slist_remove (impl->outputs, output); impl->display_server.outputs = g_slist_remove (impl->display_server.outputs, output);
window_update_scale (window); window_update_scale (window);
} }
@ -916,7 +915,7 @@ on_parent_surface_committed (GdkWindowImplWayland *parent_impl,
(gpointer) on_parent_surface_committed, (gpointer) on_parent_surface_committed,
window); window);
wl_subsurface_set_desync (impl->wl_subsurface); wl_subsurface_set_desync (impl->display_server.wl_subsurface);
} }
static void static void
@ -927,10 +926,10 @@ gdk_wayland_window_create_subsurface (GdkWindow *window)
impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
if (!impl->wl_surface) if (!impl->display_server.wl_surface)
return; /* Bail out, surface and subsurface will be created later when shown */ return; /* Bail out, surface and subsurface will be created later when shown */
if (impl->wl_subsurface) if (impl->display_server.wl_subsurface)
return; return;
if (impl->transient_for) if (impl->transient_for)
@ -939,10 +938,10 @@ gdk_wayland_window_create_subsurface (GdkWindow *window)
if (parent_impl) if (parent_impl)
{ {
display_wayland = GDK_WAYLAND_DISPLAY (gdk_window_get_display (window)); display_wayland = GDK_WAYLAND_DISPLAY (gdk_window_get_display (window));
impl->wl_subsurface = impl->display_server.wl_subsurface =
wl_subcompositor_get_subsurface (display_wayland->subcompositor, wl_subcompositor_get_subsurface (display_wayland->subcompositor,
impl->wl_surface, parent_impl->wl_surface); impl->display_server.wl_surface, parent_impl->display_server.wl_surface);
wl_subsurface_set_position (impl->wl_subsurface, window->x, window->y); wl_subsurface_set_position (impl->display_server.wl_subsurface, window->x, window->y);
/* In order to synchronize the initial position with the initial frame /* In order to synchronize the initial position with the initial frame
* content, wait with making the subsurface desynchronized until after * content, wait with making the subsurface desynchronized until after
@ -961,8 +960,8 @@ gdk_wayland_window_create_surface (GdkWindow *window)
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (gdk_window_get_display (window)); GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (gdk_window_get_display (window));
impl->wl_surface = wl_compositor_create_surface (display_wayland->compositor); impl->display_server.wl_surface = wl_compositor_create_surface (display_wayland->compositor);
wl_surface_add_listener (impl->wl_surface, &surface_listener, window); wl_surface_add_listener (impl->display_server.wl_surface, &surface_listener, window);
gdk_wayland_window_sync_opaque_region (window); gdk_wayland_window_sync_opaque_region (window);
gdk_wayland_window_sync_input_region (window); gdk_wayland_window_sync_input_region (window);
@ -1072,23 +1071,23 @@ gdk_wayland_window_create_xdg_surface (GdkWindow *window)
impl->initial_fullscreen_monitor < gdk_screen_get_n_monitors (screen)) impl->initial_fullscreen_monitor < gdk_screen_get_n_monitors (screen))
fullscreen_output = _gdk_wayland_screen_get_wl_output (screen, impl->initial_fullscreen_monitor); fullscreen_output = _gdk_wayland_screen_get_wl_output (screen, impl->initial_fullscreen_monitor);
impl->xdg_surface = xdg_shell_get_xdg_surface (display_wayland->xdg_shell, impl->wl_surface); impl->display_server.xdg_surface = xdg_shell_get_xdg_surface (display_wayland->xdg_shell, impl->display_server.wl_surface);
xdg_surface_add_listener (impl->xdg_surface, &xdg_surface_listener, window); xdg_surface_add_listener (impl->display_server.xdg_surface, &xdg_surface_listener, window);
gdk_wayland_window_sync_parent (window, NULL); gdk_wayland_window_sync_parent (window, NULL);
gdk_wayland_window_sync_title (window); gdk_wayland_window_sync_title (window);
gdk_wayland_window_sync_margin (window); gdk_wayland_window_sync_margin (window);
if (window->state & GDK_WINDOW_STATE_MAXIMIZED) if (window->state & GDK_WINDOW_STATE_MAXIMIZED)
xdg_surface_set_maximized (impl->xdg_surface); xdg_surface_set_maximized (impl->display_server.xdg_surface);
if (window->state & GDK_WINDOW_STATE_FULLSCREEN) if (window->state & GDK_WINDOW_STATE_FULLSCREEN)
xdg_surface_set_fullscreen (impl->xdg_surface, fullscreen_output); xdg_surface_set_fullscreen (impl->display_server.xdg_surface, fullscreen_output);
app_id = g_get_prgname (); app_id = g_get_prgname ();
if (app_id == NULL) if (app_id == NULL)
app_id = gdk_get_program_class (); app_id = gdk_get_program_class ();
xdg_surface_set_app_id (impl->xdg_surface, app_id); xdg_surface_set_app_id (impl->display_server.xdg_surface, app_id);
maybe_set_gtk_surface_dbus_properties (window); maybe_set_gtk_surface_dbus_properties (window);
maybe_set_gtk_surface_modal (window); maybe_set_gtk_surface_modal (window);
@ -1181,10 +1180,10 @@ gdk_wayland_window_create_xdg_popup (GdkWindow *window,
int x, y; int x, y;
int parent_x, parent_y; int parent_x, parent_y;
if (!impl->wl_surface) if (!impl->display_server.wl_surface)
return; return;
if (!parent_impl->wl_surface) if (!parent_impl->display_server.wl_surface)
return; return;
gdk_seat = gdk_display_get_default_seat (GDK_DISPLAY (display)); gdk_seat = gdk_display_get_default_seat (GDK_DISPLAY (display));
@ -1195,14 +1194,14 @@ gdk_wayland_window_create_xdg_popup (GdkWindow *window,
x = window->x - parent_x; x = window->x - parent_x;
y = window->y - parent_y; y = window->y - parent_y;
impl->xdg_popup = xdg_shell_get_xdg_popup (display->xdg_shell, impl->display_server.xdg_popup = xdg_shell_get_xdg_popup (display->xdg_shell,
impl->wl_surface, impl->display_server.wl_surface,
parent_impl->wl_surface, parent_impl->display_server.wl_surface,
seat, seat,
_gdk_wayland_device_get_last_implicit_grab_serial (device, NULL), _gdk_wayland_device_get_last_implicit_grab_serial (device, NULL),
x, y); x, y);
xdg_popup_add_listener (impl->xdg_popup, &xdg_popup_listener, window); xdg_popup_add_listener (impl->display_server.xdg_popup, &xdg_popup_listener, window);
} }
static struct wl_seat * static struct wl_seat *
@ -1356,7 +1355,7 @@ get_popup_parent (GdkWindow *window)
{ {
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
if (impl->xdg_popup || impl->xdg_surface) if (impl->display_server.xdg_popup || impl->display_server.xdg_surface)
return window; return window;
window = impl->transient_for; window = impl->transient_for;
@ -1487,7 +1486,7 @@ gdk_wayland_window_show (GdkWindow *window,
{ {
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
if (!impl->wl_surface) if (!impl->display_server.wl_surface)
gdk_wayland_window_create_surface (window); gdk_wayland_window_create_surface (window);
gdk_wayland_window_map (window); gdk_wayland_window_map (window);
@ -1505,15 +1504,15 @@ unmap_subsurface (GdkWindow *window)
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
GdkWindowImplWayland *parent_impl; GdkWindowImplWayland *parent_impl;
g_return_if_fail (impl->wl_subsurface); g_return_if_fail (impl->display_server.wl_subsurface);
g_return_if_fail (impl->transient_for); g_return_if_fail (impl->transient_for);
parent_impl = GDK_WINDOW_IMPL_WAYLAND (impl->transient_for->impl); parent_impl = GDK_WINDOW_IMPL_WAYLAND (impl->transient_for->impl);
wl_subsurface_destroy (impl->wl_subsurface); wl_subsurface_destroy (impl->display_server.wl_subsurface);
g_signal_handlers_disconnect_by_func (parent_impl, g_signal_handlers_disconnect_by_func (parent_impl,
(gpointer) on_parent_surface_committed, (gpointer) on_parent_surface_committed,
window); window);
impl->wl_subsurface = NULL; impl->display_server.wl_subsurface = NULL;
} }
static void static void
@ -1522,7 +1521,7 @@ gdk_wayland_window_hide_surface (GdkWindow *window)
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (gdk_window_get_display (window)); GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (gdk_window_get_display (window));
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
if (impl->wl_surface) if (impl->display_server.wl_surface)
{ {
if (impl->dummy_egl_surface) if (impl->dummy_egl_surface)
{ {
@ -1530,10 +1529,10 @@ gdk_wayland_window_hide_surface (GdkWindow *window)
impl->dummy_egl_surface = NULL; impl->dummy_egl_surface = NULL;
} }
if (impl->dummy_egl_window) if (impl->display_server.dummy_egl_window)
{ {
wl_egl_window_destroy (impl->dummy_egl_window); wl_egl_window_destroy (impl->display_server.dummy_egl_window);
impl->dummy_egl_window = NULL; impl->display_server.dummy_egl_window = NULL;
} }
if (impl->egl_surface) if (impl->egl_surface)
@ -1542,24 +1541,24 @@ gdk_wayland_window_hide_surface (GdkWindow *window)
impl->egl_surface = NULL; impl->egl_surface = NULL;
} }
if (impl->egl_window) if (impl->display_server.egl_window)
{ {
wl_egl_window_destroy (impl->egl_window); wl_egl_window_destroy (impl->display_server.egl_window);
impl->egl_window = NULL; impl->display_server.egl_window = NULL;
} }
if (impl->xdg_surface) if (impl->display_server.xdg_surface)
{ {
xdg_surface_destroy (impl->xdg_surface); xdg_surface_destroy (impl->display_server.xdg_surface);
impl->xdg_surface = NULL; impl->display_server.xdg_surface = NULL;
} }
else if (impl->xdg_popup) else if (impl->display_server.xdg_popup)
{ {
xdg_popup_destroy (impl->xdg_popup); xdg_popup_destroy (impl->display_server.xdg_popup);
impl->xdg_popup = NULL; impl->display_server.xdg_popup = NULL;
} }
if (impl->wl_subsurface) if (impl->display_server.wl_subsurface)
unmap_subsurface (window); unmap_subsurface (window);
if (impl->awaiting_frame) if (impl->awaiting_frame)
@ -1572,17 +1571,17 @@ gdk_wayland_window_hide_surface (GdkWindow *window)
_gdk_frame_clock_thaw (frame_clock); _gdk_frame_clock_thaw (frame_clock);
} }
if (impl->gtk_surface) if (impl->display_server.gtk_surface)
{ {
gtk_surface_destroy (impl->gtk_surface); gtk_surface_destroy (impl->display_server.gtk_surface);
impl->gtk_surface = NULL; impl->display_server.gtk_surface = NULL;
} }
wl_surface_destroy (impl->wl_surface); wl_surface_destroy (impl->display_server.wl_surface);
impl->wl_surface = NULL; impl->display_server.wl_surface = NULL;
g_slist_free (impl->outputs); g_slist_free (impl->display_server.outputs);
impl->outputs = NULL; impl->display_server.outputs = NULL;
if (impl->hint == GDK_WINDOW_TYPE_HINT_DIALOG && !impl->transient_for) if (impl->hint == GDK_WINDOW_TYPE_HINT_DIALOG && !impl->transient_for)
orphan_dialogs = g_list_remove (orphan_dialogs, window); orphan_dialogs = g_list_remove (orphan_dialogs, window);
@ -1665,7 +1664,7 @@ gdk_window_request_transient_parent_commit (GdkWindow *window)
impl = GDK_WINDOW_IMPL_WAYLAND (window_impl->transient_for->impl); impl = GDK_WINDOW_IMPL_WAYLAND (window_impl->transient_for->impl);
if (!impl->wl_surface || impl->pending_commit) if (!impl->display_server.wl_surface || impl->pending_commit)
return; return;
frame_clock = gdk_window_get_frame_clock (window_impl->transient_for); frame_clock = gdk_window_get_frame_clock (window_impl->transient_for);
@ -1697,9 +1696,9 @@ gdk_window_wayland_move_resize (GdkWindow *window,
window->y = y; window->y = y;
impl->position_set = 1; impl->position_set = 1;
if (impl->wl_subsurface) if (impl->display_server.wl_subsurface)
{ {
wl_subsurface_set_position (impl->wl_subsurface, x, y); wl_subsurface_set_position (impl->display_server.wl_subsurface, x, y);
gdk_window_request_transient_parent_commit (window); gdk_window_request_transient_parent_commit (window);
} }
} }
@ -1915,15 +1914,15 @@ gdk_wayland_window_init_gtk_surface (GdkWindow *window)
GdkWaylandDisplay *display = GdkWaylandDisplay *display =
GDK_WAYLAND_DISPLAY (gdk_window_get_display (window)); GDK_WAYLAND_DISPLAY (gdk_window_get_display (window));
if (impl->gtk_surface != NULL) if (impl->display_server.gtk_surface != NULL)
return; return;
if (impl->xdg_surface == NULL) if (impl->display_server.xdg_surface == NULL)
return; return;
if (display->gtk_shell == NULL) if (display->gtk_shell == NULL)
return; return;
impl->gtk_surface = gtk_shell_get_gtk_surface (display->gtk_shell, impl->display_server.gtk_surface = gtk_shell_get_gtk_surface (display->gtk_shell,
impl->wl_surface); impl->display_server.wl_surface);
} }
static void static void
@ -1932,13 +1931,13 @@ maybe_set_gtk_surface_modal (GdkWindow *window)
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
gdk_wayland_window_init_gtk_surface (window); gdk_wayland_window_init_gtk_surface (window);
if (impl->gtk_surface == NULL) if (impl->display_server.gtk_surface == NULL)
return; return;
if (window->modal_hint) if (window->modal_hint)
gtk_surface_set_modal (impl->gtk_surface); gtk_surface_set_modal (impl->display_server.gtk_surface);
else else
gtk_surface_unset_modal (impl->gtk_surface); gtk_surface_unset_modal (impl->display_server.gtk_surface);
} }
@ -2043,7 +2042,7 @@ gdk_wayland_window_set_transient_for (GdkWindow *window,
return; return;
} }
if (impl->wl_subsurface) if (impl->display_server.wl_subsurface)
unmap_subsurface (window); unmap_subsurface (window);
previous_parent = impl->transient_for; previous_parent = impl->transient_for;
@ -2112,10 +2111,10 @@ gdk_wayland_window_iconify (GdkWindow *window)
!WINDOW_IS_TOPLEVEL_OR_FOREIGN (window)) !WINDOW_IS_TOPLEVEL_OR_FOREIGN (window))
return; return;
if (!impl->xdg_surface) if (!impl->display_server.xdg_surface)
return; return;
xdg_surface_set_minimized (impl->xdg_surface); xdg_surface_set_minimized (impl->display_server.xdg_surface);
} }
static void static void
@ -2150,8 +2149,8 @@ gdk_wayland_window_maximize (GdkWindow *window)
if (GDK_WINDOW_DESTROYED (window)) if (GDK_WINDOW_DESTROYED (window))
return; return;
if (impl->xdg_surface) if (impl->display_server.xdg_surface)
xdg_surface_set_maximized (impl->xdg_surface); xdg_surface_set_maximized (impl->display_server.xdg_surface);
else else
gdk_synthesize_window_state (window, 0, GDK_WINDOW_STATE_MAXIMIZED); gdk_synthesize_window_state (window, 0, GDK_WINDOW_STATE_MAXIMIZED);
} }
@ -2164,8 +2163,8 @@ gdk_wayland_window_unmaximize (GdkWindow *window)
if (GDK_WINDOW_DESTROYED (window)) if (GDK_WINDOW_DESTROYED (window))
return; return;
if (impl->xdg_surface) if (impl->display_server.xdg_surface)
xdg_surface_unset_maximized (impl->xdg_surface); xdg_surface_unset_maximized (impl->display_server.xdg_surface);
else else
gdk_synthesize_window_state (window, GDK_WINDOW_STATE_MAXIMIZED, 0); gdk_synthesize_window_state (window, GDK_WINDOW_STATE_MAXIMIZED, 0);
} }
@ -2181,8 +2180,8 @@ gdk_wayland_window_fullscreen_on_monitor (GdkWindow *window, gint monitor)
if (GDK_WINDOW_DESTROYED (window)) if (GDK_WINDOW_DESTROYED (window))
return; return;
if (impl->xdg_surface) if (impl->display_server.xdg_surface)
xdg_surface_set_fullscreen (impl->xdg_surface, fullscreen_output); xdg_surface_set_fullscreen (impl->display_server.xdg_surface, fullscreen_output);
else { else {
gdk_synthesize_window_state (window, 0, GDK_WINDOW_STATE_FULLSCREEN); gdk_synthesize_window_state (window, 0, GDK_WINDOW_STATE_FULLSCREEN);
impl->initial_fullscreen_monitor = monitor; impl->initial_fullscreen_monitor = monitor;
@ -2199,8 +2198,8 @@ gdk_wayland_window_fullscreen (GdkWindow *window)
impl->initial_fullscreen_monitor = -1; impl->initial_fullscreen_monitor = -1;
if (impl->xdg_surface) if (impl->display_server.xdg_surface)
xdg_surface_set_fullscreen (impl->xdg_surface, NULL); xdg_surface_set_fullscreen (impl->display_server.xdg_surface, NULL);
else else
gdk_synthesize_window_state (window, 0, GDK_WINDOW_STATE_FULLSCREEN); gdk_synthesize_window_state (window, 0, GDK_WINDOW_STATE_FULLSCREEN);
} }
@ -2215,8 +2214,8 @@ gdk_wayland_window_unfullscreen (GdkWindow *window)
impl->initial_fullscreen_monitor = -1; impl->initial_fullscreen_monitor = -1;
if (impl->xdg_surface) if (impl->display_server.xdg_surface)
xdg_surface_unset_fullscreen (impl->xdg_surface); xdg_surface_unset_fullscreen (impl->display_server.xdg_surface);
else else
gdk_synthesize_window_state (window, GDK_WINDOW_STATE_FULLSCREEN, 0); gdk_synthesize_window_state (window, GDK_WINDOW_STATE_FULLSCREEN, 0);
} }
@ -2320,13 +2319,13 @@ gdk_wayland_window_begin_resize_drag (GdkWindow *window,
impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
if (!impl->xdg_surface) if (!impl->display_server.xdg_surface)
return; return;
serial = _gdk_wayland_device_get_last_implicit_grab_serial (GDK_WAYLAND_DEVICE (device), serial = _gdk_wayland_device_get_last_implicit_grab_serial (GDK_WAYLAND_DEVICE (device),
&sequence); &sequence);
xdg_surface_resize (impl->xdg_surface, xdg_surface_resize (impl->display_server.xdg_surface,
gdk_wayland_device_get_wl_seat (device), gdk_wayland_device_get_wl_seat (device),
serial, resize_edges); serial, resize_edges);
@ -2357,12 +2356,12 @@ gdk_wayland_window_begin_move_drag (GdkWindow *window,
impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
if (!impl->xdg_surface) if (!impl->display_server.xdg_surface)
return; return;
serial = _gdk_wayland_device_get_last_implicit_grab_serial (GDK_WAYLAND_DEVICE (device), serial = _gdk_wayland_device_get_last_implicit_grab_serial (GDK_WAYLAND_DEVICE (device),
&sequence); &sequence);
xdg_surface_move (impl->xdg_surface, xdg_surface_move (impl->display_server.xdg_surface,
gdk_wayland_device_get_wl_seat (device), gdk_wayland_device_get_wl_seat (device),
serial); serial);
if (sequence) if (sequence)
@ -2533,14 +2532,14 @@ gdk_wayland_window_show_window_menu (GdkWindow *window,
return FALSE; return FALSE;
} }
if (!impl->xdg_surface) if (!impl->display_server.xdg_surface)
return FALSE; return FALSE;
device = GDK_WAYLAND_DEVICE (gdk_event_get_device (event)); device = GDK_WAYLAND_DEVICE (gdk_event_get_device (event));
seat = gdk_wayland_device_get_wl_seat (GDK_DEVICE (device)); seat = gdk_wayland_device_get_wl_seat (GDK_DEVICE (device));
gdk_event_get_coords (event, &x, &y); gdk_event_get_coords (event, &x, &y);
xdg_surface_show_window_menu (impl->xdg_surface, xdg_surface_show_window_menu (impl->display_server.xdg_surface,
seat, seat,
_gdk_wayland_device_get_implicit_grab_serial (device, event), _gdk_wayland_device_get_implicit_grab_serial (device, event),
x, y); x, y);
@ -2673,7 +2672,7 @@ gdk_wayland_window_get_wl_surface (GdkWindow *window)
{ {
g_return_val_if_fail (GDK_IS_WAYLAND_WINDOW (window), NULL); g_return_val_if_fail (GDK_IS_WAYLAND_WINDOW (window), NULL);
return GDK_WINDOW_IMPL_WAYLAND (window->impl)->wl_surface; return GDK_WINDOW_IMPL_WAYLAND (window->impl)->display_server.wl_surface;
} }
static struct wl_egl_window * static struct wl_egl_window *
@ -2681,16 +2680,16 @@ gdk_wayland_window_get_wl_egl_window (GdkWindow *window)
{ {
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
if (impl->egl_window == NULL) if (impl->display_server.egl_window == NULL)
{ {
impl->egl_window = impl->display_server.egl_window =
wl_egl_window_create (impl->wl_surface, wl_egl_window_create (impl->display_server.wl_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->wl_surface, impl->scale); wl_surface_set_buffer_scale (impl->display_server.wl_surface, impl->scale);
} }
return impl->egl_window; return impl->display_server.egl_window;
} }
EGLSurface EGLSurface
@ -2729,11 +2728,11 @@ gdk_wayland_window_get_dummy_egl_surface (GdkWindow *window,
if (impl->dummy_egl_surface == NULL) if (impl->dummy_egl_surface == NULL)
{ {
impl->dummy_egl_window = impl->display_server.dummy_egl_window =
wl_egl_window_create (impl->wl_surface, 1, 1); wl_egl_window_create (impl->display_server.wl_surface, 1, 1);
impl->dummy_egl_surface = impl->dummy_egl_surface =
eglCreateWindowSurface (display->egl_display, config, impl->dummy_egl_window, NULL); eglCreateWindowSurface (display->egl_display, config, impl->display_server.dummy_egl_window, NULL);
} }
return impl->dummy_egl_surface; return impl->dummy_egl_surface;
@ -2793,7 +2792,7 @@ gdk_wayland_window_set_use_custom_surface (GdkWindow *window)
impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
if (!impl->wl_surface) if (!impl->display_server.wl_surface)
gdk_wayland_window_create_surface (window); gdk_wayland_window_create_surface (window);
impl->use_custom_surface = TRUE; impl->use_custom_surface = TRUE;
@ -2816,10 +2815,10 @@ maybe_set_gtk_surface_dbus_properties (GdkWindow *window)
return; return;
gdk_wayland_window_init_gtk_surface (window); gdk_wayland_window_init_gtk_surface (window);
if (impl->gtk_surface == NULL) if (impl->display_server.gtk_surface == NULL)
return; return;
gtk_surface_set_dbus_properties (impl->gtk_surface, gtk_surface_set_dbus_properties (impl->display_server.gtk_surface,
impl->application.application_id, impl->application.application_id,
impl->application.app_menu_path, impl->application.app_menu_path,
impl->application.menubar_path, impl->application.menubar_path,