[gtk+/rendering-cleanup: 36/41] gdk: Make GdkWindowImpl a class, not an interface
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/rendering-cleanup: 36/41] gdk: Make GdkWindowImpl a class, not an interface
- Date: Tue, 23 Nov 2010 00:24:38 +0000 (UTC)
commit 9d8d87e3774ea47fb93f8ae2162734884a0b1fd3
Author: Benjamin Otte <otte redhat com>
Date: Mon Nov 22 20:42:00 2010 +0100
gdk: Make GdkWindowImpl a class, not an interface
It's a subclass of GdkDrawable and the baseclass for GdkWindowImplX11
etc now.
gdk/gdkdisplay.c | 2 +-
gdk/gdkoffscreenwindow.c | 52 +++++-------
gdk/gdkwindow.c | 200 +++++++++++++++++++++++-----------------------
gdk/gdkwindowimpl.c | 10 ++-
gdk/gdkwindowimpl.h | 21 +++--
gdk/x11/gdkwindow-x11.c | 84 +++++++++-----------
gdk/x11/gdkwindow-x11.h | 5 +-
7 files changed, 185 insertions(+), 189 deletions(-)
---
diff --git a/gdk/gdkdisplay.c b/gdk/gdkdisplay.c
index 1dab470..84c1820 100644
--- a/gdk/gdkdisplay.c
+++ b/gdk/gdkdisplay.c
@@ -940,7 +940,7 @@ gdk_window_real_window_get_device_position (GdkDisplay *display,
private = (GdkWindowObject *) window;
- normal_child = GDK_WINDOW_IMPL_GET_IFACE (private->impl)->get_device_state (window,
+ normal_child = GDK_WINDOW_IMPL_GET_CLASS (private->impl)->get_device_state (window,
device,
&tmpx, &tmpy,
&tmp_mask);
diff --git a/gdk/gdkoffscreenwindow.c b/gdk/gdkoffscreenwindow.c
index 8d8337e..49c8b7f 100644
--- a/gdk/gdkoffscreenwindow.c
+++ b/gdk/gdkoffscreenwindow.c
@@ -64,14 +64,9 @@ struct _GdkOffscreenWindowClass
#define GDK_IS_OFFSCREEN_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_OFFSCREEN_WINDOW))
#define GDK_OFFSCREEN_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_OFFSCREEN_WINDOW, GdkOffscreenWindowClass))
-static void gdk_offscreen_window_impl_iface_init (GdkWindowImplIface *iface);
static void gdk_offscreen_window_hide (GdkWindow *window);
-G_DEFINE_TYPE_WITH_CODE (GdkOffscreenWindow,
- gdk_offscreen_window,
- GDK_TYPE_DRAWABLE,
- G_IMPLEMENT_INTERFACE (GDK_TYPE_WINDOW_IMPL,
- gdk_offscreen_window_impl_iface_init));
+G_DEFINE_TYPE (GdkOffscreenWindow, gdk_offscreen_window, GDK_TYPE_WINDOW_IMPL)
static void
@@ -727,35 +722,32 @@ gdk_offscreen_window_get_embedder (GdkWindow *window)
static void
gdk_offscreen_window_class_init (GdkOffscreenWindowClass *klass)
{
+ GdkWindowImplClass *impl_class = GDK_WINDOW_IMPL_CLASS (klass);
GdkDrawableClass *drawable_class = GDK_DRAWABLE_CLASS (klass);
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->finalize = gdk_offscreen_window_finalize;
drawable_class->ref_cairo_surface = gdk_offscreen_window_ref_cairo_surface;
-}
-static void
-gdk_offscreen_window_impl_iface_init (GdkWindowImplIface *iface)
-{
- iface->show = gdk_offscreen_window_show;
- iface->hide = gdk_offscreen_window_hide;
- iface->withdraw = gdk_offscreen_window_withdraw;
- iface->raise = gdk_offscreen_window_raise;
- iface->lower = gdk_offscreen_window_lower;
- iface->move_resize = gdk_offscreen_window_move_resize;
- iface->set_background = gdk_offscreen_window_set_background;
- iface->get_events = gdk_offscreen_window_get_events;
- iface->set_events = gdk_offscreen_window_set_events;
- iface->reparent = gdk_offscreen_window_reparent;
- iface->get_geometry = gdk_offscreen_window_get_geometry;
- iface->shape_combine_region = gdk_offscreen_window_shape_combine_region;
- iface->input_shape_combine_region = gdk_offscreen_window_input_shape_combine_region;
- iface->set_static_gravities = gdk_offscreen_window_set_static_gravities;
- iface->queue_antiexpose = gdk_offscreen_window_queue_antiexpose;
- iface->translate = gdk_offscreen_window_translate;
- iface->get_root_coords = gdk_offscreen_window_get_root_coords;
- iface->get_device_state = gdk_offscreen_window_get_device_state;
- iface->destroy = gdk_offscreen_window_destroy;
- iface->resize_cairo_surface = gdk_offscreen_window_resize_cairo_surface;
+ impl_class->show = gdk_offscreen_window_show;
+ impl_class->hide = gdk_offscreen_window_hide;
+ impl_class->withdraw = gdk_offscreen_window_withdraw;
+ impl_class->raise = gdk_offscreen_window_raise;
+ impl_class->lower = gdk_offscreen_window_lower;
+ impl_class->move_resize = gdk_offscreen_window_move_resize;
+ impl_class->set_background = gdk_offscreen_window_set_background;
+ impl_class->get_events = gdk_offscreen_window_get_events;
+ impl_class->set_events = gdk_offscreen_window_set_events;
+ impl_class->reparent = gdk_offscreen_window_reparent;
+ impl_class->get_geometry = gdk_offscreen_window_get_geometry;
+ impl_class->shape_combine_region = gdk_offscreen_window_shape_combine_region;
+ impl_class->input_shape_combine_region = gdk_offscreen_window_input_shape_combine_region;
+ impl_class->set_static_gravities = gdk_offscreen_window_set_static_gravities;
+ impl_class->queue_antiexpose = gdk_offscreen_window_queue_antiexpose;
+ impl_class->translate = gdk_offscreen_window_translate;
+ impl_class->get_root_coords = gdk_offscreen_window_get_root_coords;
+ impl_class->get_device_state = gdk_offscreen_window_get_device_state;
+ impl_class->destroy = gdk_offscreen_window_destroy;
+ impl_class->resize_cairo_surface = gdk_offscreen_window_resize_cairo_surface;
}
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index c246ede..db0ca3e 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -830,18 +830,18 @@ static void
apply_shape (GdkWindowObject *private,
cairo_region_t *region)
{
- GdkWindowImplIface *impl_iface;
+ GdkWindowImplClass *impl_class;
/* We trash whether we applied a shape so that
we can avoid unsetting it many times, which
could happen in e.g. apply_clip_as_shape as
windows get resized */
- impl_iface = GDK_WINDOW_IMPL_GET_IFACE (private->impl);
+ impl_class = GDK_WINDOW_IMPL_GET_CLASS (private->impl);
if (region)
- impl_iface->shape_combine_region ((GdkWindow *)private,
+ impl_class->shape_combine_region ((GdkWindow *)private,
region, 0, 0);
else if (private->applied_shape)
- impl_iface->shape_combine_region ((GdkWindow *)private,
+ impl_class->shape_combine_region ((GdkWindow *)private,
NULL, 0, 0);
private->applied_shape = region != NULL;
@@ -1055,7 +1055,7 @@ recompute_visible_regions_internal (GdkWindowObject *private,
if (private->cairo_surface && gdk_window_has_impl (private))
{
- GdkWindowImplIface *iface = GDK_WINDOW_IMPL_GET_IFACE (private->impl);
+ GdkWindowImplClass *iface = GDK_WINDOW_IMPL_GET_CLASS (private->impl);
private->cairo_surface = iface->resize_cairo_surface (private->impl,
private->cairo_surface,
@@ -1245,17 +1245,17 @@ sync_native_window_stack_position (GdkWindow *window)
{
GdkWindowObject *above;
GdkWindowObject *private;
- GdkWindowImplIface *impl_iface;
+ GdkWindowImplClass *impl_class;
GList listhead = {0};
private = (GdkWindowObject *) window;
- impl_iface = GDK_WINDOW_IMPL_GET_IFACE (private->impl);
+ impl_class = GDK_WINDOW_IMPL_GET_CLASS (private->impl);
above = find_native_sibling_above (private->parent, private);
if (above)
{
listhead.data = window;
- impl_iface->restack_under ((GdkWindow *)above,
+ impl_class->restack_under ((GdkWindow *)above,
&listhead);
}
}
@@ -1516,9 +1516,9 @@ reparent_to_impl (GdkWindowObject *private)
GList *l;
GdkWindowObject *child;
gboolean show;
- GdkWindowImplIface *impl_iface;
+ GdkWindowImplClass *impl_class;
- impl_iface = GDK_WINDOW_IMPL_GET_IFACE (private->impl);
+ impl_class = GDK_WINDOW_IMPL_GET_CLASS (private->impl);
/* Enumerate in reverse order so we get the right order for the native
windows (first in childrens list is topmost, and reparent places on top) */
@@ -1530,7 +1530,7 @@ reparent_to_impl (GdkWindowObject *private)
reparent_to_impl (child);
else
{
- show = impl_iface->reparent ((GdkWindow *)child,
+ show = impl_class->reparent ((GdkWindow *)child,
(GdkWindow *)private,
child->x, child->y);
if (show)
@@ -1564,7 +1564,7 @@ gdk_window_reparent (GdkWindow *window,
gboolean show, was_mapped, applied_clip_as_shape;
gboolean do_reparent_to_impl;
GdkEventMask old_native_event_mask;
- GdkWindowImplIface *impl_iface;
+ GdkWindowImplClass *impl_class;
g_return_if_fail (GDK_IS_WINDOW (window));
g_return_if_fail (new_parent == NULL || GDK_IS_WINDOW (new_parent));
@@ -1593,7 +1593,7 @@ gdk_window_reparent (GdkWindow *window,
To make sure we're ok, just wipe it. */
gdk_window_drop_cairo_surface (private);
- impl_iface = GDK_WINDOW_IMPL_GET_IFACE (private->impl);
+ impl_class = GDK_WINDOW_IMPL_GET_CLASS (private->impl);
old_parent = private->parent;
was_mapped = GDK_WINDOW_IS_MAPPED (window);
@@ -1612,7 +1612,7 @@ gdk_window_reparent (GdkWindow *window,
{
old_native_event_mask = get_native_event_mask (private);
/* Native window */
- show = impl_iface->reparent (window, new_parent, x, y);
+ show = impl_class->reparent (window, new_parent, x, y);
}
else
{
@@ -1680,7 +1680,7 @@ gdk_window_reparent (GdkWindow *window,
GdkEventMask native_event_mask = get_native_event_mask (private);
if (native_event_mask != old_native_event_mask)
- impl_iface->set_events (window, native_event_mask);
+ impl_class->set_events (window, native_event_mask);
}
_gdk_window_update_viewable (window);
@@ -1798,7 +1798,7 @@ gdk_window_ensure_native (GdkWindow *window)
GdkScreen *screen;
GdkWindowObject *above;
GList listhead;
- GdkWindowImplIface *impl_iface;
+ GdkWindowImplClass *impl_class;
gboolean disabled_extension_events;
g_return_val_if_fail (GDK_IS_WINDOW (window), FALSE);
@@ -1840,7 +1840,7 @@ gdk_window_ensure_native (GdkWindow *window)
private->impl = old_impl;
change_impl (private, private, new_impl);
- impl_iface = GDK_WINDOW_IMPL_GET_IFACE (private->impl);
+ impl_class = GDK_WINDOW_IMPL_GET_CLASS (private->impl);
/* Native window creation will put the native window topmost in the
* native parent, which may be wrong wrt the position of the previous
@@ -1852,7 +1852,7 @@ gdk_window_ensure_native (GdkWindow *window)
listhead.data = window;
listhead.prev = NULL;
listhead.next = NULL;
- impl_iface->restack_under ((GdkWindow *)above, &listhead);
+ impl_class->restack_under ((GdkWindow *)above, &listhead);
}
recompute_visible_regions (private, FALSE, FALSE);
@@ -1866,15 +1866,15 @@ gdk_window_ensure_native (GdkWindow *window)
if (!private->input_only)
{
- impl_iface->set_background (window, private->background);
+ impl_class->set_background (window, private->background);
}
- impl_iface->input_shape_combine_region (window,
+ impl_class->input_shape_combine_region (window,
private->input_shape,
0, 0);
if (gdk_window_is_viewable (window))
- impl_iface->show (window, FALSE);
+ impl_class->show (window, FALSE);
if (disabled_extension_events)
reenable_extension_events (private);
@@ -1949,7 +1949,7 @@ _gdk_window_destroy_hierarchy (GdkWindow *window,
{
GdkWindowObject *private;
GdkWindowObject *temp_private;
- GdkWindowImplIface *impl_iface;
+ GdkWindowImplClass *impl_class;
GdkWindow *temp_window;
GdkScreen *screen;
GdkDisplay *display;
@@ -2054,10 +2054,10 @@ _gdk_window_destroy_hierarchy (GdkWindow *window,
gdk_window_drop_cairo_surface (private);
- impl_iface = GDK_WINDOW_IMPL_GET_IFACE (private->impl);
+ impl_class = GDK_WINDOW_IMPL_GET_CLASS (private->impl);
if (gdk_window_has_impl (private))
- impl_iface->destroy (window, recursing_native,
+ impl_class->destroy (window, recursing_native,
foreign_destroy);
else
{
@@ -3173,11 +3173,11 @@ do_move_region_bits_on_impl (GdkWindowObject *impl_window,
cairo_region_t *dest_region, /* In impl window coords */
int dx, int dy)
{
- GdkWindowImplIface *impl_iface;
+ GdkWindowImplClass *impl_class;
- impl_iface = GDK_WINDOW_IMPL_GET_IFACE (impl_window->impl);
+ impl_class = GDK_WINDOW_IMPL_GET_CLASS (impl_window->impl);
- impl_iface->translate ((GdkWindow *) impl_window, dest_region, dx, dy);
+ impl_class->translate ((GdkWindow *) impl_window, dest_region, dx, dy);
}
static GdkWindowRegionMove *
@@ -4064,7 +4064,7 @@ static void
gdk_window_process_updates_internal (GdkWindow *window)
{
GdkWindowObject *private = (GdkWindowObject *)window;
- GdkWindowImplIface *impl_iface;
+ GdkWindowImplClass *impl_class;
gboolean save_region = FALSE;
GdkRectangle clip_box;
@@ -4181,8 +4181,8 @@ gdk_window_process_updates_internal (GdkWindow *window)
* moves and queue antiexposure immediately. No need to do
* any tricks */
gdk_window_flush_outstanding_moves (window);
- impl_iface = GDK_WINDOW_IMPL_GET_IFACE (private->impl);
- save_region = impl_iface->queue_antiexpose (window, update_area);
+ impl_class = GDK_WINDOW_IMPL_GET_CLASS (private->impl);
+ save_region = impl_class->queue_antiexpose (window, update_area);
}
/* Render the invalid areas to the implicit paint, by sending exposes.
@@ -4204,8 +4204,8 @@ gdk_window_process_updates_internal (GdkWindow *window)
if (private->implicit_paint != NULL &&
!private->implicit_paint->flushed)
{
- impl_iface = GDK_WINDOW_IMPL_GET_IFACE (private->impl);
- save_region = impl_iface->queue_antiexpose (window, update_area);
+ impl_class = GDK_WINDOW_IMPL_GET_CLASS (private->impl);
+ save_region = impl_class->queue_antiexpose (window, update_area);
}
gdk_window_end_implicit_paint (window);
@@ -5230,7 +5230,7 @@ gdk_window_raise_internal (GdkWindow *window)
GdkWindowObject *above;
GList *native_children;
GList *l, listhead;
- GdkWindowImplIface *impl_iface;
+ GdkWindowImplClass *impl_class;
if (parent)
{
@@ -5238,7 +5238,7 @@ gdk_window_raise_internal (GdkWindow *window)
parent->children = g_list_prepend (parent->children, window);
}
- impl_iface = GDK_WINDOW_IMPL_GET_IFACE (private->impl);
+ impl_class = GDK_WINDOW_IMPL_GET_CLASS (private->impl);
/* Just do native raise for toplevels */
if (gdk_window_is_toplevel (private) ||
/* The restack_under codepath should work correctly even if the parent
@@ -5248,7 +5248,7 @@ gdk_window_raise_internal (GdkWindow *window)
when using native windows */
(gdk_window_has_impl (private) && gdk_window_has_impl (parent)))
{
- impl_iface->raise (window);
+ impl_class->raise (window);
}
else if (gdk_window_has_impl (private))
{
@@ -5258,11 +5258,11 @@ gdk_window_raise_internal (GdkWindow *window)
listhead.data = window;
listhead.next = NULL;
listhead.prev = NULL;
- impl_iface->restack_under ((GdkWindow *)above,
+ impl_class->restack_under ((GdkWindow *)above,
&listhead);
}
else
- impl_iface->raise (window);
+ impl_class->raise (window);
}
else
{
@@ -5273,13 +5273,13 @@ gdk_window_raise_internal (GdkWindow *window)
above = find_native_sibling_above (parent, private);
if (above)
- impl_iface->restack_under ((GdkWindow *)above,
+ impl_class->restack_under ((GdkWindow *)above,
native_children);
else
{
/* Right order, since native_children is bottom-topmost first */
for (l = native_children; l != NULL; l = l->next)
- impl_iface->raise (l->data);
+ impl_class->raise (l->data);
}
g_list_free (native_children);
@@ -5294,7 +5294,7 @@ set_viewable (GdkWindowObject *w,
gboolean val)
{
GdkWindowObject *child;
- GdkWindowImplIface *impl_iface;
+ GdkWindowImplClass *impl_class;
GList *l;
if (w->viewable == val)
@@ -5345,11 +5345,11 @@ set_viewable (GdkWindowObject *w,
* like this, so we just always show/hide directly.
*/
- impl_iface = GDK_WINDOW_IMPL_GET_IFACE (w->impl);
+ impl_class = GDK_WINDOW_IMPL_GET_CLASS (w->impl);
if (val)
- impl_iface->show ((GdkWindow *)w, FALSE);
+ impl_class->show ((GdkWindow *)w, FALSE);
else
- impl_iface->hide ((GdkWindow *)w);
+ impl_class->hide ((GdkWindow *)w);
return TRUE;
}
@@ -5380,7 +5380,7 @@ static void
gdk_window_show_internal (GdkWindow *window, gboolean raise)
{
GdkWindowObject *private;
- GdkWindowImplIface *impl_iface;
+ GdkWindowImplClass *impl_class;
gboolean was_mapped, was_viewable;
gboolean did_show;
@@ -5418,8 +5418,8 @@ gdk_window_show_internal (GdkWindow *window, gboolean raise)
Also show if not done by gdk_window_update_viewable. */
if (gdk_window_has_impl (private) && (was_viewable || !did_show))
{
- impl_iface = GDK_WINDOW_IMPL_GET_IFACE (private->impl);
- impl_iface->show ((GdkWindow *)private,
+ impl_class = GDK_WINDOW_IMPL_GET_CLASS (private->impl);
+ impl_class->show ((GdkWindow *)private,
!did_show ? was_mapped : TRUE);
}
@@ -5518,7 +5518,7 @@ gdk_window_lower_internal (GdkWindow *window)
{
GdkWindowObject *private = (GdkWindowObject *)window;
GdkWindowObject *parent = private->parent;
- GdkWindowImplIface *impl_iface;
+ GdkWindowImplClass *impl_class;
GdkWindowObject *above;
GList *native_children;
GList *l, listhead;
@@ -5529,7 +5529,7 @@ gdk_window_lower_internal (GdkWindow *window)
parent->children = g_list_append (parent->children, window);
}
- impl_iface = GDK_WINDOW_IMPL_GET_IFACE (private->impl);
+ impl_class = GDK_WINDOW_IMPL_GET_CLASS (private->impl);
/* Just do native lower for toplevels */
if (gdk_window_is_toplevel (private) ||
/* The restack_under codepath should work correctly even if the parent
@@ -5539,7 +5539,7 @@ gdk_window_lower_internal (GdkWindow *window)
when using native windows */
(gdk_window_has_impl (private) && gdk_window_has_impl (parent)))
{
- impl_iface->lower (window);
+ impl_class->lower (window);
}
else if (gdk_window_has_impl (private))
{
@@ -5549,10 +5549,10 @@ gdk_window_lower_internal (GdkWindow *window)
listhead.data = window;
listhead.next = NULL;
listhead.prev = NULL;
- impl_iface->restack_under ((GdkWindow *)above, &listhead);
+ impl_class->restack_under ((GdkWindow *)above, &listhead);
}
else
- impl_iface->raise (window);
+ impl_class->raise (window);
}
else
{
@@ -5563,13 +5563,13 @@ gdk_window_lower_internal (GdkWindow *window)
above = find_native_sibling_above (parent, private);
if (above)
- impl_iface->restack_under ((GdkWindow *)above,
+ impl_class->restack_under ((GdkWindow *)above,
native_children);
else
{
/* Right order, since native_children is bottom-topmost first */
for (l = native_children; l != NULL; l = l->next)
- impl_iface->raise (l->data);
+ impl_class->raise (l->data);
}
g_list_free (native_children);
@@ -5663,7 +5663,7 @@ gdk_window_restack (GdkWindow *window,
gboolean above)
{
GdkWindowObject *private;
- GdkWindowImplIface *impl_iface;
+ GdkWindowImplClass *impl_class;
GdkWindowObject *parent;
GdkWindowObject *above_native;
GList *sibling_link;
@@ -5691,8 +5691,8 @@ gdk_window_restack (GdkWindow *window,
if (gdk_window_is_toplevel (private))
{
g_return_if_fail (gdk_window_is_toplevel (GDK_WINDOW_OBJECT (sibling)));
- impl_iface = GDK_WINDOW_IMPL_GET_IFACE (private->impl);
- impl_iface->restack_toplevel (window, sibling, above);
+ impl_class = GDK_WINDOW_IMPL_GET_CLASS (private->impl);
+ impl_class->restack_toplevel (window, sibling, above);
return;
}
@@ -5714,7 +5714,7 @@ gdk_window_restack (GdkWindow *window,
sibling_link->next,
window);
- impl_iface = GDK_WINDOW_IMPL_GET_IFACE (private->impl);
+ impl_class = GDK_WINDOW_IMPL_GET_CLASS (private->impl);
if (gdk_window_has_impl (private))
{
above_native = find_native_sibling_above (parent, private);
@@ -5723,10 +5723,10 @@ gdk_window_restack (GdkWindow *window,
listhead.data = window;
listhead.next = NULL;
listhead.prev = NULL;
- impl_iface->restack_under ((GdkWindow *)above_native, &listhead);
+ impl_class->restack_under ((GdkWindow *)above_native, &listhead);
}
else
- impl_iface->raise (window);
+ impl_class->raise (window);
}
else
{
@@ -5736,13 +5736,13 @@ gdk_window_restack (GdkWindow *window,
{
above_native = find_native_sibling_above (parent, private);
if (above_native)
- impl_iface->restack_under ((GdkWindow *)above_native,
+ impl_class->restack_under ((GdkWindow *)above_native,
native_children);
else
{
/* Right order, since native_children is bottom-topmost first */
for (l = native_children; l != NULL; l = l->next)
- impl_iface->raise (l->data);
+ impl_class->raise (l->data);
}
g_list_free (native_children);
@@ -5790,7 +5790,7 @@ void
gdk_window_hide (GdkWindow *window)
{
GdkWindowObject *private;
- GdkWindowImplIface *impl_iface;
+ GdkWindowImplClass *impl_class;
gboolean was_mapped, did_hide;
g_return_if_fail (GDK_IS_WINDOW (window));
@@ -5844,8 +5844,8 @@ gdk_window_hide (GdkWindow *window)
/* Hide foreign window as those are not handled by update_viewable. */
if (gdk_window_has_impl (private) && (!did_hide))
{
- impl_iface = GDK_WINDOW_IMPL_GET_IFACE (private->impl);
- impl_iface->hide (window);
+ impl_class = GDK_WINDOW_IMPL_GET_CLASS (private->impl);
+ impl_class->hide (window);
}
recompute_visible_regions (private, TRUE, FALSE);
@@ -5881,7 +5881,7 @@ void
gdk_window_withdraw (GdkWindow *window)
{
GdkWindowObject *private;
- GdkWindowImplIface *impl_iface;
+ GdkWindowImplClass *impl_class;
gboolean was_mapped;
g_return_if_fail (GDK_IS_WINDOW (window));
@@ -5894,8 +5894,8 @@ gdk_window_withdraw (GdkWindow *window)
if (gdk_window_has_impl (private))
{
- impl_iface = GDK_WINDOW_IMPL_GET_IFACE (private->impl);
- impl_iface->withdraw (window);
+ impl_class = GDK_WINDOW_IMPL_GET_CLASS (private->impl);
+ impl_class->withdraw (window);
if (was_mapped)
{
@@ -5928,7 +5928,7 @@ gdk_window_set_events (GdkWindow *window,
GdkEventMask event_mask)
{
GdkWindowObject *private;
- GdkWindowImplIface *impl_iface;
+ GdkWindowImplClass *impl_class;
GdkDisplay *display;
g_return_if_fail (GDK_IS_WINDOW (window));
@@ -5955,8 +5955,8 @@ gdk_window_set_events (GdkWindow *window,
if (gdk_window_has_impl (private))
{
- impl_iface = GDK_WINDOW_IMPL_GET_IFACE (private->impl);
- impl_iface->set_events (window,
+ impl_class = GDK_WINDOW_IMPL_GET_CLASS (private->impl);
+ impl_class->set_events (window,
get_native_event_mask (private));
}
@@ -6104,7 +6104,7 @@ gdk_window_move_resize_toplevel (GdkWindow *window,
{
GdkWindowObject *private;
cairo_region_t *old_region, *new_region;
- GdkWindowImplIface *impl_iface;
+ GdkWindowImplClass *impl_class;
gboolean expose;
int old_x, old_y, old_abs_x, old_abs_y;
int dx, dy;
@@ -6127,8 +6127,8 @@ gdk_window_move_resize_toplevel (GdkWindow *window,
old_region = cairo_region_copy (private->clip_region);
}
- impl_iface = GDK_WINDOW_IMPL_GET_IFACE (private->impl);
- impl_iface->move_resize (window, with_move, x, y, width, height);
+ impl_class = GDK_WINDOW_IMPL_GET_CLASS (private->impl);
+ impl_class->move_resize (window, with_move, x, y, width, height);
dx = private->x - old_x;
dy = private->y - old_y;
@@ -6164,7 +6164,7 @@ move_native_children (GdkWindowObject *private)
{
GList *l;
GdkWindowObject *child;
- GdkWindowImplIface *impl_iface;
+ GdkWindowImplClass *impl_class;
for (l = private->children; l; l = l->next)
{
@@ -6172,8 +6172,8 @@ move_native_children (GdkWindowObject *private)
if (child->impl != private->impl)
{
- impl_iface = GDK_WINDOW_IMPL_GET_IFACE (child->impl);
- impl_iface->move_resize ((GdkWindow *)child, TRUE,
+ impl_class = GDK_WINDOW_IMPL_GET_CLASS (child->impl);
+ impl_class->move_resize ((GdkWindow *)child, TRUE,
child->x, child->y,
child->width, child->height);
}
@@ -6252,7 +6252,7 @@ gdk_window_move_resize_internal (GdkWindow *window,
cairo_region_t *old_region, *new_region, *copy_area;
cairo_region_t *old_native_child_region, *new_native_child_region;
GdkWindowObject *impl_window;
- GdkWindowImplIface *impl_iface;
+ GdkWindowImplClass *impl_class;
gboolean expose;
int old_x, old_y, old_abs_x, old_abs_y;
int dx, dy;
@@ -6349,11 +6349,11 @@ gdk_window_move_resize_internal (GdkWindow *window,
if (gdk_window_has_impl (private))
{
- impl_iface = GDK_WINDOW_IMPL_GET_IFACE (private->impl);
+ impl_class = GDK_WINDOW_IMPL_GET_CLASS (private->impl);
/* Do the actual move after recomputing things, as this will have set the shape to
the now correct one, thus avoiding copying regions that should not be copied. */
- impl_iface->move_resize (window, TRUE,
+ impl_class->move_resize (window, TRUE,
private->x, private->y,
private->width, private->height);
}
@@ -6783,8 +6783,8 @@ gdk_window_set_background_pattern (GdkWindow *window,
if (gdk_window_has_impl (private) &&
!private->input_only)
{
- GdkWindowImplIface *impl_iface = GDK_WINDOW_IMPL_GET_IFACE (private->impl);
- impl_iface->set_background (window, pattern);
+ GdkWindowImplClass *impl_class = GDK_WINDOW_IMPL_GET_CLASS (private->impl);
+ impl_class->set_background (window, pattern);
}
}
@@ -6823,7 +6823,7 @@ update_cursor_foreach (GdkDisplay *display,
if (_gdk_native_windows ||
private->window_type == GDK_WINDOW_ROOT ||
private->window_type == GDK_WINDOW_FOREIGN)
- GDK_WINDOW_IMPL_GET_IFACE (private->impl)->set_device_cursor (window, device, private->cursor);
+ GDK_WINDOW_IMPL_GET_CLASS (private->impl)->set_device_cursor (window, device, private->cursor);
else if (_gdk_window_event_parent_of (window, pointer_info->window_under_pointer))
update_cursor (display, device);
}
@@ -7013,7 +7013,7 @@ gdk_window_get_geometry (GdkWindow *window,
gint *depth)
{
GdkWindowObject *private, *parent;
- GdkWindowImplIface *impl_iface;
+ GdkWindowImplClass *impl_class;
if (!window)
{
@@ -7031,8 +7031,8 @@ gdk_window_get_geometry (GdkWindow *window,
{
if (gdk_window_has_impl (private))
{
- impl_iface = GDK_WINDOW_IMPL_GET_IFACE (private->impl);
- impl_iface->get_geometry (window, x, y,
+ impl_class = GDK_WINDOW_IMPL_GET_CLASS (private->impl);
+ impl_class->get_geometry (window, x, y,
width, height,
depth);
/* This reports the position wrt to the native parent, we need to convert
@@ -7133,7 +7133,7 @@ gdk_window_get_origin (GdkWindow *window,
gint *y)
{
GdkWindowObject *private;
- GdkWindowImplIface *impl_iface;
+ GdkWindowImplClass *impl_class;
g_return_val_if_fail (GDK_IS_WINDOW (window), 0);
@@ -7148,8 +7148,8 @@ gdk_window_get_origin (GdkWindow *window,
private = (GdkWindowObject *) window;
- impl_iface = GDK_WINDOW_IMPL_GET_IFACE (private->impl);
- impl_iface->get_root_coords (window,
+ impl_class = GDK_WINDOW_IMPL_GET_CLASS (private->impl);
+ impl_class->get_root_coords (window,
private->abs_x,
private->abs_y,
x, y);
@@ -7180,7 +7180,7 @@ gdk_window_get_root_coords (GdkWindow *window,
gint *root_y)
{
GdkWindowObject *private;
- GdkWindowImplIface *impl_iface;
+ GdkWindowImplClass *impl_class;
g_return_if_fail (GDK_IS_WINDOW (window));
@@ -7195,8 +7195,8 @@ gdk_window_get_root_coords (GdkWindow *window,
return;
}
- impl_iface = GDK_WINDOW_IMPL_GET_IFACE (private->impl);
- impl_iface->get_root_coords (window,
+ impl_class = GDK_WINDOW_IMPL_GET_CLASS (private->impl);
+ impl_class->get_root_coords (window,
x + private->abs_x,
y + private->abs_y,
root_x, root_y);
@@ -7515,7 +7515,7 @@ gdk_window_input_shape_combine_region (GdkWindow *window,
gint offset_y)
{
GdkWindowObject *private;
- GdkWindowImplIface *impl_iface;
+ GdkWindowImplClass *impl_class;
g_return_if_fail (GDK_IS_WINDOW (window));
@@ -7537,8 +7537,8 @@ gdk_window_input_shape_combine_region (GdkWindow *window,
if (gdk_window_has_impl (private))
{
- impl_iface = GDK_WINDOW_IMPL_GET_IFACE (private->impl);
- impl_iface->input_shape_combine_region (window, private->input_shape, 0, 0);
+ impl_class = GDK_WINDOW_IMPL_GET_CLASS (private->impl);
+ impl_class->input_shape_combine_region (window, private->input_shape, 0, 0);
}
/* Pointer may have e.g. moved outside window due to the input mask change */
@@ -7632,7 +7632,7 @@ gdk_window_set_static_gravities (GdkWindow *window,
gboolean use_static)
{
GdkWindowObject *private;
- GdkWindowImplIface *impl_iface;
+ GdkWindowImplClass *impl_class;
g_return_val_if_fail (GDK_IS_WINDOW (window), FALSE);
@@ -7640,8 +7640,8 @@ gdk_window_set_static_gravities (GdkWindow *window,
if (gdk_window_has_impl (private))
{
- impl_iface = GDK_WINDOW_IMPL_GET_IFACE (private->impl);
- return impl_iface->set_static_gravities (window, use_static);
+ impl_class = GDK_WINDOW_IMPL_GET_CLASS (private->impl);
+ return impl_class->set_static_gravities (window, use_static);
}
return FALSE;
@@ -8030,7 +8030,7 @@ update_cursor (GdkDisplay *display,
{
GdkWindowObject *cursor_window, *parent, *toplevel;
GdkWindow *pointer_window;
- GdkWindowImplIface *impl_iface;
+ GdkWindowImplClass *impl_class;
GdkPointerWindowInfo *pointer_info;
GdkDeviceGrabInfo *grab;
GdkCursor *cursor;
@@ -8070,8 +8070,8 @@ update_cursor (GdkDisplay *display,
/* Set all cursors on toplevel, otherwise its tricky to keep track of
* which native window has what cursor set. */
toplevel = (GdkWindowObject *) get_event_toplevel (pointer_window);
- impl_iface = GDK_WINDOW_IMPL_GET_IFACE (toplevel->impl);
- impl_iface->set_device_cursor ((GdkWindow *) toplevel, device, cursor);
+ impl_class = GDK_WINDOW_IMPL_GET_CLASS (toplevel->impl);
+ impl_class->set_device_cursor ((GdkWindow *) toplevel, device, cursor);
}
static gboolean
diff --git a/gdk/gdkwindowimpl.c b/gdk/gdkwindowimpl.c
index 5658373..681aef8 100644
--- a/gdk/gdkwindowimpl.c
+++ b/gdk/gdkwindowimpl.c
@@ -31,11 +31,15 @@
#include "gdkinternals.h"
-typedef GdkWindowImplIface GdkWindowImplInterface;
-G_DEFINE_INTERFACE (GdkWindowImpl, gdk_window_impl, G_TYPE_OBJECT);
+G_DEFINE_TYPE (GdkWindowImpl, gdk_window_impl, GDK_TYPE_DRAWABLE);
static void
-gdk_window_impl_default_init (GdkWindowImplInterface *iface)
+gdk_window_impl_class_init (GdkWindowImplClass *klass)
+{
+}
+
+static void
+gdk_window_impl_init (GdkWindowImpl *impl)
{
}
diff --git a/gdk/gdkwindowimpl.h b/gdk/gdkwindowimpl.h
index ce7f663..3df0095 100644
--- a/gdk/gdkwindowimpl.h
+++ b/gdk/gdkwindowimpl.h
@@ -32,16 +32,23 @@
G_BEGIN_DECLS
#define GDK_TYPE_WINDOW_IMPL (gdk_window_impl_get_type ())
-#define GDK_WINDOW_IMPL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GDK_TYPE_WINDOW_IMPL, GdkWindowImpl))
-#define GDK_IS_WINDOW_IMPL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GDK_TYPE_WINDOW_IMPL))
-#define GDK_WINDOW_IMPL_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GDK_TYPE_WINDOW_IMPL, GdkWindowImplIface))
+#define GDK_WINDOW_IMPL(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_WINDOW_IMPL, GdkWindowImpl))
+#define GDK_WINDOW_IMPL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_WINDOW_IMPL, GdkWindowImplClass))
+#define GDK_IS_WINDOW_IMPL(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_WINDOW_IMPL))
+#define GDK_IS_WINDOW_IMPL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_WINDOW_IMPL))
+#define GDK_WINDOW_IMPL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_WINDOW_IMPL, GdkWindowImplClass))
-typedef struct _GdkWindowImpl GdkWindowImpl; /* dummy */
-typedef struct _GdkWindowImplIface GdkWindowImplIface;
+typedef struct _GdkWindowImpl GdkWindowImpl;
+typedef struct _GdkWindowImplClass GdkWindowImplClass;
-struct _GdkWindowImplIface
+struct _GdkWindowImpl
{
- GTypeInterface g_iface;
+ GdkDrawable parent;
+};
+
+struct _GdkWindowImplClass
+{
+ GdkDrawableClass parent_class;
void (* show) (GdkWindow *window,
gboolean already_mapped);
diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c
index b5886c6..1789dcd 100644
--- a/gdk/x11/gdkwindow-x11.c
+++ b/gdk/x11/gdkwindow-x11.c
@@ -109,7 +109,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,11 +127,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));
+G_DEFINE_TYPE (GdkWindowImplX11, gdk_window_impl_x11, GDK_TYPE_WINDOW_IMPL)
GType
_gdk_window_impl_get_type (void)
@@ -241,18 +236,6 @@ gdk_x11_ref_cairo_surface (GdkDrawable *drawable)
}
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;
@@ -5574,34 +5557,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,
@@ -5693,3 +5648,40 @@ gdk_x11_window_get_xid (GdkWindow *window)
return ((GdkWindowImplX11 *)impl)->xid;
}
+static void
+gdk_window_impl_x11_class_init (GdkWindowImplX11Class *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GdkDrawableClass *drawable_class = GDK_DRAWABLE_CLASS (klass);
+ GdkWindowImplClass *impl_class = GDK_WINDOW_IMPL_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;
+
+ 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->resize_cairo_surface = gdk_window_x11_resize_cairo_surface;
+}
+
diff --git a/gdk/x11/gdkwindow-x11.h b/gdk/x11/gdkwindow-x11.h
index 04dc8aa..fd63e8b 100644
--- a/gdk/x11/gdkwindow-x11.h
+++ b/gdk/x11/gdkwindow-x11.h
@@ -28,6 +28,7 @@
#define __GDK_WINDOW_X11_H__
#include "gdk/x11/gdkprivate-x11.h"
+#include "gdk/gdkwindowimpl.h"
#ifdef HAVE_XDAMAGE
#include <X11/extensions/Xdamage.h>
@@ -56,7 +57,7 @@ typedef struct _GdkXPositionInfo GdkXPositionInfo;
struct _GdkWindowImplX11
{
- GdkDrawable parent_instance;
+ GdkWindowImpl parent_instance;
GdkWindow *wrapper;
@@ -81,7 +82,7 @@ struct _GdkWindowImplX11
struct _GdkWindowImplX11Class
{
- GdkDrawableClass parent_class;
+ GdkWindowImplClass parent_class;
};
struct _GdkToplevelX11
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]