surface: Rename gdk_surface_input_shape_combine_region

There is no shape combining going on anymore, so
call this just gdk_surface_set_input_region, and
remove the offset arguments too. All callers pass
0 anyway.

Update all callers and implementations.
This commit is contained in:
Matthias Clasen 2020-03-01 11:29:06 -08:00
parent 72fdf54e07
commit b2ae6ce8ff
9 changed files with 37 additions and 60 deletions

View File

@ -689,10 +689,8 @@ gdk_broadway_surface_get_device_state (GdkSurface *surface,
}
static void
gdk_broadway_surface_input_shape_combine_region (GdkSurface *surface,
const cairo_region_t *shape_region,
gint offset_x,
gint offset_y)
gdk_broadway_surface_set_input_region (GdkSurface *surface,
cairo_region_t *shape_region)
{
}
@ -1410,7 +1408,7 @@ gdk_broadway_surface_class_init (GdkBroadwaySurfaceClass *klass)
impl_class->get_geometry = gdk_broadway_surface_get_geometry;
impl_class->get_root_coords = gdk_broadway_surface_get_root_coords;
impl_class->get_device_state = gdk_broadway_surface_get_device_state;
impl_class->input_shape_combine_region = gdk_broadway_surface_input_shape_combine_region;
impl_class->set_input_region = gdk_broadway_surface_set_input_region;
impl_class->destroy = _gdk_broadway_surface_destroy;
impl_class->beep = gdk_broadway_surface_beep;

View File

@ -582,8 +582,8 @@ gdk_surface_finalize (GObject *object)
_gdk_surface_destroy (surface, FALSE);
}
if (surface->input_shape)
cairo_region_destroy (surface->input_shape);
if (surface->input_region)
cairo_region_destroy (surface->input_region);
if (surface->cursor)
g_object_unref (surface->cursor);
@ -2372,11 +2372,9 @@ gdk_surface_get_root_coords (GdkSurface *surface,
}
/**
* gdk_surface_input_shape_combine_region:
* gdk_surface_set_input_region:
* @surface: a #GdkSurface
* @shape_region: region of surface to be non-transparent
* @offset_x: X position of @shape_region in @surface coordinates
* @offset_y: Y position of @shape_region in @surface coordinates
* @region: region of surface to be reactive
*
* Apply the region to the surface for the purpose of event
* handling. Mouse events which happen while the pointer position
@ -2396,28 +2394,23 @@ gdk_surface_get_root_coords (GdkSurface *surface,
* function does nothing.
*/
void
gdk_surface_input_shape_combine_region (GdkSurface *surface,
const cairo_region_t *shape_region,
gint offset_x,
gint offset_y)
gdk_surface_set_input_region (GdkSurface *surface,
cairo_region_t *region)
{
g_return_if_fail (GDK_IS_SURFACE (surface));
if (GDK_SURFACE_DESTROYED (surface))
return;
if (surface->input_shape)
cairo_region_destroy (surface->input_shape);
if (surface->input_region)
cairo_region_destroy (surface->input_region);
if (shape_region)
{
surface->input_shape = cairo_region_copy (shape_region);
cairo_region_translate (surface->input_shape, offset_x, offset_y);
}
if (region)
surface->input_region = cairo_region_copy (region);
else
surface->input_shape = NULL;
surface->input_region = NULL;
GDK_SURFACE_GET_CLASS (surface)->input_shape_combine_region (surface, surface->input_shape, 0, 0);
GDK_SURFACE_GET_CLASS (surface)->set_input_region (surface, surface->input_region);
}
/**

View File

@ -386,10 +386,8 @@ void gdk_surface_set_focus_on_map (GdkSurface *surface,
gboolean focus_on_map);
GDK_AVAILABLE_IN_ALL
void gdk_surface_input_shape_combine_region (GdkSurface *surface,
const cairo_region_t *shape_region,
gint offset_x,
gint offset_y);
void gdk_surface_set_input_region (GdkSurface *surface,
cairo_region_t *region);
GDK_AVAILABLE_IN_ALL
gboolean gdk_surface_is_viewable (GdkSurface *surface);

View File

@ -89,7 +89,7 @@ struct _GdkSurface
GdkCursor *cursor;
GHashTable *device_cursor;
cairo_region_t *input_shape;
cairo_region_t *input_region;
GList *devices_inside;
@ -142,10 +142,8 @@ struct _GdkSurfaceClass
gdouble *y,
GdkModifierType *mask);
void (* input_shape_combine_region) (GdkSurface *surface,
const cairo_region_t *shape_region,
gint offset_x,
gint offset_y);
void (* set_input_region) (GdkSurface *surface,
cairo_region_t *shape_region);
/* Called to do the windowing system specific part of gdk_surface_destroy(),
*

View File

@ -2935,10 +2935,8 @@ gdk_wayland_surface_get_device_state (GdkSurface *surface,
}
static void
gdk_wayland_surface_input_shape_combine_region (GdkSurface *surface,
const cairo_region_t *shape_region,
gint offset_x,
gint offset_y)
gdk_wayland_surface_set_input_region (GdkSurface *surface,
cairo_region_t *input_region)
{
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
@ -2947,11 +2945,8 @@ gdk_wayland_surface_input_shape_combine_region (GdkSurface *surface,
g_clear_pointer (&impl->input_region, cairo_region_destroy);
if (shape_region)
{
impl->input_region = cairo_region_copy (shape_region);
cairo_region_translate (impl->input_region, offset_x, offset_y);
}
if (input_region)
impl->input_region = cairo_region_copy (input_region);
impl->input_region_dirty = TRUE;
}
@ -3909,7 +3904,7 @@ gdk_wayland_surface_class_init (GdkWaylandSurfaceClass *klass)
impl_class->get_geometry = gdk_wayland_surface_get_geometry;
impl_class->get_root_coords = gdk_wayland_surface_get_root_coords;
impl_class->get_device_state = gdk_wayland_surface_get_device_state;
impl_class->input_shape_combine_region = gdk_wayland_surface_input_shape_combine_region;
impl_class->set_input_region = gdk_wayland_surface_set_input_region;
impl_class->destroy = gdk_wayland_surface_destroy;
impl_class->beep = gdk_wayland_surface_beep;

View File

@ -5166,10 +5166,8 @@ _gdk_win32_surface_get_unscaled_size (GdkSurface *window,
}
static void
gdk_win32_input_shape_combine_region (GdkSurface *window,
const cairo_region_t *shape_region,
gint offset_x,
gint offset_y)
gdk_win32_surface_set_input_region (GdkSurface *window,
cairo_region_t *input_region)
{
/* Partial input shape support is implemented by handling the
* NC_NCHITTEST message
@ -5199,7 +5197,7 @@ gdk_win32_surface_class_init (GdkWin32SurfaceClass *klass)
impl_class->get_device_state = gdk_surface_win32_get_device_state;
impl_class->get_root_coords = gdk_win32_surface_get_root_coords;
impl_class->input_shape_combine_region = gdk_win32_input_shape_combine_region;
impl_class->set_input_region = gdk_win32_surface_set_input_region;
impl_class->destroy = gdk_win32_surface_destroy;
//impl_class->beep = gdk_x11_surface_beep;

View File

@ -2617,10 +2617,8 @@ gdk_x11_surface_get_device_state (GdkSurface *surface,
}
static void
gdk_x11_surface_input_shape_combine_region (GdkSurface *surface,
const cairo_region_t *shape_region,
gint offset_x,
gint offset_y)
gdk_x11_surface_set_input_region (GdkSurface *surface,
cairo_region_t *input_region)
{
#ifdef ShapeInput
GdkX11Surface *impl = GDK_X11_SURFACE (surface);
@ -2631,7 +2629,7 @@ gdk_x11_surface_input_shape_combine_region (GdkSurface *surface,
if (!gdk_display_supports_input_shapes (GDK_SURFACE_DISPLAY (surface)))
return;
if (shape_region == NULL)
if (input_region == NULL)
{
XShapeCombineMask (GDK_SURFACE_XDISPLAY (surface),
GDK_SURFACE_XID (surface),
@ -2646,15 +2644,14 @@ gdk_x11_surface_input_shape_combine_region (GdkSurface *surface,
gint n_rects = 0;
XRectangle *xrects = NULL;
_gdk_x11_region_get_xrectangles (shape_region,
_gdk_x11_region_get_xrectangles (input_region,
0, 0, impl->surface_scale,
&xrects, &n_rects);
XShapeCombineRectangles (GDK_SURFACE_XDISPLAY (surface),
GDK_SURFACE_XID (surface),
ShapeInput,
offset_x * impl->surface_scale,
offset_y * impl->surface_scale,
0, 0,
xrects, n_rects,
ShapeSet,
YXBanded);
@ -4697,7 +4694,7 @@ gdk_x11_surface_class_init (GdkX11SurfaceClass *klass)
impl_class->get_geometry = gdk_x11_surface_get_geometry;
impl_class->get_root_coords = gdk_x11_surface_get_root_coords;
impl_class->get_device_state = gdk_x11_surface_get_device_state;
impl_class->input_shape_combine_region = gdk_x11_surface_input_shape_combine_region;
impl_class->set_input_region = gdk_x11_surface_set_input_region;
impl_class->destroy = gdk_x11_surface_destroy;
impl_class->beep = gdk_x11_surface_beep;

View File

@ -1175,11 +1175,11 @@ gtk_popover_update_shape (GtkPopover *popover)
region = gdk_cairo_region_create_from_surface (cairo_surface);
cairo_surface_destroy (cairo_surface);
gdk_surface_input_shape_combine_region (priv->surface, region, 0, 0);
gdk_surface_set_input_region (priv->surface, region);
cairo_region_destroy (region);
}
else
gdk_surface_input_shape_combine_region (priv->surface, NULL, 0, 0);
gdk_surface_set_input_region (priv->surface, NULL);
}
static gint

View File

@ -5346,7 +5346,7 @@ update_csd_shape (GtkWindow *window)
if (priv->extra_input_region)
cairo_region_intersect (region, priv->extra_input_region);
gdk_surface_input_shape_combine_region (priv->surface, region, 0, 0);
gdk_surface_set_input_region (priv->surface, region);
cairo_region_destroy (region);
}
}