wayland: rename window->surface to window->wl_surface

The name surface is really overloaded when dealing
with wayland windows.

To alleviate ambiguity, this commit changes the name
of the "surface" and "subsurface" members to have
a wl_ prefix.

https://bugzilla.gnome.org/show_bug.cgi?id=761312
This commit is contained in:
Ray Strode 2016-02-02 11:27:54 -05:00
parent 4d40bd4474
commit f90db30b9e

View File

@ -98,13 +98,13 @@ struct _GdkWindowImplWayland
/* The wl_outputs that this window currently touches */
GSList *outputs;
struct wl_surface *surface;
struct wl_surface *wl_surface;
struct xdg_surface *xdg_surface;
struct xdg_popup *xdg_popup;
struct gtk_surface *gtk_surface;
struct wl_subsurface *subsurface;
struct wl_subsurface *wl_subsurface;
struct wl_egl_window *egl_window;
EGLSurface egl_surface;
@ -225,7 +225,7 @@ gdk_wayland_window_update_size (GdkWindow *window,
width * scale,
height * scale,
0, 0);
wl_surface_set_buffer_scale (impl->surface, scale);
wl_surface_set_buffer_scale (impl->wl_surface, scale);
}
area.x = 0;
@ -442,11 +442,11 @@ on_frame_clock_after_paint (GdkFrameClock *clock,
impl->pending_frame_counter = gdk_frame_clock_get_frame_counter (clock);
impl->awaiting_frame = TRUE;
callback = wl_surface_frame (impl->surface);
callback = wl_surface_frame (impl->wl_surface);
wl_callback_add_listener (callback, &frame_listener, window);
_gdk_frame_clock_freeze (clock);
wl_surface_commit (impl->surface);
wl_surface_commit (impl->wl_surface);
if (_gdk_wayland_is_shm_surface (impl->cairo_surface))
_gdk_wayland_shm_surface_set_busy (impl->cairo_surface);
@ -572,7 +572,7 @@ gdk_wayland_window_attach_image (GdkWindow *window)
g_assert (_gdk_wayland_is_shm_surface (impl->cairo_surface));
/* Attach this new buffer to the surface */
wl_surface_attach (impl->surface,
wl_surface_attach (impl->wl_surface,
_gdk_wayland_shm_surface_get_wl_buffer (impl->cairo_surface),
impl->pending_buffer_offset_x,
impl->pending_buffer_offset_y);
@ -582,7 +582,7 @@ gdk_wayland_window_attach_image (GdkWindow *window)
/* Only set the buffer scale if supported by the compositor */
display = GDK_WAYLAND_DISPLAY (gdk_window_get_display (window));
if (display->compositor_version >= WL_SURFACE_HAS_BUFFER_SCALE)
wl_surface_set_buffer_scale (impl->surface, impl->scale);
wl_surface_set_buffer_scale (impl->wl_surface, impl->scale);
impl->pending_commit = TRUE;
}
@ -671,7 +671,7 @@ gdk_window_impl_wayland_end_paint (GdkWindow *window)
for (i = 0; i < n; i++)
{
cairo_region_get_rectangle (window->current_paint.region, i, &rect);
wl_surface_damage (impl->surface, rect.x, rect.y, rect.width, rect.height);
wl_surface_damage (impl->wl_surface, rect.x, rect.y, rect.width, rect.height);
impl->pending_commit = TRUE;
}
}
@ -742,7 +742,7 @@ gdk_wayland_window_sync_parent (GdkWindow *window,
if (impl_parent)
{
/* XXX: Is this correct? */
if (!impl_parent->surface)
if (!impl_parent->wl_surface)
return;
parent_surface = impl_parent->xdg_surface;
@ -837,14 +837,14 @@ gdk_wayland_window_sync_opaque_region (GdkWindow *window)
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
struct wl_region *wl_region = NULL;
if (!impl->surface)
if (!impl->wl_surface)
return;
if (impl->opaque_region != NULL)
wl_region = wl_region_from_cairo_region (GDK_WAYLAND_DISPLAY (gdk_window_get_display (window)),
impl->opaque_region);
wl_surface_set_opaque_region (impl->surface, wl_region);
wl_surface_set_opaque_region (impl->wl_surface, wl_region);
if (wl_region != NULL)
wl_region_destroy (wl_region);
@ -856,14 +856,14 @@ gdk_wayland_window_sync_input_region (GdkWindow *window)
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
struct wl_region *wl_region = NULL;
if (!impl->surface)
if (!impl->wl_surface)
return;
if (impl->input_region != NULL)
wl_region = wl_region_from_cairo_region (GDK_WAYLAND_DISPLAY (gdk_window_get_display (window)),
impl->input_region);
wl_surface_set_input_region (impl->surface, wl_region);
wl_surface_set_input_region (impl->wl_surface, wl_region);
if (wl_region != NULL)
wl_region_destroy (wl_region);
@ -916,7 +916,7 @@ on_parent_surface_committed (GdkWindowImplWayland *parent_impl,
(gpointer) on_parent_surface_committed,
window);
wl_subsurface_set_desync (impl->subsurface);
wl_subsurface_set_desync (impl->wl_subsurface);
}
static void
@ -927,10 +927,10 @@ gdk_wayland_window_create_subsurface (GdkWindow *window)
impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
if (!impl->surface)
if (!impl->wl_surface)
return; /* Bail out, surface and subsurface will be created later when shown */
if (impl->subsurface)
if (impl->wl_subsurface)
return;
if (impl->transient_for)
@ -939,10 +939,10 @@ gdk_wayland_window_create_subsurface (GdkWindow *window)
if (parent_impl)
{
display_wayland = GDK_WAYLAND_DISPLAY (gdk_window_get_display (window));
impl->subsurface =
impl->wl_subsurface =
wl_subcompositor_get_subsurface (display_wayland->subcompositor,
impl->surface, parent_impl->surface);
wl_subsurface_set_position (impl->subsurface, window->x, window->y);
impl->wl_surface, parent_impl->wl_surface);
wl_subsurface_set_position (impl->wl_subsurface, window->x, window->y);
/* In order to synchronize the initial position with the initial frame
* content, wait with making the subsurface desynchronized until after
@ -961,8 +961,8 @@ gdk_wayland_window_create_surface (GdkWindow *window)
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (gdk_window_get_display (window));
impl->surface = wl_compositor_create_surface (display_wayland->compositor);
wl_surface_add_listener (impl->surface, &surface_listener, window);
impl->wl_surface = wl_compositor_create_surface (display_wayland->compositor);
wl_surface_add_listener (impl->wl_surface, &surface_listener, window);
gdk_wayland_window_sync_opaque_region (window);
gdk_wayland_window_sync_input_region (window);
@ -1072,7 +1072,7 @@ gdk_wayland_window_create_xdg_surface (GdkWindow *window)
impl->initial_fullscreen_monitor < gdk_screen_get_n_monitors (screen))
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->surface);
impl->xdg_surface = xdg_shell_get_xdg_surface (display_wayland->xdg_shell, impl->wl_surface);
xdg_surface_add_listener (impl->xdg_surface, &xdg_surface_listener, window);
gdk_wayland_window_sync_parent (window, NULL);
@ -1181,10 +1181,10 @@ gdk_wayland_window_create_xdg_popup (GdkWindow *window,
int x, y;
int parent_x, parent_y;
if (!impl->surface)
if (!impl->wl_surface)
return;
if (!parent_impl->surface)
if (!parent_impl->wl_surface)
return;
gdk_seat = gdk_display_get_default_seat (GDK_DISPLAY (display));
@ -1196,8 +1196,8 @@ gdk_wayland_window_create_xdg_popup (GdkWindow *window,
y = window->y - parent_y;
impl->xdg_popup = xdg_shell_get_xdg_popup (display->xdg_shell,
impl->surface,
parent_impl->surface,
impl->wl_surface,
parent_impl->wl_surface,
seat,
_gdk_wayland_device_get_last_implicit_grab_serial (device, NULL),
x, y);
@ -1487,7 +1487,7 @@ gdk_wayland_window_show (GdkWindow *window,
{
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
if (!impl->surface)
if (!impl->wl_surface)
gdk_wayland_window_create_surface (window);
gdk_wayland_window_map (window);
@ -1505,15 +1505,15 @@ unmap_subsurface (GdkWindow *window)
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
GdkWindowImplWayland *parent_impl;
g_return_if_fail (impl->subsurface);
g_return_if_fail (impl->wl_subsurface);
g_return_if_fail (impl->transient_for);
parent_impl = GDK_WINDOW_IMPL_WAYLAND (impl->transient_for->impl);
wl_subsurface_destroy (impl->subsurface);
wl_subsurface_destroy (impl->wl_subsurface);
g_signal_handlers_disconnect_by_func (parent_impl,
(gpointer) on_parent_surface_committed,
window);
impl->subsurface = NULL;
impl->wl_subsurface = NULL;
}
static void
@ -1522,7 +1522,7 @@ gdk_wayland_window_hide_surface (GdkWindow *window)
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (gdk_window_get_display (window));
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
if (impl->surface)
if (impl->wl_surface)
{
if (impl->dummy_egl_surface)
{
@ -1559,7 +1559,7 @@ gdk_wayland_window_hide_surface (GdkWindow *window)
impl->xdg_popup = NULL;
}
if (impl->subsurface)
if (impl->wl_subsurface)
unmap_subsurface (window);
if (impl->awaiting_frame)
@ -1578,8 +1578,8 @@ gdk_wayland_window_hide_surface (GdkWindow *window)
impl->gtk_surface = NULL;
}
wl_surface_destroy (impl->surface);
impl->surface = NULL;
wl_surface_destroy (impl->wl_surface);
impl->wl_surface = NULL;
g_slist_free (impl->outputs);
impl->outputs = NULL;
@ -1665,7 +1665,7 @@ gdk_window_request_transient_parent_commit (GdkWindow *window)
impl = GDK_WINDOW_IMPL_WAYLAND (window_impl->transient_for->impl);
if (!impl->surface || impl->pending_commit)
if (!impl->wl_surface || impl->pending_commit)
return;
frame_clock = gdk_window_get_frame_clock (window_impl->transient_for);
@ -1697,9 +1697,9 @@ gdk_window_wayland_move_resize (GdkWindow *window,
window->y = y;
impl->position_set = 1;
if (impl->subsurface)
if (impl->wl_subsurface)
{
wl_subsurface_set_position (impl->subsurface, x, y);
wl_subsurface_set_position (impl->wl_subsurface, x, y);
gdk_window_request_transient_parent_commit (window);
}
}
@ -1923,7 +1923,7 @@ gdk_wayland_window_init_gtk_surface (GdkWindow *window)
return;
impl->gtk_surface = gtk_shell_get_gtk_surface (display->gtk_shell,
impl->surface);
impl->wl_surface);
}
static void
@ -2043,7 +2043,7 @@ gdk_wayland_window_set_transient_for (GdkWindow *window,
return;
}
if (impl->subsurface)
if (impl->wl_subsurface)
unmap_subsurface (window);
previous_parent = impl->transient_for;
@ -2673,7 +2673,7 @@ gdk_wayland_window_get_wl_surface (GdkWindow *window)
{
g_return_val_if_fail (GDK_IS_WAYLAND_WINDOW (window), NULL);
return GDK_WINDOW_IMPL_WAYLAND (window->impl)->surface;
return GDK_WINDOW_IMPL_WAYLAND (window->impl)->wl_surface;
}
static struct wl_egl_window *
@ -2684,10 +2684,10 @@ gdk_wayland_window_get_wl_egl_window (GdkWindow *window)
if (impl->egl_window == NULL)
{
impl->egl_window =
wl_egl_window_create (impl->surface,
wl_egl_window_create (impl->wl_surface,
impl->wrapper->width * impl->scale,
impl->wrapper->height * impl->scale);
wl_surface_set_buffer_scale (impl->surface, impl->scale);
wl_surface_set_buffer_scale (impl->wl_surface, impl->scale);
}
return impl->egl_window;
@ -2730,7 +2730,7 @@ gdk_wayland_window_get_dummy_egl_surface (GdkWindow *window,
if (impl->dummy_egl_surface == NULL)
{
impl->dummy_egl_window =
wl_egl_window_create (impl->surface, 1, 1);
wl_egl_window_create (impl->wl_surface, 1, 1);
impl->dummy_egl_surface =
eglCreateWindowSurface (display->egl_display, config, impl->dummy_egl_window, NULL);
@ -2793,7 +2793,7 @@ gdk_wayland_window_set_use_custom_surface (GdkWindow *window)
impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
if (!impl->surface)
if (!impl->wl_surface)
gdk_wayland_window_create_surface (window);
impl->use_custom_surface = TRUE;