Add new GdkPaintable interface which implementation objects can implement
2006-04-11 Anders Carlsson <andersca@imendio.com> * gdk/gdkinternals.h: * gdk/gdkwindow.c: (_gdk_paintable_get_type): (gdk_window_begin_paint_region): (gdk_window_end_paint): (gdk_window_process_updates): (gdk_window_invalidate_maybe_recurse): Add new GdkPaintable interface which implementation objects can implement in order to override gdk painting functions.
This commit is contained in:

committed by
Anders Carlsson

parent
c39d964d09
commit
47257b075b
12
ChangeLog
12
ChangeLog
@ -1,3 +1,15 @@
|
||||
2006-04-11 Anders Carlsson <andersca@imendio.com>
|
||||
|
||||
* gdk/gdkinternals.h:
|
||||
* gdk/gdkwindow.c:
|
||||
(_gdk_paintable_get_type):
|
||||
(gdk_window_begin_paint_region):
|
||||
(gdk_window_end_paint):
|
||||
(gdk_window_process_updates):
|
||||
(gdk_window_invalidate_maybe_recurse):
|
||||
Add new GdkPaintable interface which implementation objects can
|
||||
implement in order to override gdk painting functions.
|
||||
|
||||
2006-04-10 Vladimer Sichinava <vlsichinava@gmail.com>
|
||||
|
||||
* configure.in: Added "ka" (Georgian) to ALL_LINGUAS
|
||||
|
@ -1,3 +1,15 @@
|
||||
2006-04-11 Anders Carlsson <andersca@imendio.com>
|
||||
|
||||
* gdk/gdkinternals.h:
|
||||
* gdk/gdkwindow.c:
|
||||
(_gdk_paintable_get_type):
|
||||
(gdk_window_begin_paint_region):
|
||||
(gdk_window_end_paint):
|
||||
(gdk_window_process_updates):
|
||||
(gdk_window_invalidate_maybe_recurse):
|
||||
Add new GdkPaintable interface which implementation objects can
|
||||
implement in order to override gdk painting functions.
|
||||
|
||||
2006-04-10 Vladimer Sichinava <vlsichinava@gmail.com>
|
||||
|
||||
* configure.in: Added "ka" (Georgian) to ALL_LINGUAS
|
||||
|
@ -337,6 +337,32 @@ void _gdk_windowing_window_destroy_foreign (GdkWindow *window);
|
||||
void _gdk_windowing_display_set_sm_client_id (GdkDisplay *display,
|
||||
const gchar *sm_client_id);
|
||||
|
||||
#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,
|
||||
GdkRegion *region);
|
||||
void (* end_paint) (GdkPaintable *paintable);
|
||||
|
||||
void (* invalidate_maybe_recurse) (GdkPaintable *paintable,
|
||||
GdkRegion *region,
|
||||
gboolean (*child_func) (GdkWindow *, gpointer),
|
||||
gpointer user_data);
|
||||
void (* process_updates) (GdkPaintable *paintable,
|
||||
gboolean update_children);
|
||||
};
|
||||
|
||||
GType _gdk_paintable_get_type (void) G_GNUC_CONST;
|
||||
|
||||
/* Implementation types */
|
||||
GType _gdk_window_impl_get_type (void) G_GNUC_CONST;
|
||||
GType _gdk_pixmap_impl_get_type (void) G_GNUC_CONST;
|
||||
|
@ -192,6 +192,30 @@ static void gdk_window_clear_backing_rect (GdkWindow *window,
|
||||
|
||||
G_DEFINE_TYPE (GdkWindowObject, gdk_window_object, GDK_TYPE_DRAWABLE);
|
||||
|
||||
GType
|
||||
_gdk_paintable_get_type (void)
|
||||
{
|
||||
static GType paintable_type = 0;
|
||||
|
||||
if (!paintable_type)
|
||||
{
|
||||
static 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
|
||||
gdk_window_object_init (GdkWindowObject *window)
|
||||
{
|
||||
@ -936,6 +960,13 @@ gdk_window_begin_paint_region (GdkWindow *window,
|
||||
if (GDK_WINDOW_DESTROYED (window))
|
||||
return;
|
||||
|
||||
if (GDK_IS_PAINTABLE (private->impl) &&
|
||||
GDK_PAINTABLE_GET_IFACE (private->impl)->begin_paint_region)
|
||||
{
|
||||
GDK_PAINTABLE_GET_IFACE (private->impl)->begin_paint_region (GDK_PAINTABLE (private->impl), region);
|
||||
return;
|
||||
}
|
||||
|
||||
gdk_region_get_clipbox (region, &clip_box);
|
||||
|
||||
paint = g_new (GdkWindowPaint, 1);
|
||||
@ -997,6 +1028,13 @@ gdk_window_end_paint (GdkWindow *window)
|
||||
if (GDK_WINDOW_DESTROYED (window))
|
||||
return;
|
||||
|
||||
if (GDK_IS_PAINTABLE (private->impl) &&
|
||||
GDK_PAINTABLE_GET_IFACE (private->impl)->end_paint)
|
||||
{
|
||||
GDK_PAINTABLE_GET_IFACE (private->impl)->end_paint (GDK_PAINTABLE (private->impl));
|
||||
return;
|
||||
}
|
||||
|
||||
if (private->paint_stack == NULL)
|
||||
{
|
||||
g_warning (G_STRLOC": no preceding call to gdk_window_begin_paint_region(), see documentation");
|
||||
@ -2287,6 +2325,16 @@ flush_all_displays (void)
|
||||
g_slist_free (displays);
|
||||
}
|
||||
|
||||
/* Currently it is not possible to override
|
||||
* gdk_window_process_all_updates in the same manner as
|
||||
* gdk_window_process_updates and gdk_window_invalidate_maybe_recurse
|
||||
* by implementing the GdkPaintable interface. If in the future a
|
||||
* backend would need this, the right solution would be to add a
|
||||
* method to GdkDisplay that can be optionally
|
||||
* NULL. gdk_window_process_all_updates can then walk the list of open
|
||||
* displays and call the mehod.
|
||||
*/
|
||||
|
||||
/**
|
||||
* gdk_window_process_all_updates:
|
||||
*
|
||||
@ -2350,6 +2398,13 @@ gdk_window_process_updates (GdkWindow *window,
|
||||
g_return_if_fail (window != NULL);
|
||||
g_return_if_fail (GDK_IS_WINDOW (window));
|
||||
|
||||
if (GDK_IS_PAINTABLE (private->impl) &&
|
||||
GDK_PAINTABLE_GET_IFACE (private->impl)->process_updates)
|
||||
{
|
||||
GDK_PAINTABLE_GET_IFACE (private->impl)->process_updates (GDK_PAINTABLE (private->impl), update_children);
|
||||
return;
|
||||
}
|
||||
|
||||
if (private->update_area && !private->update_freeze_count)
|
||||
{
|
||||
gdk_window_process_updates_internal (window);
|
||||
@ -2479,6 +2534,14 @@ gdk_window_invalidate_maybe_recurse (GdkWindow *window,
|
||||
if (private->input_only || !GDK_WINDOW_IS_MAPPED (window))
|
||||
return;
|
||||
|
||||
if (GDK_IS_PAINTABLE (private->impl) &&
|
||||
GDK_PAINTABLE_GET_IFACE (private->impl)->invalidate_maybe_recurse)
|
||||
{
|
||||
GDK_PAINTABLE_GET_IFACE (private->impl)->invalidate_maybe_recurse (GDK_PAINTABLE (private->impl), region,
|
||||
child_func, user_data);
|
||||
return;
|
||||
}
|
||||
|
||||
visible_region = gdk_drawable_get_visible_region (window);
|
||||
gdk_region_intersect (visible_region, region);
|
||||
|
||||
|
Reference in New Issue
Block a user