X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;f=gdk%2Fx11%2Fgdkwindow-x11.c;h=527da43f3c8c174b93a549b1a33d31ba8a5c9b4d;hb=dfe6ba932ca798c53121f90b7d696b5d2231a179;hp=2589fa6c54099446952f5b2123ac4891fcaec77b;hpb=fe6f76a5a2f33f9873b482c397b22a9ae5cda300;p=~andy%2Fgtk diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c index 2589fa6c5..527da43f3 100644 --- a/gdk/x11/gdkwindow-x11.c +++ b/gdk/x11/gdkwindow-x11.c @@ -35,6 +35,7 @@ #include "gdkasync.h" #include "gdkdisplay-x11.h" #include "gdkprivate-x11.h" +#include "gdkvisualprivate.h" #include "gdkinternals.h" #include "gdkdeviceprivate.h" #include "gdkeventsource.h" @@ -109,7 +110,6 @@ static void gdk_window_x11_set_background (GdkWindow *window, cairo_pattern_t *pattern); static void gdk_window_impl_x11_finalize (GObject *object); -static void gdk_window_impl_iface_init (GdkWindowImplIface *iface); #define WINDOW_IS_TOPLEVEL_OR_FOREIGN(window) \ (GDK_WINDOW_TYPE (window) != GDK_WINDOW_CHILD && \ @@ -128,17 +128,7 @@ static void gdk_window_impl_iface_init (GdkWindowImplIface *iface); (( time1 < time2 ) && ( time2 - time1 > ((guint32)-1)/2 )) \ ) -G_DEFINE_TYPE_WITH_CODE (GdkWindowImplX11, - gdk_window_impl_x11, - GDK_TYPE_DRAWABLE, - G_IMPLEMENT_INTERFACE (GDK_TYPE_WINDOW_IMPL, - gdk_window_impl_iface_init)); - -GType -_gdk_window_impl_get_type (void) -{ - return gdk_window_impl_x11_get_type (); -} +G_DEFINE_TYPE (GdkWindowImplX11, gdk_window_impl_x11, GDK_TYPE_WINDOW_IMPL) static void gdk_window_impl_x11_init (GdkWindowImplX11 *impl) @@ -151,7 +141,6 @@ gdk_window_impl_x11_init (GdkWindowImplX11 *impl) GdkToplevelX11 * _gdk_x11_window_get_toplevel (GdkWindow *window) { - GdkWindowObject *private; GdkWindowImplX11 *impl; g_return_val_if_fail (GDK_IS_WINDOW (window), NULL); @@ -159,8 +148,7 @@ _gdk_x11_window_get_toplevel (GdkWindow *window) if (!WINDOW_IS_TOPLEVEL (window)) return NULL; - private = (GdkWindowObject *)window; - impl = GDK_WINDOW_IMPL_X11 (private->impl); + impl = GDK_WINDOW_IMPL_X11 (window->impl); if (!impl->toplevel) impl->toplevel = g_new0 (GdkToplevelX11, 1); @@ -201,11 +189,10 @@ gdk_x11_cairo_surface_destroy (void *data) } static cairo_surface_t * -gdk_x11_create_cairo_surface (GdkDrawable *drawable, +gdk_x11_create_cairo_surface (GdkWindowImplX11 *impl, int width, int height) { - GdkWindowImplX11 *impl = GDK_WINDOW_IMPL_X11 (drawable); GdkVisual *visual; visual = gdk_window_get_visual (impl->wrapper); @@ -216,23 +203,22 @@ gdk_x11_create_cairo_surface (GdkDrawable *drawable, } static cairo_surface_t * -gdk_x11_ref_cairo_surface (GdkDrawable *drawable) +gdk_x11_ref_cairo_surface (GdkWindow *window) { - GdkWindowImplX11 *impl = GDK_WINDOW_IMPL_X11 (drawable); + GdkWindowImplX11 *impl = GDK_WINDOW_IMPL_X11 (window->impl); - if (GDK_IS_WINDOW_IMPL_X11 (drawable) && - GDK_WINDOW_DESTROYED (impl->wrapper)) + if (GDK_WINDOW_DESTROYED (window)) return NULL; if (!impl->cairo_surface) { - impl->cairo_surface = gdk_x11_create_cairo_surface (drawable, - gdk_window_get_width (impl->wrapper), - gdk_window_get_height (impl->wrapper)); + impl->cairo_surface = gdk_x11_create_cairo_surface (impl, + gdk_window_get_width (window), + gdk_window_get_height (window)); if (impl->cairo_surface) cairo_surface_set_user_data (impl->cairo_surface, &gdk_x11_cairo_key, - drawable, gdk_x11_cairo_surface_destroy); + impl, gdk_x11_cairo_surface_destroy); } else cairo_surface_reference (impl->cairo_surface); @@ -240,35 +226,23 @@ gdk_x11_ref_cairo_surface (GdkDrawable *drawable) return impl->cairo_surface; } -static void -gdk_window_impl_x11_class_init (GdkWindowImplX11Class *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - GdkDrawableClass *drawable_class = GDK_DRAWABLE_CLASS (klass); - - object_class->finalize = gdk_window_impl_x11_finalize; - - drawable_class->ref_cairo_surface = gdk_x11_ref_cairo_surface; - drawable_class->create_cairo_surface = gdk_x11_create_cairo_surface; -} - static void gdk_window_impl_x11_finalize (GObject *object) { - GdkWindowObject *wrapper; + GdkWindow *wrapper; GdkWindowImplX11 *impl; g_return_if_fail (GDK_IS_WINDOW_IMPL_X11 (object)); impl = GDK_WINDOW_IMPL_X11 (object); - wrapper = (GdkWindowObject*) impl->wrapper; + wrapper = impl->wrapper; - _gdk_xgrab_check_destroy (GDK_WINDOW (wrapper)); + _gdk_xgrab_check_destroy (wrapper); if (!GDK_WINDOW_DESTROYED (wrapper)) { - GdkDisplay *display = GDK_WINDOW_DISPLAY ((GdkWindow *) wrapper); + GdkDisplay *display = GDK_WINDOW_DISPLAY (wrapper); _gdk_xid_table_remove (display, impl->xid); if (impl->toplevel && impl->toplevel->focus_window) @@ -373,10 +347,8 @@ static void tmp_unset_bg (GdkWindow *window) { GdkWindowImplX11 *impl; - GdkWindowObject *obj; - obj = (GdkWindowObject *) window; - impl = GDK_WINDOW_IMPL_X11 (obj->impl); + impl = GDK_WINDOW_IMPL_X11 (window->impl); impl->no_bg = TRUE; @@ -388,14 +360,12 @@ static void tmp_reset_bg (GdkWindow *window) { GdkWindowImplX11 *impl; - GdkWindowObject *obj; - obj = (GdkWindowObject *) window; - impl = GDK_WINDOW_IMPL_X11 (obj->impl); + impl = GDK_WINDOW_IMPL_X11 (window->impl); impl->no_bg = FALSE; - gdk_window_x11_set_background (window, obj->background); + gdk_window_x11_set_background (window, window->background); } /* Unsetting and resetting window backgrounds. @@ -409,28 +379,24 @@ void _gdk_x11_window_tmp_unset_bg (GdkWindow *window, gboolean recurse) { - GdkWindowObject *private; - g_return_if_fail (GDK_IS_WINDOW (window)); - private = (GdkWindowObject *)window; - - if (private->input_only || private->destroyed || - (private->window_type != GDK_WINDOW_ROOT && + if (window->input_only || window->destroyed || + (window->window_type != GDK_WINDOW_ROOT && !GDK_WINDOW_IS_MAPPED (window))) return; if (_gdk_window_has_impl (window) && GDK_WINDOW_IS_X11 (window) && - private->window_type != GDK_WINDOW_ROOT && - private->window_type != GDK_WINDOW_FOREIGN) + window->window_type != GDK_WINDOW_ROOT && + window->window_type != GDK_WINDOW_FOREIGN) tmp_unset_bg (window); if (recurse) { GList *l; - for (l = private->children; l != NULL; l = l->next) + for (l = window->children; l != NULL; l = l->next) _gdk_x11_window_tmp_unset_bg (l->data, TRUE); } } @@ -438,13 +404,10 @@ _gdk_x11_window_tmp_unset_bg (GdkWindow *window, void _gdk_x11_window_tmp_unset_parent_bg (GdkWindow *window) { - GdkWindowObject *private; - private = (GdkWindowObject*) window; - - if (GDK_WINDOW_TYPE (private->parent) == GDK_WINDOW_ROOT) + if (GDK_WINDOW_TYPE (window->parent) == GDK_WINDOW_ROOT) return; - window = _gdk_window_get_impl_window ((GdkWindow *)private->parent); + window = _gdk_window_get_impl_window (window->parent); _gdk_x11_window_tmp_unset_bg (window, FALSE); } @@ -452,29 +415,25 @@ void _gdk_x11_window_tmp_reset_bg (GdkWindow *window, gboolean recurse) { - GdkWindowObject *private; - g_return_if_fail (GDK_IS_WINDOW (window)); - private = (GdkWindowObject *)window; - - if (private->input_only || private->destroyed || - (private->window_type != GDK_WINDOW_ROOT && + if (window->input_only || window->destroyed || + (window->window_type != GDK_WINDOW_ROOT && !GDK_WINDOW_IS_MAPPED (window))) return; if (_gdk_window_has_impl (window) && GDK_WINDOW_IS_X11 (window) && - private->window_type != GDK_WINDOW_ROOT && - private->window_type != GDK_WINDOW_FOREIGN) + window->window_type != GDK_WINDOW_ROOT && + window->window_type != GDK_WINDOW_FOREIGN) tmp_reset_bg (window); if (recurse) { GList *l; - for (l = private->children; l != NULL; l = l->next) + for (l = window->children; l != NULL; l = l->next) _gdk_x11_window_tmp_reset_bg (l->data, TRUE); } } @@ -482,13 +441,10 @@ _gdk_x11_window_tmp_reset_bg (GdkWindow *window, void _gdk_x11_window_tmp_reset_parent_bg (GdkWindow *window) { - GdkWindowObject *private; - private = (GdkWindowObject*) window; - - if (GDK_WINDOW_TYPE (private->parent) == GDK_WINDOW_ROOT) + if (GDK_WINDOW_TYPE (window->parent) == GDK_WINDOW_ROOT) return; - window = _gdk_window_get_impl_window ((GdkWindow *)private->parent); + window = _gdk_window_get_impl_window (window->parent); _gdk_x11_window_tmp_reset_bg (window, FALSE); } @@ -496,7 +452,7 @@ _gdk_x11_window_tmp_reset_parent_bg (GdkWindow *window) void _gdk_windowing_window_init (GdkScreen * screen) { - GdkWindowObject *private; + GdkWindow *window; GdkWindowImplX11 *impl; GdkScreenX11 *screen_x11; @@ -504,31 +460,30 @@ _gdk_windowing_window_init (GdkScreen * screen) g_assert (screen_x11->root_window == NULL); - screen_x11->root_window = g_object_new (GDK_TYPE_WINDOW, NULL); + window = screen_x11->root_window = g_object_new (GDK_TYPE_WINDOW, NULL); - private = (GdkWindowObject *) screen_x11->root_window; - private->impl = g_object_new (_gdk_window_impl_get_type (), NULL); - private->impl_window = private; - private->visual = gdk_screen_get_system_visual (screen); + window->impl = g_object_new (GDK_TYPE_WINDOW_IMPL_X11, NULL); + window->impl_window = window; + window->visual = gdk_screen_get_system_visual (screen); - impl = GDK_WINDOW_IMPL_X11 (private->impl); + impl = GDK_WINDOW_IMPL_X11 (window->impl); impl->xid = screen_x11->xroot_window; - impl->wrapper = GDK_WINDOW (private); + impl->wrapper = window; - private->window_type = GDK_WINDOW_ROOT; - private->depth = DefaultDepthOfScreen (screen_x11->xscreen); + window->window_type = GDK_WINDOW_ROOT; + window->depth = DefaultDepthOfScreen (screen_x11->xscreen); - private->x = 0; - private->y = 0; - private->abs_x = 0; - private->abs_y = 0; - private->width = WidthOfScreen (screen_x11->xscreen); - private->height = HeightOfScreen (screen_x11->xscreen); - private->viewable = TRUE; + window->x = 0; + window->y = 0; + window->abs_x = 0; + window->abs_y = 0; + window->width = WidthOfScreen (screen_x11->xscreen); + window->height = HeightOfScreen (screen_x11->xscreen); + window->viewable = TRUE; /* see init_randr_support() in gdkscreen-x11.c */ - private->event_mask = GDK_STRUCTURE_MASK; + window->event_mask = GDK_STRUCTURE_MASK; _gdk_window_update_size (screen_x11->root_window); @@ -624,8 +579,7 @@ ensure_sync_counter (GdkWindow *window) { GdkDisplay *display = GDK_WINDOW_DISPLAY (window); GdkToplevelX11 *toplevel = _gdk_x11_window_get_toplevel (window); - GdkWindowObject *private = (GdkWindowObject *)window; - GdkWindowImplX11 *impl = GDK_WINDOW_IMPL_X11 (private->impl); + GdkWindowImplX11 *impl = GDK_WINDOW_IMPL_X11 (window->impl); if (toplevel && impl->use_synchronized_configure && toplevel->update_counter == None && @@ -657,7 +611,6 @@ static void setup_toplevel_window (GdkWindow *window, GdkWindow *parent) { - GdkWindowObject *obj = (GdkWindowObject *)window; GdkToplevelX11 *toplevel = _gdk_x11_window_get_toplevel (window); GdkDisplay *display = gdk_window_get_display (window); Display *xdisplay = GDK_WINDOW_XDISPLAY (window); @@ -669,7 +622,7 @@ setup_toplevel_window (GdkWindow *window, set_wm_protocols (window); - if (!obj->input_only) + if (!window->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. @@ -685,8 +638,8 @@ setup_toplevel_window (GdkWindow *window, * correct value??? */ size_hints.flags = PSize; - size_hints.width = obj->width; - size_hints.height = obj->height; + size_hints.width = window->width; + size_hints.height = window->height; XSetWMNormalHints (xdisplay, xid, &size_hints); @@ -714,7 +667,7 @@ setup_toplevel_window (GdkWindow *window, XA_WINDOW, 32, PropModeReplace, (guchar *) &toplevel->focus_window, 1); - if (!obj->focus_on_map) + if (!window->focus_on_map) gdk_x11_window_set_user_time (window, 0); else if (GDK_DISPLAY_X11 (screen_x11->display)->user_time != 0) gdk_x11_window_set_user_time (window, GDK_DISPLAY_X11 (screen_x11->display)->user_time); @@ -730,7 +683,6 @@ _gdk_window_impl_new (GdkWindow *window, GdkWindowAttr *attributes, gint attributes_mask) { - GdkWindowObject *private; GdkWindowImplX11 *impl; GdkScreenX11 *screen_x11; GdkDisplayX11 *display_x11; @@ -746,21 +698,19 @@ _gdk_window_impl_new (GdkWindow *window, unsigned int class; const char *title; - private = (GdkWindowObject *) window; - screen_x11 = GDK_SCREEN_X11 (screen); xparent = GDK_WINDOW_XID (real_parent); display_x11 = GDK_DISPLAY_X11 (GDK_SCREEN_DISPLAY (screen)); - impl = g_object_new (_gdk_window_impl_get_type (), NULL); - private->impl = (GdkDrawable *)impl; + impl = g_object_new (GDK_TYPE_WINDOW_IMPL_X11, NULL); + window->impl = GDK_WINDOW_IMPL (impl); impl->wrapper = GDK_WINDOW (window); xdisplay = screen_x11->xdisplay; xattributes_mask = 0; - xvisual = gdk_x11_visual_get_xvisual (private->visual); + xvisual = gdk_x11_visual_get_xvisual (window->visual); if (attributes_mask & GDK_WA_NOREDIR) { @@ -773,25 +723,25 @@ _gdk_window_impl_new (GdkWindow *window, impl->override_redirect = xattributes.override_redirect; - if (private->parent && private->parent->guffaw_gravity) + if (window->parent && window->parent->guffaw_gravity) { xattributes.win_gravity = StaticGravity; xattributes_mask |= CWWinGravity; } /* Sanity checks */ - switch (private->window_type) + switch (window->window_type) { case GDK_WINDOW_TOPLEVEL: case GDK_WINDOW_TEMP: - if (GDK_WINDOW_TYPE (private->parent) != GDK_WINDOW_ROOT) + if (GDK_WINDOW_TYPE (window->parent) != GDK_WINDOW_ROOT) { /* The common code warns for this case */ xparent = GDK_SCREEN_XROOTWIN (screen); } } - if (!private->input_only) + if (!window->input_only) { class = InputOutput; @@ -800,17 +750,17 @@ _gdk_window_impl_new (GdkWindow *window, xattributes.border_pixel = BlackPixel (xdisplay, screen_x11->screen_num); xattributes_mask |= CWBorderPixel | CWBackPixel; - if (private->guffaw_gravity) + if (window->guffaw_gravity) xattributes.bit_gravity = StaticGravity; else xattributes.bit_gravity = NorthWestGravity; xattributes_mask |= CWBitGravity; - xattributes.colormap = _gdk_visual_get_x11_colormap (private->visual); + xattributes.colormap = _gdk_visual_get_x11_colormap (window->visual); xattributes_mask |= CWColormap; - if (private->window_type == GDK_WINDOW_TEMP) + if (window->window_type == GDK_WINDOW_TEMP) { xattributes.save_under = True; xattributes.override_redirect = True; @@ -825,28 +775,28 @@ _gdk_window_impl_new (GdkWindow *window, class = InputOnly; } - if (private->width > 65535 || - private->height > 65535) + if (window->width > 65535 || + window->height > 65535) { g_warning ("Native Windows wider or taller than 65535 pixels are not supported"); - if (private->width > 65535) - private->width = 65535; - if (private->height > 65535) - private->height = 65535; + if (window->width > 65535) + window->width = 65535; + if (window->height > 65535) + window->height = 65535; } impl->xid = XCreateWindow (xdisplay, xparent, - private->x + private->parent->abs_x, - private->y + private->parent->abs_y, - private->width, private->height, - 0, private->depth, class, xvisual, + window->x + window->parent->abs_x, + window->y + window->parent->abs_y, + window->width, window->height, + 0, window->depth, class, xvisual, xattributes_mask, &xattributes); g_object_ref (window); _gdk_xid_table_insert (screen_x11->display, &impl->xid, window); - switch (GDK_WINDOW_TYPE (private)) + switch (GDK_WINDOW_TYPE (window)) { case GDK_WINDOW_TOPLEVEL: case GDK_WINDOW_TEMP: @@ -866,7 +816,7 @@ _gdk_window_impl_new (GdkWindow *window, XFree (class_hint); } - setup_toplevel_window (window, (GdkWindow *)private->parent); + setup_toplevel_window (window, window->parent); break; case GDK_WINDOW_CHILD: @@ -878,7 +828,7 @@ _gdk_window_impl_new (GdkWindow *window, gdk_window_set_type_hint (window, attributes->type_hint); gdk_event_source_select_events ((GdkEventSource *) display_x11->event_source, - GDK_WINDOW_XWINDOW (window), event_mask, + GDK_WINDOW_XID (window), event_mask, StructureNotifyMask | PropertyChangeMask); } @@ -922,7 +872,6 @@ gdk_window_foreign_new_for_display (GdkDisplay *display, { GdkScreen *screen; GdkWindow *window; - GdkWindowObject *private; GdkWindowImplX11 *impl; GdkDisplayX11 *display_x11; XWindowAttributes attrs; @@ -957,40 +906,39 @@ gdk_window_foreign_new_for_display (GdkDisplay *display, window = g_object_new (GDK_TYPE_WINDOW, NULL); - private = (GdkWindowObject *) window; - private->impl = g_object_new (_gdk_window_impl_get_type (), NULL); - private->impl_window = private; - private->visual = gdk_x11_screen_lookup_visual (screen, + window->impl = g_object_new (GDK_TYPE_WINDOW_IMPL_X11, NULL); + window->impl_window = window; + window->visual = gdk_x11_screen_lookup_visual (screen, XVisualIDFromVisual (attrs.visual)); - impl = GDK_WINDOW_IMPL_X11 (private->impl); + impl = GDK_WINDOW_IMPL_X11 (window->impl); impl->wrapper = window; - private->parent = gdk_xid_table_lookup_for_display (display, parent); + window->parent = gdk_xid_table_lookup_for_display (display, parent); - if (!private->parent || GDK_WINDOW_TYPE (private->parent) == GDK_WINDOW_FOREIGN) - private->parent = (GdkWindowObject *) gdk_screen_get_root_window (screen); + if (!window->parent || GDK_WINDOW_TYPE (window->parent) == GDK_WINDOW_FOREIGN) + window->parent = gdk_screen_get_root_window (screen); - private->parent->children = g_list_prepend (private->parent->children, window); + window->parent->children = g_list_prepend (window->parent->children, window); impl->xid = anid; - private->x = attrs.x; - private->y = attrs.y; - private->width = attrs.width; - private->height = attrs.height; - private->window_type = GDK_WINDOW_FOREIGN; - private->destroyed = FALSE; + window->x = attrs.x; + window->y = attrs.y; + window->width = attrs.width; + window->height = attrs.height; + window->window_type = GDK_WINDOW_FOREIGN; + window->destroyed = FALSE; - private->event_mask = x_event_mask_to_gdk_event_mask (attrs.your_event_mask); + window->event_mask = x_event_mask_to_gdk_event_mask (attrs.your_event_mask); if (attrs.map_state == IsUnmapped) - private->state = GDK_WINDOW_STATE_WITHDRAWN; + window->state = GDK_WINDOW_STATE_WITHDRAWN; else - private->state = 0; - private->viewable = TRUE; + window->state = 0; + window->viewable = TRUE; - private->depth = attrs.depth; + window->depth = attrs.depth; g_object_ref (window); _gdk_xid_table_insert (display, &GDK_WINDOW_XID (window), window); @@ -1022,24 +970,6 @@ gdk_window_lookup_for_display (GdkDisplay *display, GdkNativeWindow anid) return (GdkWindow*) gdk_xid_table_lookup_for_display (display, anid); } -/** - * gdk_window_lookup: - * @anid: a native window handle. - * - * Looks up the #GdkWindow that wraps the given native window handle. - * - * For example in the X backend, a native window handle is an Xlib - * XID. - * - * Return value: (transfer none): the #GdkWindow wrapper for the native - * window, or %NULL if there is none. - **/ -GdkWindow * -gdk_window_lookup (GdkNativeWindow anid) -{ - return (GdkWindow*) gdk_xid_table_lookup (anid); -} - static void gdk_toplevel_x11_free_contents (GdkDisplay *display, GdkToplevelX11 *toplevel) @@ -1072,12 +1002,11 @@ gdk_toplevel_x11_free_contents (GdkDisplay *display, } static void -_gdk_x11_window_destroy (GdkWindow *window, - gboolean recursing, - gboolean foreign_destroy) +gdk_x11_window_destroy (GdkWindow *window, + gboolean recursing, + gboolean foreign_destroy) { - GdkWindowObject *private = (GdkWindowObject *)window; - GdkWindowImplX11 *impl = GDK_WINDOW_IMPL_X11 (private->impl); + GdkWindowImplX11 *impl = GDK_WINDOW_IMPL_X11 (window->impl); GdkToplevelX11 *toplevel; g_return_if_fail (GDK_IS_WINDOW (window)); @@ -1112,8 +1041,8 @@ gdk_window_x11_resize_cairo_surface (GdkWindow *window, return surface; } -void -_gdk_windowing_window_destroy_foreign (GdkWindow *window) +static void +gdk_x11_window_destroy_foreign (GdkWindow *window) { /* It's somebody else's window, but in our hierarchy, * so reparent it to the root window, and then send @@ -1154,12 +1083,12 @@ get_root (GdkWindow *window) /* This function is called when the XWindow is really gone. */ -void -gdk_window_destroy_notify (GdkWindow *window) +static void +gdk_x11_window_destroy_notify (GdkWindow *window) { GdkWindowImplX11 *window_impl; - window_impl = GDK_WINDOW_IMPL_X11 (((GdkWindowObject *)window)->impl); + window_impl = GDK_WINDOW_IMPL_X11 ((window)->impl); if (!GDK_WINDOW_DESTROYED (window)) { @@ -1183,20 +1112,19 @@ update_wm_hints (GdkWindow *window, gboolean force) { GdkToplevelX11 *toplevel = _gdk_x11_window_get_toplevel (window); - GdkWindowObject *private = (GdkWindowObject *)window; GdkDisplay *display = GDK_WINDOW_DISPLAY (window); XWMHints wm_hints; if (!force && !toplevel->is_leader && - private->state & GDK_WINDOW_STATE_WITHDRAWN) + window->state & GDK_WINDOW_STATE_WITHDRAWN) return; wm_hints.flags = StateHint | InputHint; - wm_hints.input = private->accept_focus ? True : False; + wm_hints.input = window->accept_focus ? True : False; wm_hints.initial_state = NormalState; - if (private->state & GDK_WINDOW_STATE_ICONIFIED) + if (window->state & GDK_WINDOW_STATE_ICONIFIED) { wm_hints.flags |= StateHint; wm_hints.initial_state = IconicState; @@ -1237,12 +1165,10 @@ set_initial_hints (GdkWindow *window) GdkDisplay *display = GDK_WINDOW_DISPLAY (window); Display *xdisplay = GDK_DISPLAY_XDISPLAY (display); Window xwindow = GDK_WINDOW_XID (window); - GdkWindowObject *private; GdkToplevelX11 *toplevel; Atom atoms[9]; gint i; - private = (GdkWindowObject*) window; toplevel = _gdk_x11_window_get_toplevel (window); if (!toplevel) @@ -1257,7 +1183,7 @@ set_initial_hints (GdkWindow *window) i = 0; - if (private->state & GDK_WINDOW_STATE_MAXIMIZED) + if (window->state & GDK_WINDOW_STATE_MAXIMIZED) { atoms[i] = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_STATE_MAXIMIZED_VERT"); @@ -1268,21 +1194,21 @@ set_initial_hints (GdkWindow *window) toplevel->have_maxhorz = toplevel->have_maxvert = TRUE; } - if (private->state & GDK_WINDOW_STATE_ABOVE) + if (window->state & GDK_WINDOW_STATE_ABOVE) { atoms[i] = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_STATE_ABOVE"); ++i; } - if (private->state & GDK_WINDOW_STATE_BELOW) + if (window->state & GDK_WINDOW_STATE_BELOW) { atoms[i] = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_STATE_BELOW"); ++i; } - if (private->state & GDK_WINDOW_STATE_STICKY) + if (window->state & GDK_WINDOW_STATE_STICKY) { atoms[i] = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_STATE_STICKY"); @@ -1290,7 +1216,7 @@ set_initial_hints (GdkWindow *window) toplevel->have_sticky = TRUE; } - if (private->state & GDK_WINDOW_STATE_FULLSCREEN) + if (window->state & GDK_WINDOW_STATE_FULLSCREEN) { atoms[i] = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_STATE_FULLSCREEN"); @@ -1298,7 +1224,7 @@ set_initial_hints (GdkWindow *window) toplevel->have_fullscreen = TRUE; } - if (private->modal_hint) + if (window->modal_hint) { atoms[i] = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_STATE_MODAL"); @@ -1334,7 +1260,7 @@ set_initial_hints (GdkWindow *window) gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_STATE")); } - if (private->state & GDK_WINDOW_STATE_STICKY) + if (window->state & GDK_WINDOW_STATE_STICKY) { atoms[0] = 0xFFFFFFFF; XChangeProperty (xdisplay, @@ -1357,11 +1283,10 @@ set_initial_hints (GdkWindow *window) static void gdk_window_x11_show (GdkWindow *window, gboolean already_mapped) { - GdkWindowObject *private = (GdkWindowObject*) window; GdkDisplay *display; GdkDisplayX11 *display_x11; GdkToplevelX11 *toplevel; - GdkWindowImplX11 *impl = GDK_WINDOW_IMPL_X11 (private->impl); + GdkWindowImplX11 *impl = GDK_WINDOW_IMPL_X11 (window->impl); Display *xdisplay = GDK_WINDOW_XDISPLAY (window); Window xwindow = GDK_WINDOW_XID (window); gboolean unset_bg; @@ -1381,8 +1306,8 @@ gdk_window_x11_show (GdkWindow *window, gboolean already_mapped) gdk_x11_window_set_user_time (window, display_x11->user_time); } - unset_bg = !private->input_only && - (private->window_type == GDK_WINDOW_CHILD || + unset_bg = !window->input_only && + (window->window_type == GDK_WINDOW_CHILD || impl->override_redirect) && gdk_window_is_viewable (window); @@ -1399,14 +1324,13 @@ static void pre_unmap (GdkWindow *window) { GdkWindow *start_window = NULL; - GdkWindowObject *private = (GdkWindowObject *)window; - if (private->input_only) + if (window->input_only) return; - if (private->window_type == GDK_WINDOW_CHILD) - start_window = _gdk_window_get_impl_window ((GdkWindow *)private->parent); - else if (private->window_type == GDK_WINDOW_TEMP) + if (window->window_type == GDK_WINDOW_CHILD) + start_window = _gdk_window_get_impl_window ((GdkWindow *)window->parent); + else if (window->window_type == GDK_WINDOW_TEMP) start_window = get_root (window); if (start_window) @@ -1417,28 +1341,27 @@ static void post_unmap (GdkWindow *window) { GdkWindow *start_window = NULL; - GdkWindowObject *private = (GdkWindowObject *)window; - if (private->input_only) + if (window->input_only) return; - if (private->window_type == GDK_WINDOW_CHILD) - start_window = _gdk_window_get_impl_window ((GdkWindow *)private->parent); - else if (private->window_type == GDK_WINDOW_TEMP) + if (window->window_type == GDK_WINDOW_CHILD) + start_window = _gdk_window_get_impl_window ((GdkWindow *)window->parent); + else if (window->window_type == GDK_WINDOW_TEMP) start_window = get_root (window); if (start_window) { _gdk_x11_window_tmp_reset_bg (start_window, TRUE); - if (private->window_type == GDK_WINDOW_CHILD && private->parent) + if (window->window_type == GDK_WINDOW_CHILD && window->parent) { GdkRectangle invalid_rect; gdk_window_get_position (window, &invalid_rect.x, &invalid_rect.y); invalid_rect.width = gdk_window_get_width (window); invalid_rect.height = gdk_window_get_height (window); - gdk_window_invalidate_rect ((GdkWindow *)private->parent, + gdk_window_invalidate_rect ((GdkWindow *)window->parent, &invalid_rect, TRUE); } } @@ -1447,10 +1370,6 @@ post_unmap (GdkWindow *window) static void gdk_window_x11_hide (GdkWindow *window) { - GdkWindowObject *private; - - private = (GdkWindowObject*) window; - /* 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. @@ -1459,7 +1378,7 @@ gdk_window_x11_hide (GdkWindow *window) NextRequest (GDK_WINDOW_XDISPLAY (window))); /* You can't simply unmap toplevel windows. */ - switch (private->window_type) + switch (window->window_type) { case GDK_WINDOW_TOPLEVEL: case GDK_WINDOW_TEMP: /* ? */ @@ -1483,10 +1402,7 @@ gdk_window_x11_hide (GdkWindow *window) static void gdk_window_x11_withdraw (GdkWindow *window) { - GdkWindowObject *private; - - private = (GdkWindowObject*) window; - if (!private->destroyed) + if (!window->destroyed) { if (GDK_WINDOW_IS_MAPPED (window)) gdk_synthesize_window_state (window, @@ -1509,14 +1425,13 @@ window_x11_move (GdkWindow *window, gint x, gint y) { - GdkWindowObject *private = (GdkWindowObject *) window; - GdkWindowImplX11 *impl = GDK_WINDOW_IMPL_X11 (private->impl); + GdkWindowImplX11 *impl = GDK_WINDOW_IMPL_X11 (window->impl); - if (GDK_WINDOW_TYPE (private) == GDK_WINDOW_CHILD) + if (GDK_WINDOW_TYPE (window) == GDK_WINDOW_CHILD) { _gdk_window_move_resize_child (window, x, y, - private->width, private->height); + window->width, window->height); } else { @@ -1526,8 +1441,8 @@ window_x11_move (GdkWindow *window, if (impl->override_redirect) { - private->x = x; - private->y = y; + window->x = x; + window->y = y; } } } @@ -1537,23 +1452,21 @@ window_x11_resize (GdkWindow *window, gint width, gint height) { - GdkWindowObject *private = (GdkWindowObject *) window; - if (width < 1) width = 1; if (height < 1) height = 1; - if (GDK_WINDOW_TYPE (private) == GDK_WINDOW_CHILD) + if (GDK_WINDOW_TYPE (window) == GDK_WINDOW_CHILD) { _gdk_window_move_resize_child (window, - private->x, private->y, + window->x, window->y, width, height); } else { - GdkWindowImplX11 *impl = GDK_WINDOW_IMPL_X11 (private->impl); + GdkWindowImplX11 *impl = GDK_WINDOW_IMPL_X11 (window->impl); XResizeWindow (GDK_WINDOW_XDISPLAY (window), GDK_WINDOW_XID (window), @@ -1561,18 +1474,18 @@ window_x11_resize (GdkWindow *window, if (impl->override_redirect) { - private->width = width; - private->height = height; - _gdk_x11_window_update_size (GDK_WINDOW_IMPL_X11 (private->impl)); + window->width = width; + window->height = height; + _gdk_x11_window_update_size (GDK_WINDOW_IMPL_X11 (window->impl)); } else { - if (width != private->width || height != private->height) - private->resize_count += 1; + if (width != window->width || height != window->height) + window->resize_count += 1; } } - _gdk_x11_window_update_size (GDK_WINDOW_IMPL_X11 (private->impl)); + _gdk_x11_window_update_size (GDK_WINDOW_IMPL_X11 (window->impl)); } static inline void @@ -1582,22 +1495,20 @@ window_x11_move_resize (GdkWindow *window, gint width, gint height) { - GdkWindowObject *private = (GdkWindowObject *) window;; - if (width < 1) width = 1; if (height < 1) height = 1; - if (GDK_WINDOW_TYPE (private) == GDK_WINDOW_CHILD) + if (GDK_WINDOW_TYPE (window) == GDK_WINDOW_CHILD) { _gdk_window_move_resize_child (window, x, y, width, height); - _gdk_x11_window_update_size (GDK_WINDOW_IMPL_X11 (private->impl)); + _gdk_x11_window_update_size (GDK_WINDOW_IMPL_X11 (window->impl)); } else { - GdkWindowImplX11 *impl = GDK_WINDOW_IMPL_X11 (private->impl); + GdkWindowImplX11 *impl = GDK_WINDOW_IMPL_X11 (window->impl); XMoveResizeWindow (GDK_WINDOW_XDISPLAY (window), GDK_WINDOW_XID (window), @@ -1605,18 +1516,18 @@ window_x11_move_resize (GdkWindow *window, if (impl->override_redirect) { - private->x = x; - private->y = y; + window->x = x; + window->y = y; - private->width = width; - private->height = height; + window->width = width; + window->height = height; - _gdk_x11_window_update_size (GDK_WINDOW_IMPL_X11 (private->impl)); + _gdk_x11_window_update_size (GDK_WINDOW_IMPL_X11 (window->impl)); } else { - if (width != private->width || height != private->height) - private->resize_count += 1; + if (width != window->width || height != window->height) + window->resize_count += 1; } } } @@ -1646,27 +1557,23 @@ gdk_window_x11_reparent (GdkWindow *window, gint x, gint y) { - GdkWindowObject *window_private; - GdkWindowObject *parent_private; GdkWindowImplX11 *impl; - window_private = (GdkWindowObject*) window; - parent_private = (GdkWindowObject*) new_parent; - impl = GDK_WINDOW_IMPL_X11 (window_private->impl); + impl = GDK_WINDOW_IMPL_X11 (window->impl); _gdk_x11_window_tmp_unset_bg (window, TRUE); _gdk_x11_window_tmp_unset_parent_bg (window); XReparentWindow (GDK_WINDOW_XDISPLAY (window), GDK_WINDOW_XID (window), GDK_WINDOW_XID (new_parent), - parent_private->abs_x + x, parent_private->abs_y + y); + new_parent->abs_x + x, new_parent->abs_y + y); _gdk_x11_window_tmp_reset_parent_bg (window); _gdk_x11_window_tmp_reset_bg (window, TRUE); if (GDK_WINDOW_TYPE (new_parent) == GDK_WINDOW_FOREIGN) new_parent = gdk_screen_get_root_window (GDK_WINDOW_SCREEN (window)); - window_private->parent = parent_private; + window->parent = new_parent; /* Switch the window type as appropriate */ @@ -1681,8 +1588,8 @@ gdk_window_x11_reparent (GdkWindow *window, { /* This is also done in common code at a later stage, but we need it in setup_toplevel, so do it here too */ - if (window_private->toplevel_window_type != -1) - GDK_WINDOW_TYPE (window) = window_private->toplevel_window_type; + if (window->toplevel_window_type != -1) + GDK_WINDOW_TYPE (window) = window->toplevel_window_type; else if (GDK_WINDOW_TYPE (window) == GDK_WINDOW_CHILD) GDK_WINDOW_TYPE (window) = GDK_WINDOW_TOPLEVEL; @@ -1826,7 +1733,7 @@ move_to_current_desktop (GdkWindow *window) xclient.type = ClientMessage; xclient.serial = 0; xclient.send_event = True; - xclient.window = GDK_WINDOW_XWINDOW (window); + xclient.window = GDK_WINDOW_XID (window); xclient.message_type = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_DESKTOP"); xclient.format = 32; @@ -1847,18 +1754,9 @@ move_to_current_desktop (GdkWindow *window) } } -/** - * gdk_window_focus: - * @window: a #GdkWindow - * @timestamp: timestamp of the event triggering the window focus - * - * Sets keyboard focus to @window. In most cases, gtk_window_present() - * should be used on a #GtkWindow, rather than calling this function. - * - **/ -void -gdk_window_focus (GdkWindow *window, - guint32 timestamp) +static void +gdk_x11_window_focus (GdkWindow *window, + guint32 timestamp) { GdkDisplay *display; @@ -1877,7 +1775,7 @@ gdk_window_focus (GdkWindow *window, memset (&xclient, 0, sizeof (xclient)); xclient.type = ClientMessage; - xclient.window = GDK_WINDOW_XWINDOW (window); + xclient.window = GDK_WINDOW_XID (window); xclient.message_type = gdk_x11_get_xatom_by_name_for_display (display, "_NET_ACTIVE_WINDOW"); xclient.format = 32; @@ -1904,21 +1802,9 @@ gdk_window_focus (GdkWindow *window, } } -/** - * gdk_window_set_type_hint: - * @window: A toplevel #GdkWindow - * @hint: A hint of the function this window will have - * - * The application can use this call to provide a hint to the window - * manager about the functionality of a window. The window manager - * can use this information when determining the decoration and behaviour - * of the window. - * - * The hint must be set before the window is mapped. - **/ -void -gdk_window_set_type_hint (GdkWindow *window, - GdkWindowTypeHint hint) +static void +gdk_x11_window_set_type_hint (GdkWindow *window, + GdkWindowTypeHint hint) { GdkDisplay *display; Atom atom; @@ -1984,18 +1870,8 @@ gdk_window_set_type_hint (GdkWindow *window, (guchar *)&atom, 1); } -/** - * gdk_window_get_type_hint: - * @window: A toplevel #GdkWindow - * - * This function returns the type hint set for a window. - * - * Return value: The type hint set for @window - * - * Since: 2.10 - **/ -GdkWindowTypeHint -gdk_window_get_type_hint (GdkWindow *window) +static GdkWindowTypeHint +gdk_x11_window_get_type_hint (GdkWindow *window) { GdkDisplay *display; GdkWindowTypeHint type; @@ -2090,32 +1966,15 @@ gdk_wmspec_change_state (gboolean add, (XEvent *)&xclient); } -/** - * gdk_window_set_modal_hint: - * @window: A toplevel #GdkWindow - * @modal: %TRUE if the window is modal, %FALSE otherwise. - * - * The application can use this hint to tell the window manager - * that a certain window has modal behaviour. The window manager - * can use this information to handle modal windows in a special - * way. - * - * You should only use this on windows for which you have - * previously called gdk_window_set_transient_for() - **/ -void -gdk_window_set_modal_hint (GdkWindow *window, - gboolean modal) +static void +gdk_x11_window_set_modal_hint (GdkWindow *window, + gboolean modal) { - GdkWindowObject *private; - if (GDK_WINDOW_DESTROYED (window) || !WINDOW_IS_TOPLEVEL_OR_FOREIGN (window)) return; - private = (GdkWindowObject*) window; - - private->modal_hint = modal; + window->modal_hint = modal; if (GDK_WINDOW_IS_MAPPED (window)) gdk_wmspec_change_state (modal, window, @@ -2123,23 +1982,9 @@ gdk_window_set_modal_hint (GdkWindow *window, GDK_NONE); } -/** - * gdk_window_set_skip_taskbar_hint: - * @window: a toplevel #GdkWindow - * @skips_taskbar: %TRUE to skip the taskbar - * - * Toggles whether a window should appear in a task list or window - * list. If a window's semantic type as specified with - * gdk_window_set_type_hint() already fully describes the window, this - * function should not be called in addition, - * instead you should allow the window to be treated according to - * standard policy for its semantic type. - * - * Since: 2.2 - **/ -void -gdk_window_set_skip_taskbar_hint (GdkWindow *window, - gboolean skips_taskbar) +static void +gdk_x11_window_set_skip_taskbar_hint (GdkWindow *window, + gboolean skips_taskbar) { GdkToplevelX11 *toplevel; @@ -2158,25 +2003,9 @@ gdk_window_set_skip_taskbar_hint (GdkWindow *window, GDK_NONE); } -/** - * gdk_window_set_skip_pager_hint: - * @window: a toplevel #GdkWindow - * @skips_pager: %TRUE to skip the pager - * - * Toggles whether a window should appear in a pager (workspace - * switcher, or other desktop utility program that displays a small - * thumbnail representation of the windows on the desktop). If a - * window's semantic type as specified with gdk_window_set_type_hint() - * already fully describes the window, this function should - * not be called in addition, instead you should - * allow the window to be treated according to standard policy for - * its semantic type. - * - * Since: 2.2 - **/ -void -gdk_window_set_skip_pager_hint (GdkWindow *window, - gboolean skips_pager) +static void +gdk_x11_window_set_skip_pager_hint (GdkWindow *window, + gboolean skips_pager) { GdkToplevelX11 *toplevel; @@ -2195,18 +2024,8 @@ gdk_window_set_skip_pager_hint (GdkWindow *window, GDK_NONE); } -/** - * gdk_window_set_urgency_hint: - * @window: a toplevel #GdkWindow - * @urgent: %TRUE if the window is urgent - * - * Toggles whether a window needs the user's - * urgent attention. - * - * Since: 2.8 - **/ -void -gdk_window_set_urgency_hint (GdkWindow *window, +static void +gdk_x11_window_set_urgency_hint (GdkWindow *window, gboolean urgent) { GdkToplevelX11 *toplevel; @@ -2223,39 +2042,10 @@ gdk_window_set_urgency_hint (GdkWindow *window, update_wm_hints (window, FALSE); } -/** - * gdk_window_set_geometry_hints: - * @window: a toplevel #GdkWindow - * @geometry: geometry hints - * @geom_mask: bitmask indicating fields of @geometry to pay attention to - * - * Sets the geometry hints for @window. Hints flagged in @geom_mask - * are set, hints not flagged in @geom_mask are unset. - * To unset all hints, use a @geom_mask of 0 and a @geometry of %NULL. - * - * This function provides hints to the windowing system about - * acceptable sizes for a toplevel window. The purpose of - * this is to constrain user resizing, but the windowing system - * will typically (but is not required to) also constrain the - * current size of the window to the provided values and - * constrain programatic resizing via gdk_window_resize() or - * gdk_window_move_resize(). - * - * Note that on X11, this effect has no effect on windows - * of type %GDK_WINDOW_TEMP or windows where override redirect - * has been turned on via gdk_window_set_override_redirect() - * since these windows are not resizable by the user. - * - * Since you can't count on the windowing system doing the - * constraints for programmatic resizes, you should generally - * call gdk_window_constrain_size() yourself to determine - * appropriate sizes. - * - **/ -void -gdk_window_set_geometry_hints (GdkWindow *window, - const GdkGeometry *geometry, - GdkWindowHints geom_mask) +static void +gdk_x11_window_set_geometry_hints (GdkWindow *window, + const GdkGeometry *geometry, + GdkWindowHints geom_mask) { XSizeHints size_hints; @@ -2504,20 +2294,9 @@ set_wm_name (GdkDisplay *display, name); } -/** - * gdk_window_set_title: - * @window: a toplevel #GdkWindow - * @title: title of @window - * - * Sets the title of a toplevel window, to be displayed in the titlebar. - * If you haven't explicitly set the icon name for the window - * (using gdk_window_set_icon_name()), the icon name will be set to - * @title as well. @title must be in UTF-8 encoding (as with all - * user-readable strings in GDK/GTK+). @title may not be %NULL. - **/ -void -gdk_window_set_title (GdkWindow *window, - const gchar *title) +static void +gdk_x11_window_set_title (GdkWindow *window, + const gchar *title) { GdkDisplay *display; Display *xdisplay; @@ -2548,28 +2327,9 @@ gdk_window_set_title (GdkWindow *window, } } -/** - * gdk_window_set_role: - * @window: a toplevel #GdkWindow - * @role: a string indicating its role - * - * When using GTK+, typically you should use gtk_window_set_role() instead - * of this low-level function. - * - * The window manager and session manager use a window's role to - * distinguish it from other kinds of window in the same application. - * When an application is restarted after being saved in a previous - * session, all windows with the same title and role are treated as - * interchangeable. So if you have two windows with the same title - * that should be distinguished for session management purposes, you - * should set the role on those windows. It doesn't matter what string - * you use for the role, as long as you have a different role for each - * non-interchangeable kind of window. - * - **/ -void -gdk_window_set_role (GdkWindow *window, - const gchar *role) +static void +gdk_x11_window_set_role (GdkWindow *window, + const gchar *role) { GdkDisplay *display; @@ -2588,20 +2348,9 @@ gdk_window_set_role (GdkWindow *window, gdk_x11_get_xatom_by_name_for_display (display, "WM_WINDOW_ROLE")); } -/** - * gdk_window_set_startup_id: - * @window: a toplevel #GdkWindow - * @startup_id: a string with startup-notification identifier - * - * When using GTK+, typically you should use gtk_window_set_startup_id() - * instead of this low-level function. - * - * Since: 2.12 - * - **/ -void -gdk_window_set_startup_id (GdkWindow *window, - const gchar *startup_id) +static void +gdk_x11_window_set_startup_id (GdkWindow *window, + const gchar *startup_id) { GdkDisplay *display; @@ -2623,22 +2372,9 @@ gdk_window_set_startup_id (GdkWindow *window, gdk_x11_get_xatom_by_name_for_display (display, "_NET_STARTUP_ID")); } -/** - * gdk_window_set_transient_for: - * @window: a toplevel #GdkWindow - * @parent: another toplevel #GdkWindow - * - * Indicates to the window manager that @window is a transient dialog - * associated with the application window @parent. This allows the - * window manager to do things like center @window on @parent and - * keep @window above @parent. - * - * See gtk_window_set_transient_for() if you're using #GtkWindow or - * #GtkDialog. - **/ -void -gdk_window_set_transient_for (GdkWindow *window, - GdkWindow *parent) +static void +gdk_x11_window_set_transient_for (GdkWindow *window, + GdkWindow *parent) { if (!GDK_WINDOW_DESTROYED (window) && !GDK_WINDOW_DESTROYED (parent) && WINDOW_IS_TOPLEVEL_OR_FOREIGN (window)) @@ -2782,14 +2518,12 @@ gdk_window_x11_set_device_cursor (GdkWindow *window, GdkDevice *device, GdkCursor *cursor) { - GdkWindowObject *private; GdkWindowImplX11 *impl; g_return_if_fail (GDK_IS_WINDOW (window)); g_return_if_fail (GDK_IS_DEVICE (device)); - private = (GdkWindowObject *) window; - impl = GDK_WINDOW_IMPL_X11 (private->impl); + impl = GDK_WINDOW_IMPL_X11 (window->impl); if (!cursor) g_hash_table_remove (impl->device_cursor, device); @@ -2807,13 +2541,11 @@ gdk_window_x11_set_device_cursor (GdkWindow *window, GdkCursor * _gdk_x11_window_get_cursor (GdkWindow *window) { - GdkWindowObject *private; GdkWindowImplX11 *impl; g_return_val_if_fail (GDK_IS_WINDOW (window), NULL); - private = (GdkWindowObject *)window; - impl = GDK_WINDOW_IMPL_X11 (private->impl); + impl = GDK_WINDOW_IMPL_X11 (window->impl); return impl->cursor; } @@ -2823,8 +2555,7 @@ gdk_window_x11_get_geometry (GdkWindow *window, gint *x, gint *y, gint *width, - gint *height, - gint *depth) + gint *height) { Window root; gint tx; @@ -2848,8 +2579,6 @@ gdk_window_x11_get_geometry (GdkWindow *window, *width = twidth; if (height) *height = theight; - if (depth) - *depth = tdepth; } } @@ -2879,18 +2608,8 @@ gdk_window_x11_get_root_coords (GdkWindow *window, return return_val; } -/** - * gdk_window_get_root_origin: - * @window: a toplevel #GdkWindow - * @x: return location for X position of window frame - * @y: return location for Y position of window frame - * - * Obtains the top-left corner of the window manager frame in root - * window coordinates. - * - **/ -void -gdk_window_get_root_origin (GdkWindow *window, +static void +gdk_x11_window_get_root_origin (GdkWindow *window, gint *x, gint *y) { @@ -2905,23 +2624,11 @@ gdk_window_get_root_origin (GdkWindow *window, *y = rect.y; } -/** - * gdk_window_get_frame_extents: - * @window: a toplevel #GdkWindow - * @rect: rectangle to fill with bounding box of the window frame - * - * Obtains the bounding box of the window, including window manager - * titlebar/borders if any. The frame position is given in root window - * coordinates. To get the position of the window itself (rather than - * the frame) in root window coordinates, use gdk_window_get_origin(). - * - **/ -void -gdk_window_get_frame_extents (GdkWindow *window, - GdkRectangle *rect) +static void +gdk_x11_window_get_frame_extents (GdkWindow *window, + GdkRectangle *rect) { GdkDisplay *display; - GdkWindowObject *private; GdkWindowImplX11 *impl; Window xwindow; Window xparent; @@ -2943,24 +2650,22 @@ gdk_window_get_frame_extents (GdkWindow *window, g_return_if_fail (rect != NULL); - private = (GdkWindowObject*) window; - rect->x = 0; rect->y = 0; rect->width = 1; rect->height = 1; - while (private->parent && ((GdkWindowObject*) private->parent)->parent) - private = (GdkWindowObject*) private->parent; + while (window->parent && (window->parent)->parent) + window = window->parent; /* Refine our fallback answer a bit using local information */ - rect->x = private->x; - rect->y = private->y; - rect->width = private->width; - rect->height = private->height; + rect->x = window->x; + rect->y = window->y; + rect->width = window->width; + rect->height = window->height; - impl = GDK_WINDOW_IMPL_X11 (private->impl); - if (GDK_WINDOW_DESTROYED (private) || impl->override_redirect) + impl = GDK_WINDOW_IMPL_X11 (window->impl); + if (GDK_WINDOW_DESTROYED (window) || impl->override_redirect) return; nvroots = 0; @@ -3086,7 +2791,7 @@ _gdk_windowing_get_device_state (GdkDisplay *display, { GdkScreen *default_screen; - if (display->closed) + if (gdk_display_is_closed (display)) return; default_screen = gdk_display_get_default_screen (display); @@ -3305,7 +3010,7 @@ _gdk_windowing_window_at_device_position (GdkDisplay *display, toplevels = gdk_screen_get_toplevel_windows (screen); for (list = toplevels; list != NULL; list = g_list_next (list)) { window = GDK_WINDOW (list->data); - xwindow = GDK_WINDOW_XWINDOW (window); + xwindow = GDK_WINDOW_XID (window); gdk_error_trap_push (); XQueryPointer (xdisplay, xwindow, &root, &child, &rootx, &rooty, &winx, &winy, &xmask); @@ -3316,7 +3021,7 @@ _gdk_windowing_window_at_device_position (GdkDisplay *display, pointer_window = child; break; } - gdk_window_get_geometry (window, NULL, NULL, &width, &height, NULL); + gdk_window_get_geometry (window, NULL, NULL, &width, &height); if (winx >= 0 && winy >= 0 && winx < width && winy < height) { /* A childless toplevel, or below another window? */ @@ -3387,7 +3092,7 @@ gdk_window_x11_get_events (GdkWindow *window) 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; - GDK_WINDOW_OBJECT (window)->event_mask = event_mask & ((GDK_WINDOW_OBJECT (window)->event_mask & filtered) | ~filtered); + window->event_mask = event_mask & ((window->event_mask & filtered) | ~filtered); return event_mask; } @@ -3407,7 +3112,7 @@ gdk_window_x11_set_events (GdkWindow *window, display_x11 = GDK_DISPLAY_X11 (gdk_window_get_display (window)); gdk_event_source_select_events ((GdkEventSource *) display_x11->event_source, - GDK_WINDOW_XWINDOW (window), event_mask, + GDK_WINDOW_XID (window), event_mask, xevent_mask); } } @@ -3504,23 +3209,8 @@ gdk_window_x11_input_shape_combine_region (GdkWindow *window, } -/** - * gdk_window_set_override_redirect: - * @window: a toplevel #GdkWindow - * @override_redirect: %TRUE if window should be override redirect - * - * An override redirect window is not under the control of the window manager. - * This means it won't have a titlebar, won't be minimizable, etc. - it will - * be entirely under the control of the application. The window manager - * can't see the override redirect window at all. - * - * Override redirect should only be used for short-lived temporary - * windows, such as popup menus. #GtkMenu uses an override redirect - * window in its implementation, for example. - * - **/ -void -gdk_window_set_override_redirect (GdkWindow *window, +static void +gdk_x11_window_set_override_redirect (GdkWindow *window, gboolean override_redirect) { XSetWindowAttributes attr; @@ -3528,8 +3218,7 @@ gdk_window_set_override_redirect (GdkWindow *window, if (!GDK_WINDOW_DESTROYED (window) && WINDOW_IS_TOPLEVEL_OR_FOREIGN (window)) { - GdkWindowObject *private = (GdkWindowObject *)window; - GdkWindowImplX11 *impl = GDK_WINDOW_IMPL_X11 (private->impl); + GdkWindowImplX11 *impl = GDK_WINDOW_IMPL_X11 (window->impl); attr.override_redirect = (override_redirect? True : False); XChangeWindowAttributes (GDK_WINDOW_XDISPLAY (window), @@ -3541,32 +3230,15 @@ gdk_window_set_override_redirect (GdkWindow *window, } } -/** - * gdk_window_set_accept_focus: - * @window: a toplevel #GdkWindow - * @accept_focus: %TRUE if the window should receive input focus - * - * Setting @accept_focus to %FALSE hints the desktop environment that the - * window doesn't want to receive input focus. - * - * On X, it is the responsibility of the window manager to interpret this - * hint. ICCCM-compliant window manager usually respect it. - * - * Since: 2.4 - **/ -void -gdk_window_set_accept_focus (GdkWindow *window, - gboolean accept_focus) +static void +gdk_x11_window_set_accept_focus (GdkWindow *window, + gboolean accept_focus) { - GdkWindowObject *private; - - private = (GdkWindowObject *)window; - accept_focus = accept_focus != FALSE; - if (private->accept_focus != accept_focus) + if (window->accept_focus != accept_focus) { - private->accept_focus = accept_focus; + window->accept_focus = accept_focus; if (!GDK_WINDOW_DESTROYED (window) && WINDOW_IS_TOPLEVEL_OR_FOREIGN (window)) @@ -3574,38 +3246,18 @@ gdk_window_set_accept_focus (GdkWindow *window, } } -/** - * gdk_window_set_focus_on_map: - * @window: a toplevel #GdkWindow - * @focus_on_map: %TRUE if the window should receive input focus when mapped - * - * Setting @focus_on_map to %FALSE hints the desktop environment that the - * window doesn't want to receive input focus when it is mapped. - * focus_on_map should be turned off for windows that aren't triggered - * interactively (such as popups from network activity). - * - * On X, it is the responsibility of the window manager to interpret - * this hint. Window managers following the freedesktop.org window - * manager extension specification should respect it. - * - * Since: 2.6 - **/ -void -gdk_window_set_focus_on_map (GdkWindow *window, - gboolean focus_on_map) +static void +gdk_x11_window_set_focus_on_map (GdkWindow *window, + gboolean focus_on_map) { - GdkWindowObject *private; - - private = (GdkWindowObject *)window; - focus_on_map = focus_on_map != FALSE; - if (private->focus_on_map != focus_on_map) + if (window->focus_on_map != focus_on_map) { - private->focus_on_map = focus_on_map; + window->focus_on_map = focus_on_map; if ((!GDK_WINDOW_DESTROYED (window)) && - (!private->focus_on_map) && + (!window->focus_on_map) && WINDOW_IS_TOPLEVEL_OR_FOREIGN (window)) gdk_x11_window_set_user_time (window, 0); } @@ -3782,24 +3434,9 @@ gdk_window_update_icon (GdkWindow *window, update_wm_hints (window, FALSE); } -/** - * gdk_window_set_icon_list: - * @window: The #GdkWindow toplevel window to set the icon of. - * @pixbufs: (transfer none) (element-type GdkPixbuf): - * A list of pixbufs, of different sizes. - * - * Sets a list of icons for the window. One of these will be used - * to represent the window when it has been iconified. The icon is - * usually shown in an icon box or some sort of task bar. Which icon - * size is shown depends on the window manager. The window manager - * can scale the icon but setting several size icons can give better - * image quality since the window manager may only need to scale the - * icon by a small amount or not at all. - * - **/ -void -gdk_window_set_icon_list (GdkWindow *window, - GList *pixbufs) +static void +gdk_x11_window_set_icon_list (GdkWindow *window, + GList *pixbufs) { gulong *data; guchar *pixels; @@ -3911,25 +3548,9 @@ gdk_window_icon_name_set (GdkWindow *window) g_quark_from_static_string ("gdk-icon-name-set"))); } -/** - * gdk_window_set_icon_name: - * @window: a toplevel #GdkWindow - * @name: name of window while iconified (minimized) - * - * Windows may have a name used while minimized, distinct from the - * name they display in their titlebar. Most of the time this is a bad - * idea from a user interface standpoint. But you can set such a name - * with this function, if you like. - * - * After calling this with a non-%NULL @name, calls to gdk_window_set_title() - * will not update the icon title. - * - * Using %NULL for @name unsets the icon title; further calls to - * gdk_window_set_title() will again update the icon title as well. - **/ -void -gdk_window_set_icon_name (GdkWindow *window, - const gchar *name) +static void +gdk_x11_window_set_icon_name (GdkWindow *window, + const gchar *name) { GdkDisplay *display; @@ -3965,19 +3586,8 @@ gdk_window_set_icon_name (GdkWindow *window, } } -/** - * gdk_window_iconify: - * @window: a toplevel #GdkWindow - * - * Asks to iconify (minimize) @window. The window manager may choose - * to ignore the request, but normally will honor it. Using - * gtk_window_iconify() is preferred, if you have a #GtkWindow widget. - * - * This function only makes sense when @window is a toplevel window. - * - **/ -void -gdk_window_iconify (GdkWindow *window) +static void +gdk_x11_window_iconify (GdkWindow *window) { if (GDK_WINDOW_DESTROYED (window) || !WINDOW_IS_TOPLEVEL_OR_FOREIGN (window)) @@ -3986,7 +3596,7 @@ gdk_window_iconify (GdkWindow *window) if (GDK_WINDOW_IS_MAPPED (window)) { XIconifyWindow (GDK_WINDOW_XDISPLAY (window), - GDK_WINDOW_XWINDOW (window), + GDK_WINDOW_XID (window), gdk_screen_get_number (GDK_WINDOW_SCREEN (window))); } else @@ -3998,19 +3608,8 @@ gdk_window_iconify (GdkWindow *window) } } -/** - * gdk_window_deiconify: - * @window: a toplevel #GdkWindow - * - * Attempt to deiconify (unminimize) @window. On X11 the window manager may - * choose to ignore the request to deiconify. When using GTK+, - * use gtk_window_deiconify() instead of the #GdkWindow variant. Or better yet, - * you probably want to use gtk_window_present(), which raises the window, focuses it, - * unminimizes it, and puts it on the current desktop. - * - **/ -void -gdk_window_deiconify (GdkWindow *window) +static void +gdk_x11_window_deiconify (GdkWindow *window) { if (GDK_WINDOW_DESTROYED (window) || !WINDOW_IS_TOPLEVEL_OR_FOREIGN (window)) @@ -4029,23 +3628,8 @@ gdk_window_deiconify (GdkWindow *window) } } -/** - * gdk_window_stick: - * @window: a toplevel #GdkWindow - * - * "Pins" a window such that it's on all workspaces and does not scroll - * with viewports, for window managers that have scrollable viewports. - * (When using #GtkWindow, gtk_window_stick() may be more useful.) - * - * On the X11 platform, this function depends on window manager - * support, so may have no effect with many window managers. However, - * GDK will do the best it can to convince the window manager to stick - * the window. For window managers that don't support this operation, - * there's nothing you can do to force it to happen. - * - **/ -void -gdk_window_stick (GdkWindow *window) +static void +gdk_x11_window_stick (GdkWindow *window) { if (GDK_WINDOW_DESTROYED (window) || !WINDOW_IS_TOPLEVEL_OR_FOREIGN (window)) @@ -4067,7 +3651,7 @@ gdk_window_stick (GdkWindow *window) /* Request desktop 0xFFFFFFFF */ memset (&xclient, 0, sizeof (xclient)); xclient.type = ClientMessage; - xclient.window = GDK_WINDOW_XWINDOW (window); + 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), "_NET_WM_DESKTOP"); @@ -4092,16 +3676,8 @@ gdk_window_stick (GdkWindow *window) } } -/** - * gdk_window_unstick: - * @window: a toplevel #GdkWindow - * - * Reverse operation for gdk_window_stick(); see gdk_window_stick(), - * and gtk_window_unstick(). - * - **/ -void -gdk_window_unstick (GdkWindow *window) +static void +gdk_x11_window_unstick (GdkWindow *window) { if (GDK_WINDOW_DESTROYED (window) || !WINDOW_IS_TOPLEVEL_OR_FOREIGN (window)) @@ -4126,25 +3702,8 @@ gdk_window_unstick (GdkWindow *window) } } -/** - * gdk_window_maximize: - * @window: a toplevel #GdkWindow - * - * Maximizes the window. If the window was already maximized, then - * this function does nothing. - * - * On X11, asks the window manager to maximize @window, if the window - * manager supports this operation. Not all window managers support - * this, and some deliberately ignore it or don't have a concept of - * "maximized"; so you can't rely on the maximization actually - * happening. But it will happen with most standard window managers, - * and GDK makes a best effort to get it to happen. - * - * On Windows, reliably maximizes the window. - * - **/ -void -gdk_window_maximize (GdkWindow *window) +static void +gdk_x11_window_maximize (GdkWindow *window) { if (GDK_WINDOW_DESTROYED (window) || !WINDOW_IS_TOPLEVEL_OR_FOREIGN (window)) @@ -4160,25 +3719,8 @@ gdk_window_maximize (GdkWindow *window) GDK_WINDOW_STATE_MAXIMIZED); } -/** - * gdk_window_unmaximize: - * @window: a toplevel #GdkWindow - * - * Unmaximizes the window. If the window wasn't maximized, then this - * function does nothing. - * - * On X11, asks the window manager to unmaximize @window, if the - * window manager supports this operation. Not all window managers - * support this, and some deliberately ignore it or don't have a - * concept of "maximized"; so you can't rely on the unmaximization - * actually happening. But it will happen with most standard window - * managers, and GDK makes a best effort to get it to happen. - * - * On Windows, reliably unmaximizes the window. - * - **/ -void -gdk_window_unmaximize (GdkWindow *window) +static void +gdk_x11_window_unmaximize (GdkWindow *window) { if (GDK_WINDOW_DESTROYED (window) || !WINDOW_IS_TOPLEVEL_OR_FOREIGN (window)) @@ -4194,28 +3736,8 @@ gdk_window_unmaximize (GdkWindow *window) 0); } -/** - * gdk_window_fullscreen: - * @window: a toplevel #GdkWindow - * - * Moves the window into fullscreen mode. This means the - * window covers the entire screen and is above any panels - * or task bars. - * - * If the window was already fullscreen, then this function does nothing. - * - * On X11, asks the window manager to put @window in a fullscreen - * state, if the window manager supports this operation. Not all - * window managers support this, and some deliberately ignore it or - * don't have a concept of "fullscreen"; so you can't rely on the - * fullscreenification actually happening. But it will happen with - * most standard window managers, and GDK makes a best effort to get - * it to happen. - * - * Since: 2.2 - **/ -void -gdk_window_fullscreen (GdkWindow *window) +static void +gdk_x11_window_fullscreen (GdkWindow *window) { if (GDK_WINDOW_DESTROYED (window) || !WINDOW_IS_TOPLEVEL_OR_FOREIGN (window)) @@ -4232,25 +3754,8 @@ gdk_window_fullscreen (GdkWindow *window) GDK_WINDOW_STATE_FULLSCREEN); } -/** - * gdk_window_unfullscreen: - * @window: a toplevel #GdkWindow - * - * Moves the window out of fullscreen mode. If the window was not - * fullscreen, does nothing. - * - * On X11, asks the window manager to move @window out of the fullscreen - * state, if the window manager supports this operation. Not all - * window managers support this, and some deliberately ignore it or - * don't have a concept of "fullscreen"; so you can't rely on the - * unfullscreenification actually happening. But it will happen with - * most standard window managers, and GDK makes a best effort to get - * it to happen. - * - * Since: 2.2 - **/ -void -gdk_window_unfullscreen (GdkWindow *window) +static void +gdk_x11_window_unfullscreen (GdkWindow *window) { if (GDK_WINDOW_DESTROYED (window) || !WINDOW_IS_TOPLEVEL_OR_FOREIGN (window)) @@ -4267,26 +3772,9 @@ gdk_window_unfullscreen (GdkWindow *window) 0); } -/** - * gdk_window_set_keep_above: - * @window: a toplevel #GdkWindow - * @setting: whether to keep @window above other windows - * - * Set if @window must be kept above other windows. If the - * window was already above, then this function does nothing. - * - * On X11, asks the window manager to keep @window above, if the window - * manager supports this operation. Not all window managers support - * this, and some deliberately ignore it or don't have a concept of - * "keep above"; so you can't rely on the window being kept above. - * But it will happen with most standard window managers, - * and GDK makes a best effort to get it to happen. - * - * Since: 2.4 - **/ -void -gdk_window_set_keep_above (GdkWindow *window, - gboolean setting) +static void +gdk_x11_window_set_keep_above (GdkWindow *window, + gboolean setting) { g_return_if_fail (GDK_IS_WINDOW (window)); @@ -4310,25 +3798,8 @@ gdk_window_set_keep_above (GdkWindow *window, setting ? GDK_WINDOW_STATE_ABOVE : 0); } -/** - * gdk_window_set_keep_below: - * @window: a toplevel #GdkWindow - * @setting: whether to keep @window below other windows - * - * Set if @window must be kept below other windows. If the - * window was already below, then this function does nothing. - * - * On X11, asks the window manager to keep @window below, if the window - * manager supports this operation. Not all window managers support - * this, and some deliberately ignore it or don't have a concept of - * "keep below"; so you can't rely on the window being kept below. - * But it will happen with most standard window managers, - * and GDK makes a best effort to get it to happen. - * - * Since: 2.4 - **/ -void -gdk_window_set_keep_below (GdkWindow *window, gboolean setting) +static void +gdk_x11_window_set_keep_below (GdkWindow *window, gboolean setting) { g_return_if_fail (GDK_IS_WINDOW (window)); @@ -4352,18 +3823,8 @@ gdk_window_set_keep_below (GdkWindow *window, gboolean setting) setting ? GDK_WINDOW_STATE_BELOW : 0); } -/** - * gdk_window_get_group: - * @window: a toplevel #GdkWindow - * - * Returns the group leader window for @window. See gdk_window_set_group(). - * - * Return value: (transfer none): the group leader window for @window - * - * Since: 2.4 - **/ -GdkWindow * -gdk_window_get_group (GdkWindow *window) +static GdkWindow * +gdk_x11_window_get_group (GdkWindow *window) { GdkToplevelX11 *toplevel; @@ -4376,25 +3837,9 @@ gdk_window_get_group (GdkWindow *window) return toplevel->group_leader; } -/** - * gdk_window_set_group: - * @window: a toplevel #GdkWindow - * @leader: group leader window, or %NULL to restore the default group leader window - * - * Sets the group leader window for @window. By default, - * GDK sets the group leader for all toplevel windows - * to a global window implicitly created by GDK. With this function - * you can override this default. - * - * The group leader window allows the window manager to distinguish - * all windows that belong to a single application. It may for example - * allow users to minimize/unminimize all windows belonging to an - * application at once. You should only set a non-default group window - * if your application pretends to be multiple applications. - **/ -void -gdk_window_set_group (GdkWindow *window, - GdkWindow *leader) +static void +gdk_x11_window_set_group (GdkWindow *window, + GdkWindow *leader) { GdkToplevelX11 *toplevel; @@ -4503,30 +3948,9 @@ gdk_window_set_mwm_hints (GdkWindow *window, XFree (hints); } -/** - * gdk_window_set_decorations: - * @window: a toplevel #GdkWindow - * @decorations: decoration hint mask - * - * "Decorations" are the features the window manager adds to a toplevel #GdkWindow. - * This function sets the traditional Motif window manager hints that tell the - * window manager which decorations you would like your window to have. - * Usually you should use gtk_window_set_decorated() on a #GtkWindow instead of - * using the GDK function directly. - * - * The @decorations argument is the logical OR of the fields in - * the #GdkWMDecoration enumeration. If #GDK_DECOR_ALL is included in the - * mask, the other bits indicate which decorations should be turned off. - * If #GDK_DECOR_ALL is not included, then the other bits indicate - * which decorations should be turned on. - * - * Most window managers honor a decorations hint of 0 to disable all decorations, - * but very few honor all possible combinations of bits. - * - **/ -void -gdk_window_set_decorations (GdkWindow *window, - GdkWMDecoration decorations) +static void +gdk_x11_window_set_decorations (GdkWindow *window, + GdkWMDecoration decorations) { MotifWmHints hints; @@ -4542,19 +3966,9 @@ gdk_window_set_decorations (GdkWindow *window, gdk_window_set_mwm_hints (window, &hints); } -/** - * gdk_window_get_decorations: - * @window: The toplevel #GdkWindow to get the decorations from - * @decorations: The window decorations will be written here - * - * Returns the decorations set on the GdkWindow with - * gdk_window_set_decorations(). - * - * Returns: %TRUE if the window has decorations set, %FALSE otherwise. - **/ -gboolean -gdk_window_get_decorations(GdkWindow *window, - GdkWMDecoration *decorations) +static gboolean +gdk_x11_window_get_decorations(GdkWindow *window, + GdkWMDecoration *decorations) { MotifWmHints *hints; gboolean result = FALSE; @@ -4580,28 +3994,8 @@ gdk_window_get_decorations(GdkWindow *window, return result; } -/** - * gdk_window_set_functions: - * @window: a toplevel #GdkWindow - * @functions: bitmask of operations to allow on @window - * - * Sets hints about the window management functions to make available - * via buttons on the window frame. - * - * On the X backend, this function sets the traditional Motif window - * manager hint for this purpose. However, few window managers do - * anything reliable or interesting with this hint. Many ignore it - * entirely. - * - * The @functions argument is the logical OR of values from the - * #GdkWMFunction enumeration. If the bitmask includes #GDK_FUNC_ALL, - * then the other bits indicate which functions to disable; if - * it doesn't include #GDK_FUNC_ALL, it indicates which functions to - * enable. - * - **/ -void -gdk_window_set_functions (GdkWindow *window, +static void +gdk_x11_window_set_functions (GdkWindow *window, GdkWMFunction functions) { MotifWmHints hints; @@ -4666,8 +4060,8 @@ _xwindow_get_shape (Display *xdisplay, } -cairo_region_t * -_gdk_windowing_window_get_shape (GdkWindow *window) +static cairo_region_t * +gdk_x11_window_get_shape (GdkWindow *window) { if (!GDK_WINDOW_DESTROYED (window) && gdk_display_supports_shapes (GDK_WINDOW_DISPLAY (window))) @@ -4677,8 +4071,8 @@ _gdk_windowing_window_get_shape (GdkWindow *window) return NULL; } -cairo_region_t * -_gdk_windowing_window_get_input_shape (GdkWindow *window) +static cairo_region_t * +gdk_x11_window_get_input_shape (GdkWindow *window) { #if defined(ShapeInput) if (!GDK_WINDOW_DESTROYED (window) && @@ -4696,13 +4090,11 @@ gdk_window_set_static_bit_gravity (GdkWindow *window, gboolean on) { XSetWindowAttributes xattributes; - GdkWindowObject *private; guint xattributes_mask = 0; g_return_if_fail (GDK_IS_WINDOW (window)); - private = GDK_WINDOW_OBJECT (window); - if (private->input_only) + if (window->input_only) return; xattributes.bit_gravity = StaticGravity; @@ -4732,19 +4124,18 @@ static gboolean gdk_window_x11_set_static_gravities (GdkWindow *window, gboolean use_static) { - GdkWindowObject *private = (GdkWindowObject *)window; GList *tmp_list; - if (!use_static == !private->guffaw_gravity) + if (!use_static == !window->guffaw_gravity) return TRUE; - private->guffaw_gravity = use_static; + window->guffaw_gravity = use_static; if (!GDK_WINDOW_DESTROYED (window)) { gdk_window_set_static_bit_gravity (window, use_static); - tmp_list = private->children; + tmp_list = window->children; while (tmp_list) { gdk_window_set_static_win_gravity (tmp_list->data, use_static); @@ -5053,21 +4444,18 @@ gboolean _gdk_moveresize_handle_event (XEvent *event) { guint button_mask = 0; - GdkWindowObject *window_private; GdkDisplay *display = gdk_x11_lookup_xdisplay (event->xany.display); MoveResizeData *mv_resize = get_move_resize_data (display, FALSE); if (!mv_resize || !mv_resize->moveresize_window) return FALSE; - window_private = (GdkWindowObject *) mv_resize->moveresize_window; - button_mask = GDK_BUTTON1_MASK << (mv_resize->moveresize_button - 1); switch (event->xany.type) { case MotionNotify: - if (window_private->resize_count > 0) + if (mv_resize->moveresize_window->resize_count > 0) { if (mv_resize->moveresize_pending_event) *mv_resize->moveresize_pending_event = *event; @@ -5198,7 +4586,7 @@ calculate_unmoving_origin (MoveResizeData *mv_resize) { gdk_window_get_frame_extents (mv_resize->moveresize_window, &rect); gdk_window_get_geometry (mv_resize->moveresize_window, - NULL, NULL, &width, &height, NULL); + NULL, NULL, &width, &height); switch (mv_resize->moveresize_geometry.win_gravity) { @@ -5297,29 +4685,13 @@ emulate_move_drag (GdkWindow *window, create_moveresize_window (mv_resize, timestamp); } -/** - * gdk_window_begin_resize_drag: - * @window: a toplevel #GdkWindow - * @edge: the edge or corner from which the drag is started - * @button: the button being used to drag - * @root_x: root window X coordinate of mouse click that began the drag - * @root_y: root window Y coordinate of mouse click that began the drag - * @timestamp: timestamp of mouse click that began the drag (use gdk_event_get_time()) - * - * Begins a window resize operation (for a toplevel window). - * You might use this function to implement a "window resize grip," for - * example; in fact #GtkStatusbar uses it. The function works best - * with window managers that support the Extended Window Manager Hints, but has a - * fallback implementation for other window managers. - * - **/ -void -gdk_window_begin_resize_drag (GdkWindow *window, - GdkWindowEdge edge, - gint button, - gint root_x, - gint root_y, - guint32 timestamp) +static void +gdk_x11_window_begin_resize_drag (GdkWindow *window, + GdkWindowEdge edge, + gint button, + gint root_x, + gint root_y, + guint32 timestamp) { if (GDK_WINDOW_DESTROYED (window) || !WINDOW_IS_TOPLEVEL_OR_FOREIGN (window)) @@ -5332,28 +4704,12 @@ gdk_window_begin_resize_drag (GdkWindow *window, emulate_resize_drag (window, edge, button, root_x, root_y, timestamp); } -/** - * gdk_window_begin_move_drag: - * @window: a toplevel #GdkWindow - * @button: the button being used to drag - * @root_x: root window X coordinate of mouse click that began the drag - * @root_y: root window Y coordinate of mouse click that began the drag - * @timestamp: timestamp of mouse click that began the drag - * - * Begins a window move operation (for a toplevel window). You might - * use this function to implement a "window move grip," for - * example. The function works best with window managers that support - * the Extended - * Window Manager Hints, but has a fallback implementation for - * other window managers. - * - **/ -void -gdk_window_begin_move_drag (GdkWindow *window, - gint button, - gint root_x, - gint root_y, - guint32 timestamp) +static void +gdk_x11_window_begin_move_drag (GdkWindow *window, + gint button, + gint root_x, + gint root_y, + guint32 timestamp) { if (GDK_WINDOW_DESTROYED (window) || !WINDOW_IS_TOPLEVEL (window)) @@ -5367,33 +4723,15 @@ gdk_window_begin_move_drag (GdkWindow *window, emulate_move_drag (window, button, root_x, root_y, timestamp); } -/** - * gdk_window_enable_synchronized_configure: - * @window: a toplevel #GdkWindow - * - * Indicates that the application will cooperate with the window - * system in synchronizing the window repaint with the window - * manager during resizing operations. After an application calls - * this function, it must call gdk_window_configure_finished() every - * time it has finished all processing associated with a set of - * Configure events. Toplevel GTK+ windows automatically use this - * protocol. - * - * On X, calling this function makes @window participate in the - * _NET_WM_SYNC_REQUEST window manager protocol. - * - * Since: 2.6 - **/ -void -gdk_window_enable_synchronized_configure (GdkWindow *window) +static void +gdk_x11_window_enable_synchronized_configure (GdkWindow *window) { - GdkWindowObject *private = (GdkWindowObject *)window; GdkWindowImplX11 *impl; - if (!GDK_IS_WINDOW_IMPL_X11 (private->impl)) + if (!GDK_IS_WINDOW_IMPL_X11 (window->impl)) return; - impl = GDK_WINDOW_IMPL_X11 (private->impl); + impl = GDK_WINDOW_IMPL_X11 (window->impl); if (!impl->use_synchronized_configure) { @@ -5406,30 +4744,15 @@ gdk_window_enable_synchronized_configure (GdkWindow *window) } } -/** - * gdk_window_configure_finished: - * @window: a toplevel #GdkWindow - * - * Signal to the window system that the application has finished - * handling Configure events it has received. Window Managers can - * use this to better synchronize the frame repaint with the - * application. GTK+ applications will automatically call this - * function when appropriate. - * - * This function can only be called if gdk_window_enable_synchronized_configure() - * was called previously. - * - * Since: 2.6 - **/ -void -gdk_window_configure_finished (GdkWindow *window) +static void +gdk_x11_window_configure_finished (GdkWindow *window) { GdkWindowImplX11 *impl; if (!WINDOW_IS_TOPLEVEL (window)) return; - impl = GDK_WINDOW_IMPL_X11 (((GdkWindowObject *)window)->impl); + impl = GDK_WINDOW_IMPL_X11 (window->impl); if (!impl->use_synchronized_configure) return; @@ -5453,47 +4776,30 @@ gdk_window_configure_finished (GdkWindow *window) #endif } -void -_gdk_windowing_window_beep (GdkWindow *window) +static gboolean +gdk_x11_window_beep (GdkWindow *window) { GdkDisplay *display; - g_return_if_fail (GDK_IS_WINDOW (window)); - display = GDK_WINDOW_DISPLAY (window); #ifdef HAVE_XKB if (GDK_DISPLAY_X11 (display)->use_xkb) - XkbBell (GDK_DISPLAY_XDISPLAY (display), - GDK_WINDOW_XID (window), - 0, - None); - else + { + XkbBell (GDK_DISPLAY_XDISPLAY (display), + GDK_WINDOW_XID (window), + 0, + None); + return TRUE; + } #endif - gdk_display_beep (display); + + return FALSE; } -/** - * gdk_window_set_opacity: - * @window: a top-level #GdkWindow - * @opacity: opacity - * - * Request the windowing system to make @window partially transparent, - * with opacity 0 being fully transparent and 1 fully opaque. (Values - * of the opacity parameter are clamped to the [0,1] range.) - * - * On X11, this works only on X screens with a compositing manager - * running. - * - * For setting up per-pixel alpha, see gdk_screen_get_rgba_visual(). - * For making non-toplevel windows translucent, see - * gdk_window_set_composited(). - * - * Since: 2.12 - */ -void -gdk_window_set_opacity (GdkWindow *window, - gdouble opacity) +static void +gdk_x11_window_set_opacity (GdkWindow *window, + gdouble opacity) { GdkDisplay *display; guint32 cardinal; @@ -5526,22 +4832,21 @@ gdk_window_set_opacity (GdkWindow *window, (guchar *) &cardinal, 1); } -void -_gdk_windowing_window_set_composited (GdkWindow *window, - gboolean composited) +static void +gdk_x11_window_set_composited (GdkWindow *window, + gboolean composited) { #if defined(HAVE_XCOMPOSITE) && defined(HAVE_XDAMAGE) && defined (HAVE_XFIXES) - GdkWindowObject *private = (GdkWindowObject *) window; GdkWindowImplX11 *impl; GdkDisplay *display; Display *dpy; Window xid; - impl = GDK_WINDOW_IMPL_X11 (private->impl); + impl = GDK_WINDOW_IMPL_X11 (window->impl); display = gdk_window_get_display (window); dpy = GDK_DISPLAY_XDISPLAY (display); - xid = GDK_WINDOW_XWINDOW (private); + xid = GDK_WINDOW_XID (window); if (composited) { @@ -5574,34 +4879,6 @@ _gdk_windowing_after_process_all_updates (void) { } -static void -gdk_window_impl_iface_init (GdkWindowImplIface *iface) -{ - iface->show = gdk_window_x11_show; - iface->hide = gdk_window_x11_hide; - iface->withdraw = gdk_window_x11_withdraw; - iface->set_events = gdk_window_x11_set_events; - iface->get_events = gdk_window_x11_get_events; - iface->raise = gdk_window_x11_raise; - iface->lower = gdk_window_x11_lower; - iface->restack_under = gdk_window_x11_restack_under; - iface->restack_toplevel = gdk_window_x11_restack_toplevel; - iface->move_resize = gdk_window_x11_move_resize; - iface->set_background = gdk_window_x11_set_background; - iface->reparent = gdk_window_x11_reparent; - iface->set_device_cursor = gdk_window_x11_set_device_cursor; - iface->get_geometry = gdk_window_x11_get_geometry; - iface->get_root_coords = gdk_window_x11_get_root_coords; - iface->get_device_state = gdk_window_x11_get_device_state; - iface->shape_combine_region = gdk_window_x11_shape_combine_region; - iface->input_shape_combine_region = gdk_window_x11_input_shape_combine_region; - iface->set_static_gravities = gdk_window_x11_set_static_gravities; - iface->queue_antiexpose = _gdk_x11_window_queue_antiexpose; - iface->translate = _gdk_x11_window_translate; - iface->destroy = _gdk_x11_window_destroy; - iface->resize_cairo_surface = gdk_window_x11_resize_cairo_surface; -} - static Bool timestamp_predicate (Display *display, XEvent *xevent, @@ -5642,7 +4919,7 @@ gdk_x11_get_server_time (GdkWindow *window) g_return_val_if_fail (!GDK_WINDOW_DESTROYED (window), 0); xdisplay = GDK_WINDOW_XDISPLAY (window); - xwindow = GDK_WINDOW_XWINDOW (window); + xwindow = GDK_WINDOW_XID (window); timestamp_prop_atom = gdk_x11_get_xatom_by_name_for_display (GDK_WINDOW_DISPLAY (window), "GDK_TIMESTAMP_PROP"); @@ -5668,8 +4945,6 @@ gdk_x11_get_server_time (GdkWindow *window) XID gdk_x11_window_get_xid (GdkWindow *window) { - GdkDrawable *impl; - /* Try to ensure the window has a native window */ if (!_gdk_window_has_impl (window)) { @@ -5688,8 +4963,93 @@ gdk_x11_window_get_xid (GdkWindow *window) return None; } - impl = ((GdkWindowObject *) window)->impl; + return GDK_WINDOW_IMPL_X11 (window->impl)->xid; +} + +extern GdkDragContext * _gdk_x11_window_drag_begin (GdkWindow *window, + GdkDevice *device, + GList *targets); - return ((GdkWindowImplX11 *)impl)->xid; +static void +gdk_window_impl_x11_class_init (GdkWindowImplX11Class *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + GdkWindowImplClass *impl_class = GDK_WINDOW_IMPL_CLASS (klass); + + object_class->finalize = gdk_window_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_under = gdk_window_x11_restack_under; + impl_class->restack_toplevel = gdk_window_x11_restack_toplevel; + impl_class->move_resize = gdk_window_x11_move_resize; + impl_class->set_background = gdk_window_x11_set_background; + impl_class->reparent = gdk_window_x11_reparent; + impl_class->set_device_cursor = gdk_window_x11_set_device_cursor; + 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->set_static_gravities = gdk_window_x11_set_static_gravities; + impl_class->queue_antiexpose = _gdk_x11_window_queue_antiexpose; + impl_class->translate = _gdk_x11_window_translate; + impl_class->destroy = gdk_x11_window_destroy; + impl_class->destroy_foreign = gdk_x11_window_destroy_foreign; + impl_class->resize_cairo_surface = gdk_window_x11_resize_cairo_surface; + impl_class->get_shape = gdk_x11_window_get_shape; + impl_class->get_input_shape = gdk_x11_window_get_input_shape; + 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_root_origin = gdk_x11_window_get_root_origin; + impl_class->get_frame_extents = gdk_x11_window_get_frame_extents; + impl_class->set_override_redirect = gdk_x11_window_set_override_redirect; + 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->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->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->enable_synchronized_configure = gdk_x11_window_enable_synchronized_configure; + impl_class->configure_finished = gdk_x11_window_configure_finished; + impl_class->set_opacity = gdk_x11_window_set_opacity; + impl_class->set_composited = gdk_x11_window_set_composited; + 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; }