gdkwindow: Make GdkPaintable normal GdkWindowImpl vfuncs
There is no need for this to be a separate interface, its just looking weird.
This commit is contained in:
parent
e09b4fa029
commit
6115961175
@ -351,26 +351,6 @@ void _gdk_windowing_got_event (GdkDisplay *display,
|
|||||||
|
|
||||||
#define GDK_WINDOW_IS_MAPPED(window) (((window)->state & GDK_WINDOW_STATE_WITHDRAWN) == 0)
|
#define GDK_WINDOW_IS_MAPPED(window) (((window)->state & GDK_WINDOW_STATE_WITHDRAWN) == 0)
|
||||||
|
|
||||||
#define GDK_TYPE_PAINTABLE (_gdk_paintable_get_type ())
|
|
||||||
#define GDK_PAINTABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GDK_TYPE_PAINTABLE, GdkPaintable))
|
|
||||||
#define GDK_IS_PAINTABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GDK_TYPE_PAINTABLE))
|
|
||||||
#define GDK_PAINTABLE_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GDK_TYPE_PAINTABLE, GdkPaintableIface))
|
|
||||||
|
|
||||||
typedef struct _GdkPaintable GdkPaintable;
|
|
||||||
typedef struct _GdkPaintableIface GdkPaintableIface;
|
|
||||||
|
|
||||||
struct _GdkPaintableIface
|
|
||||||
{
|
|
||||||
GTypeInterface g_iface;
|
|
||||||
|
|
||||||
void (* begin_paint_region) (GdkPaintable *paintable,
|
|
||||||
GdkWindow *window,
|
|
||||||
const cairo_region_t *region);
|
|
||||||
void (* end_paint) (GdkPaintable *paintable);
|
|
||||||
};
|
|
||||||
|
|
||||||
GType _gdk_paintable_get_type (void) G_GNUC_CONST;
|
|
||||||
|
|
||||||
void _gdk_window_invalidate_for_expose (GdkWindow *window,
|
void _gdk_window_invalidate_for_expose (GdkWindow *window,
|
||||||
cairo_region_t *region);
|
cairo_region_t *region);
|
||||||
|
|
||||||
|
@ -241,30 +241,6 @@ print_region (cairo_region_t *region)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
GType
|
|
||||||
_gdk_paintable_get_type (void)
|
|
||||||
{
|
|
||||||
static GType paintable_type = 0;
|
|
||||||
|
|
||||||
if (!paintable_type)
|
|
||||||
{
|
|
||||||
const GTypeInfo paintable_info =
|
|
||||||
{
|
|
||||||
sizeof (GdkPaintableIface), /* class_size */
|
|
||||||
NULL, /* base_init */
|
|
||||||
NULL, /* base_finalize */
|
|
||||||
};
|
|
||||||
|
|
||||||
paintable_type = g_type_register_static (G_TYPE_INTERFACE,
|
|
||||||
g_intern_static_string ("GdkPaintable"),
|
|
||||||
&paintable_info, 0);
|
|
||||||
|
|
||||||
g_type_interface_add_prerequisite (paintable_type, G_TYPE_OBJECT);
|
|
||||||
}
|
|
||||||
|
|
||||||
return paintable_type;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gdk_window_init (GdkWindow *window)
|
gdk_window_init (GdkWindow *window)
|
||||||
{
|
{
|
||||||
@ -2714,6 +2690,7 @@ gdk_window_begin_paint_region (GdkWindow *window,
|
|||||||
const cairo_region_t *region)
|
const cairo_region_t *region)
|
||||||
{
|
{
|
||||||
GdkRectangle clip_box;
|
GdkRectangle clip_box;
|
||||||
|
GdkWindowImplClass *impl_class;
|
||||||
GdkWindowPaint *paint;
|
GdkWindowPaint *paint;
|
||||||
GSList *list;
|
GSList *list;
|
||||||
gboolean needs_surface;
|
gboolean needs_surface;
|
||||||
@ -2724,17 +2701,11 @@ gdk_window_begin_paint_region (GdkWindow *window,
|
|||||||
!gdk_window_has_impl (window))
|
!gdk_window_has_impl (window))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
impl_class = GDK_WINDOW_IMPL_GET_CLASS (window->impl);
|
||||||
|
|
||||||
needs_surface = TRUE;
|
needs_surface = TRUE;
|
||||||
|
if (impl_class->begin_paint_region)
|
||||||
if (GDK_IS_PAINTABLE (window->impl))
|
needs_surface = impl_class->begin_paint_region (window, region);
|
||||||
{
|
|
||||||
GdkPaintableIface *iface = GDK_PAINTABLE_GET_IFACE (window->impl);
|
|
||||||
|
|
||||||
if (iface->begin_paint_region)
|
|
||||||
iface->begin_paint_region ((GdkPaintable*)window->impl, window, region);
|
|
||||||
|
|
||||||
needs_surface = FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
paint = g_new0 (GdkWindowPaint, 1);
|
paint = g_new0 (GdkWindowPaint, 1);
|
||||||
paint->region = cairo_region_copy (region);
|
paint->region = cairo_region_copy (region);
|
||||||
@ -2783,6 +2754,7 @@ gdk_window_end_paint (GdkWindow *window)
|
|||||||
{
|
{
|
||||||
GdkWindow *composited;
|
GdkWindow *composited;
|
||||||
GdkWindowPaint *paint;
|
GdkWindowPaint *paint;
|
||||||
|
GdkWindowImplClass *impl_class;
|
||||||
GdkRectangle clip_box;
|
GdkRectangle clip_box;
|
||||||
cairo_region_t *full_clip;
|
cairo_region_t *full_clip;
|
||||||
cairo_t *cr;
|
cairo_t *cr;
|
||||||
@ -2799,13 +2771,10 @@ gdk_window_end_paint (GdkWindow *window)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GDK_IS_PAINTABLE (window->impl))
|
impl_class = GDK_WINDOW_IMPL_GET_CLASS (window->impl);
|
||||||
{
|
|
||||||
GdkPaintableIface *iface = GDK_PAINTABLE_GET_IFACE (window->impl);
|
|
||||||
|
|
||||||
if (iface->end_paint)
|
if (impl_class->end_paint)
|
||||||
iface->end_paint ((GdkPaintable*)window->impl);
|
impl_class->end_paint (window);
|
||||||
}
|
|
||||||
|
|
||||||
paint = window->paint_stack->data;
|
paint = window->paint_stack->data;
|
||||||
|
|
||||||
|
@ -101,6 +101,9 @@ struct _GdkWindowImplClass
|
|||||||
gint *x,
|
gint *x,
|
||||||
gint *y,
|
gint *y,
|
||||||
GdkModifierType *mask);
|
GdkModifierType *mask);
|
||||||
|
gboolean (* begin_paint_region) (GdkWindow *window,
|
||||||
|
const cairo_region_t *region);
|
||||||
|
void (* end_paint) (GdkWindow *window);
|
||||||
|
|
||||||
cairo_region_t * (* get_shape) (GdkWindow *window);
|
cairo_region_t * (* get_shape) (GdkWindow *window);
|
||||||
cairo_region_t * (* get_input_shape) (GdkWindow *window);
|
cairo_region_t * (* get_input_shape) (GdkWindow *window);
|
||||||
|
@ -364,19 +364,18 @@ gdk_window_impl_quartz_init (GdkWindowImplQuartz *impl)
|
|||||||
impl->type_hint = GDK_WINDOW_TYPE_HINT_NORMAL;
|
impl->type_hint = GDK_WINDOW_TYPE_HINT_NORMAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static gboolean
|
||||||
gdk_window_impl_quartz_begin_paint_region (GdkPaintable *paintable,
|
gdk_window_impl_quartz_begin_paint_region (GdkWindow *window,
|
||||||
GdkWindow *window,
|
|
||||||
const cairo_region_t *region)
|
const cairo_region_t *region)
|
||||||
{
|
{
|
||||||
GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (paintable);
|
GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (window->imp);
|
||||||
cairo_region_t *clipped_and_offset_region;
|
cairo_region_t *clipped_and_offset_region;
|
||||||
cairo_t *cr;
|
cairo_t *cr;
|
||||||
|
|
||||||
clipped_and_offset_region = cairo_region_copy (region);
|
clipped_and_offset_region = cairo_region_copy (region);
|
||||||
|
|
||||||
cairo_region_intersect (clipped_and_offset_region,
|
cairo_region_intersect (clipped_and_offset_region,
|
||||||
window->clip_region_with_children);
|
window->clip_region);
|
||||||
cairo_region_translate (clipped_and_offset_region,
|
cairo_region_translate (clipped_and_offset_region,
|
||||||
window->abs_x, window->abs_y);
|
window->abs_x, window->abs_y);
|
||||||
|
|
||||||
@ -415,12 +414,14 @@ gdk_window_impl_quartz_begin_paint_region (GdkPaintable *paintable,
|
|||||||
|
|
||||||
done:
|
done:
|
||||||
cairo_region_destroy (clipped_and_offset_region);
|
cairo_region_destroy (clipped_and_offset_region);
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gdk_window_impl_quartz_end_paint (GdkPaintable *paintable)
|
gdk_window_impl_quartz_end_paint (GdkWindow *window)
|
||||||
{
|
{
|
||||||
GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (paintable);
|
GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (window->impl);
|
||||||
|
|
||||||
impl->begin_paint_count--;
|
impl->begin_paint_count--;
|
||||||
|
|
||||||
@ -536,13 +537,6 @@ _gdk_quartz_display_after_process_all_updates (GdkDisplay *display)
|
|||||||
NSEnableScreenUpdates ();
|
NSEnableScreenUpdates ();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
gdk_window_impl_quartz_paintable_init (GdkPaintableIface *iface)
|
|
||||||
{
|
|
||||||
iface->begin_paint_region = gdk_window_impl_quartz_begin_paint_region;
|
|
||||||
iface->end_paint = gdk_window_impl_quartz_end_paint;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const gchar *
|
static const gchar *
|
||||||
get_default_title (void)
|
get_default_title (void)
|
||||||
{
|
{
|
||||||
@ -3040,6 +3034,8 @@ gdk_window_impl_quartz_class_init (GdkWindowImplQuartzClass *klass)
|
|||||||
impl_class->resize_cairo_surface = gdk_window_quartz_resize_cairo_surface;
|
impl_class->resize_cairo_surface = gdk_window_quartz_resize_cairo_surface;
|
||||||
impl_class->get_shape = gdk_quartz_window_get_shape;
|
impl_class->get_shape = gdk_quartz_window_get_shape;
|
||||||
impl_class->get_input_shape = gdk_quartz_window_get_input_shape;
|
impl_class->get_input_shape = gdk_quartz_window_get_input_shape;
|
||||||
|
impl_class->begin_paint_region = gdk_window_impl_quartz_begin_paint_region;
|
||||||
|
impl_class->end_paint = gdk_window_impl_quartz_end_paint;
|
||||||
|
|
||||||
impl_class->focus = gdk_quartz_window_focus;
|
impl_class->focus = gdk_quartz_window_focus;
|
||||||
impl_class->set_type_hint = gdk_quartz_window_set_type_hint;
|
impl_class->set_type_hint = gdk_quartz_window_set_type_hint;
|
||||||
@ -3115,19 +3111,9 @@ _gdk_window_impl_quartz_get_type (void)
|
|||||||
(GInstanceInitFunc) gdk_window_impl_quartz_init,
|
(GInstanceInitFunc) gdk_window_impl_quartz_init,
|
||||||
};
|
};
|
||||||
|
|
||||||
const GInterfaceInfo paintable_info =
|
|
||||||
{
|
|
||||||
(GInterfaceInitFunc) gdk_window_impl_quartz_paintable_init,
|
|
||||||
NULL,
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
object_type = g_type_register_static (GDK_TYPE_WINDOW_IMPL,
|
object_type = g_type_register_static (GDK_TYPE_WINDOW_IMPL,
|
||||||
"GdkWindowImplQuartz",
|
"GdkWindowImplQuartz",
|
||||||
&object_info, 0);
|
&object_info, 0);
|
||||||
g_type_add_interface_static (object_type,
|
|
||||||
GDK_TYPE_PAINTABLE,
|
|
||||||
&paintable_info);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return object_type;
|
return object_type;
|
||||||
|
Loading…
Reference in New Issue
Block a user