gdk: Make get_shape and get_input_shape vfuncs

Trying to get rid of all the _gdk_windowing_something() functions that
we expect backends to magically know about and instead put them in a
proper interface (mostly GdkWindowImplClass).
This commit is contained in:
Benjamin Otte 2010-11-25 12:17:11 +01:00
parent 218eea4378
commit 1269f8424f
6 changed files with 22 additions and 16 deletions

View File

@ -356,8 +356,6 @@ gulong _gdk_windowing_window_get_next_serial (GdkDisplay *display);
void _gdk_windowing_window_get_offsets (GdkWindow *window,
gint *x_offset,
gint *y_offset);
cairo_region_t *_gdk_windowing_window_get_shape (GdkWindow *window);
cairo_region_t *_gdk_windowing_window_get_input_shape(GdkWindow *window);
void _gdk_windowing_window_beep (GdkWindow *window);

View File

@ -718,7 +718,7 @@ remove_child_area (GdkWindow *private,
}
else if (private->window_type == GDK_WINDOW_FOREIGN)
{
shape = _gdk_windowing_window_get_shape ((GdkWindow *)child);
shape = GDK_WINDOW_IMPL_GET_CLASS (child)->get_shape (child);
if (shape)
{
cairo_region_intersect (child_region, shape);
@ -732,7 +732,7 @@ remove_child_area (GdkWindow *private,
cairo_region_intersect (child_region, child->input_shape);
else if (private->window_type == GDK_WINDOW_FOREIGN)
{
shape = _gdk_windowing_window_get_input_shape ((GdkWindow *)child);
shape = GDK_WINDOW_IMPL_GET_CLASS (child)->get_input_shape (child);
if (shape)
{
cairo_region_intersect (child_region, shape);

View File

@ -104,6 +104,8 @@ struct _GdkWindowImplClass
gint *y,
GdkModifierType *mask);
cairo_region_t * (* get_shape) (GdkWindow *window);
cairo_region_t * (* get_input_shape) (GdkWindow *window);
void (* shape_combine_region) (GdkWindow *window,
const cairo_region_t *shape_region,
gint offset_x,

View File

@ -2954,15 +2954,15 @@ _gdk_windowing_window_set_composited (GdkWindow *window, gboolean composited)
{
}
cairo_region_t *
_gdk_windowing_window_get_shape (GdkWindow *window)
static cairo_region_t *
gdk_quartz_window_get_shape (GdkWindow *window)
{
/* FIXME: implement */
return NULL;
}
cairo_region_t *
_gdk_windowing_window_get_input_shape (GdkWindow *window)
static cairo_region_t *
gdk_quartz_window_get_input_shape (GdkWindow *window)
{
/* FIXME: implement */
return NULL;
@ -2993,6 +2993,8 @@ gdk_window_impl_iface_init (GdkWindowImplIface *iface)
iface->translate = _gdk_quartz_window_translate;
iface->destroy = _gdk_quartz_window_destroy;
iface->resize_cairo_surface = gdk_window_quartz_resize_cairo_surface;
iface->get_shape = gdk_quartz_window_get_shape;
iface->get_input_shape = gdk_quartz_window_get_input_shape;
}

View File

@ -3170,8 +3170,8 @@ _gdk_windowing_window_set_composited (GdkWindow *window, gboolean composited)
{
}
cairo_region_t *
_gdk_windowing_window_get_shape (GdkWindow *window)
static cairo_region_t *
gdk_win32_window_get_shape (GdkWindow *window)
{
HRGN hrgn = CreateRectRgn (0, 0, 0, 0);
int type = GetWindowRgn (GDK_WINDOW_HWND (window), hrgn);
@ -3187,8 +3187,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_win32_window_get_input_shape (GdkWindow *window)
{
/* CHECK: are these really supposed to be the same? */
return _gdk_windowing_window_get_shape (window);
@ -3306,6 +3306,8 @@ gdk_window_impl_iface_init (GdkWindowImplIface *iface)
iface->translate = _gdk_win32_window_translate;
iface->destroy = _gdk_win32_window_destroy;
iface->resize_cairo_surface = gdk_win32_window_resize_cairo_surface;
iface->get_shape = gdk_win32_window_get_shape;
iface->get_input_shape = gdk_win32_window_get_input_shape;
}
gboolean

View File

@ -4570,8 +4570,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)))
@ -4581,8 +4581,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) &&
@ -5589,5 +5589,7 @@ gdk_window_impl_x11_class_init (GdkWindowImplX11Class *klass)
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;
impl_class->get_shape = gdk_x11_window_get_shape;
impl_class->get_input_shape = gdk_x11_window_get_input_shape;
}