diff options
Diffstat (limited to 'gdk/x11')
31 files changed, 2136 insertions, 2136 deletions
diff --git a/gdk/x11/gdkdevice-core-x11.c b/gdk/x11/gdkdevice-core-x11.c index 8cd0408661..3f875422a9 100644 --- a/gdk/x11/gdkdevice-core-x11.c +++ b/gdk/x11/gdkdevice-core-x11.c @@ -22,7 +22,7 @@ #include "gdkdeviceprivate.h" #include "gdkinternals.h" -#include "gdkwindow.h" +#include "gdksurface.h" #include "gdkprivate-x11.h" #include "gdkdisplay-x11.h" #include "gdkasync.h" @@ -40,45 +40,45 @@ struct _GdkX11DeviceCoreClass }; static gboolean gdk_x11_device_core_get_history (GdkDevice *device, - GdkWindow *window, + GdkSurface *surface, guint32 start, guint32 stop, GdkTimeCoord ***events, gint *n_events); static void gdk_x11_device_core_get_state (GdkDevice *device, - GdkWindow *window, + GdkSurface *surface, gdouble *axes, GdkModifierType *mask); -static void gdk_x11_device_core_set_window_cursor (GdkDevice *device, - GdkWindow *window, +static void gdk_x11_device_core_set_surface_cursor (GdkDevice *device, + GdkSurface *surface, GdkCursor *cursor); static void gdk_x11_device_core_warp (GdkDevice *device, gdouble x, gdouble y); static void gdk_x11_device_core_query_state (GdkDevice *device, - GdkWindow *window, - GdkWindow **child_window, + GdkSurface *surface, + GdkSurface **child_surface, gdouble *root_x, gdouble *root_y, gdouble *win_x, gdouble *win_y, GdkModifierType *mask); static GdkGrabStatus gdk_x11_device_core_grab (GdkDevice *device, - GdkWindow *window, + GdkSurface *surface, gboolean owner_events, GdkEventMask event_mask, - GdkWindow *confine_to, + GdkSurface *confine_to, GdkCursor *cursor, guint32 time_); static void gdk_x11_device_core_ungrab (GdkDevice *device, guint32 time_); -static GdkWindow * gdk_x11_device_core_window_at_position (GdkDevice *device, +static GdkSurface * gdk_x11_device_core_surface_at_position (GdkDevice *device, gdouble *win_x, gdouble *win_y, GdkModifierType *mask, gboolean get_toplevel); -static void gdk_x11_device_core_select_window_events (GdkDevice *device, - GdkWindow *window, +static void gdk_x11_device_core_select_surface_events (GdkDevice *device, + GdkSurface *surface, GdkEventMask event_mask); G_DEFINE_TYPE (GdkX11DeviceCore, gdk_x11_device_core, GDK_TYPE_DEVICE) @@ -90,13 +90,13 @@ gdk_x11_device_core_class_init (GdkX11DeviceCoreClass *klass) device_class->get_history = gdk_x11_device_core_get_history; device_class->get_state = gdk_x11_device_core_get_state; - device_class->set_window_cursor = gdk_x11_device_core_set_window_cursor; + device_class->set_surface_cursor = gdk_x11_device_core_set_surface_cursor; device_class->warp = gdk_x11_device_core_warp; device_class->query_state = gdk_x11_device_core_query_state; device_class->grab = gdk_x11_device_core_grab; device_class->ungrab = gdk_x11_device_core_ungrab; - device_class->window_at_position = gdk_x11_device_core_window_at_position; - device_class->select_window_events = gdk_x11_device_core_select_window_events; + device_class->surface_at_position = gdk_x11_device_core_surface_at_position; + device_class->select_surface_events = gdk_x11_device_core_select_surface_events; } static void @@ -111,16 +111,16 @@ gdk_x11_device_core_init (GdkX11DeviceCore *device_core) } static gboolean -impl_coord_in_window (GdkWindow *window, +impl_coord_in_surface (GdkSurface *surface, int impl_x, int impl_y) { - if (impl_x < window->abs_x || - impl_x >= window->abs_x + window->width) + if (impl_x < surface->abs_x || + impl_x >= surface->abs_x + surface->width) return FALSE; - if (impl_y < window->abs_y || - impl_y >= window->abs_y + window->height) + if (impl_y < surface->abs_y || + impl_y >= surface->abs_y + surface->height) return FALSE; return TRUE; @@ -128,7 +128,7 @@ impl_coord_in_window (GdkWindow *window, static gboolean gdk_x11_device_core_get_history (GdkDevice *device, - GdkWindow *window, + GdkSurface *surface, guint32 start, guint32 stop, GdkTimeCoord ***events, @@ -136,15 +136,15 @@ gdk_x11_device_core_get_history (GdkDevice *device, { XTimeCoord *xcoords; GdkTimeCoord **coords; - GdkWindow *impl_window; - GdkWindowImplX11 *impl; + GdkSurface *impl_surface; + GdkSurfaceImplX11 *impl; int tmp_n_events; int i, j; - impl_window = _gdk_window_get_impl_window (window); - impl = GDK_WINDOW_IMPL_X11 (impl_window->impl); - xcoords = XGetMotionEvents (GDK_WINDOW_XDISPLAY (window), - GDK_WINDOW_XID (impl_window), + impl_surface = _gdk_surface_get_impl_surface (surface); + impl = GDK_SURFACE_IMPL_X11 (impl_surface->impl); + xcoords = XGetMotionEvents (GDK_SURFACE_XDISPLAY (surface), + GDK_SURFACE_XID (impl_surface), start, stop, &tmp_n_events); if (!xcoords) return FALSE; @@ -153,13 +153,13 @@ gdk_x11_device_core_get_history (GdkDevice *device, for (i = 0, j = 0; i < tmp_n_events; i++) { - if (impl_coord_in_window (window, - xcoords[i].x / impl->window_scale, - xcoords[i].y / impl->window_scale)) + if (impl_coord_in_surface (surface, + xcoords[i].x / impl->surface_scale, + xcoords[i].y / impl->surface_scale)) { coords[j]->time = xcoords[i].time; - coords[j]->axes[0] = (double)xcoords[i].x / impl->window_scale - window->abs_x; - coords[j]->axes[1] = (double)xcoords[i].y / impl->window_scale - window->abs_y; + coords[j]->axes[0] = (double)xcoords[i].x / impl->surface_scale - surface->abs_x; + coords[j]->axes[1] = (double)xcoords[i].y / impl->surface_scale - surface->abs_y; j++; } } @@ -194,13 +194,13 @@ gdk_x11_device_core_get_history (GdkDevice *device, static void gdk_x11_device_core_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) { @@ -210,8 +210,8 @@ gdk_x11_device_core_get_state (GdkDevice *device, } static void -gdk_x11_device_core_set_window_cursor (GdkDevice *device, - GdkWindow *window, +gdk_x11_device_core_set_surface_cursor (GdkDevice *device, + GdkSurface *surface, GdkCursor *cursor) { GdkDisplay *display = gdk_device_get_display (device); @@ -223,7 +223,7 @@ gdk_x11_device_core_set_window_cursor (GdkDevice *device, xcursor = gdk_x11_display_get_xcursor (display, cursor); XDefineCursor (GDK_DISPLAY_XDISPLAY (display), - GDK_WINDOW_XID (window), + GDK_SURFACE_XID (surface), xcursor); } @@ -243,14 +243,14 @@ gdk_x11_device_core_warp (GdkDevice *device, dest = GDK_SCREEN_XROOTWIN (screen); XWarpPointer (xdisplay, None, dest, 0, 0, 0, 0, - round (x * screen->window_scale), - round (y * screen->window_scale)); + round (x * screen->surface_scale), + round (y * screen->surface_scale)); } static void gdk_x11_device_core_query_state (GdkDevice *device, - GdkWindow *window, - GdkWindow **child_window, + GdkSurface *surface, + GdkSurface **child_surface, gdouble *root_x, gdouble *root_y, gdouble *win_x, @@ -267,19 +267,19 @@ gdk_x11_device_core_query_state (GdkDevice *device, display = gdk_device_get_display (device); screen = GDK_X11_DISPLAY (display)->screen; - if (window == NULL) + if (surface == NULL) { xwindow = GDK_SCREEN_XROOTWIN (screen); - scale = screen->window_scale; + scale = screen->surface_scale; } else { - xwindow = GDK_WINDOW_XID (window); - scale = GDK_WINDOW_IMPL_X11 (window->impl)->window_scale; + xwindow = GDK_SURFACE_XID (surface); + scale = GDK_SURFACE_IMPL_X11 (surface->impl)->surface_scale; } if (!GDK_X11_DISPLAY (display)->trusted_client || - !XQueryPointer (GDK_WINDOW_XDISPLAY (window), + !XQueryPointer (GDK_SURFACE_XDISPLAY (surface), xwindow, &xroot_window, &xchild_window, @@ -306,8 +306,8 @@ gdk_x11_device_core_query_state (GdkDevice *device, XDestroyWindow (xdisplay, w); } - if (child_window) - *child_window = gdk_x11_window_lookup_for_display (display, xchild_window); + if (child_surface) + *child_surface = gdk_x11_surface_lookup_for_display (display, xchild_window); if (root_x) *root_x = (double)xroot_x / scale; @@ -327,10 +327,10 @@ gdk_x11_device_core_query_state (GdkDevice *device, static GdkGrabStatus gdk_x11_device_core_grab (GdkDevice *device, - GdkWindow *window, + GdkSurface *surface, gboolean owner_events, GdkEventMask event_mask, - GdkWindow *confine_to, + GdkSurface *confine_to, GdkCursor *cursor, guint32 time_) { @@ -340,15 +340,15 @@ gdk_x11_device_core_grab (GdkDevice *device, display = gdk_device_get_display (device); - xwindow = GDK_WINDOW_XID (window); + xwindow = GDK_SURFACE_XID (surface); if (confine_to) - confine_to = _gdk_window_get_impl_window (confine_to); + confine_to = _gdk_surface_get_impl_surface (confine_to); - if (!confine_to || GDK_WINDOW_DESTROYED (confine_to)) + if (!confine_to || GDK_SURFACE_DESTROYED (confine_to)) xconfine_to = None; else - xconfine_to = GDK_WINDOW_XID (confine_to); + xconfine_to = GDK_SURFACE_XID (confine_to); #ifdef G_ENABLE_DEBUG if (GDK_DISPLAY_DEBUG_CHECK (display, NOGRABS)) @@ -424,17 +424,17 @@ gdk_x11_device_core_ungrab (GdkDevice *device, _gdk_x11_display_update_grab_info_ungrab (display, device, time_, serial); } -static GdkWindow * -gdk_x11_device_core_window_at_position (GdkDevice *device, +static GdkSurface * +gdk_x11_device_core_surface_at_position (GdkDevice *device, gdouble *win_x, gdouble *win_y, GdkModifierType *mask, gboolean get_toplevel) { - GdkWindowImplX11 *impl; + GdkSurfaceImplX11 *impl; GdkDisplay *display; Display *xdisplay; - GdkWindow *window; + GdkSurface *surface; GdkX11Screen *screen; Window xwindow, root, child, last; int xroot_x, xroot_y, xwin_x, xwin_y; @@ -480,9 +480,9 @@ gdk_x11_device_core_window_at_position (GdkDevice *device, toplevels = gdk_x11_display_get_toplevel_windows (display); for (list = toplevels; list != NULL; list = list->next) { - window = GDK_WINDOW (list->data); - impl = GDK_WINDOW_IMPL_X11 (window->impl); - xwindow = GDK_WINDOW_XID (window); + surface = GDK_SURFACE (list->data); + impl = GDK_SURFACE_IMPL_X11 (surface->impl); + xwindow = GDK_SURFACE_XID (surface); gdk_x11_display_error_trap_push (display); XQueryPointer (xdisplay, xwindow, &root, &child, @@ -496,8 +496,8 @@ gdk_x11_device_core_window_at_position (GdkDevice *device, pointer_window = child; break; } - gdk_window_get_geometry (window, NULL, NULL, &width, &height); - if (winx >= 0 && winy >= 0 && winx < width * impl->window_scale && winy < height * impl->window_scale) + gdk_surface_get_geometry (surface, NULL, NULL, &width, &height); + if (winx >= 0 && winy >= 0 && winx < width * impl->surface_scale && winy < height * impl->surface_scale) { /* A childless toplevel, or below another window? */ XSetWindowAttributes attributes; @@ -537,8 +537,8 @@ gdk_x11_device_core_window_at_position (GdkDevice *device, break; if (get_toplevel && last != root && - (window = gdk_x11_window_lookup_for_display (display, last)) != NULL && - window->window_type != GDK_WINDOW_FOREIGN) + (surface = gdk_x11_surface_lookup_for_display (display, last)) != NULL && + surface->surface_type != GDK_SURFACE_FOREIGN) { xwindow = last; break; @@ -547,33 +547,33 @@ gdk_x11_device_core_window_at_position (GdkDevice *device, gdk_x11_display_ungrab (display); - window = gdk_x11_window_lookup_for_display (display, last); + surface = gdk_x11_surface_lookup_for_display (display, last); impl = NULL; - if (window) - impl = GDK_WINDOW_IMPL_X11 (window->impl); + if (surface) + impl = GDK_SURFACE_IMPL_X11 (surface->impl); if (win_x) - *win_x = (window) ? (double)xwin_x / impl->window_scale : -1; + *win_x = (surface) ? (double)xwin_x / impl->surface_scale : -1; if (win_y) - *win_y = (window) ? (double)xwin_y / impl->window_scale : -1; + *win_y = (surface) ? (double)xwin_y / impl->surface_scale : -1; if (mask) *mask = xmask; - return window; + return surface; } static void -gdk_x11_device_core_select_window_events (GdkDevice *device, - GdkWindow *window, +gdk_x11_device_core_select_surface_events (GdkDevice *device, + GdkSurface *surface, GdkEventMask event_mask) { - GdkEventMask filter_mask, window_mask; + GdkEventMask filter_mask, surface_mask; guint xmask = 0; gint i; - window_mask = gdk_window_get_events (window); + surface_mask = gdk_surface_get_events (surface); filter_mask = GDK_POINTER_MOTION_MASK | GDK_BUTTON_MOTION_MASK | GDK_BUTTON1_MOTION_MASK @@ -593,11 +593,11 @@ gdk_x11_device_core_select_window_events (GdkDevice *device, /* Filter out non-device events */ event_mask &= filter_mask; - /* Unset device events on window mask */ - window_mask &= ~filter_mask; + /* Unset device events on surface mask */ + surface_mask &= ~filter_mask; /* Combine masks */ - event_mask |= window_mask; + event_mask |= surface_mask; for (i = 0; i < _gdk_x11_event_mask_table_size; i++) { @@ -605,10 +605,10 @@ gdk_x11_device_core_select_window_events (GdkDevice *device, xmask |= _gdk_x11_event_mask_table[i]; } - if (GDK_WINDOW_XID (window) != GDK_WINDOW_XROOTWIN (window)) + if (GDK_SURFACE_XID (surface) != GDK_SURFACE_XROOTWIN (surface)) xmask |= StructureNotifyMask | PropertyChangeMask; - XSelectInput (GDK_WINDOW_XDISPLAY (window), - GDK_WINDOW_XID (window), + XSelectInput (GDK_SURFACE_XDISPLAY (surface), + GDK_SURFACE_XID (surface), xmask); } diff --git a/gdk/x11/gdkdevice-xi2.c b/gdk/x11/gdkdevice-xi2.c index 98d3ce38a5..81f1f19b29 100644 --- a/gdk/x11/gdkdevice-xi2.c +++ b/gdk/x11/gdkdevice-xi2.c @@ -71,18 +71,18 @@ static void gdk_x11_device_xi2_set_property (GObject *object, GParamSpec *pspec); static void gdk_x11_device_xi2_get_state (GdkDevice *device, - GdkWindow *window, + GdkSurface *surface, gdouble *axes, GdkModifierType *mask); -static void gdk_x11_device_xi2_set_window_cursor (GdkDevice *device, - GdkWindow *window, +static void gdk_x11_device_xi2_set_surface_cursor (GdkDevice *device, + GdkSurface *surface, GdkCursor *cursor); static void gdk_x11_device_xi2_warp (GdkDevice *device, gdouble x, gdouble y); static void gdk_x11_device_xi2_query_state (GdkDevice *device, - GdkWindow *window, - GdkWindow **child_window, + GdkSurface *surface, + GdkSurface **child_surface, gdouble *root_x, gdouble *root_y, gdouble *win_x, @@ -90,22 +90,22 @@ static void gdk_x11_device_xi2_query_state (GdkDevice *device, GdkModifierType *mask); static GdkGrabStatus gdk_x11_device_xi2_grab (GdkDevice *device, - GdkWindow *window, + GdkSurface *surface, gboolean owner_events, GdkEventMask event_mask, - GdkWindow *confine_to, + GdkSurface *confine_to, GdkCursor *cursor, guint32 time_); static void gdk_x11_device_xi2_ungrab (GdkDevice *device, guint32 time_); -static GdkWindow * gdk_x11_device_xi2_window_at_position (GdkDevice *device, +static GdkSurface * gdk_x11_device_xi2_surface_at_position (GdkDevice *device, gdouble *win_x, gdouble *win_y, GdkModifierType *mask, gboolean get_toplevel); -static void gdk_x11_device_xi2_select_window_events (GdkDevice *device, - GdkWindow *window, +static void gdk_x11_device_xi2_select_surface_events (GdkDevice *device, + GdkSurface *surface, GdkEventMask event_mask); @@ -125,13 +125,13 @@ gdk_x11_device_xi2_class_init (GdkX11DeviceXI2Class *klass) object_class->set_property = gdk_x11_device_xi2_set_property; device_class->get_state = gdk_x11_device_xi2_get_state; - device_class->set_window_cursor = gdk_x11_device_xi2_set_window_cursor; + device_class->set_surface_cursor = gdk_x11_device_xi2_set_surface_cursor; device_class->warp = gdk_x11_device_xi2_warp; device_class->query_state = gdk_x11_device_xi2_query_state; device_class->grab = gdk_x11_device_xi2_grab; device_class->ungrab = gdk_x11_device_xi2_ungrab; - device_class->window_at_position = gdk_x11_device_xi2_window_at_position; - device_class->select_window_events = gdk_x11_device_xi2_select_window_events; + device_class->surface_at_position = gdk_x11_device_xi2_surface_at_position; + device_class->select_surface_events = gdk_x11_device_xi2_select_surface_events; g_object_class_install_property (object_class, PROP_DEVICE_ID, @@ -200,7 +200,7 @@ gdk_x11_device_xi2_set_property (GObject *object, static void gdk_x11_device_xi2_get_state (GdkDevice *device, - GdkWindow *window, + GdkSurface *surface, gdouble *axes, GdkModifierType *mask) { @@ -238,15 +238,15 @@ gdk_x11_device_xi2_get_state (GdkDevice *device, case GDK_AXIS_X: case GDK_AXIS_Y: case GDK_AXIS_IGNORE: - if (gdk_device_get_mode (device) == GDK_MODE_WINDOW) - _gdk_device_translate_window_coord (device, window, j, value, &axes[j]); + if (gdk_device_get_mode (device) == GDK_MODE_SURFACE) + _gdk_device_translate_surface_coord (device, surface, j, value, &axes[j]); else { gint root_x, root_y; /* FIXME: Maybe root coords chaching should happen here */ - gdk_window_get_origin (window, &root_x, &root_y); - _gdk_device_translate_screen_coord (device, window, + gdk_surface_get_origin (surface, &root_x, &root_y); + _gdk_device_translate_screen_coord (device, surface, root_x, root_y, WidthOfScreen (xscreen), HeightOfScreen (xscreen), @@ -267,7 +267,7 @@ gdk_x11_device_xi2_get_state (GdkDevice *device, } if (mask) - gdk_x11_device_xi2_query_state (device, window, + gdk_x11_device_xi2_query_state (device, surface, NULL, NULL, NULL, NULL, NULL, @@ -275,8 +275,8 @@ gdk_x11_device_xi2_get_state (GdkDevice *device, } static void -gdk_x11_device_xi2_set_window_cursor (GdkDevice *device, - GdkWindow *window, +gdk_x11_device_xi2_set_surface_cursor (GdkDevice *device, + GdkSurface *surface, GdkCursor *cursor) { GdkX11DeviceXI2 *device_xi2 = GDK_X11_DEVICE_XI2 (device); @@ -286,14 +286,14 @@ gdk_x11_device_xi2_set_window_cursor (GdkDevice *device, return; if (cursor) - XIDefineCursor (GDK_WINDOW_XDISPLAY (window), + XIDefineCursor (GDK_SURFACE_XDISPLAY (surface), device_xi2->device_id, - GDK_WINDOW_XID (window), - gdk_x11_display_get_xcursor (GDK_WINDOW_DISPLAY (window), cursor)); + GDK_SURFACE_XID (surface), + gdk_x11_display_get_xcursor (GDK_SURFACE_DISPLAY (surface), cursor)); else - XIUndefineCursor (GDK_WINDOW_XDISPLAY (window), + XIUndefineCursor (GDK_SURFACE_XDISPLAY (surface), device_xi2->device_id, - GDK_WINDOW_XID (window)); + GDK_SURFACE_XID (surface)); } static void @@ -310,14 +310,14 @@ gdk_x11_device_xi2_warp (GdkDevice *device, device_xi2->device_id, None, dest, 0, 0, 0, 0, - round (x * screen->window_scale), - round (y * screen->window_scale)); + round (x * screen->surface_scale), + round (y * screen->surface_scale)); } static void gdk_x11_device_xi2_query_state (GdkDevice *device, - GdkWindow *window, - GdkWindow **child_window, + GdkSurface *surface, + GdkSurface **child_surface, gdouble *root_x, gdouble *root_y, gdouble *win_x, @@ -336,15 +336,15 @@ gdk_x11_device_xi2_query_state (GdkDevice *device, display = gdk_device_get_display (device); default_screen = GDK_X11_DISPLAY (display)->screen; - if (window == NULL) + if (surface == NULL) { xwindow = GDK_DISPLAY_XROOTWIN (display); - scale = default_screen->window_scale; + scale = default_screen->surface_scale; } else { - xwindow = GDK_WINDOW_XID (window); - scale = GDK_WINDOW_IMPL_X11 (window->impl)->window_scale; + xwindow = GDK_SURFACE_XID (surface); + scale = GDK_SURFACE_IMPL_X11 (surface->impl)->surface_scale; } if (gdk_device_get_device_type (device) == GDK_DEVICE_TYPE_SLAVE) @@ -352,7 +352,7 @@ gdk_x11_device_xi2_query_state (GdkDevice *device, GdkDevice *master = gdk_device_get_associated_device (device); if (master) - _gdk_device_query_state (master, window, child_window, + _gdk_device_query_state (master, surface, child_surface, root_x, root_y, win_x, win_y, mask); return; } @@ -392,8 +392,8 @@ gdk_x11_device_xi2_query_state (GdkDevice *device, XDestroyWindow (xdisplay, w); } - if (child_window) - *child_window = gdk_x11_window_lookup_for_display (display, xchild_window); + if (child_surface) + *child_surface = gdk_x11_surface_lookup_for_display (display, xchild_window); if (root_x) *root_x = xroot_x / scale; @@ -415,10 +415,10 @@ gdk_x11_device_xi2_query_state (GdkDevice *device, static GdkGrabStatus gdk_x11_device_xi2_grab (GdkDevice *device, - GdkWindow *window, + GdkSurface *surface, gboolean owner_events, GdkEventMask event_mask, - GdkWindow *confine_to, + GdkSurface *confine_to, GdkCursor *cursor, guint32 time_) { @@ -435,7 +435,7 @@ gdk_x11_device_xi2_grab (GdkDevice *device, /* FIXME: confine_to is actually unused */ - xwindow = GDK_WINDOW_XID (window); + xwindow = GDK_SURFACE_XID (surface); if (!cursor) xcursor = None; @@ -486,19 +486,19 @@ gdk_x11_device_xi2_ungrab (GdkDevice *device, _gdk_x11_display_update_grab_info_ungrab (display, device, time_, serial); } -static GdkWindow * -gdk_x11_device_xi2_window_at_position (GdkDevice *device, +static GdkSurface * +gdk_x11_device_xi2_surface_at_position (GdkDevice *device, gdouble *win_x, gdouble *win_y, GdkModifierType *mask, gboolean get_toplevel) { - GdkWindowImplX11 *impl; + GdkSurfaceImplX11 *impl; GdkX11DeviceXI2 *device_xi2 = GDK_X11_DEVICE_XI2 (device); GdkDisplay *display; GdkX11Screen *screen; Display *xdisplay; - GdkWindow *window; + GdkSurface *surface; Window xwindow, root, child, last = None; gdouble xroot_x, xroot_y, xwin_x, xwin_y; XIButtonState button_state = { 0 }; @@ -550,8 +550,8 @@ gdk_x11_device_xi2_window_at_position (GdkDevice *device, toplevels = gdk_x11_display_get_toplevel_windows (display); for (list = toplevels; list != NULL; list = list->next) { - window = GDK_WINDOW (list->data); - xwindow = GDK_WINDOW_XID (window); + surface = GDK_SURFACE (list->data); + xwindow = GDK_SURFACE_XID (surface); /* Free previous button mask, if any */ g_free (button_state.mask); @@ -573,7 +573,7 @@ gdk_x11_device_xi2_window_at_position (GdkDevice *device, pointer_window = child; break; } - gdk_window_get_geometry (window, NULL, NULL, &width, &height); + gdk_surface_get_geometry (surface, NULL, NULL, &width, &height); if (xwin_x >= 0 && xwin_y >= 0 && xwin_x < width && xwin_y < height) { /* A childless toplevel, or below another window? */ @@ -628,8 +628,8 @@ gdk_x11_device_xi2_window_at_position (GdkDevice *device, break; if (get_toplevel && last != root && - (window = gdk_x11_window_lookup_for_display (display, last)) != NULL && - GDK_WINDOW_TYPE (window) != GDK_WINDOW_FOREIGN) + (surface = gdk_x11_surface_lookup_for_display (display, last)) != NULL && + GDK_SURFACE_TYPE (surface) != GDK_SURFACE_FOREIGN) { xwindow = last; break; @@ -640,10 +640,10 @@ gdk_x11_device_xi2_window_at_position (GdkDevice *device, if (gdk_x11_display_error_trap_pop (display) == 0) { - window = gdk_x11_window_lookup_for_display (display, last); + surface = gdk_x11_surface_lookup_for_display (display, last); impl = NULL; - if (window) - impl = GDK_WINDOW_IMPL_X11 (window->impl); + if (surface) + impl = GDK_SURFACE_IMPL_X11 (surface->impl); if (mask) *mask = _gdk_x11_device_xi2_translate_state (&mod_state, &button_state, &group_state); @@ -652,25 +652,25 @@ gdk_x11_device_xi2_window_at_position (GdkDevice *device, } else { - window = NULL; + surface = NULL; if (mask) *mask = 0; } if (win_x) - *win_x = (window) ? (xwin_x / impl->window_scale) : -1; + *win_x = (surface) ? (xwin_x / impl->surface_scale) : -1; if (win_y) - *win_y = (window) ? (xwin_y / impl->window_scale) : -1; + *win_y = (surface) ? (xwin_y / impl->surface_scale) : -1; - return window; + return surface; } static void -gdk_x11_device_xi2_select_window_events (GdkDevice *device, - GdkWindow *window, +gdk_x11_device_xi2_select_surface_events (GdkDevice *device, + GdkSurface *surface, GdkEventMask event_mask) { GdkX11DeviceXI2 *device_xi2 = GDK_X11_DEVICE_XI2 (device); @@ -686,8 +686,8 @@ gdk_x11_device_xi2_select_window_events (GdkDevice *device, event_mask, &evmask.mask_len); - XISelectEvents (GDK_WINDOW_XDISPLAY (window), - GDK_WINDOW_XID (window), + XISelectEvents (GDK_SURFACE_XDISPLAY (surface), + GDK_SURFACE_XID (surface), &evmask, 1); g_free (evmask.mask); diff --git a/gdk/x11/gdkdevicemanager-core-x11.c b/gdk/x11/gdkdevicemanager-core-x11.c index 5606d8949d..6ae5fc8a8e 100644 --- a/gdk/x11/gdkdevicemanager-core-x11.c +++ b/gdk/x11/gdkdevicemanager-core-x11.c @@ -261,19 +261,19 @@ static const char notify_details[][23] = { #endif static void -set_user_time (GdkWindow *window, +set_user_time (GdkSurface *surface, GdkEvent *event) { g_return_if_fail (event != NULL); - window = gdk_window_get_toplevel (event->any.window); - g_return_if_fail (GDK_IS_WINDOW (window)); + surface = gdk_surface_get_toplevel (event->any.surface); + g_return_if_fail (GDK_IS_SURFACE (surface)); /* If an event doesn't have a valid timestamp, we shouldn't use it * to update the latest user interaction time. */ if (gdk_event_get_time (event) != GDK_CURRENT_TIME) - gdk_x11_window_set_user_time (gdk_window_get_toplevel (window), + gdk_x11_surface_set_user_time (gdk_surface_get_toplevel (surface), gdk_event_get_time (event)); } @@ -316,10 +316,10 @@ translate_notify_type (int detail) } static gboolean -is_parent_of (GdkWindow *parent, - GdkWindow *child) +is_parent_of (GdkSurface *parent, + GdkSurface *child) { - GdkWindow *w; + GdkSurface *w; w = child; while (w != NULL) @@ -327,21 +327,21 @@ is_parent_of (GdkWindow *parent, if (w == parent) return TRUE; - w = gdk_window_get_parent (w); + w = gdk_surface_get_parent (w); } return FALSE; } -static GdkWindow * -get_event_window (GdkEventTranslator *translator, +static GdkSurface * +get_event_surface (GdkEventTranslator *translator, const XEvent *xevent) { GdkDisplay *display; - GdkWindow *window; + GdkSurface *surface; display = GDK_X11_DEVICE_MANAGER_CORE (translator)->display; - window = gdk_x11_window_lookup_for_display (display, xevent->xany.window); + surface = gdk_x11_surface_lookup_for_display (display, xevent->xany.window); /* Apply keyboard grabs to non-native windows */ if (xevent->type == KeyPress || xevent->type == KeyRelease) @@ -354,15 +354,15 @@ get_event_window (GdkEventTranslator *translator, GDK_X11_DEVICE_MANAGER_CORE (translator)->core_keyboard, serial); if (info && - (!is_parent_of (info->window, window) || + (!is_parent_of (info->surface, surface) || !info->owner_events)) { - /* Report key event against grab window */ - window = info->window; + /* Report key event against grab surface */ + surface = info->surface; } } - return window; + return surface; } static gboolean @@ -371,32 +371,32 @@ gdk_x11_device_manager_core_translate_event (GdkEventTranslator *translator, GdkEvent *event, const XEvent *xevent) { - GdkWindowImplX11 *impl; + GdkSurfaceImplX11 *impl; GdkX11DeviceManagerCore *device_manager; - GdkWindow *window; + GdkSurface *surface; gboolean return_val; int scale; GdkX11Display *display_x11 = GDK_X11_DISPLAY (display); device_manager = GDK_X11_DEVICE_MANAGER_CORE (translator); - window = get_event_window (translator, xevent); + surface = get_event_surface (translator, xevent); scale = 1; - if (window) + if (surface) { - if (GDK_WINDOW_DESTROYED (window) || !GDK_IS_WINDOW (window)) + if (GDK_SURFACE_DESTROYED (surface) || !GDK_IS_SURFACE (surface)) return FALSE; - g_object_ref (window); - impl = GDK_WINDOW_IMPL_X11 (window->impl); - scale = impl->window_scale; + g_object_ref (surface); + impl = GDK_SURFACE_IMPL_X11 (surface->impl); + scale = impl->surface_scale; } - event->any.window = window; + event->any.surface = surface; event->any.send_event = xevent->xany.send_event ? TRUE : FALSE; - if (window && GDK_WINDOW_DESTROYED (window)) + if (surface && GDK_SURFACE_DESTROYED (surface)) { if (xevent->type != DestroyNotify) { @@ -405,7 +405,7 @@ gdk_x11_device_manager_core_translate_event (GdkEventTranslator *translator, } } - if (window && + if (surface && (xevent->type == MotionNotify || xevent->type == ButtonRelease)) { @@ -428,17 +428,17 @@ gdk_x11_device_manager_core_translate_event (GdkEventTranslator *translator, switch (xevent->type) { case KeyPress: - if (window == NULL) + if (surface == NULL) { return_val = FALSE; break; } translate_key_event (display, device_manager, event, xevent); - set_user_time (window, event); + set_user_time (surface, event); break; case KeyRelease: - if (window == NULL) + if (surface == NULL) { return_val = FALSE; break; @@ -474,7 +474,7 @@ gdk_x11_device_manager_core_translate_event (GdkEventTranslator *translator, xevent->xbutton.x, xevent->xbutton.y, xevent->xbutton.button)); - if (window == NULL) + if (surface == NULL) { return_val = FALSE; break; @@ -499,7 +499,7 @@ gdk_x11_device_manager_core_translate_event (GdkEventTranslator *translator, else event->scroll.direction = GDK_SCROLL_RIGHT; - event->any.window = window; + event->any.surface = surface; event->scroll.time = xevent->xbutton.time; event->scroll.x = (gdouble) xevent->xbutton.x / scale; event->scroll.y = (gdouble) xevent->xbutton.y / scale; @@ -517,7 +517,7 @@ gdk_x11_device_manager_core_translate_event (GdkEventTranslator *translator, default: event->any.type = GDK_BUTTON_PRESS; - event->any.window = window; + event->any.surface = surface; event->button.time = xevent->xbutton.time; event->button.x = (gdouble) xevent->xbutton.x / scale; event->button.y = (gdouble) xevent->xbutton.y / scale; @@ -533,7 +533,7 @@ gdk_x11_device_manager_core_translate_event (GdkEventTranslator *translator, break; } - set_user_time (window, event); + set_user_time (surface, event); break; @@ -544,7 +544,7 @@ gdk_x11_device_manager_core_translate_event (GdkEventTranslator *translator, xevent->xbutton.x, xevent->xbutton.y, xevent->xbutton.button)); - if (window == NULL) + if (surface == NULL) { return_val = FALSE; break; @@ -559,7 +559,7 @@ gdk_x11_device_manager_core_translate_event (GdkEventTranslator *translator, } event->any.type = GDK_BUTTON_RELEASE; - event->any.window = window; + event->any.surface = surface; event->button.time = xevent->xbutton.time; event->button.x = (gdouble) xevent->xbutton.x / scale; event->button.y = (gdouble) xevent->xbutton.y / scale; @@ -581,14 +581,14 @@ gdk_x11_device_manager_core_translate_event (GdkEventTranslator *translator, xevent->xmotion.x, xevent->xmotion.y, (xevent->xmotion.is_hint) ? "true" : "false")); - if (window == NULL) + if (surface == NULL) { return_val = FALSE; break; } event->any.type = GDK_MOTION_NOTIFY; - event->any.window = window; + event->any.surface = surface; event->motion.time = xevent->xmotion.time; event->motion.x = (gdouble) xevent->xmotion.x / scale; event->motion.y = (gdouble) xevent->xmotion.y / scale; @@ -609,7 +609,7 @@ gdk_x11_device_manager_core_translate_event (GdkEventTranslator *translator, xevent->xcrossing.detail, xevent->xcrossing.subwindow)); - if (window == NULL) + if (surface == NULL) { return_val = FALSE; break; @@ -618,16 +618,16 @@ gdk_x11_device_manager_core_translate_event (GdkEventTranslator *translator, gdk_event_set_display (event, display); event->any.type = GDK_ENTER_NOTIFY; - event->any.window = window; + event->any.surface = surface; gdk_event_set_device (event, device_manager->core_pointer); /* If the subwindow field of the XEvent is non-NULL, then - * lookup the corresponding GdkWindow. + * lookup the corresponding GdkSurface. */ if (xevent->xcrossing.subwindow != None) - event->crossing.subwindow = gdk_x11_window_lookup_for_display (display, xevent->xcrossing.subwindow); + event->crossing.child_surface = gdk_x11_surface_lookup_for_display (display, xevent->xcrossing.subwindow); else - event->crossing.subwindow = NULL; + event->crossing.child_surface = NULL; event->crossing.time = xevent->xcrossing.time; event->crossing.x = (gdouble) xevent->xcrossing.x / scale; @@ -649,7 +649,7 @@ gdk_x11_device_manager_core_translate_event (GdkEventTranslator *translator, xevent->xcrossing.window, xevent->xcrossing.detail, xevent->xcrossing.subwindow)); - if (window == NULL) + if (surface == NULL) { return_val = FALSE; break; @@ -658,16 +658,16 @@ gdk_x11_device_manager_core_translate_event (GdkEventTranslator *translator, gdk_event_set_display (event, display); event->any.type = GDK_LEAVE_NOTIFY; - event->any.window = window; + event->any.surface = surface; gdk_event_set_device (event, device_manager->core_pointer); /* If the subwindow field of the XEvent is non-NULL, then - * lookup the corresponding GdkWindow. + * lookup the corresponding GdkSurface. */ if (xevent->xcrossing.subwindow != None) - event->crossing.subwindow = gdk_x11_window_lookup_for_display (display, xevent->xcrossing.subwindow); + event->crossing.child_surface = gdk_x11_surface_lookup_for_display (display, xevent->xcrossing.subwindow); else - event->crossing.subwindow = NULL; + event->crossing.child_surface = NULL; event->crossing.time = xevent->xcrossing.time; event->crossing.x = (gdouble) xevent->xcrossing.x / scale; @@ -685,8 +685,8 @@ gdk_x11_device_manager_core_translate_event (GdkEventTranslator *translator, case FocusIn: case FocusOut: - if (window) - _gdk_device_manager_core_handle_focus (window, + if (surface) + _gdk_device_manager_core_handle_focus (surface, xevent->xfocus.window, device_manager->core_keyboard, NULL, @@ -703,23 +703,23 @@ gdk_x11_device_manager_core_translate_event (GdkEventTranslator *translator, done: if (return_val) { - if (event->any.window) - g_object_ref (event->any.window); + if (event->any.surface) + g_object_ref (event->any.surface); if (((event->any.type == GDK_ENTER_NOTIFY) || (event->any.type == GDK_LEAVE_NOTIFY)) && - (event->crossing.subwindow != NULL)) - g_object_ref (event->crossing.subwindow); + (event->crossing.child_surface != NULL)) + g_object_ref (event->crossing.child_surface); } else { /* Mark this event as having no resources to be freed */ - event->any.window = NULL; + event->any.surface = NULL; event->any.type = GDK_NOTHING; } - if (window) - g_object_unref (window); + if (surface) + g_object_unref (surface); return return_val; } @@ -789,10 +789,10 @@ _gdk_x11_event_translate_keyboard_string (GdkEventKey *event) } /* We only care about focus events that indicate that _this_ - * window (not a ancestor or child) got or lost the focus + * surface (not a ancestor or child) got or lost the focus */ void -_gdk_device_manager_core_handle_focus (GdkWindow *window, +_gdk_device_manager_core_handle_focus (GdkSurface *surface, Window original, GdkDevice *device, GdkDevice *source_device, @@ -804,17 +804,17 @@ _gdk_device_manager_core_handle_focus (GdkWindow *window, GdkX11Screen *x11_screen; gboolean had_focus; - g_return_if_fail (GDK_IS_WINDOW (window)); + g_return_if_fail (GDK_IS_SURFACE (surface)); g_return_if_fail (GDK_IS_DEVICE (device)); g_return_if_fail (source_device == NULL || GDK_IS_DEVICE (source_device)); - GDK_DISPLAY_NOTE (gdk_window_get_display (window), EVENTS, + GDK_DISPLAY_NOTE (gdk_surface_get_display (surface), EVENTS, g_message ("focus out:\t\twindow: %ld, detail: %s, mode: %s", - GDK_WINDOW_XID (window), + GDK_SURFACE_XID (surface), notify_details[detail], notify_modes[mode])); - toplevel = _gdk_x11_window_get_toplevel (window); + toplevel = _gdk_x11_surface_get_toplevel (surface); if (!toplevel) return; @@ -823,7 +823,7 @@ _gdk_device_manager_core_handle_focus (GdkWindow *window, return; had_focus = HAS_FOCUS (toplevel); - x11_screen = GDK_X11_SCREEN (GDK_WINDOW_SCREEN (window)); + x11_screen = GDK_X11_SCREEN (GDK_SURFACE_SCREEN (surface)); switch (detail) { @@ -889,14 +889,14 @@ _gdk_device_manager_core_handle_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->any.send_event = FALSE; event->focus_change.in = focus_in; gdk_event_set_device (event, device); if (source_device) gdk_event_set_source_device (event, source_device); - gdk_display_put_event (gdk_window_get_display (window), event); + gdk_display_put_event (gdk_surface_get_display (surface), event); g_object_unref (event); } } diff --git a/gdk/x11/gdkdevicemanager-xi2.c b/gdk/x11/gdkdevicemanager-xi2.c index 2c12bdd203..4c873790ff 100644 --- a/gdk/x11/gdkdevicemanager-xi2.c +++ b/gdk/x11/gdkdevicemanager-xi2.c @@ -82,10 +82,10 @@ static gboolean gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator * GdkEvent *event, const XEvent *xevent); static GdkEventMask gdk_x11_device_manager_xi2_get_handled_events (GdkEventTranslator *translator); -static void gdk_x11_device_manager_xi2_select_window_events (GdkEventTranslator *translator, +static void gdk_x11_device_manager_xi2_select_surface_events (GdkEventTranslator *translator, Window window, GdkEventMask event_mask); -static GdkWindow * gdk_x11_device_manager_xi2_get_window (GdkEventTranslator *translator, +static GdkSurface * gdk_x11_device_manager_xi2_get_surface (GdkEventTranslator *translator, const XEvent *xevent); enum { @@ -835,8 +835,8 @@ gdk_x11_device_manager_xi2_event_translator_init (GdkEventTranslatorIface *iface { iface->translate_event = gdk_x11_device_manager_xi2_translate_event; iface->get_handled_events = gdk_x11_device_manager_xi2_get_handled_events; - iface->select_window_events = gdk_x11_device_manager_xi2_select_window_events; - iface->get_window = gdk_x11_device_manager_xi2_get_window; + iface->select_surface_events = gdk_x11_device_manager_xi2_select_surface_events; + iface->get_surface = gdk_x11_device_manager_xi2_get_surface; } static void @@ -1061,11 +1061,11 @@ translate_notify_type (gint detail) static void set_user_time (GdkEvent *event) { - GdkWindow *window; + GdkSurface *surface; guint32 time; - window = gdk_window_get_toplevel (event->any.window); - g_return_if_fail (GDK_IS_WINDOW (window)); + surface = gdk_surface_get_toplevel (event->any.surface); + g_return_if_fail (GDK_IS_SURFACE (surface)); time = gdk_event_get_time (event); @@ -1073,14 +1073,14 @@ set_user_time (GdkEvent *event) * to update the latest user interaction time. */ if (time != GDK_CURRENT_TIME) - gdk_x11_window_set_user_time (window, time); + gdk_x11_surface_set_user_time (surface, time); } static gdouble * translate_axes (GdkDevice *device, gdouble x, gdouble y, - GdkWindow *window, + GdkSurface *surface, XIValuatorState *valuators) { guint n_axes, i; @@ -1110,8 +1110,8 @@ translate_axes (GdkDevice *device, { case GDK_AXIS_X: case GDK_AXIS_Y: - if (gdk_device_get_mode (device) == GDK_MODE_WINDOW) - _gdk_device_translate_window_coord (device, window, i, val, &axes[i]); + if (gdk_device_get_mode (device) == GDK_MODE_SURFACE) + _gdk_device_translate_surface_coord (device, surface, i, val, &axes[i]); else { if (use == GDK_AXIS_X) @@ -1132,10 +1132,10 @@ translate_axes (GdkDevice *device, } static gboolean -is_parent_of (GdkWindow *parent, - GdkWindow *child) +is_parent_of (GdkSurface *parent, + GdkSurface *child) { - GdkWindow *w; + GdkSurface *w; w = child; while (w != NULL) @@ -1143,19 +1143,19 @@ is_parent_of (GdkWindow *parent, if (w == parent) return TRUE; - w = gdk_window_get_parent (w); + w = gdk_surface_get_parent (w); } return FALSE; } static gboolean -get_event_window (GdkEventTranslator *translator, +get_event_surface (GdkEventTranslator *translator, XIEvent *ev, - GdkWindow **window_p) + GdkSurface **surface_p) { GdkDisplay *display; - GdkWindow *window = NULL; + GdkSurface *surface = NULL; gboolean should_have_window = TRUE; display = GDK_X11_DEVICE_MANAGER_CORE (translator)->display; @@ -1175,7 +1175,7 @@ get_event_window (GdkEventTranslator *translator, { XIDeviceEvent *xev = (XIDeviceEvent *) ev; - window = gdk_x11_window_lookup_for_display (display, xev->event); + surface = gdk_x11_surface_lookup_for_display (display, xev->event); /* Apply keyboard grabs to non-native windows */ if (ev->evtype == XI_KeyPress || ev->evtype == XI_KeyRelease) @@ -1191,11 +1191,11 @@ get_event_window (GdkEventTranslator *translator, info = _gdk_display_has_device_grab (display, device, serial); if (info && - (!is_parent_of (info->window, window) || + (!is_parent_of (info->surface, surface) || !info->owner_events)) { - /* Report key event against grab window */ - window = info->window; + /* Report key event against grab surface */ + surface = info->surface; } } } @@ -1207,7 +1207,7 @@ get_event_window (GdkEventTranslator *translator, { XIEnterEvent *xev = (XIEnterEvent *) ev; - window = gdk_x11_window_lookup_for_display (display, xev->event); + surface = gdk_x11_surface_lookup_for_display (display, xev->event); } break; default: @@ -1215,9 +1215,9 @@ get_event_window (GdkEventTranslator *translator, break; } - *window_p = window; + *surface_p = surface; - if (should_have_window && !window) + if (should_have_window && !surface) return FALSE; return TRUE; @@ -1257,7 +1257,7 @@ gdk_x11_device_manager_xi2_translate_core_event (GdkEventTranslator *translator, * (At the moment, it's not possible to send XI2 events anyway. * In the future, an app that was trying to decide whether to * send core or XI2 events could look at the event mask on the - * window to see which kind we are listening to.) + * surface to see which kind we are listening to.) */ switch (xevent->type) { @@ -1349,8 +1349,8 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator, const XGenericEventCookie *cookie; GdkDevice *device, *source_device; gboolean return_val = TRUE; - GdkWindow *window; - GdkWindowImplX11 *impl; + GdkSurface *surface; + GdkSurfaceImplX11 *impl; int scale; XIEvent *ev; @@ -1367,17 +1367,17 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator, if (!ev) return FALSE; - if (!get_event_window (translator, ev, &window)) + if (!get_event_surface (translator, ev, &surface)) return FALSE; - if (window && GDK_WINDOW_DESTROYED (window)) + if (surface && GDK_SURFACE_DESTROYED (surface)) return FALSE; scale = 1; - if (window) + if (surface) { - impl = GDK_WINDOW_IMPL_X11 (window->impl); - scale = impl->window_scale; + impl = GDK_SURFACE_IMPL_X11 (surface->impl); + scale = impl->surface_scale; } if (ev->evtype == XI_Motion || @@ -1424,7 +1424,7 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator, event->any.type = xev->evtype == XI_KeyPress ? GDK_KEY_PRESS : GDK_KEY_RELEASE; - event->any.window = window; + event->any.surface = surface; event->key.time = xev->time; event->key.state = _gdk_x11_device_xi2_translate_state (&xev->mods, &xev->buttons, &xev->group); @@ -1507,7 +1507,7 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator, else event->scroll.direction = GDK_SCROLL_RIGHT; - event->any.window = window; + event->any.surface = surface; event->scroll.time = xev->time; event->scroll.x = (gdouble) xev->event_x / scale; event->scroll.y = (gdouble) xev->event_y / scale; @@ -1530,7 +1530,7 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator, { event->any.type = (ev->evtype == XI_ButtonPress) ? GDK_BUTTON_PRESS : GDK_BUTTON_RELEASE; - event->any.window = window; + event->any.surface = surface; event->button.time = xev->time; event->button.x = (gdouble) xev->event_x / scale; event->button.y = (gdouble) xev->event_y / scale; @@ -1549,10 +1549,10 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator, event->button.axes = translate_axes (device, event->button.x, event->button.y, - event->any.window, + event->any.surface, &xev->valuators); - if (gdk_device_get_mode (device) == GDK_MODE_WINDOW) + if (gdk_device_get_mode (device) == GDK_MODE_SURFACE) { /* Update event coordinates from axes */ gdk_device_get_axis (device, event->button.axes, GDK_AXIS_X, &event->button.x); @@ -1614,7 +1614,7 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator, xev->event, delta_x, delta_y)); - event->any.window = window; + event->any.surface = surface; event->scroll.time = xev->time; event->scroll.x = (gdouble) xev->event_x / scale; event->scroll.y = (gdouble) xev->event_y / scale; @@ -1631,7 +1631,7 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator, } event->any.type = GDK_MOTION_NOTIFY; - event->any.window = window; + event->any.surface = surface; event->motion.time = xev->time; event->motion.x = (gdouble) xev->event_x / scale; event->motion.y = (gdouble) xev->event_y / scale; @@ -1647,10 +1647,10 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator, event->motion.axes = translate_axes (device, event->motion.x, event->motion.y, - event->any.window, + event->any.surface, &xev->valuators); - if (gdk_device_get_mode (device) == GDK_MODE_WINDOW) + if (gdk_device_get_mode (device) == GDK_MODE_SURFACE) { /* Update event coordinates from axes */ gdk_device_get_axis (device, event->motion.axes, GDK_AXIS_X, &event->motion.x); @@ -1677,7 +1677,7 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator, else if (ev->evtype == XI_TouchEnd) event->any.type = GDK_TOUCH_END; - event->any.window = window; + event->any.surface = surface; event->touch.time = xev->time; event->touch.x = (gdouble) xev->event_x / scale; event->touch.y = (gdouble) xev->event_y / scale; @@ -1695,10 +1695,10 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator, event->touch.axes = translate_axes (device, event->touch.x, event->touch.y, - event->any.window, + event->any.surface, &xev->valuators); - if (gdk_device_get_mode (device) == GDK_MODE_WINDOW) + if (gdk_device_get_mode (device) == GDK_MODE_SURFACE) { /* Update event coordinates from axes */ gdk_device_get_axis (device, event->touch.axes, GDK_AXIS_X, &event->touch.x); @@ -1738,7 +1738,7 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator, xev->detail, xev->flags & XITouchEmulatingPointer ? "true" : "false")); - event->any.window = window; + event->any.surface = surface; event->touch.sequence = GUINT_TO_POINTER (xev->detail); event->any.type = GDK_TOUCH_UPDATE; event->touch.time = xev->time; @@ -1768,10 +1768,10 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator, event->touch.axes = translate_axes (device, event->touch.x, event->touch.y, - event->any.window, + event->any.surface, &xev->valuators); - if (gdk_device_get_mode (device) == GDK_MODE_WINDOW) + if (gdk_device_get_mode (device) == GDK_MODE_SURFACE) { /* Update event coordinates from axes */ gdk_device_get_axis (device, event->touch.axes, GDK_AXIS_X, &event->touch.x); @@ -1804,8 +1804,8 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator, event->crossing.time = xev->time; event->crossing.focus = xev->focus; - event->any.window = window; - event->crossing.subwindow = gdk_x11_window_lookup_for_display (display, xev->child); + event->any.surface = surface; + event->crossing.child_surface = gdk_x11_surface_lookup_for_display (display, xev->child); device = g_hash_table_lookup (device_manager->id_table, GINT_TO_POINTER (xev->deviceid)); @@ -1817,7 +1817,7 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator, if (ev->evtype == XI_Enter && xev->detail != XINotifyInferior && xev->mode != XINotifyPassiveUngrab && - gdk_window_get_window_type (window) == GDK_WINDOW_TOPLEVEL) + gdk_surface_get_surface_type (surface) == GDK_SURFACE_TOPLEVEL) { if (gdk_device_get_device_type (source_device) != GDK_DEVICE_TYPE_MASTER) _gdk_device_xi2_reset_scroll_valuators (GDK_X11_DEVICE_XI2 (source_device)); @@ -1842,7 +1842,7 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator, case XI_FocusIn: case XI_FocusOut: { - if (window) + if (surface) { XIEnterEvent *xev = (XIEnterEvent *) ev; @@ -1852,7 +1852,7 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator, source_device = g_hash_table_lookup (device_manager->id_table, GUINT_TO_POINTER (xev->sourceid)); - _gdk_device_manager_core_handle_focus (window, + _gdk_device_manager_core_handle_focus (surface, xev->event, device, source_device, @@ -1873,18 +1873,18 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator, if (return_val) { - if (event->any.window) - g_object_ref (event->any.window); + if (event->any.surface) + g_object_ref (event->any.surface); if (((event->any.type == GDK_ENTER_NOTIFY) || (event->any.type == GDK_LEAVE_NOTIFY)) && - (event->crossing.subwindow != NULL)) - g_object_ref (event->crossing.subwindow); + (event->crossing.child_surface != NULL)) + g_object_ref (event->crossing.child_surface); } else { /* Mark this event as having no resources to be freed */ - event->any.window = NULL; + event->any.surface = NULL; event->any.type = GDK_NOTHING; } @@ -1911,7 +1911,7 @@ gdk_x11_device_manager_xi2_get_handled_events (GdkEventTranslator *translator) } static void -gdk_x11_device_manager_xi2_select_window_events (GdkEventTranslator *translator, +gdk_x11_device_manager_xi2_select_surface_events (GdkEventTranslator *translator, Window window, GdkEventMask evmask) { @@ -1926,13 +1926,13 @@ gdk_x11_device_manager_xi2_select_window_events (GdkEventTranslator *translator, g_free (event_mask.mask); } -static GdkWindow * -gdk_x11_device_manager_xi2_get_window (GdkEventTranslator *translator, - const XEvent *xevent) +static GdkSurface * +gdk_x11_device_manager_xi2_get_surface (GdkEventTranslator *translator, + const XEvent *xevent) { GdkX11DeviceManagerXI2 *device_manager; XIEvent *ev; - GdkWindow *window = NULL; + GdkSurface *surface = NULL; device_manager = (GdkX11DeviceManagerXI2 *) translator; @@ -1944,8 +1944,8 @@ gdk_x11_device_manager_xi2_get_window (GdkEventTranslator *translator, if (!ev) return NULL; - get_event_window (translator, ev, &window); - return window; + get_event_surface (translator, ev, &surface); + return surface; } GdkDevice * diff --git a/gdk/x11/gdkdevicemanagerprivate-core.h b/gdk/x11/gdkdevicemanagerprivate-core.h index 55aa45c748..47ea27dfd1 100644 --- a/gdk/x11/gdkdevicemanagerprivate-core.h +++ b/gdk/x11/gdkdevicemanagerprivate-core.h @@ -37,7 +37,7 @@ struct _GdkX11DeviceManagerCoreClass GObjectClass parent_class; }; -void _gdk_device_manager_core_handle_focus (GdkWindow *window, +void _gdk_device_manager_core_handle_focus (GdkSurface *window, Window original, GdkDevice *device, GdkDevice *source_device, diff --git a/gdk/x11/gdkdisplay-x11.c b/gdk/x11/gdkdisplay-x11.c index 28a5344c24..4432a3efe4 100644 --- a/gdk/x11/gdkdisplay-x11.c +++ b/gdk/x11/gdkdisplay-x11.c @@ -199,19 +199,19 @@ gdk_x11_display_event_translator_init (GdkEventTranslatorIface *iface) iface->translate_event = gdk_x11_display_translate_event; } -#define ANY_EDGE_TILED (GDK_WINDOW_STATE_LEFT_TILED | \ - GDK_WINDOW_STATE_RIGHT_TILED | \ - GDK_WINDOW_STATE_TOP_TILED | \ - GDK_WINDOW_STATE_BOTTOM_TILED) +#define ANY_EDGE_TILED (GDK_SURFACE_STATE_LEFT_TILED | \ + GDK_SURFACE_STATE_RIGHT_TILED | \ + GDK_SURFACE_STATE_TOP_TILED | \ + GDK_SURFACE_STATE_BOTTOM_TILED) static void -do_edge_constraint_state_check (GdkWindow *window, - GdkWindowState old_state, - GdkWindowState *set, - GdkWindowState *unset) +do_edge_constraint_state_check (GdkSurface *surface, + GdkSurfaceState old_state, + GdkSurfaceState *set, + GdkSurfaceState *unset) { - GdkToplevelX11 *toplevel = _gdk_x11_window_get_toplevel (window); - GdkWindowState local_set, local_unset; + GdkToplevelX11 *toplevel = _gdk_x11_surface_get_toplevel (surface); + GdkSurfaceState local_set, local_unset; guint edge_constraints; local_set = *set; @@ -220,130 +220,130 @@ do_edge_constraint_state_check (GdkWindow *window, /* If the WM doesn't support _GTK_EDGE_CONSTRAINTS, rely on the fallback * implementation. If it supports _GTK_EDGE_CONSTRAINTS, arrange for - * GDK_WINDOW_STATE_TILED to be set if any edge is tiled, and cleared + * GDK_SURFACE_STATE_TILED to be set if any edge is tiled, and cleared * if no edge is tiled. */ - if (!gdk_window_supports_edge_constraints (window)) + if (!gdk_surface_supports_edge_constraints (surface)) { /* FIXME: we rely on implementation details of mutter here: * mutter only tiles horizontally, and sets maxvert when it does * and if it tiles, it always affects all edges */ - if (old_state & GDK_WINDOW_STATE_TILED) + if (old_state & GDK_SURFACE_STATE_TILED) { if (!toplevel->have_maxvert) - local_unset |= GDK_WINDOW_STATE_TILED; + local_unset |= GDK_SURFACE_STATE_TILED; } else { if (toplevel->have_maxvert && !toplevel->have_maxhorz) - local_set |= GDK_WINDOW_STATE_TILED; + local_set |= GDK_SURFACE_STATE_TILED; } } else { - if (old_state & GDK_WINDOW_STATE_TILED) + if (old_state & GDK_SURFACE_STATE_TILED) { if (!(edge_constraints & ANY_EDGE_TILED)) - local_unset |= GDK_WINDOW_STATE_TILED; + local_unset |= GDK_SURFACE_STATE_TILED; } else { if (edge_constraints & ANY_EDGE_TILED) - local_set |= GDK_WINDOW_STATE_TILED; + local_set |= GDK_SURFACE_STATE_TILED; } } /* Top edge */ - if (old_state & GDK_WINDOW_STATE_TOP_TILED) + if (old_state & GDK_SURFACE_STATE_TOP_TILED) { - if ((edge_constraints & GDK_WINDOW_STATE_TOP_TILED) == 0) - local_unset |= GDK_WINDOW_STATE_TOP_TILED; + if ((edge_constraints & GDK_SURFACE_STATE_TOP_TILED) == 0) + local_unset |= GDK_SURFACE_STATE_TOP_TILED; } else { - if (edge_constraints & GDK_WINDOW_STATE_TOP_TILED) - local_set |= GDK_WINDOW_STATE_TOP_TILED; + if (edge_constraints & GDK_SURFACE_STATE_TOP_TILED) + local_set |= GDK_SURFACE_STATE_TOP_TILED; } - if (old_state & GDK_WINDOW_STATE_TOP_RESIZABLE) + if (old_state & GDK_SURFACE_STATE_TOP_RESIZABLE) { - if ((edge_constraints & GDK_WINDOW_STATE_TOP_RESIZABLE) == 0) - local_unset |= GDK_WINDOW_STATE_TOP_RESIZABLE; + if ((edge_constraints & GDK_SURFACE_STATE_TOP_RESIZABLE) == 0) + local_unset |= GDK_SURFACE_STATE_TOP_RESIZABLE; } else { - if (edge_constraints & GDK_WINDOW_STATE_TOP_RESIZABLE) - local_set |= GDK_WINDOW_STATE_TOP_RESIZABLE; + if (edge_constraints & GDK_SURFACE_STATE_TOP_RESIZABLE) + local_set |= GDK_SURFACE_STATE_TOP_RESIZABLE; } /* Right edge */ - if (old_state & GDK_WINDOW_STATE_RIGHT_TILED) + if (old_state & GDK_SURFACE_STATE_RIGHT_TILED) { - if ((edge_constraints & GDK_WINDOW_STATE_RIGHT_TILED) == 0) - local_unset |= GDK_WINDOW_STATE_RIGHT_TILED; + if ((edge_constraints & GDK_SURFACE_STATE_RIGHT_TILED) == 0) + local_unset |= GDK_SURFACE_STATE_RIGHT_TILED; } else { - if (edge_constraints & GDK_WINDOW_STATE_RIGHT_TILED) - local_set |= GDK_WINDOW_STATE_RIGHT_TILED; + if (edge_constraints & GDK_SURFACE_STATE_RIGHT_TILED) + local_set |= GDK_SURFACE_STATE_RIGHT_TILED; } - if (old_state & GDK_WINDOW_STATE_RIGHT_RESIZABLE) + if (old_state & GDK_SURFACE_STATE_RIGHT_RESIZABLE) { - if ((edge_constraints & GDK_WINDOW_STATE_RIGHT_RESIZABLE) == 0) - local_unset |= GDK_WINDOW_STATE_RIGHT_RESIZABLE; + if ((edge_constraints & GDK_SURFACE_STATE_RIGHT_RESIZABLE) == 0) + local_unset |= GDK_SURFACE_STATE_RIGHT_RESIZABLE; } else { - if (edge_constraints & GDK_WINDOW_STATE_RIGHT_RESIZABLE) - local_set |= GDK_WINDOW_STATE_RIGHT_RESIZABLE; + if (edge_constraints & GDK_SURFACE_STATE_RIGHT_RESIZABLE) + local_set |= GDK_SURFACE_STATE_RIGHT_RESIZABLE; } /* Bottom edge */ - if (old_state & GDK_WINDOW_STATE_BOTTOM_TILED) + if (old_state & GDK_SURFACE_STATE_BOTTOM_TILED) { - if ((edge_constraints & GDK_WINDOW_STATE_BOTTOM_TILED) == 0) - local_unset |= GDK_WINDOW_STATE_BOTTOM_TILED; + if ((edge_constraints & GDK_SURFACE_STATE_BOTTOM_TILED) == 0) + local_unset |= GDK_SURFACE_STATE_BOTTOM_TILED; } else { - if (edge_constraints & GDK_WINDOW_STATE_BOTTOM_TILED) - local_set |= GDK_WINDOW_STATE_BOTTOM_TILED; + if (edge_constraints & GDK_SURFACE_STATE_BOTTOM_TILED) + local_set |= GDK_SURFACE_STATE_BOTTOM_TILED; } - if (old_state & GDK_WINDOW_STATE_BOTTOM_RESIZABLE) + if (old_state & GDK_SURFACE_STATE_BOTTOM_RESIZABLE) { - if ((edge_constraints & GDK_WINDOW_STATE_BOTTOM_RESIZABLE) == 0) - local_unset |= GDK_WINDOW_STATE_BOTTOM_RESIZABLE; + if ((edge_constraints & GDK_SURFACE_STATE_BOTTOM_RESIZABLE) == 0) + local_unset |= GDK_SURFACE_STATE_BOTTOM_RESIZABLE; } else { - if (edge_constraints & GDK_WINDOW_STATE_BOTTOM_RESIZABLE) - local_set |= GDK_WINDOW_STATE_BOTTOM_RESIZABLE; + if (edge_constraints & GDK_SURFACE_STATE_BOTTOM_RESIZABLE) + local_set |= GDK_SURFACE_STATE_BOTTOM_RESIZABLE; } /* Left edge */ - if (old_state & GDK_WINDOW_STATE_LEFT_TILED) + if (old_state & GDK_SURFACE_STATE_LEFT_TILED) { - if ((edge_constraints & GDK_WINDOW_STATE_LEFT_TILED) == 0) - local_unset |= GDK_WINDOW_STATE_LEFT_TILED; + if ((edge_constraints & GDK_SURFACE_STATE_LEFT_TILED) == 0) + local_unset |= GDK_SURFACE_STATE_LEFT_TILED; } else { - if (edge_constraints & GDK_WINDOW_STATE_LEFT_TILED) - local_set |= GDK_WINDOW_STATE_LEFT_TILED; + if (edge_constraints & GDK_SURFACE_STATE_LEFT_TILED) + local_set |= GDK_SURFACE_STATE_LEFT_TILED; } - if (old_state & GDK_WINDOW_STATE_LEFT_RESIZABLE) + if (old_state & GDK_SURFACE_STATE_LEFT_RESIZABLE) { - if ((edge_constraints & GDK_WINDOW_STATE_LEFT_RESIZABLE) == 0) - local_unset |= GDK_WINDOW_STATE_LEFT_RESIZABLE; + if ((edge_constraints & GDK_SURFACE_STATE_LEFT_RESIZABLE) == 0) + local_unset |= GDK_SURFACE_STATE_LEFT_RESIZABLE; } else { - if (edge_constraints & GDK_WINDOW_STATE_LEFT_RESIZABLE) - local_set |= GDK_WINDOW_STATE_LEFT_RESIZABLE; + if (edge_constraints & GDK_SURFACE_STATE_LEFT_RESIZABLE) + local_set |= GDK_SURFACE_STATE_LEFT_RESIZABLE; } *set = local_set; @@ -351,91 +351,91 @@ do_edge_constraint_state_check (GdkWindow *window, } static void -do_net_wm_state_changes (GdkWindow *window) +do_net_wm_state_changes (GdkSurface *surface) { - GdkToplevelX11 *toplevel = _gdk_x11_window_get_toplevel (window); - GdkWindowState old_state, set, unset; + GdkToplevelX11 *toplevel = _gdk_x11_surface_get_toplevel (surface); + GdkSurfaceState old_state, set, unset; - if (GDK_WINDOW_DESTROYED (window) || - gdk_window_get_window_type (window) != GDK_WINDOW_TOPLEVEL) + if (GDK_SURFACE_DESTROYED (surface) || + gdk_surface_get_surface_type (surface) != GDK_SURFACE_TOPLEVEL) return; - old_state = gdk_window_get_state (window); + old_state = gdk_surface_get_state (surface); set = unset = 0; /* For found_sticky to remain TRUE, we have to also be on desktop * 0xFFFFFFFF */ - if (old_state & GDK_WINDOW_STATE_STICKY) + if (old_state & GDK_SURFACE_STATE_STICKY) { if (!(toplevel->have_sticky && toplevel->on_all_desktops)) - unset |= GDK_WINDOW_STATE_STICKY; + unset |= GDK_SURFACE_STATE_STICKY; } else { if (toplevel->have_sticky && toplevel->on_all_desktops) - set |= GDK_WINDOW_STATE_STICKY; + set |= GDK_SURFACE_STATE_STICKY; } - if (old_state & GDK_WINDOW_STATE_FULLSCREEN) + if (old_state & GDK_SURFACE_STATE_FULLSCREEN) { if (!toplevel->have_fullscreen) - unset |= GDK_WINDOW_STATE_FULLSCREEN; + unset |= GDK_SURFACE_STATE_FULLSCREEN; } else { if (toplevel->have_fullscreen) - set |= GDK_WINDOW_STATE_FULLSCREEN; + set |= GDK_SURFACE_STATE_FULLSCREEN; } /* Our "maximized" means both vertical and horizontal; if only one, * we don't expose that via GDK */ - if (old_state & GDK_WINDOW_STATE_MAXIMIZED) + if (old_state & GDK_SURFACE_STATE_MAXIMIZED) { if (!(toplevel->have_maxvert && toplevel->have_maxhorz)) - unset |= GDK_WINDOW_STATE_MAXIMIZED; + unset |= GDK_SURFACE_STATE_MAXIMIZED; } else { if (toplevel->have_maxvert && toplevel->have_maxhorz) - set |= GDK_WINDOW_STATE_MAXIMIZED; + set |= GDK_SURFACE_STATE_MAXIMIZED; } - if (old_state & GDK_WINDOW_STATE_FOCUSED) + if (old_state & GDK_SURFACE_STATE_FOCUSED) { if (!toplevel->have_focused) - unset |= GDK_WINDOW_STATE_FOCUSED; + unset |= GDK_SURFACE_STATE_FOCUSED; } else { if (toplevel->have_focused) - set |= GDK_WINDOW_STATE_FOCUSED; + set |= GDK_SURFACE_STATE_FOCUSED; } - if (old_state & GDK_WINDOW_STATE_ICONIFIED) + if (old_state & GDK_SURFACE_STATE_ICONIFIED) { if (!toplevel->have_hidden) - unset |= GDK_WINDOW_STATE_ICONIFIED; + unset |= GDK_SURFACE_STATE_ICONIFIED; } else { if (toplevel->have_hidden) - set |= GDK_WINDOW_STATE_ICONIFIED; + set |= GDK_SURFACE_STATE_ICONIFIED; } /* Update edge constraints and tiling */ - do_edge_constraint_state_check (window, old_state, &set, &unset); + do_edge_constraint_state_check (surface, old_state, &set, &unset); - gdk_synthesize_window_state (window, unset, set); + gdk_synthesize_surface_state (surface, unset, set); } static void -gdk_check_wm_desktop_changed (GdkWindow *window) +gdk_check_wm_desktop_changed (GdkSurface *surface) { - GdkToplevelX11 *toplevel = _gdk_x11_window_get_toplevel (window); - GdkDisplay *display = GDK_WINDOW_DISPLAY (window); + GdkToplevelX11 *toplevel = _gdk_x11_surface_get_toplevel (surface); + GdkDisplay *display = GDK_SURFACE_DISPLAY (surface); Atom type; gint format; @@ -447,7 +447,7 @@ gdk_check_wm_desktop_changed (GdkWindow *window) type = None; gdk_x11_display_error_trap_push (display); XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display), - GDK_WINDOW_XID (window), + GDK_SURFACE_XID (surface), gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_DESKTOP"), 0, G_MAXLONG, False, XA_CARDINAL, &type, &format, &nitems, @@ -463,15 +463,15 @@ gdk_check_wm_desktop_changed (GdkWindow *window) else toplevel->on_all_desktops = FALSE; - do_net_wm_state_changes (window); + do_net_wm_state_changes (surface); } static void -gdk_check_wm_state_changed (GdkWindow *window) +gdk_check_wm_state_changed (GdkSurface *surface) { - GdkToplevelX11 *toplevel = _gdk_x11_window_get_toplevel (window); - GdkDisplay *display = GDK_WINDOW_DISPLAY (window); - GdkX11Screen *screen = GDK_WINDOW_SCREEN (window); + GdkToplevelX11 *toplevel = _gdk_x11_surface_get_toplevel (surface); + GdkDisplay *display = GDK_SURFACE_DISPLAY (surface); + GdkX11Screen *screen = GDK_SURFACE_SCREEN (surface); Atom type; gint format; @@ -492,7 +492,7 @@ gdk_check_wm_state_changed (GdkWindow *window) type = None; gdk_x11_display_error_trap_push (display); - XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display), GDK_WINDOW_XID (window), + XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display), GDK_SURFACE_XID (surface), gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_STATE"), 0, G_MAXLONG, False, XA_ATOM, &type, &format, &nitems, &bytes_after, &data); @@ -539,16 +539,16 @@ gdk_check_wm_state_changed (GdkWindow *window) * as well. */ if (toplevel->have_sticky && !had_sticky) - gdk_check_wm_desktop_changed (window); + gdk_check_wm_desktop_changed (surface); else - do_net_wm_state_changes (window); + do_net_wm_state_changes (surface); } static void -gdk_check_edge_constraints_changed (GdkWindow *window) +gdk_check_edge_constraints_changed (GdkSurface *surface) { - GdkToplevelX11 *toplevel = _gdk_x11_window_get_toplevel (window); - GdkDisplay *display = GDK_WINDOW_DISPLAY (window); + GdkToplevelX11 *toplevel = _gdk_x11_surface_get_toplevel (surface); + GdkDisplay *display = GDK_SURFACE_DISPLAY (surface); Atom type; gint format; @@ -560,7 +560,7 @@ gdk_check_edge_constraints_changed (GdkWindow *window) type = None; gdk_x11_display_error_trap_push (display); XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display), - GDK_WINDOW_XID (window), + GDK_SURFACE_XID (surface), gdk_x11_get_xatom_by_name_for_display (display, "_GTK_EDGE_CONSTRAINTS"), 0, G_MAXLONG, False, XA_CARDINAL, &type, &format, &nitems, @@ -584,7 +584,7 @@ gdk_check_edge_constraints_changed (GdkWindow *window) toplevel->edge_constraints = 0; } - do_net_wm_state_changes (window); + do_net_wm_state_changes (surface); } static Atom @@ -635,16 +635,16 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator, const XEvent *xevent) { Window xwindow; - GdkWindow *window; + GdkSurface *surface; gboolean is_substructure; - GdkWindowImplX11 *window_impl = NULL; + GdkSurfaceImplX11 *surface_impl = NULL; GdkX11Screen *x11_screen = NULL; GdkToplevelX11 *toplevel = NULL; GdkX11Display *display_x11 = GDK_X11_DISPLAY (display); gboolean return_val; - /* Find the GdkWindow that this event relates to. If that's - * not the same as the window that the event was sent to, + /* Find the GdkSurface that this event relates to. If that's + * not the same as the surface that the event was sent to, * we are getting an event from SubstructureNotifyMask. * We ignore such events for internal operation, but we * need to report them to the application because of @@ -656,26 +656,26 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator, xwindow = get_event_xwindow (xevent); is_substructure = xwindow != xevent->xany.window; - window = gdk_x11_window_lookup_for_display (display, xwindow); - if (window) + surface = gdk_x11_surface_lookup_for_display (display, xwindow); + if (surface) { /* We may receive events such as NoExpose/GraphicsExpose * and ShmCompletion for pixmaps */ - if (!GDK_IS_WINDOW (window)) + if (!GDK_IS_SURFACE (surface)) return FALSE; - x11_screen = GDK_WINDOW_SCREEN (window); - toplevel = _gdk_x11_window_get_toplevel (window); - window_impl = GDK_WINDOW_IMPL_X11 (window->impl); + x11_screen = GDK_SURFACE_SCREEN (surface); + toplevel = _gdk_x11_surface_get_toplevel (surface); + surface_impl = GDK_SURFACE_IMPL_X11 (surface->impl); - g_object_ref (window); + g_object_ref (surface); } - event->any.window = window; + event->any.surface = surface; event->any.send_event = xevent->xany.send_event ? TRUE : FALSE; - if (window && GDK_WINDOW_DESTROYED (window)) + if (surface && GDK_SURFACE_DESTROYED (surface)) { if (xevent->type != DestroyNotify) { @@ -729,7 +729,7 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator, xevent->xexpose.width, xevent->xexpose.height, event->any.send_event ? " (send)" : "")); - if (window == NULL) + if (surface == NULL) { return_val = FALSE; break; @@ -739,16 +739,16 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator, GdkRectangle expose_rect; int x2, y2; - expose_rect.x = xevent->xexpose.x / window_impl->window_scale; - expose_rect.y = xevent->xexpose.y / window_impl->window_scale; + expose_rect.x = xevent->xexpose.x / surface_impl->surface_scale; + expose_rect.y = xevent->xexpose.y / surface_impl->surface_scale; - x2 = (xevent->xexpose.x + xevent->xexpose.width + window_impl->window_scale -1) / window_impl->window_scale; + x2 = (xevent->xexpose.x + xevent->xexpose.width + surface_impl->surface_scale -1) / surface_impl->surface_scale; expose_rect.width = x2 - expose_rect.x; - y2 = (xevent->xexpose.y + xevent->xexpose.height + window_impl->window_scale -1) / window_impl->window_scale; + y2 = (xevent->xexpose.y + xevent->xexpose.height + surface_impl->surface_scale -1) / surface_impl->surface_scale; expose_rect.height = y2 - expose_rect.y; - _gdk_x11_window_process_expose (window, xevent->xexpose.serial, &expose_rect); + _gdk_x11_surface_process_expose (surface, xevent->xexpose.serial, &expose_rect); return_val = FALSE; } @@ -763,22 +763,22 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator, g_message ("graphics expose:\tdrawable: %ld", xevent->xgraphicsexpose.drawable)); - if (window == NULL) + if (surface == NULL) { return_val = FALSE; break; } - expose_rect.x = xevent->xgraphicsexpose.x / window_impl->window_scale; - expose_rect.y = xevent->xgraphicsexpose.y / window_impl->window_scale; + expose_rect.x = xevent->xgraphicsexpose.x / surface_impl->surface_scale; + expose_rect.y = xevent->xgraphicsexpose.y / surface_impl->surface_scale; - x2 = (xevent->xgraphicsexpose.x + xevent->xgraphicsexpose.width + window_impl->window_scale -1) / window_impl->window_scale; + x2 = (xevent->xgraphicsexpose.x + xevent->xgraphicsexpose.width + surface_impl->surface_scale -1) / surface_impl->surface_scale; expose_rect.width = x2 - expose_rect.x; - y2 = (xevent->xgraphicsexpose.y + xevent->xgraphicsexpose.height + window_impl->window_scale -1) / window_impl->window_scale; + y2 = (xevent->xgraphicsexpose.y + xevent->xgraphicsexpose.height + surface_impl->surface_scale -1) / surface_impl->surface_scale; expose_rect.height = y2 - expose_rect.y; - _gdk_x11_window_process_expose (window, xevent->xgraphicsexpose.serial, &expose_rect); + _gdk_x11_surface_process_expose (surface, xevent->xgraphicsexpose.serial, &expose_rect); return_val = FALSE; } break; @@ -830,12 +830,12 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator, if (!is_substructure) { event->any.type = GDK_DESTROY; - event->any.window = window; + event->any.surface = surface; - return_val = window && !GDK_WINDOW_DESTROYED (window); + return_val = surface && !GDK_SURFACE_DESTROYED (surface); - if (window && GDK_WINDOW_XID (window) != x11_screen->xroot_window) - gdk_window_destroy_notify (window); + if (surface && GDK_SURFACE_XID (surface) != x11_screen->xroot_window) + gdk_surface_destroy_notify (surface); } else return_val = FALSE; @@ -848,9 +848,9 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator, xevent->xmap.window)); event->any.type = GDK_UNMAP; - event->any.window = window; + event->any.surface = surface; - if (window && !is_substructure) + if (surface && !is_substructure) { /* If the WM supports the _NET_WM_STATE_HIDDEN hint, we do not want to * interpret UnmapNotify events as implying iconic state. @@ -865,23 +865,23 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator, * means we hid the window ourselves, so we will have already flipped * the iconified bit off. */ - if (GDK_WINDOW_IS_MAPPED (window)) - gdk_synthesize_window_state (window, + if (GDK_SURFACE_IS_MAPPED (surface)) + gdk_synthesize_surface_state (surface, 0, - GDK_WINDOW_STATE_ICONIFIED); + GDK_SURFACE_STATE_ICONIFIED); } - if (window_impl->toplevel && - window_impl->toplevel->frame_pending) + if (surface_impl->toplevel && + surface_impl->toplevel->frame_pending) { - window_impl->toplevel->frame_pending = FALSE; - _gdk_frame_clock_thaw (gdk_window_get_frame_clock (event->any.window)); + surface_impl->toplevel->frame_pending = FALSE; + _gdk_frame_clock_thaw (gdk_surface_get_frame_clock (event->any.surface)); } if (toplevel) - gdk_window_freeze_toplevel_updates (window); + gdk_surface_freeze_toplevel_updates (surface); - _gdk_x11_window_grab_check_unmap (window, xevent->xany.serial); + _gdk_x11_surface_grab_check_unmap (surface, xevent->xany.serial); } break; @@ -892,18 +892,18 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator, xevent->xmap.window)); event->any.type = GDK_MAP; - event->any.window = window; + event->any.surface = surface; - if (window && !is_substructure) + if (surface && !is_substructure) { /* Unset iconified if it was set */ - if (window->state & GDK_WINDOW_STATE_ICONIFIED) - gdk_synthesize_window_state (window, - GDK_WINDOW_STATE_ICONIFIED, + if (surface->state & GDK_SURFACE_STATE_ICONIFIED) + gdk_synthesize_surface_state (surface, + GDK_SURFACE_STATE_ICONIFIED, 0); if (toplevel) - gdk_window_thaw_toplevel_updates (window); + gdk_surface_thaw_toplevel_updates (surface); } break; @@ -932,9 +932,9 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator, xevent->xconfigure.border_width, xevent->xconfigure.above, xevent->xconfigure.override_redirect, - !window + !surface ? " (discarding)" - : window->window_type == GDK_WINDOW_CHILD + : surface->surface_type == GDK_SURFACE_CHILD ? " (discarding child)" : xevent->xconfigure.event != xevent->xconfigure.window ? " (discarding substructure)" @@ -953,66 +953,66 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator, } #endif - if (!window || + if (!surface || xevent->xconfigure.event != xevent->xconfigure.window || - GDK_WINDOW_TYPE (window) == GDK_WINDOW_CHILD) + GDK_SURFACE_TYPE (surface) == GDK_SURFACE_CHILD) return_val = FALSE; else { event->any.type = GDK_CONFIGURE; - event->any.window = window; - event->configure.width = (xevent->xconfigure.width + window_impl->window_scale - 1) / window_impl->window_scale; - event->configure.height = (xevent->xconfigure.height + window_impl->window_scale - 1) / window_impl->window_scale; + event->any.surface = surface; + event->configure.width = (xevent->xconfigure.width + surface_impl->surface_scale - 1) / surface_impl->surface_scale; + event->configure.height = (xevent->xconfigure.height + surface_impl->surface_scale - 1) / surface_impl->surface_scale; if (!xevent->xconfigure.send_event && !xevent->xconfigure.override_redirect && - !GDK_WINDOW_DESTROYED (window)) + !GDK_SURFACE_DESTROYED (surface)) { gint tx = 0; gint ty = 0; Window child_window = 0; gdk_x11_display_error_trap_push (display); - if (XTranslateCoordinates (GDK_WINDOW_XDISPLAY (window), - GDK_WINDOW_XID (window), + if (XTranslateCoordinates (GDK_SURFACE_XDISPLAY (surface), + GDK_SURFACE_XID (surface), x11_screen->xroot_window, 0, 0, &tx, &ty, &child_window)) { - event->configure.x = tx / window_impl->window_scale; - event->configure.y = ty / window_impl->window_scale; + event->configure.x = tx / surface_impl->surface_scale; + event->configure.y = ty / surface_impl->surface_scale; } gdk_x11_display_error_trap_pop_ignored (display); } else { - event->configure.x = xevent->xconfigure.x / window_impl->window_scale; - event->configure.y = xevent->xconfigure.y / window_impl->window_scale; + event->configure.x = xevent->xconfigure.x / surface_impl->surface_scale; + event->configure.y = xevent->xconfigure.y / surface_impl->surface_scale; } if (!is_substructure) { - window->x = event->configure.x; - window->y = event->configure.y; + surface->x = event->configure.x; + surface->y = event->configure.y; - if (window_impl->unscaled_width != xevent->xconfigure.width || - window_impl->unscaled_height != xevent->xconfigure.height) + if (surface_impl->unscaled_width != xevent->xconfigure.width || + surface_impl->unscaled_height != xevent->xconfigure.height) { - window_impl->unscaled_width = xevent->xconfigure.width; - window_impl->unscaled_height = xevent->xconfigure.height; - window->width = event->configure.width; - window->height = event->configure.height; + surface_impl->unscaled_width = xevent->xconfigure.width; + surface_impl->unscaled_height = xevent->xconfigure.height; + surface->width = event->configure.width; + surface->height = event->configure.height; - _gdk_window_update_size (window); - _gdk_x11_window_update_size (window_impl); + _gdk_surface_update_size (surface); + _gdk_x11_surface_update_size (surface_impl); } - if (window->resize_count >= 1) + if (surface->resize_count >= 1) { - window->resize_count -= 1; + surface->resize_count -= 1; - if (window->resize_count == 0) - _gdk_x11_moveresize_configure_done (display, window); + if (surface->resize_count == 0) + _gdk_x11_moveresize_configure_done (display, surface); } } } @@ -1027,7 +1027,7 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator, gdk_x11_get_xatom_name_for_display (display, xevent->xproperty.atom), "\"")); - if (window == NULL) + if (surface == NULL) { return_val = FALSE; break; @@ -1040,13 +1040,13 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator, xevent->xproperty.serial >= toplevel->map_serial) { if (xevent->xproperty.atom == gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_STATE")) - gdk_check_wm_state_changed (window); + gdk_check_wm_state_changed (surface); if (xevent->xproperty.atom == gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_DESKTOP")) - gdk_check_wm_desktop_changed (window); + gdk_check_wm_desktop_changed (surface); if (xevent->xproperty.atom == gdk_x11_get_xatom_by_name_for_display (display, "_GTK_EDGE_CONSTRAINTS")) - gdk_check_edge_constraints_changed (window); + gdk_check_edge_constraints_changed (surface); } return_val = FALSE; @@ -1120,18 +1120,18 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator, done: if (return_val) { - if (event->any.window) - g_object_ref (event->any.window); + if (event->any.surface) + g_object_ref (event->any.surface); } else { /* Mark this event as having no resources to be freed */ - event->any.window = NULL; + event->any.surface = NULL; event->any.type = GDK_NOTHING; } - if (window) - g_object_unref (window); + if (surface) + g_object_unref (surface); return return_val; } @@ -1172,7 +1172,7 @@ server_time_to_monotonic_time (GdkX11Display *display_x11, (!display_x11->server_time_is_monotonic_time && server_time > display_x11->server_time_query_time + 10*1000*1000)) /* 10 seconds */ { - gint64 current_server_time = gdk_x11_get_server_time (display_x11->leader_gdk_window); + gint64 current_server_time = gdk_x11_get_server_time (display_x11->leader_gdk_surface); gint64 current_server_time_usec = (gint64)current_server_time * 1000; gint64 current_monotonic_time = g_get_monotonic_time (); display_x11->server_time_query_time = current_monotonic_time; @@ -1201,25 +1201,25 @@ _gdk_wm_protocols_filter (const XEvent *xevent, GdkEvent *event, gpointer data) { - GdkWindow *win = event->any.window; + GdkSurface *win = event->any.surface; GdkDisplay *display; Atom atom; - if (!GDK_IS_X11_WINDOW (win) || GDK_WINDOW_DESTROYED (win)) + if (!GDK_IS_X11_SURFACE (win) || GDK_SURFACE_DESTROYED (win)) return GDK_FILTER_CONTINUE; if (xevent->type != ClientMessage) return GDK_FILTER_CONTINUE; - display = GDK_WINDOW_DISPLAY (win); + display = GDK_SURFACE_DISPLAY (win); /* This isn't actually WM_PROTOCOLS because that wouldn't leave enough space * in the message for everything that gets stuffed in */ if (xevent->xclient.message_type == gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_FRAME_DRAWN")) { - GdkWindowImplX11 *window_impl; - window_impl = GDK_WINDOW_IMPL_X11 (win->impl); - if (window_impl->toplevel) + GdkSurfaceImplX11 *surface_impl; + surface_impl = GDK_SURFACE_IMPL_X11 (win->impl); + if (surface_impl->toplevel) { guint32 d0 = xevent->xclient.data.l[0]; guint32 d1 = xevent->xclient.data.l[1]; @@ -1230,15 +1230,15 @@ _gdk_wm_protocols_filter (const XEvent *xevent, gint64 frame_drawn_time = server_time_to_monotonic_time (GDK_X11_DISPLAY (display), ((guint64)d3 << 32) | d2); gint64 refresh_interval, presentation_time; - GdkFrameClock *clock = gdk_window_get_frame_clock (win); + GdkFrameClock *clock = gdk_surface_get_frame_clock (win); GdkFrameTimings *timings = find_frame_timings (clock, serial); if (timings) timings->drawn_time = frame_drawn_time; - if (window_impl->toplevel->frame_pending) + if (surface_impl->toplevel->frame_pending) { - window_impl->toplevel->frame_pending = FALSE; + surface_impl->toplevel->frame_pending = FALSE; _gdk_frame_clock_thaw (clock); } @@ -1247,7 +1247,7 @@ _gdk_wm_protocols_filter (const XEvent *xevent, &refresh_interval, &presentation_time); if (presentation_time != 0) - window_impl->toplevel->throttled_presentation_time = presentation_time + refresh_interval; + surface_impl->toplevel->throttled_presentation_time = presentation_time + refresh_interval; } return GDK_FILTER_REMOVE; @@ -1255,9 +1255,9 @@ _gdk_wm_protocols_filter (const XEvent *xevent, if (xevent->xclient.message_type == gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_FRAME_TIMINGS")) { - GdkWindowImplX11 *window_impl; - window_impl = GDK_WINDOW_IMPL_X11 (win->impl); - if (window_impl->toplevel) + GdkSurfaceImplX11 *surface_impl; + surface_impl = GDK_SURFACE_IMPL_X11 (win->impl); + if (surface_impl->toplevel) { guint32 d0 = xevent->xclient.data.l[0]; guint32 d1 = xevent->xclient.data.l[1]; @@ -1266,7 +1266,7 @@ _gdk_wm_protocols_filter (const XEvent *xevent, guint64 serial = ((guint64)d1 << 32) | d0; - GdkFrameClock *clock = gdk_window_get_frame_clock (win); + GdkFrameClock *clock = gdk_surface_get_frame_clock (win); GdkFrameTimings *timings = find_frame_timings (clock, serial); if (timings) @@ -1310,13 +1310,13 @@ _gdk_wm_protocols_filter (const XEvent *xevent, event->any.type = GDK_DELETE; - gdk_x11_window_set_user_time (win, xevent->xclient.data.l[1]); + gdk_x11_surface_set_user_time (win, xevent->xclient.data.l[1]); return GDK_FILTER_TRANSLATE; } else if (atom == gdk_x11_get_xatom_by_name_for_display (display, "WM_TAKE_FOCUS")) { - GdkToplevelX11 *toplevel = _gdk_x11_window_get_toplevel (win); + GdkToplevelX11 *toplevel = _gdk_x11_surface_get_toplevel (win); /* There is no way of knowing reliably whether we are viewable; * so trap errors asynchronously around the XSetInputFocus call @@ -1338,8 +1338,8 @@ _gdk_wm_protocols_filter (const XEvent *xevent, { XClientMessageEvent xclient = xevent->xclient; - xclient.window = GDK_WINDOW_XROOTWIN (win); - XSendEvent (GDK_WINDOW_XDISPLAY (win), + xclient.window = GDK_SURFACE_XROOTWIN (win); + XSendEvent (GDK_SURFACE_XDISPLAY (win), xclient.window, False, SubstructureRedirectMask | SubstructureNotifyMask, (XEvent *)&xclient); @@ -1349,7 +1349,7 @@ _gdk_wm_protocols_filter (const XEvent *xevent, else if (atom == gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_SYNC_REQUEST") && GDK_X11_DISPLAY (display)->use_sync) { - GdkToplevelX11 *toplevel = _gdk_x11_window_get_toplevel (win); + GdkToplevelX11 *toplevel = _gdk_x11_surface_get_toplevel (win); if (toplevel) { #ifdef HAVE_XSYNC @@ -1493,10 +1493,10 @@ gdk_x11_display_open (const gchar *display_name) gdk_event_init (display); - display_x11->leader_gdk_window = gdk_window_new_temp (display); - (_gdk_x11_window_get_toplevel (display_x11->leader_gdk_window))->is_leader = TRUE; + display_x11->leader_gdk_surface = gdk_surface_new_temp (display); + (_gdk_x11_surface_get_toplevel (display_x11->leader_gdk_surface))->is_leader = TRUE; - display_x11->leader_window = GDK_WINDOW_XID (display_x11->leader_gdk_window); + display_x11->leader_window = GDK_SURFACE_XID (display_x11->leader_gdk_surface); display_x11->leader_window_title_set = FALSE; @@ -1811,7 +1811,7 @@ device_grab_update_callback (GdkDisplay *display, gpointer data, gulong serial) { - GdkPointerWindowInfo *pointer_info; + GdkPointerSurfaceInfo *pointer_info; GdkDevice *device = data; pointer_info = _gdk_display_get_pointer_info (display, device); @@ -1884,12 +1884,12 @@ gdk_x11_display_has_pending (GdkDisplay *display) return XPending (GDK_DISPLAY_XDISPLAY (display)); } -static GdkWindow * +static GdkSurface * gdk_x11_display_get_default_group (GdkDisplay *display) { g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL); - return GDK_X11_DISPLAY (display)->leader_gdk_window; + return GDK_X11_DISPLAY (display)->leader_gdk_surface; } /** @@ -1982,8 +1982,8 @@ gdk_x11_display_finalize (GObject *object) /* List of event window extraction functions */ g_slist_free_full (display_x11->event_types, g_free); - /* input GdkWindow list */ - g_list_free_full (display_x11->input_windows, g_free); + /* input GdkSurface list */ + g_list_free_full (display_x11->input_surfaces, g_free); /* Free all GdkX11Screens */ g_object_unref (display_x11->screen); @@ -2378,7 +2378,7 @@ gdk_x11_display_request_selection_notification (GdkDisplay *display, * Returns the timestamp of the last user interaction on * @display. The timestamp is taken from events caused * by user interaction such as key presses or pointer - * movements. See gdk_x11_window_set_user_time(). + * movements. See gdk_x11_surface_set_user_time(). * * Returns: the timestamp of the last user interaction */ @@ -2744,7 +2744,7 @@ gdk_x11_display_error_trap_pop_internal (GdkDisplay *display, } /** - * gdk_x11_display_set_window_scale: + * gdk_x11_display_set_surface_scale: * @display: (type GdkX11Display): the display * @scale: The new scale value * @@ -2757,7 +2757,7 @@ gdk_x11_display_error_trap_pop_internal (GdkDisplay *display, * to later user configuration changes. */ void -gdk_x11_display_set_window_scale (GdkDisplay *display, +gdk_x11_display_set_surface_scale (GdkDisplay *display, gint scale) { GdkX11Screen *x11_screen; @@ -2769,9 +2769,9 @@ gdk_x11_display_set_window_scale (GdkDisplay *display, x11_screen = GDK_X11_SCREEN (GDK_X11_DISPLAY (display)->screen); - if (!x11_screen->fixed_window_scale) + if (!x11_screen->fixed_surface_scale) { - x11_screen->fixed_window_scale = TRUE; + x11_screen->fixed_surface_scale = TRUE; /* We treat screens with a window scale set differently when * reading xsettings, so we need to reread @@ -2779,7 +2779,7 @@ gdk_x11_display_set_window_scale (GdkDisplay *display, need_reread_settings = TRUE; } - _gdk_x11_screen_set_window_scale (x11_screen, scale); + _gdk_x11_screen_set_surface_scale (x11_screen, scale); if (need_reread_settings) _gdk_x11_settings_force_reread (x11_screen); @@ -3006,7 +3006,7 @@ gdk_x11_display_get_toplevel_windows (GdkDisplay *display) static guint32 gdk_x11_display_get_last_seen_time (GdkDisplay *display) { - return gdk_x11_get_server_time (GDK_X11_DISPLAY (display)->leader_gdk_window); + return gdk_x11_get_server_time (GDK_X11_DISPLAY (display)->leader_gdk_surface); } static gboolean @@ -3034,7 +3034,7 @@ gdk_x11_display_class_init (GdkX11DisplayClass * class) object_class->dispose = gdk_x11_display_dispose; object_class->finalize = gdk_x11_display_finalize; - display_class->window_type = GDK_TYPE_X11_WINDOW; + display_class->surface_type = GDK_TYPE_X11_SURFACE; #ifdef GDK_RENDERING_VULKAN display_class->vk_context_type = GDK_TYPE_X11_VULKAN_CONTEXT; display_class->vk_extension_name = VK_KHR_XLIB_SURFACE_EXTENSION_NAME; @@ -3054,7 +3054,7 @@ gdk_x11_display_class_init (GdkX11DisplayClass * class) display_class->get_next_serial = gdk_x11_display_get_next_serial; display_class->notify_startup_complete = gdk_x11_display_notify_startup_complete; - display_class->create_window_impl = _gdk_x11_display_create_window_impl; + display_class->create_surface_impl = _gdk_x11_display_create_surface_impl; display_class->get_keymap = gdk_x11_display_get_keymap; display_class->text_property_to_utf8_list = _gdk_x11_display_text_property_to_utf8_list; display_class->utf8_to_string_target = _gdk_x11_display_utf8_to_string_target; @@ -3105,5 +3105,5 @@ gdk_x11_display_class_init (GdkX11DisplayClass * class) _gdk_marshal_BOOLEAN__POINTER, G_TYPE_BOOLEAN, 1, G_TYPE_POINTER); - _gdk_x11_windowing_init (); + _gdk_x11_surfaceing_init (); } diff --git a/gdk/x11/gdkdisplay-x11.h b/gdk/x11/gdkdisplay-x11.h index ff000857e9..0625c7d395 100644 --- a/gdk/x11/gdkdisplay-x11.h +++ b/gdk/x11/gdkdisplay-x11.h @@ -24,7 +24,7 @@ #include "gdkdisplayprivate.h" #include "gdkkeys.h" -#include "gdkwindow.h" +#include "gdksurface.h" #include "gdkinternals.h" #include "gdkx11devicemanager.h" #include "gdkx11display.h" @@ -96,7 +96,7 @@ struct _GdkX11Display /* Session Management leader window see ICCCM */ char *program_class; Window leader_window; - GdkWindow *leader_gdk_window; + GdkSurface *leader_gdk_surface; gboolean leader_window_title_set; /* List of functions to go from extension event => X window */ @@ -111,8 +111,8 @@ struct _GdkX11Display /* streams reading selections */ GSList *streams; - /* input GdkWindow list */ - GList *input_windows; + /* input GdkSurface list */ + GList *input_surfaces; /* GdkCursor => XCursor */ GHashTable *cursors; diff --git a/gdk/x11/gdkdnd-x11.c b/gdk/x11/gdkdnd-x11.c index 10b25dad51..659923fb66 100644 --- a/gdk/x11/gdkdnd-x11.c +++ b/gdk/x11/gdkdnd-x11.c @@ -84,7 +84,7 @@ typedef struct { cairo_region_t *shape; } GdkCacheChild; -struct _GdkWindowCache { +struct _GdkSurfaceCache { GList *children; GHashTable *child_hash; guint old_event_mask; @@ -109,11 +109,11 @@ struct _GdkX11DragContext GdkDragAction xdnd_actions; /* What is currently set in XdndActionList */ guint version; /* Xdnd protocol version */ - GdkWindowCache *cache; + GdkSurfaceCache *cache; - GdkWindow *drag_window; + GdkSurface *drag_surface; - GdkWindow *ipc_window; + GdkSurface *ipc_surface; GdkCursor *cursor; GdkSeat *grab_seat; GdkDragAction actions; @@ -167,8 +167,8 @@ static GrabKey grab_keys[] = { /* Forward declarations */ -static GdkWindowCache *gdk_window_cache_ref (GdkWindowCache *cache); -static void gdk_window_cache_unref (GdkWindowCache *cache); +static GdkSurfaceCache *gdk_surface_cache_ref (GdkSurfaceCache *cache); +static void gdk_surface_cache_unref (GdkSurfaceCache *cache); static GdkFilterReturn xdnd_enter_filter (const XEvent *xevent, GdkEvent *event, @@ -190,7 +190,7 @@ static GdkFilterReturn xdnd_drop_filter (const XEvent *xevent, gpointer data); static void xdnd_manage_source_filter (GdkDragContext *context, - GdkWindow *window, + GdkSurface *surface, gboolean add_filter); gboolean gdk_x11_drag_context_handle_event (GdkDragContext *context, @@ -223,13 +223,13 @@ gdk_x11_drag_context_init (GdkX11DragContext *context) } static void gdk_x11_drag_context_finalize (GObject *object); -static GdkWindow * gdk_x11_drag_context_find_window (GdkDragContext *context, - GdkWindow *drag_window, +static GdkSurface * gdk_x11_drag_context_find_surface (GdkDragContext *context, + GdkSurface *drag_surface, gint x_root, gint y_root, GdkDragProtocol *protocol); static gboolean gdk_x11_drag_context_drag_motion (GdkDragContext *context, - GdkWindow *dest_window, + GdkSurface *dest_surface, GdkDragProtocol protocol, gint x_root, gint y_root, @@ -250,7 +250,7 @@ static void gdk_x11_drag_context_drop_finish (GdkDragContext *context, gboolean success, guint32 time_); static gboolean gdk_x11_drag_context_drop_status (GdkDragContext *context); -static GdkWindow * gdk_x11_drag_context_get_drag_window (GdkDragContext *context); +static GdkSurface * gdk_x11_drag_context_get_drag_surface (GdkDragContext *context); static void gdk_x11_drag_context_set_hotspot (GdkDragContext *context, gint hot_x, gint hot_y); @@ -408,7 +408,7 @@ gdk_x11_drag_context_class_init (GdkX11DragContextClass *klass) context_class->drop_status = gdk_x11_drag_context_drop_status; context_class->read_async = gdk_x11_drag_context_read_async; context_class->read_finish = gdk_x11_drag_context_read_finish; - context_class->get_drag_window = gdk_x11_drag_context_get_drag_window; + context_class->get_drag_surface = gdk_x11_drag_context_get_drag_surface; context_class->set_hotspot = gdk_x11_drag_context_set_hotspot; context_class->drop_done = gdk_x11_drag_context_drop_done; context_class->set_cursor = gdk_x11_drag_context_set_cursor; @@ -423,28 +423,28 @@ gdk_x11_drag_context_finalize (GObject *object) { GdkDragContext *context = GDK_DRAG_CONTEXT (object); GdkX11DragContext *x11_context = GDK_X11_DRAG_CONTEXT (object); - GdkWindow *drag_window, *ipc_window; + GdkSurface *drag_surface, *ipc_surface; - if (context->source_window) + if (context->source_surface) { if ((x11_context->protocol == GDK_DRAG_PROTO_XDND) && !context->is_source) - xdnd_manage_source_filter (context, context->source_window, FALSE); + xdnd_manage_source_filter (context, context->source_surface, FALSE); } if (x11_context->cache) - gdk_window_cache_unref (x11_context->cache); + gdk_surface_cache_unref (x11_context->cache); contexts = g_list_remove (contexts, context); - drag_window = context->drag_window; - ipc_window = x11_context->ipc_window; + drag_surface = context->drag_surface; + ipc_surface = x11_context->ipc_surface; G_OBJECT_CLASS (gdk_x11_drag_context_parent_class)->finalize (object); - if (drag_window) - gdk_window_destroy (drag_window); - if (ipc_window) - gdk_window_destroy (ipc_window); + if (drag_surface) + gdk_surface_destroy (drag_surface); + if (ipc_surface) + gdk_surface_destroy (ipc_surface); } /* Drag Contexts */ @@ -465,19 +465,19 @@ gdk_drag_context_find (GdkDisplay *display, context = (GdkDragContext *)tmp_list->data; context_x11 = (GdkX11DragContext *)context; - if ((context->source_window && gdk_window_get_display (context->source_window) != display) || - (context->dest_window && gdk_window_get_display (context->dest_window) != display)) + if ((context->source_surface && gdk_surface_get_display (context->source_surface) != display) || + (context->dest_surface && gdk_surface_get_display (context->dest_surface) != display)) continue; - context_dest_xid = context->dest_window + context_dest_xid = context->dest_surface ? (context_x11->drop_xid ? context_x11->drop_xid - : GDK_WINDOW_XID (context->dest_window)) + : GDK_SURFACE_XID (context->dest_surface)) : None; if ((!context->is_source == !is_source) && - ((source_xid == None) || (context->source_window && - (GDK_WINDOW_XID (context->source_window) == source_xid))) && + ((source_xid == None) || (context->source_surface && + (GDK_SURFACE_XID (context->source_surface) == source_xid))) && ((dest_xid == None) || (context_dest_xid == dest_xid))) return context; } @@ -521,7 +521,7 @@ free_cache_child (GdkCacheChild *child, } static void -gdk_window_cache_add (GdkWindowCache *cache, +gdk_surface_cache_add (GdkSurfaceCache *cache, guint32 xid, gint x, gint y, @@ -547,11 +547,11 @@ gdk_window_cache_add (GdkWindowCache *cache, } GdkFilterReturn -gdk_window_cache_shape_filter (const XEvent *xevent, +gdk_surface_cache_shape_filter (const XEvent *xevent, GdkEvent *event, gpointer data) { - GdkWindowCache *cache = data; + GdkSurfaceCache *cache = data; GdkX11Display *display = GDK_X11_DISPLAY (cache->display); @@ -581,11 +581,11 @@ gdk_window_cache_shape_filter (const XEvent *xevent, } GdkFilterReturn -gdk_window_cache_filter (const XEvent *xevent, +gdk_surface_cache_filter (const XEvent *xevent, GdkEvent *event, gpointer data) { - GdkWindowCache *cache = data; + GdkSurfaceCache *cache = data; switch (xevent->type) { @@ -639,7 +639,7 @@ gdk_window_cache_filter (const XEvent *xevent, if (!g_hash_table_lookup (cache->child_hash, GUINT_TO_POINTER (xcwe->window))) - gdk_window_cache_add (cache, xcwe->window, + gdk_surface_cache_add (cache, xcwe->window, xcwe->x, xcwe->y, xcwe->width, xcwe->height, FALSE); break; @@ -700,8 +700,8 @@ gdk_window_cache_filter (const XEvent *xevent, return GDK_FILTER_REMOVE; } -static GdkWindowCache * -gdk_window_cache_new (GdkDisplay *display) +static GdkSurfaceCache * +gdk_surface_cache_new (GdkDisplay *display) { XWindowAttributes xwa; GdkX11Screen *screen = GDK_X11_DISPLAY (display)->screen; @@ -713,7 +713,7 @@ gdk_window_cache_new (GdkDisplay *display) Window cow; #endif - GdkWindowCache *result = g_new (GdkWindowCache, 1); + GdkSurfaceCache *result = g_new (GdkSurfaceCache, 1); result->children = NULL; result->child_hash = g_hash_table_new (g_direct_hash, NULL); @@ -726,21 +726,21 @@ gdk_window_cache_new (GdkDisplay *display) if (G_UNLIKELY (!GDK_X11_DISPLAY (display)->trusted_client)) { GList *toplevel_windows, *list; - GdkWindow *window; - GdkWindowImplX11 *impl; + GdkSurface *surface; + GdkSurfaceImplX11 *impl; gint x, y, width, height; toplevel_windows = gdk_x11_display_get_toplevel_windows (display); for (list = toplevel_windows; list; list = list->next) { - window = GDK_WINDOW (list->data); - impl = GDK_WINDOW_IMPL_X11 (window->impl); - gdk_window_get_geometry (window, &x, &y, &width, &height); - gdk_window_cache_add (result, GDK_WINDOW_XID (window), - x * impl->window_scale, y * impl->window_scale, - width * impl->window_scale, - height * impl->window_scale, - gdk_window_is_visible (window)); + surface = GDK_SURFACE (list->data); + impl = GDK_SURFACE_IMPL_X11 (surface->impl); + gdk_surface_get_geometry (surface, &x, &y, &width, &height); + gdk_surface_cache_add (result, GDK_SURFACE_XID (surface), + x * impl->surface_scale, y * impl->surface_scale, + width * impl->surface_scale, + height * impl->surface_scale, + gdk_surface_is_visible (surface)); } return result; } @@ -755,7 +755,7 @@ gdk_window_cache_new (GdkDisplay *display) for (i = 0; i < nchildren ; i++) { - gdk_window_cache_add (result, children[i].window, + gdk_surface_cache_add (result, children[i].window, children[i].x, children[i].y, children[i].width, children[i].height, children[i].is_mapped); } @@ -773,9 +773,9 @@ gdk_window_cache_new (GdkDisplay *display) if (gdk_display_is_composited (display)) { cow = XCompositeGetOverlayWindow (xdisplay, xroot_window); - gdk_window_cache_add (result, cow, 0, 0, - WidthOfScreen (GDK_X11_SCREEN (screen)->xscreen) * GDK_X11_SCREEN (screen)->window_scale, - HeightOfScreen (GDK_X11_SCREEN (screen)->xscreen) * GDK_X11_SCREEN (screen)->window_scale, + gdk_surface_cache_add (result, cow, 0, 0, + WidthOfScreen (GDK_X11_SCREEN (screen)->xscreen) * GDK_X11_SCREEN (screen)->surface_scale, + HeightOfScreen (GDK_X11_SCREEN (screen)->xscreen) * GDK_X11_SCREEN (screen)->surface_scale, TRUE); XCompositeReleaseOverlayWindow (xdisplay, xroot_window); } @@ -785,7 +785,7 @@ gdk_window_cache_new (GdkDisplay *display) } static void -gdk_window_cache_destroy (GdkWindowCache *cache) +gdk_surface_cache_destroy (GdkSurfaceCache *cache) { XSelectInput (GDK_DISPLAY_XDISPLAY (cache->display), GDK_DISPLAY_XROOTWIN (cache->display), @@ -801,8 +801,8 @@ gdk_window_cache_destroy (GdkWindowCache *cache) g_free (cache); } -static GdkWindowCache * -gdk_window_cache_ref (GdkWindowCache *cache) +static GdkSurfaceCache * +gdk_surface_cache_ref (GdkSurfaceCache *cache) { cache->ref_count += 1; @@ -810,7 +810,7 @@ gdk_window_cache_ref (GdkWindowCache *cache) } static void -gdk_window_cache_unref (GdkWindowCache *cache) +gdk_surface_cache_unref (GdkSurfaceCache *cache) { g_assert (cache->ref_count > 0); @@ -819,24 +819,24 @@ gdk_window_cache_unref (GdkWindowCache *cache) if (cache->ref_count == 0) { window_caches = g_slist_remove (window_caches, cache); - gdk_window_cache_destroy (cache); + gdk_surface_cache_destroy (cache); } } -GdkWindowCache * -gdk_window_cache_get (GdkDisplay *display) +GdkSurfaceCache * +gdk_surface_cache_get (GdkDisplay *display) { GSList *list; - GdkWindowCache *cache; + GdkSurfaceCache *cache; for (list = window_caches; list; list = list->next) { cache = list->data; if (cache->display == display) - return gdk_window_cache_ref (cache); + return gdk_surface_cache_ref (cache); } - cache = gdk_window_cache_new (display); + cache = gdk_surface_cache_new (display); window_caches = g_slist_prepend (window_caches, cache); @@ -944,7 +944,7 @@ get_client_window_at_coords_recurse (GdkDisplay *display, } static Window -get_client_window_at_coords (GdkWindowCache *cache, +get_client_window_at_coords (GdkSurfaceCache *cache, Window ignore, gint x_root, gint y_root) @@ -1064,21 +1064,21 @@ xdnd_status_filter (const XEvent *xevent, gpointer data) { GdkDisplay *display; - guint32 dest_window = xevent->xclient.data.l[0]; + guint32 dest_surface = xevent->xclient.data.l[0]; guint32 flags = xevent->xclient.data.l[1]; Atom action = xevent->xclient.data.l[4]; GdkDragContext *context; - if (!event->any.window || - gdk_window_get_window_type (event->any.window) == GDK_WINDOW_FOREIGN) + if (!event->any.surface || + gdk_surface_get_surface_type (event->any.surface) == GDK_SURFACE_FOREIGN) return GDK_FILTER_CONTINUE; /* Not for us */ - display = gdk_window_get_display (event->any.window); - context = gdk_drag_context_find (display, TRUE, xevent->xclient.window, dest_window); + display = gdk_surface_get_display (event->any.surface); + context = gdk_drag_context_find (display, TRUE, xevent->xclient.window, dest_surface); GDK_DISPLAY_NOTE (display, DND, - g_message ("XdndStatus: dest_window: %#x action: %ld", - dest_window, action)); + g_message ("XdndStatus: dest_surface: %#x action: %ld", + dest_surface, action)); if (context) { @@ -1111,19 +1111,19 @@ xdnd_finished_filter (const XEvent *xevent, gpointer data) { GdkDisplay *display; - guint32 dest_window = xevent->xclient.data.l[0]; + guint32 dest_surface = xevent->xclient.data.l[0]; GdkDragContext *context; GdkX11DragContext *context_x11; - if (!event->any.window || - gdk_window_get_window_type (event->any.window) == GDK_WINDOW_FOREIGN) + if (!event->any.surface || + gdk_surface_get_surface_type (event->any.surface) == GDK_SURFACE_FOREIGN) return GDK_FILTER_CONTINUE; /* Not for us */ - display = gdk_window_get_display (event->any.window); - context = gdk_drag_context_find (display, TRUE, xevent->xclient.window, dest_window); + display = gdk_surface_get_display (event->any.surface); + context = gdk_drag_context_find (display, TRUE, xevent->xclient.window, dest_surface); GDK_DISPLAY_NOTE (display, DND, - g_message ("XdndFinished: dest_window: %#x", dest_window)); + g_message ("XdndFinished: dest_surface: %#x", dest_surface)); if (context) { @@ -1157,7 +1157,7 @@ xdnd_set_targets (GdkX11DragContext *context_x11) atomlist[i] = gdk_x11_get_xatom_by_name_for_display (display, atoms[i]); XChangeProperty (GDK_DISPLAY_XDISPLAY (display), - GDK_WINDOW_XID (context_x11->ipc_window), + GDK_SURFACE_XID (context_x11->ipc_surface), gdk_x11_get_xatom_by_name_for_display (display, "XdndTypeList"), XA_ATOM, 32, PropModeReplace, (guchar *)atomlist, n_atoms); @@ -1203,7 +1203,7 @@ xdnd_set_actions (GdkX11DragContext *context_x11) } XChangeProperty (GDK_DISPLAY_XDISPLAY (display), - GDK_WINDOW_XID (context_x11->ipc_window), + GDK_SURFACE_XID (context_x11->ipc_surface), gdk_x11_get_xatom_by_name_for_display (display, "XdndActionList"), XA_ATOM, 32, PropModeReplace, (guchar *)atomlist, n_atoms); @@ -1228,13 +1228,13 @@ send_client_message_async_cb (Window window, * so we don't end up blocking for a timeout */ if (!success && - context->dest_window && - window == GDK_WINDOW_XID (context->dest_window)) + context->dest_surface && + window == GDK_SURFACE_XID (context->dest_surface)) { GdkX11DragContext *context_x11 = data; - g_object_unref (context->dest_window); - context->dest_window = NULL; + g_object_unref (context->dest_surface); + context->dest_surface = NULL; context->action = 0; if (context->action != context_x11->current_action) { @@ -1265,7 +1265,7 @@ send_client_message_async (GdkDragContext *context, static gboolean xdnd_send_xevent (GdkX11DragContext *context_x11, - GdkWindow *window, + GdkSurface *surface, gboolean propagate, XEvent *event_send) { @@ -1277,7 +1277,7 @@ xdnd_send_xevent (GdkX11DragContext *context_x11, g_assert (event_send->xany.type == ClientMessage); /* We short-circuit messages to ourselves */ - if (gdk_window_get_window_type (window) != GDK_WINDOW_FOREIGN) + if (gdk_surface_get_surface_type (surface) != GDK_SURFACE_FOREIGN) { gint i; @@ -1289,7 +1289,7 @@ xdnd_send_xevent (GdkX11DragContext *context_x11, GdkEvent *temp_event; temp_event = gdk_event_new (GDK_NOTHING); - temp_event->any.window = g_object_ref (window); + temp_event->any.surface = g_object_ref (surface); if ((*xdnd_filters[i].func) (event_send, temp_event, NULL) == GDK_FILTER_TRANSLATE) gdk_display_put_event (display, temp_event); @@ -1301,7 +1301,7 @@ xdnd_send_xevent (GdkX11DragContext *context_x11, } } - xwindow = GDK_WINDOW_XID (window); + xwindow = GDK_SURFACE_XID (surface); if (_gdk_x11_display_is_root_window (display, xwindow)) event_mask = ButtonPressMask; @@ -1328,8 +1328,8 @@ xdnd_send_enter (GdkX11DragContext *context_x11) xev.xclient.format = 32; xev.xclient.window = context_x11->drop_xid ? context_x11->drop_xid - : GDK_WINDOW_XID (context->dest_window); - xev.xclient.data.l[0] = GDK_WINDOW_XID (context_x11->ipc_window); + : GDK_SURFACE_XID (context->dest_surface); + xev.xclient.data.l[0] = GDK_SURFACE_XID (context_x11->ipc_surface); xev.xclient.data.l[1] = (context_x11->version << 24); /* version */ xev.xclient.data.l[2] = 0; xev.xclient.data.l[3] = 0; @@ -1337,7 +1337,7 @@ xdnd_send_enter (GdkX11DragContext *context_x11) GDK_DISPLAY_NOTE (display, DND, g_message ("Sending enter source window %#lx XDND protocol version %d\n", - GDK_WINDOW_XID (context_x11->ipc_window), context_x11->version)); + GDK_SURFACE_XID (context_x11->ipc_surface), context_x11->version)); atoms = gdk_content_formats_get_mime_types (context->formats, &n_atoms); if (n_atoms > 3) @@ -1354,13 +1354,13 @@ xdnd_send_enter (GdkX11DragContext *context_x11) } } - if (!xdnd_send_xevent (context_x11, context->dest_window, FALSE, &xev)) + if (!xdnd_send_xevent (context_x11, context->dest_surface, FALSE, &xev)) { GDK_DISPLAY_NOTE (display, DND, g_message ("Send event to %lx failed", - GDK_WINDOW_XID (context->dest_window))); - g_object_unref (context->dest_window); - context->dest_window = NULL; + GDK_SURFACE_XID (context->dest_surface))); + g_object_unref (context->dest_surface); + context->dest_surface = NULL; } } @@ -1376,20 +1376,20 @@ xdnd_send_leave (GdkX11DragContext *context_x11) xev.xclient.format = 32; xev.xclient.window = context_x11->drop_xid ? context_x11->drop_xid - : GDK_WINDOW_XID (context->dest_window); - xev.xclient.data.l[0] = GDK_WINDOW_XID (context_x11->ipc_window); + : GDK_SURFACE_XID (context->dest_surface); + xev.xclient.data.l[0] = GDK_SURFACE_XID (context_x11->ipc_surface); xev.xclient.data.l[1] = 0; xev.xclient.data.l[2] = 0; xev.xclient.data.l[3] = 0; xev.xclient.data.l[4] = 0; - if (!xdnd_send_xevent (context_x11, context->dest_window, FALSE, &xev)) + if (!xdnd_send_xevent (context_x11, context->dest_surface, FALSE, &xev)) { GDK_DISPLAY_NOTE (display, DND, g_message ("Send event to %lx failed", - GDK_WINDOW_XID (context->dest_window))); - g_object_unref (context->dest_window); - context->dest_window = NULL; + GDK_SURFACE_XID (context->dest_surface))); + g_object_unref (context->dest_surface); + context->dest_surface = NULL; } } @@ -1406,20 +1406,20 @@ xdnd_send_drop (GdkX11DragContext *context_x11, xev.xclient.format = 32; xev.xclient.window = context_x11->drop_xid ? context_x11->drop_xid - : GDK_WINDOW_XID (context->dest_window); - xev.xclient.data.l[0] = GDK_WINDOW_XID (context_x11->ipc_window); + : GDK_SURFACE_XID (context->dest_surface); + xev.xclient.data.l[0] = GDK_SURFACE_XID (context_x11->ipc_surface); xev.xclient.data.l[1] = 0; xev.xclient.data.l[2] = time; xev.xclient.data.l[3] = 0; xev.xclient.data.l[4] = 0; - if (!xdnd_send_xevent (context_x11, context->dest_window, FALSE, &xev)) + if (!xdnd_send_xevent (context_x11, context->dest_surface, FALSE, &xev)) { GDK_DISPLAY_NOTE (display, DND, g_message ("Send event to %lx failed", - GDK_WINDOW_XID (context->dest_window))); - g_object_unref (context->dest_window); - context->dest_window = NULL; + GDK_SURFACE_XID (context->dest_surface))); + g_object_unref (context->dest_surface); + context->dest_surface = NULL; } } @@ -1439,20 +1439,20 @@ xdnd_send_motion (GdkX11DragContext *context_x11, xev.xclient.format = 32; xev.xclient.window = context_x11->drop_xid ? context_x11->drop_xid - : GDK_WINDOW_XID (context->dest_window); - xev.xclient.data.l[0] = GDK_WINDOW_XID (context_x11->ipc_window); + : GDK_SURFACE_XID (context->dest_surface); + xev.xclient.data.l[0] = GDK_SURFACE_XID (context_x11->ipc_surface); xev.xclient.data.l[1] = 0; xev.xclient.data.l[2] = (x_root << 16) | y_root; xev.xclient.data.l[3] = time; xev.xclient.data.l[4] = xdnd_action_to_atom (display, action); - if (!xdnd_send_xevent (context_x11, context->dest_window, FALSE, &xev)) + if (!xdnd_send_xevent (context_x11, context->dest_surface, FALSE, &xev)) { GDK_DISPLAY_NOTE (display, DND, g_message ("Send event to %lx failed", - GDK_WINDOW_XID (context->dest_window))); - g_object_unref (context->dest_window); - context->dest_window = NULL; + GDK_SURFACE_XID (context->dest_surface))); + g_object_unref (context->dest_surface); + context->dest_surface = NULL; } context_x11->drag_status = GDK_DRAG_STATUS_MOTION_WAIT; } @@ -1546,13 +1546,13 @@ xdnd_read_actions (GdkX11DragContext *context_x11) context_x11->xdnd_have_actions = FALSE; - if (gdk_window_get_window_type (context->source_window) == GDK_WINDOW_FOREIGN) + if (gdk_surface_get_surface_type (context->source_surface) == GDK_SURFACE_FOREIGN) { /* Get the XdndActionList, if set */ gdk_x11_display_error_trap_push (display); if (XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display), - GDK_WINDOW_XID (context->source_window), + GDK_SURFACE_XID (context->source_surface), gdk_x11_get_xatom_by_name_for_display (display, "XdndActionList"), 0, 65536, False, XA_ATOM, &type, &format, &nitems, @@ -1600,8 +1600,8 @@ xdnd_read_actions (GdkX11DragContext *context_x11) GdkDragContext *source_context; source_context = gdk_drag_context_find (display, TRUE, - GDK_WINDOW_XID (context->source_window), - GDK_WINDOW_XID (context->dest_window)); + GDK_SURFACE_XID (context->source_surface), + GDK_SURFACE_XID (context->dest_surface)); if (source_context) { @@ -1618,7 +1618,7 @@ xdnd_read_actions (GdkX11DragContext *context_x11) * and add this filter. */ GdkFilterReturn -xdnd_source_window_filter (const XEvent *xevent, +xdnd_source_surface_filter (const XEvent *xevent, GdkEvent *event, gpointer data) { @@ -1644,11 +1644,11 @@ xdnd_source_window_filter (const XEvent *xevent, static void xdnd_manage_source_filter (GdkDragContext *context, - GdkWindow *window, + GdkSurface *surface, gboolean add_filter) { - if (!GDK_WINDOW_DESTROYED (window) && - gdk_window_get_window_type (window) == GDK_WINDOW_FOREIGN) + if (!GDK_SURFACE_DESTROYED (surface) && + gdk_surface_get_surface_type (surface) == GDK_SURFACE_FOREIGN) { GdkDisplay *display = gdk_drag_context_get_display (context); @@ -1656,14 +1656,14 @@ xdnd_manage_source_filter (GdkDragContext *context, if (add_filter) { - gdk_window_set_events (window, - gdk_window_get_events (window) | + gdk_surface_set_events (surface, + gdk_surface_get_events (surface) | GDK_PROPERTY_CHANGE_MASK); - g_object_set_data (G_OBJECT (window), "xdnd-source-context", context); + g_object_set_data (G_OBJECT (surface), "xdnd-source-context", context); } else { - g_object_set_data (G_OBJECT (window), "xdnd-source-context", NULL); + g_object_set_data (G_OBJECT (surface), "xdnd-source-context", NULL); /* Should we remove the GDK_PROPERTY_NOTIFY mask? * but we might want it for other reasons. (Like * INCR selection transactions). @@ -1742,26 +1742,26 @@ xdnd_enter_filter (const XEvent *xevent, guchar *data; Atom *atoms; GPtrArray *formats; - guint32 source_window; + guint32 source_surface; gboolean get_types; gint version; - if (!event->any.window || - gdk_window_get_window_type (event->any.window) == GDK_WINDOW_FOREIGN) + if (!event->any.surface || + gdk_surface_get_surface_type (event->any.surface) == GDK_SURFACE_FOREIGN) return GDK_FILTER_CONTINUE; /* Not for us */ - source_window = xevent->xclient.data.l[0]; + source_surface = xevent->xclient.data.l[0]; get_types = ((xevent->xclient.data.l[1] & 1) != 0); version = (xevent->xclient.data.l[1] & 0xff000000) >> 24; - display = GDK_WINDOW_DISPLAY (event->any.window); + display = GDK_SURFACE_DISPLAY (event->any.surface); display_x11 = GDK_X11_DISPLAY (display); xdnd_precache_atoms (display); GDK_DISPLAY_NOTE (display, DND, - g_message ("XdndEnter: source_window: %#x, version: %#x", - source_window, version)); + g_message ("XdndEnter: source_surface: %#x, version: %#x", + source_surface, version)); if (version < 3) { @@ -1788,21 +1788,21 @@ xdnd_enter_filter (const XEvent *xevent, seat = gdk_display_get_default_seat (display); gdk_drag_context_set_device (context, gdk_seat_get_pointer (seat)); - context->source_window = gdk_x11_window_foreign_new_for_display (display, source_window); - if (!context->source_window) + context->source_surface = gdk_x11_surface_foreign_new_for_display (display, source_surface); + if (!context->source_surface) { g_object_unref (context); return GDK_FILTER_REMOVE; } - context->dest_window = event->any.window; - g_object_ref (context->dest_window); + context->dest_surface = event->any.surface; + g_object_ref (context->dest_surface); formats = g_ptr_array_new (); if (get_types) { gdk_x11_display_error_trap_push (display); - XGetWindowProperty (GDK_WINDOW_XDISPLAY (event->any.window), - source_window, + XGetWindowProperty (GDK_SURFACE_XDISPLAY (event->any.surface), + source_surface, gdk_x11_get_xatom_by_name_for_display (display, "XdndTypeList"), 0, 65536, False, XA_ATOM, &type, &format, &nitems, @@ -1841,7 +1841,7 @@ xdnd_enter_filter (const XEvent *xevent, print_target_list (context->formats); #endif /* G_ENABLE_DEBUG */ - xdnd_manage_source_filter (context, context->source_window, TRUE); + xdnd_manage_source_filter (context, context->source_surface, TRUE); xdnd_read_actions (context_x11); event->any.type = GDK_DRAG_ENTER; @@ -1859,26 +1859,26 @@ xdnd_leave_filter (const XEvent *xevent, GdkEvent *event, gpointer data) { - guint32 source_window = xevent->xclient.data.l[0]; + guint32 source_surface = xevent->xclient.data.l[0]; GdkDisplay *display; GdkX11Display *display_x11; - if (!event->any.window || - gdk_window_get_window_type (event->any.window) == GDK_WINDOW_FOREIGN) + if (!event->any.surface || + gdk_surface_get_surface_type (event->any.surface) == GDK_SURFACE_FOREIGN) return GDK_FILTER_CONTINUE; /* Not for us */ - display = GDK_WINDOW_DISPLAY (event->any.window); + display = GDK_SURFACE_DISPLAY (event->any.surface); display_x11 = GDK_X11_DISPLAY (display); GDK_DISPLAY_NOTE (display, DND, - g_message ("XdndLeave: source_window: %#x", - source_window)); + g_message ("XdndLeave: source_surface: %#x", + source_surface)); xdnd_precache_atoms (display); if ((display_x11->current_dest_drag != NULL) && (GDK_X11_DRAG_CONTEXT (display_x11->current_dest_drag)->protocol == GDK_DRAG_PROTO_XDND) && - (GDK_WINDOW_XID (display_x11->current_dest_drag->source_window) == source_window)) + (GDK_SURFACE_XID (display_x11->current_dest_drag->source_surface) == source_surface)) { event->any.type = GDK_DRAG_LEAVE; /* Pass ownership of context to the event */ @@ -1898,8 +1898,8 @@ xdnd_position_filter (const XEvent *xevent, GdkEvent *event, gpointer data) { - GdkWindowImplX11 *impl; - guint32 source_window = xevent->xclient.data.l[0]; + GdkSurfaceImplX11 *impl; + guint32 source_surface = xevent->xclient.data.l[0]; gint16 x_root = xevent->xclient.data.l[2] >> 16; gint16 y_root = xevent->xclient.data.l[2] & 0xffff; guint32 time = xevent->xclient.data.l[3]; @@ -1909,16 +1909,16 @@ xdnd_position_filter (const XEvent *xevent, GdkDragContext *context; GdkX11DragContext *context_x11; - if (!event->any.window || - gdk_window_get_window_type (event->any.window) == GDK_WINDOW_FOREIGN) + if (!event->any.surface || + gdk_surface_get_surface_type (event->any.surface) == GDK_SURFACE_FOREIGN) return GDK_FILTER_CONTINUE; /* Not for us */ - display = GDK_WINDOW_DISPLAY (event->any.window); + display = GDK_SURFACE_DISPLAY (event->any.surface); display_x11 = GDK_X11_DISPLAY (display); GDK_DISPLAY_NOTE (display, DND, - g_message ("XdndPosition: source_window: %#x position: (%d, %d) time: %d action: %ld", - source_window, x_root, y_root, time, action)); + g_message ("XdndPosition: source_surface: %#x position: (%d, %d) time: %d action: %ld", + source_surface, x_root, y_root, time, action)); xdnd_precache_atoms (display); @@ -1926,9 +1926,9 @@ xdnd_position_filter (const XEvent *xevent, if ((context != NULL) && (GDK_X11_DRAG_CONTEXT (context)->protocol == GDK_DRAG_PROTO_XDND) && - (GDK_WINDOW_XID (context->source_window) == source_window)) + (GDK_SURFACE_XID (context->source_surface) == source_surface)) { - impl = GDK_WINDOW_IMPL_X11 (event->any.window->impl); + impl = GDK_SURFACE_IMPL_X11 (event->any.surface->impl); context_x11 = GDK_X11_DRAG_CONTEXT (context); @@ -1944,11 +1944,11 @@ xdnd_position_filter (const XEvent *xevent, if (!context_x11->xdnd_have_actions) context->actions = context->suggested_action; - event->dnd.x_root = x_root / impl->window_scale; - event->dnd.y_root = y_root / impl->window_scale; + event->dnd.x_root = x_root / impl->surface_scale; + event->dnd.y_root = y_root / impl->surface_scale; - context_x11->last_x = x_root / impl->window_scale; - context_x11->last_y = y_root / impl->window_scale; + context_x11->last_x = x_root / impl->surface_scale; + context_x11->last_y = y_root / impl->surface_scale; return GDK_FILTER_TRANSLATE; } @@ -1961,23 +1961,23 @@ xdnd_drop_filter (const XEvent *xevent, GdkEvent *event, gpointer data) { - guint32 source_window = xevent->xclient.data.l[0]; + guint32 source_surface = xevent->xclient.data.l[0]; guint32 time = xevent->xclient.data.l[2]; GdkDisplay *display; GdkX11Display *display_x11; GdkDragContext *context; GdkX11DragContext *context_x11; - if (!event->any.window || - gdk_window_get_window_type (event->any.window) == GDK_WINDOW_FOREIGN) + if (!event->any.surface || + gdk_surface_get_surface_type (event->any.surface) == GDK_SURFACE_FOREIGN) return GDK_FILTER_CONTINUE; /* Not for us */ - display = GDK_WINDOW_DISPLAY (event->any.window); + display = GDK_SURFACE_DISPLAY (event->any.surface); display_x11 = GDK_X11_DISPLAY (display); GDK_DISPLAY_NOTE (display, DND, - g_message ("XdndDrop: source_window: %#x time: %d", - source_window, time)); + g_message ("XdndDrop: source_surface: %#x time: %d", + source_surface, time)); xdnd_precache_atoms (display); @@ -1985,7 +1985,7 @@ xdnd_drop_filter (const XEvent *xevent, if ((context != NULL) && (GDK_X11_DRAG_CONTEXT (context)->protocol == GDK_DRAG_PROTO_XDND) && - (GDK_WINDOW_XID (context->source_window) == source_window)) + (GDK_SURFACE_XID (context->source_surface) == source_surface)) { context_x11 = GDK_X11_DRAG_CONTEXT (context); event->any.type = GDK_DROP_START; @@ -1998,7 +1998,7 @@ xdnd_drop_filter (const XEvent *xevent, event->dnd.x_root = context_x11->last_x; event->dnd.y_root = context_x11->last_y; - gdk_x11_window_set_user_time (event->any.window, time); + gdk_x11_surface_set_user_time (event->any.surface, time); return GDK_FILTER_TRANSLATE; } @@ -2014,13 +2014,13 @@ _gdk_x11_dnd_filter (const XEvent *xevent, GdkDisplay *display; int i; - if (!GDK_IS_X11_WINDOW (event->any.window)) + if (!GDK_IS_X11_SURFACE (event->any.surface)) return GDK_FILTER_CONTINUE; if (xevent->type != ClientMessage) return GDK_FILTER_CONTINUE; - display = GDK_WINDOW_DISPLAY (event->any.window); + display = GDK_SURFACE_DISPLAY (event->any.surface); for (i = 0; i < G_N_ELEMENTS (xdnd_filters); i++) { @@ -2041,7 +2041,7 @@ gdk_drag_do_leave (GdkX11DragContext *context_x11, { GdkDragContext *context = GDK_DRAG_CONTEXT (context_x11); - if (context->dest_window) + if (context->dest_surface) { switch (context_x11->protocol) { @@ -2054,21 +2054,21 @@ gdk_drag_do_leave (GdkX11DragContext *context_x11, break; } - g_object_unref (context->dest_window); - context->dest_window = NULL; + g_object_unref (context->dest_surface); + context->dest_surface = NULL; } } -static GdkWindow * -create_drag_window (GdkDisplay *display) +static GdkSurface * +create_drag_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; } static Window @@ -2078,16 +2078,16 @@ _gdk_x11_display_get_drag_protocol (GdkDisplay *display, guint *version) { - GdkWindow *window; + GdkSurface *surface; Window retval; base_precache_atoms (display); /* Check for a local drag */ - window = gdk_x11_window_lookup_for_display (display, xid); - if (window && gdk_window_get_window_type (window) != GDK_WINDOW_FOREIGN) + surface = gdk_x11_surface_lookup_for_display (display, xid); + if (surface && gdk_surface_get_surface_type (surface) != GDK_SURFACE_FOREIGN) { - if (g_object_get_data (G_OBJECT (window), "gdk-dnd-registered") != NULL) + if (g_object_get_data (G_OBJECT (surface), "gdk-dnd-registered") != NULL) { *protocol = GDK_DRAG_PROTO_XDND; *version = 5; @@ -2130,39 +2130,39 @@ _gdk_x11_display_get_drag_protocol (GdkDisplay *display, return 0; /* a.k.a. None */ } -static GdkWindowCache * +static GdkSurfaceCache * drag_context_find_window_cache (GdkX11DragContext *context_x11, GdkDisplay *display) { if (!context_x11->cache) - context_x11->cache = gdk_window_cache_get (display); + context_x11->cache = gdk_surface_cache_get (display); return context_x11->cache; } -static GdkWindow * -gdk_x11_drag_context_find_window (GdkDragContext *context, - GdkWindow *drag_window, - gint x_root, - gint y_root, - GdkDragProtocol *protocol) +static GdkSurface * +gdk_x11_drag_context_find_surface (GdkDragContext *context, + GdkSurface *drag_surface, + gint x_root, + gint y_root, + GdkDragProtocol *protocol) { GdkX11Screen *screen_x11 = GDK_X11_SCREEN(GDK_X11_DISPLAY (context->display)->screen); GdkX11DragContext *context_x11 = GDK_X11_DRAG_CONTEXT (context); - GdkWindowCache *window_cache; + GdkSurfaceCache *window_cache; GdkDisplay *display; Window dest; - GdkWindow *dest_window; + GdkSurface *dest_surface; display = gdk_drag_context_get_display (context); window_cache = drag_context_find_window_cache (context_x11, display); dest = get_client_window_at_coords (window_cache, - drag_window && GDK_WINDOW_IS_X11 (drag_window) ? - GDK_WINDOW_XID (drag_window) : None, - x_root * screen_x11->window_scale, - y_root * screen_x11->window_scale); + drag_surface && GDK_SURFACE_IS_X11 (drag_surface) ? + GDK_SURFACE_XID (drag_surface) : None, + x_root * screen_x11->surface_scale, + y_root * screen_x11->surface_scale); if (context_x11->dest_xid != dest) { @@ -2172,7 +2172,7 @@ gdk_x11_drag_context_find_window (GdkDragContext *context, /* Check if new destination accepts drags, and which protocol */ /* There is some ugliness here. We actually need to pass - * _three_ pieces of information to drag_motion - dest_window, + * _three_ pieces of information to drag_motion - dest_surface, * protocol, and the XID of the unproxied window. The first * two are passed explicitly, the third implicitly through * protocol->dest_xid. @@ -2183,37 +2183,37 @@ gdk_x11_drag_context_find_window (GdkDragContext *context, &context_x11->version); if (recipient != None) - dest_window = gdk_x11_window_foreign_new_for_display (display, recipient); + dest_surface = gdk_x11_surface_foreign_new_for_display (display, recipient); else - dest_window = NULL; + dest_surface = NULL; } else { - dest_window = context->dest_window; - if (dest_window) - g_object_ref (dest_window); + dest_surface = context->dest_surface; + if (dest_surface) + g_object_ref (dest_surface); *protocol = context_x11->protocol; } - return dest_window; + return dest_surface; } static void -move_drag_window (GdkDragContext *context, +move_drag_surface (GdkDragContext *context, guint x_root, guint y_root) { GdkX11DragContext *context_x11 = GDK_X11_DRAG_CONTEXT (context); - gdk_window_move (context_x11->drag_window, + gdk_surface_move (context_x11->drag_surface, x_root - context_x11->hot_x, y_root - context_x11->hot_y); - gdk_window_raise (context_x11->drag_window); + gdk_surface_raise (context_x11->drag_surface); } static gboolean gdk_x11_drag_context_drag_motion (GdkDragContext *context, - GdkWindow *dest_window, + GdkSurface *dest_surface, GdkDragProtocol protocol, gint x_root, gint y_root, @@ -2222,10 +2222,10 @@ gdk_x11_drag_context_drag_motion (GdkDragContext *context, guint32 time) { GdkX11DragContext *context_x11 = GDK_X11_DRAG_CONTEXT (context); - GdkWindowImplX11 *impl; + GdkSurfaceImplX11 *impl; - if (context_x11->drag_window) - move_drag_window (context, x_root, y_root); + if (context_x11->drag_surface) + move_drag_surface (context, x_root, y_root); context_x11->old_actions = context->actions; context->actions = possible_actions; @@ -2243,12 +2243,12 @@ gdk_x11_drag_context_drag_motion (GdkDragContext *context, * gdk_drag_find_window(). This happens, e.g. * when GTK+ is proxying DND events to embedded windows. */ - if (dest_window) + if (dest_surface) { - GdkDisplay *display = GDK_WINDOW_DISPLAY (dest_window); + GdkDisplay *display = GDK_SURFACE_DISPLAY (dest_surface); xdnd_check_dest (display, - GDK_WINDOW_XID (dest_window), + GDK_SURFACE_XID (dest_surface), &context_x11->version); } } @@ -2258,18 +2258,18 @@ gdk_x11_drag_context_drag_motion (GdkDragContext *context, */ if (protocol == GDK_DRAG_PROTO_XDND && !context_x11->xdnd_actions_set) { - if (dest_window) + if (dest_surface) { - if (gdk_window_get_window_type (dest_window) == GDK_WINDOW_FOREIGN) + if (gdk_surface_get_surface_type (dest_surface) == GDK_SURFACE_FOREIGN) xdnd_set_actions (context_x11); - else if (context->dest_window == dest_window) + else if (context->dest_surface == dest_surface) { - GdkDisplay *display = GDK_WINDOW_DISPLAY (dest_window); + GdkDisplay *display = GDK_SURFACE_DISPLAY (dest_surface); GdkDragContext *dest_context; dest_context = gdk_drag_context_find (display, FALSE, - GDK_WINDOW_XID (context->source_window), - GDK_WINDOW_XID (dest_window)); + GDK_SURFACE_XID (context->source_surface), + GDK_SURFACE_XID (dest_surface)); if (dest_context) { @@ -2280,7 +2280,7 @@ gdk_x11_drag_context_drag_motion (GdkDragContext *context, } } - if (context->dest_window != dest_window) + if (context->dest_surface != dest_surface) { /* Send a leave to the last destination */ gdk_drag_do_leave (context_x11, time); @@ -2288,11 +2288,11 @@ gdk_x11_drag_context_drag_motion (GdkDragContext *context, /* Check if new destination accepts drags, and which protocol */ - if (dest_window) + if (dest_surface) { - context->dest_window = dest_window; + context->dest_surface = dest_surface; context_x11->drop_xid = context_x11->dest_xid; - g_object_ref (context->dest_window); + g_object_ref (context->dest_surface); context_x11->protocol = protocol; switch (protocol) @@ -2312,7 +2312,7 @@ gdk_x11_drag_context_drag_motion (GdkDragContext *context, } else { - context->dest_window = NULL; + context->dest_surface = NULL; context_x11->drop_xid = None; context->action = 0; } @@ -2337,16 +2337,16 @@ gdk_x11_drag_context_drag_motion (GdkDragContext *context, context_x11->last_x = x_root; context_x11->last_y = y_root; - if (context->dest_window) + if (context->dest_surface) { - impl = GDK_WINDOW_IMPL_X11 (context->dest_window->impl); + impl = GDK_SURFACE_IMPL_X11 (context->dest_surface->impl); if (context_x11->drag_status == GDK_DRAG_STATUS_DRAG) { switch (context_x11->protocol) { case GDK_DRAG_PROTO_XDND: - xdnd_send_motion (context_x11, x_root * impl->window_scale, y_root * impl->window_scale, suggested_action, time); + xdnd_send_motion (context_x11, x_root * impl->surface_scale, y_root * impl->surface_scale, suggested_action, time); break; case GDK_DRAG_PROTO_ROOTWIN: @@ -2394,7 +2394,7 @@ gdk_x11_drag_context_drag_drop (GdkDragContext *context, { GdkX11DragContext *context_x11 = GDK_X11_DRAG_CONTEXT (context); - if (context->dest_window) + if (context->dest_surface) { switch (context_x11->protocol) { @@ -2435,18 +2435,18 @@ gdk_x11_drag_context_drag_status (GdkDragContext *context, xev.xclient.type = ClientMessage; xev.xclient.message_type = gdk_x11_get_xatom_by_name_for_display (display, "XdndStatus"); xev.xclient.format = 32; - xev.xclient.window = GDK_WINDOW_XID (context->source_window); + xev.xclient.window = GDK_SURFACE_XID (context->source_surface); - xev.xclient.data.l[0] = GDK_WINDOW_XID (context->dest_window); + xev.xclient.data.l[0] = GDK_SURFACE_XID (context->dest_surface); xev.xclient.data.l[1] = (action != 0) ? (2 | 1) : 0; xev.xclient.data.l[2] = 0; xev.xclient.data.l[3] = 0; xev.xclient.data.l[4] = xdnd_action_to_atom (display, action); - if (!xdnd_send_xevent (context_x11, context->source_window, FALSE, &xev)) + if (!xdnd_send_xevent (context_x11, context->source_surface, FALSE, &xev)) { GDK_DISPLAY_NOTE (display, DND, g_message ("Send event to %lx failed", - GDK_WINDOW_XID (context->source_window))); + GDK_SURFACE_XID (context->source_surface))); } } @@ -2476,7 +2476,7 @@ gdk_x11_drag_context_drop_finish (GdkDragContext *context, gdk_x11_get_xatom_by_name_for_display (display, "XdndSelection"), gdk_x11_get_xatom_by_name_for_display (display, "DELETE"), gdk_x11_get_xatom_by_name_for_display (display, "GDK_SELECTION"), - GDK_WINDOW_XID (context->source_window), + GDK_SURFACE_XID (context->source_surface), time); /* XXX: Do we need to wait for a reply here before sending the next message? */ } @@ -2484,9 +2484,9 @@ gdk_x11_drag_context_drop_finish (GdkDragContext *context, xev.xclient.type = ClientMessage; xev.xclient.message_type = gdk_x11_get_xatom_by_name_for_display (display, "XdndFinished"); xev.xclient.format = 32; - xev.xclient.window = GDK_WINDOW_XID (context->source_window); + xev.xclient.window = GDK_SURFACE_XID (context->source_surface); - xev.xclient.data.l[0] = GDK_WINDOW_XID (context->dest_window); + xev.xclient.data.l[0] = GDK_SURFACE_XID (context->dest_surface); if (success) { xev.xclient.data.l[1] = 1; @@ -2501,35 +2501,35 @@ gdk_x11_drag_context_drop_finish (GdkDragContext *context, xev.xclient.data.l[3] = 0; xev.xclient.data.l[4] = 0; - if (!xdnd_send_xevent (GDK_X11_DRAG_CONTEXT (context), context->source_window, FALSE, &xev)) + if (!xdnd_send_xevent (GDK_X11_DRAG_CONTEXT (context), context->source_surface, FALSE, &xev)) { GDK_DISPLAY_NOTE (display, DND, g_message ("Send event to %lx failed", - GDK_WINDOW_XID (context->source_window))); + GDK_SURFACE_XID (context->source_surface))); } } } void -_gdk_x11_window_register_dnd (GdkWindow *window) +_gdk_x11_surface_register_dnd (GdkSurface *surface) { static const gulong xdnd_version = 5; - GdkDisplay *display = gdk_window_get_display (window); + GdkDisplay *display = gdk_surface_get_display (surface); - g_return_if_fail (window != NULL); + g_return_if_fail (surface != NULL); base_precache_atoms (display); - if (g_object_get_data (G_OBJECT (window), "gdk-dnd-registered") != NULL) + if (g_object_get_data (G_OBJECT (surface), "gdk-dnd-registered") != NULL) return; else - g_object_set_data (G_OBJECT (window), "gdk-dnd-registered", GINT_TO_POINTER (TRUE)); + g_object_set_data (G_OBJECT (surface), "gdk-dnd-registered", GINT_TO_POINTER (TRUE)); /* Set XdndAware */ /* The property needs to be of type XA_ATOM, not XA_INTEGER. Blech */ XChangeProperty (GDK_DISPLAY_XDISPLAY (display), - GDK_WINDOW_XID (window), + GDK_SURFACE_XID (surface), gdk_x11_get_xatom_by_name_for_display (display, "XdndAware"), XA_ATOM, 32, PropModeReplace, (guchar *)&xdnd_version, 1); @@ -2541,10 +2541,10 @@ gdk_x11_drag_context_drop_status (GdkDragContext *context) return ! GDK_X11_DRAG_CONTEXT (context)->drop_failed; } -static GdkWindow * -gdk_x11_drag_context_get_drag_window (GdkDragContext *context) +static GdkSurface * +gdk_x11_drag_context_get_drag_surface (GdkDragContext *context) { - return GDK_X11_DRAG_CONTEXT (context)->drag_window; + return GDK_X11_DRAG_CONTEXT (context)->drag_surface; } static void @@ -2560,7 +2560,7 @@ gdk_x11_drag_context_set_hotspot (GdkDragContext *context, if (x11_context->grab_seat) { /* DnD is managed, update current position */ - move_drag_window (context, x11_context->last_x, x11_context->last_y); + move_drag_surface (context, x11_context->last_x, x11_context->last_y); } } @@ -2603,7 +2603,7 @@ gdk_x11_drag_context_xevent (GdkDisplay *display, Window xwindow; Atom xselection; - xwindow = GDK_WINDOW_XID (x11_context->ipc_window); + xwindow = GDK_SURFACE_XID (x11_context->ipc_surface); xselection = gdk_x11_get_xatom_by_name_for_display (display, "XdndSelection"); if (xevent->xany.window != xwindow) @@ -2713,11 +2713,11 @@ gdk_drag_anim_timeout (gpointer data) t = ease_out_cubic (f); - gdk_window_show (context->drag_window); - gdk_window_move (context->drag_window, + gdk_surface_show (context->drag_surface); + gdk_surface_move (context->drag_surface, context->last_x + (context->start_x - context->last_x) * t, context->last_y + (context->start_y - context->last_y) * t); - gdk_window_set_opacity (context->drag_window, 1.0 - f); + gdk_surface_set_opacity (context->drag_surface, 1.0 - f); return G_SOURCE_CONTINUE; } @@ -2734,7 +2734,7 @@ gdk_x11_drag_context_release_selection (GdkDragContext *context) display = gdk_drag_context_get_display (context); xdisplay = GDK_DISPLAY_XDISPLAY (display); xselection = gdk_x11_get_xatom_by_name_for_display (display, "XdndSelection"); - xwindow = GDK_WINDOW_XID (x11_context->ipc_window); + xwindow = GDK_SURFACE_XID (x11_context->ipc_surface); if (XGetSelectionOwner (xdisplay, xselection) == xwindow) XSetSelectionOwner (xdisplay, xselection, None, CurrentTime); @@ -2758,15 +2758,15 @@ gdk_x11_drag_context_drop_done (GdkDragContext *context, context); if (success) { - gdk_window_hide (x11_context->drag_window); + gdk_surface_hide (x11_context->drag_surface); return; } - win_surface = _gdk_window_ref_cairo_surface (x11_context->drag_window); - surface = gdk_window_create_similar_surface (x11_context->drag_window, + win_surface = _gdk_surface_ref_cairo_surface (x11_context->drag_surface); + surface = gdk_surface_create_similar_surface (x11_context->drag_surface, cairo_surface_get_content (win_surface), - gdk_window_get_width (x11_context->drag_window), - gdk_window_get_height (x11_context->drag_window)); + gdk_surface_get_width (x11_context->drag_surface), + gdk_surface_get_height (x11_context->drag_surface)); cr = cairo_create (surface); cairo_set_source_surface (cr, win_surface, 0, 0); cairo_paint (cr); @@ -2776,7 +2776,7 @@ gdk_x11_drag_context_drop_done (GdkDragContext *context, /* pattern = cairo_pattern_create_for_surface (surface); - gdk_window_set_background_pattern (x11_context->drag_window, pattern); + gdk_surface_set_background_pattern (x11_context->drag_surface, pattern); cairo_pattern_destroy (pattern); */ @@ -2784,7 +2784,7 @@ gdk_x11_drag_context_drop_done (GdkDragContext *context, anim = g_slice_new0 (GdkDragAnim); anim->context = g_object_ref (x11_context); - anim->frame_clock = gdk_window_get_frame_clock (x11_context->drag_window); + anim->frame_clock = gdk_surface_get_frame_clock (x11_context->drag_surface); anim->start_time = gdk_frame_clock_get_frame_time (anim->frame_clock); id = g_timeout_add_full (G_PRIORITY_DEFAULT, 17, @@ -2805,7 +2805,7 @@ drag_context_grab (GdkDragContext *context) gint keycode, i; GdkCursor *cursor; - if (!x11_context->ipc_window) + if (!x11_context->ipc_surface) return FALSE; display = gdk_drag_context_get_display (context); @@ -2822,7 +2822,7 @@ drag_context_grab (GdkDragContext *context) cursor = gdk_drag_get_cursor (context, x11_context->current_action); g_set_object (&x11_context->cursor, cursor); - if (gdk_seat_grab (seat, x11_context->ipc_window, + if (gdk_seat_grab (seat, x11_context->ipc_surface, capabilities, FALSE, x11_context->cursor, NULL, NULL, NULL) != GDK_GRAB_SUCCESS) return FALSE; @@ -2939,7 +2939,7 @@ drag_context_ungrab (GdkDragContext *context) } GdkDragContext * -_gdk_x11_window_drag_begin (GdkWindow *window, +_gdk_x11_surface_drag_begin (GdkSurface *surface, GdkDevice *device, GdkContentProvider *content, GdkDragAction actions, @@ -2952,7 +2952,7 @@ _gdk_x11_window_drag_begin (GdkWindow *window, int x_root, y_root; Atom xselection; - display = gdk_window_get_display (window); + display = gdk_surface_get_display (surface); context = (GdkDragContext *) g_object_new (GDK_TYPE_X11_DRAG_CONTEXT, "display", display, @@ -2978,15 +2978,15 @@ _gdk_x11_window_drag_begin (GdkWindow *window, x11_context->protocol = GDK_DRAG_PROTO_XDND; x11_context->actions = actions; - x11_context->ipc_window = gdk_window_new_popup (display, &(GdkRectangle) { -99, -99, 1, 1 }); - if (gdk_window_get_group (window)) - gdk_window_set_group (x11_context->ipc_window, window); - gdk_window_show (x11_context->ipc_window); + x11_context->ipc_surface = gdk_surface_new_popup (display, &(GdkRectangle) { -99, -99, 1, 1 }); + if (gdk_surface_get_group (surface)) + gdk_surface_set_group (x11_context->ipc_surface, surface); + gdk_surface_show (x11_context->ipc_surface); - context->source_window = x11_context->ipc_window; - g_object_ref (context->source_window); + context->source_surface = x11_context->ipc_surface; + g_object_ref (context->source_surface); - x11_context->drag_window = create_drag_window (display); + x11_context->drag_surface = create_drag_surface (display); if (!drag_context_grab (context)) { @@ -2994,15 +2994,15 @@ _gdk_x11_window_drag_begin (GdkWindow *window, return NULL; } - move_drag_window (context, x_root, y_root); + move_drag_surface (context, x_root, y_root); x11_context->timestamp = gdk_display_get_last_seen_time (display); xselection = gdk_x11_get_xatom_by_name_for_display (display, "XdndSelection"); XSetSelectionOwner (GDK_DISPLAY_XDISPLAY (display), xselection, - GDK_WINDOW_XID (x11_context->ipc_window), + GDK_SURFACE_XID (x11_context->ipc_surface), x11_context->timestamp); - if (XGetSelectionOwner (GDK_DISPLAY_XDISPLAY (display), xselection) != GDK_WINDOW_XID (x11_context->ipc_window)) + if (XGetSelectionOwner (GDK_DISPLAY_XDISPLAY (display), xselection) != GDK_SURFACE_XID (x11_context->ipc_surface)) { GDK_DISPLAY_NOTE (display, DND, g_printerr ("failed XSetSelectionOwner() on \"XdndSelection\", aborting DND\n")); g_object_unref (context); @@ -3025,7 +3025,7 @@ gdk_x11_drag_context_set_cursor (GdkDragContext *context, { G_GNUC_BEGIN_IGNORE_DEPRECATIONS; gdk_device_grab (gdk_seat_get_pointer (x11_context->grab_seat), - x11_context->ipc_window, + x11_context->ipc_surface, GDK_OWNERSHIP_APPLICATION, FALSE, GDK_POINTER_MOTION_MASK | GDK_BUTTON_RELEASE_MASK, cursor, GDK_CURRENT_TIME); @@ -3118,17 +3118,17 @@ gdk_drag_update (GdkDragContext *context, { GdkX11DragContext *x11_context = GDK_X11_DRAG_CONTEXT (context); GdkDragAction action, possible_actions; - GdkWindow *dest_window; + GdkSurface *dest_surface; GdkDragProtocol protocol; gdk_drag_get_current_actions (mods, GDK_BUTTON_PRIMARY, x11_context->actions, &action, &possible_actions); - dest_window = gdk_x11_drag_context_find_window (context, - x11_context->drag_window, - x_root, y_root, &protocol); + dest_surface = gdk_x11_drag_context_find_surface (context, + x11_context->drag_surface, + x_root, y_root, &protocol); - gdk_x11_drag_context_drag_motion (context, dest_window, protocol, x_root, y_root, + gdk_x11_drag_context_drag_motion (context, dest_surface, protocol, x_root, y_root, action, possible_actions, evtime); } @@ -3173,7 +3173,7 @@ gdk_dnd_handle_key_event (GdkDragContext *context, case GDK_KEY_KP_Enter: case GDK_KEY_KP_Space: if ((gdk_drag_context_get_selected_action (context) != 0) && - (gdk_drag_context_get_dest_window (context) != NULL)) + (gdk_drag_context_get_dest_surface (context) != NULL)) { g_signal_emit_by_name (context, "drop-performed", gdk_event_get_time ((GdkEvent *) event)); @@ -3238,8 +3238,8 @@ gdk_dnd_handle_grab_broken_event (GdkDragContext *context, * example, when changing the drag cursor. */ if (event->implicit || - event->grab_window == x11_context->drag_window || - event->grab_window == x11_context->ipc_window) + event->grab_surface == x11_context->drag_surface || + event->grab_surface == x11_context->ipc_surface) return FALSE; if (gdk_event_get_device ((GdkEvent *) event) != @@ -3261,7 +3261,7 @@ gdk_dnd_handle_button_event (GdkDragContext *context, #endif if ((gdk_drag_context_get_selected_action (context) != 0) && - (gdk_drag_context_get_dest_window (context) != NULL)) + (gdk_drag_context_get_dest_surface (context) != NULL)) { g_signal_emit_by_name (context, "drop-performed", gdk_event_get_time ((GdkEvent *) event)); diff --git a/gdk/x11/gdkeventsource.c b/gdk/x11/gdkeventsource.c index 45b5df94ad..a4bbea0079 100644 --- a/gdk/x11/gdkeventsource.c +++ b/gdk/x11/gdkeventsource.c @@ -20,7 +20,7 @@ #include "gdkeventsource.h" #include "gdkinternals.h" -#include "gdkwindow-x11.h" +#include "gdksurface-x11.h" #include "gdkprivate-x11.h" #include "gdkdisplay-x11.h" #include "xsettings-client.h" @@ -55,13 +55,13 @@ static GSourceFuncs event_funcs = { gdk_event_source_finalize }; -static GdkWindow * -gdk_event_source_get_filter_window (GdkEventSource *event_source, - const XEvent *xevent, - GdkEventTranslator **event_translator) +static GdkSurface * +gdk_event_source_get_filter_surface (GdkEventSource *event_source, + const XEvent *xevent, + GdkEventTranslator **event_translator) { GList *list = event_source->translators; - GdkWindow *window; + GdkSurface *surface; *event_translator = NULL; @@ -70,23 +70,23 @@ gdk_event_source_get_filter_window (GdkEventSource *event_source, GdkEventTranslator *translator = list->data; list = list->next; - window = _gdk_x11_event_translator_get_window (translator, + surface = _gdk_x11_event_translator_get_surface (translator, event_source->display, xevent); - if (window) + if (surface) { *event_translator = translator; - return window; + return surface; } } - window = gdk_x11_window_lookup_for_display (event_source->display, + surface = gdk_x11_surface_lookup_for_display (event_source->display, xevent->xany.window); - if (window && !GDK_IS_WINDOW (window)) - window = NULL; + if (surface && !GDK_IS_SURFACE (surface)) + surface = NULL; - return window; + return surface; } static void @@ -96,8 +96,8 @@ handle_focus_change (GdkEventCrossing *event) GdkX11Screen *x11_screen; gboolean focus_in, had_focus; - toplevel = _gdk_x11_window_get_toplevel (event->any.window); - x11_screen = GDK_X11_SCREEN (GDK_WINDOW_SCREEN (event->any.window)); + toplevel = _gdk_x11_surface_get_toplevel (event->any.surface); + x11_screen = GDK_X11_SCREEN (GDK_SURFACE_SCREEN (event->any.surface)); focus_in = (event->any.type == GDK_ENTER_NOTIFY); if (x11_screen->wmspec_check_window) @@ -119,12 +119,12 @@ handle_focus_change (GdkEventCrossing *event) GdkEvent *focus_event; focus_event = gdk_event_new (GDK_FOCUS_CHANGE); - focus_event->any.window = g_object_ref (event->any.window); + focus_event->any.surface = g_object_ref (event->any.surface); focus_event->any.send_event = FALSE; focus_event->focus_change.in = focus_in; gdk_event_set_device (focus_event, gdk_event_get_device ((GdkEvent *) event)); - gdk_display_put_event (gdk_window_get_display (event->any.window), focus_event); + gdk_display_put_event (gdk_surface_get_display (event->any.surface), focus_event); g_object_unref (focus_event); } } @@ -142,7 +142,7 @@ create_synth_crossing_event (GdkEventType evtype, event = gdk_event_new (evtype); event->any.send_event = TRUE; - event->any.window = g_object_ref (real_event->any.window); + event->any.surface = g_object_ref (real_event->any.surface); event->crossing.detail = GDK_NOTIFY_ANCESTOR; event->crossing.mode = mode; event->crossing.time = gdk_event_get_time (real_event); @@ -232,7 +232,7 @@ gdk_event_source_translate_event (GdkX11Display *x11_display, GdkFilterReturn result = GDK_FILTER_CONTINUE; GdkDisplay *display = GDK_DISPLAY (x11_display); GdkEventTranslator *event_translator; - GdkWindow *filter_window; + GdkSurface *filter_surface; Display *dpy; GdkX11Screen *x11_screen; gpointer cache; @@ -241,10 +241,10 @@ gdk_event_source_translate_event (GdkX11Display *x11_display, dpy = GDK_DISPLAY_XDISPLAY (display); - filter_window = gdk_event_source_get_filter_window (event_source, xevent, + filter_surface = gdk_event_source_get_filter_surface (event_source, xevent, &event_translator); - if (filter_window) - event->any.window = g_object_ref (filter_window); + if (filter_surface) + event->any.surface = g_object_ref (filter_surface); /* apply XSettings filters */ if (xevent->xany.window == XRootWindow (dpy, 0)) @@ -254,15 +254,15 @@ gdk_event_source_translate_event (GdkX11Display *x11_display, xevent->xany.window == x11_screen->xsettings_manager_window) result = gdk_xsettings_manager_window_filter (xevent, event, x11_screen); - cache = gdk_window_cache_get (display); + cache = gdk_surface_cache_get (display); if (cache) { if (result == GDK_FILTER_CONTINUE) - result = gdk_window_cache_shape_filter (xevent, event, cache); + result = gdk_surface_cache_shape_filter (xevent, event, cache); if (result == GDK_FILTER_CONTINUE && xevent->xany.window == XRootWindow (dpy, 0)) - result = gdk_window_cache_filter (xevent, event, cache); + result = gdk_surface_cache_filter (xevent, event, cache); } if (result == GDK_FILTER_CONTINUE) @@ -271,10 +271,10 @@ gdk_event_source_translate_event (GdkX11Display *x11_display, if (result == GDK_FILTER_CONTINUE) result = _gdk_x11_dnd_filter (xevent, event, NULL); - if (result == GDK_FILTER_CONTINUE && filter_window) + if (result == GDK_FILTER_CONTINUE && filter_surface) { - gpointer context = g_object_get_data (G_OBJECT (filter_window), "xdnd-source-context"); - result = xdnd_source_window_filter (xevent, event, context); + gpointer context = g_object_get_data (G_OBJECT (filter_surface), "xdnd-source-context"); + result = xdnd_source_surface_filter (xevent, event, context); } if (result != GDK_FILTER_CONTINUE) @@ -316,7 +316,7 @@ gdk_event_source_translate_event (GdkX11Display *x11_display, if (event && (event->any.type == GDK_ENTER_NOTIFY || event->any.type == GDK_LEAVE_NOTIFY) && - event->any.window != NULL) + event->any.surface != NULL) { /* Handle focusing (in the case where no window manager is running */ handle_focus_change (&event->crossing); @@ -523,7 +523,7 @@ gdk_x11_event_source_select_events (GdkEventSource *source, if (mask != 0) { - _gdk_x11_event_translator_select_window_events (translator, window, mask); + _gdk_x11_event_translator_select_surface_events (translator, window, mask); event_mask &= ~mask; } diff --git a/gdk/x11/gdkeventtranslator.c b/gdk/x11/gdkeventtranslator.c index 7bb4c6668e..7344b882bc 100644 --- a/gdk/x11/gdkeventtranslator.c +++ b/gdk/x11/gdkeventtranslator.c @@ -18,7 +18,7 @@ #include "config.h" #include "gdkeventtranslator.h" -#include "gdkwindow-x11.h" +#include "gdksurface-x11.h" typedef GdkEventTranslatorIface GdkEventTranslatorInterface; G_DEFINE_INTERFACE (GdkEventTranslator, _gdk_x11_event_translator, G_TYPE_OBJECT); @@ -72,7 +72,7 @@ _gdk_x11_event_translator_get_handled_events (GdkEventTranslator *translator) } void -_gdk_x11_event_translator_select_window_events (GdkEventTranslator *translator, +_gdk_x11_event_translator_select_surface_events (GdkEventTranslator *translator, Window window, GdkEventMask event_mask) { @@ -82,14 +82,14 @@ _gdk_x11_event_translator_select_window_events (GdkEventTranslator *translator, iface = GDK_EVENT_TRANSLATOR_GET_IFACE (translator); - if (iface->select_window_events) - iface->select_window_events (translator, window, event_mask); + if (iface->select_surface_events) + iface->select_surface_events (translator, window, event_mask); } -GdkWindow * -_gdk_x11_event_translator_get_window (GdkEventTranslator *translator, - GdkDisplay *display, - const XEvent *xevent) +GdkSurface * +_gdk_x11_event_translator_get_surface (GdkEventTranslator *translator, + GdkDisplay *display, + const XEvent *xevent) { GdkEventTranslatorIface *iface; @@ -97,8 +97,8 @@ _gdk_x11_event_translator_get_window (GdkEventTranslator *translator, iface = GDK_EVENT_TRANSLATOR_GET_IFACE (translator); - if (iface->get_window) - return iface->get_window (translator, xevent); + if (iface->get_surface) + return iface->get_surface (translator, xevent); return NULL; } diff --git a/gdk/x11/gdkeventtranslator.h b/gdk/x11/gdkeventtranslator.h index 1bd9d78d5f..5cbc41d539 100644 --- a/gdk/x11/gdkeventtranslator.h +++ b/gdk/x11/gdkeventtranslator.h @@ -44,10 +44,10 @@ struct _GdkEventTranslatorIface const XEvent *xevent); GdkEventMask (* get_handled_events) (GdkEventTranslator *translator); - void (* select_window_events) (GdkEventTranslator *translator, + void (* select_surface_events) (GdkEventTranslator *translator, Window window, GdkEventMask event_mask); - GdkWindow * (* get_window) (GdkEventTranslator *translator, + GdkSurface * (* get_surface) (GdkEventTranslator *translator, const XEvent *xevent); }; @@ -57,10 +57,10 @@ GdkEvent * _gdk_x11_event_translator_translate (GdkEventTranslator *translator, GdkDisplay *display, const XEvent *xevent); GdkEventMask _gdk_x11_event_translator_get_handled_events (GdkEventTranslator *translator); -void _gdk_x11_event_translator_select_window_events (GdkEventTranslator *translator, +void _gdk_x11_event_translator_select_surface_events (GdkEventTranslator *translator, Window window, GdkEventMask event_mask); -GdkWindow * _gdk_x11_event_translator_get_window (GdkEventTranslator *translator, +GdkSurface * _gdk_x11_event_translator_get_surface (GdkEventTranslator *translator, GdkDisplay *display, const XEvent *xevent); diff --git a/gdk/x11/gdkgeometry-x11.c b/gdk/x11/gdkgeometry-x11.c index 6d299fe475..268f852fc7 100644 --- a/gdk/x11/gdkgeometry-x11.c +++ b/gdk/x11/gdkgeometry-x11.c @@ -22,15 +22,15 @@ #include "gdkprivate-x11.h" #include "gdkscreen-x11.h" #include "gdkdisplay-x11.h" -#include "gdkwindow-x11.h" +#include "gdksurface-x11.h" -typedef struct _GdkWindowQueueItem GdkWindowQueueItem; -typedef struct _GdkWindowParentPos GdkWindowParentPos; +typedef struct _GdkSurfaceQueueItem GdkSurfaceQueueItem; +typedef struct _GdkSurfaceParentPos GdkSurfaceParentPos; -struct _GdkWindowQueueItem +struct _GdkSurfaceQueueItem { - GdkWindow *window; + GdkSurface *surface; gulong serial; cairo_region_t *antiexpose_area; }; @@ -76,12 +76,12 @@ queue_delete_link (GQueue *queue, } static void -queue_item_free (GdkWindowQueueItem *item) +queue_item_free (GdkSurfaceQueueItem *item) { - if (item->window) + if (item->surface) { - g_object_remove_weak_pointer (G_OBJECT (item->window), - (gpointer *)&(item->window)); + g_object_remove_weak_pointer (G_OBJECT (item->surface), + (gpointer *)&(item->surface)); } cairo_region_destroy (item->antiexpose_area); @@ -102,10 +102,10 @@ _gdk_x11_display_free_translate_queue (GdkDisplay *display) } static void -gdk_window_queue (GdkWindow *window, - GdkWindowQueueItem *new_item) +gdk_surface_queue (GdkSurface *surface, + GdkSurfaceQueueItem *new_item) { - GdkX11Display *display_x11 = GDK_X11_DISPLAY (GDK_WINDOW_DISPLAY (window)); + GdkX11Display *display_x11 = GDK_X11_DISPLAY (GDK_SURFACE_DISPLAY (surface)); if (!display_x11->translate_queue) display_x11->translate_queue = g_queue_new (); @@ -116,12 +116,12 @@ gdk_window_queue (GdkWindow *window, */ if (display_x11->translate_queue->length >= 64) { - gulong serial = find_current_serial (GDK_WINDOW_XDISPLAY (window)); + gulong serial = find_current_serial (GDK_SURFACE_XDISPLAY (surface)); GList *tmp_list = display_x11->translate_queue->head; while (tmp_list) { - GdkWindowQueueItem *item = tmp_list->data; + GdkSurfaceQueueItem *item = tmp_list->data; GList *next = tmp_list->next; /* an overflow-safe (item->serial < serial) */ @@ -147,7 +147,7 @@ gdk_window_queue (GdkWindow *window, while (tmp_list) { - GdkWindowQueueItem *item = tmp_list->data; + GdkSurfaceQueueItem *item = tmp_list->data; GList *next = tmp_list->next; queue_delete_link (display_x11->translate_queue, tmp_list); @@ -157,32 +157,32 @@ gdk_window_queue (GdkWindow *window, } } - new_item->window = window; - new_item->serial = NextRequest (GDK_WINDOW_XDISPLAY (window)); + new_item->surface = surface; + new_item->serial = NextRequest (GDK_SURFACE_XDISPLAY (surface)); - g_object_add_weak_pointer (G_OBJECT (window), - (gpointer *)&(new_item->window)); + g_object_add_weak_pointer (G_OBJECT (surface), + (gpointer *)&(new_item->surface)); g_queue_push_tail (display_x11->translate_queue, new_item); } void -_gdk_x11_window_queue_antiexpose (GdkWindow *window, +_gdk_x11_surface_queue_antiexpose (GdkSurface *surface, cairo_region_t *area) { - GdkWindowQueueItem *item = g_new (GdkWindowQueueItem, 1); + GdkSurfaceQueueItem *item = g_new (GdkSurfaceQueueItem, 1); item->antiexpose_area = cairo_region_reference (area); - gdk_window_queue (window, item); + gdk_surface_queue (surface, item); } void -_gdk_x11_window_process_expose (GdkWindow *window, +_gdk_x11_surface_process_expose (GdkSurface *surface, gulong serial, GdkRectangle *area) { cairo_region_t *invalidate_region = cairo_region_create_rectangle (area); - GdkX11Display *display_x11 = GDK_X11_DISPLAY (GDK_WINDOW_DISPLAY (window)); + GdkX11Display *display_x11 = GDK_X11_DISPLAY (GDK_SURFACE_DISPLAY (surface)); if (display_x11->translate_queue) { @@ -190,13 +190,13 @@ _gdk_x11_window_process_expose (GdkWindow *window, while (tmp_list) { - GdkWindowQueueItem *item = tmp_list->data; + GdkSurfaceQueueItem *item = tmp_list->data; GList *next = tmp_list->next; /* an overflow-safe (serial < item->serial) */ if (serial - item->serial > (gulong) G_MAXLONG) { - if (item->window == window) + if (item->surface == surface) cairo_region_subtract (invalidate_region, item->antiexpose_area); } else @@ -209,7 +209,7 @@ _gdk_x11_window_process_expose (GdkWindow *window, } if (!cairo_region_is_empty (invalidate_region)) - _gdk_window_invalidate_for_expose (window, invalidate_region); + _gdk_surface_invalidate_for_expose (surface, invalidate_region); cairo_region_destroy (invalidate_region); } diff --git a/gdk/x11/gdkglcontext-x11.c b/gdk/x11/gdkglcontext-x11.c index fdd9571b92..c5f104fde5 100644 --- a/gdk/x11/gdkglcontext-x11.c +++ b/gdk/x11/gdkglcontext-x11.c @@ -28,7 +28,7 @@ #include "gdkx11display.h" #include "gdkx11glcontext.h" #include "gdkx11screen.h" -#include "gdkx11window.h" +#include "gdkx11surface.h" #include "gdkvisual-x11.h" #include "gdkx11property.h" #include <X11/Xatom.h> @@ -79,16 +79,16 @@ drawable_info_free (gpointer data_) } static DrawableInfo * -get_glx_drawable_info (GdkWindow *window) +get_glx_drawable_info (GdkSurface *surface) { - return g_object_get_data (G_OBJECT (window), "-gdk-x11-window-glx-info"); + return g_object_get_data (G_OBJECT (surface), "-gdk-x11-surface-glx-info"); } static void -set_glx_drawable_info (GdkWindow *window, +set_glx_drawable_info (GdkSurface *surface, DrawableInfo *info) { - g_object_set_data_full (G_OBJECT (window), "-gdk-x11-window-glx-info", + g_object_set_data_full (G_OBJECT (surface), "-gdk-x11-surface-glx-info", info, drawable_info_free); } @@ -125,7 +125,7 @@ gdk_x11_gl_context_end_frame (GdkDrawContext *draw_context, { GdkGLContext *context = GDK_GL_CONTEXT (draw_context); GdkX11GLContext *context_x11 = GDK_X11_GL_CONTEXT (context); - GdkWindow *window = gdk_gl_context_get_window (context); + GdkSurface *surface = gdk_gl_context_get_surface (context); GdkDisplay *display = gdk_gl_context_get_display (context); Display *dpy = gdk_x11_display_get_xdisplay (display); GdkX11Display *display_x11 = GDK_X11_DISPLAY (display); @@ -139,14 +139,14 @@ gdk_x11_gl_context_end_frame (GdkDrawContext *draw_context, gdk_gl_context_make_current (context); - info = get_glx_drawable_info (window); + info = get_glx_drawable_info (surface); drawable = context_x11->attached_drawable; GDK_DISPLAY_NOTE (display, OPENGL, g_message ("Flushing GLX buffers for drawable %lu (window: %lu), frame sync: %s", (unsigned long) drawable, - (unsigned long) gdk_x11_window_get_xid (window), + (unsigned long) gdk_x11_surface_get_xid (surface), context_x11->do_frame_sync ? "yes" : "no")); /* if we are going to wait for the vertical refresh manually @@ -194,7 +194,7 @@ gdk_x11_gl_context_get_damage (GdkGLContext *context) GdkDisplay *display = gdk_draw_context_get_display (GDK_DRAW_CONTEXT (context)); GdkX11Display *display_x11 = GDK_X11_DISPLAY (display); Display *dpy = gdk_x11_display_get_xdisplay (display); - GdkWindow *window = gdk_draw_context_get_window (GDK_DRAW_CONTEXT (context)); + GdkSurface *surface = gdk_draw_context_get_surface (GDK_DRAW_CONTEXT (context)); unsigned int buffer_age = 0; if (display_x11->has_glx_buffer_age) @@ -213,16 +213,16 @@ gdk_x11_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; } } @@ -363,16 +363,16 @@ glx_pixmap_get (cairo_surface_t *surface, guint texture_target) static gboolean gdk_x11_gl_context_texture_from_surface (GdkGLContext *paint_context, - cairo_surface_t *surface, + cairo_surface_t *cairo_surface, cairo_region_t *region) { GdkGLXPixmap *glx_pixmap; double device_x_offset, device_y_offset; cairo_rectangle_int_t rect; int n_rects, i; - GdkWindow *window; - int unscaled_window_height; - int window_scale; + GdkSurface *surface; + int unscaled_surface_height; + int surface_scale; unsigned int texture_id; gboolean use_texture_rectangle; guint target; @@ -385,7 +385,7 @@ gdk_x11_gl_context_texture_from_surface (GdkGLContext *paint_context, if (!display_x11->has_glx_texture_from_pixmap) return FALSE; - if (cairo_surface_get_type (surface) != CAIRO_SURFACE_TYPE_XLIB) + if (cairo_surface_get_type (cairo_surface) != CAIRO_SURFACE_TYPE_XLIB) return FALSE; use_texture_rectangle = gdk_gl_context_use_texture_rectangle (paint_context); @@ -394,19 +394,19 @@ gdk_x11_gl_context_texture_from_surface (GdkGLContext *paint_context, else target = GL_TEXTURE_2D; - glx_pixmap = glx_pixmap_get (surface, target); + glx_pixmap = glx_pixmap_get (cairo_surface, target); if (glx_pixmap == NULL) return FALSE; GDK_DISPLAY_NOTE (GDK_DISPLAY (display_x11), OPENGL, g_message ("Using GLX_EXT_texture_from_pixmap to draw surface")); - window = gdk_gl_context_get_window (paint_context)->impl_window; - window_scale = gdk_window_get_scale_factor (window); - gdk_window_get_unscaled_size (window, NULL, &unscaled_window_height); + surface = gdk_gl_context_get_surface (paint_context)->impl_surface; + surface_scale = gdk_surface_get_scale_factor (surface); + gdk_surface_get_unscaled_size (surface, NULL, &unscaled_surface_height); sx = sy = 1; - cairo_surface_get_device_scale (surface, &sx, &sy); - cairo_surface_get_device_offset (surface, &device_x_offset, &device_y_offset); + cairo_surface_get_device_scale (cairo_surface, &sx, &sy); + cairo_surface_get_device_offset (cairo_surface, &device_x_offset, &device_y_offset); /* Ensure all the X stuff are synced before we read it back via texture-from-pixmap */ glXWaitX(); @@ -427,11 +427,11 @@ gdk_x11_gl_context_texture_from_surface (GdkGLContext *paint_context, n_rects = cairo_region_num_rectangles (region); quads = g_new (GdkTexturedQuad, n_rects); -#define FLIP_Y(_y) (unscaled_window_height - (_y)) +#define FLIP_Y(_y) (unscaled_surface_height - (_y)) cairo_region_get_extents (region, &rect); - glScissor (rect.x * window_scale, FLIP_Y((rect.y + rect.height) * window_scale), - rect.width * window_scale, rect.height * window_scale); + glScissor (rect.x * surface_scale, FLIP_Y((rect.y + rect.height) * surface_scale), + rect.width * surface_scale, rect.height * surface_scale); for (i = 0; i < n_rects; i++) { @@ -451,14 +451,14 @@ gdk_x11_gl_context_texture_from_surface (GdkGLContext *paint_context, } else { - uscale = 1.0 / cairo_xlib_surface_get_width (surface); - vscale = 1.0 / cairo_xlib_surface_get_height (surface); + uscale = 1.0 / cairo_xlib_surface_get_width (cairo_surface); + vscale = 1.0 / cairo_xlib_surface_get_height (cairo_surface); } { GdkTexturedQuad quad = { - rect.x * window_scale, FLIP_Y(rect.y * window_scale), - (rect.x + rect.width) * window_scale, FLIP_Y((rect.y + rect.height) * window_scale), + rect.x * surface_scale, FLIP_Y(rect.y * surface_scale), + (rect.x + rect.width) * surface_scale, FLIP_Y((rect.y + rect.height) * surface_scale), uscale * src_x, vscale * src_y, uscale * (src_x + src_width), vscale * (src_y + src_height), }; @@ -566,12 +566,12 @@ gdk_x11_gl_context_realize (GdkGLContext *context, Display *dpy; DrawableInfo *info; GdkGLContext *share; - GdkWindow *window; + GdkSurface *surface; gboolean debug_bit, compat_bit, legacy_bit, es_bit; int major, minor, flags; - window = gdk_gl_context_get_window (context); - display = gdk_window_get_display (window); + surface = gdk_gl_context_get_surface (context); + display = gdk_surface_get_display (surface); dpy = gdk_x11_display_get_xdisplay (display); context_x11 = GDK_X11_GL_CONTEXT (context); display_x11 = GDK_X11_DISPLAY (display); @@ -669,7 +669,7 @@ gdk_x11_gl_context_realize (GdkGLContext *context, xvisinfo = find_xvisinfo_for_fbconfig (display, context_x11->glx_config); - info = get_glx_drawable_info (window->impl_window); + info = get_glx_drawable_info (surface->impl_surface); if (info == NULL) { XSetWindowAttributes attrs; @@ -698,7 +698,7 @@ gdk_x11_gl_context_realize (GdkGLContext *context, if (GDK_X11_DISPLAY (display)->glx_version >= 13) { info->glx_drawable = glXCreateWindow (dpy, context_x11->glx_config, - gdk_x11_window_get_xid (window->impl_window), + gdk_x11_surface_get_xid (surface->impl_surface), NULL); info->dummy_glx = glXCreateWindow (dpy, context_x11->glx_config, info->dummy_xwin, NULL); } @@ -717,12 +717,12 @@ gdk_x11_gl_context_realize (GdkGLContext *context, return FALSE; } - set_glx_drawable_info (window->impl_window, info); + set_glx_drawable_info (surface->impl_surface, info); } XFree (xvisinfo); - context_x11->attached_drawable = info->glx_drawable ? info->glx_drawable : gdk_x11_window_get_xid (window->impl_window); + context_x11->attached_drawable = info->glx_drawable ? info->glx_drawable : gdk_x11_surface_get_xid (surface->impl_surface); context_x11->unattached_drawable = info->dummy_glx ? info->dummy_glx : info->dummy_xwin; context_x11->is_direct = glXIsDirect (dpy, context_x11->glx_context); @@ -1193,7 +1193,7 @@ _gdk_x11_screen_update_visuals_for_gl (GdkX11Screen *x11_screen) } GdkGLContext * -gdk_x11_window_create_gl_context (GdkWindow *window, +gdk_x11_surface_create_gl_context (GdkSurface *surface, gboolean attached, GdkGLContext *share, GError **error) @@ -1202,9 +1202,9 @@ gdk_x11_window_create_gl_context (GdkWindow *window, GdkX11GLContext *context; GLXFBConfig config; - display = gdk_window_get_display (window); + display = gdk_surface_get_display (surface); - if (!gdk_x11_screen_init_gl (GDK_WINDOW_SCREEN (window))) + if (!gdk_x11_screen_init_gl (GDK_SURFACE_SCREEN (surface))) { g_set_error_literal (error, GDK_GL_ERROR, GDK_GL_ERROR_NOT_AVAILABLE, @@ -1216,7 +1216,7 @@ gdk_x11_window_create_gl_context (GdkWindow *window, return NULL; context = g_object_new (GDK_TYPE_X11_GL_CONTEXT, - "window", window, + "surface", surface, "shared-context", share, NULL); diff --git a/gdk/x11/gdkglcontext-x11.h b/gdk/x11/gdkglcontext-x11.h index f5af2115df..89d1131fcc 100644 --- a/gdk/x11/gdkglcontext-x11.h +++ b/gdk/x11/gdkglcontext-x11.h @@ -30,7 +30,7 @@ #include "gdkglcontextprivate.h" #include "gdkdisplayprivate.h" #include "gdkvisual-x11.h" -#include "gdkwindow.h" +#include "gdksurface.h" #include "gdkinternals.h" G_BEGIN_DECLS @@ -55,7 +55,7 @@ struct _GdkX11GLContextClass }; gboolean gdk_x11_screen_init_gl (GdkX11Screen *screen); -GdkGLContext * gdk_x11_window_create_gl_context (GdkWindow *window, +GdkGLContext * gdk_x11_surface_create_gl_context (GdkSurface *window, gboolean attached, GdkGLContext *share, GError **error); diff --git a/gdk/x11/gdkmain-x11.c b/gdk/x11/gdkmain-x11.c index 72edfe1c09..4fe1d36b19 100644 --- a/gdk/x11/gdkmain-x11.c +++ b/gdk/x11/gdkmain-x11.c @@ -102,7 +102,7 @@ static int gdk_x_error (Display *display, static int gdk_x_io_error (Display *display); void -_gdk_x11_windowing_init (void) +_gdk_x11_surfaceing_init (void) { XSetErrorHandler (gdk_x_error); XSetIOErrorHandler (gdk_x_io_error); @@ -130,20 +130,20 @@ _gdk_x11_convert_grab_status (gint status) } /* - * _gdk_x11_window_grab_check_unmap: - * @window: a #GdkWindow + * _gdk_x11_surface_grab_check_unmap: + * @surface: a #GdkSurface * @serial: serial from Unmap event (or from NextRequest(display) * if the unmap is being done by this client.) * * Checks to see if an unmap request or event causes the current - * grab window to become not viewable, and if so, clear the + * grab surface to become not viewable, and if so, clear the * the pointer we keep to it. **/ void -_gdk_x11_window_grab_check_unmap (GdkWindow *window, +_gdk_x11_surface_grab_check_unmap (GdkSurface *surface, gulong serial) { - GdkDisplay *display = gdk_window_get_display (window); + GdkDisplay *display = gdk_surface_get_display (surface); GdkSeat *seat; GList *devices, *d; @@ -153,24 +153,24 @@ _gdk_x11_window_grab_check_unmap (GdkWindow *window, devices = g_list_prepend (devices, gdk_seat_get_keyboard (seat)); devices = g_list_prepend (devices, gdk_seat_get_pointer (seat)); - /* End all grabs on the newly hidden window */ + /* End all grabs on the newly hidden surface */ for (d = devices; d; d = d->next) - _gdk_display_end_device_grab (display, d->data, serial, window, TRUE); + _gdk_display_end_device_grab (display, d->data, serial, surface, TRUE); g_list_free (devices); } /* - * _gdk_x11_window_grab_check_destroy: - * @window: a #GdkWindow + * _gdk_x11_surface_grab_check_destroy: + * @surface: a #GdkSurface * - * Checks to see if window is the current grab window, and if - * so, clear the current grab window. + * Checks to see if surface is the current grab surface, and if + * so, clear the current grab surface. **/ void -_gdk_x11_window_grab_check_destroy (GdkWindow *window) +_gdk_x11_surface_grab_check_destroy (GdkSurface *surface) { - GdkDisplay *display = gdk_window_get_display (window); + GdkDisplay *display = gdk_surface_get_display (surface); GdkSeat *seat; GdkDeviceGrabInfo *grab; GList *devices, *d; @@ -183,10 +183,10 @@ _gdk_x11_window_grab_check_destroy (GdkWindow *window) for (d = devices; d; d = d->next) { - /* Make sure there is no lasting grab in this native window */ + /* Make sure there is no lasting grab in this native surface */ grab = _gdk_display_get_last_device_grab (display, d->data); - if (grab && grab->native_window == window) + if (grab && grab->native_surface == surface) { /* We don't know the actual serial to end, but it doesn't really matter as this only happens diff --git a/gdk/x11/gdkmonitor-x11.c b/gdk/x11/gdkmonitor-x11.c index a10d41da6f..34d88e98f8 100644 --- a/gdk/x11/gdkmonitor-x11.c +++ b/gdk/x11/gdkmonitor-x11.c @@ -34,7 +34,7 @@ static gboolean gdk_monitor_has_fullscreen_window (GdkMonitor *monitor) { GList *toplevels, *l; - GdkWindow *window; + GdkSurface *surface; gboolean has_fullscreen; toplevels = gdk_x11_display_get_toplevel_windows (monitor->display); @@ -42,13 +42,13 @@ gdk_monitor_has_fullscreen_window (GdkMonitor *monitor) has_fullscreen = FALSE; for (l = toplevels; l; l = l->next) { - window = l->data; + surface = l->data; - if ((gdk_window_get_state (window) & GDK_WINDOW_STATE_FULLSCREEN) == 0) + if ((gdk_surface_get_state (surface) & GDK_SURFACE_STATE_FULLSCREEN) == 0) continue; - if (gdk_window_get_fullscreen_mode (window) == GDK_FULLSCREEN_ON_ALL_MONITORS || - gdk_display_get_monitor_at_window (monitor->display, window) == monitor) + if (gdk_surface_get_fullscreen_mode (surface) == GDK_FULLSCREEN_ON_ALL_MONITORS || + gdk_display_get_monitor_at_surface (monitor->display, surface) == monitor) { has_fullscreen = TRUE; break; diff --git a/gdk/x11/gdkprivate-x11.h b/gdk/x11/gdkprivate-x11.h index bcd6b265b3..c55b0b3fc9 100644 --- a/gdk/x11/gdkprivate-x11.h +++ b/gdk/x11/gdkprivate-x11.h @@ -32,7 +32,7 @@ #include "gdkcursor.h" #include "gdkinternals.h" #include "gdkx.h" -#include "gdkwindow-x11.h" +#include "gdksurface-x11.h" #include "gdkscreen-x11.h" #include <X11/Xlib.h> @@ -68,7 +68,7 @@ Colormap gdk_x11_display_get_window_colormap (GdkX11Display *displa void _gdk_x11_display_add_window (GdkDisplay *display, XID *xid, - GdkWindow *window); + GdkSurface *window); void _gdk_x11_display_remove_window (GdkDisplay *display, XID xid); @@ -79,13 +79,13 @@ gint _gdk_x11_display_send_xevent (GdkDisplay *display, XEvent *event_send); /* Routines from gdkgeometry-x11.c */ -void _gdk_x11_window_process_expose (GdkWindow *window, +void _gdk_x11_surface_process_expose (GdkSurface *window, gulong serial, GdkRectangle *area); -void _gdk_x11_window_queue_antiexpose (GdkWindow *window, +void _gdk_x11_surface_queue_antiexpose (GdkSurface *window, cairo_region_t *area); -void _gdk_x11_window_translate (GdkWindow *window, +void _gdk_x11_surface_translate (GdkSurface *window, cairo_region_t *area, gint dx, gint dy); @@ -106,7 +106,7 @@ void _gdk_x11_region_get_xrectangles (const cairo_region_t *region, gboolean _gdk_x11_moveresize_handle_event (const XEvent *event); gboolean _gdk_x11_moveresize_configure_done (GdkDisplay *display, - GdkWindow *window); + GdkSurface *window); void _gdk_x11_keymap_state_changed (GdkDisplay *display, const XEvent *event); @@ -114,11 +114,11 @@ void _gdk_x11_keymap_keys_changed (GdkDisplay *display); void _gdk_x11_keymap_add_virt_mods (GdkKeymap *keymap, GdkModifierType *modifiers); -void _gdk_x11_windowing_init (void); +void _gdk_x11_surfaceing_init (void); -void _gdk_x11_window_grab_check_unmap (GdkWindow *window, +void _gdk_x11_surface_grab_check_unmap (GdkSurface *window, gulong serial); -void _gdk_x11_window_grab_check_destroy (GdkWindow *window); +void _gdk_x11_surface_grab_check_destroy (GdkSurface *window); gboolean _gdk_x11_display_is_root_window (GdkDisplay *display, Window xroot_window); @@ -196,11 +196,11 @@ void _gdk_x11_display_get_default_cursor_size (GdkDisplay *display, void _gdk_x11_display_get_maximal_cursor_size (GdkDisplay *display, guint *width, guint *height); -void _gdk_x11_display_create_window_impl (GdkDisplay *display, - GdkWindow *window, - GdkWindow *real_parent, +void _gdk_x11_display_create_surface_impl (GdkDisplay *display, + GdkSurface *window, + GdkSurface *real_parent, GdkEventMask event_mask, - GdkWindowAttr *attributes); + GdkSurfaceAttr *attributes); GList * gdk_x11_display_get_toplevel_windows (GdkDisplay *display); void _gdk_x11_precache_atoms (GdkDisplay *display, @@ -217,29 +217,29 @@ _gdk_x11_dnd_filter (const XEvent *xevent, gpointer data); GdkFilterReturn -xdnd_source_window_filter (const XEvent *xevent, +xdnd_source_surface_filter (const XEvent *xevent, GdkEvent *event, gpointer data); -typedef struct _GdkWindowCache GdkWindowCache; +typedef struct _GdkSurfaceCache GdkSurfaceCache; -GdkWindowCache * -gdk_window_cache_get (GdkDisplay *display); +GdkSurfaceCache * +gdk_surface_cache_get (GdkDisplay *display); GdkFilterReturn -gdk_window_cache_filter (const XEvent *xevent, +gdk_surface_cache_filter (const XEvent *xevent, GdkEvent *event, gpointer data); GdkFilterReturn -gdk_window_cache_shape_filter (const XEvent *xevent, +gdk_surface_cache_shape_filter (const XEvent *xevent, GdkEvent *event, gpointer data); void _gdk_x11_cursor_display_finalize (GdkDisplay *display); -void _gdk_x11_window_register_dnd (GdkWindow *window); +void _gdk_x11_surface_register_dnd (GdkSurface *window); -GdkDragContext * _gdk_x11_window_drag_begin (GdkWindow *window, +GdkDragContext * _gdk_x11_surface_drag_begin (GdkSurface *window, GdkDevice *device, GdkContentProvider *content, GdkDragAction actions, @@ -258,20 +258,20 @@ extern const gint _gdk_x11_event_mask_table_size; #define GDK_SCREEN_DISPLAY(screen) (GDK_X11_SCREEN (screen)->display) #define GDK_SCREEN_XROOTWIN(screen) (GDK_X11_SCREEN (screen)->xroot_window) #define GDK_DISPLAY_XROOTWIN(display) (GDK_SCREEN_XROOTWIN (GDK_X11_DISPLAY (display)->screen)) -#define GDK_WINDOW_SCREEN(win) (GDK_X11_DISPLAY (gdk_window_get_display (win))->screen) -#define GDK_WINDOW_DISPLAY(win) (gdk_window_get_display (win)) -#define GDK_WINDOW_XROOTWIN(win) (GDK_X11_SCREEN (GDK_WINDOW_SCREEN (win))->xroot_window) -#define GDK_WINDOW_IS_X11(win) (GDK_IS_WINDOW_IMPL_X11 ((win)->impl)) +#define GDK_SURFACE_SCREEN(win) (GDK_X11_DISPLAY (gdk_surface_get_display (win))->screen) +#define GDK_SURFACE_DISPLAY(win) (gdk_surface_get_display (win)) +#define GDK_SURFACE_XROOTWIN(win) (GDK_X11_SCREEN (GDK_SURFACE_SCREEN (win))->xroot_window) +#define GDK_SURFACE_IS_X11(win) (GDK_IS_SURFACE_IMPL_X11 ((win)->impl)) /* override some macros from gdkx.h with direct-access variants */ #undef GDK_DISPLAY_XDISPLAY -#undef GDK_WINDOW_XDISPLAY -#undef GDK_WINDOW_XID +#undef GDK_SURFACE_XDISPLAY +#undef GDK_SURFACE_XID #undef GDK_SCREEN_XDISPLAY #define GDK_DISPLAY_XDISPLAY(display) (GDK_X11_DISPLAY(display)->xdisplay) -#define GDK_WINDOW_XDISPLAY(win) (GDK_X11_SCREEN (GDK_WINDOW_SCREEN (win))->xdisplay) -#define GDK_WINDOW_XID(win) (GDK_WINDOW_IMPL_X11(GDK_WINDOW (win)->impl)->xid) +#define GDK_SURFACE_XDISPLAY(win) (GDK_X11_SCREEN (GDK_SURFACE_SCREEN (win))->xdisplay) +#define GDK_SURFACE_XID(win) (GDK_SURFACE_IMPL_X11(GDK_SURFACE (win)->impl)->xid) #define GDK_SCREEN_XDISPLAY(screen) (GDK_X11_SCREEN (screen)->xdisplay) #endif /* __GDK_PRIVATE_X11_H__ */ diff --git a/gdk/x11/gdkscreen-x11.c b/gdk/x11/gdkscreen-x11.c index 2ca0ac7886..4554c6ccd4 100644 --- a/gdk/x11/gdkscreen-x11.c +++ b/gdk/x11/gdkscreen-x11.c @@ -242,10 +242,10 @@ gdk_x11_screen_get_work_area (GdkX11Screen *x11_screen, area->width = workareas[desktop * 4 + 2]; area->height = workareas[desktop * 4 + 3]; - area->x /= x11_screen->window_scale; - area->y /= x11_screen->window_scale; - area->width /= x11_screen->window_scale; - area->height /= x11_screen->window_scale; + area->x /= x11_screen->surface_scale; + area->y /= x11_screen->surface_scale; + area->width /= x11_screen->surface_scale; + area->height /= x11_screen->surface_scale; out: if (ret_workarea) @@ -408,10 +408,10 @@ init_randr15 (GdkX11Screen *x11_screen, gboolean *changed) gdk_monitor_get_geometry (GDK_MONITOR (monitor), &geometry); name = g_strndup (output_info->name, output_info->nameLen); - newgeo.x = rr_monitors[i].x / x11_screen->window_scale; - newgeo.y = rr_monitors[i].y / x11_screen->window_scale; - newgeo.width = rr_monitors[i].width / x11_screen->window_scale; - newgeo.height = rr_monitors[i].height / x11_screen->window_scale; + newgeo.x = rr_monitors[i].x / x11_screen->surface_scale; + newgeo.y = rr_monitors[i].y / x11_screen->surface_scale; + newgeo.width = rr_monitors[i].width / x11_screen->surface_scale; + newgeo.height = rr_monitors[i].height / x11_screen->surface_scale; if (newgeo.x != geometry.x || newgeo.y != geometry.y || newgeo.width != geometry.width || @@ -430,7 +430,7 @@ init_randr15 (GdkX11Screen *x11_screen, gboolean *changed) gdk_monitor_set_subpixel_layout (GDK_MONITOR (monitor), translate_subpixel_order (output_info->subpixel_order)); gdk_monitor_set_refresh_rate (GDK_MONITOR (monitor), refresh_rate); - gdk_monitor_set_scale_factor (GDK_MONITOR (monitor), x11_screen->window_scale); + gdk_monitor_set_scale_factor (GDK_MONITOR (monitor), x11_screen->surface_scale); gdk_monitor_set_model (GDK_MONITOR (monitor), name); g_free (name); @@ -570,10 +570,10 @@ init_randr13 (GdkX11Screen *x11_screen, gboolean *changed) gdk_monitor_get_geometry (GDK_MONITOR (monitor), &geometry); name = g_strndup (output_info->name, output_info->nameLen); - newgeo.x = crtc->x / x11_screen->window_scale; - newgeo.y = crtc->y / x11_screen->window_scale; - newgeo.width = crtc->width / x11_screen->window_scale; - newgeo.height = crtc->height / x11_screen->window_scale; + newgeo.x = crtc->x / x11_screen->surface_scale; + newgeo.y = crtc->y / x11_screen->surface_scale; + newgeo.width = crtc->width / x11_screen->surface_scale; + newgeo.height = crtc->height / x11_screen->surface_scale; if (newgeo.x != geometry.x || newgeo.y != geometry.y || newgeo.width != geometry.width || @@ -592,7 +592,7 @@ init_randr13 (GdkX11Screen *x11_screen, gboolean *changed) gdk_monitor_set_subpixel_layout (GDK_MONITOR (monitor), translate_subpixel_order (output_info->subpixel_order)); gdk_monitor_set_refresh_rate (GDK_MONITOR (monitor), refresh_rate); - gdk_monitor_set_scale_factor (GDK_MONITOR (monitor), x11_screen->window_scale); + gdk_monitor_set_scale_factor (GDK_MONITOR (monitor), x11_screen->surface_scale); gdk_monitor_set_model (GDK_MONITOR (monitor), name); g_free (name); @@ -712,7 +712,7 @@ init_no_multihead (GdkX11Screen *x11_screen, gboolean *changed) gdk_monitor_set_size (GDK_MONITOR (monitor), width, height); g_object_notify (G_OBJECT (monitor), "workarea"); gdk_monitor_set_physical_size (GDK_MONITOR (monitor), width_mm, height_mm); - gdk_monitor_set_scale_factor (GDK_MONITOR (monitor), x11_screen->window_scale); + gdk_monitor_set_scale_factor (GDK_MONITOR (monitor), x11_screen->surface_scale); if (x11_display->primary_monitor != 0) *changed = TRUE; @@ -772,13 +772,13 @@ _gdk_x11_screen_new (GdkDisplay *display, scale_str = g_getenv ("GDK_SCALE"); if (scale_str) { - x11_screen->fixed_window_scale = TRUE; - x11_screen->window_scale = atol (scale_str); - if (x11_screen->window_scale == 0) - x11_screen->window_scale = 1; + x11_screen->fixed_surface_scale = TRUE; + x11_screen->surface_scale = atol (scale_str); + if (x11_screen->surface_scale == 0) + x11_screen->surface_scale = 1; } else - x11_screen->window_scale = 1; + x11_screen->surface_scale = 1; init_randr_support (x11_screen); init_multihead (x11_screen); @@ -789,25 +789,25 @@ _gdk_x11_screen_new (GdkDisplay *display, } void -_gdk_x11_screen_set_window_scale (GdkX11Screen *x11_screen, +_gdk_x11_screen_set_surface_scale (GdkX11Screen *x11_screen, gint scale) { GdkX11Display *x11_display = GDK_X11_DISPLAY (x11_screen->display); GList *toplevels, *l; int i; - if (x11_screen->window_scale == scale) + if (x11_screen->surface_scale == scale) return; - x11_screen->window_scale = scale; + x11_screen->surface_scale = scale; toplevels = gdk_x11_display_get_toplevel_windows (x11_screen->display); for (l = toplevels; l != NULL; l = l->next) { - GdkWindow *window = l->data; + GdkSurface *surface = l->data; - _gdk_x11_window_set_window_scale (window, scale); + _gdk_x11_surface_set_surface_scale (surface, scale); } for (i = 0; i < x11_display->monitors->len; i++) diff --git a/gdk/x11/gdkscreen-x11.h b/gdk/x11/gdkscreen-x11.h index 9553b4baba..08e3e8ba87 100644 --- a/gdk/x11/gdkscreen-x11.h +++ b/gdk/x11/gdkscreen-x11.h @@ -41,8 +41,8 @@ struct _GdkX11Screen Window xroot_window; gint screen_num; - gint window_scale; - gboolean fixed_window_scale; + gint surface_scale; + gboolean fixed_surface_scale; /* Xft resources for the display, used for default values for * the Xft/ XSETTINGS @@ -108,7 +108,7 @@ void _gdk_x11_screen_get_edge_monitors (GdkX11Screen *screen, gint *bottom, gint *left, gint *right); -void _gdk_x11_screen_set_window_scale (GdkX11Screen *x11_screen, +void _gdk_x11_screen_set_surface_scale (GdkX11Screen *x11_screen, int scale); void gdk_x11_screen_get_work_area (GdkX11Screen *screen, GdkRectangle *area); diff --git a/gdk/x11/gdkselectioninputstream-x11.c b/gdk/x11/gdkselectioninputstream-x11.c index c3ae895344..55f83b4975 100644 --- a/gdk/x11/gdkselectioninputstream-x11.c +++ b/gdk/x11/gdkselectioninputstream-x11.c @@ -27,7 +27,7 @@ #include "gdkintl.h" #include "gdkx11display.h" #include "gdkx11property.h" -#include "gdkx11window.h" +#include "gdkx11surface.h" typedef struct GdkX11SelectionInputStreamPrivate GdkX11SelectionInputStreamPrivate; diff --git a/gdk/x11/gdkselectionoutputstream-x11.c b/gdk/x11/gdkselectionoutputstream-x11.c index 106c6b780c..5f35cdf6be 100644 --- a/gdk/x11/gdkselectionoutputstream-x11.c +++ b/gdk/x11/gdkselectionoutputstream-x11.c @@ -29,7 +29,7 @@ #include "gdktextlistconverter-x11.h" #include "gdkx11display.h" #include "gdkx11property.h" -#include "gdkx11window.h" +#include "gdkx11surface.h" typedef struct _GdkX11PendingSelectionNotify GdkX11PendingSelectionNotify; typedef struct _GdkX11SelectionOutputStreamPrivate GdkX11SelectionOutputStreamPrivate; diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdksurface-x11.c index 3fcaae3591..17a51c3fa6 100644 --- a/gdk/x11/gdkwindow-x11.c +++ b/gdk/x11/gdksurface-x11.c @@ -25,10 +25,10 @@ #include "config.h" -#include "gdkwindow-x11.h" +#include "gdksurface-x11.h" -#include "gdkwindow.h" -#include "gdkwindowimpl.h" +#include "gdksurface.h" +#include "gdksurfaceimpl.h" #include "gdkvisual-x11.h" #include "gdkinternals.h" #include "gdkdeviceprivate.h" @@ -101,23 +101,23 @@ const int _gdk_x11_event_mask_table[21] = const gint _gdk_x11_event_mask_table_size = G_N_ELEMENTS (_gdk_x11_event_mask_table); /* Forward declarations */ -static void gdk_x11_window_apply_fullscreen_mode (GdkWindow *window); -static gboolean gdk_window_icon_name_set (GdkWindow *window); +static void gdk_x11_surface_apply_fullscreen_mode (GdkSurface *surface); +static gboolean gdk_surface_icon_name_set (GdkSurface *surface); static void set_wm_name (GdkDisplay *display, Window xwindow, const gchar *name); -static void move_to_current_desktop (GdkWindow *window); +static void move_to_current_desktop (GdkSurface *surface); -static void gdk_window_impl_x11_finalize (GObject *object); +static void gdk_surface_impl_x11_finalize (GObject *object); -#define WINDOW_IS_TOPLEVEL_OR_FOREIGN(window) \ - (GDK_WINDOW_TYPE (window) == GDK_WINDOW_TOPLEVEL || \ - GDK_WINDOW_TYPE (window) == GDK_WINDOW_TEMP || \ - GDK_WINDOW_TYPE (window) == GDK_WINDOW_FOREIGN) +#define SURFACE_IS_TOPLEVEL_OR_FOREIGN(surface) \ + (GDK_SURFACE_TYPE (surface) == GDK_SURFACE_TOPLEVEL || \ + GDK_SURFACE_TYPE (surface) == GDK_SURFACE_TEMP || \ + GDK_SURFACE_TYPE (surface) == GDK_SURFACE_FOREIGN) -#define WINDOW_IS_TOPLEVEL(window) \ - (GDK_WINDOW_TYPE (window) == GDK_WINDOW_TOPLEVEL || \ - GDK_WINDOW_TYPE (window) == GDK_WINDOW_TEMP) +#define SURFACE_IS_TOPLEVEL(surface) \ + (GDK_SURFACE_TYPE (surface) == GDK_SURFACE_TOPLEVEL || \ + GDK_SURFACE_TYPE (surface) == GDK_SURFACE_TEMP) /* Return whether time1 is considered later than time2 as far as xserver * time is concerned. Accounts for wraparound. @@ -127,47 +127,47 @@ static void gdk_window_impl_x11_finalize (GObject *object); (( time1 < time2 ) && ( time2 - time1 > ((guint32)-1)/2 )) \ ) -struct _GdkX11Window { - GdkWindow parent; +struct _GdkX11Surface { + GdkSurface parent; }; -struct _GdkX11WindowClass { - GdkWindowClass parent_class; +struct _GdkX11SurfaceClass { + GdkSurfaceClass parent_class; }; -G_DEFINE_TYPE (GdkX11Window, gdk_x11_window, GDK_TYPE_WINDOW) +G_DEFINE_TYPE (GdkX11Surface, gdk_x11_surface, GDK_TYPE_SURFACE) static void -gdk_x11_window_class_init (GdkX11WindowClass *x11_window_class) +gdk_x11_surface_class_init (GdkX11SurfaceClass *x11_surface_class) { } static void -gdk_x11_window_init (GdkX11Window *x11_window) +gdk_x11_surface_init (GdkX11Surface *x11_surface) { } -G_DEFINE_TYPE (GdkWindowImplX11, gdk_window_impl_x11, GDK_TYPE_WINDOW_IMPL) +G_DEFINE_TYPE (GdkSurfaceImplX11, gdk_surface_impl_x11, GDK_TYPE_SURFACE_IMPL) static void -gdk_window_impl_x11_init (GdkWindowImplX11 *impl) +gdk_surface_impl_x11_init (GdkSurfaceImplX11 *impl) { - impl->window_scale = 1; + impl->surface_scale = 1; impl->frame_sync_enabled = TRUE; } GdkToplevelX11 * -_gdk_x11_window_get_toplevel (GdkWindow *window) +_gdk_x11_surface_get_toplevel (GdkSurface *surface) { - GdkWindowImplX11 *impl; + GdkSurfaceImplX11 *impl; - g_return_val_if_fail (GDK_IS_WINDOW (window), NULL); + g_return_val_if_fail (GDK_IS_SURFACE (surface), NULL); - if (!WINDOW_IS_TOPLEVEL (window)) + if (!SURFACE_IS_TOPLEVEL (surface)) return NULL; - impl = GDK_WINDOW_IMPL_X11 (window->impl); + impl = GDK_SURFACE_IMPL_X11 (surface->impl); if (!impl->toplevel) { @@ -179,14 +179,14 @@ _gdk_x11_window_get_toplevel (GdkWindow *window) } /** - * _gdk_x11_window_update_size: - * @impl: a #GdkWindowImplX11. + * _gdk_x11_surface_update_size: + * @impl: a #GdkSurfaceImplX11. * - * Updates the state of the window (in particular the drawable's + * Updates the state of the surface (in particular the drawable's * cairo surface) when its size has changed. **/ void -_gdk_x11_window_update_size (GdkWindowImplX11 *impl) +_gdk_x11_surface_update_size (GdkSurfaceImplX11 *impl) { if (impl->cairo_surface) { @@ -196,11 +196,11 @@ _gdk_x11_window_update_size (GdkWindowImplX11 *impl) } static void -gdk_x11_window_get_unscaled_size (GdkWindow *window, +gdk_x11_surface_get_unscaled_size (GdkSurface *surface, int *unscaled_width, int *unscaled_height) { - GdkWindowImplX11 *impl = GDK_WINDOW_IMPL_X11 (window->impl); + GdkSurfaceImplX11 *impl = GDK_SURFACE_IMPL_X11 (surface->impl); if (unscaled_width) *unscaled_width = impl->unscaled_width; @@ -210,9 +210,9 @@ gdk_x11_window_get_unscaled_size (GdkWindow *window, } static gboolean -gdk_x11_window_supports_edge_constraints (GdkWindow *window) +gdk_x11_surface_supports_edge_constraints (GdkSurface *surface) { - return gdk_x11_screen_supports_net_wm_hint (GDK_WINDOW_SCREEN (window), + return gdk_x11_screen_supports_net_wm_hint (GDK_SURFACE_SCREEN (surface), g_intern_static_string ("_GTK_EDGE_CONSTRAINTS")); } @@ -230,21 +230,21 @@ set_sync_counter(Display *display, } static void -window_pre_damage (GdkWindow *window) +surface_pre_damage (GdkSurface *surface) { - GdkWindow *toplevel_window = gdk_window_get_toplevel (window); - GdkWindowImplX11 *impl; + GdkSurface *toplevel_surface = gdk_surface_get_toplevel (surface); + GdkSurfaceImplX11 *impl; - if (!toplevel_window || !WINDOW_IS_TOPLEVEL (toplevel_window)) + if (!toplevel_surface || !SURFACE_IS_TOPLEVEL (toplevel_surface)) return; - impl = GDK_WINDOW_IMPL_X11 (toplevel_window->impl); + impl = GDK_SURFACE_IMPL_X11 (toplevel_surface->impl); if (impl->toplevel->in_frame && impl->toplevel->current_counter_value % 2 == 0) { impl->toplevel->current_counter_value += 1; - set_sync_counter (GDK_WINDOW_XDISPLAY (impl->wrapper), + set_sync_counter (GDK_SURFACE_XDISPLAY (impl->wrapper), impl->toplevel->extended_update_counter, impl->toplevel->current_counter_value); } @@ -253,11 +253,11 @@ window_pre_damage (GdkWindow *window) static void on_surface_changed (void *data) { - GdkWindow *window = data; - GdkWindowImplX11 *impl = GDK_WINDOW_IMPL_X11 (window->impl); + GdkSurface *surface = data; + GdkSurfaceImplX11 *impl = GDK_SURFACE_IMPL_X11 (surface->impl); if (impl->tracking_damage) - window_pre_damage (window); + surface_pre_damage (surface); } /* We want to know when cairo drawing causes damage to the window, @@ -270,9 +270,9 @@ on_surface_changed (void *data) */ static void -hook_surface_changed (GdkWindow *window) +hook_surface_changed (GdkSurface *surface) { - GdkWindowImplX11 *impl = GDK_WINDOW_IMPL_X11 (window->impl); + GdkSurfaceImplX11 *impl = GDK_SURFACE_IMPL_X11 (surface->impl); if (impl->cairo_surface) { @@ -281,15 +281,15 @@ hook_surface_changed (GdkWindow *window) (unsigned char *)"X", 1, on_surface_changed, - window); + surface); impl->tracking_damage = 1; } } static void -unhook_surface_changed (GdkWindow *window) +unhook_surface_changed (GdkSurface *surface) { - GdkWindowImplX11 *impl = GDK_WINDOW_IMPL_X11 (window->impl); + GdkSurfaceImplX11 *impl = GDK_SURFACE_IMPL_X11 (surface->impl); if (impl->cairo_surface) { @@ -302,18 +302,18 @@ unhook_surface_changed (GdkWindow *window) } static void -gdk_x11_window_predict_presentation_time (GdkWindow *window) +gdk_x11_surface_predict_presentation_time (GdkSurface *surface) { - GdkWindowImplX11 *impl = GDK_WINDOW_IMPL_X11 (window->impl); + GdkSurfaceImplX11 *impl = GDK_SURFACE_IMPL_X11 (surface->impl); GdkFrameClock *clock; GdkFrameTimings *timings; gint64 presentation_time; gint64 refresh_interval; - if (!WINDOW_IS_TOPLEVEL (window)) + if (!SURFACE_IS_TOPLEVEL (surface)) return; - clock = gdk_window_get_frame_clock (window); + clock = gdk_surface_get_frame_clock (surface); timings = gdk_frame_clock_get_current_timings (clock); @@ -348,16 +348,16 @@ gdk_x11_window_predict_presentation_time (GdkWindow *window) } static void -gdk_x11_window_begin_frame (GdkWindow *window, +gdk_x11_surface_begin_frame (GdkSurface *surface, gboolean force_frame) { - GdkWindowImplX11 *impl; + GdkSurfaceImplX11 *impl; - g_return_if_fail (GDK_IS_WINDOW (window)); + g_return_if_fail (GDK_IS_SURFACE (surface)); - impl = GDK_WINDOW_IMPL_X11 (window->impl); + impl = GDK_SURFACE_IMPL_X11 (surface->impl); - if (!WINDOW_IS_TOPLEVEL (window) || + if (!SURFACE_IS_TOPLEVEL (surface) || impl->toplevel->extended_update_counter == None) return; @@ -372,48 +372,48 @@ gdk_x11_window_begin_frame (GdkWindow *window, impl->toplevel->configure_counter_value = 0; - window_pre_damage (window); + surface_pre_damage (surface); } else if (force_frame) { - /* When mapping the window, we really want to freeze the - rendering of the window by the compositor until we've - actually painted something into the window's buffer. */ - window_pre_damage (window); + /* When mapping the surface, we really want to freeze the + rendering of the surface by the compositor until we've + actually painted something into the surface's buffer. */ + surface_pre_damage (surface); } else { - hook_surface_changed (window); + hook_surface_changed (surface); } } static void -gdk_x11_window_end_frame (GdkWindow *window) +gdk_x11_surface_end_frame (GdkSurface *surface) { GdkFrameClock *clock; GdkFrameTimings *timings; - GdkWindowImplX11 *impl; + GdkSurfaceImplX11 *impl; - g_return_if_fail (GDK_IS_WINDOW (window)); + g_return_if_fail (GDK_IS_SURFACE (surface)); - impl = GDK_WINDOW_IMPL_X11 (window->impl); + impl = GDK_SURFACE_IMPL_X11 (surface->impl); - if (!WINDOW_IS_TOPLEVEL (window) || + if (!SURFACE_IS_TOPLEVEL (surface) || impl->toplevel->extended_update_counter == None || !impl->toplevel->in_frame) return; - clock = gdk_window_get_frame_clock (window); + clock = gdk_surface_get_frame_clock (surface); timings = gdk_frame_clock_get_current_timings (clock); impl->toplevel->in_frame = FALSE; if (impl->toplevel->current_counter_value % 2 == 1) { - if (GDK_DISPLAY_DEBUG_CHECK (gdk_window_get_display (window), FRAMES)) + if (GDK_DISPLAY_DEBUG_CHECK (gdk_surface_get_display (surface), FRAMES)) { - XImage *image = XGetImage (GDK_WINDOW_XDISPLAY (window), - GDK_WINDOW_XID (window), + XImage *image = XGetImage (GDK_SURFACE_XDISPLAY (surface), + GDK_SURFACE_XID (surface), 0, 0, 1, 1, (1 << 24) - 1, ZPixmap); @@ -429,26 +429,26 @@ gdk_x11_window_end_frame (GdkWindow *window) else impl->toplevel->current_counter_value += 1; - set_sync_counter(GDK_WINDOW_XDISPLAY (impl->wrapper), + set_sync_counter(GDK_SURFACE_XDISPLAY (impl->wrapper), impl->toplevel->extended_update_counter, impl->toplevel->current_counter_value); if (impl->frame_sync_enabled && - gdk_x11_screen_supports_net_wm_hint (GDK_WINDOW_SCREEN (window), + gdk_x11_screen_supports_net_wm_hint (GDK_SURFACE_SCREEN (surface), g_intern_static_string ("_NET_WM_FRAME_DRAWN"))) { impl->toplevel->frame_pending = TRUE; - _gdk_frame_clock_freeze (gdk_window_get_frame_clock (window)); + _gdk_frame_clock_freeze (gdk_surface_get_frame_clock (surface)); timings->cookie = impl->toplevel->current_counter_value; } } - unhook_surface_changed (window); + unhook_surface_changed (surface); if (impl->toplevel->configure_counter_value != 0 && !impl->toplevel->configure_counter_value_is_extended) { - set_sync_counter (GDK_WINDOW_XDISPLAY (window), + set_sync_counter (GDK_SURFACE_XDISPLAY (surface), impl->toplevel->update_counter, impl->toplevel->configure_counter_value); @@ -464,36 +464,36 @@ gdk_x11_window_end_frame (GdkWindow *window) *****************************************************/ static cairo_surface_t * -gdk_x11_create_cairo_surface (GdkWindowImplX11 *impl, +gdk_x11_create_cairo_surface (GdkSurfaceImplX11 *impl, int width, int height) { Visual *visual; - visual = gdk_x11_display_get_window_visual (GDK_X11_DISPLAY (gdk_window_get_display (impl->wrapper))); - return cairo_xlib_surface_create (GDK_WINDOW_XDISPLAY (impl->wrapper), - GDK_WINDOW_IMPL_X11 (impl)->xid, + visual = gdk_x11_display_get_window_visual (GDK_X11_DISPLAY (gdk_surface_get_display (impl->wrapper))); + return cairo_xlib_surface_create (GDK_SURFACE_XDISPLAY (impl->wrapper), + GDK_SURFACE_IMPL_X11 (impl)->xid, visual, width, height); } static cairo_surface_t * -gdk_x11_ref_cairo_surface (GdkWindow *window) +gdk_x11_ref_cairo_surface (GdkSurface *surface) { - GdkWindowImplX11 *impl = GDK_WINDOW_IMPL_X11 (window->impl); + GdkSurfaceImplX11 *impl = GDK_SURFACE_IMPL_X11 (surface->impl); - if (GDK_WINDOW_DESTROYED (window)) + if (GDK_SURFACE_DESTROYED (surface)) return NULL; if (!impl->cairo_surface) { impl->cairo_surface = gdk_x11_create_cairo_surface (impl, - gdk_window_get_width (window) * impl->window_scale, - gdk_window_get_height (window) * impl->window_scale); - cairo_surface_set_device_scale (impl->cairo_surface, impl->window_scale, impl->window_scale); + gdk_surface_get_width (surface) * impl->surface_scale, + gdk_surface_get_height (surface) * impl->surface_scale); + cairo_surface_set_device_scale (impl->cairo_surface, impl->surface_scale, impl->surface_scale); - if (WINDOW_IS_TOPLEVEL (window) && impl->toplevel->in_frame) - hook_surface_changed (window); + if (SURFACE_IS_TOPLEVEL (surface) && impl->toplevel->in_frame) + hook_surface_changed (surface); } cairo_surface_reference (impl->cairo_surface); @@ -502,25 +502,25 @@ gdk_x11_ref_cairo_surface (GdkWindow *window) } static void -gdk_window_impl_x11_finalize (GObject *object) +gdk_surface_impl_x11_finalize (GObject *object) { - GdkWindow *wrapper; - GdkWindowImplX11 *impl; + GdkSurface *wrapper; + GdkSurfaceImplX11 *impl; - g_return_if_fail (GDK_IS_WINDOW_IMPL_X11 (object)); + g_return_if_fail (GDK_IS_SURFACE_IMPL_X11 (object)); - impl = GDK_WINDOW_IMPL_X11 (object); + impl = GDK_SURFACE_IMPL_X11 (object); wrapper = impl->wrapper; - if (WINDOW_IS_TOPLEVEL (wrapper) && impl->toplevel->in_frame) + if (SURFACE_IS_TOPLEVEL (wrapper) && impl->toplevel->in_frame) unhook_surface_changed (wrapper); - _gdk_x11_window_grab_check_destroy (wrapper); + _gdk_x11_surface_grab_check_destroy (wrapper); - if (!GDK_WINDOW_DESTROYED (wrapper)) + if (!GDK_SURFACE_DESTROYED (wrapper)) { - GdkDisplay *display = GDK_WINDOW_DISPLAY (wrapper); + GdkDisplay *display = GDK_SURFACE_DISPLAY (wrapper); _gdk_x11_display_remove_window (display, impl->xid); if (impl->toplevel && impl->toplevel->focus_window) @@ -532,7 +532,7 @@ gdk_window_impl_x11_finalize (GObject *object) if (impl->cursor) g_object_unref (impl->cursor); - G_OBJECT_CLASS (gdk_window_impl_x11_parent_class)->finalize (object); + G_OBJECT_CLASS (gdk_surface_impl_x11_parent_class)->finalize (object); } typedef struct { @@ -595,37 +595,37 @@ _gdk_x11_display_create_bitmap_surface (GdkDisplay *display, return surface; } -/* Create a surface backed with a pixmap without alpha on the same screen as window */ +/* Create a surface backed with a pixmap without alpha on the same screen as surface */ static cairo_surface_t * -gdk_x11_window_create_pixmap_surface (GdkWindow *window, +gdk_x11_surface_create_pixmap_surface (GdkSurface *surface, int width, int height) { GdkDisplay *display; Display *dpy; - cairo_surface_t *surface; + cairo_surface_t *cairo_surface; Pixmap pixmap; - display = gdk_window_get_display (window); + display = gdk_surface_get_display (surface); dpy = GDK_DISPLAY_XDISPLAY (display); pixmap = XCreatePixmap (dpy, - GDK_WINDOW_XID (window), + GDK_SURFACE_XID (surface), width, height, DefaultDepth (dpy, DefaultScreen (dpy))); - surface = cairo_xlib_surface_create (dpy, + cairo_surface = cairo_xlib_surface_create (dpy, pixmap, DefaultVisual (dpy, DefaultScreen (dpy)), width, height); - attach_free_pixmap_handler (surface, display, pixmap); + attach_free_pixmap_handler (cairo_surface, display, pixmap); - return surface; + return cairo_surface; } static void -set_wm_protocols (GdkWindow *window) +set_wm_protocols (GdkSurface *surface) { - GdkDisplay *display = gdk_window_get_display (window); + GdkDisplay *display = gdk_surface_get_display (surface); Atom protocols[4]; int n = 0; @@ -638,7 +638,7 @@ set_wm_protocols (GdkWindow *window) protocols[n++] = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_SYNC_REQUEST"); #endif - XSetWMProtocols (GDK_DISPLAY_XDISPLAY (display), GDK_WINDOW_XID (window), protocols, n); + XSetWMProtocols (GDK_DISPLAY_XDISPLAY (display), GDK_SURFACE_XID (surface), protocols, n); } static const gchar * @@ -704,13 +704,13 @@ create_focus_window (GdkDisplay *display, } static void -ensure_sync_counter (GdkWindow *window) +ensure_sync_counter (GdkSurface *surface) { #ifdef HAVE_XSYNC - if (!GDK_WINDOW_DESTROYED (window)) + if (!GDK_SURFACE_DESTROYED (surface)) { - GdkDisplay *display = GDK_WINDOW_DISPLAY (window); - GdkToplevelX11 *toplevel = _gdk_x11_window_get_toplevel (window); + GdkDisplay *display = GDK_SURFACE_DISPLAY (surface); + GdkToplevelX11 *toplevel = _gdk_x11_surface_get_toplevel (surface); if (toplevel && toplevel->update_counter == None && @@ -731,7 +731,7 @@ ensure_sync_counter (GdkWindow *window) counters[0] = toplevel->update_counter; counters[1] = toplevel->extended_update_counter; - XChangeProperty (xdisplay, GDK_WINDOW_XID (window), + XChangeProperty (xdisplay, GDK_SURFACE_XID (surface), atom, XA_CARDINAL, 32, PropModeReplace, (guchar *)counters, 2); @@ -743,29 +743,29 @@ ensure_sync_counter (GdkWindow *window) } static void -setup_toplevel_window (GdkWindow *window, +setup_toplevel_window (GdkSurface *surface, GdkX11Screen *x11_screen) { - GdkToplevelX11 *toplevel = _gdk_x11_window_get_toplevel (window); - GdkWindowImplX11 *impl = GDK_WINDOW_IMPL_X11 (window->impl); - GdkDisplay *display = gdk_window_get_display (window); - Display *xdisplay = GDK_WINDOW_XDISPLAY (window); - XID xid = GDK_WINDOW_XID (window); + GdkToplevelX11 *toplevel = _gdk_x11_surface_get_toplevel (surface); + GdkSurfaceImplX11 *impl = GDK_SURFACE_IMPL_X11 (surface->impl); + GdkDisplay *display = gdk_surface_get_display (surface); + Display *xdisplay = GDK_SURFACE_XDISPLAY (surface); + XID xid = GDK_SURFACE_XID (surface); XSizeHints size_hints; long pid; Window leader_window; - set_wm_protocols (window); + set_wm_protocols (surface); - if (!window->input_only) + if (!surface->input_only) { - /* The focus window is off the visible area, and serves to receive key - * press events so they don't get sent to child windows. + /* The focus surface is off the visible area, and serves to receive key + * press events so they don't get sent to child surfaces. */ toplevel->focus_window = create_focus_window (display, xid); _gdk_x11_display_add_window (x11_screen->display, &toplevel->focus_window, - window); + surface); } check_leader_window_title (x11_screen->display); @@ -775,8 +775,8 @@ setup_toplevel_window (GdkWindow *window, * correct value??? */ size_hints.flags = PSize; - size_hints.width = window->width * impl->window_scale; - size_hints.height = window->height * impl->window_scale; + size_hints.width = surface->width * impl->surface_scale; + size_hints.height = surface->height * impl->surface_scale; XSetWMNormalHints (xdisplay, xid, &size_hints); @@ -804,60 +804,60 @@ setup_toplevel_window (GdkWindow *window, XA_WINDOW, 32, PropModeReplace, (guchar *) &toplevel->focus_window, 1); - if (!window->focus_on_map) - gdk_x11_window_set_user_time (window, 0); + if (!surface->focus_on_map) + gdk_x11_surface_set_user_time (surface, 0); else if (GDK_X11_DISPLAY (x11_screen->display)->user_time != 0) - gdk_x11_window_set_user_time (window, GDK_X11_DISPLAY (x11_screen->display)->user_time); + gdk_x11_surface_set_user_time (surface, GDK_X11_DISPLAY (x11_screen->display)->user_time); - ensure_sync_counter (window); + ensure_sync_counter (surface); /* Start off in a frozen state - we'll finish this when we first paint */ - gdk_x11_window_begin_frame (window, TRUE); + gdk_x11_surface_begin_frame (surface, TRUE); } static void on_frame_clock_before_paint (GdkFrameClock *clock, - GdkWindow *window) + GdkSurface *surface) { - gdk_x11_window_predict_presentation_time (window); - gdk_x11_window_begin_frame (window, FALSE); + gdk_x11_surface_predict_presentation_time (surface); + gdk_x11_surface_begin_frame (surface, FALSE); } static void on_frame_clock_after_paint (GdkFrameClock *clock, - GdkWindow *window) + GdkSurface *surface) { - gdk_x11_window_end_frame (window); + gdk_x11_surface_end_frame (surface); } static void -connect_frame_clock (GdkWindow *window) +connect_frame_clock (GdkSurface *surface) { - GdkWindowImplX11 *impl; + GdkSurfaceImplX11 *impl; - impl = GDK_WINDOW_IMPL_X11 (window->impl); - if (WINDOW_IS_TOPLEVEL (window) && !impl->frame_clock_connected) + impl = GDK_SURFACE_IMPL_X11 (surface->impl); + if (SURFACE_IS_TOPLEVEL (surface) && !impl->frame_clock_connected) { - GdkFrameClock *frame_clock = gdk_window_get_frame_clock (window); + GdkFrameClock *frame_clock = gdk_surface_get_frame_clock (surface); g_signal_connect (frame_clock, "before-paint", - G_CALLBACK (on_frame_clock_before_paint), window); + G_CALLBACK (on_frame_clock_before_paint), surface); g_signal_connect (frame_clock, "after-paint", - G_CALLBACK (on_frame_clock_after_paint), window); + G_CALLBACK (on_frame_clock_after_paint), surface); impl->frame_clock_connected = TRUE; } } void -_gdk_x11_display_create_window_impl (GdkDisplay *display, - GdkWindow *window, - GdkWindow *real_parent, +_gdk_x11_display_create_surface_impl (GdkDisplay *display, + GdkSurface *surface, + GdkSurface *real_parent, GdkEventMask event_mask, - GdkWindowAttr *attributes) + GdkSurfaceAttr *attributes) { - GdkWindowImplX11 *impl; + GdkSurfaceImplX11 *impl; GdkX11Screen *x11_screen; GdkX11Display *display_x11; @@ -878,14 +878,14 @@ _gdk_x11_display_create_window_impl (GdkDisplay *display, display_x11 = GDK_X11_DISPLAY (display); x11_screen = GDK_X11_SCREEN (display_x11->screen); if (real_parent) - xparent = GDK_WINDOW_XID (real_parent); + xparent = GDK_SURFACE_XID (real_parent); else xparent = GDK_SCREEN_XROOTWIN (x11_screen); - impl = g_object_new (GDK_TYPE_WINDOW_IMPL_X11, NULL); - window->impl = GDK_WINDOW_IMPL (impl); - impl->wrapper = GDK_WINDOW (window); - impl->window_scale = x11_screen->window_scale; + impl = g_object_new (GDK_TYPE_SURFACE_IMPL_X11, NULL); + surface->impl = GDK_SURFACE_IMPL (impl); + impl->wrapper = GDK_SURFACE (surface); + impl->surface_scale = x11_screen->surface_scale; xdisplay = x11_screen->xdisplay; @@ -896,24 +896,24 @@ _gdk_x11_display_create_window_impl (GdkDisplay *display, impl->override_redirect = FALSE; /* Sanity checks */ - switch (window->window_type) + switch (surface->surface_type) { - case GDK_WINDOW_TOPLEVEL: - case GDK_WINDOW_TEMP: - if (window->parent) + case GDK_SURFACE_TOPLEVEL: + case GDK_SURFACE_TEMP: + if (surface->parent) { /* The common code warns for this case */ xparent = GDK_SCREEN_XROOTWIN (x11_screen); } break; - case GDK_WINDOW_CHILD: + case GDK_SURFACE_CHILD: default: g_assert_not_reached (); break; } - if (!window->input_only) + if (!surface->input_only) { class = InputOutput; @@ -928,7 +928,7 @@ _gdk_x11_display_create_window_impl (GdkDisplay *display, xattributes.colormap = gdk_x11_display_get_window_colormap (display_x11); xattributes_mask |= CWColormap; - if (window->window_type == GDK_WINDOW_TEMP) + if (surface->surface_type == GDK_SURFACE_TEMP) { xattributes.save_under = True; xattributes.override_redirect = True; @@ -944,7 +944,7 @@ _gdk_x11_display_create_window_impl (GdkDisplay *display, { class = InputOnly; - if (window->window_type == GDK_WINDOW_TEMP) + if (surface->surface_type == GDK_SURFACE_TEMP) { xattributes.override_redirect = True; xattributes_mask |= CWOverrideRedirect; @@ -955,24 +955,24 @@ _gdk_x11_display_create_window_impl (GdkDisplay *display, depth = 0; } - if (window->width * impl->window_scale > 32767 || - window->height * impl->window_scale > 32767) + if (surface->width * impl->surface_scale > 32767 || + surface->height * impl->surface_scale > 32767) { g_warning ("Native Windows wider or taller than 32767 pixels are not supported"); - if (window->width * impl->window_scale > 32767) - window->width = 32767 / impl->window_scale; - if (window->height * impl->window_scale > 32767) - window->height = 32767 / impl->window_scale; + if (surface->width * impl->surface_scale > 32767) + surface->width = 32767 / impl->surface_scale; + if (surface->height * impl->surface_scale > 32767) + surface->height = 32767 / impl->surface_scale; } - impl->unscaled_width = window->width * impl->window_scale; - impl->unscaled_height = window->height * impl->window_scale; + impl->unscaled_width = surface->width * impl->surface_scale; + impl->unscaled_height = surface->height * impl->surface_scale; - if (window->parent) + if (surface->parent) { - abs_x = window->parent->abs_x; - abs_y = window->parent->abs_y; + abs_x = surface->parent->abs_x; + abs_y = surface->parent->abs_y; } else { @@ -981,20 +981,20 @@ _gdk_x11_display_create_window_impl (GdkDisplay *display, } impl->xid = XCreateWindow (xdisplay, xparent, - (window->x + abs_x) * impl->window_scale, - (window->y + abs_y) * impl->window_scale, - window->width * impl->window_scale, window->height * impl->window_scale, + (surface->x + abs_x) * impl->surface_scale, + (surface->y + abs_y) * impl->surface_scale, + surface->width * impl->surface_scale, surface->height * impl->surface_scale, 0, depth, class, xvisual, xattributes_mask, &xattributes); - g_object_ref (window); - _gdk_x11_display_add_window (x11_screen->display, &impl->xid, window); + g_object_ref (surface); + _gdk_x11_display_add_window (x11_screen->display, &impl->xid, surface); - 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 ()); class_hint = XAllocClassHint (); class_hint->res_name = (char *) g_get_prgname (); @@ -1002,21 +1002,21 @@ _gdk_x11_display_create_window_impl (GdkDisplay *display, XSetClassHint (xdisplay, impl->xid, class_hint); XFree (class_hint); - setup_toplevel_window (window, x11_screen); + setup_toplevel_window (surface, x11_screen); break; - case GDK_WINDOW_CHILD: + case GDK_SURFACE_CHILD: default: break; } gdk_x11_event_source_select_events ((GdkEventSource *) display_x11->event_source, - GDK_WINDOW_XID (window), event_mask, + GDK_SURFACE_XID (surface), event_mask, StructureNotifyMask | PropertyChangeMask); - connect_frame_clock (window); + connect_frame_clock (surface); - gdk_window_freeze_toplevel_updates (window); + gdk_surface_freeze_toplevel_updates (surface); } static GdkEventMask @@ -1035,29 +1035,29 @@ x_event_mask_to_gdk_event_mask (long mask) } /** - * gdk_x11_window_foreign_new_for_display: + * gdk_x11_surface_foreign_new_for_display: * @display: (type GdkX11Display): the #GdkDisplay where the window handle comes from. * @window: an Xlib Window * - * Wraps a native window in a #GdkWindow. The function will try to - * look up the window using gdk_x11_window_lookup_for_display() first. + * Wraps a native window in a #GdkSurface. The function will try to + * look up the window using gdk_x11_surface_lookup_for_display() first. * If it does not find it there, it will create a new window. * * This may fail if the window has been destroyed. If the window * was already known to GDK, a new reference to the existing - * #GdkWindow is returned. + * #GdkSurface is returned. * - * Returns: (transfer full): a #GdkWindow wrapper for the native + * Returns: (transfer full): a #GdkSurface wrapper for the native * window, or %NULL if the window has been destroyed. The wrapper * will be newly created, if one doesn’t exist already. */ -GdkWindow * -gdk_x11_window_foreign_new_for_display (GdkDisplay *display, +GdkSurface * +gdk_x11_surface_foreign_new_for_display (GdkDisplay *display, Window window) { GdkX11Screen *screen; - GdkWindow *win; - GdkWindowImplX11 *impl; + GdkSurface *win; + GdkSurfaceImplX11 *impl; GdkX11Display *display_x11; XWindowAttributes attrs; Window root, parent; @@ -1069,7 +1069,7 @@ gdk_x11_window_foreign_new_for_display (GdkDisplay *display, display_x11 = GDK_X11_DISPLAY (display); - if ((win = gdk_x11_window_lookup_for_display (display, window)) != NULL) + if ((win = gdk_x11_surface_lookup_for_display (display, window)) != NULL) return g_object_ref (win); gdk_x11_display_error_trap_push (display); @@ -1092,41 +1092,41 @@ gdk_x11_window_foreign_new_for_display (GdkDisplay *display, if (screen == NULL) return NULL; - win = _gdk_display_create_window (display); - win->impl = g_object_new (GDK_TYPE_WINDOW_IMPL_X11, NULL); - win->impl_window = win; + win = _gdk_display_create_surface (display); + win->impl = g_object_new (GDK_TYPE_SURFACE_IMPL_X11, NULL); + win->impl_surface = win; - impl = GDK_WINDOW_IMPL_X11 (win->impl); + impl = GDK_SURFACE_IMPL_X11 (win->impl); impl->wrapper = win; - impl->window_scale = GDK_X11_SCREEN (screen)->window_scale; + impl->surface_scale = GDK_X11_SCREEN (screen)->surface_scale; /* Always treat foreigns as toplevels */ win->parent = NULL; impl->xid = window; - win->x = attrs.x / impl->window_scale; - win->y = attrs.y / impl->window_scale; + win->x = attrs.x / impl->surface_scale; + win->y = attrs.y / impl->surface_scale; impl->unscaled_width = attrs.width; impl->unscaled_height = attrs.height; - win->width = attrs.width / impl->window_scale; - win->height = attrs.height / impl->window_scale; - win->window_type = GDK_WINDOW_FOREIGN; + win->width = attrs.width / impl->surface_scale; + win->height = attrs.height / impl->surface_scale; + win->surface_type = GDK_SURFACE_FOREIGN; win->destroyed = FALSE; win->event_mask = x_event_mask_to_gdk_event_mask (attrs.your_event_mask); if (attrs.map_state == IsUnmapped) - win->state = GDK_WINDOW_STATE_WITHDRAWN; + win->state = GDK_SURFACE_STATE_WITHDRAWN; else win->state = 0; win->viewable = TRUE; g_object_ref (win); - _gdk_x11_display_add_window (display, &GDK_WINDOW_XID (win), win); + _gdk_x11_display_add_window (display, &GDK_SURFACE_XID (win), win); /* Update the clip region, etc */ - _gdk_window_update_size (win); + _gdk_surface_update_size (win); return win; } @@ -1166,20 +1166,20 @@ gdk_toplevel_x11_free_contents (GdkDisplay *display, } static void -gdk_x11_window_destroy (GdkWindow *window, +gdk_x11_surface_destroy (GdkSurface *surface, gboolean recursing, gboolean foreign_destroy) { - GdkWindowImplX11 *impl = GDK_WINDOW_IMPL_X11 (window->impl); + GdkSurfaceImplX11 *impl = GDK_SURFACE_IMPL_X11 (surface->impl); GdkToplevelX11 *toplevel; - g_return_if_fail (GDK_IS_WINDOW (window)); + g_return_if_fail (GDK_IS_SURFACE (surface)); - toplevel = _gdk_x11_window_get_toplevel (window); + toplevel = _gdk_x11_surface_get_toplevel (surface); if (toplevel) - gdk_toplevel_x11_free_contents (GDK_WINDOW_DISPLAY (window), toplevel); + gdk_toplevel_x11_free_contents (GDK_SURFACE_DISPLAY (surface), toplevel); - unhook_surface_changed (window); + unhook_surface_changed (surface); if (impl->cairo_surface) { @@ -1189,53 +1189,53 @@ gdk_x11_window_destroy (GdkWindow *window, } if (!recursing && !foreign_destroy) - XDestroyWindow (GDK_WINDOW_XDISPLAY (window), GDK_WINDOW_XID (window)); + XDestroyWindow (GDK_SURFACE_XDISPLAY (surface), GDK_SURFACE_XID (surface)); } /* This function is called when the XWindow is really gone. */ static void -gdk_x11_window_destroy_notify (GdkWindow *window) +gdk_x11_surface_destroy_notify (GdkSurface *surface) { - GdkWindowImplX11 *window_impl; + GdkSurfaceImplX11 *surface_impl; - window_impl = GDK_WINDOW_IMPL_X11 ((window)->impl); + surface_impl = GDK_SURFACE_IMPL_X11 ((surface)->impl); - if (!GDK_WINDOW_DESTROYED (window)) + if (!GDK_SURFACE_DESTROYED (surface)) { - if (GDK_WINDOW_TYPE(window) != GDK_WINDOW_FOREIGN) - g_warning ("GdkWindow %#lx unexpectedly destroyed", GDK_WINDOW_XID (window)); + if (GDK_SURFACE_TYPE(surface) != GDK_SURFACE_FOREIGN) + g_warning ("GdkSurface %#lx unexpectedly destroyed", GDK_SURFACE_XID (surface)); - _gdk_window_destroy (window, TRUE); + _gdk_surface_destroy (surface, TRUE); } - _gdk_x11_display_remove_window (GDK_WINDOW_DISPLAY (window), GDK_WINDOW_XID (window)); - if (window_impl->toplevel && window_impl->toplevel->focus_window) - _gdk_x11_display_remove_window (GDK_WINDOW_DISPLAY (window), window_impl->toplevel->focus_window); + _gdk_x11_display_remove_window (GDK_SURFACE_DISPLAY (surface), GDK_SURFACE_XID (surface)); + if (surface_impl->toplevel && surface_impl->toplevel->focus_window) + _gdk_x11_display_remove_window (GDK_SURFACE_DISPLAY (surface), surface_impl->toplevel->focus_window); - _gdk_x11_window_grab_check_destroy (window); + _gdk_x11_surface_grab_check_destroy (surface); - g_object_unref (window); + g_object_unref (surface); } static void -update_wm_hints (GdkWindow *window, +update_wm_hints (GdkSurface *surface, gboolean force) { - GdkToplevelX11 *toplevel = _gdk_x11_window_get_toplevel (window); - GdkDisplay *display = GDK_WINDOW_DISPLAY (window); + GdkToplevelX11 *toplevel = _gdk_x11_surface_get_toplevel (surface); + GdkDisplay *display = GDK_SURFACE_DISPLAY (surface); XWMHints wm_hints; if (!force && !toplevel->is_leader && - window->state & GDK_WINDOW_STATE_WITHDRAWN) + surface->state & GDK_SURFACE_STATE_WITHDRAWN) return; wm_hints.flags = StateHint | InputHint; - wm_hints.input = window->accept_focus ? True : False; + wm_hints.input = surface->accept_focus ? True : False; wm_hints.initial_state = NormalState; - if (window->state & GDK_WINDOW_STATE_ICONIFIED) + if (surface->state & GDK_SURFACE_STATE_ICONIFIED) { wm_hints.flags |= StateHint; wm_hints.initial_state = IconicState; @@ -1254,10 +1254,10 @@ update_wm_hints (GdkWindow *window, } wm_hints.flags |= WindowGroupHint; - if (toplevel->group_leader && !GDK_WINDOW_DESTROYED (toplevel->group_leader)) + if (toplevel->group_leader && !GDK_SURFACE_DESTROYED (toplevel->group_leader)) { wm_hints.flags |= WindowGroupHint; - wm_hints.window_group = GDK_WINDOW_XID (toplevel->group_leader); + wm_hints.window_group = GDK_SURFACE_XID (toplevel->group_leader); } else wm_hints.window_group = GDK_X11_DISPLAY (display)->leader_window; @@ -1265,27 +1265,27 @@ update_wm_hints (GdkWindow *window, if (toplevel->urgency_hint) wm_hints.flags |= XUrgencyHint; - XSetWMHints (GDK_WINDOW_XDISPLAY (window), - GDK_WINDOW_XID (window), + XSetWMHints (GDK_SURFACE_XDISPLAY (surface), + GDK_SURFACE_XID (surface), &wm_hints); } static void -set_initial_hints (GdkWindow *window) +set_initial_hints (GdkSurface *surface) { - GdkDisplay *display = GDK_WINDOW_DISPLAY (window); + GdkDisplay *display = GDK_SURFACE_DISPLAY (surface); Display *xdisplay = GDK_DISPLAY_XDISPLAY (display); - Window xwindow = GDK_WINDOW_XID (window); + Window xwindow = GDK_SURFACE_XID (surface); GdkToplevelX11 *toplevel; Atom atoms[9]; gint i; - toplevel = _gdk_x11_window_get_toplevel (window); + toplevel = _gdk_x11_surface_get_toplevel (surface); if (!toplevel) return; - update_wm_hints (window, TRUE); + update_wm_hints (surface, TRUE); /* We set the spec hints regardless of whether the spec is supported, * since it can't hurt and it's kind of expensive to check whether @@ -1294,7 +1294,7 @@ set_initial_hints (GdkWindow *window) i = 0; - if (window->state & GDK_WINDOW_STATE_MAXIMIZED) + if (surface->state & GDK_SURFACE_STATE_MAXIMIZED) { atoms[i] = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_STATE_MAXIMIZED_VERT"); @@ -1305,21 +1305,21 @@ set_initial_hints (GdkWindow *window) toplevel->have_maxhorz = toplevel->have_maxvert = TRUE; } - if (window->state & GDK_WINDOW_STATE_ABOVE) + if (surface->state & GDK_SURFACE_STATE_ABOVE) { atoms[i] = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_STATE_ABOVE"); ++i; } - if (window->state & GDK_WINDOW_STATE_BELOW) + if (surface->state & GDK_SURFACE_STATE_BELOW) { atoms[i] = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_STATE_BELOW"); ++i; } - if (window->state & GDK_WINDOW_STATE_STICKY) + if (surface->state & GDK_SURFACE_STATE_STICKY) { atoms[i] = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_STATE_STICKY"); @@ -1327,7 +1327,7 @@ set_initial_hints (GdkWindow *window) toplevel->have_sticky = TRUE; } - if (window->state & GDK_WINDOW_STATE_FULLSCREEN) + if (surface->state & GDK_SURFACE_STATE_FULLSCREEN) { atoms[i] = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_STATE_FULLSCREEN"); @@ -1335,7 +1335,7 @@ set_initial_hints (GdkWindow *window) toplevel->have_fullscreen = TRUE; } - if (window->modal_hint) + if (surface->modal_hint) { atoms[i] = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_STATE_MODAL"); @@ -1356,7 +1356,7 @@ set_initial_hints (GdkWindow *window) ++i; } - if (window->state & GDK_WINDOW_STATE_ICONIFIED) + if (surface->state & GDK_SURFACE_STATE_ICONIFIED) { atoms[i] = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_STATE_HIDDEN"); @@ -1379,7 +1379,7 @@ set_initial_hints (GdkWindow *window) gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_STATE")); } - if (window->state & GDK_WINDOW_STATE_STICKY) + if (surface->state & GDK_SURFACE_STATE_STICKY) { atoms[0] = 0xFFFFFFFF; XChangeProperty (xdisplay, @@ -1400,27 +1400,27 @@ set_initial_hints (GdkWindow *window) } static void -gdk_window_x11_show (GdkWindow *window, gboolean already_mapped) +gdk_surface_x11_show (GdkSurface *surface, gboolean already_mapped) { GdkDisplay *display; GdkX11Display *display_x11; GdkToplevelX11 *toplevel; - Display *xdisplay = GDK_WINDOW_XDISPLAY (window); - Window xwindow = GDK_WINDOW_XID (window); + Display *xdisplay = GDK_SURFACE_XDISPLAY (surface); + Window xwindow = GDK_SURFACE_XID (surface); if (!already_mapped) - set_initial_hints (window); + set_initial_hints (surface); - if (WINDOW_IS_TOPLEVEL (window)) + if (SURFACE_IS_TOPLEVEL (surface)) { - display = gdk_window_get_display (window); + display = gdk_surface_get_display (surface); display_x11 = GDK_X11_DISPLAY (display); - toplevel = _gdk_x11_window_get_toplevel (window); + toplevel = _gdk_x11_surface_get_toplevel (surface); if (toplevel->user_time != 0 && display_x11->user_time != 0 && XSERVER_TIME_IS_LATER (display_x11->user_time, toplevel->user_time)) - gdk_x11_window_set_user_time (window, display_x11->user_time); + gdk_x11_surface_set_user_time (surface, display_x11->user_time); } XMapWindow (xdisplay, xwindow); @@ -1429,81 +1429,81 @@ gdk_window_x11_show (GdkWindow *window, gboolean already_mapped) * when mapping a window. This also ensures that the default behavior remains * consistent with pre-fullscreen mode implementation. */ - if (window->fullscreen_mode != GDK_FULLSCREEN_ON_CURRENT_MONITOR) - gdk_x11_window_apply_fullscreen_mode (window); + if (surface->fullscreen_mode != GDK_FULLSCREEN_ON_CURRENT_MONITOR) + gdk_x11_surface_apply_fullscreen_mode (surface); } static void -gdk_window_x11_hide (GdkWindow *window) +gdk_surface_x11_hide (GdkSurface *surface) { /* We'll get the unmap notify eventually, and handle it then, * but checking here makes things more consistent if we are * just doing stuff ourself. */ - _gdk_x11_window_grab_check_unmap (window, - NextRequest (GDK_WINDOW_XDISPLAY (window))); + _gdk_x11_surface_grab_check_unmap (surface, + NextRequest (GDK_SURFACE_XDISPLAY (surface))); - /* You can't simply unmap toplevel windows. */ - switch (window->window_type) + /* You can't simply unmap toplevel surfaces. */ + switch (surface->surface_type) { - case GDK_WINDOW_TOPLEVEL: - case GDK_WINDOW_TEMP: /* ? */ - gdk_window_withdraw (window); + case GDK_SURFACE_TOPLEVEL: + case GDK_SURFACE_TEMP: /* ? */ + gdk_surface_withdraw (surface); return; - case GDK_WINDOW_FOREIGN: - case GDK_WINDOW_CHILD: + case GDK_SURFACE_FOREIGN: + case GDK_SURFACE_CHILD: default: break; } - _gdk_window_clear_update_area (window); + _gdk_surface_clear_update_area (surface); - XUnmapWindow (GDK_WINDOW_XDISPLAY (window), - GDK_WINDOW_XID (window)); + XUnmapWindow (GDK_SURFACE_XDISPLAY (surface), + GDK_SURFACE_XID (surface)); } static void -gdk_window_x11_withdraw (GdkWindow *window) +gdk_surface_x11_withdraw (GdkSurface *surface) { - if (!window->destroyed) + if (!surface->destroyed) { - if (GDK_WINDOW_IS_MAPPED (window)) - gdk_synthesize_window_state (window, + if (GDK_SURFACE_IS_MAPPED (surface)) + gdk_synthesize_surface_state (surface, 0, - GDK_WINDOW_STATE_WITHDRAWN); + GDK_SURFACE_STATE_WITHDRAWN); - g_assert (!GDK_WINDOW_IS_MAPPED (window)); + g_assert (!GDK_SURFACE_IS_MAPPED (surface)); - XWithdrawWindow (GDK_WINDOW_XDISPLAY (window), - GDK_WINDOW_XID (window), 0); + XWithdrawWindow (GDK_SURFACE_XDISPLAY (surface), + GDK_SURFACE_XID (surface), 0); } } static inline void -window_x11_move (GdkWindow *window, +surface_x11_move (GdkSurface *surface, gint x, gint y) { - GdkWindowImplX11 *impl = GDK_WINDOW_IMPL_X11 (window->impl); + GdkSurfaceImplX11 *impl = GDK_SURFACE_IMPL_X11 (surface->impl); - XMoveWindow (GDK_WINDOW_XDISPLAY (window), - GDK_WINDOW_XID (window), - x * impl->window_scale, y * impl->window_scale); + XMoveWindow (GDK_SURFACE_XDISPLAY (surface), + GDK_SURFACE_XID (surface), + x * impl->surface_scale, y * impl->surface_scale); if (impl->override_redirect) { - window->x = x; - window->y = y; + surface->x = x; + surface->y = y; } } static inline void -window_x11_resize (GdkWindow *window, +surface_x11_resize (GdkSurface *surface, gint width, gint height) { - GdkWindowImplX11 *impl = GDK_WINDOW_IMPL_X11 (window->impl); + GdkSurfaceImplX11 *impl = GDK_SURFACE_IMPL_X11 (surface->impl); if (width < 1) width = 1; @@ -1511,35 +1511,35 @@ window_x11_resize (GdkWindow *window, if (height < 1) height = 1; - window_pre_damage (window); + surface_pre_damage (surface); - XResizeWindow (GDK_WINDOW_XDISPLAY (window), - GDK_WINDOW_XID (window), - width * impl->window_scale, height * impl->window_scale); + XResizeWindow (GDK_SURFACE_XDISPLAY (surface), + GDK_SURFACE_XID (surface), + width * impl->surface_scale, height * impl->surface_scale); if (impl->override_redirect) { - impl->unscaled_width = width * impl->window_scale; - impl->unscaled_height = height * impl->window_scale; - window->width = width; - window->height = height; - _gdk_x11_window_update_size (GDK_WINDOW_IMPL_X11 (window->impl)); + impl->unscaled_width = width * impl->surface_scale; + impl->unscaled_height = height * impl->surface_scale; + surface->width = width; + surface->height = height; + _gdk_x11_surface_update_size (GDK_SURFACE_IMPL_X11 (surface->impl)); } else { - if (width * impl->window_scale != impl->unscaled_width || height * impl->window_scale != impl->unscaled_height) - window->resize_count += 1; + if (width * impl->surface_scale != impl->unscaled_width || height * impl->surface_scale != impl->unscaled_height) + surface->resize_count += 1; } } static inline void -window_x11_move_resize (GdkWindow *window, +surface_x11_move_resize (GdkSurface *surface, gint x, gint y, gint width, gint height) { - GdkWindowImplX11 *impl = GDK_WINDOW_IMPL_X11 (window->impl); + GdkSurfaceImplX11 *impl = GDK_SURFACE_IMPL_X11 (surface->impl); if (width < 1) width = 1; @@ -1547,34 +1547,34 @@ window_x11_move_resize (GdkWindow *window, if (height < 1) height = 1; - window_pre_damage (window); + surface_pre_damage (surface); - XMoveResizeWindow (GDK_WINDOW_XDISPLAY (window), - GDK_WINDOW_XID (window), - x * impl->window_scale, y * impl->window_scale, - width * impl->window_scale, height * impl->window_scale); + XMoveResizeWindow (GDK_SURFACE_XDISPLAY (surface), + GDK_SURFACE_XID (surface), + x * impl->surface_scale, y * impl->surface_scale, + width * impl->surface_scale, height * impl->surface_scale); if (impl->override_redirect) { - window->x = x; - window->y = y; + surface->x = x; + surface->y = y; - impl->unscaled_width = width * impl->window_scale; - impl->unscaled_height = height * impl->window_scale; - window->width = width; - window->height = height; + impl->unscaled_width = width * impl->surface_scale; + impl->unscaled_height = height * impl->surface_scale; + surface->width = width; + surface->height = height; - _gdk_x11_window_update_size (GDK_WINDOW_IMPL_X11 (window->impl)); + _gdk_x11_surface_update_size (GDK_SURFACE_IMPL_X11 (surface->impl)); } else { - if (width * impl->window_scale != impl->unscaled_width || height * impl->window_scale != impl->unscaled_height) - window->resize_count += 1; + if (width * impl->surface_scale != impl->unscaled_width || height * impl->surface_scale != impl->unscaled_height) + surface->resize_count += 1; } } static void -gdk_window_x11_move_resize (GdkWindow *window, +gdk_surface_x11_move_resize (GdkSurface *surface, gboolean with_move, gint x, gint y, @@ -1582,131 +1582,131 @@ gdk_window_x11_move_resize (GdkWindow *window, gint height) { if (with_move && (width < 0 && height < 0)) - window_x11_move (window, x, y); + surface_x11_move (surface, x, y); else { if (with_move) - window_x11_move_resize (window, x, y, width, height); + surface_x11_move_resize (surface, x, y, width, height); else - window_x11_resize (window, width, height); + surface_x11_resize (surface, width, height); } } void -_gdk_x11_window_set_window_scale (GdkWindow *window, +_gdk_x11_surface_set_surface_scale (GdkSurface *surface, int scale) { - GdkWindowImplX11 *impl; + GdkSurfaceImplX11 *impl; GdkToplevelX11 *toplevel; - GdkWindowHints geom_mask; + GdkSurfaceHints geom_mask; - impl = GDK_WINDOW_IMPL_X11 (window->impl); + impl = GDK_SURFACE_IMPL_X11 (surface->impl); - impl->window_scale = scale; + impl->surface_scale = scale; if (impl->cairo_surface) - cairo_surface_set_device_scale (impl->cairo_surface, impl->window_scale, impl->window_scale); - _gdk_window_update_size (window); + cairo_surface_set_device_scale (impl->cairo_surface, impl->surface_scale, impl->surface_scale); + _gdk_surface_update_size (surface); - toplevel = _gdk_x11_window_get_toplevel (window); - if (toplevel && window->window_type != GDK_WINDOW_FOREIGN) + toplevel = _gdk_x11_surface_get_toplevel (surface); + if (toplevel && surface->surface_type != GDK_SURFACE_FOREIGN) { - /* These are affected by window scale: */ + /* These are affected by surface scale: */ geom_mask = toplevel->last_geometry_hints_mask & (GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE | GDK_HINT_BASE_SIZE | GDK_HINT_RESIZE_INC); if (geom_mask) - gdk_window_set_geometry_hints (window, + gdk_surface_set_geometry_hints (surface, &toplevel->last_geometry_hints, geom_mask); } - if (window->window_type == GDK_WINDOW_FOREIGN) - XMoveWindow (GDK_WINDOW_XDISPLAY (window), - GDK_WINDOW_XID (window), - window->x * impl->window_scale, - window->y * impl->window_scale); + if (surface->surface_type == GDK_SURFACE_FOREIGN) + XMoveWindow (GDK_SURFACE_XDISPLAY (surface), + GDK_SURFACE_XID (surface), + surface->x * impl->surface_scale, + surface->y * impl->surface_scale); else { if (impl->override_redirect) { - impl->unscaled_width = window->width * impl->window_scale; - impl->unscaled_height = window->height * impl->window_scale; + impl->unscaled_width = surface->width * impl->surface_scale; + impl->unscaled_height = surface->height * impl->surface_scale; } - XResizeWindow (GDK_WINDOW_XDISPLAY (window), - GDK_WINDOW_XID (window), - window->width * impl->window_scale, - window->height * impl->window_scale); + XResizeWindow (GDK_SURFACE_XDISPLAY (surface), + GDK_SURFACE_XID (surface), + surface->width * impl->surface_scale, + surface->height * impl->surface_scale); } - gdk_window_invalidate_rect (window, NULL, TRUE); + gdk_surface_invalidate_rect (surface, NULL, TRUE); } static void -gdk_window_x11_raise (GdkWindow *window) +gdk_surface_x11_raise (GdkSurface *surface) { - XRaiseWindow (GDK_WINDOW_XDISPLAY (window), GDK_WINDOW_XID (window)); + XRaiseWindow (GDK_SURFACE_XDISPLAY (surface), GDK_SURFACE_XID (surface)); } static void -gdk_window_x11_restack_toplevel (GdkWindow *window, - GdkWindow *sibling, +gdk_surface_x11_restack_toplevel (GdkSurface *surface, + GdkSurface *sibling, gboolean above) { XWindowChanges changes; - changes.sibling = GDK_WINDOW_XID (sibling); + changes.sibling = GDK_SURFACE_XID (sibling); changes.stack_mode = above ? Above : Below; - XReconfigureWMWindow (GDK_WINDOW_XDISPLAY (window), - GDK_WINDOW_XID (window), - gdk_x11_screen_get_screen_number (GDK_WINDOW_SCREEN (window)), + XReconfigureWMWindow (GDK_SURFACE_XDISPLAY (surface), + GDK_SURFACE_XID (surface), + gdk_x11_screen_get_screen_number (GDK_SURFACE_SCREEN (surface)), CWStackMode | CWSibling, &changes); } static void -gdk_window_x11_lower (GdkWindow *window) +gdk_surface_x11_lower (GdkSurface *surface) { - XLowerWindow (GDK_WINDOW_XDISPLAY (window), GDK_WINDOW_XID (window)); + XLowerWindow (GDK_SURFACE_XDISPLAY (surface), GDK_SURFACE_XID (surface)); } /** - * gdk_x11_window_move_to_current_desktop: - * @window: (type GdkX11Window): a #GdkWindow + * gdk_x11_surface_move_to_current_desktop: + * @surface: (type GdkX11Surface): a #GdkSurface * - * Moves the window to the correct workspace when running under a + * Moves the surface to the correct workspace when running under a * window manager that supports multiple workspaces, as described * in the [Extended Window Manager Hints](http://www.freedesktop.org/Standards/wm-spec) specification. - * Will not do anything if the window is already on all workspaces. + * Will not do anything if the surface is already on all workspaces. */ void -gdk_x11_window_move_to_current_desktop (GdkWindow *window) +gdk_x11_surface_move_to_current_desktop (GdkSurface *surface) { GdkToplevelX11 *toplevel; - g_return_if_fail (GDK_IS_WINDOW (window)); - g_return_if_fail (GDK_WINDOW_TYPE (window) != GDK_WINDOW_CHILD); + g_return_if_fail (GDK_IS_SURFACE (surface)); + g_return_if_fail (GDK_SURFACE_TYPE (surface) != GDK_SURFACE_CHILD); - toplevel = _gdk_x11_window_get_toplevel (window); + toplevel = _gdk_x11_surface_get_toplevel (surface); if (toplevel->on_all_desktops) return; - move_to_current_desktop (window); + move_to_current_desktop (surface); } static void -move_to_current_desktop (GdkWindow *window) +move_to_current_desktop (GdkSurface *surface) { guint32 desktop; - desktop = gdk_x11_screen_get_current_desktop (GDK_WINDOW_SCREEN (window)); - gdk_x11_window_move_to_desktop (window, desktop); + desktop = gdk_x11_screen_get_current_desktop (GDK_SURFACE_SCREEN (surface)); + gdk_x11_surface_move_to_desktop (surface, desktop); } static guint32 -get_netwm_cardinal_property (GdkWindow *window, +get_netwm_cardinal_property (GdkSurface *surface, const gchar *name) { - GdkX11Screen *x11_screen = GDK_WINDOW_SCREEN (window); + GdkX11Screen *x11_screen = GDK_SURFACE_SCREEN (surface); GdkAtom atom; guint32 prop = 0; Atom type; @@ -1721,8 +1721,8 @@ get_netwm_cardinal_property (GdkWindow *window, return 0; XGetWindowProperty (x11_screen->xdisplay, - GDK_WINDOW_XID (window), - gdk_x11_get_xatom_by_name_for_display (GDK_WINDOW_DISPLAY (window), name), + GDK_SURFACE_XID (surface), + gdk_x11_get_xatom_by_name_for_display (GDK_SURFACE_DISPLAY (surface), name), 0, G_MAXLONG, False, XA_CARDINAL, &type, &format, &nitems, &bytes_after, &data); @@ -1736,49 +1736,49 @@ get_netwm_cardinal_property (GdkWindow *window, } /** - * gdk_x11_window_get_desktop: - * @window: (type GdkX11Window): a #GdkWindow + * gdk_x11_surface_get_desktop: + * @surface: (type GdkX11Surface): a #GdkSurface * - * Gets the number of the workspace @window is on. + * Gets the number of the workspace @surface is on. * - * Returns: the current workspace of @window + * Returns: the current workspace of @surface */ guint32 -gdk_x11_window_get_desktop (GdkWindow *window) +gdk_x11_surface_get_desktop (GdkSurface *surface) { - g_return_val_if_fail (GDK_IS_WINDOW (window), 0); + g_return_val_if_fail (GDK_IS_SURFACE (surface), 0); - return get_netwm_cardinal_property (window, "_NET_WM_DESKTOP"); + return get_netwm_cardinal_property (surface, "_NET_WM_DESKTOP"); } /** - * gdk_x11_window_move_to_desktop: - * @window: (type GdkX11Window): a #GdkWindow - * @desktop: the number of the workspace to move the window to + * gdk_x11_surface_move_to_desktop: + * @surface: (type GdkX11Surface): a #GdkSurface + * @desktop: the number of the workspace to move the surface to * - * Moves the window to the given workspace when running unde a + * Moves the surface to the given workspace when running unde a * window manager that supports multiple workspaces, as described * in the [Extended Window Manager Hints](http://www.freedesktop.org/Standards/wm-spec) specification. */ void -gdk_x11_window_move_to_desktop (GdkWindow *window, +gdk_x11_surface_move_to_desktop (GdkSurface *surface, guint32 desktop) { GdkAtom atom; XClientMessageEvent xclient; - g_return_if_fail (GDK_IS_WINDOW (window)); + g_return_if_fail (GDK_IS_SURFACE (surface)); atom = g_intern_static_string ("_NET_WM_DESKTOP"); - if (!gdk_x11_screen_supports_net_wm_hint (GDK_WINDOW_SCREEN (window), atom)) + if (!gdk_x11_screen_supports_net_wm_hint (GDK_SURFACE_SCREEN (surface), atom)) return; memset (&xclient, 0, sizeof (xclient)); xclient.type = ClientMessage; xclient.serial = 0; xclient.send_event = True; - xclient.window = GDK_WINDOW_XID (window); - xclient.message_type = gdk_x11_atom_to_xatom_for_display (GDK_WINDOW_DISPLAY (window), atom); + xclient.window = GDK_SURFACE_XID (surface); + xclient.message_type = gdk_x11_atom_to_xatom_for_display (GDK_SURFACE_DISPLAY (surface), atom); xclient.format = 32; xclient.data.l[0] = desktop; @@ -1787,35 +1787,35 @@ gdk_x11_window_move_to_desktop (GdkWindow *window, xclient.data.l[3] = 0; xclient.data.l[4] = 0; - XSendEvent (GDK_WINDOW_XDISPLAY (window), - GDK_WINDOW_XROOTWIN (window), + XSendEvent (GDK_SURFACE_XDISPLAY (surface), + GDK_SURFACE_XROOTWIN (surface), False, SubstructureRedirectMask | SubstructureNotifyMask, (XEvent *)&xclient); } static void -gdk_x11_window_focus (GdkWindow *window, +gdk_x11_surface_focus (GdkSurface *surface, guint32 timestamp) { GdkDisplay *display; - g_return_if_fail (GDK_IS_WINDOW (window)); + g_return_if_fail (GDK_IS_SURFACE (surface)); - if (GDK_WINDOW_DESTROYED (window) || - !WINDOW_IS_TOPLEVEL_OR_FOREIGN (window)) + if (GDK_SURFACE_DESTROYED (surface) || + !SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface)) return; - display = GDK_WINDOW_DISPLAY (window); + display = GDK_SURFACE_DISPLAY (surface); - if (gdk_x11_screen_supports_net_wm_hint (GDK_WINDOW_SCREEN (window), + if (gdk_x11_screen_supports_net_wm_hint (GDK_SURFACE_SCREEN (surface), g_intern_static_string ("_NET_ACTIVE_WINDOW"))) { XClientMessageEvent xclient; memset (&xclient, 0, sizeof (xclient)); xclient.type = ClientMessage; - xclient.window = GDK_WINDOW_XID (window); + xclient.window = GDK_SURFACE_XID (surface); xclient.message_type = gdk_x11_get_xatom_by_name_for_display (display, "_NET_ACTIVE_WINDOW"); xclient.format = 32; @@ -1825,20 +1825,20 @@ gdk_x11_window_focus (GdkWindow *window, xclient.data.l[3] = 0; xclient.data.l[4] = 0; - XSendEvent (GDK_DISPLAY_XDISPLAY (display), GDK_WINDOW_XROOTWIN (window), False, + XSendEvent (GDK_DISPLAY_XDISPLAY (display), GDK_SURFACE_XROOTWIN (surface), False, SubstructureRedirectMask | SubstructureNotifyMask, (XEvent *)&xclient); } else { - XRaiseWindow (GDK_DISPLAY_XDISPLAY (display), GDK_WINDOW_XID (window)); + XRaiseWindow (GDK_DISPLAY_XDISPLAY (display), GDK_SURFACE_XID (surface)); /* There is no way of knowing reliably whether we are viewable; * so trap errors asynchronously around the XSetInputFocus call */ gdk_x11_display_error_trap_push (display); XSetInputFocus (GDK_DISPLAY_XDISPLAY (display), - GDK_WINDOW_XID (window), + GDK_SURFACE_XID (surface), RevertToParent, timestamp); gdk_x11_display_error_trap_pop_ignored (display); @@ -1846,95 +1846,95 @@ gdk_x11_window_focus (GdkWindow *window, } static void -gdk_x11_window_set_type_hint (GdkWindow *window, - GdkWindowTypeHint hint) +gdk_x11_surface_set_type_hint (GdkSurface *surface, + GdkSurfaceTypeHint hint) { GdkDisplay *display; Atom atom; - if (GDK_WINDOW_DESTROYED (window) || - !WINDOW_IS_TOPLEVEL_OR_FOREIGN (window)) + if (GDK_SURFACE_DESTROYED (surface) || + !SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface)) return; - display = gdk_window_get_display (window); + display = gdk_surface_get_display (surface); switch (hint) { - case GDK_WINDOW_TYPE_HINT_DIALOG: + case GDK_SURFACE_TYPE_HINT_DIALOG: atom = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_WINDOW_TYPE_DIALOG"); break; - case GDK_WINDOW_TYPE_HINT_MENU: + case GDK_SURFACE_TYPE_HINT_MENU: atom = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_WINDOW_TYPE_MENU"); break; - case GDK_WINDOW_TYPE_HINT_TOOLBAR: + case GDK_SURFACE_TYPE_HINT_TOOLBAR: atom = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_WINDOW_TYPE_TOOLBAR"); break; - case GDK_WINDOW_TYPE_HINT_UTILITY: + case GDK_SURFACE_TYPE_HINT_UTILITY: atom = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_WINDOW_TYPE_UTILITY"); break; - case GDK_WINDOW_TYPE_HINT_SPLASHSCREEN: + case GDK_SURFACE_TYPE_HINT_SPLASHSCREEN: atom = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_WINDOW_TYPE_SPLASH"); break; - case GDK_WINDOW_TYPE_HINT_DOCK: + case GDK_SURFACE_TYPE_HINT_DOCK: atom = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_WINDOW_TYPE_DOCK"); break; - case GDK_WINDOW_TYPE_HINT_DESKTOP: + case GDK_SURFACE_TYPE_HINT_DESKTOP: atom = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_WINDOW_TYPE_DESKTOP"); break; - case GDK_WINDOW_TYPE_HINT_DROPDOWN_MENU: + case GDK_SURFACE_TYPE_HINT_DROPDOWN_MENU: atom = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_WINDOW_TYPE_DROPDOWN_MENU"); break; - case GDK_WINDOW_TYPE_HINT_POPUP_MENU: + case GDK_SURFACE_TYPE_HINT_POPUP_MENU: atom = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_WINDOW_TYPE_POPUP_MENU"); break; - case GDK_WINDOW_TYPE_HINT_TOOLTIP: + case GDK_SURFACE_TYPE_HINT_TOOLTIP: atom = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_WINDOW_TYPE_TOOLTIP"); break; - case GDK_WINDOW_TYPE_HINT_NOTIFICATION: + case GDK_SURFACE_TYPE_HINT_NOTIFICATION: atom = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_WINDOW_TYPE_NOTIFICATION"); break; - case GDK_WINDOW_TYPE_HINT_COMBO: + case GDK_SURFACE_TYPE_HINT_COMBO: atom = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_WINDOW_TYPE_COMBO"); break; - case GDK_WINDOW_TYPE_HINT_DND: + case GDK_SURFACE_TYPE_HINT_DND: atom = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_WINDOW_TYPE_DND"); break; default: - g_warning ("Unknown hint %d passed to gdk_window_set_type_hint", hint); + g_warning ("Unknown hint %d passed to gdk_surface_set_type_hint", hint); /* Fall thru */ - case GDK_WINDOW_TYPE_HINT_NORMAL: + case GDK_SURFACE_TYPE_HINT_NORMAL: atom = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_WINDOW_TYPE_NORMAL"); break; } - XChangeProperty (GDK_DISPLAY_XDISPLAY (display), GDK_WINDOW_XID (window), + XChangeProperty (GDK_DISPLAY_XDISPLAY (display), GDK_SURFACE_XID (surface), gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_WINDOW_TYPE"), XA_ATOM, 32, PropModeReplace, (guchar *)&atom, 1); } -static GdkWindowTypeHint -gdk_x11_window_get_type_hint (GdkWindow *window) +static GdkSurfaceTypeHint +gdk_x11_surface_get_type_hint (GdkSurface *surface) { GdkDisplay *display; - GdkWindowTypeHint type; + GdkSurfaceTypeHint type; Atom type_return; gint format_return; gulong nitems_return; gulong bytes_after_return; guchar *data = NULL; - g_return_val_if_fail (GDK_IS_WINDOW (window), GDK_WINDOW_TYPE_HINT_NORMAL); + g_return_val_if_fail (GDK_IS_SURFACE (surface), GDK_SURFACE_TYPE_HINT_NORMAL); - if (GDK_WINDOW_DESTROYED (window) || - !WINDOW_IS_TOPLEVEL_OR_FOREIGN (window)) - return GDK_WINDOW_TYPE_HINT_NORMAL; + if (GDK_SURFACE_DESTROYED (surface) || + !SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface)) + return GDK_SURFACE_TYPE_HINT_NORMAL; - type = GDK_WINDOW_TYPE_HINT_NORMAL; + type = GDK_SURFACE_TYPE_HINT_NORMAL; - display = gdk_window_get_display (window); + display = gdk_surface_get_display (surface); - if (XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display), GDK_WINDOW_XID (window), + if (XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display), GDK_SURFACE_XID (surface), gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_WINDOW_TYPE"), 0, G_MAXLONG, False, XA_ATOM, &type_return, &format_return, &nitems_return, &bytes_after_return, @@ -1946,31 +1946,31 @@ gdk_x11_window_get_type_hint (GdkWindow *window) Atom atom = *(Atom*)data; if (atom == gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_WINDOW_TYPE_DIALOG")) - type = GDK_WINDOW_TYPE_HINT_DIALOG; + type = GDK_SURFACE_TYPE_HINT_DIALOG; else if (atom == gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_WINDOW_TYPE_MENU")) - type = GDK_WINDOW_TYPE_HINT_MENU; + type = GDK_SURFACE_TYPE_HINT_MENU; else if (atom == gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_WINDOW_TYPE_TOOLBAR")) - type = GDK_WINDOW_TYPE_HINT_TOOLBAR; + type = GDK_SURFACE_TYPE_HINT_TOOLBAR; else if (atom == gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_WINDOW_TYPE_UTILITY")) - type = GDK_WINDOW_TYPE_HINT_UTILITY; + type = GDK_SURFACE_TYPE_HINT_UTILITY; else if (atom == gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_WINDOW_TYPE_SPLASH")) - type = GDK_WINDOW_TYPE_HINT_SPLASHSCREEN; + type = GDK_SURFACE_TYPE_HINT_SPLASHSCREEN; else if (atom == gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_WINDOW_TYPE_DOCK")) - type = GDK_WINDOW_TYPE_HINT_DOCK; + type = GDK_SURFACE_TYPE_HINT_DOCK; else if (atom == gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_WINDOW_TYPE_DESKTOP")) - type = GDK_WINDOW_TYPE_HINT_DESKTOP; + type = GDK_SURFACE_TYPE_HINT_DESKTOP; else if (atom == gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_WINDOW_TYPE_DROPDOWN_MENU")) - type = GDK_WINDOW_TYPE_HINT_DROPDOWN_MENU; + type = GDK_SURFACE_TYPE_HINT_DROPDOWN_MENU; else if (atom == gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_WINDOW_TYPE_POPUP_MENU")) - type = GDK_WINDOW_TYPE_HINT_POPUP_MENU; + type = GDK_SURFACE_TYPE_HINT_POPUP_MENU; else if (atom == gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_WINDOW_TYPE_TOOLTIP")) - type = GDK_WINDOW_TYPE_HINT_TOOLTIP; + type = GDK_SURFACE_TYPE_HINT_TOOLTIP; else if (atom == gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_WINDOW_TYPE_NOTIFICATION")) - type = GDK_WINDOW_TYPE_HINT_NOTIFICATION; + type = GDK_SURFACE_TYPE_HINT_NOTIFICATION; else if (atom == gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_WINDOW_TYPE_COMBO")) - type = GDK_WINDOW_TYPE_HINT_COMBO; + type = GDK_SURFACE_TYPE_HINT_COMBO; else if (atom == gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_WINDOW_TYPE_DND")) - type = GDK_WINDOW_TYPE_HINT_DND; + type = GDK_SURFACE_TYPE_HINT_DND; } if (type_return != None && data != NULL) @@ -1982,11 +1982,11 @@ gdk_x11_window_get_type_hint (GdkWindow *window) static void gdk_wmspec_change_state (gboolean add, - GdkWindow *window, + GdkSurface *surface, GdkAtom state1, GdkAtom state2) { - GdkDisplay *display = GDK_WINDOW_DISPLAY (window); + GdkDisplay *display = GDK_SURFACE_DISPLAY (surface); XClientMessageEvent xclient; #define _NET_WM_STATE_REMOVE 0 /* remove/unset property */ @@ -1995,7 +1995,7 @@ gdk_wmspec_change_state (gboolean add, memset (&xclient, 0, sizeof (xclient)); xclient.type = ClientMessage; - xclient.window = GDK_WINDOW_XID (window); + xclient.window = GDK_SURFACE_XID (surface); xclient.message_type = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_STATE"); xclient.format = 32; xclient.data.l[0] = add ? _NET_WM_STATE_ADD : _NET_WM_STATE_REMOVE; @@ -2004,101 +2004,101 @@ gdk_wmspec_change_state (gboolean add, xclient.data.l[3] = 1; /* source indication */ xclient.data.l[4] = 0; - XSendEvent (GDK_WINDOW_XDISPLAY (window), GDK_WINDOW_XROOTWIN (window), False, + XSendEvent (GDK_SURFACE_XDISPLAY (surface), GDK_SURFACE_XROOTWIN (surface), False, SubstructureRedirectMask | SubstructureNotifyMask, (XEvent *)&xclient); } static void -gdk_x11_window_set_modal_hint (GdkWindow *window, +gdk_x11_surface_set_modal_hint (GdkSurface *surface, gboolean modal) { - if (GDK_WINDOW_DESTROYED (window) || - !WINDOW_IS_TOPLEVEL_OR_FOREIGN (window)) + if (GDK_SURFACE_DESTROYED (surface) || + !SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface)) return; - window->modal_hint = modal; + surface->modal_hint = modal; - if (GDK_WINDOW_IS_MAPPED (window)) - gdk_wmspec_change_state (modal, window, + if (GDK_SURFACE_IS_MAPPED (surface)) + gdk_wmspec_change_state (modal, surface, g_intern_static_string ("_NET_WM_STATE_MODAL"), NULL); } static void -gdk_x11_window_set_skip_taskbar_hint (GdkWindow *window, +gdk_x11_surface_set_skip_taskbar_hint (GdkSurface *surface, gboolean skips_taskbar) { GdkToplevelX11 *toplevel; - g_return_if_fail (GDK_WINDOW_TYPE (window) != GDK_WINDOW_CHILD); + g_return_if_fail (GDK_SURFACE_TYPE (surface) != GDK_SURFACE_CHILD); - if (GDK_WINDOW_DESTROYED (window) || - !WINDOW_IS_TOPLEVEL_OR_FOREIGN (window)) + if (GDK_SURFACE_DESTROYED (surface) || + !SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface)) return; - toplevel = _gdk_x11_window_get_toplevel (window); + toplevel = _gdk_x11_surface_get_toplevel (surface); toplevel->skip_taskbar_hint = skips_taskbar; - if (GDK_WINDOW_IS_MAPPED (window)) - gdk_wmspec_change_state (skips_taskbar, window, + if (GDK_SURFACE_IS_MAPPED (surface)) + gdk_wmspec_change_state (skips_taskbar, surface, g_intern_static_string ("_NET_WM_STATE_SKIP_TASKBAR"), NULL); } static void -gdk_x11_window_set_skip_pager_hint (GdkWindow *window, +gdk_x11_surface_set_skip_pager_hint (GdkSurface *surface, gboolean skips_pager) { GdkToplevelX11 *toplevel; - g_return_if_fail (GDK_WINDOW_TYPE (window) != GDK_WINDOW_CHILD); + g_return_if_fail (GDK_SURFACE_TYPE (surface) != GDK_SURFACE_CHILD); - if (GDK_WINDOW_DESTROYED (window) || - !WINDOW_IS_TOPLEVEL_OR_FOREIGN (window)) + if (GDK_SURFACE_DESTROYED (surface) || + !SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface)) return; - toplevel = _gdk_x11_window_get_toplevel (window); + toplevel = _gdk_x11_surface_get_toplevel (surface); toplevel->skip_pager_hint = skips_pager; - if (GDK_WINDOW_IS_MAPPED (window)) - gdk_wmspec_change_state (skips_pager, window, + if (GDK_SURFACE_IS_MAPPED (surface)) + gdk_wmspec_change_state (skips_pager, surface, g_intern_static_string ("_NET_WM_STATE_SKIP_PAGER"), NULL); } static void -gdk_x11_window_set_urgency_hint (GdkWindow *window, +gdk_x11_surface_set_urgency_hint (GdkSurface *surface, gboolean urgent) { GdkToplevelX11 *toplevel; - g_return_if_fail (GDK_WINDOW_TYPE (window) != GDK_WINDOW_CHILD); + g_return_if_fail (GDK_SURFACE_TYPE (surface) != GDK_SURFACE_CHILD); - if (GDK_WINDOW_DESTROYED (window) || - !WINDOW_IS_TOPLEVEL_OR_FOREIGN (window)) + if (GDK_SURFACE_DESTROYED (surface) || + !SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface)) return; - toplevel = _gdk_x11_window_get_toplevel (window); + toplevel = _gdk_x11_surface_get_toplevel (surface); toplevel->urgency_hint = urgent; - update_wm_hints (window, FALSE); + update_wm_hints (surface, FALSE); } static void -gdk_x11_window_set_geometry_hints (GdkWindow *window, +gdk_x11_surface_set_geometry_hints (GdkSurface *surface, const GdkGeometry *geometry, - GdkWindowHints geom_mask) + GdkSurfaceHints geom_mask) { - GdkWindowImplX11 *impl = GDK_WINDOW_IMPL_X11 (window->impl); + GdkSurfaceImplX11 *impl = GDK_SURFACE_IMPL_X11 (surface->impl); XSizeHints size_hints; GdkToplevelX11 *toplevel; - if (GDK_WINDOW_DESTROYED (window) || - !WINDOW_IS_TOPLEVEL_OR_FOREIGN (window)) + if (GDK_SURFACE_DESTROYED (surface) || + !SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface)) return; - toplevel = _gdk_x11_window_get_toplevel (window); + toplevel = _gdk_x11_surface_get_toplevel (surface); if (toplevel) { if (geometry) @@ -2132,35 +2132,35 @@ gdk_x11_window_set_geometry_hints (GdkWindow *window, if (geom_mask & GDK_HINT_MIN_SIZE) { size_hints.flags |= PMinSize; - size_hints.min_width = geometry->min_width * impl->window_scale; - size_hints.min_height = geometry->min_height * impl->window_scale; + size_hints.min_width = geometry->min_width * impl->surface_scale; + size_hints.min_height = geometry->min_height * impl->surface_scale; } if (geom_mask & GDK_HINT_MAX_SIZE) { size_hints.flags |= PMaxSize; - size_hints.max_width = MAX (geometry->max_width, 1) * impl->window_scale; - size_hints.max_height = MAX (geometry->max_height, 1) * impl->window_scale; + size_hints.max_width = MAX (geometry->max_width, 1) * impl->surface_scale; + size_hints.max_height = MAX (geometry->max_height, 1) * impl->surface_scale; } if (geom_mask & GDK_HINT_BASE_SIZE) { size_hints.flags |= PBaseSize; - size_hints.base_width = geometry->base_width * impl->window_scale; - size_hints.base_height = geometry->base_height * impl->window_scale; + size_hints.base_width = geometry->base_width * impl->surface_scale; + size_hints.base_height = geometry->base_height * impl->surface_scale; } if (geom_mask & GDK_HINT_RESIZE_INC) { size_hints.flags |= PResizeInc; - size_hints.width_inc = geometry->width_inc * impl->window_scale; - size_hints.height_inc = geometry->height_inc * impl->window_scale; + size_hints.width_inc = geometry->width_inc * impl->surface_scale; + size_hints.height_inc = geometry->height_inc * impl->surface_scale; } - else if (impl->window_scale > 1) + else if (impl->surface_scale > 1) { size_hints.flags |= PResizeInc; - size_hints.width_inc = impl->window_scale; - size_hints.height_inc = impl->window_scale; + size_hints.width_inc = impl->surface_scale; + size_hints.height_inc = impl->surface_scale; } if (geom_mask & GDK_HINT_ASPECT) @@ -2197,38 +2197,38 @@ gdk_x11_window_set_geometry_hints (GdkWindow *window, /* FIXME: Would it be better to delete this property if * geom_mask == 0? It would save space on the server */ - XSetWMNormalHints (GDK_WINDOW_XDISPLAY (window), - GDK_WINDOW_XID (window), + XSetWMNormalHints (GDK_SURFACE_XDISPLAY (surface), + GDK_SURFACE_XID (surface), &size_hints); } static void -gdk_window_get_geometry_hints (GdkWindow *window, +gdk_surface_get_geometry_hints (GdkSurface *surface, GdkGeometry *geometry, - GdkWindowHints *geom_mask) + GdkSurfaceHints *geom_mask) { - GdkWindowImplX11 *impl; + GdkSurfaceImplX11 *impl; XSizeHints *size_hints; glong junk_supplied_mask = 0; - g_return_if_fail (GDK_IS_WINDOW (window)); + g_return_if_fail (GDK_IS_SURFACE (surface)); g_return_if_fail (geometry != NULL); g_return_if_fail (geom_mask != NULL); *geom_mask = 0; - if (GDK_WINDOW_DESTROYED (window) || - !WINDOW_IS_TOPLEVEL_OR_FOREIGN (window)) + if (GDK_SURFACE_DESTROYED (surface) || + !SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface)) return; - impl = GDK_WINDOW_IMPL_X11 (window->impl); + impl = GDK_SURFACE_IMPL_X11 (surface->impl); size_hints = XAllocSizeHints (); if (!size_hints) return; - if (!XGetWMNormalHints (GDK_WINDOW_XDISPLAY (window), - GDK_WINDOW_XID (window), + if (!XGetWMNormalHints (GDK_SURFACE_XDISPLAY (surface), + GDK_SURFACE_XID (surface), size_hints, &junk_supplied_mask)) size_hints->flags = 0; @@ -2236,22 +2236,22 @@ gdk_window_get_geometry_hints (GdkWindow *window, if (size_hints->flags & PMinSize) { *geom_mask |= GDK_HINT_MIN_SIZE; - geometry->min_width = size_hints->min_width / impl->window_scale; - geometry->min_height = size_hints->min_height / impl->window_scale; + geometry->min_width = size_hints->min_width / impl->surface_scale; + geometry->min_height = size_hints->min_height / impl->surface_scale; } if (size_hints->flags & PMaxSize) { *geom_mask |= GDK_HINT_MAX_SIZE; - geometry->max_width = MAX (size_hints->max_width, 1) / impl->window_scale; - geometry->max_height = MAX (size_hints->max_height, 1) / impl->window_scale; + geometry->max_width = MAX (size_hints->max_width, 1) / impl->surface_scale; + geometry->max_height = MAX (size_hints->max_height, 1) / impl->surface_scale; } if (size_hints->flags & PResizeInc) { *geom_mask |= GDK_HINT_RESIZE_INC; - geometry->width_inc = size_hints->width_inc / impl->window_scale; - geometry->height_inc = size_hints->height_inc / impl->window_scale; + geometry->width_inc = size_hints->width_inc / impl->surface_scale; + geometry->height_inc = size_hints->height_inc / impl->surface_scale; } if (size_hints->flags & PAspect) @@ -2357,7 +2357,7 @@ set_wm_name (GdkDisplay *display, } static void -gdk_x11_window_set_title (GdkWindow *window, +gdk_x11_surface_set_title (GdkSurface *surface, const gchar *title) { GdkDisplay *display; @@ -2366,17 +2366,17 @@ gdk_x11_window_set_title (GdkWindow *window, g_return_if_fail (title != NULL); - if (GDK_WINDOW_DESTROYED (window) || - !WINDOW_IS_TOPLEVEL_OR_FOREIGN (window)) + if (GDK_SURFACE_DESTROYED (surface) || + !SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface)) return; - display = gdk_window_get_display (window); + display = gdk_surface_get_display (surface); xdisplay = GDK_DISPLAY_XDISPLAY (display); - xwindow = GDK_WINDOW_XID (window); + xwindow = GDK_SURFACE_XID (surface); set_wm_name (display, xwindow, title); - if (!gdk_window_icon_name_set (window)) + if (!gdk_surface_icon_name_set (surface)) { XChangeProperty (xdisplay, xwindow, gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_ICON_NAME"), @@ -2390,89 +2390,89 @@ gdk_x11_window_set_title (GdkWindow *window, } static void -gdk_x11_window_set_role (GdkWindow *window, +gdk_x11_surface_set_role (GdkSurface *surface, const gchar *role) { GdkDisplay *display; - display = gdk_window_get_display (window); + display = gdk_surface_get_display (surface); - if (GDK_WINDOW_DESTROYED (window) || - !WINDOW_IS_TOPLEVEL_OR_FOREIGN (window)) + if (GDK_SURFACE_DESTROYED (surface) || + !SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface)) return; if (role) - XChangeProperty (GDK_DISPLAY_XDISPLAY (display), GDK_WINDOW_XID (window), + XChangeProperty (GDK_DISPLAY_XDISPLAY (display), GDK_SURFACE_XID (surface), gdk_x11_get_xatom_by_name_for_display (display, "WM_WINDOW_ROLE"), XA_STRING, 8, PropModeReplace, (guchar *)role, strlen (role)); else - XDeleteProperty (GDK_DISPLAY_XDISPLAY (display), GDK_WINDOW_XID (window), + XDeleteProperty (GDK_DISPLAY_XDISPLAY (display), GDK_SURFACE_XID (surface), gdk_x11_get_xatom_by_name_for_display (display, "WM_WINDOW_ROLE")); } static void -gdk_x11_window_set_startup_id (GdkWindow *window, +gdk_x11_surface_set_startup_id (GdkSurface *surface, const gchar *startup_id) { GdkDisplay *display; - g_return_if_fail (GDK_IS_WINDOW (window)); + g_return_if_fail (GDK_IS_SURFACE (surface)); - display = gdk_window_get_display (window); + display = gdk_surface_get_display (surface); - if (GDK_WINDOW_DESTROYED (window) || - !WINDOW_IS_TOPLEVEL_OR_FOREIGN (window)) + if (GDK_SURFACE_DESTROYED (surface) || + !SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface)) return; if (startup_id) - XChangeProperty (GDK_DISPLAY_XDISPLAY (display), GDK_WINDOW_XID (window), + XChangeProperty (GDK_DISPLAY_XDISPLAY (display), GDK_SURFACE_XID (surface), gdk_x11_get_xatom_by_name_for_display (display, "_NET_STARTUP_ID"), gdk_x11_get_xatom_by_name_for_display (display, "UTF8_STRING"), 8, PropModeReplace, (unsigned char *)startup_id, strlen (startup_id)); else - XDeleteProperty (GDK_DISPLAY_XDISPLAY (display), GDK_WINDOW_XID (window), + XDeleteProperty (GDK_DISPLAY_XDISPLAY (display), GDK_SURFACE_XID (surface), gdk_x11_get_xatom_by_name_for_display (display, "_NET_STARTUP_ID")); } static void -gdk_x11_window_set_transient_for (GdkWindow *window, - GdkWindow *parent) +gdk_x11_surface_set_transient_for (GdkSurface *surface, + GdkSurface *parent) { - if (GDK_WINDOW_DESTROYED (window) || - !WINDOW_IS_TOPLEVEL_OR_FOREIGN (window)) + if (GDK_SURFACE_DESTROYED (surface) || + !SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface)) return; /* XSetTransientForHint() doesn't allow unsetting, so do it manually */ - if (parent && !GDK_WINDOW_DESTROYED (parent)) - XSetTransientForHint (GDK_WINDOW_XDISPLAY (window), - GDK_WINDOW_XID (window), - GDK_WINDOW_XID (parent)); + if (parent && !GDK_SURFACE_DESTROYED (parent)) + XSetTransientForHint (GDK_SURFACE_XDISPLAY (surface), + GDK_SURFACE_XID (surface), + GDK_SURFACE_XID (parent)); else - XDeleteProperty (GDK_WINDOW_XDISPLAY (window), - GDK_WINDOW_XID (window), - gdk_x11_get_xatom_by_name_for_display (GDK_WINDOW_DISPLAY (window), "WM_TRANSIENT_FOR")); + XDeleteProperty (GDK_SURFACE_XDISPLAY (surface), + GDK_SURFACE_XID (surface), + gdk_x11_get_xatom_by_name_for_display (GDK_SURFACE_DISPLAY (surface), "WM_TRANSIENT_FOR")); } GdkCursor * -_gdk_x11_window_get_cursor (GdkWindow *window) +_gdk_x11_surface_get_cursor (GdkSurface *surface) { - GdkWindowImplX11 *impl; + GdkSurfaceImplX11 *impl; - g_return_val_if_fail (GDK_IS_WINDOW (window), NULL); + g_return_val_if_fail (GDK_IS_SURFACE (surface), NULL); - impl = GDK_WINDOW_IMPL_X11 (window->impl); + impl = GDK_SURFACE_IMPL_X11 (surface->impl); return impl->cursor; } static void -gdk_window_x11_get_geometry (GdkWindow *window, +gdk_surface_x11_get_geometry (GdkSurface *surface, gint *x, gint *y, gint *width, gint *height) { - GdkWindowImplX11 *impl; + GdkSurfaceImplX11 *impl; Window root; gint tx; gint ty; @@ -2481,55 +2481,55 @@ gdk_window_x11_get_geometry (GdkWindow *window, guint tborder_width; guint tdepth; - if (!GDK_WINDOW_DESTROYED (window)) + if (!GDK_SURFACE_DESTROYED (surface)) { - impl = GDK_WINDOW_IMPL_X11 (window->impl); + impl = GDK_SURFACE_IMPL_X11 (surface->impl); - XGetGeometry (GDK_WINDOW_XDISPLAY (window), - GDK_WINDOW_XID (window), + XGetGeometry (GDK_SURFACE_XDISPLAY (surface), + GDK_SURFACE_XID (surface), &root, &tx, &ty, &twidth, &theight, &tborder_width, &tdepth); if (x) - *x = tx / impl->window_scale; + *x = tx / impl->surface_scale; if (y) - *y = ty / impl->window_scale; + *y = ty / impl->surface_scale; if (width) - *width = twidth / impl->window_scale; + *width = twidth / impl->surface_scale; if (height) - *height = theight / impl->window_scale; + *height = theight / impl->surface_scale; } } static void -gdk_window_x11_get_root_coords (GdkWindow *window, +gdk_surface_x11_get_root_coords (GdkSurface *surface, gint x, gint y, gint *root_x, gint *root_y) { - GdkWindowImplX11 *impl = GDK_WINDOW_IMPL_X11 (window->impl); + GdkSurfaceImplX11 *impl = GDK_SURFACE_IMPL_X11 (surface->impl); Window child; gint tx; gint ty; - XTranslateCoordinates (GDK_WINDOW_XDISPLAY (window), - GDK_WINDOW_XID (window), - GDK_WINDOW_XROOTWIN (window), - x * impl->window_scale, y * impl->window_scale, &tx, &ty, + XTranslateCoordinates (GDK_SURFACE_XDISPLAY (surface), + GDK_SURFACE_XID (surface), + GDK_SURFACE_XROOTWIN (surface), + x * impl->surface_scale, y * impl->surface_scale, &tx, &ty, &child); if (root_x) - *root_x = tx / impl->window_scale; + *root_x = tx / impl->surface_scale; if (root_y) - *root_y = ty / impl->window_scale; + *root_y = ty / impl->surface_scale; } static void -gdk_x11_window_get_frame_extents (GdkWindow *window, +gdk_x11_surface_get_frame_extents (GdkSurface *surface, GdkRectangle *rect) { GdkDisplay *display; - GdkWindowImplX11 *impl; + GdkSurfaceImplX11 *impl; Window xwindow; Window xparent; Window root; @@ -2555,31 +2555,31 @@ gdk_x11_window_get_frame_extents (GdkWindow *window, rect->width = 1; rect->height = 1; - while (window->parent && (window->parent)->parent) - window = window->parent; + while (surface->parent && (surface->parent)->parent) + surface = surface->parent; - impl = GDK_WINDOW_IMPL_X11 (window->impl); + impl = GDK_SURFACE_IMPL_X11 (surface->impl); /* Refine our fallback answer a bit using local information */ - rect->x = window->x * impl->window_scale; - rect->y = window->y * impl->window_scale; - rect->width = window->width * impl->window_scale; - rect->height = window->height * impl->window_scale; + rect->x = surface->x * impl->surface_scale; + rect->y = surface->y * impl->surface_scale; + rect->width = surface->width * impl->surface_scale; + rect->height = surface->height * impl->surface_scale; - if (GDK_WINDOW_DESTROYED (window) || impl->override_redirect) + if (GDK_SURFACE_DESTROYED (surface) || impl->override_redirect) return; nvroots = 0; vroots = NULL; - display = gdk_window_get_display (window); + display = gdk_surface_get_display (surface); gdk_x11_display_error_trap_push (display); - xwindow = GDK_WINDOW_XID (window); + xwindow = GDK_SURFACE_XID (surface); /* first try: use _NET_FRAME_EXTENTS */ - if (gdk_x11_screen_supports_net_wm_hint (GDK_WINDOW_SCREEN (window), + if (gdk_x11_screen_supports_net_wm_hint (GDK_SURFACE_SCREEN (surface), g_intern_static_string ("_NET_FRAME_EXTENTS")) && XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display), xwindow, gdk_x11_get_xatom_by_name_for_display (display, @@ -2626,9 +2626,9 @@ gdk_x11_window_get_frame_extents (GdkWindow *window, tree to get our window's parent which hopefully is the window frame */ /* use NETWM_VIRTUAL_ROOTS if available */ - root = GDK_WINDOW_XROOTWIN (window); + root = GDK_SURFACE_XROOTWIN (surface); - if (gdk_x11_screen_supports_net_wm_hint (GDK_WINDOW_SCREEN (window), + if (gdk_x11_screen_supports_net_wm_hint (GDK_SURFACE_SCREEN (surface), g_intern_static_string ("_NET_VIRTUAL_ROOTS")) && XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display), root, gdk_x11_get_xatom_by_name_for_display (display, @@ -2645,7 +2645,7 @@ gdk_x11_window_get_frame_extents (GdkWindow *window, } } - xparent = GDK_WINDOW_XID (window); + xparent = GDK_SURFACE_XID (surface); do { @@ -2688,27 +2688,27 @@ gdk_x11_window_get_frame_extents (GdkWindow *window, as well as round the size up when we divide by scale so that the returned size is guaranteed to cover the real pixels, but it may overshoot a bit in case the window is not positioned/sized according to the scale */ - rect->width = (rect->width + rect->x % impl->window_scale + impl->window_scale - 1) / impl->window_scale; - rect->height = (rect->height + rect->y % impl->window_scale + impl->window_scale - 1) / impl->window_scale; - rect->x = rect->x / impl->window_scale; - rect->y = rect->y / impl->window_scale; + rect->width = (rect->width + rect->x % impl->surface_scale + impl->surface_scale - 1) / impl->surface_scale; + rect->height = (rect->height + rect->y % impl->surface_scale + impl->surface_scale - 1) / impl->surface_scale; + rect->x = rect->x / impl->surface_scale; + rect->y = rect->y / impl->surface_scale; gdk_x11_display_error_trap_pop_ignored (display); } static gboolean -gdk_window_x11_get_device_state (GdkWindow *window, +gdk_surface_x11_get_device_state (GdkSurface *surface, GdkDevice *device, gdouble *x, gdouble *y, GdkModifierType *mask) { - GdkWindow *child; + GdkSurface *child; - if (GDK_WINDOW_DESTROYED (window)) + if (GDK_SURFACE_DESTROYED (surface)) return FALSE; /*HIDPI: handle coords here?*/ - GDK_DEVICE_GET_CLASS (device)->query_state (device, window, + GDK_DEVICE_GET_CLASS (device)->query_state (device, surface, &child, NULL, NULL, x, y, mask); @@ -2716,68 +2716,68 @@ gdk_window_x11_get_device_state (GdkWindow *window, } static GdkEventMask -gdk_window_x11_get_events (GdkWindow *window) +gdk_surface_x11_get_events (GdkSurface *surface) { XWindowAttributes attrs; GdkEventMask event_mask; GdkEventMask filtered; - if (GDK_WINDOW_DESTROYED (window)) + if (GDK_SURFACE_DESTROYED (surface)) return 0; else { - XGetWindowAttributes (GDK_WINDOW_XDISPLAY (window), - GDK_WINDOW_XID (window), + XGetWindowAttributes (GDK_SURFACE_XDISPLAY (surface), + GDK_SURFACE_XID (surface), &attrs); event_mask = x_event_mask_to_gdk_event_mask (attrs.your_event_mask); /* if property change was filtered out before, keep it filtered out */ filtered = GDK_STRUCTURE_MASK | GDK_PROPERTY_CHANGE_MASK; - window->event_mask = event_mask & ((window->event_mask & filtered) | ~filtered); + surface->event_mask = event_mask & ((surface->event_mask & filtered) | ~filtered); return event_mask; } } static void -gdk_window_x11_set_events (GdkWindow *window, +gdk_surface_x11_set_events (GdkSurface *surface, GdkEventMask event_mask) { long xevent_mask = 0; - if (!GDK_WINDOW_DESTROYED (window)) + if (!GDK_SURFACE_DESTROYED (surface)) { GdkX11Display *display_x11; - if (GDK_WINDOW_XID (window) != GDK_WINDOW_XROOTWIN (window)) + if (GDK_SURFACE_XID (surface) != GDK_SURFACE_XROOTWIN (surface)) xevent_mask = StructureNotifyMask | PropertyChangeMask; - display_x11 = GDK_X11_DISPLAY (gdk_window_get_display (window)); + display_x11 = GDK_X11_DISPLAY (gdk_surface_get_display (surface)); gdk_x11_event_source_select_events ((GdkEventSource *) display_x11->event_source, - GDK_WINDOW_XID (window), event_mask, + GDK_SURFACE_XID (surface), event_mask, xevent_mask); } } static inline void -do_shape_combine_region (GdkWindow *window, +do_shape_combine_region (GdkSurface *surface, const cairo_region_t *shape_region, gint offset_x, gint offset_y, gint shape) { - GdkWindowImplX11 *impl = GDK_WINDOW_IMPL_X11 (window->impl); + GdkSurfaceImplX11 *impl = GDK_SURFACE_IMPL_X11 (surface->impl); - if (GDK_WINDOW_DESTROYED (window)) + if (GDK_SURFACE_DESTROYED (surface)) return; if (shape_region == NULL) { /* Use NULL mask to unset the shape */ if (shape == ShapeBounding - ? gdk_display_supports_shapes (GDK_WINDOW_DISPLAY (window)) - : gdk_display_supports_input_shapes (GDK_WINDOW_DISPLAY (window))) + ? gdk_display_supports_shapes (GDK_SURFACE_DISPLAY (surface)) + : gdk_display_supports_input_shapes (GDK_SURFACE_DISPLAY (surface))) { - XShapeCombineMask (GDK_WINDOW_XDISPLAY (window), - GDK_WINDOW_XID (window), + XShapeCombineMask (GDK_SURFACE_XDISPLAY (surface), + GDK_SURFACE_XID (surface), shape, 0, 0, None, @@ -2787,21 +2787,21 @@ do_shape_combine_region (GdkWindow *window, } if (shape == ShapeBounding - ? gdk_display_supports_shapes (GDK_WINDOW_DISPLAY (window)) - : gdk_display_supports_input_shapes (GDK_WINDOW_DISPLAY (window))) + ? gdk_display_supports_shapes (GDK_SURFACE_DISPLAY (surface)) + : gdk_display_supports_input_shapes (GDK_SURFACE_DISPLAY (surface))) { gint n_rects = 0; XRectangle *xrects = NULL; _gdk_x11_region_get_xrectangles (shape_region, - 0, 0, impl->window_scale, + 0, 0, impl->surface_scale, &xrects, &n_rects); - XShapeCombineRectangles (GDK_WINDOW_XDISPLAY (window), - GDK_WINDOW_XID (window), + XShapeCombineRectangles (GDK_SURFACE_XDISPLAY (surface), + GDK_SURFACE_XID (surface), shape, - offset_x * impl->window_scale, - offset_y * impl->window_scale, + offset_x * impl->surface_scale, + offset_y * impl->surface_scale, xrects, n_rects, ShapeSet, YXBanded); @@ -2811,70 +2811,70 @@ do_shape_combine_region (GdkWindow *window, } static void -gdk_window_x11_shape_combine_region (GdkWindow *window, +gdk_surface_x11_shape_combine_region (GdkSurface *surface, const cairo_region_t *shape_region, gint offset_x, gint offset_y) { - do_shape_combine_region (window, shape_region, offset_x, offset_y, ShapeBounding); + do_shape_combine_region (surface, shape_region, offset_x, offset_y, ShapeBounding); } static void -gdk_window_x11_input_shape_combine_region (GdkWindow *window, +gdk_surface_x11_input_shape_combine_region (GdkSurface *surface, const cairo_region_t *shape_region, gint offset_x, gint offset_y) { #ifdef ShapeInput - do_shape_combine_region (window, shape_region, offset_x, offset_y, ShapeInput); + do_shape_combine_region (surface, shape_region, offset_x, offset_y, ShapeInput); #endif } static void -gdk_x11_window_set_accept_focus (GdkWindow *window, +gdk_x11_surface_set_accept_focus (GdkSurface *surface, gboolean accept_focus) { accept_focus = accept_focus != FALSE; - if (window->accept_focus != accept_focus) + if (surface->accept_focus != accept_focus) { - window->accept_focus = accept_focus; + surface->accept_focus = accept_focus; - if (!GDK_WINDOW_DESTROYED (window) && - WINDOW_IS_TOPLEVEL_OR_FOREIGN (window)) - update_wm_hints (window, FALSE); + if (!GDK_SURFACE_DESTROYED (surface) && + SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface)) + update_wm_hints (surface, FALSE); } } static void -gdk_x11_window_set_focus_on_map (GdkWindow *window, +gdk_x11_surface_set_focus_on_map (GdkSurface *surface, gboolean focus_on_map) { focus_on_map = focus_on_map != FALSE; - if (window->focus_on_map != focus_on_map) + if (surface->focus_on_map != focus_on_map) { - window->focus_on_map = focus_on_map; + surface->focus_on_map = focus_on_map; - if ((!GDK_WINDOW_DESTROYED (window)) && - (!window->focus_on_map) && - WINDOW_IS_TOPLEVEL_OR_FOREIGN (window)) - gdk_x11_window_set_user_time (window, 0); + if ((!GDK_SURFACE_DESTROYED (surface)) && + (!surface->focus_on_map) && + SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface)) + gdk_x11_surface_set_user_time (surface, 0); } } /** - * gdk_x11_window_set_user_time: - * @window: (type GdkX11Window): A toplevel #GdkWindow + * gdk_x11_surface_set_user_time: + * @surface: (type GdkX11Surface): A toplevel #GdkSurface * @timestamp: An XServer timestamp to which the property should be set * * The application can use this call to update the _NET_WM_USER_TIME - * property on a toplevel window. This property stores an Xserver + * property on a toplevel surface. This property stores an Xserver * time which represents the time of the last user input event - * received for this window. This property may be used by the window + * received for this surface. This property may be used by the window * manager to alter the focus, stacking, and/or placement behavior of - * windows when they are mapped depending on whether the new window - * was created by a user action or is a "pop-up" window activated by a + * surfaces when they are mapped depending on whether the new surface + * was created by a user action or is a "pop-up" surface activated by a * timer or some other event. * * Note that this property is automatically updated by GDK, so this @@ -2882,7 +2882,7 @@ gdk_x11_window_set_focus_on_map (GdkWindow *window, * events bypassing GDK. **/ void -gdk_x11_window_set_user_time (GdkWindow *window, +gdk_x11_surface_set_user_time (GdkSurface *surface, guint32 timestamp) { GdkDisplay *display; @@ -2891,26 +2891,26 @@ gdk_x11_window_set_user_time (GdkWindow *window, glong timestamp_long = (glong)timestamp; Window xid; - if (GDK_WINDOW_DESTROYED (window) || - !WINDOW_IS_TOPLEVEL_OR_FOREIGN (window)) + if (GDK_SURFACE_DESTROYED (surface) || + !SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface)) return; - display = gdk_window_get_display (window); + display = gdk_surface_get_display (surface); display_x11 = GDK_X11_DISPLAY (display); - toplevel = _gdk_x11_window_get_toplevel (window); + toplevel = _gdk_x11_surface_get_toplevel (surface); if (!toplevel) { - g_warning ("gdk_window_set_user_time called on non-toplevel\n"); + g_warning ("gdk_surface_set_user_time called on non-toplevel\n"); return; } if (toplevel->focus_window != None && - gdk_x11_screen_supports_net_wm_hint (GDK_WINDOW_SCREEN (window), + gdk_x11_screen_supports_net_wm_hint (GDK_SURFACE_SCREEN (surface), g_intern_static_string ("_NET_WM_USER_TIME_WINDOW"))) xid = toplevel->focus_window; else - xid = GDK_WINDOW_XID (window); + xid = GDK_SURFACE_XID (surface); XChangeProperty (GDK_DISPLAY_XDISPLAY (display), xid, gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_USER_TIME"), @@ -2927,31 +2927,31 @@ gdk_x11_window_set_user_time (GdkWindow *window, } /** - * gdk_x11_window_set_utf8_property: - * @window: (type GdkX11Window): a #GdkWindow + * gdk_x11_surface_set_utf8_property: + * @surface: (type GdkX11Surface): a #GdkSurface * @name: Property name, will be interned as an X atom * @value: (allow-none): Property value, or %NULL to delete * * This function modifies or removes an arbitrary X11 window - * property of type UTF8_STRING. If the given @window is - * not a toplevel window, it is ignored. + * property of type UTF8_STRING. If the given @surface is + * not a toplevel surface, it is ignored. */ void -gdk_x11_window_set_utf8_property (GdkWindow *window, +gdk_x11_surface_set_utf8_property (GdkSurface *surface, const gchar *name, const gchar *value) { GdkDisplay *display; - if (!WINDOW_IS_TOPLEVEL (window)) + if (!SURFACE_IS_TOPLEVEL (surface)) return; - display = gdk_window_get_display (window); + display = gdk_surface_get_display (surface); if (value != NULL) { XChangeProperty (GDK_DISPLAY_XDISPLAY (display), - GDK_WINDOW_XID (window), + GDK_SURFACE_XID (surface), gdk_x11_get_xatom_by_name_for_display (display, name), gdk_x11_get_xatom_by_name_for_display (display, "UTF8_STRING"), 8, PropModeReplace, (guchar *)value, strlen (value)); @@ -2959,56 +2959,56 @@ gdk_x11_window_set_utf8_property (GdkWindow *window, else { XDeleteProperty (GDK_DISPLAY_XDISPLAY (display), - GDK_WINDOW_XID (window), + GDK_SURFACE_XID (surface), gdk_x11_get_xatom_by_name_for_display (display, name)); } } static void -gdk_x11_window_set_shadow_width (GdkWindow *window, +gdk_x11_surface_set_shadow_width (GdkSurface *surface, int left, int right, int top, int bottom) { - GdkWindowImplX11 *impl = GDK_WINDOW_IMPL_X11 (window->impl); + GdkSurfaceImplX11 *impl = GDK_SURFACE_IMPL_X11 (surface->impl); Atom frame_extents; gulong data[4] = { - left * impl->window_scale, - right * impl->window_scale, - top * impl->window_scale, - bottom * impl->window_scale + left * impl->surface_scale, + right * impl->surface_scale, + top * impl->surface_scale, + bottom * impl->surface_scale }; - frame_extents = gdk_x11_get_xatom_by_name_for_display (gdk_window_get_display (window), + frame_extents = gdk_x11_get_xatom_by_name_for_display (gdk_surface_get_display (surface), "_GTK_FRAME_EXTENTS"); - XChangeProperty (GDK_WINDOW_XDISPLAY (window), - GDK_WINDOW_XID (window), + XChangeProperty (GDK_SURFACE_XDISPLAY (surface), + GDK_SURFACE_XID (surface), frame_extents, XA_CARDINAL, 32, PropModeReplace, (guchar *) &data, 4); } /** - * gdk_x11_window_set_theme_variant: - * @window: (type GdkX11Window): a #GdkWindow + * gdk_x11_surface_set_theme_variant: + * @surface: (type GdkX11Surface): a #GdkSurface * @variant: the theme variant to export * * GTK+ applications can request a dark theme variant. In order to * make other applications - namely window managers using GTK+ for * themeing - aware of this choice, GTK+ uses this function to * export the requested theme variant as _GTK_THEME_VARIANT property - * on toplevel windows. + * on toplevel surfaces. * * Note that this property is automatically updated by GTK+, so this * function should only be used by applications which do not use GTK+ - * to create toplevel windows. + * to create toplevel surfaces. */ void -gdk_x11_window_set_theme_variant (GdkWindow *window, +gdk_x11_surface_set_theme_variant (GdkSurface *surface, const char *variant) { - gdk_x11_window_set_utf8_property (window, "_GTK_THEME_VARIANT", + gdk_x11_surface_set_utf8_property (surface, "_GTK_THEME_VARIANT", variant ? variant : ""); } @@ -3019,7 +3019,7 @@ gdk_x11_window_set_theme_variant (GdkWindow *window, : XExtendedMaxRequestSize (GDK_DISPLAY_XDISPLAY (display)) - 100) static void -gdk_window_update_icon (GdkWindow *window, +gdk_surface_update_icon (GdkSurface *surface, GList *icon_list) { GdkToplevelX11 *toplevel; @@ -3027,7 +3027,7 @@ gdk_window_update_icon (GdkWindow *window, GList *tmp_list; int best_size; - toplevel = _gdk_x11_window_get_toplevel (window); + toplevel = _gdk_x11_surface_get_toplevel (surface); if (toplevel->icon_pixmap != NULL) { @@ -3080,17 +3080,17 @@ gdk_window_update_icon (GdkWindow *window, { int width = gdk_texture_get_width (best_icon); int height = gdk_texture_get_height (best_icon); - cairo_surface_t *surface; + cairo_surface_t *cairo_surface; cairo_t *cr; - toplevel->icon_pixmap = gdk_x11_window_create_pixmap_surface (window, width, height); + toplevel->icon_pixmap = gdk_x11_surface_create_pixmap_surface (surface, width, height); - surface = gdk_texture_download_surface (best_icon); + cairo_surface = gdk_texture_download_surface (best_icon); cr = cairo_create (toplevel->icon_pixmap); cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE); - cairo_set_source_surface (cr, surface, 0, 0); - if (cairo_surface_get_content (surface) == CAIRO_CONTENT_COLOR_ALPHA) + cairo_set_source_surface (cr, cairo_surface, 0, 0); + if (cairo_surface_get_content (cairo_surface) == CAIRO_CONTENT_COLOR_ALPHA) { /* Saturate the image, so it has bilevel alpha */ cairo_push_group_with_content (cr, CAIRO_CONTENT_COLOR_ALPHA); @@ -3102,27 +3102,27 @@ gdk_window_update_icon (GdkWindow *window, cairo_paint (cr); cairo_destroy (cr); - if (cairo_surface_get_content (surface) == CAIRO_CONTENT_COLOR_ALPHA) + if (cairo_surface_get_content (cairo_surface) == CAIRO_CONTENT_COLOR_ALPHA) { - GdkDisplay *display = gdk_window_get_display (window); + GdkDisplay *display = gdk_surface_get_display (surface); toplevel->icon_mask = _gdk_x11_display_create_bitmap_surface (display, width, height); cr = cairo_create (toplevel->icon_mask); - cairo_set_source_surface (cr, surface, 0, 0); + cairo_set_source_surface (cr, cairo_surface, 0, 0); cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE); cairo_paint (cr); cairo_destroy (cr); } - cairo_surface_destroy (surface); + cairo_surface_destroy (cairo_surface); } - update_wm_hints (window, FALSE); + update_wm_hints (surface, FALSE); } static void -gdk_x11_window_set_icon_list (GdkWindow *window, +gdk_x11_surface_set_icon_list (GdkSurface *surface, GList *textures) { gulong *data; @@ -3134,11 +3134,11 @@ gdk_x11_window_set_icon_list (GdkWindow *window, GdkDisplay *display; gint i, n; - if (GDK_WINDOW_DESTROYED (window) || - !WINDOW_IS_TOPLEVEL_OR_FOREIGN (window)) + if (GDK_SURFACE_DESTROYED (surface) || + !SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface)) return; - display = gdk_window_get_display (window); + display = gdk_surface_get_display (surface); size = 0; n = 0; @@ -3185,7 +3185,7 @@ gdk_x11_window_set_icon_list (GdkWindow *window, if (size > 0) { XChangeProperty (GDK_DISPLAY_XDISPLAY (display), - GDK_WINDOW_XID (window), + GDK_SURFACE_XID (surface), gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_ICON"), XA_CARDINAL, 32, PropModeReplace, @@ -3194,119 +3194,119 @@ gdk_x11_window_set_icon_list (GdkWindow *window, else { XDeleteProperty (GDK_DISPLAY_XDISPLAY (display), - GDK_WINDOW_XID (window), + GDK_SURFACE_XID (surface), gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_ICON")); } g_free (data); - gdk_window_update_icon (window, textures); + gdk_surface_update_icon (surface, textures); } static gboolean -gdk_window_icon_name_set (GdkWindow *window) +gdk_surface_icon_name_set (GdkSurface *surface) { - return GPOINTER_TO_UINT (g_object_get_qdata (G_OBJECT (window), + return GPOINTER_TO_UINT (g_object_get_qdata (G_OBJECT (surface), g_quark_from_static_string ("gdk-icon-name-set"))); } static void -gdk_x11_window_set_icon_name (GdkWindow *window, +gdk_x11_surface_set_icon_name (GdkSurface *surface, const gchar *name) { GdkDisplay *display; - if (GDK_WINDOW_DESTROYED (window) || - !WINDOW_IS_TOPLEVEL_OR_FOREIGN (window)) + if (GDK_SURFACE_DESTROYED (surface) || + !SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface)) return; - display = gdk_window_get_display (window); + display = gdk_surface_get_display (surface); - g_object_set_qdata (G_OBJECT (window), g_quark_from_static_string ("gdk-icon-name-set"), + g_object_set_qdata (G_OBJECT (surface), g_quark_from_static_string ("gdk-icon-name-set"), GUINT_TO_POINTER (name != NULL)); if (name != NULL) { XChangeProperty (GDK_DISPLAY_XDISPLAY (display), - GDK_WINDOW_XID (window), + GDK_SURFACE_XID (surface), gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_ICON_NAME"), gdk_x11_get_xatom_by_name_for_display (display, "UTF8_STRING"), 8, PropModeReplace, (guchar *)name, strlen (name)); - set_text_property (display, GDK_WINDOW_XID (window), + set_text_property (display, GDK_SURFACE_XID (surface), gdk_x11_get_xatom_by_name_for_display (display, "WM_ICON_NAME"), name); } else { XDeleteProperty (GDK_DISPLAY_XDISPLAY (display), - GDK_WINDOW_XID (window), + GDK_SURFACE_XID (surface), gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_ICON_NAME")); XDeleteProperty (GDK_DISPLAY_XDISPLAY (display), - GDK_WINDOW_XID (window), + GDK_SURFACE_XID (surface), gdk_x11_get_xatom_by_name_for_display (display, "WM_ICON_NAME")); } } static void -gdk_x11_window_iconify (GdkWindow *window) +gdk_x11_surface_iconify (GdkSurface *surface) { - if (GDK_WINDOW_DESTROYED (window) || - !WINDOW_IS_TOPLEVEL_OR_FOREIGN (window)) + if (GDK_SURFACE_DESTROYED (surface) || + !SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface)) return; - if (GDK_WINDOW_IS_MAPPED (window)) + if (GDK_SURFACE_IS_MAPPED (surface)) { - XIconifyWindow (GDK_WINDOW_XDISPLAY (window), - GDK_WINDOW_XID (window), - gdk_x11_screen_get_screen_number (GDK_WINDOW_SCREEN (window))); + XIconifyWindow (GDK_SURFACE_XDISPLAY (surface), + GDK_SURFACE_XID (surface), + gdk_x11_screen_get_screen_number (GDK_SURFACE_SCREEN (surface))); } else { /* Flip our client side flag, the real work happens on map. */ - gdk_synthesize_window_state (window, + gdk_synthesize_surface_state (surface, 0, - GDK_WINDOW_STATE_ICONIFIED); - gdk_wmspec_change_state (TRUE, window, + GDK_SURFACE_STATE_ICONIFIED); + gdk_wmspec_change_state (TRUE, surface, g_intern_static_string ("_NET_WM_STATE_HIDDEN"), NULL); } } static void -gdk_x11_window_deiconify (GdkWindow *window) +gdk_x11_surface_deiconify (GdkSurface *surface) { - if (GDK_WINDOW_DESTROYED (window) || - !WINDOW_IS_TOPLEVEL_OR_FOREIGN (window)) + if (GDK_SURFACE_DESTROYED (surface) || + !SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface)) return; - if (GDK_WINDOW_IS_MAPPED (window)) + if (GDK_SURFACE_IS_MAPPED (surface)) { - gdk_window_show (window); - gdk_wmspec_change_state (FALSE, window, + gdk_surface_show (surface); + gdk_wmspec_change_state (FALSE, surface, g_intern_static_string ("_NET_WM_STATE_HIDDEN"), NULL); } else { /* Flip our client side flag, the real work happens on map. */ - gdk_synthesize_window_state (window, - GDK_WINDOW_STATE_ICONIFIED, + gdk_synthesize_surface_state (surface, + GDK_SURFACE_STATE_ICONIFIED, 0); - gdk_wmspec_change_state (FALSE, window, + gdk_wmspec_change_state (FALSE, surface, g_intern_static_string ("_NET_WM_STATE_HIDDEN"), NULL); } } static void -gdk_x11_window_stick (GdkWindow *window) +gdk_x11_surface_stick (GdkSurface *surface) { - if (GDK_WINDOW_DESTROYED (window) || - !WINDOW_IS_TOPLEVEL_OR_FOREIGN (window)) + if (GDK_SURFACE_DESTROYED (surface) || + !SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface)) return; - if (GDK_WINDOW_IS_MAPPED (window)) + if (GDK_SURFACE_IS_MAPPED (surface)) { /* "stick" means stick to all desktops _and_ do not scroll with the * viewport. i.e. glue to the monitor glass in all cases. @@ -3315,16 +3315,16 @@ gdk_x11_window_stick (GdkWindow *window) XClientMessageEvent xclient; /* Request stick during viewport scroll */ - gdk_wmspec_change_state (TRUE, window, + gdk_wmspec_change_state (TRUE, surface, g_intern_static_string ("_NET_WM_STATE_STICKY"), NULL); /* Request desktop 0xFFFFFFFF */ memset (&xclient, 0, sizeof (xclient)); xclient.type = ClientMessage; - xclient.window = GDK_WINDOW_XID (window); - xclient.display = GDK_WINDOW_XDISPLAY (window); - xclient.message_type = gdk_x11_get_xatom_by_name_for_display (GDK_WINDOW_DISPLAY (window), + xclient.window = GDK_SURFACE_XID (surface); + xclient.display = GDK_SURFACE_XDISPLAY (surface); + xclient.message_type = gdk_x11_get_xatom_by_name_for_display (GDK_SURFACE_DISPLAY (surface), "_NET_WM_DESKTOP"); xclient.format = 32; @@ -3334,93 +3334,93 @@ gdk_x11_window_stick (GdkWindow *window) xclient.data.l[3] = 0; xclient.data.l[4] = 0; - XSendEvent (GDK_WINDOW_XDISPLAY (window), GDK_WINDOW_XROOTWIN (window), False, + XSendEvent (GDK_SURFACE_XDISPLAY (surface), GDK_SURFACE_XROOTWIN (surface), False, SubstructureRedirectMask | SubstructureNotifyMask, (XEvent *)&xclient); } else { /* Flip our client side flag, the real work happens on map. */ - gdk_synthesize_window_state (window, + gdk_synthesize_surface_state (surface, 0, - GDK_WINDOW_STATE_STICKY); + GDK_SURFACE_STATE_STICKY); } } static void -gdk_x11_window_unstick (GdkWindow *window) +gdk_x11_surface_unstick (GdkSurface *surface) { - if (GDK_WINDOW_DESTROYED (window) || - !WINDOW_IS_TOPLEVEL_OR_FOREIGN (window)) + if (GDK_SURFACE_DESTROYED (surface) || + !SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface)) return; - if (GDK_WINDOW_IS_MAPPED (window)) + if (GDK_SURFACE_IS_MAPPED (surface)) { /* Request unstick from viewport */ - gdk_wmspec_change_state (FALSE, window, + gdk_wmspec_change_state (FALSE, surface, g_intern_static_string ("_NET_WM_STATE_STICKY"), NULL); - move_to_current_desktop (window); + move_to_current_desktop (surface); } else { /* Flip our client side flag, the real work happens on map. */ - gdk_synthesize_window_state (window, - GDK_WINDOW_STATE_STICKY, + gdk_synthesize_surface_state (surface, + GDK_SURFACE_STATE_STICKY, 0); } } static void -gdk_x11_window_maximize (GdkWindow *window) +gdk_x11_surface_maximize (GdkSurface *surface) { - if (GDK_WINDOW_DESTROYED (window) || - !WINDOW_IS_TOPLEVEL_OR_FOREIGN (window)) + if (GDK_SURFACE_DESTROYED (surface) || + !SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface)) return; - if (GDK_WINDOW_IS_MAPPED (window)) - gdk_wmspec_change_state (TRUE, window, + if (GDK_SURFACE_IS_MAPPED (surface)) + gdk_wmspec_change_state (TRUE, surface, g_intern_static_string ("_NET_WM_STATE_MAXIMIZED_VERT"), g_intern_static_string ("_NET_WM_STATE_MAXIMIZED_HORZ")); else - gdk_synthesize_window_state (window, + gdk_synthesize_surface_state (surface, 0, - GDK_WINDOW_STATE_MAXIMIZED); + GDK_SURFACE_STATE_MAXIMIZED); } static void -gdk_x11_window_unmaximize (GdkWindow *window) +gdk_x11_surface_unmaximize (GdkSurface *surface) { - if (GDK_WINDOW_DESTROYED (window) || - !WINDOW_IS_TOPLEVEL_OR_FOREIGN (window)) + if (GDK_SURFACE_DESTROYED (surface) || + !SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface)) return; - if (GDK_WINDOW_IS_MAPPED (window)) - gdk_wmspec_change_state (FALSE, window, + if (GDK_SURFACE_IS_MAPPED (surface)) + gdk_wmspec_change_state (FALSE, surface, g_intern_static_string ("_NET_WM_STATE_MAXIMIZED_VERT"), g_intern_static_string ("_NET_WM_STATE_MAXIMIZED_HORZ")); else - gdk_synthesize_window_state (window, - GDK_WINDOW_STATE_MAXIMIZED, + gdk_synthesize_surface_state (surface, + GDK_SURFACE_STATE_MAXIMIZED, 0); } static void -gdk_x11_window_apply_fullscreen_mode (GdkWindow *window) +gdk_x11_surface_apply_fullscreen_mode (GdkSurface *surface) { - if (GDK_WINDOW_DESTROYED (window) || - !WINDOW_IS_TOPLEVEL_OR_FOREIGN (window)) + if (GDK_SURFACE_DESTROYED (surface) || + !SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface)) return; /* _NET_WM_FULLSCREEN_MONITORS gives an indication to the window manager as - * to which monitors so span across when the window is fullscreen, but it's - * not a state in itself so this would have no effect if the window is not + * to which monitors so span across when the surface is fullscreen, but it's + * not a state in itself so this would have no effect if the surface is not * mapped. */ - if (GDK_WINDOW_IS_MAPPED (window)) + if (GDK_SURFACE_IS_MAPPED (surface)) { XClientMessageEvent xclient; gint monitors[4]; @@ -3428,11 +3428,11 @@ gdk_x11_window_apply_fullscreen_mode (GdkWindow *window) memset (&xclient, 0, sizeof (xclient)); xclient.type = ClientMessage; - xclient.window = GDK_WINDOW_XID (window); - xclient.display = GDK_WINDOW_XDISPLAY (window); + xclient.window = GDK_SURFACE_XID (surface); + xclient.display = GDK_SURFACE_XDISPLAY (surface); xclient.format = 32; - switch (window->fullscreen_mode) + switch (surface->fullscreen_mode) { case GDK_FULLSCREEN_ON_CURRENT_MONITOR: @@ -3463,7 +3463,7 @@ gdk_x11_window_apply_fullscreen_mode (GdkWindow *window) case GDK_FULLSCREEN_ON_ALL_MONITORS: - _gdk_x11_screen_get_edge_monitors (GDK_WINDOW_SCREEN (window), + _gdk_x11_screen_get_edge_monitors (GDK_SURFACE_SCREEN (surface), &monitors[0], &monitors[1], &monitors[2], @@ -3477,185 +3477,185 @@ gdk_x11_window_apply_fullscreen_mode (GdkWindow *window) */ if (xclient.data.l[i] < 0) { - g_warning ("gdk_x11_window_apply_fullscreen_mode: Invalid XINERAMA monitor index"); + g_warning ("gdk_x11_surface_apply_fullscreen_mode: Invalid XINERAMA monitor index"); return; } } break; default: - g_warning ("gdk_x11_window_apply_fullscreen_mode: Unhandled fullscreen mode %d", - window->fullscreen_mode); + g_warning ("gdk_x11_surface_apply_fullscreen_mode: Unhandled fullscreen mode %d", + surface->fullscreen_mode); return; } /* Send fullscreen monitors client message */ xclient.data.l[4] = 1; /* source indication */ - xclient.message_type = gdk_x11_get_xatom_by_name_for_display (GDK_WINDOW_DISPLAY (window), + xclient.message_type = gdk_x11_get_xatom_by_name_for_display (GDK_SURFACE_DISPLAY (surface), "_NET_WM_FULLSCREEN_MONITORS"); - XSendEvent (GDK_WINDOW_XDISPLAY (window), GDK_WINDOW_XROOTWIN (window), False, + XSendEvent (GDK_SURFACE_XDISPLAY (surface), GDK_SURFACE_XROOTWIN (surface), False, SubstructureRedirectMask | SubstructureNotifyMask, (XEvent *)&xclient); } } static void -gdk_x11_window_fullscreen (GdkWindow *window) +gdk_x11_surface_fullscreen (GdkSurface *surface) { - if (GDK_WINDOW_DESTROYED (window) || - !WINDOW_IS_TOPLEVEL_OR_FOREIGN (window)) + if (GDK_SURFACE_DESTROYED (surface) || + !SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface)) return; - if (GDK_WINDOW_IS_MAPPED (window)) + if (GDK_SURFACE_IS_MAPPED (surface)) { - gdk_wmspec_change_state (TRUE, window, + gdk_wmspec_change_state (TRUE, surface, g_intern_static_string ("_NET_WM_STATE_FULLSCREEN"), NULL); /* Actual XRandR layout may have change since we computed the fullscreen * monitors in GDK_FULLSCREEN_ON_ALL_MONITORS mode. */ - if (window->fullscreen_mode == GDK_FULLSCREEN_ON_ALL_MONITORS) - gdk_x11_window_apply_fullscreen_mode (window); + if (surface->fullscreen_mode == GDK_FULLSCREEN_ON_ALL_MONITORS) + gdk_x11_surface_apply_fullscreen_mode (surface); } else - gdk_synthesize_window_state (window, + gdk_synthesize_surface_state (surface, 0, - GDK_WINDOW_STATE_FULLSCREEN); + GDK_SURFACE_STATE_FULLSCREEN); } static void -gdk_x11_window_fullscreen_on_monitor (GdkWindow *window, +gdk_x11_surface_fullscreen_on_monitor (GdkSurface *surface, GdkMonitor *monitor) { GdkRectangle geom; - if (GDK_WINDOW_DESTROYED (window) || - !WINDOW_IS_TOPLEVEL_OR_FOREIGN (window)) + if (GDK_SURFACE_DESTROYED (surface) || + !SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface)) return; gdk_monitor_get_geometry (monitor, &geom); - gdk_window_move (window, geom.x, geom.y); + gdk_surface_move (surface, geom.x, geom.y); - gdk_window_set_fullscreen_mode (window, GDK_FULLSCREEN_ON_CURRENT_MONITOR); - gdk_x11_window_fullscreen (window); + gdk_surface_set_fullscreen_mode (surface, GDK_FULLSCREEN_ON_CURRENT_MONITOR); + gdk_x11_surface_fullscreen (surface); } static void -gdk_x11_window_unfullscreen (GdkWindow *window) +gdk_x11_surface_unfullscreen (GdkSurface *surface) { - if (GDK_WINDOW_DESTROYED (window) || - !WINDOW_IS_TOPLEVEL_OR_FOREIGN (window)) + if (GDK_SURFACE_DESTROYED (surface) || + !SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface)) return; - if (GDK_WINDOW_IS_MAPPED (window)) - gdk_wmspec_change_state (FALSE, window, + if (GDK_SURFACE_IS_MAPPED (surface)) + gdk_wmspec_change_state (FALSE, surface, g_intern_static_string ("_NET_WM_STATE_FULLSCREEN"), NULL); else - gdk_synthesize_window_state (window, - GDK_WINDOW_STATE_FULLSCREEN, + gdk_synthesize_surface_state (surface, + GDK_SURFACE_STATE_FULLSCREEN, 0); } static void -gdk_x11_window_set_keep_above (GdkWindow *window, +gdk_x11_surface_set_keep_above (GdkSurface *surface, gboolean setting) { - g_return_if_fail (GDK_IS_WINDOW (window)); + g_return_if_fail (GDK_IS_SURFACE (surface)); - if (GDK_WINDOW_DESTROYED (window) || - !WINDOW_IS_TOPLEVEL_OR_FOREIGN (window)) + if (GDK_SURFACE_DESTROYED (surface) || + !SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface)) return; - if (GDK_WINDOW_IS_MAPPED (window)) + if (GDK_SURFACE_IS_MAPPED (surface)) { if (setting) - gdk_wmspec_change_state (FALSE, window, + gdk_wmspec_change_state (FALSE, surface, g_intern_static_string ("_NET_WM_STATE_BELOW"), NULL); - gdk_wmspec_change_state (setting, window, + gdk_wmspec_change_state (setting, surface, g_intern_static_string ("_NET_WM_STATE_ABOVE"), NULL); } else - gdk_synthesize_window_state (window, - setting ? GDK_WINDOW_STATE_BELOW : GDK_WINDOW_STATE_ABOVE, - setting ? GDK_WINDOW_STATE_ABOVE : 0); + gdk_synthesize_surface_state (surface, + setting ? GDK_SURFACE_STATE_BELOW : GDK_SURFACE_STATE_ABOVE, + setting ? GDK_SURFACE_STATE_ABOVE : 0); } static void -gdk_x11_window_set_keep_below (GdkWindow *window, gboolean setting) +gdk_x11_surface_set_keep_below (GdkSurface *surface, gboolean setting) { - g_return_if_fail (GDK_IS_WINDOW (window)); + g_return_if_fail (GDK_IS_SURFACE (surface)); - if (GDK_WINDOW_DESTROYED (window) || - !WINDOW_IS_TOPLEVEL_OR_FOREIGN (window)) + if (GDK_SURFACE_DESTROYED (surface) || + !SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface)) return; - if (GDK_WINDOW_IS_MAPPED (window)) + if (GDK_SURFACE_IS_MAPPED (surface)) { if (setting) - gdk_wmspec_change_state (FALSE, window, + gdk_wmspec_change_state (FALSE, surface, g_intern_static_string ("_NET_WM_STATE_ABOVE"), NULL); - gdk_wmspec_change_state (setting, window, + gdk_wmspec_change_state (setting, surface, g_intern_static_string ("_NET_WM_STATE_BELOW"), NULL); } else - gdk_synthesize_window_state (window, - setting ? GDK_WINDOW_STATE_ABOVE : GDK_WINDOW_STATE_BELOW, - setting ? GDK_WINDOW_STATE_BELOW : 0); + gdk_synthesize_surface_state (surface, + setting ? GDK_SURFACE_STATE_ABOVE : GDK_SURFACE_STATE_BELOW, + setting ? GDK_SURFACE_STATE_BELOW : 0); } -static GdkWindow * -gdk_x11_window_get_group (GdkWindow *window) +static GdkSurface * +gdk_x11_surface_get_group (GdkSurface *surface) { GdkToplevelX11 *toplevel; - if (GDK_WINDOW_DESTROYED (window) || - !WINDOW_IS_TOPLEVEL (window)) + if (GDK_SURFACE_DESTROYED (surface) || + !SURFACE_IS_TOPLEVEL (surface)) return NULL; - toplevel = _gdk_x11_window_get_toplevel (window); + toplevel = _gdk_x11_surface_get_toplevel (surface); return toplevel->group_leader; } static void -gdk_x11_window_set_group (GdkWindow *window, - GdkWindow *leader) +gdk_x11_surface_set_group (GdkSurface *surface, + GdkSurface *leader) { GdkToplevelX11 *toplevel; - g_return_if_fail (GDK_IS_WINDOW (window)); - g_return_if_fail (GDK_WINDOW_TYPE (window) != GDK_WINDOW_CHILD); - g_return_if_fail (leader == NULL || GDK_IS_WINDOW (leader)); + g_return_if_fail (GDK_IS_SURFACE (surface)); + g_return_if_fail (GDK_SURFACE_TYPE (surface) != GDK_SURFACE_CHILD); + g_return_if_fail (leader == NULL || GDK_IS_SURFACE (leader)); - if (GDK_WINDOW_DESTROYED (window) || - (leader != NULL && GDK_WINDOW_DESTROYED (leader)) || - !WINDOW_IS_TOPLEVEL (window)) + if (GDK_SURFACE_DESTROYED (surface) || + (leader != NULL && GDK_SURFACE_DESTROYED (leader)) || + !SURFACE_IS_TOPLEVEL (surface)) return; - toplevel = _gdk_x11_window_get_toplevel (window); + toplevel = _gdk_x11_surface_get_toplevel (surface); if (leader == NULL) - leader = gdk_display_get_default_group (gdk_window_get_display (window)); + leader = gdk_display_get_default_group (gdk_surface_get_display (surface)); if (toplevel->group_leader != leader) { if (toplevel->group_leader) g_object_unref (toplevel->group_leader); toplevel->group_leader = g_object_ref (leader); - (_gdk_x11_window_get_toplevel (leader))->is_leader = TRUE; + (_gdk_x11_surface_get_toplevel (leader))->is_leader = TRUE; } - update_wm_hints (window, FALSE); + update_wm_hints (surface, FALSE); } static MotifWmHints * -gdk_window_get_mwm_hints (GdkWindow *window) +gdk_surface_get_mwm_hints (GdkSurface *surface) { GdkDisplay *display; Atom hints_atom = None; @@ -3665,14 +3665,14 @@ gdk_window_get_mwm_hints (GdkWindow *window) gulong nitems; gulong bytes_after; - if (GDK_WINDOW_DESTROYED (window)) + if (GDK_SURFACE_DESTROYED (surface)) return NULL; - display = gdk_window_get_display (window); + display = gdk_surface_get_display (surface); hints_atom = gdk_x11_get_xatom_by_name_for_display (display, _XA_MOTIF_WM_HINTS); - XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display), GDK_WINDOW_XID (window), + XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display), GDK_SURFACE_XID (surface), hints_atom, 0, sizeof (MotifWmHints)/sizeof (long), False, AnyPropertyType, &type, &format, &nitems, &bytes_after, &data); @@ -3684,7 +3684,7 @@ gdk_window_get_mwm_hints (GdkWindow *window) } static void -gdk_window_set_mwm_hints (GdkWindow *window, +gdk_surface_set_mwm_hints (GdkSurface *surface, MotifWmHints *new_hints) { GdkDisplay *display; @@ -3696,14 +3696,14 @@ gdk_window_set_mwm_hints (GdkWindow *window, gulong nitems; gulong bytes_after; - if (GDK_WINDOW_DESTROYED (window)) + if (GDK_SURFACE_DESTROYED (surface)) return; - display = gdk_window_get_display (window); + display = gdk_surface_get_display (surface); hints_atom = gdk_x11_get_xatom_by_name_for_display (display, _XA_MOTIF_WM_HINTS); - XGetWindowProperty (GDK_WINDOW_XDISPLAY (window), GDK_WINDOW_XID (window), + XGetWindowProperty (GDK_SURFACE_XDISPLAY (surface), GDK_SURFACE_XID (surface), hints_atom, 0, sizeof (MotifWmHints)/sizeof (long), False, AnyPropertyType, &type, &format, &nitems, &bytes_after, &data); @@ -3726,7 +3726,7 @@ gdk_window_set_mwm_hints (GdkWindow *window, } } - XChangeProperty (GDK_WINDOW_XDISPLAY (window), GDK_WINDOW_XID (window), + XChangeProperty (GDK_SURFACE_XDISPLAY (surface), GDK_SURFACE_XID (surface), hints_atom, hints_atom, 32, PropModeReplace, (guchar *)hints, sizeof (MotifWmHints)/sizeof (long)); @@ -3735,13 +3735,13 @@ gdk_window_set_mwm_hints (GdkWindow *window, } static void -gdk_x11_window_set_decorations (GdkWindow *window, +gdk_x11_surface_set_decorations (GdkSurface *surface, GdkWMDecoration decorations) { MotifWmHints hints; - if (GDK_WINDOW_DESTROYED (window) || - !WINDOW_IS_TOPLEVEL_OR_FOREIGN (window)) + if (GDK_SURFACE_DESTROYED (surface) || + !SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface)) return; /* initialize to zero to avoid writing uninitialized data to socket */ @@ -3749,21 +3749,21 @@ gdk_x11_window_set_decorations (GdkWindow *window, hints.flags = MWM_HINTS_DECORATIONS; hints.decorations = decorations; - gdk_window_set_mwm_hints (window, &hints); + gdk_surface_set_mwm_hints (surface, &hints); } static gboolean -gdk_x11_window_get_decorations(GdkWindow *window, +gdk_x11_surface_get_decorations(GdkSurface *surface, GdkWMDecoration *decorations) { MotifWmHints *hints; gboolean result = FALSE; - if (GDK_WINDOW_DESTROYED (window) || - !WINDOW_IS_TOPLEVEL_OR_FOREIGN (window)) + if (GDK_SURFACE_DESTROYED (surface) || + !SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface)) return FALSE; - hints = gdk_window_get_mwm_hints (window); + hints = gdk_surface_get_mwm_hints (surface); if (hints) { @@ -3781,15 +3781,15 @@ gdk_x11_window_get_decorations(GdkWindow *window, } static void -gdk_x11_window_set_functions (GdkWindow *window, +gdk_x11_surface_set_functions (GdkSurface *surface, GdkWMFunction functions) { MotifWmHints hints; - g_return_if_fail (GDK_IS_WINDOW (window)); + g_return_if_fail (GDK_IS_SURFACE (surface)); - if (GDK_WINDOW_DESTROYED (window) || - !WINDOW_IS_TOPLEVEL_OR_FOREIGN (window)) + if (GDK_SURFACE_DESTROYED (surface) || + !SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface)) return; /* initialize to zero to avoid writing uninitialized data to socket */ @@ -3797,7 +3797,7 @@ gdk_x11_window_set_functions (GdkWindow *window, hints.flags = MWM_HINTS_FUNCTIONS; hints.functions = functions; - gdk_window_set_mwm_hints (window, &hints); + gdk_surface_set_mwm_hints (surface, &hints); } cairo_region_t * @@ -3871,28 +3871,28 @@ _gdk_x11_xwindow_get_shape (Display *xdisplay, static void wmspec_send_message (GdkDisplay *display, - GdkWindow *window, + GdkSurface *surface, gint root_x, gint root_y, gint action, gint button) { - GdkWindowImplX11 *impl = GDK_WINDOW_IMPL_X11 (window->impl); + GdkSurfaceImplX11 *impl = GDK_SURFACE_IMPL_X11 (surface->impl); XClientMessageEvent xclient; memset (&xclient, 0, sizeof (xclient)); xclient.type = ClientMessage; - xclient.window = GDK_WINDOW_XID (window); + xclient.window = GDK_SURFACE_XID (surface); xclient.message_type = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_MOVERESIZE"); xclient.format = 32; - xclient.data.l[0] = root_x * impl->window_scale; - xclient.data.l[1] = root_y * impl->window_scale; + xclient.data.l[0] = root_x * impl->surface_scale; + xclient.data.l[1] = root_y * impl->surface_scale; xclient.data.l[2] = action; xclient.data.l[3] = button; xclient.data.l[4] = 1; /* source indication */ - XSendEvent (GDK_DISPLAY_XDISPLAY (display), GDK_WINDOW_XROOTWIN (window), False, + XSendEvent (GDK_DISPLAY_XDISPLAY (display), GDK_SURFACE_XROOTWIN (surface), False, SubstructureRedirectMask | SubstructureNotifyMask, (XEvent *)&xclient); } @@ -3902,19 +3902,19 @@ handle_wmspec_button_release (GdkDisplay *display, const XEvent *xevent) { GdkX11Display *display_x11 = GDK_X11_DISPLAY (display); - GdkWindow *window; + GdkSurface *surface; #if defined (HAVE_XGENERICEVENTS) && defined (XINPUT_2) XIEvent *xiev = (XIEvent *) xevent->xcookie.data; XIDeviceEvent *xidev = (XIDeviceEvent *) xiev; if (xevent->xany.type == GenericEvent) - window = gdk_x11_window_lookup_for_display (display, xidev->event); + surface = gdk_x11_surface_lookup_for_display (display, xidev->event); else #endif - window = gdk_x11_window_lookup_for_display (display, xevent->xany.window); + surface = gdk_x11_surface_lookup_for_display (display, xevent->xany.window); - if (display_x11->wm_moveresize_button != 0 && window != NULL) + if (display_x11->wm_moveresize_button != 0 && surface != NULL) { if ((xevent->xany.type == ButtonRelease && xevent->xbutton.button == display_x11->wm_moveresize_button) @@ -3927,13 +3927,13 @@ handle_wmspec_button_release (GdkDisplay *display, ) { display_x11->wm_moveresize_button = 0; - wmspec_send_message (display, window, 0, 0, _NET_WM_MOVERESIZE_CANCEL, 0); + wmspec_send_message (display, surface, 0, 0, _NET_WM_MOVERESIZE_CANCEL, 0); } } } static void -wmspec_moveresize (GdkWindow *window, +wmspec_moveresize (GdkSurface *surface, gint direction, GdkDevice *device, gint button, @@ -3941,18 +3941,18 @@ wmspec_moveresize (GdkWindow *window, gint root_y, guint32 timestamp) { - GdkDisplay *display = GDK_WINDOW_DISPLAY (window); + GdkDisplay *display = GDK_SURFACE_DISPLAY (surface); if (button != 0) gdk_seat_ungrab (gdk_device_get_seat (device)); /* Release passive grab */ GDK_X11_DISPLAY (display)->wm_moveresize_button = button; - wmspec_send_message (display, window, root_x, root_y, direction, button); + wmspec_send_message (display, surface, root_x, root_y, direction, button); } static void -wmspec_resize_drag (GdkWindow *window, - GdkWindowEdge edge, +wmspec_resize_drag (GdkSurface *surface, + GdkSurfaceEdge edge, GdkDevice *device, gint button, gint root_x, @@ -3969,45 +3969,45 @@ wmspec_resize_drag (GdkWindow *window, /* Let the compiler turn a switch into a table, instead * of doing the table manually, this way is easier to verify. */ - case GDK_WINDOW_EDGE_NORTH_WEST: + case GDK_SURFACE_EDGE_NORTH_WEST: direction = _NET_WM_MOVERESIZE_SIZE_TOPLEFT; break; - case GDK_WINDOW_EDGE_NORTH: + case GDK_SURFACE_EDGE_NORTH: direction = _NET_WM_MOVERESIZE_SIZE_TOP; break; - case GDK_WINDOW_EDGE_NORTH_EAST: + case GDK_SURFACE_EDGE_NORTH_EAST: direction = _NET_WM_MOVERESIZE_SIZE_TOPRIGHT; break; - case GDK_WINDOW_EDGE_WEST: + case GDK_SURFACE_EDGE_WEST: direction = _NET_WM_MOVERESIZE_SIZE_LEFT; break; - case GDK_WINDOW_EDGE_EAST: + case GDK_SURFACE_EDGE_EAST: direction = _NET_WM_MOVERESIZE_SIZE_RIGHT; break; - case GDK_WINDOW_EDGE_SOUTH_WEST: + case GDK_SURFACE_EDGE_SOUTH_WEST: direction = _NET_WM_MOVERESIZE_SIZE_BOTTOMLEFT; break; - case GDK_WINDOW_EDGE_SOUTH: + case GDK_SURFACE_EDGE_SOUTH: direction = _NET_WM_MOVERESIZE_SIZE_BOTTOM; break; - case GDK_WINDOW_EDGE_SOUTH_EAST: + case GDK_SURFACE_EDGE_SOUTH_EAST: direction = _NET_WM_MOVERESIZE_SIZE_BOTTOMRIGHT; break; default: - g_warning ("gdk_window_begin_resize_drag: bad resize edge %d!", + g_warning ("gdk_surface_begin_resize_drag: bad resize edge %d!", edge); return; } - wmspec_moveresize (window, direction, device, button, root_x, root_y, timestamp); + wmspec_moveresize (surface, direction, device, button, root_x, root_y, timestamp); } typedef struct _MoveResizeData MoveResizeData; @@ -4016,10 +4016,10 @@ struct _MoveResizeData { GdkDisplay *display; - GdkWindow *moveresize_window; - GdkWindow *moveresize_emulation_window; + GdkSurface *moveresize_surface; + GdkSurface *moveresize_emulation_surface; gboolean is_resize; - GdkWindowEdge resize_edge; + GdkSurfaceEdge resize_edge; GdkDevice *device; gint moveresize_button; gint moveresize_x; @@ -4028,7 +4028,7 @@ struct _MoveResizeData gint moveresize_orig_y; gint moveresize_orig_width; gint moveresize_orig_height; - GdkWindowHints moveresize_geom_mask; + GdkSurfaceHints moveresize_geom_mask; GdkGeometry moveresize_geometry; Time moveresize_process_time; XEvent *moveresize_pending_event; @@ -4062,21 +4062,21 @@ check_maximize (MoveResizeData *mv_resize, gdouble x_root, gdouble y_root) { - GdkWindowState state; + GdkSurfaceState state; gint y; if (mv_resize->is_resize) return; - state = gdk_window_get_state (mv_resize->moveresize_window); + state = gdk_surface_get_state (mv_resize->moveresize_surface); - if (state & GDK_WINDOW_STATE_MAXIMIZED) + if (state & GDK_SURFACE_STATE_MAXIMIZED) return; y = mv_resize->moveresize_orig_y + (y_root - mv_resize->moveresize_y); if (y < 10) - gdk_window_maximize (mv_resize->moveresize_window); + gdk_surface_maximize (mv_resize->moveresize_surface); } static void @@ -4084,22 +4084,22 @@ check_unmaximize (MoveResizeData *mv_resize, gdouble x_root, gdouble y_root) { - GdkWindowState state; + GdkSurfaceState state; gint dx, dy; if (mv_resize->is_resize) return; - state = gdk_window_get_state (mv_resize->moveresize_window); + state = gdk_surface_get_state (mv_resize->moveresize_surface); - if ((state & (GDK_WINDOW_STATE_MAXIMIZED | GDK_WINDOW_STATE_TILED)) == 0) + if ((state & (GDK_SURFACE_STATE_MAXIMIZED | GDK_SURFACE_STATE_TILED)) == 0) return; dx = x_root - mv_resize->moveresize_x; dy = y_root - mv_resize->moveresize_y; if (ABS (dx) > 20 || ABS (dy) > 20) - gdk_window_unmaximize (mv_resize->moveresize_window); + gdk_surface_unmaximize (mv_resize->moveresize_surface); } static void @@ -4125,37 +4125,37 @@ update_pos (MoveResizeData *mv_resize, switch (mv_resize->resize_edge) { - case GDK_WINDOW_EDGE_NORTH_WEST: + case GDK_SURFACE_EDGE_NORTH_WEST: x += dx; y += dy; w -= dx; h -= dy; break; - case GDK_WINDOW_EDGE_NORTH: + case GDK_SURFACE_EDGE_NORTH: y += dy; h -= dy; break; - case GDK_WINDOW_EDGE_NORTH_EAST: + case GDK_SURFACE_EDGE_NORTH_EAST: y += dy; h -= dy; w += dx; break; - case GDK_WINDOW_EDGE_SOUTH_WEST: + case GDK_SURFACE_EDGE_SOUTH_WEST: h += dy; x += dx; w -= dx; break; - case GDK_WINDOW_EDGE_SOUTH_EAST: + case GDK_SURFACE_EDGE_SOUTH_EAST: w += dx; h += dy; break; - case GDK_WINDOW_EDGE_SOUTH: + case GDK_SURFACE_EDGE_SOUTH: h += dy; break; - case GDK_WINDOW_EDGE_EAST: + case GDK_SURFACE_EDGE_EAST: w += dx; break; - case GDK_WINDOW_EDGE_WEST: + case GDK_SURFACE_EDGE_WEST: x += dx; w -= dx; break; @@ -4170,12 +4170,12 @@ update_pos (MoveResizeData *mv_resize, if (mv_resize->moveresize_geom_mask) { - gdk_window_constrain_size (&mv_resize->moveresize_geometry, + gdk_surface_constrain_size (&mv_resize->moveresize_geometry, mv_resize->moveresize_geom_mask, w, h, &w, &h); } - gdk_window_move_resize (mv_resize->moveresize_window, x, y, w, h); + gdk_surface_move_resize (mv_resize->moveresize_surface, x, y, w, h); } else { @@ -4184,16 +4184,16 @@ update_pos (MoveResizeData *mv_resize, x = mv_resize->moveresize_orig_x + dx; y = mv_resize->moveresize_orig_y + dy; - gdk_window_move (mv_resize->moveresize_window, x, y); + gdk_surface_move (mv_resize->moveresize_surface, x, y); } } static void finish_drag (MoveResizeData *mv_resize) { - gdk_window_destroy (mv_resize->moveresize_emulation_window); - mv_resize->moveresize_emulation_window = NULL; - g_clear_object (&mv_resize->moveresize_window); + gdk_surface_destroy (mv_resize->moveresize_emulation_surface); + mv_resize->moveresize_emulation_surface = NULL; + g_clear_object (&mv_resize->moveresize_surface); g_clear_pointer (&mv_resize->moveresize_pending_event, g_free); } @@ -4254,15 +4254,15 @@ _gdk_x11_moveresize_handle_event (const XEvent *event) guint button_mask = 0; GdkDisplay *display = gdk_x11_lookup_xdisplay (event->xany.display); MoveResizeData *mv_resize = get_move_resize_data (display, FALSE); - GdkWindowImplX11 *impl; + GdkSurfaceImplX11 *impl; - if (!mv_resize || !mv_resize->moveresize_window) + if (!mv_resize || !mv_resize->moveresize_surface) { handle_wmspec_button_release (display, event); return FALSE; } - impl = GDK_WINDOW_IMPL_X11 (mv_resize->moveresize_window->impl); + impl = GDK_SURFACE_IMPL_X11 (mv_resize->moveresize_surface->impl); if (mv_resize->moveresize_button != 0) button_mask = GDK_BUTTON1_MASK << (mv_resize->moveresize_button - 1); @@ -4270,7 +4270,7 @@ _gdk_x11_moveresize_handle_event (const XEvent *event) switch (event->xany.type) { case MotionNotify: - if (mv_resize->moveresize_window->resize_count > 0) + if (mv_resize->moveresize_surface->resize_count > 0) { if (mv_resize->moveresize_pending_event) *mv_resize->moveresize_pending_event = *event; @@ -4284,8 +4284,8 @@ _gdk_x11_moveresize_handle_event (const XEvent *event) break; update_pos (mv_resize, - event->xmotion.x_root / impl->window_scale, - event->xmotion.y_root / impl->window_scale); + event->xmotion.x_root / impl->surface_scale, + event->xmotion.y_root / impl->surface_scale); /* This should never be triggered in normal cases, but in the * case where the drag started without an implicit grab being @@ -4296,22 +4296,22 @@ _gdk_x11_moveresize_handle_event (const XEvent *event) if ((event->xmotion.state & button_mask) == 0) { check_maximize (mv_resize, - event->xmotion.x_root / impl->window_scale, - event->xmotion.y_root / impl->window_scale); + event->xmotion.x_root / impl->surface_scale, + event->xmotion.y_root / impl->surface_scale); finish_drag (mv_resize); } break; case ButtonRelease: update_pos (mv_resize, - event->xbutton.x_root / impl->window_scale, - event->xbutton.y_root / impl->window_scale); + event->xbutton.x_root / impl->surface_scale, + event->xbutton.y_root / impl->surface_scale); if (event->xbutton.button == mv_resize->moveresize_button) { check_maximize (mv_resize, - event->xmotion.x_root / impl->window_scale, - event->xmotion.y_root / impl->window_scale); + event->xmotion.x_root / impl->surface_scale, + event->xmotion.y_root / impl->surface_scale); finish_drag (mv_resize); } break; @@ -4326,24 +4326,24 @@ _gdk_x11_moveresize_handle_event (const XEvent *event) switch (ev->evtype) { case XI_Motion: - update_pos (mv_resize, xev->root_x / impl->window_scale, xev->root_y / impl->window_scale); + update_pos (mv_resize, xev->root_x / impl->surface_scale, xev->root_y / impl->surface_scale); state = _gdk_x11_device_xi2_translate_state (&xev->mods, &xev->buttons, &xev->group); if ((state & button_mask) == 0) { check_maximize (mv_resize, - xev->root_x / impl->window_scale, - xev->root_y / impl->window_scale); + xev->root_x / impl->surface_scale, + xev->root_y / impl->surface_scale); finish_drag (mv_resize); } break; case XI_ButtonRelease: - update_pos (mv_resize, xev->root_x / impl->window_scale, xev->root_y / impl->window_scale); + update_pos (mv_resize, xev->root_x / impl->surface_scale, xev->root_y / impl->surface_scale); if (xev->detail == mv_resize->moveresize_button) { check_maximize (mv_resize, - xev->root_x / impl->window_scale, - xev->root_y / impl->window_scale); + xev->root_x / impl->surface_scale, + xev->root_y / impl->surface_scale); finish_drag (mv_resize); } break; @@ -4363,12 +4363,12 @@ _gdk_x11_moveresize_handle_event (const XEvent *event) gboolean _gdk_x11_moveresize_configure_done (GdkDisplay *display, - GdkWindow *window) + GdkSurface *surface) { XEvent *tmp_event; MoveResizeData *mv_resize = get_move_resize_data (display, FALSE); - if (!mv_resize || window != mv_resize->moveresize_window) + if (!mv_resize || surface != mv_resize->moveresize_surface) return FALSE; if (mv_resize->moveresize_pending_event) @@ -4383,24 +4383,24 @@ _gdk_x11_moveresize_configure_done (GdkDisplay *display, } static void -create_moveresize_window (MoveResizeData *mv_resize, +create_moveresize_surface (MoveResizeData *mv_resize, guint32 timestamp) { GdkGrabStatus status; - g_assert (mv_resize->moveresize_emulation_window == NULL); + g_assert (mv_resize->moveresize_emulation_surface == NULL); - mv_resize->moveresize_emulation_window = gdk_window_new_temp (mv_resize->display); - gdk_window_show (mv_resize->moveresize_emulation_window); + mv_resize->moveresize_emulation_surface = gdk_surface_new_temp (mv_resize->display); + gdk_surface_show (mv_resize->moveresize_emulation_surface); status = gdk_seat_grab (gdk_device_get_seat (mv_resize->device), - mv_resize->moveresize_emulation_window, + mv_resize->moveresize_emulation_surface, GDK_SEAT_CAPABILITY_POINTER, FALSE, NULL, NULL, NULL, NULL); if (status != GDK_GRAB_SUCCESS) { - /* If this fails, some other client has grabbed the window + /* If this fails, some other client has grabbed the surface * already. */ finish_drag (mv_resize); @@ -4412,7 +4412,7 @@ create_moveresize_window (MoveResizeData *mv_resize, /* Calculate mv_resize->moveresize_orig_x and mv_resize->moveresize_orig_y so that calling XMoveWindow with these coordinates will not move the - window. + surface. Note that this depends on the WM to implement ICCCM-compliant reference point handling. */ @@ -4425,14 +4425,14 @@ calculate_unmoving_origin (MoveResizeData *mv_resize) if (mv_resize->moveresize_geom_mask & GDK_HINT_WIN_GRAVITY && mv_resize->moveresize_geometry.win_gravity == GDK_GRAVITY_STATIC) { - gdk_window_get_origin (mv_resize->moveresize_window, + gdk_surface_get_origin (mv_resize->moveresize_surface, &mv_resize->moveresize_orig_x, &mv_resize->moveresize_orig_y); } else { - gdk_window_get_frame_extents (mv_resize->moveresize_window, &rect); - gdk_window_get_geometry (mv_resize->moveresize_window, + gdk_surface_get_frame_extents (mv_resize->moveresize_surface, &rect); + gdk_surface_get_geometry (mv_resize->moveresize_surface, NULL, NULL, &width, &height); switch (mv_resize->moveresize_geometry.win_gravity) @@ -4483,17 +4483,17 @@ calculate_unmoving_origin (MoveResizeData *mv_resize) } static void -emulate_resize_drag (GdkWindow *window, - GdkWindowEdge edge, +emulate_resize_drag (GdkSurface *surface, + GdkSurfaceEdge edge, GdkDevice *device, gint button, gint root_x, gint root_y, guint32 timestamp) { - MoveResizeData *mv_resize = get_move_resize_data (GDK_WINDOW_DISPLAY (window), TRUE); + MoveResizeData *mv_resize = get_move_resize_data (GDK_SURFACE_DISPLAY (surface), TRUE); - if (mv_resize->moveresize_window != NULL) + if (mv_resize->moveresize_surface != NULL) return; /* already a drag operation in progress */ mv_resize->is_resize = TRUE; @@ -4502,32 +4502,32 @@ emulate_resize_drag (GdkWindow *window, mv_resize->device = device; mv_resize->moveresize_x = root_x; mv_resize->moveresize_y = root_y; - mv_resize->moveresize_window = g_object_ref (window); + mv_resize->moveresize_surface = g_object_ref (surface); - mv_resize->moveresize_orig_width = gdk_window_get_width (window); - mv_resize->moveresize_orig_height = gdk_window_get_height (window); + mv_resize->moveresize_orig_width = gdk_surface_get_width (surface); + mv_resize->moveresize_orig_height = gdk_surface_get_height (surface); mv_resize->moveresize_geom_mask = 0; - gdk_window_get_geometry_hints (window, + gdk_surface_get_geometry_hints (surface, &mv_resize->moveresize_geometry, &mv_resize->moveresize_geom_mask); calculate_unmoving_origin (mv_resize); - create_moveresize_window (mv_resize, timestamp); + create_moveresize_surface (mv_resize, timestamp); } static void -emulate_move_drag (GdkWindow *window, +emulate_move_drag (GdkSurface *surface, GdkDevice *device, gint button, gint root_x, gint root_y, guint32 timestamp) { - MoveResizeData *mv_resize = get_move_resize_data (GDK_WINDOW_DISPLAY (window), TRUE); + MoveResizeData *mv_resize = get_move_resize_data (GDK_SURFACE_DISPLAY (surface), TRUE); - if (mv_resize->moveresize_window != NULL) + if (mv_resize->moveresize_surface != NULL) return; /* already a drag operation in progress */ mv_resize->is_resize = FALSE; @@ -4536,25 +4536,25 @@ emulate_move_drag (GdkWindow *window, mv_resize->moveresize_x = root_x; mv_resize->moveresize_y = root_y; - mv_resize->moveresize_window = g_object_ref (window); + mv_resize->moveresize_surface = g_object_ref (surface); calculate_unmoving_origin (mv_resize); - create_moveresize_window (mv_resize, timestamp); + create_moveresize_surface (mv_resize, timestamp); } static gboolean -_should_perform_ewmh_drag (GdkWindow *window, +_should_perform_ewmh_drag (GdkSurface *surface, GdkDevice *device) { - GdkPointerWindowInfo *info; + GdkPointerSurfaceInfo *info; GdkDisplay *display; - display = gdk_window_get_display (window); + display = gdk_surface_get_display (surface); info = _gdk_display_get_pointer_info (display, device); if ((!info->last_slave || gdk_device_get_source (info->last_slave) != GDK_SOURCE_TOUCHSCREEN) && - gdk_x11_screen_supports_net_wm_hint (GDK_WINDOW_SCREEN (window), + gdk_x11_screen_supports_net_wm_hint (GDK_SURFACE_SCREEN (surface), g_intern_static_string ("_NET_WM_MOVERESIZE"))) return TRUE; @@ -4562,27 +4562,27 @@ _should_perform_ewmh_drag (GdkWindow *window, } static void -gdk_x11_window_begin_resize_drag (GdkWindow *window, - GdkWindowEdge edge, +gdk_x11_surface_begin_resize_drag (GdkSurface *surface, + GdkSurfaceEdge edge, GdkDevice *device, gint button, gint root_x, gint root_y, guint32 timestamp) { - if (GDK_WINDOW_DESTROYED (window) || - !WINDOW_IS_TOPLEVEL_OR_FOREIGN (window)) + if (GDK_SURFACE_DESTROYED (surface) || + !SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface)) return; /* Avoid EWMH for touch devices */ - if (_should_perform_ewmh_drag (window, device)) - wmspec_resize_drag (window, edge, device, button, root_x, root_y, timestamp); + if (_should_perform_ewmh_drag (surface, device)) + wmspec_resize_drag (surface, edge, device, button, root_x, root_y, timestamp); else - emulate_resize_drag (window, edge, device, button, root_x, root_y, timestamp); + emulate_resize_drag (surface, edge, device, button, root_x, root_y, timestamp); } static void -gdk_x11_window_begin_move_drag (GdkWindow *window, +gdk_x11_surface_begin_move_drag (GdkSurface *surface, GdkDevice *device, gint button, gint root_x, @@ -4591,7 +4591,7 @@ gdk_x11_window_begin_move_drag (GdkWindow *window, { gint direction; - if (GDK_WINDOW_DESTROYED (window) || !WINDOW_IS_TOPLEVEL (window)) + if (GDK_SURFACE_DESTROYED (surface) || !SURFACE_IS_TOPLEVEL (surface)) return; if (button == 0) @@ -4600,24 +4600,24 @@ gdk_x11_window_begin_move_drag (GdkWindow *window, direction = _NET_WM_MOVERESIZE_MOVE; /* Avoid EWMH for touch devices */ - if (_should_perform_ewmh_drag (window, device)) - wmspec_moveresize (window, direction, device, button, root_x, root_y, timestamp); + if (_should_perform_ewmh_drag (surface, device)) + wmspec_moveresize (surface, direction, device, button, root_x, root_y, timestamp); else - emulate_move_drag (window, device, button, root_x, root_y, timestamp); + emulate_move_drag (surface, device, button, root_x, root_y, timestamp); } static gboolean -gdk_x11_window_beep (GdkWindow *window) +gdk_x11_surface_beep (GdkSurface *surface) { GdkDisplay *display; - display = GDK_WINDOW_DISPLAY (window); + display = GDK_SURFACE_DISPLAY (surface); #ifdef HAVE_XKB if (GDK_X11_DISPLAY (display)->use_xkb) { XkbBell (GDK_DISPLAY_XDISPLAY (display), - GDK_WINDOW_XID (window), + GDK_SURFACE_XID (surface), 0, None); return TRUE; @@ -4628,19 +4628,19 @@ gdk_x11_window_beep (GdkWindow *window) } static void -gdk_x11_window_set_opacity (GdkWindow *window, +gdk_x11_surface_set_opacity (GdkSurface *surface, gdouble opacity) { GdkDisplay *display; gulong cardinal; - g_return_if_fail (GDK_IS_WINDOW (window)); + g_return_if_fail (GDK_IS_SURFACE (surface)); - if (GDK_WINDOW_DESTROYED (window) || - !WINDOW_IS_TOPLEVEL (window)) + if (GDK_SURFACE_DESTROYED (surface) || + !SURFACE_IS_TOPLEVEL (surface)) return; - display = gdk_window_get_display (window); + display = gdk_surface_get_display (surface); if (opacity < 0) opacity = 0; @@ -4651,11 +4651,11 @@ gdk_x11_window_set_opacity (GdkWindow *window, if (cardinal == 0xffffffff) XDeleteProperty (GDK_DISPLAY_XDISPLAY (display), - GDK_WINDOW_XID (window), + GDK_SURFACE_XID (surface), gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_WINDOW_OPACITY")); else XChangeProperty (GDK_DISPLAY_XDISPLAY (display), - GDK_WINDOW_XID (window), + GDK_SURFACE_XID (surface), gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_WINDOW_OPACITY"), XA_CARDINAL, 32, PropModeReplace, @@ -4681,8 +4681,8 @@ timestamp_predicate (Display *display, /** * gdk_x11_get_server_time: - * @window: (type GdkX11Window): a #GdkWindow, used for communication - * with the server. The window must have + * @surface: (type GdkX11Surface): a #GdkSurface, used for communication + * with the server. The surface must have * GDK_PROPERTY_CHANGE_MASK in its events mask or a hang will * result. * @@ -4691,7 +4691,7 @@ timestamp_predicate (Display *display, * Returns: the time stamp. **/ guint32 -gdk_x11_get_server_time (GdkWindow *window) +gdk_x11_get_server_time (GdkSurface *surface) { Display *xdisplay; Window xwindow; @@ -4699,13 +4699,13 @@ gdk_x11_get_server_time (GdkWindow *window) XEvent xevent; Atom timestamp_prop_atom; - g_return_val_if_fail (GDK_IS_WINDOW (window), 0); - g_return_val_if_fail (!GDK_WINDOW_DESTROYED (window), 0); + g_return_val_if_fail (GDK_IS_SURFACE (surface), 0); + g_return_val_if_fail (!GDK_SURFACE_DESTROYED (surface), 0); - xdisplay = GDK_WINDOW_XDISPLAY (window); - xwindow = GDK_WINDOW_XID (window); + xdisplay = GDK_SURFACE_XDISPLAY (surface); + xwindow = GDK_SURFACE_XID (surface); timestamp_prop_atom = - gdk_x11_get_xatom_by_name_for_display (GDK_WINDOW_DISPLAY (window), + gdk_x11_get_xatom_by_name_for_display (GDK_SURFACE_DISPLAY (surface), "GDK_TIMESTAMP_PROP"); XChangeProperty (xdisplay, xwindow, timestamp_prop_atom, @@ -4719,73 +4719,73 @@ gdk_x11_get_server_time (GdkWindow *window) } /** - * gdk_x11_window_get_xid: - * @window: (type GdkX11Window): a native #GdkWindow. + * gdk_x11_surface_get_xid: + * @surface: (type GdkX11Surface): a native #GdkSurface. * - * Returns the X resource (window) belonging to a #GdkWindow. + * Returns the X resource (surface) belonging to a #GdkSurface. * * Returns: the ID of @drawable’s X resource. **/ XID -gdk_x11_window_get_xid (GdkWindow *window) +gdk_x11_surface_get_xid (GdkSurface *surface) { - if (!GDK_WINDOW_IS_X11 (window) || - !_gdk_window_has_impl (window)) + if (!GDK_SURFACE_IS_X11 (surface) || + !_gdk_surface_has_impl (surface)) { g_warning (G_STRLOC " drawable is not a native X11 window"); return None; } - return GDK_WINDOW_IMPL_X11 (window->impl)->xid; + return GDK_SURFACE_IMPL_X11 (surface->impl)->xid; } static gint -gdk_x11_window_get_scale_factor (GdkWindow *window) +gdk_x11_surface_get_scale_factor (GdkSurface *surface) { - GdkWindowImplX11 *impl = GDK_WINDOW_IMPL_X11 (window->impl); + GdkSurfaceImplX11 *impl = GDK_SURFACE_IMPL_X11 (surface->impl); - if (GDK_WINDOW_DESTROYED (window)) + if (GDK_SURFACE_DESTROYED (surface)) return 1; - return impl->window_scale; + return impl->surface_scale; } /** - * gdk_x11_window_set_frame_sync_enabled: - * @window: (type GdkX11Window): a native #GdkWindow + * gdk_x11_surface_set_frame_sync_enabled: + * @surface: (type GdkX11Surface): a native #GdkSurface * @frame_sync_enabled: whether frame-synchronization should be enabled * - * This function can be used to disable frame synchronization for a window. + * This function can be used to disable frame synchronization for a surface. * Normally frame synchronziation will be enabled or disabled based on whether * the system has a compositor that supports frame synchronization, but if - * the window is not directly managed by the window manager, then frame - * synchronziation may need to be disabled. This is the case for a window + * the surface is not directly managed by the window manager, then frame + * synchronziation may need to be disabled. This is the case for a surface * embedded via the XEMBED protocol. */ void -gdk_x11_window_set_frame_sync_enabled (GdkWindow *window, +gdk_x11_surface_set_frame_sync_enabled (GdkSurface *surface, gboolean frame_sync_enabled) { - if (!GDK_WINDOW_IS_X11 (window) || - !_gdk_window_has_impl (window)) + if (!GDK_SURFACE_IS_X11 (surface) || + !_gdk_surface_has_impl (surface)) { g_warning (G_STRLOC " drawable is not a native X11 window"); return; } - GDK_WINDOW_IMPL_X11 (window->impl)->frame_sync_enabled = FALSE; + GDK_SURFACE_IMPL_X11 (surface->impl)->frame_sync_enabled = FALSE; } static void -gdk_x11_window_set_opaque_region (GdkWindow *window, +gdk_x11_surface_set_opaque_region (GdkSurface *surface, cairo_region_t *region) { - GdkWindowImplX11 *impl = GDK_WINDOW_IMPL_X11 (window->impl); + GdkSurfaceImplX11 *impl = GDK_SURFACE_IMPL_X11 (surface->impl); GdkDisplay *display; int nitems; gulong *data; - if (GDK_WINDOW_DESTROYED (window)) + if (GDK_SURFACE_DESTROYED (surface)) return; if (region != NULL) @@ -4800,10 +4800,10 @@ gdk_x11_window_set_opaque_region (GdkWindow *window, { cairo_rectangle_int_t rect; cairo_region_get_rectangle (region, i, &rect); - data[i*4+0] = rect.x * impl->window_scale; - data[i*4+1] = rect.y * impl->window_scale; - data[i*4+2] = rect.width * impl->window_scale; - data[i*4+3] = rect.height * impl->window_scale; + data[i*4+0] = rect.x * impl->surface_scale; + data[i*4+1] = rect.y * impl->surface_scale; + data[i*4+2] = rect.width * impl->surface_scale; + data[i*4+3] = rect.height * impl->surface_scale; } } else @@ -4812,10 +4812,10 @@ gdk_x11_window_set_opaque_region (GdkWindow *window, data = NULL; } - display = gdk_window_get_display (window); + display = gdk_surface_get_display (surface); XChangeProperty (GDK_DISPLAY_XDISPLAY (display), - GDK_WINDOW_XID (window), + GDK_SURFACE_XID (surface), gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_OPAQUE_REGION"), XA_CARDINAL, 32, PropModeReplace, (guchar *) data, nitems); @@ -4824,11 +4824,11 @@ gdk_x11_window_set_opaque_region (GdkWindow *window, } static gboolean -gdk_x11_window_show_window_menu (GdkWindow *window, +gdk_x11_surface_show_window_menu (GdkSurface *surface, GdkEvent *event) { - GdkWindowImplX11 *impl = GDK_WINDOW_IMPL_X11 (window->impl); - GdkDisplay *display = GDK_WINDOW_DISPLAY (window); + GdkSurfaceImplX11 *impl = GDK_SURFACE_IMPL_X11 (surface->impl); + GdkDisplay *display = GDK_SURFACE_DISPLAY (surface); GdkDevice *device; int device_id; double x_root, y_root; @@ -4843,7 +4843,7 @@ gdk_x11_window_show_window_menu (GdkWindow *window, return FALSE; } - if (!gdk_x11_screen_supports_net_wm_hint (GDK_WINDOW_SCREEN (window), + if (!gdk_x11_screen_supports_net_wm_hint (GDK_SURFACE_SCREEN (surface), g_intern_static_string ("_GTK_SHOW_WINDOW_MENU"))) return FALSE; @@ -4857,14 +4857,14 @@ gdk_x11_window_show_window_menu (GdkWindow *window, gdk_seat_ungrab (gdk_device_get_seat (device)); xclient.type = ClientMessage; - xclient.window = GDK_WINDOW_XID (window); + xclient.window = GDK_SURFACE_XID (surface); xclient.message_type = gdk_x11_get_xatom_by_name_for_display (display, "_GTK_SHOW_WINDOW_MENU"); xclient.data.l[0] = device_id; - xclient.data.l[1] = x_root * impl->window_scale; - xclient.data.l[2] = y_root * impl->window_scale; + xclient.data.l[1] = x_root * impl->surface_scale; + xclient.data.l[2] = y_root * impl->surface_scale; xclient.format = 32; - XSendEvent (GDK_DISPLAY_XDISPLAY (display), GDK_WINDOW_XROOTWIN (window), False, + XSendEvent (GDK_DISPLAY_XDISPLAY (display), GDK_SURFACE_XROOTWIN (surface), False, SubstructureRedirectMask | SubstructureNotifyMask, (XEvent *)&xclient); @@ -4872,77 +4872,77 @@ gdk_x11_window_show_window_menu (GdkWindow *window, } static void -gdk_window_impl_x11_class_init (GdkWindowImplX11Class *klass) +gdk_surface_impl_x11_class_init (GdkSurfaceImplX11Class *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - GdkWindowImplClass *impl_class = GDK_WINDOW_IMPL_CLASS (klass); + GdkSurfaceImplClass *impl_class = GDK_SURFACE_IMPL_CLASS (klass); - object_class->finalize = gdk_window_impl_x11_finalize; + object_class->finalize = gdk_surface_impl_x11_finalize; impl_class->ref_cairo_surface = gdk_x11_ref_cairo_surface; - impl_class->show = gdk_window_x11_show; - impl_class->hide = gdk_window_x11_hide; - impl_class->withdraw = gdk_window_x11_withdraw; - impl_class->set_events = gdk_window_x11_set_events; - impl_class->get_events = gdk_window_x11_get_events; - impl_class->raise = gdk_window_x11_raise; - impl_class->lower = gdk_window_x11_lower; - impl_class->restack_toplevel = gdk_window_x11_restack_toplevel; - impl_class->move_resize = gdk_window_x11_move_resize; - impl_class->get_geometry = gdk_window_x11_get_geometry; - impl_class->get_root_coords = gdk_window_x11_get_root_coords; - impl_class->get_device_state = gdk_window_x11_get_device_state; - impl_class->shape_combine_region = gdk_window_x11_shape_combine_region; - impl_class->input_shape_combine_region = gdk_window_x11_input_shape_combine_region; - impl_class->queue_antiexpose = _gdk_x11_window_queue_antiexpose; - impl_class->destroy = gdk_x11_window_destroy; - impl_class->beep = gdk_x11_window_beep; - - impl_class->focus = gdk_x11_window_focus; - impl_class->set_type_hint = gdk_x11_window_set_type_hint; - impl_class->get_type_hint = gdk_x11_window_get_type_hint; - impl_class->set_modal_hint = gdk_x11_window_set_modal_hint; - impl_class->set_skip_taskbar_hint = gdk_x11_window_set_skip_taskbar_hint; - impl_class->set_skip_pager_hint = gdk_x11_window_set_skip_pager_hint; - impl_class->set_urgency_hint = gdk_x11_window_set_urgency_hint; - impl_class->set_geometry_hints = gdk_x11_window_set_geometry_hints; - impl_class->set_title = gdk_x11_window_set_title; - impl_class->set_role = gdk_x11_window_set_role; - impl_class->set_startup_id = gdk_x11_window_set_startup_id; - impl_class->set_transient_for = gdk_x11_window_set_transient_for; - impl_class->get_frame_extents = gdk_x11_window_get_frame_extents; - impl_class->set_accept_focus = gdk_x11_window_set_accept_focus; - impl_class->set_focus_on_map = gdk_x11_window_set_focus_on_map; - impl_class->set_icon_list = gdk_x11_window_set_icon_list; - impl_class->set_icon_name = gdk_x11_window_set_icon_name; - impl_class->iconify = gdk_x11_window_iconify; - impl_class->deiconify = gdk_x11_window_deiconify; - impl_class->stick = gdk_x11_window_stick; - impl_class->unstick = gdk_x11_window_unstick; - impl_class->maximize = gdk_x11_window_maximize; - impl_class->unmaximize = gdk_x11_window_unmaximize; - impl_class->fullscreen = gdk_x11_window_fullscreen; - impl_class->fullscreen_on_monitor = gdk_x11_window_fullscreen_on_monitor; - impl_class->apply_fullscreen_mode = gdk_x11_window_apply_fullscreen_mode; - impl_class->unfullscreen = gdk_x11_window_unfullscreen; - impl_class->set_keep_above = gdk_x11_window_set_keep_above; - impl_class->set_keep_below = gdk_x11_window_set_keep_below; - impl_class->get_group = gdk_x11_window_get_group; - impl_class->set_group = gdk_x11_window_set_group; - impl_class->set_decorations = gdk_x11_window_set_decorations; - impl_class->get_decorations = gdk_x11_window_get_decorations; - impl_class->set_functions = gdk_x11_window_set_functions; - impl_class->begin_resize_drag = gdk_x11_window_begin_resize_drag; - impl_class->begin_move_drag = gdk_x11_window_begin_move_drag; - impl_class->set_opacity = gdk_x11_window_set_opacity; - impl_class->destroy_notify = gdk_x11_window_destroy_notify; - impl_class->register_dnd = _gdk_x11_window_register_dnd; - impl_class->drag_begin = _gdk_x11_window_drag_begin; - impl_class->get_scale_factor = gdk_x11_window_get_scale_factor; - impl_class->set_opaque_region = gdk_x11_window_set_opaque_region; - impl_class->set_shadow_width = gdk_x11_window_set_shadow_width; - impl_class->show_window_menu = gdk_x11_window_show_window_menu; - impl_class->create_gl_context = gdk_x11_window_create_gl_context; - impl_class->get_unscaled_size = gdk_x11_window_get_unscaled_size; - impl_class->supports_edge_constraints = gdk_x11_window_supports_edge_constraints; + impl_class->show = gdk_surface_x11_show; + impl_class->hide = gdk_surface_x11_hide; + impl_class->withdraw = gdk_surface_x11_withdraw; + impl_class->set_events = gdk_surface_x11_set_events; + impl_class->get_events = gdk_surface_x11_get_events; + impl_class->raise = gdk_surface_x11_raise; + impl_class->lower = gdk_surface_x11_lower; + impl_class->restack_toplevel = gdk_surface_x11_restack_toplevel; + impl_class->move_resize = gdk_surface_x11_move_resize; + impl_class->get_geometry = gdk_surface_x11_get_geometry; + impl_class->get_root_coords = gdk_surface_x11_get_root_coords; + impl_class->get_device_state = gdk_surface_x11_get_device_state; + impl_class->shape_combine_region = gdk_surface_x11_shape_combine_region; + impl_class->input_shape_combine_region = gdk_surface_x11_input_shape_combine_region; + impl_class->queue_antiexpose = _gdk_x11_surface_queue_antiexpose; + impl_class->destroy = gdk_x11_surface_destroy; + impl_class->beep = gdk_x11_surface_beep; + + impl_class->focus = gdk_x11_surface_focus; + impl_class->set_type_hint = gdk_x11_surface_set_type_hint; + impl_class->get_type_hint = gdk_x11_surface_get_type_hint; + impl_class->set_modal_hint = gdk_x11_surface_set_modal_hint; + impl_class->set_skip_taskbar_hint = gdk_x11_surface_set_skip_taskbar_hint; + impl_class->set_skip_pager_hint = gdk_x11_surface_set_skip_pager_hint; + impl_class->set_urgency_hint = gdk_x11_surface_set_urgency_hint; + impl_class->set_geometry_hints = gdk_x11_surface_set_geometry_hints; + impl_class->set_title = gdk_x11_surface_set_title; + impl_class->set_role = gdk_x11_surface_set_role; + impl_class->set_startup_id = gdk_x11_surface_set_startup_id; + impl_class->set_transient_for = gdk_x11_surface_set_transient_for; + impl_class->get_frame_extents = gdk_x11_surface_get_frame_extents; + impl_class->set_accept_focus = gdk_x11_surface_set_accept_focus; + impl_class->set_focus_on_map = gdk_x11_surface_set_focus_on_map; + impl_class->set_icon_list = gdk_x11_surface_set_icon_list; + impl_class->set_icon_name = gdk_x11_surface_set_icon_name; + impl_class->iconify = gdk_x11_surface_iconify; + impl_class->deiconify = gdk_x11_surface_deiconify; + impl_class->stick = gdk_x11_surface_stick; + impl_class->unstick = gdk_x11_surface_unstick; + impl_class->maximize = gdk_x11_surface_maximize; + impl_class->unmaximize = gdk_x11_surface_unmaximize; + impl_class->fullscreen = gdk_x11_surface_fullscreen; + impl_class->fullscreen_on_monitor = gdk_x11_surface_fullscreen_on_monitor; + impl_class->apply_fullscreen_mode = gdk_x11_surface_apply_fullscreen_mode; + impl_class->unfullscreen = gdk_x11_surface_unfullscreen; + impl_class->set_keep_above = gdk_x11_surface_set_keep_above; + impl_class->set_keep_below = gdk_x11_surface_set_keep_below; + impl_class->get_group = gdk_x11_surface_get_group; + impl_class->set_group = gdk_x11_surface_set_group; + impl_class->set_decorations = gdk_x11_surface_set_decorations; + impl_class->get_decorations = gdk_x11_surface_get_decorations; + impl_class->set_functions = gdk_x11_surface_set_functions; + impl_class->begin_resize_drag = gdk_x11_surface_begin_resize_drag; + impl_class->begin_move_drag = gdk_x11_surface_begin_move_drag; + impl_class->set_opacity = gdk_x11_surface_set_opacity; + impl_class->destroy_notify = gdk_x11_surface_destroy_notify; + impl_class->register_dnd = _gdk_x11_surface_register_dnd; + impl_class->drag_begin = _gdk_x11_surface_drag_begin; + impl_class->get_scale_factor = gdk_x11_surface_get_scale_factor; + impl_class->set_opaque_region = gdk_x11_surface_set_opaque_region; + impl_class->set_shadow_width = gdk_x11_surface_set_shadow_width; + impl_class->show_window_menu = gdk_x11_surface_show_window_menu; + impl_class->create_gl_context = gdk_x11_surface_create_gl_context; + impl_class->get_unscaled_size = gdk_x11_surface_get_unscaled_size; + impl_class->supports_edge_constraints = gdk_x11_surface_supports_edge_constraints; } diff --git a/gdk/x11/gdkwindow-x11.h b/gdk/x11/gdksurface-x11.h index 2199692327..08f3befe43 100644 --- a/gdk/x11/gdkwindow-x11.h +++ b/gdk/x11/gdksurface-x11.h @@ -22,11 +22,11 @@ * GTK+ at ftp://ftp.gtk.org/pub/gtk/. */ -#ifndef __GDK_WINDOW_X11_H__ -#define __GDK_WINDOW_X11_H__ +#ifndef __GDK_SURFACE_X11_H__ +#define __GDK_SURFACE_X11_H__ #include "gdk/x11/gdkprivate-x11.h" -#include "gdk/gdkwindowimpl.h" +#include "gdk/gdksurfaceimpl.h" #include <X11/Xlib.h> @@ -42,25 +42,25 @@ G_BEGIN_DECLS typedef struct _GdkToplevelX11 GdkToplevelX11; -typedef struct _GdkWindowImplX11 GdkWindowImplX11; -typedef struct _GdkWindowImplX11Class GdkWindowImplX11Class; +typedef struct _GdkSurfaceImplX11 GdkSurfaceImplX11; +typedef struct _GdkSurfaceImplX11Class GdkSurfaceImplX11Class; typedef struct _GdkXPositionInfo GdkXPositionInfo; /* Window implementation for X11 */ -#define GDK_TYPE_WINDOW_IMPL_X11 (gdk_window_impl_x11_get_type ()) -#define GDK_WINDOW_IMPL_X11(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_WINDOW_IMPL_X11, GdkWindowImplX11)) -#define GDK_WINDOW_IMPL_X11_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_WINDOW_IMPL_X11, GdkWindowImplX11Class)) -#define GDK_IS_WINDOW_IMPL_X11(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_WINDOW_IMPL_X11)) -#define GDK_IS_WINDOW_IMPL_X11_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_WINDOW_IMPL_X11)) -#define GDK_WINDOW_IMPL_X11_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_WINDOW_IMPL_X11, GdkWindowImplX11Class)) +#define GDK_TYPE_SURFACE_IMPL_X11 (gdk_surface_impl_x11_get_type ()) +#define GDK_SURFACE_IMPL_X11(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_SURFACE_IMPL_X11, GdkSurfaceImplX11)) +#define GDK_SURFACE_IMPL_X11_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_SURFACE_IMPL_X11, GdkSurfaceImplX11Class)) +#define GDK_IS_SURFACE_IMPL_X11(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_SURFACE_IMPL_X11)) +#define GDK_IS_SURFACE_IMPL_X11_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_SURFACE_IMPL_X11)) +#define GDK_SURFACE_IMPL_X11_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_SURFACE_IMPL_X11, GdkSurfaceImplX11Class)) -struct _GdkWindowImplX11 +struct _GdkSurfaceImplX11 { - GdkWindowImpl parent_instance; + GdkSurfaceImpl parent_instance; - GdkWindow *wrapper; + GdkSurface *wrapper; Window xid; @@ -74,11 +74,11 @@ struct _GdkWindowImplX11 guint frame_sync_enabled : 1; guint tracking_damage: 1; - gint window_scale; + gint surface_scale; - /* Width and height not divided by window_scale - this matters in the + /* Width and height not divided by surface_scale - this matters in the * corner-case where the window manager assigns us a size that isn't - * a multiple of window_scale - for example for a maximized window + * a multiple of surface_scale - for example for a maximized window * with an odd-sized title-bar. */ gint unscaled_width; @@ -91,9 +91,9 @@ struct _GdkWindowImplX11 #endif }; -struct _GdkWindowImplX11Class +struct _GdkSurfaceImplX11Class { - GdkWindowImplClass parent_class; + GdkSurfaceImplClass parent_class; }; struct _GdkToplevelX11 @@ -151,7 +151,7 @@ struct _GdkToplevelX11 cairo_surface_t *icon_pixmap; cairo_surface_t *icon_mask; - GdkWindow *group_leader; + GdkSurface *group_leader; /* Time of most recent user interaction. */ gulong user_time; @@ -162,7 +162,7 @@ struct _GdkToplevelX11 */ Window focus_window; - GdkWindowHints last_geometry_hints_mask; + GdkSurfaceHints last_geometry_hints_mask; GdkGeometry last_geometry_hints; /* Constrained edge information */ @@ -184,16 +184,16 @@ struct _GdkToplevelX11 #endif }; -GType gdk_window_impl_x11_get_type (void); +GType gdk_surface_impl_x11_get_type (void); -GdkToplevelX11 *_gdk_x11_window_get_toplevel (GdkWindow *window); +GdkToplevelX11 *_gdk_x11_surface_get_toplevel (GdkSurface *window); -GdkCursor *_gdk_x11_window_get_cursor (GdkWindow *window); +GdkCursor *_gdk_x11_surface_get_cursor (GdkSurface *window); -void _gdk_x11_window_update_size (GdkWindowImplX11 *impl); -void _gdk_x11_window_set_window_scale (GdkWindow *window, +void _gdk_x11_surface_update_size (GdkSurfaceImplX11 *impl); +void _gdk_x11_surface_set_surface_scale (GdkSurface *window, int scale); G_END_DECLS -#endif /* __GDK_WINDOW_X11_H__ */ +#endif /* __GDK_SURFACE_X11_H__ */ diff --git a/gdk/x11/gdkvulkancontext-x11.c b/gdk/x11/gdkvulkancontext-x11.c index 608a2e22d7..c59dbe3dec 100644 --- a/gdk/x11/gdkvulkancontext-x11.c +++ b/gdk/x11/gdkvulkancontext-x11.c @@ -28,7 +28,7 @@ #include "gdkinternals.h" #include "gdkdisplay-x11.h" -#include "gdkwindow-x11.h" +#include "gdksurface-x11.h" G_DEFINE_TYPE (GdkX11VulkanContext, gdk_x11_vulkan_context, GDK_TYPE_VULKAN_CONTEXT) @@ -36,7 +36,7 @@ static VkResult gdk_x11_vulkan_context_create_surface (GdkVulkanContext *context, VkSurfaceKHR *surface) { - GdkWindow *window = gdk_draw_context_get_window (GDK_DRAW_CONTEXT (context)); + GdkSurface *window = 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. @@ -52,7 +52,7 @@ gdk_x11_vulkan_context_create_surface (GdkVulkanContext *context, NULL, 0, gdk_x11_display_get_xdisplay (display), - gdk_x11_window_get_xid (window) + gdk_x11_surface_get_xid (window) }, NULL, surface); diff --git a/gdk/x11/gdkx-autocleanups.h b/gdk/x11/gdkx-autocleanups.h index d18abfa48b..ff3d5a43a9 100644 --- a/gdk/x11/gdkx-autocleanups.h +++ b/gdk/x11/gdkx-autocleanups.h @@ -31,6 +31,6 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkX11DragContext, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkX11GLContext, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkX11Keymap, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkX11Screen, g_object_unref) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkX11Window, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkX11Surface, g_object_unref) #endif diff --git a/gdk/x11/gdkx.h b/gdk/x11/gdkx.h index 153b4a501e..9fa9cb0711 100644 --- a/gdk/x11/gdkx.h +++ b/gdk/x11/gdkx.h @@ -48,7 +48,7 @@ #include <gdk/x11/gdkx11screen.h> #include <gdk/x11/gdkx11selection.h> #include <gdk/x11/gdkx11utils.h> -#include <gdk/x11/gdkx11window.h> +#include <gdk/x11/gdkx11surface.h> #include <gdk/x11/gdkx-autocleanups.h> diff --git a/gdk/x11/gdkx11display.h b/gdk/x11/gdkx11display.h index 85f54995b1..4bf8de7452 100644 --- a/gdk/x11/gdkx11display.h +++ b/gdk/x11/gdkx11display.h @@ -111,7 +111,7 @@ GDK_AVAILABLE_IN_ALL void gdk_x11_display_ungrab (GdkDisplay *display); GDK_AVAILABLE_IN_ALL -void gdk_x11_display_set_window_scale (GdkDisplay *display, +void gdk_x11_display_set_surface_scale (GdkDisplay *display, gint scale); GDK_AVAILABLE_IN_ALL diff --git a/gdk/x11/gdkx11window.h b/gdk/x11/gdkx11surface.h index a9c13189fc..85f46c120e 100644 --- a/gdk/x11/gdkx11window.h +++ b/gdk/x11/gdkx11surface.h @@ -22,8 +22,8 @@ * GTK+ at ftp://ftp.gtk.org/pub/gtk/. */ -#ifndef __GDK_X11_WINDOW_H__ -#define __GDK_X11_WINDOW_H__ +#ifndef __GDK_X11_SURFACE_H__ +#define __GDK_X11_SURFACE_H__ #if !defined (__GDKX_H_INSIDE__) && !defined (GDK_COMPILATION) #error "Only <gdk/gdkx.h> can be included directly." @@ -36,78 +36,78 @@ G_BEGIN_DECLS -#define GDK_TYPE_X11_WINDOW (gdk_x11_window_get_type ()) -#define GDK_X11_WINDOW(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_X11_WINDOW, GdkX11Window)) -#define GDK_X11_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_X11_WINDOW, GdkX11WindowClass)) -#define GDK_IS_X11_WINDOW(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_X11_WINDOW)) -#define GDK_IS_X11_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_X11_WINDOW)) -#define GDK_X11_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_X11_WINDOW, GdkX11WindowClass)) +#define GDK_TYPE_X11_SURFACE (gdk_x11_surface_get_type ()) +#define GDK_X11_SURFACE(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_X11_SURFACE, GdkX11Surface)) +#define GDK_X11_SURFACE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_X11_SURFACE, GdkX11SurfaceClass)) +#define GDK_IS_X11_SURFACE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_X11_SURFACE)) +#define GDK_IS_X11_SURFACE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_X11_SURFACE)) +#define GDK_X11_SURFACE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_X11_SURFACE, GdkX11SurfaceClass)) #ifdef GDK_COMPILATION -typedef struct _GdkX11Window GdkX11Window; +typedef struct _GdkX11Surface GdkX11Surface; #else -typedef GdkWindow GdkX11Window; +typedef GdkSurface GdkX11Surface; #endif -typedef struct _GdkX11WindowClass GdkX11WindowClass; +typedef struct _GdkX11SurfaceClass GdkX11SurfaceClass; GDK_AVAILABLE_IN_ALL -GType gdk_x11_window_get_type (void); +GType gdk_x11_surface_get_type (void); GDK_AVAILABLE_IN_ALL -Window gdk_x11_window_get_xid (GdkWindow *window); +Window gdk_x11_surface_get_xid (GdkSurface *surface); GDK_AVAILABLE_IN_ALL -void gdk_x11_window_set_user_time (GdkWindow *window, +void gdk_x11_surface_set_user_time (GdkSurface *surface, guint32 timestamp); GDK_AVAILABLE_IN_ALL -void gdk_x11_window_set_utf8_property (GdkWindow *window, +void gdk_x11_surface_set_utf8_property (GdkSurface *surface, const gchar *name, const gchar *value); GDK_AVAILABLE_IN_ALL -void gdk_x11_window_set_theme_variant (GdkWindow *window, +void gdk_x11_surface_set_theme_variant (GdkSurface *surface, const char *variant); GDK_AVAILABLE_IN_ALL -void gdk_x11_window_move_to_current_desktop (GdkWindow *window); +void gdk_x11_surface_move_to_current_desktop (GdkSurface *surface); GDK_AVAILABLE_IN_ALL -guint32 gdk_x11_window_get_desktop (GdkWindow *window); +guint32 gdk_x11_surface_get_desktop (GdkSurface *surface); GDK_AVAILABLE_IN_ALL -void gdk_x11_window_move_to_desktop (GdkWindow *window, +void gdk_x11_surface_move_to_desktop (GdkSurface *surface, guint32 desktop); GDK_AVAILABLE_IN_ALL -void gdk_x11_window_set_frame_sync_enabled (GdkWindow *window, +void gdk_x11_surface_set_frame_sync_enabled (GdkSurface *surface, gboolean frame_sync_enabled); /** - * GDK_WINDOW_XDISPLAY: - * @win: a #GdkWindow. + * GDK_SURFACE_XDISPLAY: + * @win: a #GdkSurface. * - * Returns the display of a #GdkWindow. + * Returns the display of a #GdkSurface. * * Returns: an Xlib Display*. */ -#define GDK_WINDOW_XDISPLAY(win) (GDK_DISPLAY_XDISPLAY (gdk_window_get_display (win))) +#define GDK_SURFACE_XDISPLAY(win) (GDK_DISPLAY_XDISPLAY (gdk_surface_get_display (win))) /** - * GDK_WINDOW_XID: - * @win: a #GdkWindow. + * GDK_SURFACE_XID: + * @win: a #GdkSurface. * - * Returns the X window belonging to a #GdkWindow. + * Returns the X window belonging to a #GdkSurface. * * Returns: the Xlib Window of @win. */ -#define GDK_WINDOW_XID(win) (gdk_x11_window_get_xid (win)) +#define GDK_SURFACE_XID(win) (gdk_x11_surface_get_xid (win)) GDK_AVAILABLE_IN_ALL -guint32 gdk_x11_get_server_time (GdkWindow *window); +guint32 gdk_x11_get_server_time (GdkSurface *surface); GDK_AVAILABLE_IN_ALL -GdkWindow *gdk_x11_window_foreign_new_for_display (GdkDisplay *display, +GdkSurface *gdk_x11_surface_foreign_new_for_display (GdkDisplay *display, Window window); GDK_AVAILABLE_IN_ALL -GdkWindow *gdk_x11_window_lookup_for_display (GdkDisplay *display, +GdkSurface *gdk_x11_surface_lookup_for_display (GdkDisplay *display, Window window); G_END_DECLS -#endif /* __GDK_X11_WINDOW_H__ */ +#endif /* __GDK_X11_SURFACE_H__ */ diff --git a/gdk/x11/gdkxid.c b/gdk/x11/gdkxid.c index d74b367b41..93ca3c12a3 100644 --- a/gdk/x11/gdkxid.c +++ b/gdk/x11/gdkxid.c @@ -44,7 +44,7 @@ gdk_xid_equal (XID *a, XID *b) void _gdk_x11_display_add_window (GdkDisplay *display, XID *xid, - GdkWindow *data) + GdkSurface *data) { GdkX11Display *display_x11; @@ -62,7 +62,7 @@ _gdk_x11_display_add_window (GdkDisplay *display, g_hash_table_insert (display_x11->xid_ht, xid, data); - if (gdk_window_get_parent (GDK_WINDOW (data)) == NULL) + if (gdk_surface_get_parent (GDK_SURFACE (data)) == NULL) display_x11->toplevels = g_list_prepend (display_x11->toplevels, data); } @@ -71,7 +71,7 @@ _gdk_x11_display_remove_window (GdkDisplay *display, XID xid) { GdkX11Display *display_x11; - GdkWindow *window; + GdkSurface *surface; g_return_if_fail (GDK_IS_DISPLAY (display)); @@ -80,30 +80,30 @@ _gdk_x11_display_remove_window (GdkDisplay *display, if (!display_x11->xid_ht) return; - window = g_hash_table_lookup (display_x11->xid_ht, &xid); - if (window && gdk_window_get_parent (window) == NULL) - display_x11->toplevels = g_list_remove (display_x11->toplevels, window); + surface = g_hash_table_lookup (display_x11->xid_ht, &xid); + if (surface && gdk_surface_get_parent (surface) == NULL) + display_x11->toplevels = g_list_remove (display_x11->toplevels, surface); g_hash_table_remove (display_x11->xid_ht, &xid); } /** - * gdk_x11_window_lookup_for_display: + * gdk_x11_surface_lookup_for_display: * @display: (type GdkX11Display): the #GdkDisplay corresponding to the * window handle * @window: an Xlib Window * - * Looks up the #GdkWindow that wraps the given native window handle. + * Looks up the #GdkSurface that wraps the given native window handle. * - * Returns: (transfer none) (type GdkX11Window): the #GdkWindow wrapper for the native + * Returns: (transfer none) (type GdkX11Surface): the #GdkSurface wrapper for the native * window, or %NULL if there is none. */ -GdkWindow * -gdk_x11_window_lookup_for_display (GdkDisplay *display, +GdkSurface * +gdk_x11_surface_lookup_for_display (GdkDisplay *display, Window window) { GdkX11Display *display_x11; - GdkWindow *data = NULL; + GdkSurface *data = NULL; g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL); diff --git a/gdk/x11/meson.build b/gdk/x11/meson.build index 53213818fb..3912031c18 100644 --- a/gdk/x11/meson.build +++ b/gdk/x11/meson.build @@ -26,7 +26,7 @@ gdk_x11_sources = files([ 'gdktextlistconverter-x11.c', 'gdkvisual-x11.c', 'gdkvulkancontext-x11.c', - 'gdkwindow-x11.c', + 'gdksurface-x11.c', 'gdkxftdefaults.c', 'gdkxid.c', 'xsettings-client.c', @@ -50,7 +50,7 @@ gdk_x11_public_headers = files([ 'gdkx11screen.h', 'gdkx11selection.h', 'gdkx11utils.h', - 'gdkx11window.h', + 'gdkx11surface.h', ]) install_headers(gdk_x11_public_headers, subdir: 'gtk-4.0/gdk/x11/') diff --git a/gdk/x11/xsettings-client.c b/gdk/x11/xsettings-client.c index 5713882320..247e90e9f7 100644 --- a/gdk/x11/xsettings-client.c +++ b/gdk/x11/xsettings-client.c @@ -28,7 +28,7 @@ #include <gdk/x11/gdkx11display.h> #include <gdk/x11/gdkx11property.h> #include <gdk/x11/gdkx11screen.h> -#include <gdk/x11/gdkx11window.h> +#include <gdk/x11/gdkx11surface.h> #include <gdk/x11/gdkprivate-x11.h> #include <gdk/x11/gdkdisplay-x11.h> #include <gdk/x11/gdkscreen-x11.h> @@ -445,7 +445,7 @@ read_settings (GdkX11Screen *x11_screen, /* Since we support scaling we look at the specific Gdk/UnscaledDPI setting if it exists and use that instead of Xft/DPI if it is set */ - if (x11_screen->xsettings && !x11_screen->fixed_window_scale) + if (x11_screen->xsettings && !x11_screen->fixed_surface_scale) { setting = g_hash_table_lookup (x11_screen->xsettings, "gdk-unscaled-dpi"); if (setting) @@ -465,9 +465,9 @@ read_settings (GdkX11Screen *x11_screen, g_value_init (&value, G_TYPE_INT); - if (!x11_screen->fixed_window_scale && + if (!x11_screen->fixed_surface_scale && gdk_display_get_setting (display, "gdk-window-scaling-factor", &value)) - _gdk_x11_screen_set_window_scale (x11_screen, g_value_get_int (&value)); + _gdk_x11_screen_set_surface_scale (x11_screen, g_value_get_int (&value)); } static Atom |