diff options
Diffstat (limited to 'gdk/wayland')
-rw-r--r-- | gdk/wayland/gdkdevice-wayland.c | 336 | ||||
-rw-r--r-- | gdk/wayland/gdkdisplay-wayland.c | 28 | ||||
-rw-r--r-- | gdk/wayland/gdkdisplay-wayland.h | 2 | ||||
-rw-r--r-- | gdk/wayland/gdkdnd-wayland.c | 92 | ||||
-rw-r--r-- | gdk/wayland/gdkglcontext-wayland.c | 54 | ||||
-rw-r--r-- | gdk/wayland/gdkglcontext-wayland.h | 4 | ||||
-rw-r--r-- | gdk/wayland/gdkprivate-wayland.h | 50 | ||||
-rw-r--r-- | gdk/wayland/gdkselection-wayland.c | 10 | ||||
-rw-r--r-- | gdk/wayland/gdksurface-wayland.c (renamed from gdk/wayland/gdkwindow-wayland.c) | 1846 | ||||
-rw-r--r-- | gdk/wayland/gdkvulkancontext-wayland.c | 16 | ||||
-rw-r--r-- | gdk/wayland/gdkwayland.h | 2 | ||||
-rw-r--r-- | gdk/wayland/gdkwaylandsurface.h (renamed from gdk/wayland/gdkwaylandwindow.h) | 46 | ||||
-rw-r--r-- | gdk/wayland/meson.build | 4 |
13 files changed, 1245 insertions, 1245 deletions
diff --git a/gdk/wayland/gdkdevice-wayland.c b/gdk/wayland/gdkdevice-wayland.c index 23bfa77b91..faa41a5d46 100644 --- a/gdk/wayland/gdkdevice-wayland.c +++ b/gdk/wayland/gdkdevice-wayland.c @@ -22,7 +22,7 @@ #include <errno.h> #include <string.h> -#include <gdk/gdkwindow.h> +#include <gdk/gdksurface.h> #include <gdk/gdktypes.h> #include "gdkclipboard-wayland.h" #include "gdkclipboardprivate.h" @@ -69,7 +69,7 @@ struct _GdkWaylandTouchData uint32_t id; gdouble x; gdouble y; - GdkWindow *window; + GdkSurface *surface; uint32_t touch_down_serial; guint initial_touch : 1; }; @@ -86,7 +86,7 @@ struct _GdkWaylandPointerFrameData }; struct _GdkWaylandPointerData { - GdkWindow *focus; + GdkSurface *focus; double surface_x, surface_y; @@ -96,7 +96,7 @@ struct _GdkWaylandPointerData { uint32_t enter_serial; uint32_t press_serial; - GdkWindow *grab_window; + GdkSurface *grab_surface; uint32_t grab_time; struct wl_surface *pointer_surface; @@ -220,8 +220,8 @@ struct _GdkWaylandSeat GdkWaylandPointerData touch_info; GdkModifierType key_modifiers; - GdkWindow *keyboard_focus; - GdkWindow *grab_window; + GdkSurface *keyboard_focus; + GdkSurface *grab_surface; uint32_t grab_time; gboolean have_server_repeat; uint32_t server_repeat_rate; @@ -242,7 +242,7 @@ struct _GdkWaylandSeat GdkDragContext *drop_context; /* Source/dest for non-local dnd */ - GdkWindow *foreign_dnd_window; + GdkSurface *foreign_dnd_surface; /* Some tracking on gesture events */ guint gesture_n_fingers; @@ -298,7 +298,7 @@ static void deliver_key_event (GdkWaylandSeat *seat, static gboolean gdk_wayland_device_get_history (GdkDevice *device, - GdkWindow *window, + GdkSurface *surface, guint32 start, guint32 stop, GdkTimeCoord ***events, @@ -309,13 +309,13 @@ gdk_wayland_device_get_history (GdkDevice *device, static void gdk_wayland_device_get_state (GdkDevice *device, - GdkWindow *window, + GdkSurface *surface, gdouble *axes, GdkModifierType *mask) { gdouble x, y; - gdk_window_get_device_position_double (window, device, &x, &y, mask); + gdk_surface_get_device_position_double (surface, device, &x, &y, mask); if (axes) { @@ -375,7 +375,7 @@ gdk_wayland_seat_find_pad (GdkWaylandSeat *seat, static gboolean -gdk_wayland_device_update_window_cursor (GdkDevice *device) +gdk_wayland_device_update_surface_cursor (GdkDevice *device) { GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (gdk_device_get_seat (device)); GdkWaylandPointerData *pointer = GDK_WAYLAND_DEVICE (device)->pointer; @@ -451,9 +451,9 @@ gdk_wayland_device_update_window_cursor (GdkDevice *device) /* Queue timeout for next frame */ id = g_timeout_add (next_image_delay, - (GSourceFunc) gdk_wayland_device_update_window_cursor, + (GSourceFunc) gdk_wayland_device_update_surface_cursor, device); - g_source_set_name_by_id (id, "[gtk+] gdk_wayland_device_update_window_cursor"); + g_source_set_name_by_id (id, "[gtk+] gdk_wayland_device_update_surface_cursor"); pointer->cursor_timeout_id = id; } else @@ -469,8 +469,8 @@ gdk_wayland_device_update_window_cursor (GdkDevice *device) } static void -gdk_wayland_device_set_window_cursor (GdkDevice *device, - GdkWindow *window, +gdk_wayland_device_set_surface_cursor (GdkDevice *device, + GdkSurface *surface, GdkCursor *cursor) { GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (gdk_device_get_seat (device)); @@ -501,7 +501,7 @@ gdk_wayland_device_set_window_cursor (GdkDevice *device, pointer->cursor = cursor; - gdk_wayland_device_update_window_cursor (device); + gdk_wayland_device_update_surface_cursor (device); } static void @@ -528,7 +528,7 @@ get_coordinates (GdkDevice *device, if (pointer->focus) { - gdk_window_get_root_coords (pointer->focus, + gdk_surface_get_root_coords (pointer->focus, pointer->surface_x, pointer->surface_y, &root_x, &root_y); @@ -562,8 +562,8 @@ device_get_modifiers (GdkDevice *device) static void gdk_wayland_device_query_state (GdkDevice *device, - GdkWindow *window, - GdkWindow **child_window, + GdkSurface *surface, + GdkSurface **child_surface, gdouble *root_x, gdouble *root_y, gdouble *win_x, @@ -573,16 +573,16 @@ gdk_wayland_device_query_state (GdkDevice *device, GdkWaylandPointerData *pointer; GList *children; - if (window == NULL) - children = gdk_wayland_display_get_toplevel_windows (gdk_device_get_display (device)); + if (surface == NULL) + children = gdk_wayland_display_get_toplevel_surfaces (gdk_device_get_display (device)); else - children = window->children; + children = surface->children; pointer = GDK_WAYLAND_DEVICE (device)->pointer; - if (child_window) - /* Set child only if actually a child of the given window, as XIQueryPointer() does */ - *child_window = g_list_find (children, pointer->focus) ? pointer->focus : NULL; + if (child_surface) + /* Set child only if actually a child of the given surface, as XIQueryPointer() does */ + *child_surface = g_list_find (children, pointer->focus) ? pointer->focus : NULL; if (mask) *mask = device_get_modifiers (device); @@ -590,8 +590,8 @@ gdk_wayland_device_query_state (GdkDevice *device, } static void -emulate_crossing (GdkWindow *window, - GdkWindow *subwindow, +emulate_crossing (GdkSurface *surface, + GdkSurface *child_surface, GdkDevice *device, GdkEventType type, GdkCrossingMode mode, @@ -600,26 +600,26 @@ emulate_crossing (GdkWindow *window, GdkEvent *event; event = gdk_event_new (type); - event->any.window = window ? g_object_ref (window) : NULL; - event->crossing.subwindow = subwindow ? g_object_ref (subwindow) : NULL; + event->any.surface = surface ? g_object_ref (surface) : NULL; + event->crossing.child_surface = child_surface ? g_object_ref (child_surface) : NULL; event->crossing.time = time_; event->crossing.mode = mode; event->crossing.detail = GDK_NOTIFY_NONLINEAR; gdk_event_set_device (event, device); gdk_event_set_source_device (event, device); - gdk_window_get_device_position_double (window, device, + gdk_surface_get_device_position_double (surface, device, &event->crossing.x, &event->crossing.y, &event->crossing.state); event->crossing.x_root = event->crossing.x; event->crossing.y_root = event->crossing.y; - _gdk_wayland_display_deliver_event (gdk_window_get_display (window), event); + _gdk_wayland_display_deliver_event (gdk_surface_get_display (surface), event); } static void -emulate_touch_crossing (GdkWindow *window, - GdkWindow *subwindow, +emulate_touch_crossing (GdkSurface *surface, + GdkSurface *child_surface, GdkDevice *device, GdkDevice *source, GdkWaylandTouchData *touch, @@ -630,8 +630,8 @@ emulate_touch_crossing (GdkWindow *window, GdkEvent *event; event = gdk_event_new (type); - event->any.window = window ? g_object_ref (window) : NULL; - event->crossing.subwindow = subwindow ? g_object_ref (subwindow) : NULL; + event->any.surface = surface ? g_object_ref (surface) : NULL; + event->crossing.child_surface = child_surface ? g_object_ref (child_surface) : NULL; event->crossing.time = time_; event->crossing.mode = mode; event->crossing.detail = GDK_NOTIFY_NONLINEAR; @@ -643,11 +643,11 @@ emulate_touch_crossing (GdkWindow *window, event->crossing.x_root = event->crossing.x; event->crossing.y_root = event->crossing.y; - _gdk_wayland_display_deliver_event (gdk_window_get_display (window), event); + _gdk_wayland_display_deliver_event (gdk_surface_get_display (surface), event); } static void -emulate_focus (GdkWindow *window, +emulate_focus (GdkSurface *surface, GdkDevice *device, gboolean focus_in, guint32 time_) @@ -655,18 +655,18 @@ emulate_focus (GdkWindow *window, GdkEvent *event; event = gdk_event_new (GDK_FOCUS_CHANGE); - event->any.window = g_object_ref (window); + event->any.surface = g_object_ref (surface); event->focus_change.in = focus_in; gdk_event_set_device (event, device); gdk_event_set_source_device (event, device); - _gdk_wayland_display_deliver_event (gdk_window_get_display (window), event); + _gdk_wayland_display_deliver_event (gdk_surface_get_display (surface), event); } static void device_emit_grab_crossing (GdkDevice *device, - GdkWindow *from, - GdkWindow *to, + GdkSurface *from, + GdkSurface *to, GdkCrossingMode mode, guint32 time_) { @@ -686,7 +686,7 @@ device_emit_grab_crossing (GdkDevice *device, } } -static GdkWindow * +static GdkSurface * gdk_wayland_device_get_focus (GdkDevice *device) { GdkWaylandSeat *wayland_seat = GDK_WAYLAND_SEAT (gdk_device_get_seat (device)); @@ -707,40 +707,40 @@ gdk_wayland_device_get_focus (GdkDevice *device) static GdkGrabStatus gdk_wayland_device_grab (GdkDevice *device, - GdkWindow *window, + GdkSurface *surface, gboolean owner_events, GdkEventMask event_mask, - GdkWindow *confine_to, + GdkSurface *confine_to, GdkCursor *cursor, guint32 time_) { GdkWaylandSeat *wayland_seat = GDK_WAYLAND_SEAT (gdk_device_get_seat (device)); - GdkWindow *prev_focus = gdk_wayland_device_get_focus (device); + GdkSurface *prev_focus = gdk_wayland_device_get_focus (device); GdkWaylandPointerData *pointer = GDK_WAYLAND_DEVICE (device)->pointer; - if (gdk_window_get_window_type (window) == GDK_WINDOW_TEMP && - gdk_window_is_visible (window)) + if (gdk_surface_get_surface_type (surface) == GDK_SURFACE_TEMP && + gdk_surface_is_visible (surface)) { - g_warning ("Window %p is already mapped at the time of grabbing. " + g_warning ("Surface %p is already mapped at the time of grabbing. " "gdk_seat_grab() should be used to simultanously grab input " "and show this popup. You may find oddities ahead.", - window); + surface); } - if (prev_focus != window) - device_emit_grab_crossing (device, prev_focus, window, GDK_CROSSING_GRAB, time_); + if (prev_focus != surface) + device_emit_grab_crossing (device, prev_focus, surface, GDK_CROSSING_GRAB, time_); if (gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD) { /* Device is a keyboard */ - gdk_wayland_window_inhibit_shortcuts (window, + gdk_wayland_surface_inhibit_shortcuts (surface, gdk_device_get_seat (device)); return GDK_GRAB_SUCCESS; } else { /* Device is a pointer */ - if (pointer->grab_window != NULL && + if (pointer->grab_surface != NULL && time_ != 0 && pointer->grab_time > time_) { return GDK_GRAB_ALREADY_GRABBED; @@ -749,16 +749,16 @@ gdk_wayland_device_grab (GdkDevice *device, if (time_ == 0) time_ = pointer->time; - pointer->grab_window = window; + pointer->grab_surface = surface; pointer->grab_time = time_; - _gdk_wayland_window_set_grab_seat (window, GDK_SEAT (wayland_seat)); + _gdk_wayland_surface_set_grab_seat (surface, GDK_SEAT (wayland_seat)); g_clear_object (&wayland_seat->cursor); if (cursor) wayland_seat->cursor = g_object_ref (cursor); - gdk_wayland_device_update_window_cursor (device); + gdk_wayland_device_update_surface_cursor (device); } return GDK_GRAB_SUCCESS; @@ -771,7 +771,7 @@ gdk_wayland_device_ungrab (GdkDevice *device, GdkWaylandPointerData *pointer = GDK_WAYLAND_DEVICE (device)->pointer; GdkDisplay *display; GdkDeviceGrabInfo *grab; - GdkWindow *focus, *prev_focus = NULL; + GdkSurface *focus, *prev_focus = NULL; display = gdk_device_get_display (device); @@ -780,7 +780,7 @@ gdk_wayland_device_ungrab (GdkDevice *device, if (grab) { grab->serial_end = grab->serial_start; - prev_focus = grab->window; + prev_focus = grab->surface; } focus = gdk_wayland_device_get_focus (device); @@ -792,22 +792,22 @@ gdk_wayland_device_ungrab (GdkDevice *device, { /* Device is a keyboard */ if (prev_focus) - gdk_wayland_window_restore_shortcuts (prev_focus, + gdk_wayland_surface_restore_shortcuts (prev_focus, gdk_device_get_seat (device)); } else { /* Device is a pointer */ - gdk_wayland_device_update_window_cursor (device); + gdk_wayland_device_update_surface_cursor (device); - if (pointer->grab_window) - _gdk_wayland_window_set_grab_seat (pointer->grab_window, + if (pointer->grab_surface) + _gdk_wayland_surface_set_grab_seat (pointer->grab_surface, NULL); } } -static GdkWindow * -gdk_wayland_device_window_at_position (GdkDevice *device, +static GdkSurface * +gdk_wayland_device_surface_at_position (GdkDevice *device, gdouble *win_x, gdouble *win_y, GdkModifierType *mask, @@ -831,8 +831,8 @@ gdk_wayland_device_window_at_position (GdkDevice *device, } static void -gdk_wayland_device_select_window_events (GdkDevice *device, - GdkWindow *window, +gdk_wayland_device_select_surface_events (GdkDevice *device, + GdkSurface *surface, GdkEventMask event_mask) { } @@ -844,13 +844,13 @@ gdk_wayland_device_class_init (GdkWaylandDeviceClass *klass) device_class->get_history = gdk_wayland_device_get_history; device_class->get_state = gdk_wayland_device_get_state; - device_class->set_window_cursor = gdk_wayland_device_set_window_cursor; + device_class->set_surface_cursor = gdk_wayland_device_set_surface_cursor; device_class->warp = gdk_wayland_device_warp; device_class->query_state = gdk_wayland_device_query_state; device_class->grab = gdk_wayland_device_grab; device_class->ungrab = gdk_wayland_device_ungrab; - device_class->window_at_position = gdk_wayland_device_window_at_position; - device_class->select_window_events = gdk_wayland_device_select_window_events; + device_class->surface_at_position = gdk_wayland_device_surface_at_position; + device_class->select_surface_events = gdk_wayland_device_select_surface_events; } static void @@ -1077,11 +1077,11 @@ data_device_enter (void *data, struct wl_data_offer *offer) { GdkWaylandSeat *seat = data; - GdkWindow *dest_window, *dnd_owner; + GdkSurface *dest_surface, *dnd_owner; - dest_window = wl_surface_get_user_data (surface); + dest_surface = wl_surface_get_user_data (surface); - if (!GDK_IS_WINDOW (dest_window)) + if (!GDK_IS_SURFACE (dest_surface)) return; GDK_DISPLAY_NOTE (seat->display, EVENTS, @@ -1089,18 +1089,18 @@ data_device_enter (void *data, data_device, serial, surface, wl_fixed_to_double (x), wl_fixed_to_double (y), offer)); /* Update pointer state, so device state queries work during DnD */ - seat->pointer_info.focus = g_object_ref (dest_window); + seat->pointer_info.focus = g_object_ref (dest_surface); seat->pointer_info.surface_x = wl_fixed_to_double (x); seat->pointer_info.surface_y = wl_fixed_to_double (y); gdk_wayland_drop_context_update_targets (seat->drop_context); - dnd_owner = seat->foreign_dnd_window; + dnd_owner = seat->foreign_dnd_surface; - _gdk_wayland_drag_context_set_source_window (seat->drop_context, dnd_owner); + _gdk_wayland_drag_context_set_source_surface (seat->drop_context, dnd_owner); - _gdk_wayland_drag_context_set_dest_window (seat->drop_context, - dest_window, serial); + _gdk_wayland_drag_context_set_dest_surface (seat->drop_context, + dest_surface, serial); _gdk_wayland_drag_context_set_coords (seat->drop_context, wl_fixed_to_double (x), wl_fixed_to_double (y)); @@ -1119,7 +1119,7 @@ data_device_leave (void *data, GDK_DISPLAY_NOTE (seat->display, EVENTS, g_message ("data device leave, data device %p", data_device)); - if (!gdk_drag_context_get_dest_window (seat->drop_context)) + if (!gdk_drag_context_get_dest_surface (seat->drop_context)) return; g_object_unref (seat->pointer_info.focus); @@ -1128,7 +1128,7 @@ data_device_leave (void *data, _gdk_wayland_drag_context_set_coords (seat->drop_context, -1, -1); _gdk_wayland_drag_context_emit_event (seat->drop_context, GDK_DRAG_LEAVE, GDK_CURRENT_TIME); - _gdk_wayland_drag_context_set_dest_window (seat->drop_context, NULL, 0); + _gdk_wayland_drag_context_set_dest_surface (seat->drop_context, NULL, 0); } static void @@ -1144,7 +1144,7 @@ data_device_motion (void *data, g_message ("data device motion, data_device = %p, time = %d, x = %f, y = %f", data_device, time, wl_fixed_to_double (x), wl_fixed_to_double (y))); - if (!gdk_drag_context_get_dest_window (seat->drop_context)) + if (!gdk_drag_context_get_dest_surface (seat->drop_context)) return; /* Update pointer state, so device state queries work during DnD */ @@ -1212,7 +1212,7 @@ create_scroll_event (GdkWaylandSeat *seat, GdkEvent *event; event = gdk_event_new (GDK_SCROLL); - event->any.window = g_object_ref (pointer_info->focus); + event->any.surface = g_object_ref (pointer_info->focus); gdk_event_set_device (event, device); gdk_event_set_source_device (event, source_device); event->scroll.time = pointer_info->time; @@ -1357,7 +1357,7 @@ pointer_handle_enter (void *data, if (!surface) return; - if (!GDK_IS_WINDOW (wl_surface_get_user_data (surface))) + if (!GDK_IS_SURFACE (wl_surface_get_user_data (surface))) return; _gdk_wayland_display_update_serial (display_wayland, serial); @@ -1372,17 +1372,17 @@ pointer_handle_enter (void *data, seat->pointer_info.enter_serial = serial; event = gdk_wayland_seat_get_frame_event (seat, GDK_ENTER_NOTIFY); - event->any.window = g_object_ref (seat->pointer_info.focus); + event->any.surface = g_object_ref (seat->pointer_info.focus); gdk_event_set_device (event, seat->master_pointer); gdk_event_set_source_device (event, seat->pointer); - event->crossing.subwindow = NULL; + event->crossing.child_surface = NULL; event->crossing.time = (guint32)(g_get_monotonic_time () / 1000); event->crossing.mode = GDK_CROSSING_NORMAL; event->crossing.detail = GDK_NOTIFY_NONLINEAR; event->crossing.focus = TRUE; event->crossing.state = 0; - gdk_wayland_device_update_window_cursor (seat->master_pointer); + gdk_wayland_device_update_surface_cursor (seat->master_pointer); get_coordinates (seat->master_pointer, &event->crossing.x, @@ -1411,7 +1411,7 @@ pointer_handle_leave (void *data, if (!surface) return; - if (!GDK_IS_WINDOW (wl_surface_get_user_data (surface))) + if (!GDK_IS_SURFACE (wl_surface_get_user_data (surface))) return; if (!seat->pointer_info.focus) @@ -1420,17 +1420,17 @@ pointer_handle_leave (void *data, _gdk_wayland_display_update_serial (display_wayland, serial); event = gdk_wayland_seat_get_frame_event (seat, GDK_LEAVE_NOTIFY); - event->any.window = g_object_ref (seat->pointer_info.focus); + event->any.surface = g_object_ref (seat->pointer_info.focus); gdk_event_set_device (event, seat->master_pointer); gdk_event_set_source_device (event, seat->pointer); - event->crossing.subwindow = NULL; + event->crossing.child_surface = NULL; event->crossing.time = (guint32)(g_get_monotonic_time () / 1000); event->crossing.mode = GDK_CROSSING_NORMAL; event->crossing.detail = GDK_NOTIFY_NONLINEAR; event->crossing.focus = TRUE; event->crossing.state = 0; - gdk_wayland_device_update_window_cursor (seat->master_pointer); + gdk_wayland_device_update_surface_cursor (seat->master_pointer); get_coordinates (seat->master_pointer, &event->crossing.x, @@ -1470,7 +1470,7 @@ pointer_handle_motion (void *data, seat->pointer_info.surface_y = wl_fixed_to_double (sy); event = gdk_wayland_seat_get_frame_event (seat, GDK_MOTION_NOTIFY); - event->any.window = g_object_ref (seat->pointer_info.focus); + event->any.surface = g_object_ref (seat->pointer_info.focus); gdk_event_set_device (event, seat->master_pointer); gdk_event_set_source_device (event, seat->pointer); event->motion.time = time; @@ -1536,7 +1536,7 @@ pointer_handle_button (void *data, event = gdk_wayland_seat_get_frame_event (seat, state ? GDK_BUTTON_PRESS : GDK_BUTTON_RELEASE); - event->any.window = g_object_ref (seat->pointer_info.focus); + event->any.surface = g_object_ref (seat->pointer_info.focus); gdk_event_set_device (event, seat->master_pointer); gdk_event_set_source_device (event, seat->pointer); event->button.time = time; @@ -1771,7 +1771,7 @@ keyboard_handle_enter (void *data, if (!surface) return; - if (!GDK_IS_WINDOW (wl_surface_get_user_data (surface))) + if (!GDK_IS_SURFACE (wl_surface_get_user_data (surface))) return; _gdk_wayland_display_update_serial (display, serial); @@ -1781,7 +1781,7 @@ keyboard_handle_enter (void *data, seat->repeat_key = 0; event = gdk_event_new (GDK_FOCUS_CHANGE); - event->any.window = g_object_ref (seat->keyboard_focus); + event->any.surface = g_object_ref (seat->keyboard_focus); event->any.send_event = FALSE; event->focus_change.in = TRUE; gdk_event_set_device (event, seat->master_keyboard); @@ -1809,16 +1809,16 @@ keyboard_handle_leave (void *data, if (!seat->keyboard_focus) return; - /* gdk_window_is_destroyed() might already return TRUE for + /* gdk_surface_is_destroyed() might already return TRUE for * seat->keyboard_focus here, which would happen if we destroyed the - * window before loosing keyboard focus. + * surface before loosing keyboard focus. */ stop_key_repeat (seat); _gdk_wayland_display_update_serial (display, serial); event = gdk_event_new (GDK_FOCUS_CHANGE); - event->any.window = g_object_ref (seat->keyboard_focus); + event->any.surface = g_object_ref (seat->keyboard_focus); event->any.send_event = FALSE; event->focus_change.in = FALSE; gdk_event_set_device (event, seat->master_keyboard); @@ -2008,7 +2008,7 @@ deliver_key_event (GdkWaylandSeat *seat, seat->key_modifiers = gdk_keymap_get_modifier_state (keymap); event = gdk_event_new (state ? GDK_KEY_PRESS : GDK_KEY_RELEASE); - event->any.window = seat->keyboard_focus ? g_object_ref (seat->keyboard_focus) : NULL; + event->any.surface = seat->keyboard_focus ? g_object_ref (seat->keyboard_focus) : NULL; gdk_event_set_device (event, seat->master_keyboard); gdk_event_set_source_device (event, seat->keyboard); event->key.time = time_; @@ -2181,7 +2181,7 @@ gdk_wayland_seat_add_touch (GdkWaylandSeat *seat, touch = g_new0 (GdkWaylandTouchData, 1); touch->id = id; - touch->window = wl_surface_get_user_data (surface); + touch->surface = wl_surface_get_user_data (surface); touch->initial_touch = (g_hash_table_size (seat->touches) == 0); g_hash_table_insert (seat->touches, GUINT_TO_POINTER (id), touch); @@ -2213,7 +2213,7 @@ _create_touch_event (GdkWaylandSeat *seat, GdkEvent *event; event = gdk_event_new (evtype); - event->any.window = g_object_ref (touch->window); + event->any.surface = g_object_ref (touch->surface); gdk_event_set_device (event, seat->touch_master); gdk_event_set_source_device (event, seat->touch); event->touch.time = time; @@ -2227,7 +2227,7 @@ _create_touch_event (GdkWaylandSeat *seat, event->touch.emulating_pointer = TRUE; } - gdk_window_get_root_coords (touch->window, + gdk_surface_get_root_coords (touch->surface, touch->x, touch->y, &x_root, &y_root); @@ -2246,7 +2246,7 @@ mimic_pointer_emulating_touch_info (GdkDevice *device, GdkWaylandPointerData *pointer; pointer = GDK_WAYLAND_DEVICE (device)->pointer; - g_set_object (&pointer->focus, touch->window); + g_set_object (&pointer->focus, touch->surface); pointer->press_serial = pointer->enter_serial = touch->touch_down_serial; pointer->surface_x = touch->x; pointer->surface_y = touch->y; @@ -2261,7 +2261,7 @@ touch_handle_master_pointer_crossing (GdkWaylandSeat *seat, pointer = GDK_WAYLAND_DEVICE (seat->touch_master)->pointer; - if (pointer->focus == touch->window) + if (pointer->focus == touch->surface) return; if (pointer->focus) @@ -2271,9 +2271,9 @@ touch_handle_master_pointer_crossing (GdkWaylandSeat *seat, GDK_LEAVE_NOTIFY, GDK_CROSSING_NORMAL, time); } - if (touch->window) + if (touch->surface) { - emulate_touch_crossing (touch->window, NULL, + emulate_touch_crossing (touch->surface, NULL, seat->touch_master, seat->touch, touch, GDK_ENTER_NOTIFY, GDK_CROSSING_NORMAL, time); } @@ -2422,7 +2422,7 @@ emit_gesture_swipe_event (GdkWaylandSeat *seat, event = gdk_event_new (GDK_TOUCHPAD_SWIPE); event->touchpad_swipe.phase = phase; - event->any.window = g_object_ref (seat->pointer_info.focus); + event->any.surface = g_object_ref (seat->pointer_info.focus); gdk_event_set_device (event, seat->master_pointer); gdk_event_set_source_device (event, seat->pointer); event->touchpad_swipe.time = _time; @@ -2523,7 +2523,7 @@ emit_gesture_pinch_event (GdkWaylandSeat *seat, event = gdk_event_new (GDK_TOUCHPAD_PINCH); event->touchpad_pinch.phase = phase; - event->any.window = g_object_ref (seat->pointer_info.focus); + event->any.surface = g_object_ref (seat->pointer_info.focus); gdk_event_set_device (event, seat->master_pointer); gdk_event_set_source_device (event, seat->pointer); event->touchpad_pinch.time = _time; @@ -3251,7 +3251,7 @@ gdk_wayland_tablet_flush_frame_event (GdkWaylandTabletData *tablet, } if (event->any.type == GDK_PROXIMITY_OUT) - emulate_crossing (event->any.window, NULL, + emulate_crossing (event->any.surface, NULL, tablet->master, GDK_LEAVE_NOTIFY, GDK_CROSSING_NORMAL, time); @@ -3259,7 +3259,7 @@ gdk_wayland_tablet_flush_frame_event (GdkWaylandTabletData *tablet, event); if (event->any.type == GDK_PROXIMITY_IN) - emulate_crossing (event->any.window, NULL, + emulate_crossing (event->any.surface, NULL, tablet->master, GDK_ENTER_NOTIFY, GDK_CROSSING_NORMAL, time); } @@ -3364,18 +3364,18 @@ tablet_tool_handle_proximity_in (void *data, struct zwp_tablet_tool_v2 *wp_tablet_tool, uint32_t serial, struct zwp_tablet_v2 *wp_tablet, - struct wl_surface *surface) + struct wl_surface *wsurface) { GdkWaylandTabletToolData *tool = data; GdkWaylandTabletData *tablet = zwp_tablet_v2_get_user_data (wp_tablet); GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (tablet->seat); GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (seat->display); - GdkWindow *window = wl_surface_get_user_data (surface); + GdkSurface *surface = wl_surface_get_user_data (wsurface); GdkEvent *event; if (!surface) return; - if (!GDK_IS_WINDOW (window)) + if (!GDK_IS_SURFACE (surface)) return; tool->current_tablet = tablet; @@ -3384,7 +3384,7 @@ tablet_tool_handle_proximity_in (void *data, _gdk_wayland_display_update_serial (display_wayland, serial); tablet->pointer_info.enter_serial = serial; - tablet->pointer_info.focus = g_object_ref (window); + tablet->pointer_info.focus = g_object_ref (surface); tablet->current_device = tablet_select_device_for_tool (tablet, tool->tool); @@ -3393,7 +3393,7 @@ tablet_tool_handle_proximity_in (void *data, gdk_wayland_mimic_device_axes (tablet->master, tablet->current_device); event = gdk_wayland_tablet_get_frame_event (tablet, GDK_PROXIMITY_IN); - event->any.window = g_object_ref (tablet->pointer_info.focus); + event->any.surface = g_object_ref (tablet->pointer_info.focus); gdk_event_set_device (event, tablet->master); gdk_event_set_source_device (event, tablet->current_device); gdk_event_set_device_tool (event, tool->tool); @@ -3418,14 +3418,14 @@ tablet_tool_handle_proximity_out (void *data, gdk_device_tool_get_tool_type (tool->tool))); event = gdk_wayland_tablet_get_frame_event (tablet, GDK_PROXIMITY_OUT); - event->any.window = g_object_ref (tablet->pointer_info.focus); + event->any.surface = g_object_ref (tablet->pointer_info.focus); gdk_event_set_device (event, tablet->master); gdk_event_set_source_device (event, tablet->current_device); gdk_event_set_device_tool (event, tool->tool); gdk_wayland_pointer_stop_cursor_animation (&tablet->pointer_info); - gdk_wayland_device_update_window_cursor (tablet->master); + gdk_wayland_device_update_surface_cursor (tablet->master); g_object_unref (tablet->pointer_info.focus); tablet->pointer_info.focus = NULL; @@ -3442,7 +3442,7 @@ tablet_create_button_event_frame (GdkWaylandTabletData *tablet, GdkEvent *event; event = gdk_wayland_tablet_get_frame_event (tablet, evtype); - event->any.window = g_object_ref (tablet->pointer_info.focus); + event->any.surface = g_object_ref (tablet->pointer_info.focus); gdk_event_set_device (event, tablet->master); gdk_event_set_source_device (event, tablet->current_device); gdk_event_set_device_tool (event, tablet->current_tool->tool); @@ -3512,7 +3512,7 @@ tablet_tool_handle_motion (void *data, tablet->pointer_info.surface_y)); event = gdk_wayland_tablet_get_frame_event (tablet, GDK_MOTION_NOTIFY); - event->any.window = g_object_ref (tablet->pointer_info.focus); + event->any.surface = g_object_ref (tablet->pointer_info.focus); gdk_event_set_device (event, tablet->master); gdk_event_set_source_device (event, tablet->current_device); gdk_event_set_device_tool (event, tool->tool); @@ -3798,7 +3798,7 @@ tablet_pad_ring_handle_frame (void *data, g_message ("tablet pad ring handle frame, ring = %p", wp_tablet_pad_ring)); event = gdk_event_new (GDK_PAD_RING); - g_set_object (&event->any.window, seat->keyboard_focus); + g_set_object (&event->any.surface, seat->keyboard_focus); event->pad_axis.time = time; event->pad_axis.group = g_list_index (pad->mode_groups, group); event->pad_axis.index = g_list_index (pad->rings, wp_tablet_pad_ring); @@ -3880,7 +3880,7 @@ tablet_pad_strip_handle_frame (void *data, wp_tablet_pad_strip)); event = gdk_event_new (GDK_PAD_STRIP); - g_set_object (&event->any.window, seat->keyboard_focus); + g_set_object (&event->any.surface, seat->keyboard_focus); event->pad_axis.time = time; event->pad_axis.group = g_list_index (pad->mode_groups, group); event->pad_axis.index = g_list_index (pad->strips, wp_tablet_pad_strip); @@ -4016,7 +4016,7 @@ tablet_pad_group_handle_mode (void *data, n_group = g_list_index (pad->mode_groups, group); event = gdk_event_new (GDK_PAD_GROUP_MODE); - g_set_object (&event->any.window, seat->keyboard_focus); + g_set_object (&event->any.surface, seat->keyboard_focus); event->pad_group_mode.group = n_group; event->pad_group_mode.mode = mode; event->pad_group_mode.time = time; @@ -4136,7 +4136,7 @@ tablet_pad_handle_button (void *data, event = gdk_event_new (state == ZWP_TABLET_PAD_V2_BUTTON_STATE_PRESSED ? GDK_PAD_BUTTON_PRESS : GDK_PAD_BUTTON_RELEASE); - g_set_object (&event->any.window, seat->keyboard_focus); + g_set_object (&event->any.surface, seat->keyboard_focus); event->pad_button.button = button; event->pad_button.group = n_group; event->pad_button.mode = group->current_mode; @@ -4343,7 +4343,7 @@ pointer_surface_update_scale (GdkDevice *device) pointer->current_output_scale = scale; - gdk_wayland_device_update_window_cursor (device); + gdk_wayland_device_update_surface_cursor (device); } static void @@ -4386,10 +4386,10 @@ static const struct wl_surface_listener pointer_surface_listener = { pointer_surface_leave }; -static GdkWindow * -create_foreign_dnd_window (GdkDisplay *display) +static GdkSurface * +create_foreign_dnd_surface (GdkDisplay *display) { - return gdk_window_new_popup (display, &(GdkRectangle) { 0, 0, 1, 1 }); + return gdk_surface_new_popup (display, &(GdkRectangle) { 0, 0, 1, 1 }); } static void @@ -4425,7 +4425,7 @@ gdk_wayland_seat_finalize (GObject *object) g_clear_object (&seat->clipboard); g_clear_object (&seat->primary_clipboard); g_hash_table_destroy (seat->touches); - gdk_window_destroy (seat->foreign_dnd_window); + gdk_surface_destroy (seat->foreign_dnd_surface); zwp_tablet_seat_v2_destroy (seat->wp_tablet_seat); stop_key_repeat (seat); @@ -4449,29 +4449,29 @@ gdk_wayland_seat_get_capabilities (GdkSeat *seat) } static void -gdk_wayland_seat_set_grab_window (GdkWaylandSeat *seat, - GdkWindow *window) +gdk_wayland_seat_set_grab_surface (GdkWaylandSeat *seat, + GdkSurface *surface) { - if (seat->grab_window) + if (seat->grab_surface) { - _gdk_wayland_window_set_grab_seat (seat->grab_window, NULL); - g_object_remove_weak_pointer (G_OBJECT (seat->grab_window), - (gpointer *) &seat->grab_window); - seat->grab_window = NULL; + _gdk_wayland_surface_set_grab_seat (seat->grab_surface, NULL); + g_object_remove_weak_pointer (G_OBJECT (seat->grab_surface), + (gpointer *) &seat->grab_surface); + seat->grab_surface = NULL; } - if (window) + if (surface) { - seat->grab_window = window; - g_object_add_weak_pointer (G_OBJECT (window), - (gpointer *) &seat->grab_window); - _gdk_wayland_window_set_grab_seat (window, GDK_SEAT (seat)); + seat->grab_surface = surface; + g_object_add_weak_pointer (G_OBJECT (surface), + (gpointer *) &seat->grab_surface); + _gdk_wayland_surface_set_grab_seat (surface, GDK_SEAT (seat)); } } static GdkGrabStatus gdk_wayland_seat_grab (GdkSeat *seat, - GdkWindow *window, + GdkSurface *surface, GdkSeatCapabilities capabilities, gboolean owner_events, GdkCursor *cursor, @@ -4482,32 +4482,32 @@ gdk_wayland_seat_grab (GdkSeat *seat, GdkWaylandSeat *wayland_seat = GDK_WAYLAND_SEAT (seat); guint32 evtime = event ? gdk_event_get_time (event) : GDK_CURRENT_TIME; GdkDisplay *display = gdk_seat_get_display (seat); - GdkWindow *native; + GdkSurface *native; GList *l; - native = gdk_window_get_toplevel (window); + native = gdk_surface_get_toplevel (surface); - if (native == NULL || GDK_WINDOW_DESTROYED (native)) + if (native == NULL || GDK_SURFACE_DESTROYED (native)) return GDK_GRAB_NOT_VIEWABLE; - gdk_wayland_seat_set_grab_window (wayland_seat, native); + gdk_wayland_seat_set_grab_surface (wayland_seat, native); wayland_seat->grab_time = evtime; if (prepare_func) - (prepare_func) (seat, window, prepare_func_data); + (prepare_func) (seat, surface, prepare_func_data); - if (!gdk_window_is_visible (window)) + if (!gdk_surface_is_visible (surface)) { - gdk_wayland_seat_set_grab_window (wayland_seat, NULL); - g_critical ("Window %p has not been made visible in GdkSeatGrabPrepareFunc", - window); + gdk_wayland_seat_set_grab_surface (wayland_seat, NULL); + g_critical ("Surface %p has not been made visible in GdkSeatGrabPrepareFunc", + surface); return GDK_GRAB_NOT_VIEWABLE; } if (wayland_seat->master_pointer && capabilities & GDK_SEAT_CAPABILITY_POINTER) { - GdkWindow *prev_focus = gdk_wayland_device_get_focus (wayland_seat->master_pointer); + GdkSurface *prev_focus = gdk_wayland_device_get_focus (wayland_seat->master_pointer); if (prev_focus != native) device_emit_grab_crossing (wayland_seat->master_pointer, prev_focus, @@ -4515,7 +4515,7 @@ gdk_wayland_seat_grab (GdkSeat *seat, _gdk_display_add_device_grab (display, wayland_seat->master_pointer, - window, + surface, native, GDK_OWNERSHIP_NONE, owner_events, @@ -4526,13 +4526,13 @@ gdk_wayland_seat_grab (GdkSeat *seat, gdk_wayland_seat_set_global_cursor (seat, cursor); g_set_object (&wayland_seat->cursor, cursor); - gdk_wayland_device_update_window_cursor (wayland_seat->master_pointer); + gdk_wayland_device_update_surface_cursor (wayland_seat->master_pointer); } if (wayland_seat->touch_master && capabilities & GDK_SEAT_CAPABILITY_TOUCH) { - GdkWindow *prev_focus = gdk_wayland_device_get_focus (wayland_seat->touch_master); + GdkSurface *prev_focus = gdk_wayland_device_get_focus (wayland_seat->touch_master); if (prev_focus != native) device_emit_grab_crossing (wayland_seat->touch_master, prev_focus, @@ -4540,7 +4540,7 @@ gdk_wayland_seat_grab (GdkSeat *seat, _gdk_display_add_device_grab (display, wayland_seat->touch_master, - window, + surface, native, GDK_OWNERSHIP_NONE, owner_events, @@ -4553,7 +4553,7 @@ gdk_wayland_seat_grab (GdkSeat *seat, if (wayland_seat->master_keyboard && capabilities & GDK_SEAT_CAPABILITY_KEYBOARD) { - GdkWindow *prev_focus = gdk_wayland_device_get_focus (wayland_seat->master_keyboard); + GdkSurface *prev_focus = gdk_wayland_device_get_focus (wayland_seat->master_keyboard); if (prev_focus != native) device_emit_grab_crossing (wayland_seat->master_keyboard, prev_focus, @@ -4561,7 +4561,7 @@ gdk_wayland_seat_grab (GdkSeat *seat, _gdk_display_add_device_grab (display, wayland_seat->master_keyboard, - window, + surface, native, GDK_OWNERSHIP_NONE, owner_events, @@ -4572,7 +4572,7 @@ gdk_wayland_seat_grab (GdkSeat *seat, /* Inhibit shortcuts if the seat grab is for the keyboard only */ if (capabilities == GDK_SEAT_CAPABILITY_KEYBOARD) - gdk_wayland_window_inhibit_shortcuts (window, seat); + gdk_wayland_surface_inhibit_shortcuts (surface, seat); } if (wayland_seat->tablets && @@ -4581,7 +4581,7 @@ gdk_wayland_seat_grab (GdkSeat *seat, for (l = wayland_seat->tablets; l; l = l->next) { GdkWaylandTabletData *tablet = l->data; - GdkWindow *prev_focus = gdk_wayland_device_get_focus (tablet->master); + GdkSurface *prev_focus = gdk_wayland_device_get_focus (tablet->master); if (prev_focus != native) device_emit_grab_crossing (tablet->master, prev_focus, @@ -4589,7 +4589,7 @@ gdk_wayland_seat_grab (GdkSeat *seat, _gdk_display_add_device_grab (display, tablet->master, - window, + surface, native, GDK_OWNERSHIP_NONE, owner_events, @@ -4598,7 +4598,7 @@ gdk_wayland_seat_grab (GdkSeat *seat, evtime, FALSE); - gdk_wayland_device_update_window_cursor (tablet->master); + gdk_wayland_device_update_surface_cursor (tablet->master); } } @@ -4615,18 +4615,18 @@ gdk_wayland_seat_ungrab (GdkSeat *seat) g_clear_object (&wayland_seat->grab_cursor); - gdk_wayland_seat_set_grab_window (wayland_seat, NULL); + gdk_wayland_seat_set_grab_surface (wayland_seat, NULL); if (wayland_seat->master_pointer) { - GdkWindow *focus, *prev_focus = NULL; + GdkSurface *focus, *prev_focus = NULL; grab = _gdk_display_get_last_device_grab (display, wayland_seat->master_pointer); if (grab) { grab->serial_end = grab->serial_start; - prev_focus = grab->window; + prev_focus = grab->surface; } focus = gdk_wayland_device_get_focus (wayland_seat->master_pointer); @@ -4636,7 +4636,7 @@ gdk_wayland_seat_ungrab (GdkSeat *seat) focus, GDK_CROSSING_UNGRAB, GDK_CURRENT_TIME); - gdk_wayland_device_update_window_cursor (wayland_seat->master_pointer); + gdk_wayland_device_update_surface_cursor (wayland_seat->master_pointer); } if (wayland_seat->master_keyboard) @@ -4646,8 +4646,8 @@ gdk_wayland_seat_ungrab (GdkSeat *seat) if (grab) { grab->serial_end = grab->serial_start; - if (grab->window) - gdk_wayland_window_restore_shortcuts (grab->window, seat); + if (grab->surface) + gdk_wayland_surface_restore_shortcuts (grab->surface, seat); } } @@ -4795,7 +4795,7 @@ _gdk_wayland_display_create_seat (GdkWaylandDisplay *display_wayland, seat->keymap = _gdk_wayland_keymap_new (display); seat->display = display; seat->touches = g_hash_table_new_full (NULL, NULL, NULL, (GDestroyNotify) g_free); - seat->foreign_dnd_window = create_foreign_dnd_window (display); + seat->foreign_dnd_surface = create_foreign_dnd_surface (display); seat->wl_seat = wl_seat; wl_seat_add_listener (seat->wl_seat, &seat_listener, seat); @@ -4965,7 +4965,7 @@ gdk_wayland_device_unset_touch_grab (GdkDevice *gdk_device, if (GDK_WAYLAND_DEVICE (seat->touch_master)->emulating_touch == touch) { GDK_WAYLAND_DEVICE (seat->touch_master)->emulating_touch = NULL; - emulate_touch_crossing (touch->window, NULL, + emulate_touch_crossing (touch->surface, NULL, seat->touch_master, seat->touch, touch, GDK_LEAVE_NOTIFY, GDK_CROSSING_NORMAL, GDK_CURRENT_TIME); @@ -4986,7 +4986,7 @@ gdk_wayland_seat_set_global_cursor (GdkSeat *seat, pointer = gdk_seat_get_pointer (seat); g_set_object (&wayland_seat->grab_cursor, cursor); - gdk_wayland_device_set_window_cursor (pointer, + gdk_wayland_device_set_surface_cursor (pointer, gdk_wayland_device_get_focus (pointer), NULL); } diff --git a/gdk/wayland/gdkdisplay-wayland.c b/gdk/wayland/gdkdisplay-wayland.c index 645f1352d8..2c35b65beb 100644 --- a/gdk/wayland/gdkdisplay-wayland.c +++ b/gdk/wayland/gdkdisplay-wayland.c @@ -636,7 +636,7 @@ _gdk_wayland_display_open (const gchar *display_name) static void destroy_toplevel (gpointer data) { - _gdk_window_destroy (GDK_WINDOW (data), FALSE); + _gdk_surface_destroy (GDK_SURFACE (data), FALSE); } static void @@ -714,7 +714,7 @@ gdk_wayland_display_get_name (GdkDisplay *display) void gdk_wayland_display_system_bell (GdkDisplay *display, - GdkWindow *window) + GdkSurface *window) { GdkWaylandDisplay *display_wayland; struct gtk_surface1 *gtk_surface; @@ -728,7 +728,7 @@ gdk_wayland_display_system_bell (GdkDisplay *display, return; if (window) - gtk_surface = gdk_wayland_window_get_gtk_surface (window); + gtk_surface = gdk_wayland_surface_get_gtk_surface (window); else gtk_surface = NULL; @@ -798,7 +798,7 @@ gdk_wayland_display_has_pending (GdkDisplay *display) return FALSE; } -static GdkWindow * +static GdkSurface * gdk_wayland_display_get_default_group (GdkDisplay *display) { g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL); @@ -916,16 +916,16 @@ gdk_wayland_display_get_monitor (GdkDisplay *display, } static GdkMonitor * -gdk_wayland_display_get_monitor_at_window (GdkDisplay *display, - GdkWindow *window) +gdk_wayland_display_get_monitor_at_surface (GdkDisplay *display, + GdkSurface *window) { GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (display); struct wl_output *output; int i; - g_return_val_if_fail (GDK_IS_WAYLAND_WINDOW (window), NULL); + g_return_val_if_fail (GDK_IS_WAYLAND_SURFACE (window), NULL); - output = gdk_wayland_window_get_wl_output (window); + output = gdk_wayland_surface_get_wl_output (window); if (output == NULL) return NULL; @@ -953,7 +953,7 @@ gdk_wayland_display_class_init (GdkWaylandDisplayClass *class) object_class->dispose = gdk_wayland_display_dispose; object_class->finalize = gdk_wayland_display_finalize; - display_class->window_type = gdk_wayland_window_get_type (); + display_class->surface_type = gdk_wayland_surface_get_type (); #ifdef GDK_RENDERING_VULKAN display_class->vk_context_type = GDK_TYPE_WAYLAND_VULKAN_CONTEXT; @@ -973,7 +973,7 @@ gdk_wayland_display_class_init (GdkWaylandDisplayClass *class) display_class->get_app_launch_context = _gdk_wayland_display_get_app_launch_context; display_class->get_next_serial = gdk_wayland_display_get_next_serial; display_class->notify_startup_complete = gdk_wayland_display_notify_startup_complete; - display_class->create_window_impl = _gdk_wayland_display_create_window_impl; + display_class->create_surface_impl = _gdk_wayland_display_create_surface_impl; display_class->get_keymap = _gdk_wayland_display_get_keymap; display_class->text_property_to_utf8_list = _gdk_wayland_display_text_property_to_utf8_list; display_class->utf8_to_string_target = _gdk_wayland_display_utf8_to_string_target; @@ -982,7 +982,7 @@ gdk_wayland_display_class_init (GdkWaylandDisplayClass *class) display_class->get_n_monitors = gdk_wayland_display_get_n_monitors; display_class->get_monitor = gdk_wayland_display_get_monitor; - display_class->get_monitor_at_window = gdk_wayland_display_get_monitor_at_window; + display_class->get_monitor_at_surface = gdk_wayland_display_get_monitor_at_surface; display_class->get_setting = gdk_wayland_display_get_setting; display_class->set_cursor_theme = gdk_wayland_display_set_cursor_theme; } @@ -996,7 +996,7 @@ gdk_wayland_display_init (GdkWaylandDisplay *display) } GList * -gdk_wayland_display_get_toplevel_windows (GdkDisplay *display) +gdk_wayland_display_get_toplevel_surfaces (GdkDisplay *display) { return GDK_WAYLAND_DISPLAY (display)->toplevels; } @@ -1847,8 +1847,8 @@ transform_to_string (int transform) static void update_scale (GdkDisplay *display) { - g_list_foreach (gdk_wayland_display_get_toplevel_windows (display), - (GFunc)gdk_wayland_window_update_scale, + g_list_foreach (gdk_wayland_display_get_toplevel_surfaces (display), + (GFunc)gdk_wayland_surface_update_scale, NULL); } diff --git a/gdk/wayland/gdkdisplay-wayland.h b/gdk/wayland/gdkdisplay-wayland.h index 5b0fa7918b..625b5e2f4a 100644 --- a/gdk/wayland/gdkdisplay-wayland.h +++ b/gdk/wayland/gdkdisplay-wayland.h @@ -37,7 +37,7 @@ #include <glib.h> #include <gdk/gdkkeys.h> -#include <gdk/gdkwindow.h> +#include <gdk/gdksurface.h> #include <gdk/gdkinternals.h> #include <gdk/gdk.h> /* For gdk_get_program_class() */ diff --git a/gdk/wayland/gdkdnd-wayland.c b/gdk/wayland/gdkdnd-wayland.c index da90cbe467..c9893390af 100644 --- a/gdk/wayland/gdkdnd-wayland.c +++ b/gdk/wayland/gdkdnd-wayland.c @@ -47,8 +47,8 @@ typedef struct _GdkWaylandDragContextClass GdkWaylandDragContextClass; struct _GdkWaylandDragContext { GdkDragContext context; - GdkWindow *dnd_window; - struct wl_surface *dnd_surface; + GdkSurface *dnd_surface; + struct wl_surface *dnd_wl_surface; struct wl_data_source *data_source; GdkDragAction selected_action; uint32_t serial; @@ -74,7 +74,7 @@ gdk_wayland_drag_context_finalize (GObject *object) { GdkWaylandDragContext *wayland_context = GDK_WAYLAND_DRAG_CONTEXT (object); GdkDragContext *context = GDK_DRAG_CONTEXT (object); - GdkWindow *dnd_window; + GdkSurface *dnd_surface; contexts = g_list_remove (contexts, context); @@ -86,12 +86,12 @@ gdk_wayland_drag_context_finalize (GObject *object) if (wayland_context->data_source) wl_data_source_destroy (wayland_context->data_source); - dnd_window = wayland_context->dnd_window; + dnd_surface = wayland_context->dnd_surface; G_OBJECT_CLASS (gdk_wayland_drag_context_parent_class)->finalize (object); - if (dnd_window) - gdk_window_destroy (dnd_window); + if (dnd_surface) + gdk_surface_destroy (dnd_surface); } void @@ -99,7 +99,7 @@ _gdk_wayland_drag_context_emit_event (GdkDragContext *context, GdkEventType type, guint32 time_) { - GdkWindow *window; + GdkSurface *surface; GdkEvent *event; switch ((guint) type) @@ -114,19 +114,19 @@ _gdk_wayland_drag_context_emit_event (GdkDragContext *context, } if (context->is_source) - window = gdk_drag_context_get_source_window (context); + surface = gdk_drag_context_get_source_surface (context); else - window = gdk_drag_context_get_dest_window (context); + surface = gdk_drag_context_get_dest_surface (context); event = gdk_event_new (type); - event->any.window = g_object_ref (window); + event->any.surface = g_object_ref (surface); event->dnd.context = g_object_ref (context); event->dnd.time = time_; event->dnd.x_root = GDK_WAYLAND_DRAG_CONTEXT (context)->x; event->dnd.y_root = GDK_WAYLAND_DRAG_CONTEXT (context)->y; gdk_event_set_device (event, gdk_drag_context_get_device (context)); - gdk_display_put_event (gdk_window_get_display (window), event); + gdk_display_put_event (gdk_surface_get_display (surface), event); g_object_unref (event); } @@ -174,7 +174,7 @@ gdk_wayland_drop_context_set_status (GdkDragContext *context, GdkDisplay *display; struct wl_data_offer *wl_offer; - if (!context->dest_window) + if (!context->dest_surface) return; context_wayland = GDK_WAYLAND_DRAG_CONTEXT (context); @@ -360,10 +360,10 @@ gdk_wayland_drag_context_init (GdkWaylandDragContext *context_wayland) context->actions = GDK_ACTION_COPY | GDK_ACTION_MOVE; } -static GdkWindow * -gdk_wayland_drag_context_get_drag_window (GdkDragContext *context) +static GdkSurface * +gdk_wayland_drag_context_get_drag_surface (GdkDragContext *context) { - return GDK_WAYLAND_DRAG_CONTEXT (context)->dnd_window; + return GDK_WAYLAND_DRAG_CONTEXT (context)->dnd_surface; } static void @@ -382,9 +382,9 @@ gdk_wayland_drag_context_set_hotspot (GdkDragContext *context, if (prev_hot_x == hot_x && prev_hot_y == hot_y) return; - _gdk_wayland_window_offset_next_wl_buffer (context_wayland->dnd_window, + _gdk_wayland_surface_offset_next_wl_buffer (context_wayland->dnd_surface, -hot_x, -hot_y); - gdk_window_invalidate_rect (context_wayland->dnd_window, &damage_rect, FALSE); + gdk_surface_invalidate_rect (context_wayland->dnd_surface, &damage_rect, FALSE); } static void @@ -428,8 +428,8 @@ gdk_wayland_drag_context_drop_done (GdkDragContext *context, if (success) { - if (context_wayland->dnd_window) - gdk_window_hide (context_wayland->dnd_window); + if (context_wayland->dnd_surface) + gdk_surface_hide (context_wayland->dnd_surface); } } @@ -450,7 +450,7 @@ gdk_wayland_drag_context_class_init (GdkWaylandDragContextClass *klass) context_class->read_async = gdk_wayland_drag_context_read_async; context_class->read_finish = gdk_wayland_drag_context_read_finish; context_class->drop_status = gdk_wayland_drag_context_drop_status; - context_class->get_drag_window = gdk_wayland_drag_context_get_drag_window; + context_class->get_drag_surface = gdk_wayland_drag_context_get_drag_surface; context_class->set_hotspot = gdk_wayland_drag_context_set_hotspot; context_class->drop_done = gdk_wayland_drag_context_drop_done; context_class->set_cursor = gdk_wayland_drag_context_set_cursor; @@ -461,24 +461,24 @@ gdk_wayland_drag_context_class_init (GdkWaylandDragContextClass *klass) } void -_gdk_wayland_window_register_dnd (GdkWindow *window) +_gdk_wayland_surface_register_dnd (GdkSurface *surface) { } -static GdkWindow * -create_dnd_window (GdkDisplay *display) +static GdkSurface * +create_dnd_surface (GdkDisplay *display) { - GdkWindow *window; + GdkSurface *surface; - window = gdk_window_new_popup (display, &(GdkRectangle) { 0, 0, 100, 100 }); + surface = gdk_surface_new_popup (display, &(GdkRectangle) { 0, 0, 100, 100 }); - gdk_window_set_type_hint (window, GDK_WINDOW_TYPE_HINT_DND); + gdk_surface_set_type_hint (surface, GDK_SURFACE_TYPE_HINT_DND); - return window; + return surface; } GdkDragContext * -_gdk_wayland_window_drag_begin (GdkWindow *window, +_gdk_wayland_surface_drag_begin (GdkSurface *surface, GdkDevice *device, GdkContentProvider *content, GdkDragAction actions, @@ -498,15 +498,15 @@ _gdk_wayland_window_drag_begin (GdkWindow *window, "content", content, NULL); context = GDK_DRAG_CONTEXT (context_wayland); - context->source_window = g_object_ref (window); + context->source_surface = g_object_ref (surface); context->is_source = TRUE; gdk_drag_context_set_device (context, device); - context_wayland->dnd_window = create_dnd_window (gdk_window_get_display (window)); - context_wayland->dnd_surface = gdk_wayland_window_get_wl_surface (context_wayland->dnd_window); + context_wayland->dnd_surface = create_dnd_surface (gdk_surface_get_display (surface)); + context_wayland->dnd_wl_surface = gdk_wayland_surface_get_wl_surface (context_wayland->dnd_surface); context_wayland->data_source = - gdk_wayland_selection_get_data_source (window); + gdk_wayland_selection_get_data_source (surface); mimetypes = gdk_content_formats_get_mime_types (context->formats, &n_mimetypes); for (i = 0; i < n_mimetypes; i++) @@ -523,8 +523,8 @@ _gdk_wayland_window_drag_begin (GdkWindow *window, wl_data_device_start_drag (gdk_wayland_device_get_data_device (device), context_wayland->data_source, - gdk_wayland_window_get_wl_surface (window), - context_wayland->dnd_surface, + gdk_wayland_surface_get_wl_surface (surface), + context_wayland->dnd_wl_surface, _gdk_wayland_display_get_serial (display_wayland)); gdk_seat_ungrab (gdk_device_get_seat (device)); @@ -579,24 +579,24 @@ _gdk_wayland_drag_context_set_coords (GdkDragContext *context, } void -_gdk_wayland_drag_context_set_source_window (GdkDragContext *context, - GdkWindow *window) +_gdk_wayland_drag_context_set_source_surface (GdkDragContext *context, + GdkSurface *surface) { - if (context->source_window) - g_object_unref (context->source_window); + if (context->source_surface) + g_object_unref (context->source_surface); - context->source_window = window ? g_object_ref (window) : NULL; + context->source_surface = surface ? g_object_ref (surface) : NULL; } void -_gdk_wayland_drag_context_set_dest_window (GdkDragContext *context, - GdkWindow *dest_window, +_gdk_wayland_drag_context_set_dest_surface (GdkDragContext *context, + GdkSurface *dest_surface, uint32_t serial) { - if (context->dest_window) - g_object_unref (context->dest_window); + if (context->dest_surface) + g_object_unref (context->dest_surface); - context->dest_window = dest_window ? g_object_ref (dest_window) : NULL; + context->dest_surface = dest_surface ? g_object_ref (dest_surface) : NULL; GDK_WAYLAND_DRAG_CONTEXT (context)->serial = serial; gdk_wayland_drop_context_update_targets (context); } @@ -618,13 +618,13 @@ gdk_wayland_drag_context_lookup_by_data_source (struct wl_data_source *source) } GdkDragContext * -gdk_wayland_drag_context_lookup_by_source_window (GdkWindow *window) +gdk_wayland_drag_context_lookup_by_source_surface (GdkSurface *surface) { GList *l; for (l = contexts; l; l = l->next) { - if (window == gdk_drag_context_get_source_window (l->data)) + if (surface == gdk_drag_context_get_source_surface (l->data)) return l->data; } diff --git a/gdk/wayland/gdkglcontext-wayland.c b/gdk/wayland/gdkglcontext-wayland.c index 14cece96c6..1e6f2ca28a 100644 --- a/gdk/wayland/gdkglcontext-wayland.c +++ b/gdk/wayland/gdkglcontext-wayland.c @@ -26,7 +26,7 @@ #include "gdkwaylanddisplay.h" #include "gdkwaylandglcontext.h" -#include "gdkwaylandwindow.h" +#include "gdkwaylandsurface.h" #include "gdkprivate-wayland.h" #include "gdkinternals.h" @@ -163,7 +163,7 @@ gdk_wayland_gl_context_get_damage (GdkGLContext *context) GdkDisplay *display = gdk_draw_context_get_display (GDK_DRAW_CONTEXT (context)); GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (display); EGLSurface egl_surface; - GdkWindow *window = gdk_draw_context_get_window (GDK_DRAW_CONTEXT (context)); + GdkSurface *surface = gdk_draw_context_get_surface (GDK_DRAW_CONTEXT (context)); int buffer_age = 0; if (display_wayland->have_egl_buffer_age) @@ -176,7 +176,7 @@ gdk_wayland_gl_context_get_damage (GdkGLContext *context) shared = context; shared_wayland = GDK_WAYLAND_GL_CONTEXT (shared); - egl_surface = gdk_wayland_window_get_egl_surface (window->impl_window, + egl_surface = gdk_wayland_surface_get_egl_surface (surface->impl_surface, shared_wayland->egl_config); gdk_gl_context_make_current (shared); eglQuerySurface (display_wayland->egl_display, egl_surface, @@ -184,16 +184,16 @@ gdk_wayland_gl_context_get_damage (GdkGLContext *context) if (buffer_age == 2) { - if (window->old_updated_area[0]) - return cairo_region_copy (window->old_updated_area[0]); + if (surface->old_updated_area[0]) + return cairo_region_copy (surface->old_updated_area[0]); } else if (buffer_age == 3) { - if (window->old_updated_area[0] && - window->old_updated_area[1]) + if (surface->old_updated_area[0] && + surface->old_updated_area[1]) { - cairo_region_t *damage = cairo_region_copy (window->old_updated_area[0]); - cairo_region_union (damage, window->old_updated_area[1]); + cairo_region_t *damage = cairo_region_copy (surface->old_updated_area[0]); + cairo_region_union (damage, surface->old_updated_area[1]); return damage; } } @@ -208,8 +208,8 @@ gdk_wayland_gl_context_end_frame (GdkDrawContext *draw_context, cairo_region_t *damage) { GdkGLContext *context = GDK_GL_CONTEXT (draw_context); - GdkWindow *window = gdk_gl_context_get_window (context); - GdkDisplay *display = gdk_window_get_display (window); + GdkSurface *surface = gdk_gl_context_get_surface (context); + GdkDisplay *display = gdk_surface_get_display (surface); GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (display); GdkWaylandGLContext *context_wayland = GDK_WAYLAND_GL_CONTEXT (context); EGLSurface egl_surface; @@ -220,7 +220,7 @@ gdk_wayland_gl_context_end_frame (GdkDrawContext *draw_context, gdk_gl_context_make_current (context); - egl_surface = gdk_wayland_window_get_egl_surface (window->impl_window, + egl_surface = gdk_wayland_surface_get_egl_surface (surface->impl_surface, context_wayland->egl_config); if (display_wayland->have_egl_swap_buffers_with_damage && damage != NULL) @@ -228,13 +228,13 @@ gdk_wayland_gl_context_end_frame (GdkDrawContext *draw_context, int i, j, n_rects = cairo_region_num_rectangles (damage); EGLint *rects = g_new (EGLint, n_rects * 4); cairo_rectangle_int_t rect; - int window_height = gdk_window_get_height (window); + int surface_height = gdk_surface_get_height (surface); for (i = 0, j = 0; i < n_rects; i++) { cairo_region_get_rectangle (damage, i, &rect); rects[j++] = rect.x; - rects[j++] = window_height - rect.height - rect.y; + rects[j++] = surface_height - rect.height - rect.y; rects[j++] = rect.width; rects[j++] = rect.height; } @@ -244,7 +244,7 @@ gdk_wayland_gl_context_end_frame (GdkDrawContext *draw_context, else eglSwapBuffers (display_wayland->egl_display, egl_surface); - gdk_wayland_window_sync (window); + gdk_wayland_surface_sync (surface); } static void @@ -360,11 +360,11 @@ gdk_wayland_display_init_gl (GdkDisplay *display) #define MAX_EGL_ATTRS 30 static gboolean -find_eglconfig_for_window (GdkWindow *window, +find_eglconfig_for_surface (GdkSurface *surface, EGLConfig *egl_config_out, GError **error) { - GdkDisplay *display = gdk_window_get_display (window); + GdkDisplay *display = gdk_surface_get_display (surface); GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (display); EGLint attrs[MAX_EGL_ATTRS]; EGLint count; @@ -418,12 +418,12 @@ find_eglconfig_for_window (GdkWindow *window, } GdkGLContext * -gdk_wayland_window_create_gl_context (GdkWindow *window, +gdk_wayland_surface_create_gl_context (GdkSurface *surface, gboolean attached, GdkGLContext *share, GError **error) { - GdkDisplay *display = gdk_window_get_display (window); + GdkDisplay *display = gdk_surface_get_display (surface); GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (display); GdkWaylandGLContext *context; EGLConfig config; @@ -444,11 +444,11 @@ gdk_wayland_window_create_gl_context (GdkWindow *window, return NULL; } - if (!find_eglconfig_for_window (window, &config, error)) + if (!find_eglconfig_for_surface (surface, &config, error)) return NULL; context = g_object_new (GDK_TYPE_WAYLAND_GL_CONTEXT, - "window", window, + "surface", surface, "shared-context", share, NULL); @@ -466,8 +466,8 @@ gdk_wayland_gl_context_dispose (GObject *gobject) if (context_wayland->egl_context != NULL) { GdkGLContext *context = GDK_GL_CONTEXT (gobject); - GdkWindow *window = gdk_gl_context_get_window (context); - GdkDisplay *display = gdk_window_get_display (window); + GdkSurface *surface = gdk_gl_context_get_surface (context); + GdkDisplay *display = gdk_surface_get_display (surface); GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (display); if (eglGetCurrentContext () == context_wayland->egl_context) @@ -490,7 +490,7 @@ gdk_wayland_display_make_gl_context_current (GdkDisplay *display, { GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (display); GdkWaylandGLContext *context_wayland; - GdkWindow *window; + GdkSurface *surface; EGLSurface egl_surface; if (context == NULL) @@ -501,16 +501,16 @@ gdk_wayland_display_make_gl_context_current (GdkDisplay *display, } context_wayland = GDK_WAYLAND_GL_CONTEXT (context); - window = gdk_gl_context_get_window (context); + surface = gdk_gl_context_get_surface (context); if (context_wayland->is_attached || gdk_draw_context_is_drawing (GDK_DRAW_CONTEXT (context))) - egl_surface = gdk_wayland_window_get_egl_surface (window->impl_window, context_wayland->egl_config); + egl_surface = gdk_wayland_surface_get_egl_surface (surface->impl_surface, context_wayland->egl_config); else { if (display_wayland->have_egl_surfaceless_context) egl_surface = EGL_NO_SURFACE; else - egl_surface = gdk_wayland_window_get_dummy_egl_surface (window->impl_window, + egl_surface = gdk_wayland_surface_get_dummy_egl_surface (surface->impl_surface, context_wayland->egl_config); } diff --git a/gdk/wayland/gdkglcontext-wayland.h b/gdk/wayland/gdkglcontext-wayland.h index 819818b557..48966b90ad 100644 --- a/gdk/wayland/gdkglcontext-wayland.h +++ b/gdk/wayland/gdkglcontext-wayland.h @@ -24,7 +24,7 @@ #include "gdkglcontextprivate.h" #include "gdkdisplayprivate.h" -#include "gdkwindow.h" +#include "gdksurface.h" #include "gdkinternals.h" #include <epoxy/egl.h> @@ -46,7 +46,7 @@ struct _GdkWaylandGLContextClass }; gboolean gdk_wayland_display_init_gl (GdkDisplay *display); -GdkGLContext * gdk_wayland_window_create_gl_context (GdkWindow *window, +GdkGLContext * gdk_wayland_surface_create_gl_context (GdkSurface *surface, gboolean attach, GdkGLContext *share, GError **error); diff --git a/gdk/wayland/gdkprivate-wayland.h b/gdk/wayland/gdkprivate-wayland.h index 6d3fe4c778..5ef028c134 100644 --- a/gdk/wayland/gdkprivate-wayland.h +++ b/gdk/wayland/gdkprivate-wayland.h @@ -43,7 +43,7 @@ #define WL_SURFACE_HAS_BUFFER_SCALE 3 #define WL_POINTER_HAS_FRAME 5 -#define GDK_WINDOW_IS_WAYLAND(win) (GDK_IS_WINDOW_IMPL_WAYLAND (((GdkWindow *)win)->impl)) +#define GDK_SURFACE_IS_WAYLAND(win) (GDK_IS_SURFACE_IMPL_WAYLAND (((GdkSurface *)win)->impl)) GdkKeymap *_gdk_wayland_keymap_new (GdkDisplay *display); void _gdk_wayland_keymap_update_from_fd (GdkKeymap *keymap, @@ -71,7 +71,7 @@ gboolean _gdk_wayland_display_supports_cursor_alpha (GdkDisplay *display); gboolean _gdk_wayland_display_supports_cursor_color (GdkDisplay *display); void gdk_wayland_display_system_bell (GdkDisplay *display, - GdkWindow *window); + GdkSurface *surface); struct wl_buffer *_gdk_wayland_cursor_get_buffer (GdkWaylandDisplay *display, GdkCursor *cursor, @@ -88,24 +88,24 @@ guint _gdk_wayland_cursor_get_next_image_index (GdkWaylandDisplay *display, guint current_image_index, guint *next_image_delay); -void gdk_wayland_window_sync (GdkWindow *window); +void gdk_wayland_surface_sync (GdkSurface *surface); -void _gdk_wayland_window_register_dnd (GdkWindow *window); -GdkDragContext *_gdk_wayland_window_drag_begin (GdkWindow *window, +void _gdk_wayland_surface_register_dnd (GdkSurface *surface); +GdkDragContext *_gdk_wayland_surface_drag_begin (GdkSurface *surface, GdkDevice *device, GdkContentProvider *content, GdkDragAction actions, gint dx, gint dy); -void _gdk_wayland_window_offset_next_wl_buffer (GdkWindow *window, +void _gdk_wayland_surface_offset_next_wl_buffer (GdkSurface *surface, int x, int y); GdkDragContext * _gdk_wayland_drop_context_new (GdkDisplay *display, struct wl_data_device *data_device); -void _gdk_wayland_drag_context_set_source_window (GdkDragContext *context, - GdkWindow *window); -void _gdk_wayland_drag_context_set_dest_window (GdkDragContext *context, - GdkWindow *dest_window, +void _gdk_wayland_drag_context_set_source_surface (GdkDragContext *context, + GdkSurface *surface); +void _gdk_wayland_drag_context_set_dest_surface (GdkDragContext *context, + GdkSurface *dest_surface, uint32_t serial); void _gdk_wayland_drag_context_emit_event (GdkDragContext *context, GdkEventType type, @@ -118,16 +118,16 @@ void gdk_wayland_drag_context_set_action (GdkDragContext *context, GdkDragAction action); GdkDragContext * gdk_wayland_drag_context_lookup_by_data_source (struct wl_data_source *source); -GdkDragContext * gdk_wayland_drag_context_lookup_by_source_window (GdkWindow *window); +GdkDragContext * gdk_wayland_drag_context_lookup_by_source_surface (GdkSurface *surface); struct wl_data_source * gdk_wayland_drag_context_get_data_source (GdkDragContext *context); void gdk_wayland_drop_context_update_targets (GdkDragContext *context); -void _gdk_wayland_display_create_window_impl (GdkDisplay *display, - GdkWindow *window, - GdkWindow *real_parent, +void _gdk_wayland_display_create_surface_impl (GdkDisplay *display, + GdkSurface *surface, + GdkSurface *real_parent, GdkEventMask event_mask, - GdkWindowAttr *attributes); + GdkSurfaceAttr *attributes); gint _gdk_wayland_display_text_property_to_utf8_list (GdkDisplay *display, GdkAtom encoding, @@ -166,7 +166,7 @@ GdkAppLaunchContext *_gdk_wayland_display_get_app_launch_context (GdkDisplay *di GdkDisplay *_gdk_wayland_display_open (const gchar *display_name); -GList *gdk_wayland_display_get_toplevel_windows (GdkDisplay *display); +GList *gdk_wayland_display_get_toplevel_surfaces (GdkDisplay *display); int gdk_wayland_display_get_output_refresh_rate (GdkWaylandDisplay *display_wayland, struct wl_output *output); @@ -175,7 +175,7 @@ guint32 gdk_wayland_display_get_output_scale (GdkWaylandDisplay *display_wayland struct wl_output *gdk_wayland_display_get_wl_output (GdkDisplay *display, int monitor_num); -void _gdk_wayland_window_set_grab_seat (GdkWindow *window, +void _gdk_wayland_surface_set_grab_seat (GdkSurface *surface, GdkSeat *seat); guint32 _gdk_wayland_display_get_serial (GdkWaylandDisplay *display_wayland); @@ -205,29 +205,29 @@ void gdk_wayland_selection_set_offer (GdkDisplay *display, gpointer gdk_wayland_selection_get_offer (GdkDisplay *display); GdkContentFormats *gdk_wayland_selection_get_targets (GdkDisplay *display); -struct wl_data_source * gdk_wayland_selection_get_data_source (GdkWindow *owner); +struct wl_data_source * gdk_wayland_selection_get_data_source (GdkSurface *owner); void gdk_wayland_selection_unset_data_source (GdkDisplay *display); gboolean gdk_wayland_selection_set_current_offer_actions (GdkDisplay *display, uint32_t actions); -EGLSurface gdk_wayland_window_get_egl_surface (GdkWindow *window, +EGLSurface gdk_wayland_surface_get_egl_surface (GdkSurface *surface, EGLConfig config); -EGLSurface gdk_wayland_window_get_dummy_egl_surface (GdkWindow *window, +EGLSurface gdk_wayland_surface_get_dummy_egl_surface (GdkSurface *surface, EGLConfig config); -struct gtk_surface1 * gdk_wayland_window_get_gtk_surface (GdkWindow *window); +struct gtk_surface1 * gdk_wayland_surface_get_gtk_surface (GdkSurface *surface); void gdk_wayland_seat_set_global_cursor (GdkSeat *seat, GdkCursor *cursor); -struct wl_output *gdk_wayland_window_get_wl_output (GdkWindow *window); +struct wl_output *gdk_wayland_surface_get_wl_output (GdkSurface *surface); -void gdk_wayland_window_inhibit_shortcuts (GdkWindow *window, +void gdk_wayland_surface_inhibit_shortcuts (GdkSurface *surface, GdkSeat *gdk_seat); -void gdk_wayland_window_restore_shortcuts (GdkWindow *window, +void gdk_wayland_surface_restore_shortcuts (GdkSurface *surface, GdkSeat *gdk_seat); -void gdk_wayland_window_update_scale (GdkWindow *window); +void gdk_wayland_surface_update_scale (GdkSurface *surface); #endif /* __GDK_PRIVATE_WAYLAND_H__ */ diff --git a/gdk/wayland/gdkselection-wayland.c b/gdk/wayland/gdkselection-wayland.c index 9f7826e1da..757748dd7f 100644 --- a/gdk/wayland/gdkselection-wayland.c +++ b/gdk/wayland/gdkselection-wayland.c @@ -162,7 +162,7 @@ data_offer_source_actions (void *data, GDK_DISPLAY_NOTE (display, EVENTS, g_message ("data offer source actions, offer %p, actions %d", wl_data_offer, source_actions)); - if (gdk_drag_context_get_dest_window (drop_context)) + if (gdk_drag_context_get_dest_surface (drop_context)) _gdk_wayland_drag_context_emit_event (drop_context, GDK_DRAG_MOTION, GDK_CURRENT_TIME); } @@ -184,7 +184,7 @@ data_offer_action (void *data, drop_context->action = _wl_to_gdk_actions (action); - if (gdk_drag_context_get_dest_window (drop_context)) + if (gdk_drag_context_get_dest_surface (drop_context)) _gdk_wayland_drag_context_emit_event (drop_context, GDK_DRAG_MOTION, GDK_CURRENT_TIME); } @@ -427,9 +427,9 @@ static const struct wl_data_source_listener data_source_listener = { }; struct wl_data_source * -gdk_wayland_selection_get_data_source (GdkWindow *owner) +gdk_wayland_selection_get_data_source (GdkSurface *owner) { - GdkDisplay *display = gdk_window_get_display (owner); + GdkDisplay *display = gdk_surface_get_display (owner); GdkWaylandSelection *wayland_selection = gdk_wayland_display_get_selection (display); gpointer source = NULL; GdkWaylandDisplay *display_wayland; @@ -437,7 +437,7 @@ gdk_wayland_selection_get_data_source (GdkWindow *owner) if (wayland_selection->dnd_source) return wayland_selection->dnd_source; - display_wayland = GDK_WAYLAND_DISPLAY (gdk_window_get_display (owner)); + display_wayland = GDK_WAYLAND_DISPLAY (gdk_surface_get_display (owner)); source = wl_data_device_manager_create_data_source (display_wayland->data_device_manager); wl_data_source_add_listener (source, diff --git a/gdk/wayland/gdkwindow-wayland.c b/gdk/wayland/gdksurface-wayland.c index 7a863776aa..d91be60e89 100644 --- a/gdk/wayland/gdkwindow-wayland.c +++ b/gdk/wayland/gdksurface-wayland.c @@ -23,8 +23,8 @@ #include "gdk.h" #include "gdkwayland.h" -#include "gdkwindow.h" -#include "gdkwindowimpl.h" +#include "gdksurface.h" +#include "gdksurfaceimpl.h" #include "gdkdisplay-wayland.h" #include "gdkglcontext-wayland.h" #include "gdkframeclockprivate.h" @@ -48,45 +48,45 @@ enum { static guint signals[LAST_SIGNAL]; -#define WINDOW_IS_TOPLEVEL(window) \ - (GDK_WINDOW_TYPE (window) != GDK_WINDOW_CHILD) +#define SURFACE_IS_TOPLEVEL(surface) \ + (GDK_SURFACE_TYPE (surface) != GDK_SURFACE_CHILD) #define MAX_WL_BUFFER_SIZE (4083) /* 4096 minus header, string argument length and NUL byte */ -typedef struct _GdkWaylandWindow GdkWaylandWindow; -typedef struct _GdkWaylandWindowClass GdkWaylandWindowClass; +typedef struct _GdkWaylandSurface GdkWaylandSurface; +typedef struct _GdkWaylandSurfaceClass GdkWaylandSurfaceClass; -struct _GdkWaylandWindow +struct _GdkWaylandSurface { - GdkWindow parent; + GdkSurface parent; }; -struct _GdkWaylandWindowClass +struct _GdkWaylandSurfaceClass { - GdkWindowClass parent_class; + GdkSurfaceClass parent_class; }; -G_DEFINE_TYPE (GdkWaylandWindow, gdk_wayland_window, GDK_TYPE_WINDOW) +G_DEFINE_TYPE (GdkWaylandSurface, gdk_wayland_surface, GDK_TYPE_SURFACE) static void -gdk_wayland_window_class_init (GdkWaylandWindowClass *wayland_window_class) +gdk_wayland_surface_class_init (GdkWaylandSurfaceClass *wayland_surface_class) { } static void -gdk_wayland_window_init (GdkWaylandWindow *wayland_window) +gdk_wayland_surface_init (GdkWaylandSurface *wayland_surface) { } -#define GDK_TYPE_WINDOW_IMPL_WAYLAND (_gdk_window_impl_wayland_get_type ()) -#define GDK_WINDOW_IMPL_WAYLAND(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_WINDOW_IMPL_WAYLAND, GdkWindowImplWayland)) -#define GDK_WINDOW_IMPL_WAYLAND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_WINDOW_IMPL_WAYLAND, GdkWindowImplWaylandClass)) -#define GDK_IS_WINDOW_IMPL_WAYLAND(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_WINDOW_IMPL_WAYLAND)) -#define GDK_IS_WINDOW_IMPL_WAYLAND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_WINDOW_IMPL_WAYLAND)) -#define GDK_WINDOW_IMPL_WAYLAND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_WINDOW_IMPL_WAYLAND, GdkWindowImplWaylandClass)) +#define GDK_TYPE_SURFACE_IMPL_WAYLAND (_gdk_surface_impl_wayland_get_type ()) +#define GDK_SURFACE_IMPL_WAYLAND(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_SURFACE_IMPL_WAYLAND, GdkSurfaceImplWayland)) +#define GDK_SURFACE_IMPL_WAYLAND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_SURFACE_IMPL_WAYLAND, GdkSurfaceImplWaylandClass)) +#define GDK_IS_SURFACE_IMPL_WAYLAND(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_SURFACE_IMPL_WAYLAND)) +#define GDK_IS_SURFACE_IMPL_WAYLAND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_SURFACE_IMPL_WAYLAND)) +#define GDK_SURFACE_IMPL_WAYLAND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_SURFACE_IMPL_WAYLAND, GdkSurfaceImplWaylandClass)) -typedef struct _GdkWindowImplWayland GdkWindowImplWayland; -typedef struct _GdkWindowImplWaylandClass GdkWindowImplWaylandClass; +typedef struct _GdkSurfaceImplWayland GdkSurfaceImplWayland; +typedef struct _GdkSurfaceImplWaylandClass GdkSurfaceImplWaylandClass; typedef enum _PositionMethod { @@ -95,14 +95,14 @@ typedef enum _PositionMethod POSITION_METHOD_MOVE_TO_RECT } PositionMethod; -struct _GdkWindowImplWayland +struct _GdkSurfaceImplWayland { - GdkWindowImpl parent_instance; + GdkSurfaceImpl parent_instance; - GdkWindow *wrapper; + GdkSurface *wrapper; struct { - /* The wl_outputs that this window currently touches */ + /* The wl_outputs that this surface currently touches */ GSList *outputs; struct wl_surface *wl_surface; @@ -126,9 +126,9 @@ struct _GdkWindowImplWayland unsigned int pending_buffer_attached : 1; unsigned int pending_commit : 1; unsigned int awaiting_frame : 1; - GdkWindowTypeHint hint; - GdkWindow *transient_for; - GdkWindow *popup_parent; + GdkSurfaceTypeHint hint; + GdkSurface *transient_for; + GdkSurface *popup_parent; PositionMethod position_method; cairo_surface_t *staging_cairo_surface; @@ -152,7 +152,7 @@ struct _GdkWindowImplWayland } application; GdkGeometry geometry_hints; - GdkWindowHints geometry_mask; + GdkSurfaceHints geometry_mask; GdkSeat *grab_input_seat; @@ -183,7 +183,7 @@ struct _GdkWindowImplWayland struct { GdkRectangle rect; GdkGravity rect_anchor; - GdkGravity window_anchor; + GdkGravity surface_anchor; GdkAnchorHints anchor_hints; gint rect_anchor_dx; gint rect_anchor_dy; @@ -192,11 +192,11 @@ struct _GdkWindowImplWayland struct { int width; int height; - GdkWindowState state; + GdkSurfaceState state; } pending; struct { - GdkWaylandWindowExported callback; + GdkWaylandSurfaceExported callback; gpointer user_data; GDestroyNotify destroy_func; } exported; @@ -205,28 +205,28 @@ struct _GdkWindowImplWayland GHashTable *shortcuts_inhibitors; }; -struct _GdkWindowImplWaylandClass +struct _GdkSurfaceImplWaylandClass { - GdkWindowImplClass parent_class; + GdkSurfaceImplClass parent_class; }; -static void gdk_wayland_window_maybe_configure (GdkWindow *window, +static void gdk_wayland_surface_maybe_configure (GdkSurface *surface, int width, int height, int scale); -static void maybe_set_gtk_surface_dbus_properties (GdkWindow *window); -static void maybe_set_gtk_surface_modal (GdkWindow *window); +static void maybe_set_gtk_surface_dbus_properties (GdkSurface *surface); +static void maybe_set_gtk_surface_modal (GdkSurface *surface); -static void gdk_window_request_transient_parent_commit (GdkWindow *window); +static void gdk_surface_request_transient_parent_commit (GdkSurface *surface); -static void gdk_wayland_window_sync_margin (GdkWindow *window); -static void gdk_wayland_window_sync_input_region (GdkWindow *window); -static void gdk_wayland_window_sync_opaque_region (GdkWindow *window); +static void gdk_wayland_surface_sync_margin (GdkSurface *surface); +static void gdk_wayland_surface_sync_input_region (GdkSurface *surface); +static void gdk_wayland_surface_sync_opaque_region (GdkSurface *surface); -static void unset_transient_for_exported (GdkWindow *window); +static void unset_transient_for_exported (GdkSurface *surface); -static void calculate_moved_to_rect_result (GdkWindow *window, +static void calculate_moved_to_rect_result (GdkSurface *surface, int x, int y, int width, @@ -236,14 +236,14 @@ static void calculate_moved_to_rect_result (GdkWindow *window, gboolean *flipped_x, gboolean *flipped_y); -static gboolean gdk_wayland_window_is_exported (GdkWindow *window); +static gboolean gdk_wayland_surface_is_exported (GdkSurface *surface); -GType _gdk_window_impl_wayland_get_type (void); +GType _gdk_surface_impl_wayland_get_type (void); -G_DEFINE_TYPE (GdkWindowImplWayland, _gdk_window_impl_wayland, GDK_TYPE_WINDOW_IMPL) +G_DEFINE_TYPE (GdkSurfaceImplWayland, _gdk_surface_impl_wayland, GDK_TYPE_SURFACE_IMPL) static void -_gdk_window_impl_wayland_init (GdkWindowImplWayland *impl) +_gdk_surface_impl_wayland_init (GdkSurfaceImplWayland *impl) { impl->scale = 1; impl->initial_fullscreen_output = NULL; @@ -252,20 +252,20 @@ _gdk_window_impl_wayland_init (GdkWindowImplWayland *impl) } static void -_gdk_wayland_screen_add_orphan_dialog (GdkWindow *window) +_gdk_wayland_screen_add_orphan_dialog (GdkSurface *surface) { GdkWaylandDisplay *display_wayland = - GDK_WAYLAND_DISPLAY (gdk_window_get_display (window)); + GDK_WAYLAND_DISPLAY (gdk_surface_get_display (surface)); - if (!g_list_find (display_wayland->orphan_dialogs, window)) + if (!g_list_find (display_wayland->orphan_dialogs, surface)) display_wayland->orphan_dialogs = - g_list_prepend (display_wayland->orphan_dialogs, window); + g_list_prepend (display_wayland->orphan_dialogs, surface); } static void -drop_cairo_surfaces (GdkWindow *window) +drop_cairo_surfaces (GdkSurface *surface) { - GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); + GdkSurfaceImplWayland *impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); g_clear_pointer (&impl->staging_cairo_surface, cairo_surface_destroy); g_clear_pointer (&impl->backfill_cairo_surface, cairo_surface_destroy); @@ -277,23 +277,23 @@ drop_cairo_surfaces (GdkWindow *window) } static void -_gdk_wayland_window_save_size (GdkWindow *window) +_gdk_wayland_surface_save_size (GdkSurface *surface) { - GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); + GdkSurfaceImplWayland *impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); - if (window->state & (GDK_WINDOW_STATE_FULLSCREEN | GDK_WINDOW_STATE_MAXIMIZED)) + if (surface->state & (GDK_SURFACE_STATE_FULLSCREEN | GDK_SURFACE_STATE_MAXIMIZED)) return; - impl->saved_width = window->width - impl->margin_left - impl->margin_right; - impl->saved_height = window->height - impl->margin_top - impl->margin_bottom; + impl->saved_width = surface->width - impl->margin_left - impl->margin_right; + impl->saved_height = surface->height - impl->margin_top - impl->margin_bottom; } static void -_gdk_wayland_window_clear_saved_size (GdkWindow *window) +_gdk_wayland_surface_clear_saved_size (GdkSurface *surface) { - GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); + GdkSurfaceImplWayland *impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); - if (window->state & (GDK_WINDOW_STATE_FULLSCREEN | GDK_WINDOW_STATE_MAXIMIZED)) + if (surface->state & (GDK_SURFACE_STATE_FULLSCREEN | GDK_SURFACE_STATE_MAXIMIZED)) return; impl->saved_width = -1; @@ -301,31 +301,31 @@ _gdk_wayland_window_clear_saved_size (GdkWindow *window) } /* - * gdk_wayland_window_update_size: + * gdk_wayland_surface_update_size: * @drawable: a #GdkDrawableImplWayland. * * Updates the state of the drawable (in particular the drawable's * cairo surface) when its size has changed. */ static void -gdk_wayland_window_update_size (GdkWindow *window, +gdk_wayland_surface_update_size (GdkSurface *surface, int32_t width, int32_t height, int scale) { - GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); + GdkSurfaceImplWayland *impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); GdkRectangle area; cairo_region_t *region; - if ((window->width == width) && - (window->height == height) && + if ((surface->width == width) && + (surface->height == height) && (impl->scale == scale)) return; - drop_cairo_surfaces (window); + drop_cairo_surfaces (surface); - window->width = width; - window->height = height; + surface->width = width; + surface->height = height; impl->scale = scale; if (impl->display_server.egl_window) @@ -335,11 +335,11 @@ gdk_wayland_window_update_size (GdkWindow *window, area.x = 0; area.y = 0; - area.width = window->width; - area.height = window->height; + area.width = surface->width; + area.height = surface->height; region = cairo_region_create_rectangle (&area); - _gdk_window_invalidate_for_expose (window, region); + _gdk_surface_invalidate_for_expose (surface, region); cairo_region_destroy (region); } @@ -402,16 +402,16 @@ fill_presentation_time_from_frame_time (GdkFrameTimings *timings, } static void -read_back_cairo_surface (GdkWindow *window) +read_back_cairo_surface (GdkSurface *surface) { - GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); + GdkSurfaceImplWayland *impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); cairo_t *cr; cairo_region_t *paint_region = NULL; if (!impl->backfill_cairo_surface) goto out; - paint_region = cairo_region_copy (window->clip_region); + paint_region = cairo_region_copy (surface->clip_region); cairo_region_subtract (paint_region, impl->staged_updates_region); if (cairo_region_is_empty (paint_region)) @@ -437,18 +437,18 @@ frame_callback (void *data, struct wl_callback *callback, uint32_t time) { - GdkWindow *window = data; - GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); + GdkSurface *surface = data; + GdkSurfaceImplWayland *impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); GdkWaylandDisplay *display_wayland = - GDK_WAYLAND_DISPLAY (gdk_window_get_display (window)); - GdkFrameClock *clock = gdk_window_get_frame_clock (window); + GDK_WAYLAND_DISPLAY (gdk_surface_get_display (surface)); + GdkFrameClock *clock = gdk_surface_get_frame_clock (surface); GdkFrameTimings *timings; - GDK_DISPLAY_NOTE (GDK_DISPLAY (display_wayland), EVENTS, g_message ("frame %p", window)); + GDK_DISPLAY_NOTE (GDK_DISPLAY (display_wayland), EVENTS, g_message ("frame %p", surface)); wl_callback_destroy (callback); - if (GDK_WINDOW_DESTROYED (window)) + if (GDK_SURFACE_DESTROYED (surface)) return; if (!impl->awaiting_frame) @@ -466,7 +466,7 @@ frame_callback (void *data, timings->refresh_interval = 16667; /* default to 1/60th of a second */ 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 surface touches * The rate here is in milli-hertz */ int refresh_rate = gdk_wayland_display_get_output_refresh_rate (display_wayland, @@ -491,13 +491,13 @@ static const struct wl_callback_listener frame_listener = { static void on_frame_clock_before_paint (GdkFrameClock *clock, - GdkWindow *window) + GdkSurface *surface) { GdkFrameTimings *timings = gdk_frame_clock_get_current_timings (clock); gint64 presentation_time; gint64 refresh_interval; - if (window->update_freeze_count > 0) + if (surface->update_freeze_count > 0) return; gdk_frame_clock_get_refresh_info (clock, @@ -524,26 +524,26 @@ on_frame_clock_before_paint (GdkFrameClock *clock, static void on_frame_clock_after_paint (GdkFrameClock *clock, - GdkWindow *window) + GdkSurface *surface) { - GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); + GdkSurfaceImplWayland *impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); struct wl_callback *callback; if (!impl->pending_commit) return; - if (window->update_freeze_count > 0) + if (surface->update_freeze_count > 0) return; callback = wl_surface_frame (impl->display_server.wl_surface); - wl_callback_add_listener (callback, &frame_listener, window); + wl_callback_add_listener (callback, &frame_listener, surface); _gdk_frame_clock_freeze (clock); /* Before we commit a new buffer, make sure we've backfilled * undrawn parts from any old committed buffer */ if (impl->pending_buffer_attached) - read_back_cairo_surface (window); + read_back_cairo_surface (surface); /* From this commit forward, we can't write to the buffer, * it's "live". In the future, if we need to stage more changes @@ -567,10 +567,10 @@ on_frame_clock_after_paint (GdkFrameClock *clock, } void -gdk_wayland_window_update_scale (GdkWindow *window) +gdk_wayland_surface_update_scale (GdkSurface *surface) { - GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); - GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (gdk_window_get_display (window)); + GdkSurfaceImplWayland *impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); + GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (gdk_surface_get_display (surface)); guint32 scale; GSList *l; GList *children, *c; @@ -589,47 +589,47 @@ gdk_wayland_window_update_scale (GdkWindow *window) } /* Notify app that scale changed */ - gdk_wayland_window_maybe_configure (window, window->width, window->height, scale); + gdk_wayland_surface_maybe_configure (surface, surface->width, surface->height, scale); - children = gdk_window_get_children (window); + children = gdk_surface_get_children (surface); for (c = children; c; c = c->next) { - GdkWindow *child = c->data; - gdk_wayland_window_update_scale (child); + GdkSurface *child = c->data; + gdk_wayland_surface_update_scale (child); } g_list_free (children); } -static void gdk_wayland_window_create_surface (GdkWindow *window); +static void gdk_wayland_surface_create_surface (GdkSurface *surface); void -_gdk_wayland_display_create_window_impl (GdkDisplay *display, - GdkWindow *window, - GdkWindow *real_parent, +_gdk_wayland_display_create_surface_impl (GdkDisplay *display, + GdkSurface *surface, + GdkSurface *real_parent, GdkEventMask event_mask, - GdkWindowAttr *attributes) + GdkSurfaceAttr *attributes) { GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (display); - GdkWindowImplWayland *impl; + GdkSurfaceImplWayland *impl; GdkFrameClock *frame_clock; - impl = g_object_new (GDK_TYPE_WINDOW_IMPL_WAYLAND, NULL); - window->impl = GDK_WINDOW_IMPL (impl); - impl->wrapper = GDK_WINDOW (window); + impl = g_object_new (GDK_TYPE_SURFACE_IMPL_WAYLAND, NULL); + surface->impl = GDK_SURFACE_IMPL (impl); + impl->wrapper = GDK_SURFACE (surface); impl->shortcuts_inhibitors = g_hash_table_new (NULL, NULL); - if (window->width > 65535) + if (surface->width > 65535) { - g_warning ("Native Windows wider than 65535 pixels are not supported"); - window->width = 65535; + g_warning ("Native Surfaces wider than 65535 pixels are not supported"); + surface->width = 65535; } - if (window->height > 65535) + if (surface->height > 65535) { - g_warning ("Native Windows taller than 65535 pixels are not supported"); - window->height = 65535; + g_warning ("Native Surfaces taller than 65535 pixels are not supported"); + surface->height = 65535; } - g_object_ref (window); + g_object_ref (surface); /* More likely to be right than just assuming 1 */ if (display_wayland->compositor_version >= WL_SURFACE_HAS_BUFFER_SCALE && @@ -638,35 +638,35 @@ _gdk_wayland_display_create_window_impl (GdkDisplay *display, impl->title = NULL; - switch (GDK_WINDOW_TYPE (window)) + switch (GDK_SURFACE_TYPE (surface)) { - case GDK_WINDOW_TOPLEVEL: - case GDK_WINDOW_TEMP: - gdk_window_set_title (window, get_default_title ()); + case GDK_SURFACE_TOPLEVEL: + case GDK_SURFACE_TEMP: + gdk_surface_set_title (surface, get_default_title ()); break; - case GDK_WINDOW_CHILD: + case GDK_SURFACE_CHILD: default: break; } if (real_parent == NULL) - display_wayland->toplevels = g_list_prepend (display_wayland->toplevels, window); + display_wayland->toplevels = g_list_prepend (display_wayland->toplevels, surface); - gdk_wayland_window_create_surface (window); + gdk_wayland_surface_create_surface (surface); - frame_clock = gdk_window_get_frame_clock (window); - g_signal_connect (frame_clock, "before-paint", G_CALLBACK (on_frame_clock_before_paint), window); - g_signal_connect (frame_clock, "after-paint", G_CALLBACK (on_frame_clock_after_paint), window); + frame_clock = gdk_surface_get_frame_clock (surface); + g_signal_connect (frame_clock, "before-paint", G_CALLBACK (on_frame_clock_before_paint), surface); + g_signal_connect (frame_clock, "after-paint", G_CALLBACK (on_frame_clock_after_paint), surface); } static void -gdk_wayland_window_attach_image (GdkWindow *window) +gdk_wayland_surface_attach_image (GdkSurface *surface) { GdkWaylandDisplay *display; - GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); + GdkSurfaceImplWayland *impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); - if (GDK_WINDOW_DESTROYED (window)) + if (GDK_SURFACE_DESTROYED (surface)) return; g_assert (_gdk_wayland_is_shm_surface (impl->staging_cairo_surface)); @@ -680,7 +680,7 @@ gdk_wayland_window_attach_image (GdkWindow *window) impl->pending_buffer_offset_y = 0; /* Only set the buffer scale if supported by the compositor */ - display = GDK_WAYLAND_DISPLAY (gdk_window_get_display (window)); + display = GDK_WAYLAND_DISPLAY (gdk_surface_get_display (surface)); if (display->compositor_version >= WL_SURFACE_HAS_BUFFER_SCALE) wl_surface_set_buffer_scale (impl->display_server.wl_surface, impl->scale); @@ -688,16 +688,16 @@ gdk_wayland_window_attach_image (GdkWindow *window) impl->pending_commit = TRUE; } -static const cairo_user_data_key_t gdk_wayland_window_cairo_key; +static const cairo_user_data_key_t gdk_wayland_surface_cairo_key; static void buffer_release_callback (void *_data, struct wl_buffer *wl_buffer) { cairo_surface_t *cairo_surface = _data; - GdkWindowImplWayland *impl = cairo_surface_get_user_data (cairo_surface, &gdk_wayland_window_cairo_key); + GdkSurfaceImplWayland *impl = cairo_surface_get_user_data (cairo_surface, &gdk_wayland_surface_cairo_key); - g_return_if_fail (GDK_IS_WINDOW_IMPL_WAYLAND (impl)); + g_return_if_fail (GDK_IS_SURFACE_IMPL_WAYLAND (impl)); /* The released buffer isn't the latest committed one, we have no further * use for it, so clean it up. @@ -752,9 +752,9 @@ static const struct wl_buffer_listener buffer_listener = { }; static void -gdk_wayland_window_ensure_cairo_surface (GdkWindow *window) +gdk_wayland_surface_ensure_cairo_surface (GdkSurface *surface) { - GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); + GdkSurfaceImplWayland *impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); /* If we are drawing using OpenGL then we only need a logical 1x1 surface. */ if (impl->display_server.egl_window) @@ -774,7 +774,7 @@ gdk_wayland_window_ensure_cairo_surface (GdkWindow *window) } else if (!impl->staging_cairo_surface) { - GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (gdk_window_get_display (impl->wrapper)); + GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (gdk_surface_get_display (impl->wrapper)); struct wl_buffer *buffer; impl->staging_cairo_surface = _gdk_wayland_display_create_shm_surface (display_wayland, @@ -782,7 +782,7 @@ gdk_wayland_window_ensure_cairo_surface (GdkWindow *window) impl->wrapper->height, impl->scale); cairo_surface_set_user_data (impl->staging_cairo_surface, - &gdk_wayland_window_cairo_key, + &gdk_wayland_surface_cairo_key, g_object_ref (impl), (cairo_destroy_func_t) g_object_unref); @@ -799,14 +799,14 @@ gdk_wayland_window_ensure_cairo_surface (GdkWindow *window) * impl->staging_cairo_surface gets nullified. */ static cairo_surface_t * -gdk_wayland_window_ref_cairo_surface (GdkWindow *window) +gdk_wayland_surface_ref_cairo_surface (GdkSurface *surface) { - GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); + GdkSurfaceImplWayland *impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); - if (GDK_WINDOW_DESTROYED (impl->wrapper)) + if (GDK_SURFACE_DESTROYED (impl->wrapper)) return NULL; - gdk_wayland_window_ensure_cairo_surface (window); + gdk_wayland_surface_ensure_cairo_surface (surface); cairo_surface_reference (impl->staging_cairo_surface); @@ -814,7 +814,7 @@ gdk_wayland_window_ref_cairo_surface (GdkWindow *window) } static cairo_surface_t * -gdk_wayland_window_create_similar_image_surface (GdkWindow * window, +gdk_wayland_surface_create_similar_image_surface (GdkSurface * surface, cairo_format_t format, int width, int height) @@ -823,25 +823,25 @@ gdk_wayland_window_create_similar_image_surface (GdkWindow * window, } static gboolean -gdk_window_impl_wayland_begin_paint (GdkWindow *window) +gdk_surface_impl_wayland_begin_paint (GdkSurface *surface) { - gdk_wayland_window_ensure_cairo_surface (window); + gdk_wayland_surface_ensure_cairo_surface (surface); return FALSE; } static void -gdk_window_impl_wayland_end_paint (GdkWindow *window) +gdk_surface_impl_wayland_end_paint (GdkSurface *surface) { - GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); + GdkSurfaceImplWayland *impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); cairo_rectangle_int_t rect; int i, n; if (impl->staging_cairo_surface && _gdk_wayland_is_shm_surface (impl->staging_cairo_surface) && - !cairo_region_is_empty (window->current_paint.region)) + !cairo_region_is_empty (surface->current_paint.region)) { - gdk_wayland_window_attach_image (window); + gdk_wayland_surface_attach_image (surface); /* If there's a committed buffer pending, then track which * updates are staged until the next frame, so we can back @@ -852,57 +852,57 @@ gdk_window_impl_wayland_end_paint (GdkWindow *window) { if (impl->staged_updates_region == NULL) { - impl->staged_updates_region = cairo_region_copy (window->current_paint.region); + impl->staged_updates_region = cairo_region_copy (surface->current_paint.region); impl->backfill_cairo_surface = cairo_surface_reference (impl->committed_cairo_surface); } else { - cairo_region_union (impl->staged_updates_region, window->current_paint.region); + cairo_region_union (impl->staged_updates_region, surface->current_paint.region); } } - n = cairo_region_num_rectangles (window->current_paint.region); + n = cairo_region_num_rectangles (surface->current_paint.region); for (i = 0; i < n; i++) { - cairo_region_get_rectangle (window->current_paint.region, i, &rect); + cairo_region_get_rectangle (surface->current_paint.region, i, &rect); wl_surface_damage (impl->display_server.wl_surface, rect.x, rect.y, rect.width, rect.height); } impl->pending_commit = TRUE; } - gdk_wayland_window_sync (window); + gdk_wayland_surface_sync (surface); } void -gdk_wayland_window_sync (GdkWindow *window) +gdk_wayland_surface_sync (GdkSurface *surface) { - gdk_wayland_window_sync_margin (window); - gdk_wayland_window_sync_opaque_region (window); - gdk_wayland_window_sync_input_region (window); + gdk_wayland_surface_sync_margin (surface); + gdk_wayland_surface_sync_opaque_region (surface); + gdk_wayland_surface_sync_input_region (surface); } static gboolean -gdk_window_impl_wayland_beep (GdkWindow *window) +gdk_surface_impl_wayland_beep (GdkSurface *surface) { - gdk_wayland_display_system_bell (gdk_window_get_display (window), - window); + gdk_wayland_display_system_bell (gdk_surface_get_display (surface), + surface); return TRUE; } static void -gdk_window_impl_wayland_finalize (GObject *object) +gdk_surface_impl_wayland_finalize (GObject *object) { - GdkWindow *window = GDK_WINDOW (object); - GdkWindowImplWayland *impl; + GdkSurface *surface = GDK_SURFACE (object); + GdkSurfaceImplWayland *impl; - g_return_if_fail (GDK_IS_WINDOW_IMPL_WAYLAND (object)); + g_return_if_fail (GDK_IS_SURFACE_IMPL_WAYLAND (object)); - impl = GDK_WINDOW_IMPL_WAYLAND (object); + impl = GDK_SURFACE_IMPL_WAYLAND (object); - if (gdk_wayland_window_is_exported (window)) - gdk_wayland_window_unexport_handle (window); + if (gdk_wayland_surface_is_exported (surface)) + gdk_wayland_surface_unexport_handle (surface); g_free (impl->title); @@ -919,11 +919,11 @@ gdk_window_impl_wayland_finalize (GObject *object) g_hash_table_destroy (impl->shortcuts_inhibitors); - G_OBJECT_CLASS (_gdk_window_impl_wayland_parent_class)->finalize (object); + G_OBJECT_CLASS (_gdk_surface_impl_wayland_parent_class)->finalize (object); } static void -gdk_wayland_window_configure (GdkWindow *window, +gdk_wayland_surface_configure (GdkSurface *surface, int width, int height, int scale) @@ -932,30 +932,30 @@ gdk_wayland_window_configure (GdkWindow *window, GdkEvent *event; event = gdk_event_new (GDK_CONFIGURE); - event->any.window = g_object_ref (window); + event->any.surface = g_object_ref (surface); event->any.send_event = FALSE; event->configure.width = width; event->configure.height = height; - gdk_wayland_window_update_size (window, width, height, scale); - _gdk_window_update_size (window); + gdk_wayland_surface_update_size (surface, width, height, scale); + _gdk_surface_update_size (surface); - display = gdk_window_get_display (window); + display = gdk_surface_get_display (surface); _gdk_wayland_display_deliver_event (display, event); } static void -gdk_wayland_window_maybe_configure (GdkWindow *window, +gdk_wayland_surface_maybe_configure (GdkSurface *surface, int width, int height, int scale) { - GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); + GdkSurfaceImplWayland *impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); gboolean is_xdg_popup; gboolean is_visible; - if (window->width == width && - window->height == height && + if (surface->width == width && + surface->height == height && impl->scale == scale) return; @@ -966,35 +966,35 @@ gdk_wayland_window_maybe_configure (GdkWindow *window, */ is_xdg_popup = (impl->display_server.xdg_popup != NULL); - is_visible = gdk_window_is_visible (window); + is_visible = gdk_surface_is_visible (surface); if (is_xdg_popup && is_visible && !impl->initial_configure_received) - gdk_window_hide (window); + gdk_surface_hide (surface); - gdk_wayland_window_configure (window, width, height, scale); + gdk_wayland_surface_configure (surface, width, height, scale); if (is_xdg_popup && is_visible && !impl->initial_configure_received) - gdk_window_show (window); + gdk_surface_show (surface); } static void -gdk_wayland_window_sync_parent (GdkWindow *window, - GdkWindow *parent) +gdk_wayland_surface_sync_parent (GdkSurface *surface, + GdkSurface *parent) { - GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); - GdkWindowImplWayland *impl_parent = NULL; + GdkSurfaceImplWayland *impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); + GdkSurfaceImplWayland *impl_parent = NULL; struct zxdg_toplevel_v6 *parent_toplevel; g_assert (parent == NULL || - gdk_window_get_display (window) == gdk_window_get_display (parent)); + gdk_surface_get_display (surface) == gdk_surface_get_display (parent)); if (!impl->display_server.xdg_toplevel) return; if (impl->transient_for) - impl_parent = GDK_WINDOW_IMPL_WAYLAND (impl->transient_for->impl); + impl_parent = GDK_SURFACE_IMPL_WAYLAND (impl->transient_for->impl); else if (parent) - impl_parent = GDK_WINDOW_IMPL_WAYLAND (parent->impl); + impl_parent = GDK_SURFACE_IMPL_WAYLAND (parent->impl); if (impl_parent) { @@ -1012,9 +1012,9 @@ gdk_wayland_window_sync_parent (GdkWindow *window, } static void -gdk_wayland_window_sync_parent_of_imported (GdkWindow *window) +gdk_wayland_surface_sync_parent_of_imported (GdkSurface *surface) { - GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); + GdkSurfaceImplWayland *impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); if (!impl->display_server.wl_surface) return; @@ -1030,10 +1030,10 @@ gdk_wayland_window_sync_parent_of_imported (GdkWindow *window) } static void -gdk_wayland_window_update_dialogs (GdkWindow *window) +gdk_wayland_surface_update_dialogs (GdkSurface *surface) { GdkWaylandDisplay *display_wayland = - GDK_WAYLAND_DISPLAY (gdk_window_get_display (window)); + GDK_WAYLAND_DISPLAY (gdk_surface_get_display (surface)); GList *l; if (!display_wayland->orphan_dialogs) @@ -1041,29 +1041,29 @@ gdk_wayland_window_update_dialogs (GdkWindow *window) for (l = display_wayland->orphan_dialogs; l; l = l->next) { - GdkWindow *w = l->data; - GdkWindowImplWayland *impl; + GdkSurface *w = l->data; + GdkSurfaceImplWayland *impl; - if (!GDK_IS_WINDOW_IMPL_WAYLAND(w->impl)) + if (!GDK_IS_SURFACE_IMPL_WAYLAND(w->impl)) continue; - impl = GDK_WINDOW_IMPL_WAYLAND (w->impl); - if (w == window) + impl = GDK_SURFACE_IMPL_WAYLAND (w->impl); + if (w == surface) continue; - if (impl->hint != GDK_WINDOW_TYPE_HINT_DIALOG) + if (impl->hint != GDK_SURFACE_TYPE_HINT_DIALOG) continue; if (impl->transient_for) continue; /* Update the parent relationship only for dialogs without transients */ - gdk_wayland_window_sync_parent (w, window); + gdk_wayland_surface_sync_parent (w, surface); } } static void -gdk_wayland_window_sync_title (GdkWindow *window) +gdk_wayland_surface_sync_title (GdkSurface *surface) { - GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); + GdkSurfaceImplWayland *impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); if (!impl->display_server.xdg_toplevel) return; @@ -1075,30 +1075,30 @@ gdk_wayland_window_sync_title (GdkWindow *window) } static void -gdk_wayland_window_get_window_geometry (GdkWindow *window, - GdkRectangle *geometry) +gdk_wayland_surface_get_window_geometry (GdkSurface *surface, + GdkRectangle *geometry) { - GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); + GdkSurfaceImplWayland *impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); *geometry = (GdkRectangle) { .x = impl->margin_left, .y = impl->margin_top, - .width = window->width - (impl->margin_left + impl->margin_right), - .height = window->height - (impl->margin_top + impl->margin_bottom) + .width = surface->width - (impl->margin_left + impl->margin_right), + .height = surface->height - (impl->margin_top + impl->margin_bottom) }; } static void -gdk_wayland_window_sync_margin (GdkWindow *window) +gdk_wayland_surface_sync_margin (GdkSurface *surface) { - GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); + GdkSurfaceImplWayland *impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); GdkRectangle geometry; if (!impl->display_server.xdg_surface) return; - gdk_wayland_window_get_window_geometry (window, &geometry); - gdk_window_set_geometry_hints (window, + gdk_wayland_surface_get_window_geometry (surface, &geometry); + gdk_surface_set_geometry_hints (surface, &impl->geometry_hints, impl->geometry_mask); zxdg_surface_v6_set_window_geometry (impl->display_server.xdg_surface, @@ -1131,9 +1131,9 @@ wl_region_from_cairo_region (GdkWaylandDisplay *display, } static void -gdk_wayland_window_sync_opaque_region (GdkWindow *window) +gdk_wayland_surface_sync_opaque_region (GdkSurface *surface) { - GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); + GdkSurfaceImplWayland *impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); struct wl_region *wl_region = NULL; if (!impl->display_server.wl_surface) @@ -1143,7 +1143,7 @@ gdk_wayland_window_sync_opaque_region (GdkWindow *window) return; 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_surface_get_display (surface)), impl->opaque_region); wl_surface_set_opaque_region (impl->display_server.wl_surface, wl_region); @@ -1155,9 +1155,9 @@ gdk_wayland_window_sync_opaque_region (GdkWindow *window) } static void -gdk_wayland_window_sync_input_region (GdkWindow *window) +gdk_wayland_surface_sync_input_region (GdkSurface *surface) { - GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); + GdkSurfaceImplWayland *impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); struct wl_region *wl_region = NULL; if (!impl->display_server.wl_surface) @@ -1167,7 +1167,7 @@ gdk_wayland_window_sync_input_region (GdkWindow *window) return; 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_surface_get_display (surface)), impl->input_region); wl_surface_set_input_region (impl->display_server.wl_surface, wl_region); @@ -1179,9 +1179,9 @@ gdk_wayland_window_sync_input_region (GdkWindow *window) } static void -gdk_wayland_set_input_region_if_empty (GdkWindow *window) +gdk_wayland_set_input_region_if_empty (GdkSurface *surface) { - GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); + GdkSurfaceImplWayland *impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); GdkWaylandDisplay *display; struct wl_region *empty; @@ -1194,7 +1194,7 @@ gdk_wayland_set_input_region_if_empty (GdkWindow *window) if (!cairo_region_is_empty (impl->input_region)) return; - display = GDK_WAYLAND_DISPLAY (gdk_window_get_display (window)); + display = GDK_WAYLAND_DISPLAY (gdk_surface_get_display (surface)); empty = wl_compositor_create_region (display->compositor); wl_surface_set_input_region (impl->display_server.wl_surface, empty); @@ -1208,15 +1208,15 @@ surface_enter (void *data, struct wl_surface *wl_surface, struct wl_output *output) { - GdkWindow *window = GDK_WINDOW (data); - GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); + GdkSurface *surface = GDK_SURFACE (data); + GdkSurfaceImplWayland *impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); - GDK_DISPLAY_NOTE (gdk_window_get_display (window), EVENTS, - g_message ("surface enter, window %p output %p", window, output)); + GDK_DISPLAY_NOTE (gdk_surface_get_display (surface), EVENTS, + g_message ("surface enter, surface %p output %p", surface, output)); impl->display_server.outputs = g_slist_prepend (impl->display_server.outputs, output); - gdk_wayland_window_update_scale (window); + gdk_wayland_surface_update_scale (surface); } static void @@ -1224,16 +1224,16 @@ surface_leave (void *data, struct wl_surface *wl_surface, struct wl_output *output) { - GdkWindow *window = GDK_WINDOW (data); - GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); + GdkSurface *surface = GDK_SURFACE (data); + GdkSurfaceImplWayland *impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); - GDK_DISPLAY_NOTE (gdk_window_get_display (window), EVENTS, - g_message ("surface leave, window %p output %p", window, output)); + GDK_DISPLAY_NOTE (gdk_surface_get_display (surface), EVENTS, + g_message ("surface leave, surface %p output %p", surface, output)); impl->display_server.outputs = g_slist_remove (impl->display_server.outputs, output); if (impl->display_server.outputs) - gdk_wayland_window_update_scale (window); + gdk_wayland_surface_update_scale (surface); } static const struct wl_surface_listener surface_listener = { @@ -1242,10 +1242,10 @@ static const struct wl_surface_listener surface_listener = { }; static void -on_parent_surface_committed (GdkWindowImplWayland *parent_impl, - GdkWindow *window) +on_parent_surface_committed (GdkSurfaceImplWayland *parent_impl, + GdkSurface *surface) { - GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); + GdkSurfaceImplWayland *impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); g_signal_handler_disconnect (parent_impl, impl->parent_surface_committed_handler); @@ -1254,16 +1254,16 @@ on_parent_surface_committed (GdkWindowImplWayland *parent_impl, wl_subsurface_set_desync (impl->display_server.wl_subsurface); /* Special case if the input region is empty, it won't change on resize */ - gdk_wayland_set_input_region_if_empty (window); + gdk_wayland_set_input_region_if_empty (surface); } static void -gdk_wayland_window_create_subsurface (GdkWindow *window) +gdk_wayland_surface_create_subsurface (GdkSurface *surface) { - GdkWindowImplWayland *impl, *parent_impl = NULL; + GdkSurfaceImplWayland *impl, *parent_impl = NULL; GdkWaylandDisplay *display_wayland; - impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); + impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); if (!impl->display_server.wl_surface) return; /* Bail out, surface and subsurface will be created later when shown */ @@ -1272,17 +1272,17 @@ gdk_wayland_window_create_subsurface (GdkWindow *window) return; if (impl->transient_for) - parent_impl = GDK_WINDOW_IMPL_WAYLAND (impl->transient_for->impl); + parent_impl = GDK_SURFACE_IMPL_WAYLAND (impl->transient_for->impl); if (parent_impl && parent_impl->display_server.wl_surface) { - display_wayland = GDK_WAYLAND_DISPLAY (gdk_window_get_display (window)); + display_wayland = GDK_WAYLAND_DISPLAY (gdk_surface_get_display (surface)); impl->display_server.wl_subsurface = wl_subcompositor_get_subsurface (display_wayland->subcompositor, impl->display_server.wl_surface, parent_impl->display_server.wl_surface); wl_subsurface_set_position (impl->display_server.wl_subsurface, - window->x + window->abs_x, - window->y + window->abs_y); + surface->x + surface->abs_x, + surface->y + surface->abs_y); /* In order to synchronize the initial position with the initial frame * content, wait with making the subsurface desynchronized until after @@ -1291,19 +1291,19 @@ gdk_wayland_window_create_subsurface (GdkWindow *window) impl->parent_surface_committed_handler = g_signal_connect_object (parent_impl, "committed", G_CALLBACK (on_parent_surface_committed), - window, 0); - gdk_window_request_transient_parent_commit (window); + surface, 0); + gdk_surface_request_transient_parent_commit (surface); } } static void -gdk_wayland_window_create_surface (GdkWindow *window) +gdk_wayland_surface_create_surface (GdkSurface *surface) { - GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); - GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (gdk_window_get_display (window)); + GdkSurfaceImplWayland *impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); + GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (gdk_surface_get_display (surface)); impl->display_server.wl_surface = wl_compositor_create_surface (display_wayland->compositor); - wl_surface_add_listener (impl->display_server.wl_surface, &surface_listener, window); + wl_surface_add_listener (impl->display_server.wl_surface, &surface_listener, surface); } static void @@ -1311,9 +1311,9 @@ xdg_surface_configure (void *data, struct zxdg_surface_v6 *xdg_surface, uint32_t serial) { - GdkWindow *window = GDK_WINDOW (data); - GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); - GdkWindowState new_state; + GdkSurface *surface = GDK_SURFACE (data); + GdkSurfaceImplWayland *impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); + GdkSurfaceState new_state; int width = impl->pending.width; int height = impl->pending.height; gboolean fixed_size; @@ -1321,7 +1321,7 @@ xdg_surface_configure (void *data, if (!impl->initial_configure_received) { - gdk_window_thaw_updates (window); + gdk_surface_thaw_updates (surface); impl->initial_configure_received = TRUE; } @@ -1335,7 +1335,7 @@ xdg_surface_configure (void *data, impl->pending.state = 0; fixed_size = - new_state & (GDK_WINDOW_STATE_MAXIMIZED | GDK_WINDOW_STATE_FULLSCREEN | GDK_WINDOW_STATE_TILED); + new_state & (GDK_SURFACE_STATE_MAXIMIZED | GDK_SURFACE_STATE_FULLSCREEN | GDK_SURFACE_STATE_TILED); saved_size = (width == 0 && height == 0); /* According to xdg_shell, an xdg_surface.configure with size 0x0 @@ -1354,15 +1354,15 @@ xdg_surface_configure (void *data, if (width > 0 && height > 0) { - GdkWindowHints geometry_mask = impl->geometry_mask; + GdkSurfaceHints geometry_mask = impl->geometry_mask; - /* Ignore size increments for maximized/fullscreen windows */ + /* Ignore size increments for maximized/fullscreen surfaces */ if (fixed_size) geometry_mask &= ~GDK_HINT_RESIZE_INC; if (!saved_size) { /* Do not reapply contrains if we are restoring original size */ - gdk_window_constrain_size (&impl->geometry_hints, + gdk_surface_constrain_size (&impl->geometry_hints, geometry_mask, width + impl->margin_left + impl->margin_right, height + impl->margin_top + impl->margin_bottom, @@ -1370,25 +1370,25 @@ xdg_surface_configure (void *data, &height); /* Save size for next time we get 0x0 */ - _gdk_wayland_window_save_size (window); + _gdk_wayland_surface_save_size (surface); } - gdk_wayland_window_configure (window, width, height, impl->scale); + gdk_wayland_surface_configure (surface, width, height, impl->scale); } - GDK_DISPLAY_NOTE (gdk_window_get_display (window), EVENTS, - g_message ("configure, window %p %dx%d,%s%s%s%s", - window, width, height, - (new_state & GDK_WINDOW_STATE_FULLSCREEN) ? " fullscreen" : "", - (new_state & GDK_WINDOW_STATE_MAXIMIZED) ? " maximized" : "", - (new_state & GDK_WINDOW_STATE_FOCUSED) ? " focused" : "", - (new_state & GDK_WINDOW_STATE_TILED) ? " tiled" : "")); + GDK_DISPLAY_NOTE (gdk_surface_get_display (surface), EVENTS, + g_message ("configure, surface %p %dx%d,%s%s%s%s", + surface, width, height, + (new_state & GDK_SURFACE_STATE_FULLSCREEN) ? " fullscreen" : "", + (new_state & GDK_SURFACE_STATE_MAXIMIZED) ? " maximized" : "", + (new_state & GDK_SURFACE_STATE_FOCUSED) ? " focused" : "", + (new_state & GDK_SURFACE_STATE_TILED) ? " tiled" : "")); - gdk_window_set_state (window, new_state); + gdk_surface_set_state (surface, new_state); zxdg_surface_v6_ack_configure (xdg_surface, serial); - if (impl->hint != GDK_WINDOW_TYPE_HINT_DIALOG && - new_state & GDK_WINDOW_STATE_FOCUSED) - gdk_wayland_window_update_dialogs (window); + if (impl->hint != GDK_SURFACE_TYPE_HINT_DIALOG && + new_state & GDK_SURFACE_STATE_FOCUSED) + gdk_wayland_surface_update_dialogs (surface); } static const struct zxdg_surface_v6_listener xdg_surface_listener = { @@ -1402,8 +1402,8 @@ xdg_toplevel_configure (void *data, int32_t height, struct wl_array *states) { - GdkWindow *window = GDK_WINDOW (data); - GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); + GdkSurface *surface = GDK_SURFACE (data); + GdkSurfaceImplWayland *impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); uint32_t *p; wl_array_for_each (p, states) @@ -1412,13 +1412,13 @@ xdg_toplevel_configure (void *data, switch (state) { case ZXDG_TOPLEVEL_V6_STATE_FULLSCREEN: - impl->pending.state |= GDK_WINDOW_STATE_FULLSCREEN; + impl->pending.state |= GDK_SURFACE_STATE_FULLSCREEN; break; case ZXDG_TOPLEVEL_V6_STATE_MAXIMIZED: - impl->pending.state |= GDK_WINDOW_STATE_MAXIMIZED; + impl->pending.state |= GDK_SURFACE_STATE_MAXIMIZED; break; case ZXDG_TOPLEVEL_V6_STATE_ACTIVATED: - impl->pending.state |= GDK_WINDOW_STATE_FOCUSED; + impl->pending.state |= GDK_SURFACE_STATE_FOCUSED; break; case ZXDG_TOPLEVEL_V6_STATE_RESIZING: break; @@ -1436,16 +1436,16 @@ static void xdg_toplevel_close (void *data, struct zxdg_toplevel_v6 *xdg_toplevel) { - GdkWindow *window = GDK_WINDOW (data); + GdkSurface *surface = GDK_SURFACE (data); GdkDisplay *display; GdkEvent *event; - display = gdk_window_get_display (window); + display = gdk_surface_get_display (surface); - GDK_DISPLAY_NOTE (display, EVENTS, g_message ("close %p", window)); + GDK_DISPLAY_NOTE (display, EVENTS, g_message ("close %p", surface)); event = gdk_event_new (GDK_DELETE); - event->any.window = g_object_ref (window); + event->any.surface = g_object_ref (surface); event->any.send_event = TRUE; _gdk_wayland_display_deliver_event (display, event); @@ -1457,10 +1457,10 @@ static const struct zxdg_toplevel_v6_listener xdg_toplevel_listener = { }; static void -gdk_wayland_window_create_xdg_toplevel (GdkWindow *window) +gdk_wayland_surface_create_xdg_toplevel (GdkSurface *surface) { - GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (gdk_window_get_display (window)); - GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); + GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (gdk_surface_get_display (surface)); + GdkSurfaceImplWayland *impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); const gchar *app_id; impl->display_server.xdg_surface = @@ -1468,22 +1468,22 @@ gdk_wayland_window_create_xdg_toplevel (GdkWindow *window) impl->display_server.wl_surface); zxdg_surface_v6_add_listener (impl->display_server.xdg_surface, &xdg_surface_listener, - window); - gdk_window_freeze_updates (window); + surface); + gdk_surface_freeze_updates (surface); impl->display_server.xdg_toplevel = zxdg_surface_v6_get_toplevel (impl->display_server.xdg_surface); zxdg_toplevel_v6_add_listener (impl->display_server.xdg_toplevel, &xdg_toplevel_listener, - window); + surface); - gdk_wayland_window_sync_parent (window, NULL); - gdk_wayland_window_sync_parent_of_imported (window); - gdk_wayland_window_sync_title (window); + gdk_wayland_surface_sync_parent (surface, NULL); + gdk_wayland_surface_sync_parent_of_imported (surface); + gdk_wayland_surface_sync_title (surface); - if (window->state & GDK_WINDOW_STATE_MAXIMIZED) + if (surface->state & GDK_SURFACE_STATE_MAXIMIZED) zxdg_toplevel_v6_set_maximized (impl->display_server.xdg_toplevel); - if (window->state & GDK_WINDOW_STATE_FULLSCREEN) + if (surface->state & GDK_SURFACE_STATE_FULLSCREEN) zxdg_toplevel_v6_set_fullscreen (impl->display_server.xdg_toplevel, impl->initial_fullscreen_output); @@ -1496,11 +1496,11 @@ gdk_wayland_window_create_xdg_toplevel (GdkWindow *window) zxdg_toplevel_v6_set_app_id (impl->display_server.xdg_toplevel, app_id); - maybe_set_gtk_surface_dbus_properties (window); - maybe_set_gtk_surface_modal (window); + maybe_set_gtk_surface_dbus_properties (surface); + maybe_set_gtk_surface_modal (surface); - if (impl->hint == GDK_WINDOW_TYPE_HINT_DIALOG) - _gdk_wayland_screen_add_orphan_dialog (window); + if (impl->hint == GDK_SURFACE_TYPE_HINT_DIALOG) + _gdk_wayland_screen_add_orphan_dialog (surface); wl_surface_commit (impl->display_server.wl_surface); } @@ -1513,8 +1513,8 @@ xdg_popup_configure (void *data, int32_t width, int32_t height) { - GdkWindow *window = GDK_WINDOW (data); - GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); + GdkSurface *surface = GDK_SURFACE (data); + GdkSurfaceImplWayland *impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); GdkRectangle flipped_rect; GdkRectangle final_rect; gboolean flipped_x; @@ -1525,13 +1525,13 @@ xdg_popup_configure (void *data, if (impl->position_method != POSITION_METHOD_MOVE_TO_RECT) return; - calculate_moved_to_rect_result (window, x, y, width, height, + calculate_moved_to_rect_result (surface, x, y, width, height, &flipped_rect, &final_rect, &flipped_x, &flipped_y); - g_signal_emit_by_name (window, + g_signal_emit_by_name (surface, "moved-to-rect", &flipped_rect, &final_rect, @@ -1543,11 +1543,11 @@ static void xdg_popup_done (void *data, struct zxdg_popup_v6 *xdg_popup) { - GdkWindow *window = GDK_WINDOW (data); + GdkSurface *surface = GDK_SURFACE (data); - GDK_DISPLAY_NOTE (gdk_window_get_display (window), EVENTS, g_message ("done %p", window)); + GDK_DISPLAY_NOTE (gdk_surface_get_display (surface), EVENTS, g_message ("done %p", surface)); - gdk_window_hide (window); + gdk_surface_hide (surface); } static const struct zxdg_popup_v6_listener xdg_popup_listener = { @@ -1592,7 +1592,7 @@ rect_anchor_to_anchor (GdkGravity rect_anchor) } static enum zxdg_positioner_v6_gravity -window_anchor_to_gravity (GdkGravity rect_anchor) +surface_anchor_to_gravity (GdkGravity rect_anchor) { switch (rect_anchor) { @@ -1628,10 +1628,10 @@ window_anchor_to_gravity (GdkGravity rect_anchor) } void -gdk_wayland_window_announce_csd (GdkWindow *window) +gdk_wayland_surface_announce_csd (GdkSurface *surface) { - GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (gdk_window_get_display (window)); - GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); + GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (gdk_surface_get_display (surface)); + GdkSurfaceImplWayland *impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); if (!display_wayland->server_decoration_manager) return; impl->display_server.server_decoration = @@ -1642,21 +1642,21 @@ gdk_wayland_window_announce_csd (GdkWindow *window) ORG_KDE_KWIN_SERVER_DECORATION_MANAGER_MODE_CLIENT); } -static GdkWindow * -get_real_parent_and_translate (GdkWindow *window, +static GdkSurface * +get_real_parent_and_translate (GdkSurface *surface, gint *x, gint *y) { - GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); - GdkWindow *parent = impl->transient_for; + GdkSurfaceImplWayland *impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); + GdkSurface *parent = impl->transient_for; while (parent) { - GdkWindowImplWayland *parent_impl = - GDK_WINDOW_IMPL_WAYLAND (parent->impl); - GdkWindow *effective_parent = gdk_window_get_parent (parent); + GdkSurfaceImplWayland *parent_impl = + GDK_SURFACE_IMPL_WAYLAND (parent->impl); + GdkSurface *effective_parent = gdk_surface_get_parent (parent); - if ((gdk_window_has_native (parent) && + if ((gdk_surface_has_native (parent) && !parent_impl->display_server.wl_subsurface) || !effective_parent) break; @@ -1664,7 +1664,7 @@ get_real_parent_and_translate (GdkWindow *window, *x += parent->x; *y += parent->y; - if (gdk_window_has_native (parent) && + if (gdk_surface_has_native (parent) && parent_impl->display_server.wl_subsurface) parent = parent->transient_for; else @@ -1675,28 +1675,28 @@ get_real_parent_and_translate (GdkWindow *window, } static void -translate_to_real_parent_window_geometry (GdkWindow *window, +translate_to_real_parent_surface_geometry (GdkSurface *surface, gint *x, gint *y) { - GdkWindow *parent; + GdkSurface *parent; - parent = get_real_parent_and_translate (window, x, y); + parent = get_real_parent_and_translate (surface, x, y); *x -= parent->shadow_left; *y -= parent->shadow_top; } -static GdkWindow * -translate_from_real_parent_window_geometry (GdkWindow *window, +static GdkSurface * +translate_from_real_parent_surface_geometry (GdkSurface *surface, gint *x, gint *y) { - GdkWindow *parent; + GdkSurface *parent; gint dx = 0; gint dy = 0; - parent = get_real_parent_and_translate (window, &dx, &dy); + parent = get_real_parent_and_translate (surface, &dx, &dy); *x -= dx - parent->shadow_left; *y -= dy - parent->shadow_top; @@ -1705,17 +1705,17 @@ translate_from_real_parent_window_geometry (GdkWindow *window, } static void -calculate_popup_rect (GdkWindow *window, +calculate_popup_rect (GdkSurface *surface, GdkGravity rect_anchor, - GdkGravity window_anchor, + GdkGravity surface_anchor, GdkRectangle *out_rect) { - GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); + GdkSurfaceImplWayland *impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); GdkRectangle geometry; GdkRectangle anchor_rect; int x = 0, y = 0; - gdk_wayland_window_get_window_geometry (window, &geometry); + gdk_wayland_surface_get_window_geometry (surface, &geometry); anchor_rect = (GdkRectangle) { .x = (impl->pending_move_to_rect.rect.x + @@ -1768,7 +1768,7 @@ calculate_popup_rect (GdkWindow *window, break; } - switch (window_anchor) + switch (surface_anchor) { default: case GDK_GRAVITY_STATIC: @@ -1873,7 +1873,7 @@ flip_anchor_vertically (GdkGravity anchor) } static void -calculate_moved_to_rect_result (GdkWindow *window, +calculate_moved_to_rect_result (GdkSurface *surface, int x, int y, int width, @@ -1883,13 +1883,13 @@ calculate_moved_to_rect_result (GdkWindow *window, gboolean *flipped_x, gboolean *flipped_y) { - GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); - GdkWindow *parent; - gint window_x, window_y; - gint window_width, window_height; + GdkSurfaceImplWayland *impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); + GdkSurface *parent; + gint surface_x, surface_y; + gint surface_width, surface_height; GdkRectangle best_rect; - parent = translate_from_real_parent_window_geometry (window, &x, &y); + parent = translate_from_real_parent_surface_geometry (surface, &x, &y); *final_rect = (GdkRectangle) { .x = x, .y = y, @@ -1897,18 +1897,18 @@ calculate_moved_to_rect_result (GdkWindow *window, .height = height, }; - window_x = parent->x + x; - window_y = parent->y + y; - window_width = width + window->shadow_left + window->shadow_right; - window_height = height + window->shadow_top + window->shadow_bottom; + surface_x = parent->x + x; + surface_y = parent->y + y; + surface_width = width + surface->shadow_left + surface->shadow_right; + surface_height = height + surface->shadow_top + surface->shadow_bottom; - gdk_window_move_resize (window, - window_x, window_y, - window_width, window_height); + gdk_surface_move_resize (surface, + surface_x, surface_y, + surface_width, surface_height); - calculate_popup_rect (window, + calculate_popup_rect (surface, impl->pending_move_to_rect.rect_anchor, - impl->pending_move_to_rect.window_anchor, + impl->pending_move_to_rect.surface_anchor, &best_rect); *flipped_rect = best_rect; @@ -1918,15 +1918,15 @@ calculate_moved_to_rect_result (GdkWindow *window, { GdkRectangle flipped_x_rect; GdkGravity flipped_rect_anchor; - GdkGravity flipped_window_anchor; + GdkGravity flipped_surface_anchor; flipped_rect_anchor = flip_anchor_horizontally (impl->pending_move_to_rect.rect_anchor); - flipped_window_anchor = - flip_anchor_horizontally (impl->pending_move_to_rect.window_anchor), - calculate_popup_rect (window, + flipped_surface_anchor = + flip_anchor_horizontally (impl->pending_move_to_rect.surface_anchor), + calculate_popup_rect (surface, flipped_rect_anchor, - flipped_window_anchor, + flipped_surface_anchor, &flipped_x_rect); if (flipped_x_rect.x == x) @@ -1937,15 +1937,15 @@ calculate_moved_to_rect_result (GdkWindow *window, { GdkRectangle flipped_y_rect; GdkGravity flipped_rect_anchor; - GdkGravity flipped_window_anchor; + GdkGravity flipped_surface_anchor; flipped_rect_anchor = flip_anchor_vertically (impl->pending_move_to_rect.rect_anchor); - flipped_window_anchor = - flip_anchor_vertically (impl->pending_move_to_rect.window_anchor), - calculate_popup_rect (window, + flipped_surface_anchor = + flip_anchor_vertically (impl->pending_move_to_rect.surface_anchor), + calculate_popup_rect (surface, flipped_rect_anchor, - flipped_window_anchor, + flipped_surface_anchor, &flipped_y_rect); if (flipped_y_rect.y == y) @@ -1957,11 +1957,11 @@ calculate_moved_to_rect_result (GdkWindow *window, } static struct zxdg_positioner_v6 * -create_dynamic_positioner (GdkWindow *window) +create_dynamic_positioner (GdkSurface *surface) { - GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); + GdkSurfaceImplWayland *impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); GdkWaylandDisplay *display = - GDK_WAYLAND_DISPLAY (gdk_window_get_display (window)); + GDK_WAYLAND_DISPLAY (gdk_surface_get_display (surface)); struct zxdg_positioner_v6 *positioner; GdkRectangle geometry; enum zxdg_positioner_v6_anchor anchor; @@ -1972,14 +1972,14 @@ create_dynamic_positioner (GdkWindow *window) positioner = zxdg_shell_v6_create_positioner (display->xdg_shell); - gdk_wayland_window_get_window_geometry (window, &geometry); + gdk_wayland_surface_get_window_geometry (surface, &geometry); zxdg_positioner_v6_set_size (positioner, geometry.width, geometry.height); real_anchor_rect_x = impl->pending_move_to_rect.rect.x; real_anchor_rect_y = impl->pending_move_to_rect.rect.y; - translate_to_real_parent_window_geometry (window, - &real_anchor_rect_x, - &real_anchor_rect_y); + translate_to_real_parent_surface_geometry (surface, + &real_anchor_rect_x, + &real_anchor_rect_y); anchor_rect_width = impl->pending_move_to_rect.rect.width; anchor_rect_height = impl->pending_move_to_rect.rect.height; @@ -1996,7 +1996,7 @@ create_dynamic_positioner (GdkWindow *window) anchor = rect_anchor_to_anchor (impl->pending_move_to_rect.rect_anchor); zxdg_positioner_v6_set_anchor (positioner, anchor); - gravity = window_anchor_to_gravity (impl->pending_move_to_rect.window_anchor); + gravity = surface_anchor_to_gravity (impl->pending_move_to_rect.surface_anchor); zxdg_positioner_v6_set_gravity (positioner, gravity); if (impl->pending_move_to_rect.anchor_hints & GDK_ANCHOR_FLIP_X) @@ -2019,11 +2019,11 @@ create_dynamic_positioner (GdkWindow *window) } static struct zxdg_positioner_v6 * -create_simple_positioner (GdkWindow *window, - GdkWindow *parent) +create_simple_positioner (GdkSurface *surface, + GdkSurface *parent) { GdkWaylandDisplay *display = - GDK_WAYLAND_DISPLAY (gdk_window_get_display (window)); + GDK_WAYLAND_DISPLAY (gdk_surface_get_display (surface)); struct zxdg_positioner_v6 *positioner; GdkRectangle geometry; GdkRectangle parent_geometry; @@ -2031,19 +2031,19 @@ create_simple_positioner (GdkWindow *window, positioner = zxdg_shell_v6_create_positioner (display->xdg_shell); - gdk_wayland_window_get_window_geometry (window, &geometry); + gdk_wayland_surface_get_window_geometry (surface, &geometry); zxdg_positioner_v6_set_size (positioner, geometry.width, geometry.height); parent_x = parent->x; parent_y = parent->y; - gdk_wayland_window_get_window_geometry (parent, &parent_geometry); + gdk_wayland_surface_get_window_geometry (parent, &parent_geometry); parent_x += parent_geometry.x; parent_y += parent_geometry.y; zxdg_positioner_v6_set_anchor_rect (positioner, - (window->x + geometry.x) - parent_x, - (window->y + geometry.y) - parent_y, + (surface->x + geometry.x) - parent_x, + (surface->y + geometry.y) - parent_y, 1, 1); zxdg_positioner_v6_set_anchor (positioner, (ZXDG_POSITIONER_V6_ANCHOR_TOP | @@ -2056,13 +2056,13 @@ create_simple_positioner (GdkWindow *window, } static void -gdk_wayland_window_create_xdg_popup (GdkWindow *window, - GdkWindow *parent, +gdk_wayland_surface_create_xdg_popup (GdkSurface *surface, + GdkSurface *parent, struct wl_seat *seat) { - GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (gdk_window_get_display (window)); - GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); - GdkWindowImplWayland *parent_impl = GDK_WINDOW_IMPL_WAYLAND (parent->impl); + GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (gdk_surface_get_display (surface)); + GdkSurfaceImplWayland *impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); + GdkSurfaceImplWayland *parent_impl = GDK_SURFACE_IMPL_WAYLAND (parent->impl); struct zxdg_positioner_v6 *positioner; GdkSeat *gdk_seat; guint32 serial; @@ -2097,13 +2097,13 @@ gdk_wayland_window_create_xdg_popup (GdkWindow *window, impl->display_server.wl_surface); zxdg_surface_v6_add_listener (impl->display_server.xdg_surface, &xdg_surface_listener, - window); - gdk_window_freeze_updates (window); + surface); + gdk_surface_freeze_updates (surface); if (impl->position_method == POSITION_METHOD_MOVE_TO_RECT) - positioner = create_dynamic_positioner (window); + positioner = create_dynamic_positioner (surface); else - positioner = create_simple_positioner (window, parent); + positioner = create_simple_positioner (surface, parent); impl->display_server.xdg_popup = zxdg_surface_v6_get_popup (impl->display_server.xdg_surface, @@ -2111,7 +2111,7 @@ gdk_wayland_window_create_xdg_popup (GdkWindow *window, positioner); zxdg_popup_v6_add_listener (impl->display_server.xdg_popup, &xdg_popup_listener, - window); + surface); zxdg_positioner_v6_destroy (positioner); @@ -2125,40 +2125,40 @@ gdk_wayland_window_create_xdg_popup (GdkWindow *window, wl_surface_commit (impl->display_server.wl_surface); impl->popup_parent = parent; - display->current_popups = g_list_append (display->current_popups, window); + display->current_popups = g_list_append (display->current_popups, surface); } static struct wl_seat * -find_grab_input_seat (GdkWindow *window, GdkWindow *transient_for) +find_grab_input_seat (GdkSurface *surface, GdkSurface *transient_for) { - GdkWindow *attached_grab_window; - GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); - GdkWindowImplWayland *tmp_impl; + GdkSurface *attached_grab_surface; + GdkSurfaceImplWayland *impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); + GdkSurfaceImplWayland *tmp_impl; /* Use the device that was used for the grab as the device for - * the popup window setup - so this relies on GTK+ taking the - * grab before showing the popup window. + * the popup surface setup - so this relies on GTK+ taking the + * grab before showing the popup surface. */ if (impl->grab_input_seat) return gdk_wayland_seat_get_wl_seat (impl->grab_input_seat); - /* HACK: GtkMenu grabs a special window known as the "grab transfer window" - * and then transfers the grab over to the correct window later. Look for - * this window when taking the grab to know it's correct. + /* HACK: GtkMenu grabs a special surface known as the "grab transfer surface" + * and then transfers the grab over to the correct surface later. Look for + * this surface when taking the grab to know it's correct. * - * See: associate_menu_grab_transfer_window in gtkmenu.c + * See: associate_menu_grab_transfer_surface in gtkmenu.c */ - attached_grab_window = g_object_get_data (G_OBJECT (window), "gdk-attached-grab-window"); - if (attached_grab_window) + attached_grab_surface = g_object_get_data (G_OBJECT (surface), "gdk-attached-grab-surface"); + if (attached_grab_surface) { - tmp_impl = GDK_WINDOW_IMPL_WAYLAND (attached_grab_window->impl); + tmp_impl = GDK_SURFACE_IMPL_WAYLAND (attached_grab_surface->impl); if (tmp_impl->grab_input_seat) return gdk_wayland_seat_get_wl_seat (tmp_impl->grab_input_seat); } while (transient_for) { - tmp_impl = GDK_WINDOW_IMPL_WAYLAND (transient_for->impl); + tmp_impl = GDK_SURFACE_IMPL_WAYLAND (transient_for->impl); if (tmp_impl->grab_input_seat) return gdk_wayland_seat_get_wl_seat (tmp_impl->grab_input_seat); @@ -2170,46 +2170,46 @@ find_grab_input_seat (GdkWindow *window, GdkWindow *transient_for) } static gboolean -should_be_mapped (GdkWindow *window) +should_be_mapped (GdkSurface *surface) { - GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); + GdkSurfaceImplWayland *impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); /* Don't map crazy temp that GTK+ uses for internal X11 shenanigans. */ - if (window->window_type == GDK_WINDOW_TEMP && window->x < 0 && window->y < 0) + if (surface->surface_type == GDK_SURFACE_TEMP && surface->x < 0 && surface->y < 0) return FALSE; - if (impl->hint == GDK_WINDOW_TYPE_HINT_DND) + if (impl->hint == GDK_SURFACE_TYPE_HINT_DND) return FALSE; return TRUE; } static gboolean -should_map_as_popup (GdkWindow *window) +should_map_as_popup (GdkSurface *surface) { - GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); + GdkSurfaceImplWayland *impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); - /* Ideally, popup would be temp windows with a parent and grab */ - if (GDK_WINDOW_TYPE (window) == GDK_WINDOW_TEMP) + /* Ideally, popup would be temp surfaces with a parent and grab */ + if (GDK_SURFACE_TYPE (surface) == GDK_SURFACE_TEMP) { - /* If a temp window has a parent and a grab, we can use a popup */ + /* If a temp surface has a parent and a grab, we can use a popup */ if (impl->transient_for) { if (impl->grab_input_seat) return TRUE; } else - g_message ("Window %p is a temporary window without parent, " + g_message ("Surface %p is a temporary surface without parent, " "application will not be able to position it on screen.", - window); + surface); } - /* Yet we need to keep the window type hint tests for compatibility */ + /* Yet we need to keep the surface type hint tests for compatibility */ switch ((guint) impl->hint) { - case GDK_WINDOW_TYPE_HINT_POPUP_MENU: - case GDK_WINDOW_TYPE_HINT_DROPDOWN_MENU: - case GDK_WINDOW_TYPE_HINT_COMBO: + case GDK_SURFACE_TYPE_HINT_POPUP_MENU: + case GDK_SURFACE_TYPE_HINT_DROPDOWN_MENU: + case GDK_SURFACE_TYPE_HINT_COMBO: return TRUE; default: @@ -2220,78 +2220,78 @@ should_map_as_popup (GdkWindow *window) } static gboolean -should_map_as_subsurface (GdkWindow *window) +should_map_as_subsurface (GdkSurface *surface) { - GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); + GdkSurfaceImplWayland *impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); - if (GDK_WINDOW_TYPE (window) == GDK_WINDOW_SUBSURFACE) + if (GDK_SURFACE_TYPE (surface) == GDK_SURFACE_SUBSURFACE) return TRUE; - if (GDK_WINDOW_TYPE (window) != GDK_WINDOW_TEMP) + if (GDK_SURFACE_TYPE (surface) != GDK_SURFACE_TEMP) return FALSE; /* if we want a popup, we do not want a subsurface */ - if (should_map_as_popup (window)) + if (should_map_as_popup (surface)) return FALSE; if (impl->transient_for) { - GdkWindowImplWayland *impl_parent; + GdkSurfaceImplWayland *impl_parent; - impl_parent = GDK_WINDOW_IMPL_WAYLAND (impl->transient_for->impl); + impl_parent = GDK_SURFACE_IMPL_WAYLAND (impl->transient_for->impl); /* subsurface require that the parent is mapped */ if (impl_parent->mapped) return TRUE; else - g_warning ("Couldn't map window %p as subsurface because its parent is not mapped.", - window); + g_warning ("Couldn't map surface %p as subsurface because its parent is not mapped.", + surface); } return FALSE; } -/* Get the window that can be used as a parent for a popup, i.e. a xdg_toplevel - * or xdg_popup. If the window is not, traverse up the transiency parents until +/* Get the surface that can be used as a parent for a popup, i.e. a xdg_toplevel + * or xdg_popup. If the surface is not, traverse up the transiency parents until * we find one. */ -static GdkWindow * -get_popup_parent (GdkWindow *window) +static GdkSurface * +get_popup_parent (GdkSurface *surface) { - while (window) + while (surface) { - GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); + GdkSurfaceImplWayland *impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); if (impl->display_server.xdg_popup || impl->display_server.xdg_toplevel) - return window; + return surface; - window = impl->transient_for; + surface = impl->transient_for; } return NULL; } static void -gdk_wayland_window_map (GdkWindow *window) +gdk_wayland_surface_map (GdkSurface *surface) { - GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); - GdkWindow *transient_for = NULL; + GdkSurfaceImplWayland *impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); + GdkSurface *transient_for = NULL; - if (!should_be_mapped (window)) + if (!should_be_mapped (surface)) return; if (impl->mapped || impl->use_custom_surface) return; - if (should_map_as_subsurface (window)) + if (should_map_as_subsurface (surface)) { if (impl->transient_for) - gdk_wayland_window_create_subsurface (window); + gdk_wayland_surface_create_subsurface (surface); else - g_warning ("Couldn't map window %p as susburface yet because it doesn't have a parent", - window); + g_warning ("Couldn't map surface %p as susburface yet because it doesn't have a parent", + surface); } - else if (should_map_as_popup (window)) + else if (should_map_as_popup (surface)) { gboolean create_fallback = FALSE; struct wl_seat *grab_input_seat; @@ -2299,30 +2299,30 @@ gdk_wayland_window_map (GdkWindow *window) /* Popup menus can appear without a transient parent, which means they * cannot be positioned properly on Wayland. This attempts to guess the * surface they should be positioned with by finding the surface beneath - * the device that created the grab for the popup window. + * the device that created the grab for the popup surface. */ - if (!impl->transient_for && impl->hint == GDK_WINDOW_TYPE_HINT_POPUP_MENU) + if (!impl->transient_for && impl->hint == GDK_SURFACE_TYPE_HINT_POPUP_MENU) { GdkDevice *grab_device = NULL; - /* The popup menu window is not the grabbed window. This may mean - * that a "transfer window" (see gtkmenu.c) is used, and we need - * to find that window to get the grab device. If so is the case - * the "transfer window" can be retrieved via the - * "gdk-attached-grab-window" associated data field. + /* The popup menu surface is not the grabbed surface. This may mean + * that a "transfer surface" (see gtkmenu.c) is used, and we need + * to find that surface to get the grab device. If so is the case + * the "transfer surface" can be retrieved via the + * "gdk-attached-grab-surface" associated data field. */ if (!impl->grab_input_seat) { - GdkWindow *attached_grab_window = - g_object_get_data (G_OBJECT (window), - "gdk-attached-grab-window"); - if (attached_grab_window) + GdkSurface *attached_grab_surface = + g_object_get_data (G_OBJECT (surface), + "gdk-attached-grab-surface"); + if (attached_grab_surface) { - GdkWindowImplWayland *attached_impl = - GDK_WINDOW_IMPL_WAYLAND (attached_grab_window->impl); + GdkSurfaceImplWayland *attached_impl = + GDK_SURFACE_IMPL_WAYLAND (attached_grab_surface->impl); grab_device = gdk_seat_get_pointer (attached_impl->grab_input_seat); transient_for = - gdk_device_get_window_at_position (grab_device, + gdk_device_get_surface_at_position (grab_device, NULL, NULL); } } @@ -2330,84 +2330,84 @@ gdk_wayland_window_map (GdkWindow *window) { grab_device = gdk_seat_get_pointer (impl->grab_input_seat); transient_for = - gdk_device_get_window_at_position (grab_device, NULL, NULL); + gdk_device_get_surface_at_position (grab_device, NULL, NULL); } if (transient_for) - transient_for = get_popup_parent (gdk_window_get_toplevel (transient_for)); + transient_for = get_popup_parent (gdk_surface_get_toplevel (transient_for)); /* If the position was not explicitly set, start the popup at the * position of the device that holds the grab. */ if (impl->position_method == POSITION_METHOD_NONE && grab_device) - gdk_window_get_device_position (transient_for, grab_device, - &window->x, &window->y, NULL); + gdk_surface_get_device_position (transient_for, grab_device, + &surface->x, &surface->y, NULL); } else { - transient_for = gdk_window_get_toplevel (impl->transient_for); + transient_for = gdk_surface_get_toplevel (impl->transient_for); transient_for = get_popup_parent (transient_for); } if (!transient_for) { - g_warning ("Couldn't map as window %p as popup because it doesn't have a parent", - window); + g_warning ("Couldn't map as surface %p as popup because it doesn't have a parent", + surface); create_fallback = TRUE; } else { - grab_input_seat = find_grab_input_seat (window, transient_for); + grab_input_seat = find_grab_input_seat (surface, transient_for); } if (!create_fallback) { - gdk_wayland_window_create_xdg_popup (window, + gdk_wayland_surface_create_xdg_popup (surface, transient_for, grab_input_seat); } else { - gdk_wayland_window_create_xdg_toplevel (window); + gdk_wayland_surface_create_xdg_toplevel (surface); } } else { - gdk_wayland_window_create_xdg_toplevel (window); + gdk_wayland_surface_create_xdg_toplevel (surface); } impl->mapped = TRUE; } static void -gdk_wayland_window_show (GdkWindow *window, +gdk_wayland_surface_show (GdkSurface *surface, gboolean already_mapped) { - GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); + GdkSurfaceImplWayland *impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); if (!impl->display_server.wl_surface) - gdk_wayland_window_create_surface (window); + gdk_wayland_surface_create_surface (surface); - gdk_wayland_window_map (window); + gdk_wayland_surface_map (surface); - _gdk_make_event (window, GDK_MAP, NULL, FALSE); + _gdk_make_event (surface, GDK_MAP, NULL, FALSE); if (impl->staging_cairo_surface && _gdk_wayland_is_shm_surface (impl->staging_cairo_surface)) - gdk_wayland_window_attach_image (window); + gdk_wayland_surface_attach_image (surface); } static void -unmap_subsurface (GdkWindow *window) +unmap_subsurface (GdkSurface *surface) { - GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); - GdkWindowImplWayland *parent_impl; + GdkSurfaceImplWayland *impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); + GdkSurfaceImplWayland *parent_impl; g_return_if_fail (impl->display_server.wl_subsurface); g_return_if_fail (impl->transient_for); - parent_impl = GDK_WINDOW_IMPL_WAYLAND (impl->transient_for->impl); + parent_impl = GDK_SURFACE_IMPL_WAYLAND (impl->transient_for->impl); wl_subsurface_destroy (impl->display_server.wl_subsurface); if (impl->parent_surface_committed_handler) { @@ -2419,21 +2419,21 @@ unmap_subsurface (GdkWindow *window) } static void -unmap_popups_for_window (GdkWindow *window) +unmap_popups_for_surface (GdkSurface *surface) { GdkWaylandDisplay *display_wayland; GList *l; - display_wayland = GDK_WAYLAND_DISPLAY (gdk_window_get_display (window)); + display_wayland = GDK_WAYLAND_DISPLAY (gdk_surface_get_display (surface)); for (l = display_wayland->current_popups; l; l = l->next) { - GdkWindow *popup = l->data; - GdkWindowImplWayland *popup_impl = GDK_WINDOW_IMPL_WAYLAND (popup->impl); + GdkSurface *popup = l->data; + GdkSurfaceImplWayland *popup_impl = GDK_SURFACE_IMPL_WAYLAND (popup->impl); - if (popup_impl->popup_parent == window) + if (popup_impl->popup_parent == surface) { g_warning ("Tried to unmap the parent of a popup"); - gdk_window_hide (popup); + gdk_surface_hide (popup); return; } @@ -2441,12 +2441,12 @@ unmap_popups_for_window (GdkWindow *window) } static void -gdk_wayland_window_hide_surface (GdkWindow *window) +gdk_wayland_surface_hide_surface (GdkSurface *surface) { - GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (gdk_window_get_display (window)); - GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); + GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (gdk_surface_get_display (surface)); + GdkSurfaceImplWayland *impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); - unmap_popups_for_window (window); + unmap_popups_for_surface (surface); if (impl->display_server.wl_surface) { @@ -2484,27 +2484,27 @@ gdk_wayland_window_hide_surface (GdkWindow *window) zxdg_popup_v6_destroy (impl->display_server.xdg_popup); impl->display_server.xdg_popup = NULL; display_wayland->current_popups = - g_list_remove (display_wayland->current_popups, window); + g_list_remove (display_wayland->current_popups, surface); } if (impl->display_server.xdg_surface) { zxdg_surface_v6_destroy (impl->display_server.xdg_surface); impl->display_server.xdg_surface = NULL; if (!impl->initial_configure_received) - gdk_window_thaw_updates (window); + gdk_surface_thaw_updates (surface); else impl->initial_configure_received = FALSE; } if (impl->display_server.wl_subsurface) - unmap_subsurface (window); + unmap_subsurface (surface); if (impl->awaiting_frame) { GdkFrameClock *frame_clock; impl->awaiting_frame = FALSE; - frame_clock = gdk_window_get_frame_clock (window); + frame_clock = gdk_surface_get_frame_clock (surface); if (frame_clock) _gdk_frame_clock_thaw (frame_clock); } @@ -2522,89 +2522,89 @@ gdk_wayland_window_hide_surface (GdkWindow *window) g_slist_free (impl->display_server.outputs); impl->display_server.outputs = NULL; - if (impl->hint == GDK_WINDOW_TYPE_HINT_DIALOG && !impl->transient_for) + if (impl->hint == GDK_SURFACE_TYPE_HINT_DIALOG && !impl->transient_for) display_wayland->orphan_dialogs = - g_list_remove (display_wayland->orphan_dialogs, window); + g_list_remove (display_wayland->orphan_dialogs, surface); } - unset_transient_for_exported (window); + unset_transient_for_exported (surface); - _gdk_wayland_window_clear_saved_size (window); + _gdk_wayland_surface_clear_saved_size (surface); impl->pending_commit = FALSE; impl->mapped = FALSE; } static void -gdk_wayland_window_hide (GdkWindow *window) +gdk_wayland_surface_hide (GdkSurface *surface) { - gdk_wayland_window_hide_surface (window); - _gdk_window_clear_update_area (window); + gdk_wayland_surface_hide_surface (surface); + _gdk_surface_clear_update_area (surface); } static void -gdk_window_wayland_withdraw (GdkWindow *window) +gdk_surface_wayland_withdraw (GdkSurface *surface) { - if (!window->destroyed) + if (!surface->destroyed) { - if (GDK_WINDOW_IS_MAPPED (window)) - gdk_synthesize_window_state (window, 0, GDK_WINDOW_STATE_WITHDRAWN); + if (GDK_SURFACE_IS_MAPPED (surface)) + gdk_synthesize_surface_state (surface, 0, GDK_SURFACE_STATE_WITHDRAWN); - g_assert (!GDK_WINDOW_IS_MAPPED (window)); + g_assert (!GDK_SURFACE_IS_MAPPED (surface)); - gdk_wayland_window_hide_surface (window); + gdk_wayland_surface_hide_surface (surface); } } static void -gdk_window_wayland_set_events (GdkWindow *window, +gdk_surface_wayland_set_events (GdkSurface *surface, GdkEventMask event_mask) { - GDK_WINDOW (window)->event_mask = event_mask; + GDK_SURFACE (surface)->event_mask = event_mask; } static GdkEventMask -gdk_window_wayland_get_events (GdkWindow *window) +gdk_surface_wayland_get_events (GdkSurface *surface) { - if (GDK_WINDOW_DESTROYED (window)) + if (GDK_SURFACE_DESTROYED (surface)) return 0; else - return GDK_WINDOW (window)->event_mask; + return GDK_SURFACE (surface)->event_mask; } static void -gdk_window_wayland_raise (GdkWindow *window) +gdk_surface_wayland_raise (GdkSurface *surface) { } static void -gdk_window_wayland_lower (GdkWindow *window) +gdk_surface_wayland_lower (GdkSurface *surface) { } static void -gdk_window_wayland_restack_toplevel (GdkWindow *window, - GdkWindow *sibling, +gdk_surface_wayland_restack_toplevel (GdkSurface *surface, + GdkSurface *sibling, gboolean above) { } static void -gdk_window_request_transient_parent_commit (GdkWindow *window) +gdk_surface_request_transient_parent_commit (GdkSurface *surface) { - GdkWindowImplWayland *window_impl, *impl; + GdkSurfaceImplWayland *surface_impl, *impl; GdkFrameClock *frame_clock; - window_impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); + surface_impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); - if (!window_impl->transient_for) + if (!surface_impl->transient_for) return; - impl = GDK_WINDOW_IMPL_WAYLAND (window_impl->transient_for->impl); + impl = GDK_SURFACE_IMPL_WAYLAND (surface_impl->transient_for->impl); if (!impl->display_server.wl_surface || impl->pending_commit) return; - frame_clock = gdk_window_get_frame_clock (window_impl->transient_for); + frame_clock = gdk_surface_get_frame_clock (surface_impl->transient_for); if (!frame_clock) return; @@ -2615,44 +2615,44 @@ gdk_window_request_transient_parent_commit (GdkWindow *window) } static void -gdk_window_wayland_move_resize (GdkWindow *window, +gdk_surface_wayland_move_resize (GdkSurface *surface, gboolean with_move, gint x, gint y, gint width, gint height) { - GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); + GdkSurfaceImplWayland *impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); if (with_move) { /* Each toplevel has in its own "root" coordinate system */ - if (GDK_WINDOW_TYPE (window) != GDK_WINDOW_TOPLEVEL) + if (GDK_SURFACE_TYPE (surface) != GDK_SURFACE_TOPLEVEL) { - window->x = x; - window->y = y; + surface->x = x; + surface->y = y; impl->position_method = POSITION_METHOD_MOVE_RESIZE; if (impl->display_server.wl_subsurface) { wl_subsurface_set_position (impl->display_server.wl_subsurface, - window->x + window->abs_x, - window->y + window->abs_y); - gdk_window_request_transient_parent_commit (window); + surface->x + surface->abs_x, + surface->y + surface->abs_y); + gdk_surface_request_transient_parent_commit (surface); } } } /* If this function is called with width and height = -1 then that means - * just move the window - don't update its size + * just move the surface - don't update its size */ if (width > 0 && height > 0) - gdk_wayland_window_maybe_configure (window, width, height, impl->scale); + gdk_wayland_surface_maybe_configure (surface, width, height, impl->scale); } /* Avoid zero width/height as this is a protocol error */ static void -sanitize_anchor_rect (GdkWindow *window, +sanitize_anchor_rect (GdkSurface *surface, GdkRectangle *rect) { gint original_width = rect->width; @@ -2665,21 +2665,21 @@ sanitize_anchor_rect (GdkWindow *window, } static void -gdk_window_wayland_move_to_rect (GdkWindow *window, +gdk_surface_wayland_move_to_rect (GdkSurface *surface, const GdkRectangle *rect, GdkGravity rect_anchor, - GdkGravity window_anchor, + GdkGravity surface_anchor, GdkAnchorHints anchor_hints, gint rect_anchor_dx, gint rect_anchor_dy) { - GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); + GdkSurfaceImplWayland *impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); impl->pending_move_to_rect.rect = *rect; - sanitize_anchor_rect (window, &impl->pending_move_to_rect.rect); + sanitize_anchor_rect (surface, &impl->pending_move_to_rect.rect); impl->pending_move_to_rect.rect_anchor = rect_anchor; - impl->pending_move_to_rect.window_anchor = window_anchor; + impl->pending_move_to_rect.surface_anchor = surface_anchor; impl->pending_move_to_rect.anchor_hints = anchor_hints; impl->pending_move_to_rect.rect_anchor_dx = rect_anchor_dx; impl->pending_move_to_rect.rect_anchor_dy = rect_anchor_dy; @@ -2688,27 +2688,27 @@ gdk_window_wayland_move_to_rect (GdkWindow *window, } static void -gdk_window_wayland_get_geometry (GdkWindow *window, +gdk_surface_wayland_get_geometry (GdkSurface *surface, gint *x, gint *y, gint *width, gint *height) { - if (!GDK_WINDOW_DESTROYED (window)) + if (!GDK_SURFACE_DESTROYED (surface)) { if (x) - *x = window->x; + *x = surface->x; if (y) - *y = window->y; + *y = surface->y; if (width) - *width = window->width; + *width = surface->width; if (height) - *height = window->height; + *height = surface->height; } } static void -gdk_window_wayland_get_root_coords (GdkWindow *window, +gdk_surface_wayland_get_root_coords (GdkSurface *surface, gint x, gint y, gint *root_x, @@ -2720,31 +2720,31 @@ gdk_window_wayland_get_root_coords (GdkWindow *window, * positioned, relatively. * * However, there are some cases like popups and subsurfaces where we do have - * some amount of control over the placement of our window, and we can - * semi-accurately control the x/y position of these windows, if they are + * some amount of control over the placement of our surface, and we can + * semi-accurately control the x/y position of these surfaces, if they are * relative to another surface. * * To pretend we have something called a root coordinate space, assume all - * parent-less windows are positioned in (0, 0), and all relative positioned + * parent-less surfaces are positioned in (0, 0), and all relative positioned * popups and subsurfaces are placed within this fake root coordinate space. * - * For example a 200x200 large toplevel window will have the position (0, 0). + * For example a 200x200 large toplevel surface will have the position (0, 0). * If a popup positioned in the middle of the toplevel will have the fake * position (100,100). Furthermore, if a positioned is placed in the middle * that popup, will have the fake position (150,150), even though it has the - * relative position (50,50). These three windows would make up one single + * relative position (50,50). These three surfaces would make up one single * fake root coordinate space. */ if (root_x) - *root_x = window->x + x; + *root_x = surface->x + x; if (root_y) - *root_y = window->y + y; + *root_y = surface->y + y; } static gboolean -gdk_window_wayland_get_device_state (GdkWindow *window, +gdk_surface_wayland_get_device_state (GdkSurface *surface, GdkDevice *device, gdouble *x, gdouble *y, @@ -2752,15 +2752,15 @@ gdk_window_wayland_get_device_state (GdkWindow *window, { gboolean return_val; - g_return_val_if_fail (window == NULL || GDK_IS_WINDOW (window), FALSE); + g_return_val_if_fail (surface == NULL || GDK_IS_SURFACE (surface), FALSE); return_val = TRUE; - if (!GDK_WINDOW_DESTROYED (window)) + if (!GDK_SURFACE_DESTROYED (surface)) { - GdkWindow *child; + GdkSurface *child; - GDK_DEVICE_GET_CLASS (device)->query_state (device, window, + GDK_DEVICE_GET_CLASS (device)->query_state (device, surface, &child, NULL, NULL, x, y, mask); @@ -2771,7 +2771,7 @@ gdk_window_wayland_get_device_state (GdkWindow *window, } static void -gdk_window_wayland_shape_combine_region (GdkWindow *window, +gdk_surface_wayland_shape_combine_region (GdkSurface *surface, const cairo_region_t *shape_region, gint offset_x, gint offset_y) @@ -2779,14 +2779,14 @@ gdk_window_wayland_shape_combine_region (GdkWindow *window, } static void -gdk_window_wayland_input_shape_combine_region (GdkWindow *window, +gdk_surface_wayland_input_shape_combine_region (GdkSurface *surface, const cairo_region_t *shape_region, gint offset_x, gint offset_y) { - GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); + GdkSurfaceImplWayland *impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); - if (GDK_WINDOW_DESTROYED (window)) + if (GDK_SURFACE_DESTROYED (surface)) return; g_clear_pointer (&impl->input_region, cairo_region_destroy); @@ -2801,32 +2801,32 @@ gdk_window_wayland_input_shape_combine_region (GdkWindow *window, } static void -gdk_wayland_window_destroy (GdkWindow *window, +gdk_wayland_surface_destroy (GdkSurface *surface, gboolean recursing, gboolean foreign_destroy) { - g_return_if_fail (GDK_IS_WINDOW (window)); + g_return_if_fail (GDK_IS_SURFACE (surface)); - /* Wayland windows can't be externally destroyed; we may possibly + /* Wayland surfaces can't be externally destroyed; we may possibly * eventually want to use this path at display close-down */ g_return_if_fail (!foreign_destroy); - gdk_wayland_window_hide_surface (window); - drop_cairo_surfaces (window); + gdk_wayland_surface_hide_surface (surface); + drop_cairo_surfaces (surface); - if (window->parent == NULL) + if (surface->parent == NULL) { - GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (gdk_window_get_display (window)); - display->toplevels = g_list_remove (display->toplevels, window); + GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (gdk_surface_get_display (surface)); + display->toplevels = g_list_remove (display->toplevels, surface); } } static void -gdk_wayland_window_focus (GdkWindow *window, +gdk_wayland_surface_focus (GdkSurface *surface, guint32 timestamp) { - GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); + GdkSurfaceImplWayland *impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); if (!impl->display_server.gtk_surface) return; @@ -2842,28 +2842,28 @@ gdk_wayland_window_focus (GdkWindow *window, } static void -gdk_wayland_window_set_type_hint (GdkWindow *window, - GdkWindowTypeHint hint) +gdk_wayland_surface_set_type_hint (GdkSurface *surface, + GdkSurfaceTypeHint hint) { - GdkWindowImplWayland *impl; + GdkSurfaceImplWayland *impl; - impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); + impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); - if (GDK_WINDOW_DESTROYED (window)) + if (GDK_SURFACE_DESTROYED (surface)) return; impl->hint = hint; } -static GdkWindowTypeHint -gdk_wayland_window_get_type_hint (GdkWindow *window) +static GdkSurfaceTypeHint +gdk_wayland_surface_get_type_hint (GdkSurface *surface) { - GdkWindowImplWayland *impl; + GdkSurfaceImplWayland *impl; - if (GDK_WINDOW_DESTROYED (window)) - return GDK_WINDOW_TYPE_HINT_NORMAL; + if (GDK_SURFACE_DESTROYED (surface)) + return GDK_SURFACE_TYPE_HINT_NORMAL; - impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); + impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); return impl->hint; } @@ -2873,9 +2873,9 @@ gtk_surface_configure (void *data, struct gtk_surface1 *gtk_surface, struct wl_array *states) { - GdkWindow *window = GDK_WINDOW (data); - GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); - GdkWindowState new_state = 0; + GdkSurface *surface = GDK_SURFACE (data); + GdkSurfaceImplWayland *impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); + GdkSurfaceState new_state = 0; uint32_t *p; wl_array_for_each (p, states) @@ -2885,21 +2885,21 @@ gtk_surface_configure (void *data, switch (state) { case GTK_SURFACE1_STATE_TILED: - new_state |= GDK_WINDOW_STATE_TILED; + new_state |= GDK_SURFACE_STATE_TILED; break; /* Since v2 */ case GTK_SURFACE1_STATE_TILED_TOP: - new_state |= (GDK_WINDOW_STATE_TILED | GDK_WINDOW_STATE_TOP_TILED); + new_state |= (GDK_SURFACE_STATE_TILED | GDK_SURFACE_STATE_TOP_TILED); break; case GTK_SURFACE1_STATE_TILED_RIGHT: - new_state |= (GDK_WINDOW_STATE_TILED | GDK_WINDOW_STATE_RIGHT_TILED); + new_state |= (GDK_SURFACE_STATE_TILED | GDK_SURFACE_STATE_RIGHT_TILED); break; case GTK_SURFACE1_STATE_TILED_BOTTOM: - new_state |= (GDK_WINDOW_STATE_TILED | GDK_WINDOW_STATE_BOTTOM_TILED); + new_state |= (GDK_SURFACE_STATE_TILED | GDK_SURFACE_STATE_BOTTOM_TILED); break; case GTK_SURFACE1_STATE_TILED_LEFT: - new_state |= (GDK_WINDOW_STATE_TILED | GDK_WINDOW_STATE_LEFT_TILED); + new_state |= (GDK_SURFACE_STATE_TILED | GDK_SURFACE_STATE_LEFT_TILED); break; default: /* Unknown state */ @@ -2915,9 +2915,9 @@ gtk_surface_configure_edges (void *data, struct gtk_surface1 *gtk_surface, struct wl_array *edge_constraints) { - GdkWindow *window = GDK_WINDOW (data); - GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); - GdkWindowState new_state = 0; + GdkSurface *surface = GDK_SURFACE (data); + GdkSurfaceImplWayland *impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); + GdkSurfaceState new_state = 0; uint32_t *p; wl_array_for_each (p, edge_constraints) @@ -2927,16 +2927,16 @@ gtk_surface_configure_edges (void *data, switch (constraint) { case GTK_SURFACE1_EDGE_CONSTRAINT_RESIZABLE_TOP: - new_state |= GDK_WINDOW_STATE_TOP_RESIZABLE; + new_state |= GDK_SURFACE_STATE_TOP_RESIZABLE; break; case GTK_SURFACE1_EDGE_CONSTRAINT_RESIZABLE_RIGHT: - new_state |= GDK_WINDOW_STATE_RIGHT_RESIZABLE; + new_state |= GDK_SURFACE_STATE_RIGHT_RESIZABLE; break; case GTK_SURFACE1_EDGE_CONSTRAINT_RESIZABLE_BOTTOM: - new_state |= GDK_WINDOW_STATE_BOTTOM_RESIZABLE; + new_state |= GDK_SURFACE_STATE_BOTTOM_RESIZABLE; break; case GTK_SURFACE1_EDGE_CONSTRAINT_RESIZABLE_LEFT: - new_state |= GDK_WINDOW_STATE_LEFT_RESIZABLE; + new_state |= GDK_SURFACE_STATE_LEFT_RESIZABLE; break; default: /* Unknown state */ @@ -2953,11 +2953,11 @@ static const struct gtk_surface1_listener gtk_surface_listener = { }; static void -gdk_wayland_window_init_gtk_surface (GdkWindow *window) +gdk_wayland_surface_init_gtk_surface (GdkSurface *surface) { - GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); + GdkSurfaceImplWayland *impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); GdkWaylandDisplay *display = - GDK_WAYLAND_DISPLAY (gdk_window_get_display (window)); + GDK_WAYLAND_DISPLAY (gdk_surface_get_display (surface)); if (impl->display_server.gtk_surface != NULL) return; @@ -2969,24 +2969,24 @@ gdk_wayland_window_init_gtk_surface (GdkWindow *window) impl->display_server.gtk_surface = gtk_shell1_get_gtk_surface (display->gtk_shell, impl->display_server.wl_surface); - gdk_window_set_geometry_hints (window, + gdk_surface_set_geometry_hints (surface, &impl->geometry_hints, impl->geometry_mask); gtk_surface1_add_listener (impl->display_server.gtk_surface, >k_surface_listener, - window); + surface); } static void -maybe_set_gtk_surface_modal (GdkWindow *window) +maybe_set_gtk_surface_modal (GdkSurface *surface) { - GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); + GdkSurfaceImplWayland *impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); - gdk_wayland_window_init_gtk_surface (window); + gdk_wayland_surface_init_gtk_surface (surface); if (impl->display_server.gtk_surface == NULL) return; - if (window->modal_hint) + if (surface->modal_hint) gtk_surface1_set_modal (impl->display_server.gtk_surface); else gtk_surface1_unset_modal (impl->display_server.gtk_surface); @@ -2994,44 +2994,44 @@ maybe_set_gtk_surface_modal (GdkWindow *window) } static void -gdk_wayland_window_set_modal_hint (GdkWindow *window, +gdk_wayland_surface_set_modal_hint (GdkSurface *surface, gboolean modal) { - window->modal_hint = modal; - maybe_set_gtk_surface_modal (window); + surface->modal_hint = modal; + maybe_set_gtk_surface_modal (surface); } static void -gdk_wayland_window_set_skip_taskbar_hint (GdkWindow *window, +gdk_wayland_surface_set_skip_taskbar_hint (GdkSurface *surface, gboolean skips_taskbar) { } static void -gdk_wayland_window_set_skip_pager_hint (GdkWindow *window, +gdk_wayland_surface_set_skip_pager_hint (GdkSurface *surface, gboolean skips_pager) { } static void -gdk_wayland_window_set_urgency_hint (GdkWindow *window, +gdk_wayland_surface_set_urgency_hint (GdkSurface *surface, gboolean urgent) { } static void -gdk_wayland_window_set_geometry_hints (GdkWindow *window, +gdk_wayland_surface_set_geometry_hints (GdkSurface *surface, const GdkGeometry *geometry, - GdkWindowHints geom_mask) + GdkSurfaceHints geom_mask) { - GdkWindowImplWayland *impl; + GdkSurfaceImplWayland *impl; int width, height; - if (GDK_WINDOW_DESTROYED (window) || - !WINDOW_IS_TOPLEVEL (window)) + if (GDK_SURFACE_DESTROYED (surface) || + !SURFACE_IS_TOPLEVEL (surface)) return; - impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); + impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); impl->geometry_hints = *geometry; impl->geometry_mask = geom_mask; @@ -3067,19 +3067,19 @@ gdk_wayland_window_set_geometry_hints (GdkWindow *window, } static void -gdk_wayland_window_set_title (GdkWindow *window, +gdk_wayland_surface_set_title (GdkSurface *surface, const gchar *title) { - GdkWindowImplWayland *impl; + GdkSurfaceImplWayland *impl; const char *end; gsize title_length; g_return_if_fail (title != NULL); - if (GDK_WINDOW_DESTROYED (window)) + if (GDK_SURFACE_DESTROYED (surface)) return; - impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); + impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); if (g_strcmp0 (impl->title, title) == 0) return; @@ -3096,37 +3096,37 @@ gdk_wayland_window_set_title (GdkWindow *window, else { impl->title = g_utf8_make_valid (title, title_length); - g_warning ("Invalid utf8 passed to gdk_window_set_title: '%s'", title); + g_warning ("Invalid utf8 passed to gdk_surface_set_title: '%s'", title); } - gdk_wayland_window_sync_title (window); + gdk_wayland_surface_sync_title (surface); } static void -gdk_wayland_window_set_role (GdkWindow *window, +gdk_wayland_surface_set_role (GdkSurface *surface, const gchar *role) { } static void -gdk_wayland_window_set_startup_id (GdkWindow *window, +gdk_wayland_surface_set_startup_id (GdkSurface *surface, const gchar *startup_id) { } static gboolean -check_transient_for_loop (GdkWindow *window, - GdkWindow *parent) +check_transient_for_loop (GdkSurface *surface, + GdkSurface *parent) { while (parent) { - GdkWindowImplWayland *impl; + GdkSurfaceImplWayland *impl; - if (!GDK_IS_WINDOW_IMPL_WAYLAND(parent->impl)) + if (!GDK_IS_SURFACE_IMPL_WAYLAND(parent->impl)) return FALSE; - impl = GDK_WINDOW_IMPL_WAYLAND (parent->impl); - if (impl->transient_for == window) + impl = GDK_SURFACE_IMPL_WAYLAND (parent->impl); + if (impl->transient_for == surface) return TRUE; parent = impl->transient_for; } @@ -3134,90 +3134,90 @@ check_transient_for_loop (GdkWindow *window, } static void -gdk_wayland_window_set_transient_for (GdkWindow *window, - GdkWindow *parent) +gdk_wayland_surface_set_transient_for (GdkSurface *surface, + GdkSurface *parent) { - GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); + GdkSurfaceImplWayland *impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); GdkWaylandDisplay *display_wayland = - GDK_WAYLAND_DISPLAY (gdk_window_get_display (window)); - GdkWindow *previous_parent; + GDK_WAYLAND_DISPLAY (gdk_surface_get_display (surface)); + GdkSurface *previous_parent; g_assert (parent == NULL || - gdk_window_get_display (window) == gdk_window_get_display (parent)); + gdk_surface_get_display (surface) == gdk_surface_get_display (parent)); - if (check_transient_for_loop (window, parent)) + if (check_transient_for_loop (surface, parent)) { - g_warning ("Setting %p transient for %p would create a loop", window, parent); + g_warning ("Setting %p transient for %p would create a loop", surface, parent); return; } - unset_transient_for_exported (window); + unset_transient_for_exported (surface); if (impl->display_server.wl_subsurface) - unmap_subsurface (window); + unmap_subsurface (surface); previous_parent = impl->transient_for; impl->transient_for = parent; - if (impl->hint == GDK_WINDOW_TYPE_HINT_DIALOG) + if (impl->hint == GDK_SURFACE_TYPE_HINT_DIALOG) { if (!parent) - _gdk_wayland_screen_add_orphan_dialog (window); + _gdk_wayland_screen_add_orphan_dialog (surface); else if (!previous_parent) display_wayland->orphan_dialogs = - g_list_remove (display_wayland->orphan_dialogs, window); + g_list_remove (display_wayland->orphan_dialogs, surface); } - gdk_wayland_window_sync_parent (window, NULL); - if (should_map_as_subsurface (window) && - parent && gdk_window_is_visible (window)) - gdk_wayland_window_create_subsurface (window); + gdk_wayland_surface_sync_parent (surface, NULL); + if (should_map_as_subsurface (surface) && + parent && gdk_surface_is_visible (surface)) + gdk_wayland_surface_create_subsurface (surface); } static void -gdk_wayland_window_get_frame_extents (GdkWindow *window, +gdk_wayland_surface_get_frame_extents (GdkSurface *surface, GdkRectangle *rect) { *rect = (GdkRectangle) { - .x = window->x, - .y = window->y, - .width = window->width, - .height = window->height + .x = surface->x, + .y = surface->y, + .width = surface->width, + .height = surface->height }; } static void -gdk_wayland_window_set_accept_focus (GdkWindow *window, +gdk_wayland_surface_set_accept_focus (GdkSurface *surface, gboolean accept_focus) { } static void -gdk_wayland_window_set_focus_on_map (GdkWindow *window, +gdk_wayland_surface_set_focus_on_map (GdkSurface *surface, gboolean focus_on_map) { } static void -gdk_wayland_window_set_icon_list (GdkWindow *window, +gdk_wayland_surface_set_icon_list (GdkSurface *surface, GList *surfaces) { } static void -gdk_wayland_window_set_icon_name (GdkWindow *window, +gdk_wayland_surface_set_icon_name (GdkSurface *surface, const gchar *name) { - if (GDK_WINDOW_DESTROYED (window)) + if (GDK_SURFACE_DESTROYED (surface)) return; } static void -gdk_wayland_window_iconify (GdkWindow *window) +gdk_wayland_surface_iconify (GdkSurface *surface) { - GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); + GdkSurfaceImplWayland *impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); - if (GDK_WINDOW_DESTROYED (window) || - !WINDOW_IS_TOPLEVEL (window)) + if (GDK_SURFACE_DESTROYED (surface) || + !SURFACE_IS_TOPLEVEL (surface)) return; if (!impl->display_server.xdg_toplevel) @@ -3227,103 +3227,103 @@ gdk_wayland_window_iconify (GdkWindow *window) } static void -gdk_wayland_window_deiconify (GdkWindow *window) +gdk_wayland_surface_deiconify (GdkSurface *surface) { - if (GDK_WINDOW_DESTROYED (window) || - !WINDOW_IS_TOPLEVEL (window)) + if (GDK_SURFACE_DESTROYED (surface) || + !SURFACE_IS_TOPLEVEL (surface)) return; - if (GDK_WINDOW_IS_MAPPED (window)) - gdk_window_show (window); + if (GDK_SURFACE_IS_MAPPED (surface)) + gdk_surface_show (surface); else /* Flip our client side flag, the real work happens on map. */ - gdk_synthesize_window_state (window, GDK_WINDOW_STATE_ICONIFIED, 0); + gdk_synthesize_surface_state (surface, GDK_SURFACE_STATE_ICONIFIED, 0); } static void -gdk_wayland_window_stick (GdkWindow *window) +gdk_wayland_surface_stick (GdkSurface *surface) { } static void -gdk_wayland_window_unstick (GdkWindow *window) +gdk_wayland_surface_unstick (GdkSurface *surface) { } static void -gdk_wayland_window_maximize (GdkWindow *window) +gdk_wayland_surface_maximize (GdkSurface *surface) { - GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); + GdkSurfaceImplWayland *impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); - if (GDK_WINDOW_DESTROYED (window)) + if (GDK_SURFACE_DESTROYED (surface)) return; - _gdk_wayland_window_save_size (window); + _gdk_wayland_surface_save_size (surface); if (impl->display_server.xdg_toplevel) zxdg_toplevel_v6_set_maximized (impl->display_server.xdg_toplevel); else - gdk_synthesize_window_state (window, 0, GDK_WINDOW_STATE_MAXIMIZED); + gdk_synthesize_surface_state (surface, 0, GDK_SURFACE_STATE_MAXIMIZED); } static void -gdk_wayland_window_unmaximize (GdkWindow *window) +gdk_wayland_surface_unmaximize (GdkSurface *surface) { - GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); + GdkSurfaceImplWayland *impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); - if (GDK_WINDOW_DESTROYED (window)) + if (GDK_SURFACE_DESTROYED (surface)) return; if (impl->display_server.xdg_toplevel) zxdg_toplevel_v6_unset_maximized (impl->display_server.xdg_toplevel); else - gdk_synthesize_window_state (window, GDK_WINDOW_STATE_MAXIMIZED, 0); + gdk_synthesize_surface_state (surface, GDK_SURFACE_STATE_MAXIMIZED, 0); } static void -gdk_wayland_window_fullscreen_on_monitor (GdkWindow *window, +gdk_wayland_surface_fullscreen_on_monitor (GdkSurface *surface, GdkMonitor *monitor) { - GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); + GdkSurfaceImplWayland *impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); struct wl_output *output = ((GdkWaylandMonitor *)monitor)->output; - if (GDK_WINDOW_DESTROYED (window)) + if (GDK_SURFACE_DESTROYED (surface)) return; - _gdk_wayland_window_save_size (window); + _gdk_wayland_surface_save_size (surface); if (impl->display_server.xdg_toplevel) { zxdg_toplevel_v6_set_fullscreen (impl->display_server.xdg_toplevel, output); } else { - gdk_synthesize_window_state (window, 0, GDK_WINDOW_STATE_FULLSCREEN); + gdk_synthesize_surface_state (surface, 0, GDK_SURFACE_STATE_FULLSCREEN); impl->initial_fullscreen_output = output; } } static void -gdk_wayland_window_fullscreen (GdkWindow *window) +gdk_wayland_surface_fullscreen (GdkSurface *surface) { - GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); + GdkSurfaceImplWayland *impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); - if (GDK_WINDOW_DESTROYED (window)) + if (GDK_SURFACE_DESTROYED (surface)) return; impl->initial_fullscreen_output = NULL; - _gdk_wayland_window_save_size (window); + _gdk_wayland_surface_save_size (surface); if (impl->display_server.xdg_toplevel) zxdg_toplevel_v6_set_fullscreen (impl->display_server.xdg_toplevel, NULL); else - gdk_synthesize_window_state (window, 0, GDK_WINDOW_STATE_FULLSCREEN); + gdk_synthesize_surface_state (surface, 0, GDK_SURFACE_STATE_FULLSCREEN); } static void -gdk_wayland_window_unfullscreen (GdkWindow *window) +gdk_wayland_surface_unfullscreen (GdkSurface *surface) { - GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); + GdkSurfaceImplWayland *impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); - if (GDK_WINDOW_DESTROYED (window)) + if (GDK_SURFACE_DESTROYED (surface)) return; impl->initial_fullscreen_output = NULL; @@ -3331,107 +3331,107 @@ gdk_wayland_window_unfullscreen (GdkWindow *window) if (impl->display_server.xdg_toplevel) zxdg_toplevel_v6_unset_fullscreen (impl->display_server.xdg_toplevel); else - gdk_synthesize_window_state (window, GDK_WINDOW_STATE_FULLSCREEN, 0); + gdk_synthesize_surface_state (surface, GDK_SURFACE_STATE_FULLSCREEN, 0); } static void -gdk_wayland_window_set_keep_above (GdkWindow *window, gboolean setting) +gdk_wayland_surface_set_keep_above (GdkSurface *surface, gboolean setting) { } static void -gdk_wayland_window_set_keep_below (GdkWindow *window, gboolean setting) +gdk_wayland_surface_set_keep_below (GdkSurface *surface, gboolean setting) { } -static GdkWindow * -gdk_wayland_window_get_group (GdkWindow *window) +static GdkSurface * +gdk_wayland_surface_get_group (GdkSurface *surface) { return NULL; } static void -gdk_wayland_window_set_group (GdkWindow *window, - GdkWindow *leader) +gdk_wayland_surface_set_group (GdkSurface *surface, + GdkSurface *leader) { } static void -gdk_wayland_window_set_decorations (GdkWindow *window, +gdk_wayland_surface_set_decorations (GdkSurface *surface, GdkWMDecoration decorations) { } static gboolean -gdk_wayland_window_get_decorations (GdkWindow *window, +gdk_wayland_surface_get_decorations (GdkSurface *surface, GdkWMDecoration *decorations) { return FALSE; } static void -gdk_wayland_window_set_functions (GdkWindow *window, +gdk_wayland_surface_set_functions (GdkSurface *surface, GdkWMFunction functions) { } static void -gdk_wayland_window_begin_resize_drag (GdkWindow *window, - GdkWindowEdge edge, +gdk_wayland_surface_begin_resize_drag (GdkSurface *surface, + GdkSurfaceEdge edge, GdkDevice *device, gint button, gint root_x, gint root_y, guint32 timestamp) { - GdkWindowImplWayland *impl; + GdkSurfaceImplWayland *impl; GdkEventSequence *sequence; uint32_t resize_edges, serial; - if (GDK_WINDOW_DESTROYED (window) || - !WINDOW_IS_TOPLEVEL (window)) + if (GDK_SURFACE_DESTROYED (surface) || + !SURFACE_IS_TOPLEVEL (surface)) return; switch (edge) { - case GDK_WINDOW_EDGE_NORTH_WEST: + case GDK_SURFACE_EDGE_NORTH_WEST: resize_edges = ZXDG_TOPLEVEL_V6_RESIZE_EDGE_TOP_LEFT; break; - case GDK_WINDOW_EDGE_NORTH: + case GDK_SURFACE_EDGE_NORTH: resize_edges = ZXDG_TOPLEVEL_V6_RESIZE_EDGE_TOP; break; - case GDK_WINDOW_EDGE_NORTH_EAST: + case GDK_SURFACE_EDGE_NORTH_EAST: resize_edges = ZXDG_TOPLEVEL_V6_RESIZE_EDGE_TOP_RIGHT; break; - case GDK_WINDOW_EDGE_WEST: + case GDK_SURFACE_EDGE_WEST: resize_edges = ZXDG_TOPLEVEL_V6_RESIZE_EDGE_LEFT; break; - case GDK_WINDOW_EDGE_EAST: + case GDK_SURFACE_EDGE_EAST: resize_edges = ZXDG_TOPLEVEL_V6_RESIZE_EDGE_RIGHT; break; - case GDK_WINDOW_EDGE_SOUTH_WEST: + case GDK_SURFACE_EDGE_SOUTH_WEST: resize_edges = ZXDG_TOPLEVEL_V6_RESIZE_EDGE_BOTTOM_LEFT; break; - case GDK_WINDOW_EDGE_SOUTH: + case GDK_SURFACE_EDGE_SOUTH: resize_edges = ZXDG_TOPLEVEL_V6_RESIZE_EDGE_BOTTOM; break; - case GDK_WINDOW_EDGE_SOUTH_EAST: + case GDK_SURFACE_EDGE_SOUTH_EAST: resize_edges = ZXDG_TOPLEVEL_V6_RESIZE_EDGE_BOTTOM_RIGHT; break; default: - g_warning ("gdk_window_begin_resize_drag: bad resize edge %d!", edge); + g_warning ("gdk_surface_begin_resize_drag: bad resize edge %d!", edge); return; } - impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); + impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); if (!impl->display_server.xdg_toplevel) return; @@ -3453,22 +3453,22 @@ gdk_wayland_window_begin_resize_drag (GdkWindow *window, } static void -gdk_wayland_window_begin_move_drag (GdkWindow *window, +gdk_wayland_surface_begin_move_drag (GdkSurface *surface, GdkDevice *device, gint button, gint root_x, gint root_y, guint32 timestamp) { - GdkWindowImplWayland *impl; + GdkSurfaceImplWayland *impl; GdkEventSequence *sequence; uint32_t serial; - if (GDK_WINDOW_DESTROYED (window) || - !WINDOW_IS_TOPLEVEL (window)) + if (GDK_SURFACE_DESTROYED (surface) || + !SURFACE_IS_TOPLEVEL (surface)) return; - impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); + impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); if (!impl->display_server.xdg_toplevel) return; @@ -3488,41 +3488,41 @@ gdk_wayland_window_begin_move_drag (GdkWindow *window, } static void -gdk_wayland_window_set_opacity (GdkWindow *window, +gdk_wayland_surface_set_opacity (GdkSurface *surface, gdouble opacity) { } static void -gdk_wayland_window_destroy_notify (GdkWindow *window) +gdk_wayland_surface_destroy_notify (GdkSurface *surface) { - if (!GDK_WINDOW_DESTROYED (window)) + if (!GDK_SURFACE_DESTROYED (surface)) { - g_warning ("GdkWindow %p unexpectedly destroyed", window); - _gdk_window_destroy (window, TRUE); + g_warning ("GdkSurface %p unexpectedly destroyed", surface); + _gdk_surface_destroy (surface, TRUE); } - g_object_unref (window); + g_object_unref (surface); } static gint -gdk_wayland_window_get_scale_factor (GdkWindow *window) +gdk_wayland_surface_get_scale_factor (GdkSurface *surface) { - GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); + GdkSurfaceImplWayland *impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); - if (GDK_WINDOW_DESTROYED (window)) + if (GDK_SURFACE_DESTROYED (surface)) return 1; return impl->scale; } static void -gdk_wayland_window_set_opaque_region (GdkWindow *window, +gdk_wayland_surface_set_opaque_region (GdkSurface *surface, cairo_region_t *region) { - GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); + GdkSurfaceImplWayland *impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); - if (GDK_WINDOW_DESTROYED (window)) + if (GDK_SURFACE_DESTROYED (surface)) return; g_clear_pointer (&impl->opaque_region, cairo_region_destroy); @@ -3531,24 +3531,24 @@ gdk_wayland_window_set_opaque_region (GdkWindow *window, } static void -gdk_wayland_window_set_shadow_width (GdkWindow *window, +gdk_wayland_surface_set_shadow_width (GdkSurface *surface, int left, int right, int top, int bottom) { - GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); + GdkSurfaceImplWayland *impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); gint new_width, new_height; - if (GDK_WINDOW_DESTROYED (window)) + if (GDK_SURFACE_DESTROYED (surface)) return; - /* Reconfigure window to keep the same window geometry */ - new_width = window->width - + /* Reconfigure surface to keep the same surface geometry */ + new_width = surface->width - (impl->margin_left + impl->margin_right) + (left + right); - new_height = window->height - + new_height = surface->height - (impl->margin_top + impl->margin_bottom) + (top + bottom); - gdk_wayland_window_maybe_configure (window, new_width, new_height, impl->scale); + gdk_wayland_surface_maybe_configure (surface, new_width, new_height, impl->scale); impl->margin_left = left; impl->margin_right = right; @@ -3557,10 +3557,10 @@ gdk_wayland_window_set_shadow_width (GdkWindow *window, } static gboolean -gdk_wayland_window_show_window_menu (GdkWindow *window, +gdk_wayland_surface_show_window_menu (GdkSurface *surface, GdkEvent *event) { - GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); + GdkSurfaceImplWayland *impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); struct wl_seat *seat; GdkWaylandDevice *device; double x, y; @@ -3591,9 +3591,9 @@ gdk_wayland_window_show_window_menu (GdkWindow *window, } static gboolean -gdk_wayland_window_supports_edge_constraints (GdkWindow *window) +gdk_wayland_surface_supports_edge_constraints (GdkSurface *surface) { - GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); + GdkSurfaceImplWayland *impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); struct gtk_surface1 *gtk_surface = impl->display_server.gtk_surface; if (!gtk_surface) @@ -3603,80 +3603,80 @@ gdk_wayland_window_supports_edge_constraints (GdkWindow *window) } static void -_gdk_window_impl_wayland_class_init (GdkWindowImplWaylandClass *klass) +_gdk_surface_impl_wayland_class_init (GdkSurfaceImplWaylandClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - GdkWindowImplClass *impl_class = GDK_WINDOW_IMPL_CLASS (klass); - - object_class->finalize = gdk_window_impl_wayland_finalize; - - impl_class->ref_cairo_surface = gdk_wayland_window_ref_cairo_surface; - impl_class->create_similar_image_surface = gdk_wayland_window_create_similar_image_surface; - impl_class->show = gdk_wayland_window_show; - impl_class->hide = gdk_wayland_window_hide; - impl_class->withdraw = gdk_window_wayland_withdraw; - impl_class->set_events = gdk_window_wayland_set_events; - impl_class->get_events = gdk_window_wayland_get_events; - impl_class->raise = gdk_window_wayland_raise; - impl_class->lower = gdk_window_wayland_lower; - impl_class->restack_toplevel = gdk_window_wayland_restack_toplevel; - impl_class->move_resize = gdk_window_wayland_move_resize; - impl_class->move_to_rect = gdk_window_wayland_move_to_rect; - impl_class->get_geometry = gdk_window_wayland_get_geometry; - impl_class->get_root_coords = gdk_window_wayland_get_root_coords; - impl_class->get_device_state = gdk_window_wayland_get_device_state; - impl_class->shape_combine_region = gdk_window_wayland_shape_combine_region; - impl_class->input_shape_combine_region = gdk_window_wayland_input_shape_combine_region; - impl_class->destroy = gdk_wayland_window_destroy; - impl_class->begin_paint = gdk_window_impl_wayland_begin_paint; - impl_class->end_paint = gdk_window_impl_wayland_end_paint; - impl_class->beep = gdk_window_impl_wayland_beep; - - impl_class->focus = gdk_wayland_window_focus; - impl_class->set_type_hint = gdk_wayland_window_set_type_hint; - impl_class->get_type_hint = gdk_wayland_window_get_type_hint; - impl_class->set_modal_hint = gdk_wayland_window_set_modal_hint; - impl_class->set_skip_taskbar_hint = gdk_wayland_window_set_skip_taskbar_hint; - impl_class->set_skip_pager_hint = gdk_wayland_window_set_skip_pager_hint; - impl_class->set_urgency_hint = gdk_wayland_window_set_urgency_hint; - impl_class->set_geometry_hints = gdk_wayland_window_set_geometry_hints; - impl_class->set_title = gdk_wayland_window_set_title; - impl_class->set_role = gdk_wayland_window_set_role; - impl_class->set_startup_id = gdk_wayland_window_set_startup_id; - impl_class->set_transient_for = gdk_wayland_window_set_transient_for; - impl_class->get_frame_extents = gdk_wayland_window_get_frame_extents; - impl_class->set_accept_focus = gdk_wayland_window_set_accept_focus; - impl_class->set_focus_on_map = gdk_wayland_window_set_focus_on_map; - impl_class->set_icon_list = gdk_wayland_window_set_icon_list; - impl_class->set_icon_name = gdk_wayland_window_set_icon_name; - impl_class->iconify = gdk_wayland_window_iconify; - impl_class->deiconify = gdk_wayland_window_deiconify; - impl_class->stick = gdk_wayland_window_stick; - impl_class->unstick = gdk_wayland_window_unstick; - impl_class->maximize = gdk_wayland_window_maximize; - impl_class->unmaximize = gdk_wayland_window_unmaximize; - impl_class->fullscreen = gdk_wayland_window_fullscreen; - impl_class->fullscreen_on_monitor = gdk_wayland_window_fullscreen_on_monitor; - impl_class->unfullscreen = gdk_wayland_window_unfullscreen; - impl_class->set_keep_above = gdk_wayland_window_set_keep_above; - impl_class->set_keep_below = gdk_wayland_window_set_keep_below; - impl_class->get_group = gdk_wayland_window_get_group; - impl_class->set_group = gdk_wayland_window_set_group; - impl_class->set_decorations = gdk_wayland_window_set_decorations; - impl_class->get_decorations = gdk_wayland_window_get_decorations; - impl_class->set_functions = gdk_wayland_window_set_functions; - impl_class->begin_resize_drag = gdk_wayland_window_begin_resize_drag; - impl_class->begin_move_drag = gdk_wayland_window_begin_move_drag; - impl_class->set_opacity = gdk_wayland_window_set_opacity; - impl_class->destroy_notify = gdk_wayland_window_destroy_notify; - impl_class->register_dnd = _gdk_wayland_window_register_dnd; - impl_class->drag_begin = _gdk_wayland_window_drag_begin; - impl_class->get_scale_factor = gdk_wayland_window_get_scale_factor; - impl_class->set_opaque_region = gdk_wayland_window_set_opaque_region; - impl_class->set_shadow_width = gdk_wayland_window_set_shadow_width; - impl_class->show_window_menu = gdk_wayland_window_show_window_menu; - impl_class->create_gl_context = gdk_wayland_window_create_gl_context; - impl_class->supports_edge_constraints = gdk_wayland_window_supports_edge_constraints; + GdkSurfaceImplClass *impl_class = GDK_SURFACE_IMPL_CLASS (klass); + + object_class->finalize = gdk_surface_impl_wayland_finalize; + + impl_class->ref_cairo_surface = gdk_wayland_surface_ref_cairo_surface; + impl_class->create_similar_image_surface = gdk_wayland_surface_create_similar_image_surface; + impl_class->show = gdk_wayland_surface_show; + impl_class->hide = gdk_wayland_surface_hide; + impl_class->withdraw = gdk_surface_wayland_withdraw; + impl_class->set_events = gdk_surface_wayland_set_events; + impl_class->get_events = gdk_surface_wayland_get_events; + impl_class->raise = gdk_surface_wayland_raise; + impl_class->lower = gdk_surface_wayland_lower; + impl_class->restack_toplevel = gdk_surface_wayland_restack_toplevel; + impl_class->move_resize = gdk_surface_wayland_move_resize; + impl_class->move_to_rect = gdk_surface_wayland_move_to_rect; + impl_class->get_geometry = gdk_surface_wayland_get_geometry; + impl_class->get_root_coords = gdk_surface_wayland_get_root_coords; + impl_class->get_device_state = gdk_surface_wayland_get_device_state; + impl_class->shape_combine_region = gdk_surface_wayland_shape_combine_region; + impl_class->input_shape_combine_region = gdk_surface_wayland_input_shape_combine_region; + impl_class->destroy = gdk_wayland_surface_destroy; + impl_class->begin_paint = gdk_surface_impl_wayland_begin_paint; + impl_class->end_paint = gdk_surface_impl_wayland_end_paint; + impl_class->beep = gdk_surface_impl_wayland_beep; + + impl_class->focus = gdk_wayland_surface_focus; + impl_class->set_type_hint = gdk_wayland_surface_set_type_hint; + impl_class->get_type_hint = gdk_wayland_surface_get_type_hint; + impl_class->set_modal_hint = gdk_wayland_surface_set_modal_hint; + impl_class->set_skip_taskbar_hint = gdk_wayland_surface_set_skip_taskbar_hint; + impl_class->set_skip_pager_hint = gdk_wayland_surface_set_skip_pager_hint; + impl_class->set_urgency_hint = gdk_wayland_surface_set_urgency_hint; + impl_class->set_geometry_hints = gdk_wayland_surface_set_geometry_hints; + impl_class->set_title = gdk_wayland_surface_set_title; + impl_class->set_role = gdk_wayland_surface_set_role; + impl_class->set_startup_id = gdk_wayland_surface_set_startup_id; + impl_class->set_transient_for = gdk_wayland_surface_set_transient_for; + impl_class->get_frame_extents = gdk_wayland_surface_get_frame_extents; + impl_class->set_accept_focus = gdk_wayland_surface_set_accept_focus; + impl_class->set_focus_on_map = gdk_wayland_surface_set_focus_on_map; + impl_class->set_icon_list = gdk_wayland_surface_set_icon_list; + impl_class->set_icon_name = gdk_wayland_surface_set_icon_name; + impl_class->iconify = gdk_wayland_surface_iconify; + impl_class->deiconify = gdk_wayland_surface_deiconify; + impl_class->stick = gdk_wayland_surface_stick; + impl_class->unstick = gdk_wayland_surface_unstick; + impl_class->maximize = gdk_wayland_surface_maximize; + impl_class->unmaximize = gdk_wayland_surface_unmaximize; + impl_class->fullscreen = gdk_wayland_surface_fullscreen; + impl_class->fullscreen_on_monitor = gdk_wayland_surface_fullscreen_on_monitor; + impl_class->unfullscreen = gdk_wayland_surface_unfullscreen; + impl_class->set_keep_above = gdk_wayland_surface_set_keep_above; + impl_class->set_keep_below = gdk_wayland_surface_set_keep_below; + impl_class->get_group = gdk_wayland_surface_get_group; + impl_class->set_group = gdk_wayland_surface_set_group; + impl_class->set_decorations = gdk_wayland_surface_set_decorations; + impl_class->get_decorations = gdk_wayland_surface_get_decorations; + impl_class->set_functions = gdk_wayland_surface_set_functions; + impl_class->begin_resize_drag = gdk_wayland_surface_begin_resize_drag; + impl_class->begin_move_drag = gdk_wayland_surface_begin_move_drag; + impl_class->set_opacity = gdk_wayland_surface_set_opacity; + impl_class->destroy_notify = gdk_wayland_surface_destroy_notify; + impl_class->register_dnd = _gdk_wayland_surface_register_dnd; + impl_class->drag_begin = _gdk_wayland_surface_drag_begin; + impl_class->get_scale_factor = gdk_wayland_surface_get_scale_factor; + impl_class->set_opaque_region = gdk_wayland_surface_set_opaque_region; + impl_class->set_shadow_width = gdk_wayland_surface_set_shadow_width; + impl_class->show_window_menu = gdk_wayland_surface_show_window_menu; + impl_class->create_gl_context = gdk_wayland_surface_create_gl_context; + impl_class->supports_edge_constraints = gdk_wayland_surface_supports_edge_constraints; signals[COMMITTED] = g_signal_new (g_intern_static_string ("committed"), G_TYPE_FROM_CLASS (object_class), @@ -3687,31 +3687,31 @@ _gdk_window_impl_wayland_class_init (GdkWindowImplWaylandClass *klass) } void -_gdk_wayland_window_set_grab_seat (GdkWindow *window, +_gdk_wayland_surface_set_grab_seat (GdkSurface *surface, GdkSeat *seat) { - GdkWindowImplWayland *impl; + GdkSurfaceImplWayland *impl; - g_return_if_fail (window != NULL); + g_return_if_fail (surface != NULL); - impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); + impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); impl->grab_input_seat = seat; } /** - * gdk_wayland_window_new_subsurface: (constructor) - * @display: the display to create the window on - * @position: position relative to the transient window + * gdk_wayland_surface_new_subsurface: (constructor) + * @display: the display to create the surface on + * @position: position relative to the transient surface * - * Creates a new subsurface window. + * Creates a new subsurface surface. * - * Returns: (transfer full): the new #GdkWindow + * Returns: (transfer full): the new #GdkSurface **/ -GdkWindow * -gdk_wayland_window_new_subsurface (GdkDisplay *display, +GdkSurface * +gdk_wayland_surface_new_subsurface (GdkDisplay *display, const GdkRectangle *position) { - GdkWindowAttr attr; + GdkSurfaceAttr attr; g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL); g_return_val_if_fail (position != NULL, NULL); @@ -3721,35 +3721,35 @@ gdk_wayland_window_new_subsurface (GdkDisplay *display, attr.y = position->y; attr.width = position->width; attr.height = position->height; - attr.window_type = GDK_WINDOW_SUBSURFACE; + attr.surface_type = GDK_SURFACE_SUBSURFACE; - return gdk_window_new (display, NULL, &attr); + return gdk_surface_new (display, NULL, &attr); } /** - * gdk_wayland_window_get_wl_surface: - * @window: (type GdkWaylandWindow): a #GdkWindow + * gdk_wayland_surface_get_wl_surface: + * @surface: (type GdkWaylandSurface): a #GdkSurface * - * Returns the Wayland surface of a #GdkWindow. + * Returns the Wayland surface of a #GdkSurface. * * Returns: (transfer none): a Wayland wl_surface */ struct wl_surface * -gdk_wayland_window_get_wl_surface (GdkWindow *window) +gdk_wayland_surface_get_wl_surface (GdkSurface *surface) { - g_return_val_if_fail (GDK_IS_WAYLAND_WINDOW (window), NULL); + g_return_val_if_fail (GDK_IS_WAYLAND_SURFACE (surface), NULL); - return GDK_WINDOW_IMPL_WAYLAND (window->impl)->display_server.wl_surface; + return GDK_SURFACE_IMPL_WAYLAND (surface->impl)->display_server.wl_surface; } struct wl_output * -gdk_wayland_window_get_wl_output (GdkWindow *window) +gdk_wayland_surface_get_wl_output (GdkSurface *surface) { - GdkWindowImplWayland *impl; + GdkSurfaceImplWayland *impl; - g_return_val_if_fail (GDK_IS_WAYLAND_WINDOW (window), NULL); + g_return_val_if_fail (GDK_IS_WAYLAND_SURFACE (surface), NULL); - impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); + impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); /* We pick the head of the list as this is the last entered output */ if (impl->display_server.outputs) return (struct wl_output *) impl->display_server.outputs->data; @@ -3758,9 +3758,9 @@ gdk_wayland_window_get_wl_output (GdkWindow *window) } static struct wl_egl_window * -gdk_wayland_window_get_wl_egl_window (GdkWindow *window) +gdk_wayland_surface_get_wl_egl_window (GdkSurface *surface) { - GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); + GdkSurfaceImplWayland *impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); if (impl->display_server.egl_window == NULL) { @@ -3775,20 +3775,20 @@ gdk_wayland_window_get_wl_egl_window (GdkWindow *window) } EGLSurface -gdk_wayland_window_get_egl_surface (GdkWindow *window, +gdk_wayland_surface_get_egl_surface (GdkSurface *surface, EGLConfig config) { - GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (gdk_window_get_display (window)); - GdkWindowImplWayland *impl; + GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (gdk_surface_get_display (surface)); + GdkSurfaceImplWayland *impl; struct wl_egl_window *egl_window; - g_return_val_if_fail (GDK_IS_WAYLAND_WINDOW (window), NULL); + g_return_val_if_fail (GDK_IS_WAYLAND_SURFACE (surface), NULL); - impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); + impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); if (impl->egl_surface == NULL) { - egl_window = gdk_wayland_window_get_wl_egl_window (window); + egl_window = gdk_wayland_surface_get_wl_egl_window (surface); impl->egl_surface = eglCreateWindowSurface (display->egl_display, config, egl_window, NULL); @@ -3798,15 +3798,15 @@ gdk_wayland_window_get_egl_surface (GdkWindow *window, } EGLSurface -gdk_wayland_window_get_dummy_egl_surface (GdkWindow *window, +gdk_wayland_surface_get_dummy_egl_surface (GdkSurface *surface, EGLConfig config) { - GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (gdk_window_get_display (window)); - GdkWindowImplWayland *impl; + GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (gdk_surface_get_display (surface)); + GdkSurfaceImplWayland *impl; - g_return_val_if_fail (GDK_IS_WAYLAND_WINDOW (window), NULL); + g_return_val_if_fail (GDK_IS_WAYLAND_SURFACE (surface), NULL); - impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); + impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); if (impl->dummy_egl_surface == NULL) { @@ -3821,18 +3821,18 @@ gdk_wayland_window_get_dummy_egl_surface (GdkWindow *window, } struct gtk_surface1 * -gdk_wayland_window_get_gtk_surface (GdkWindow *window) +gdk_wayland_surface_get_gtk_surface (GdkSurface *surface) { - g_return_val_if_fail (GDK_IS_WAYLAND_WINDOW (window), NULL); + g_return_val_if_fail (GDK_IS_WAYLAND_SURFACE (surface), NULL); - return GDK_WINDOW_IMPL_WAYLAND (window->impl)->display_server.gtk_surface; + return GDK_SURFACE_IMPL_WAYLAND (surface->impl)->display_server.gtk_surface; } /** - * gdk_wayland_window_set_use_custom_surface: - * @window: (type GdkWaylandWindow): a #GdkWindow + * gdk_wayland_surface_set_use_custom_surface: + * @surface: (type GdkWaylandSurface): a #GdkSurface * - * Marks a #GdkWindow as a custom Wayland surface. The application is + * Marks a #GdkSurface as a custom Wayland surface. The application is * expected to register the surface as some type of surface using * some Wayland interface. * @@ -3844,21 +3844,21 @@ gdk_wayland_window_get_gtk_surface (GdkWindow *window) * compositor will expose a private interface to the special client * that lets the client identify the wl_surface as a panel or such. * - * This function should be called before a #GdkWindow is shown. This is + * This function should be called before a #GdkSurface is shown. This is * best done by connecting to the #GtkWidget::realize signal: * * |[<!-- language="C" --> * static void * widget_realize_cb (GtkWidget *widget) * { - * GdkWindow *window; + * GdkSurface *surface; * struct wl_surface *surface; * struct input_panel_surface *ip_surface; * - * window = gtk_widget_get_window (widget); - * gdk_wayland_window_set_custom_surface (window); + * surface = gtk_widget_get_surface (widget); + * gdk_wayland_surface_set_custom_surface (surface); * - * surface = gdk_wayland_window_get_wl_surface (window); + * surface = gdk_wayland_surface_get_wl_surface (surface); * ip_surface = input_panel_get_input_panel_surface (input_panel, surface); * input_panel_surface_set_panel (ip_surface); * } @@ -3871,24 +3871,24 @@ gdk_wayland_window_get_gtk_surface (GdkWindow *window) * ]| */ void -gdk_wayland_window_set_use_custom_surface (GdkWindow *window) +gdk_wayland_surface_set_use_custom_surface (GdkSurface *surface) { - GdkWindowImplWayland *impl; + GdkSurfaceImplWayland *impl; - g_return_if_fail (GDK_IS_WAYLAND_WINDOW (window)); + g_return_if_fail (GDK_IS_WAYLAND_SURFACE (surface)); - impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); + impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); if (!impl->display_server.wl_surface) - gdk_wayland_window_create_surface (window); + gdk_wayland_surface_create_surface (surface); impl->use_custom_surface = TRUE; } static void -maybe_set_gtk_surface_dbus_properties (GdkWindow *window) +maybe_set_gtk_surface_dbus_properties (GdkSurface *surface) { - GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); + GdkSurfaceImplWayland *impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); if (impl->application.was_set) return; @@ -3901,7 +3901,7 @@ maybe_set_gtk_surface_dbus_properties (GdkWindow *window) impl->application.unique_bus_name == NULL) return; - gdk_wayland_window_init_gtk_surface (window); + gdk_wayland_surface_init_gtk_surface (surface); if (impl->display_server.gtk_surface == NULL) return; @@ -3916,7 +3916,7 @@ maybe_set_gtk_surface_dbus_properties (GdkWindow *window) } void -gdk_wayland_window_set_dbus_properties_libgtk_only (GdkWindow *window, +gdk_wayland_surface_set_dbus_properties_libgtk_only (GdkSurface *surface, const char *application_id, const char *app_menu_path, const char *menubar_path, @@ -3924,11 +3924,11 @@ gdk_wayland_window_set_dbus_properties_libgtk_only (GdkWindow *window, const char *application_object_path, const char *unique_bus_name) { - GdkWindowImplWayland *impl; + GdkSurfaceImplWayland *impl; - g_return_if_fail (GDK_IS_WAYLAND_WINDOW (window)); + g_return_if_fail (GDK_IS_WAYLAND_SURFACE (surface)); - impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); + impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); impl->application.application_id = g_strdup (application_id); impl->application.app_menu_path = g_strdup (app_menu_path); @@ -3938,19 +3938,19 @@ gdk_wayland_window_set_dbus_properties_libgtk_only (GdkWindow *window, g_strdup (application_object_path); impl->application.unique_bus_name = g_strdup (unique_bus_name); - maybe_set_gtk_surface_dbus_properties (window); + maybe_set_gtk_surface_dbus_properties (surface); } void -_gdk_wayland_window_offset_next_wl_buffer (GdkWindow *window, +_gdk_wayland_surface_offset_next_wl_buffer (GdkSurface *surface, int x, int y) { - GdkWindowImplWayland *impl; + GdkSurfaceImplWayland *impl; - g_return_if_fail (GDK_IS_WAYLAND_WINDOW (window)); + g_return_if_fail (GDK_IS_WAYLAND_SURFACE (surface)); - impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); + impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); impl->pending_buffer_offset_x = x; impl->pending_buffer_offset_y = y; @@ -3961,10 +3961,10 @@ xdg_exported_handle (void *data, struct zxdg_exported_v1 *zxdg_exported_v1, const char *handle) { - GdkWindow *window = data; - GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); + GdkSurface *surface = data; + GdkSurfaceImplWayland *impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); - impl->exported.callback (window, handle, impl->exported.user_data); + impl->exported.callback (surface, handle, impl->exported.user_data); g_clear_pointer (&impl->exported.user_data, impl->exported.destroy_func); } @@ -3974,28 +3974,28 @@ static const struct zxdg_exported_v1_listener xdg_exported_listener = { }; /** - * GdkWaylandWindowExported: - * @window: the #GdkWindow that is exported + * GdkWaylandSurfaceExported: + * @surface: the #GdkSurface that is exported * @handle: the handle - * @user_data: user data that was passed to gdk_wayland_window_export_handle() + * @user_data: user data that was passed to gdk_wayland_surface_export_handle() * - * Callback that gets called when the handle for a window has been + * Callback that gets called when the handle for a surface has been * obtained from the Wayland compositor. The handle can be passed - * to other processes, for the purpose of marking windows as transient + * to other processes, for the purpose of marking surfaces as transient * for out-of-process surfaces. */ static gboolean -gdk_wayland_window_is_exported (GdkWindow *window) +gdk_wayland_surface_is_exported (GdkSurface *surface) { - GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); + GdkSurfaceImplWayland *impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); return !!impl->display_server.xdg_exported; } /** - * gdk_wayland_window_export_handle: - * @window: the #GdkWindow to obtain a handle for + * gdk_wayland_surface_export_handle: + * @surface: the #GdkSurface to obtain a handle for * @callback: callback to call with the handle * @user_data: user data for @callback * @destroy_func: destroy notify for @user_data @@ -4004,15 +4004,15 @@ gdk_wayland_window_is_exported (GdkWindow *window) * to other processes. When the handle has been obtained, @callback * will be called. * - * It is an error to call this function on a window that is already + * It is an error to call this function on a surface that is already * exported. * - * When the handle is no longer needed, gdk_wayland_window_unexport_handle() + * When the handle is no longer needed, gdk_wayland_surface_unexport_handle() * should be called to clean up resources. * * The main purpose for obtaining a handle is to mark a surface - * from another window as transient for this one, see - * gdk_wayland_window_set_transient_for_exported(). + * from another surface as transient for this one, see + * gdk_wayland_surface_set_transient_for_exported(). * * Note that this API depends on an unstable Wayland protocol, * and thus may require changes in the future. @@ -4021,20 +4021,20 @@ gdk_wayland_window_is_exported (GdkWindow *window) * an error occurred. */ gboolean -gdk_wayland_window_export_handle (GdkWindow *window, - GdkWaylandWindowExported callback, +gdk_wayland_surface_export_handle (GdkSurface *surface, + GdkWaylandSurfaceExported callback, gpointer user_data, GDestroyNotify destroy_func) { - GdkWindowImplWayland *impl; + GdkSurfaceImplWayland *impl; GdkWaylandDisplay *display_wayland; - GdkDisplay *display = gdk_window_get_display (window); + GdkDisplay *display = gdk_surface_get_display (surface); struct zxdg_exported_v1 *xdg_exported; - g_return_val_if_fail (GDK_IS_WAYLAND_WINDOW (window), FALSE); + g_return_val_if_fail (GDK_IS_WAYLAND_SURFACE (surface), FALSE); g_return_val_if_fail (GDK_IS_WAYLAND_DISPLAY (display), FALSE); - impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); + impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); display_wayland = GDK_WAYLAND_DISPLAY (display); g_return_val_if_fail (!impl->display_server.xdg_exported, FALSE); @@ -4047,7 +4047,7 @@ gdk_wayland_window_export_handle (GdkWindow *window, xdg_exported = zxdg_exporter_v1_export (display_wayland->xdg_exporter, impl->display_server.wl_surface); - zxdg_exported_v1_add_listener (xdg_exported, &xdg_exported_listener, window); + zxdg_exported_v1_add_listener (xdg_exported, &xdg_exported_listener, surface); impl->display_server.xdg_exported = xdg_exported; impl->exported.callback = callback; @@ -4058,26 +4058,26 @@ gdk_wayland_window_export_handle (GdkWindow *window, } /** - * gdk_wayland_window_unexport_handle: - * @window: the #GdkWindow to unexport + * gdk_wayland_surface_unexport_handle: + * @surface: the #GdkSurface to unexport * * Destroys the handle that was obtained with - * gdk_wayland_window_export_handle(). + * gdk_wayland_surface_export_handle(). * - * It is an error to call this function on a window that + * It is an error to call this function on a surface that * does not have a handle. * * Note that this API depends on an unstable Wayland protocol, * and thus may require changes in the future. */ void -gdk_wayland_window_unexport_handle (GdkWindow *window) +gdk_wayland_surface_unexport_handle (GdkSurface *surface) { - GdkWindowImplWayland *impl; + GdkSurfaceImplWayland *impl; - g_return_if_fail (GDK_IS_WAYLAND_WINDOW (window)); + g_return_if_fail (GDK_IS_WAYLAND_SURFACE (surface)); - impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); + impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); g_return_if_fail (impl->display_server.xdg_exported); @@ -4088,9 +4088,9 @@ gdk_wayland_window_unexport_handle (GdkWindow *window) } static void -unset_transient_for_exported (GdkWindow *window) +unset_transient_for_exported (GdkSurface *surface) { - GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); + GdkSurfaceImplWayland *impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); g_clear_pointer (&impl->imported_transient_for, zxdg_imported_v1_destroy); } @@ -4099,9 +4099,9 @@ static void xdg_imported_destroyed (void *data, struct zxdg_imported_v1 *zxdg_imported_v1) { - GdkWindow *window = data; + GdkSurface *surface = data; - unset_transient_for_exported (window); + unset_transient_for_exported (surface); } static const struct zxdg_imported_v1_listener xdg_imported_listener = { @@ -4109,34 +4109,34 @@ static const struct zxdg_imported_v1_listener xdg_imported_listener = { }; /** - * gdk_wayland_window_set_transient_for_exported: - * @window: the #GdkWindow to make as transient + * gdk_wayland_surface_set_transient_for_exported: + * @surface: the #GdkSurface to make as transient * @parent_handle_str: an exported handle for a surface * - * Marks @window as transient for the surface to which the given + * Marks @surface as transient for the surface to which the given * @parent_handle_str refers. Typically, the handle will originate - * from a gdk_wayland_window_export_handle() call in another process. + * from a gdk_wayland_surface_export_handle() call in another process. * * Note that this API depends on an unstable Wayland protocol, * and thus may require changes in the future. * - * Return value: %TRUE if the window has been marked as transient, + * Return value: %TRUE if the surface has been marked as transient, * %FALSE if an error occurred. */ gboolean -gdk_wayland_window_set_transient_for_exported (GdkWindow *window, +gdk_wayland_surface_set_transient_for_exported (GdkSurface *surface, char *parent_handle_str) { - GdkWindowImplWayland *impl; + GdkSurfaceImplWayland *impl; GdkWaylandDisplay *display_wayland; - GdkDisplay *display = gdk_window_get_display (window); + GdkDisplay *display = gdk_surface_get_display (surface); - g_return_val_if_fail (GDK_IS_WAYLAND_WINDOW (window), FALSE); + g_return_val_if_fail (GDK_IS_WAYLAND_SURFACE (surface), FALSE); g_return_val_if_fail (GDK_IS_WAYLAND_DISPLAY (display), FALSE); - g_return_val_if_fail (!should_map_as_subsurface (window) && - !should_map_as_popup (window), FALSE); + g_return_val_if_fail (!should_map_as_subsurface (surface) && + !should_map_as_popup (surface), FALSE); - impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); + impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); display_wayland = GDK_WAYLAND_DISPLAY (display); if (!display_wayland->xdg_importer) @@ -4145,58 +4145,58 @@ gdk_wayland_window_set_transient_for_exported (GdkWindow *window, return FALSE; } - gdk_window_set_transient_for (window, NULL); + gdk_surface_set_transient_for (surface, NULL); impl->imported_transient_for = zxdg_importer_v1_import (display_wayland->xdg_importer, parent_handle_str); zxdg_imported_v1_add_listener (impl->imported_transient_for, &xdg_imported_listener, - window); + surface); - gdk_wayland_window_sync_parent_of_imported (window); + gdk_wayland_surface_sync_parent_of_imported (surface); return TRUE; } static struct zwp_keyboard_shortcuts_inhibitor_v1 * -gdk_wayland_window_get_inhibitor (GdkWindowImplWayland *impl, +gdk_wayland_surface_get_inhibitor (GdkSurfaceImplWayland *impl, struct wl_seat *seat) { return g_hash_table_lookup (impl->shortcuts_inhibitors, seat); } void -gdk_wayland_window_inhibit_shortcuts (GdkWindow *window, +gdk_wayland_surface_inhibit_shortcuts (GdkSurface *surface, GdkSeat *gdk_seat) { - GdkWindowImplWayland *impl= GDK_WINDOW_IMPL_WAYLAND (window->impl); - GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (gdk_window_get_display (window)); - struct wl_surface *surface = impl->display_server.wl_surface; + GdkSurfaceImplWayland *impl= GDK_SURFACE_IMPL_WAYLAND (surface->impl); + GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (gdk_surface_get_display (surface)); + struct wl_surface *wl_surface = impl->display_server.wl_surface; struct wl_seat *seat = gdk_wayland_seat_get_wl_seat (gdk_seat); struct zwp_keyboard_shortcuts_inhibitor_v1 *inhibitor; if (display->keyboard_shortcuts_inhibit == NULL) return; - if (gdk_wayland_window_get_inhibitor (impl, seat)) + if (gdk_wayland_surface_get_inhibitor (impl, seat)) return; /* Already inhibitted */ inhibitor = zwp_keyboard_shortcuts_inhibit_manager_v1_inhibit_shortcuts ( - display->keyboard_shortcuts_inhibit, surface, seat); + display->keyboard_shortcuts_inhibit, wl_surface, seat); g_hash_table_insert (impl->shortcuts_inhibitors, seat, inhibitor); } void -gdk_wayland_window_restore_shortcuts (GdkWindow *window, +gdk_wayland_surface_restore_shortcuts (GdkSurface *surface, GdkSeat *gdk_seat) { - GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); + GdkSurfaceImplWayland *impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl); struct wl_seat *seat = gdk_wayland_seat_get_wl_seat (gdk_seat); struct zwp_keyboard_shortcuts_inhibitor_v1 *inhibitor; - inhibitor = gdk_wayland_window_get_inhibitor (impl, seat); + inhibitor = gdk_wayland_surface_get_inhibitor (impl, seat); if (inhibitor == NULL) return; /* Not inhibitted */ diff --git a/gdk/wayland/gdkvulkancontext-wayland.c b/gdk/wayland/gdkvulkancontext-wayland.c index 7aa1d1e260..4e85469741 100644 --- a/gdk/wayland/gdkvulkancontext-wayland.c +++ b/gdk/wayland/gdkvulkancontext-wayland.c @@ -28,19 +28,19 @@ #include "gdkinternals.h" #include "gdkwaylanddisplay.h" -#include "gdkwaylandwindow.h" +#include "gdkwaylandsurface.h" #include "gdkprivate-wayland.h" G_DEFINE_TYPE (GdkWaylandVulkanContext, gdk_wayland_vulkan_context, GDK_TYPE_VULKAN_CONTEXT) static VkResult gdk_wayland_vulkan_context_create_surface (GdkVulkanContext *context, - VkSurfaceKHR *surface) + VkSurfaceKHR *vr_surface) { - GdkWindow *window = gdk_draw_context_get_window (GDK_DRAW_CONTEXT (context)); + GdkSurface *surface = gdk_draw_context_get_surface (GDK_DRAW_CONTEXT (context)); GdkDisplay *display = gdk_draw_context_get_display (GDK_DRAW_CONTEXT (context)); - /* This is necessary so that Vulkan sees the Window. + /* This is necessary so that Vulkan sees the Surface. * Usually, vkCreateXlibSurfaceKHR() will not cause a problem to happen as * it just creates resources, but futher calls with the resulting surface * do cause issues. @@ -53,10 +53,10 @@ gdk_wayland_vulkan_context_create_surface (GdkVulkanContext *context, NULL, 0, gdk_wayland_display_get_wl_display (display), - gdk_wayland_window_get_wl_surface (window) + gdk_wayland_surface_get_wl_surface (surface) }, NULL, - surface); + vr_surface); } static void @@ -64,11 +64,11 @@ gdk_vulkan_context_wayland_end_frame (GdkDrawContext *context, cairo_region_t *painted, cairo_region_t *damage) { - GdkWindow *window = gdk_draw_context_get_window (GDK_DRAW_CONTEXT (context)); + GdkSurface *surface = gdk_draw_context_get_surface (GDK_DRAW_CONTEXT (context)); GDK_DRAW_CONTEXT_CLASS (gdk_wayland_vulkan_context_parent_class)->end_frame (context, painted, damage); - gdk_wayland_window_sync (window); + gdk_wayland_surface_sync (surface); } static void diff --git a/gdk/wayland/gdkwayland.h b/gdk/wayland/gdkwayland.h index 14f25d1d1d..9179d58e77 100644 --- a/gdk/wayland/gdkwayland.h +++ b/gdk/wayland/gdkwayland.h @@ -32,7 +32,7 @@ #include <gdk/wayland/gdkwaylanddevice.h> #include <gdk/wayland/gdkwaylanddisplay.h> #include <gdk/wayland/gdkwaylandmonitor.h> -#include <gdk/wayland/gdkwaylandwindow.h> +#include <gdk/wayland/gdkwaylandsurface.h> #include <gdk/wayland/gdkwaylandglcontext.h> #undef __GDKWAYLAND_H_INSIDE__ diff --git a/gdk/wayland/gdkwaylandwindow.h b/gdk/wayland/gdkwaylandsurface.h index 1d6f5c04f7..49dafde67f 100644 --- a/gdk/wayland/gdkwaylandwindow.h +++ b/gdk/wayland/gdkwaylandsurface.h @@ -15,8 +15,8 @@ * License along with this library. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef __GDK_WAYLAND_WINDOW_H__ -#define __GDK_WAYLAND_WINDOW_H__ +#ifndef __GDK_WAYLAND_SURFACE_H__ +#define __GDK_WAYLAND_SURFACE_H__ #if !defined (__GDKWAYLAND_H_INSIDE__) && !defined (GDK_COMPILATION) #error "Only <gdk/gdkwayland.h> can be included directly." @@ -29,33 +29,33 @@ G_BEGIN_DECLS #ifdef GDK_COMPILATION -typedef struct _GdkWaylandWindow GdkWaylandWindow; +typedef struct _GdkWaylandSurface GdkWaylandSurface; #else -typedef GdkWindow GdkWaylandWindow; +typedef GdkSurface GdkWaylandSurface; #endif -typedef struct _GdkWaylandWindowClass GdkWaylandWindowClass; +typedef struct _GdkWaylandSurfaceClass GdkWaylandSurfaceClass; -#define GDK_TYPE_WAYLAND_WINDOW (gdk_wayland_window_get_type()) -#define GDK_WAYLAND_WINDOW(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_WAYLAND_WINDOW, GdkWaylandWindow)) -#define GDK_WAYLAND_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_WAYLAND_WINDOW, GdkWaylandWindowClass)) -#define GDK_IS_WAYLAND_WINDOW(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_WAYLAND_WINDOW)) -#define GDK_IS_WAYLAND_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_WAYLAND_WINDOW)) -#define GDK_WAYLAND_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_WAYLAND_WINDOW, GdkWaylandWindowClass)) +#define GDK_TYPE_WAYLAND_SURFACE (gdk_wayland_surface_get_type()) +#define GDK_WAYLAND_SURFACE(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_WAYLAND_SURFACE, GdkWaylandSurface)) +#define GDK_WAYLAND_SURFACE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_WAYLAND_SURFACE, GdkWaylandSurfaceClass)) +#define GDK_IS_WAYLAND_SURFACE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_WAYLAND_SURFACE)) +#define GDK_IS_WAYLAND_SURFACE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_WAYLAND_SURFACE)) +#define GDK_WAYLAND_SURFACE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_WAYLAND_SURFACE, GdkWaylandSurfaceClass)) GDK_AVAILABLE_IN_ALL -GType gdk_wayland_window_get_type (void); +GType gdk_wayland_surface_get_type (void); GDK_AVAILABLE_IN_ALL -GdkWindow * gdk_wayland_window_new_subsurface (GdkDisplay *display, +GdkSurface * gdk_wayland_surface_new_subsurface (GdkDisplay *display, const GdkRectangle *position); GDK_AVAILABLE_IN_ALL -struct wl_surface *gdk_wayland_window_get_wl_surface (GdkWindow *window); +struct wl_surface *gdk_wayland_surface_get_wl_surface (GdkSurface *surface); GDK_AVAILABLE_IN_ALL -void gdk_wayland_window_set_use_custom_surface (GdkWindow *window); +void gdk_wayland_surface_set_use_custom_surface (GdkSurface *surface); GDK_AVAILABLE_IN_ALL -void gdk_wayland_window_set_dbus_properties_libgtk_only (GdkWindow *window, +void gdk_wayland_surface_set_dbus_properties_libgtk_only (GdkSurface *surface, const char *application_id, const char *app_menu_path, const char *menubar_path, @@ -63,25 +63,25 @@ void gdk_wayland_window_set_dbus_properties_libgtk_only (Gdk const char *application_object_path, const char *unique_bus_name); -typedef void (*GdkWaylandWindowExported) (GdkWindow *window, +typedef void (*GdkWaylandSurfaceExported) (GdkSurface *surface, const char *handle, gpointer user_data); GDK_AVAILABLE_IN_ALL -gboolean gdk_wayland_window_export_handle (GdkWindow *window, - GdkWaylandWindowExported callback, +gboolean gdk_wayland_surface_export_handle (GdkSurface *surface, + GdkWaylandSurfaceExported callback, gpointer user_data, GDestroyNotify destroy_func); GDK_AVAILABLE_IN_ALL -void gdk_wayland_window_unexport_handle (GdkWindow *window); +void gdk_wayland_surface_unexport_handle (GdkSurface *surface); GDK_AVAILABLE_IN_ALL -gboolean gdk_wayland_window_set_transient_for_exported (GdkWindow *window, +gboolean gdk_wayland_surface_set_transient_for_exported (GdkSurface *surface, char *parent_handle_str); -void gdk_wayland_window_announce_csd (GdkWindow *window); +void gdk_wayland_surface_announce_csd (GdkSurface *surface); G_END_DECLS -#endif /* __GDK_WAYLAND_WINDOW_H__ */ +#endif /* __GDK_WAYLAND_SURFACE_H__ */ diff --git a/gdk/wayland/meson.build b/gdk/wayland/meson.build index fec3d2c74e..6390e57c19 100644 --- a/gdk/wayland/meson.build +++ b/gdk/wayland/meson.build @@ -12,7 +12,7 @@ gdk_wayland_sources = files([ 'gdkprimary-wayland.c', 'gdkselection-wayland.c', 'gdkvulkancontext-wayland.c', - 'gdkwindow-wayland.c', + 'gdksurface-wayland.c', 'wm-button-layout-translation.c', ]) @@ -21,7 +21,7 @@ gdk_wayland_public_headers = files([ 'gdkwaylanddisplay.h', 'gdkwaylandglcontext.h', 'gdkwaylandmonitor.h', - 'gdkwaylandwindow.h' + 'gdkwaylandsurface.h' ]) install_headers(gdk_wayland_public_headers, subdir: 'gtk-4.0/gdk/wayland/') |