Commit 7acb64f9 authored by Benjamin Otte's avatar Benjamin Otte

gdk: Make GdkWindowImpl a class, not an interface

It's a subclass of GdkDrawable and the baseclass for GdkWindowImplX11
etc now.
parent b3bca70d
......@@ -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);
......
......@@ -44,7 +44,7 @@ typedef struct _GdkOffscreenWindowClass GdkOffscreenWindowClass;
struct _GdkOffscreenWindow
{
GdkDrawable parent_instance;
GdkWindowImpl parent_instance;
GdkWindow *wrapper;
......@@ -54,7 +54,7 @@ struct _GdkOffscreenWindow
struct _GdkOffscreenWindowClass
{
GdkDrawableClass parent_class;
GdkWindowImplClass parent_class;
};
#define GDK_TYPE_OFFSCREEN_WINDOW (gdk_offscreen_window_get_type())
......@@ -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;
}
This diff is collapsed.
......@@ -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)
{
}
......@@ -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);
......
......@@ -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)
......@@ -240,18 +235,6 @@ 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)
{
......@@ -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;
}
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment