mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-13 05:50:10 +00:00
Merge branch 'shape-apis' into 'master'
Shape apis See merge request GNOME/gtk!1925
This commit is contained in:
commit
55b171c986
@ -86,7 +86,6 @@ gdk_display_has_pending
|
||||
gdk_display_is_rgba
|
||||
gdk_display_is_composited
|
||||
gdk_display_get_default_group
|
||||
gdk_display_supports_shapes
|
||||
gdk_display_supports_input_shapes
|
||||
gdk_display_get_app_launch_context
|
||||
gdk_display_notify_startup_complete
|
||||
|
@ -56,6 +56,8 @@ G_DEFINE_TYPE (GdkBroadwayDisplay, gdk_broadway_display, GDK_TYPE_DISPLAY)
|
||||
static void
|
||||
gdk_broadway_display_init (GdkBroadwayDisplay *display)
|
||||
{
|
||||
gdk_display_set_input_shapes (GDK_DISPLAY (display), FALSE);
|
||||
|
||||
display->id_ht = g_hash_table_new (NULL, NULL);
|
||||
|
||||
display->monitor = g_object_new (GDK_TYPE_BROADWAY_MONITOR,
|
||||
@ -313,18 +315,6 @@ gdk_broadway_display_notify_startup_complete (GdkDisplay *display,
|
||||
{
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_broadway_display_supports_shapes (GdkDisplay *display)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_broadway_display_supports_input_shapes (GdkDisplay *display)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gulong
|
||||
gdk_broadway_display_get_next_serial (GdkDisplay *display)
|
||||
{
|
||||
@ -452,8 +442,6 @@ gdk_broadway_display_class_init (GdkBroadwayDisplayClass * class)
|
||||
display_class->has_pending = gdk_broadway_display_has_pending;
|
||||
display_class->queue_events = _gdk_broadway_display_queue_events;
|
||||
display_class->get_default_group = gdk_broadway_display_get_default_group;
|
||||
display_class->supports_shapes = gdk_broadway_display_supports_shapes;
|
||||
display_class->supports_input_shapes = gdk_broadway_display_supports_input_shapes;
|
||||
|
||||
display_class->get_next_serial = gdk_broadway_display_get_next_serial;
|
||||
display_class->notify_startup_complete = gdk_broadway_display_notify_startup_complete;
|
||||
|
@ -71,6 +71,7 @@ enum
|
||||
PROP_0,
|
||||
PROP_COMPOSITED,
|
||||
PROP_RGBA,
|
||||
PROP_INPUT_SHAPES,
|
||||
LAST_PROP
|
||||
};
|
||||
|
||||
@ -113,6 +114,10 @@ gdk_display_get_property (GObject *object,
|
||||
g_value_set_boolean (value, gdk_display_is_rgba (display));
|
||||
break;
|
||||
|
||||
case PROP_INPUT_SHAPES:
|
||||
g_value_set_boolean (value, gdk_display_supports_input_shapes (display));
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
}
|
||||
@ -193,6 +198,19 @@ gdk_display_class_init (GdkDisplayClass *class)
|
||||
TRUE,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkDisplay:input-shapes:
|
||||
*
|
||||
* %TRUE if the display supports input shapes. See
|
||||
* gdk_display_supports_input_shapes() for details.
|
||||
*/
|
||||
props[PROP_INPUT_SHAPES] =
|
||||
g_param_spec_boolean ("input-shapes",
|
||||
P_("Input shapes"),
|
||||
P_("Input shapes"),
|
||||
TRUE,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
g_object_class_install_properties (object_class, LAST_PROP, props);
|
||||
|
||||
/**
|
||||
@ -322,6 +340,7 @@ gdk_display_init (GdkDisplay *display)
|
||||
|
||||
display->composited = TRUE;
|
||||
display->rgba = TRUE;
|
||||
display->input_shapes = TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1094,23 +1113,6 @@ gdk_display_get_primary_clipboard (GdkDisplay *display)
|
||||
return display->primary_clipboard;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_display_supports_shapes:
|
||||
* @display: a #GdkDisplay
|
||||
*
|
||||
* Returns %TRUE if gdk_surface_shape_combine_mask() can
|
||||
* be used to create shaped windows on @display.
|
||||
*
|
||||
* Returns: %TRUE if shaped windows are supported
|
||||
*/
|
||||
gboolean
|
||||
gdk_display_supports_shapes (GdkDisplay *display)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
|
||||
|
||||
return GDK_DISPLAY_GET_CLASS (display)->supports_shapes (display);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_display_supports_input_shapes:
|
||||
* @display: a #GdkDisplay
|
||||
@ -1125,7 +1127,21 @@ gdk_display_supports_input_shapes (GdkDisplay *display)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
|
||||
|
||||
return GDK_DISPLAY_GET_CLASS (display)->supports_input_shapes (display);
|
||||
return display->input_shapes;
|
||||
}
|
||||
|
||||
void
|
||||
gdk_display_set_input_shapes (GdkDisplay *display,
|
||||
gboolean input_shapes)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_DISPLAY (display));
|
||||
|
||||
if (display->input_shapes == input_shapes)
|
||||
return;
|
||||
|
||||
display->input_shapes = input_shapes;
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (display), props[PROP_INPUT_SHAPES]);
|
||||
}
|
||||
|
||||
static GdkAppLaunchContext *
|
||||
|
@ -65,6 +65,8 @@ GDK_AVAILABLE_IN_ALL
|
||||
gboolean gdk_display_is_composited (GdkDisplay *display);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gdk_display_is_rgba (GdkDisplay *display);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gdk_display_supports_input_shapes (GdkDisplay *display);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkEvent* gdk_display_get_event (GdkDisplay *display);
|
||||
@ -87,10 +89,6 @@ GdkClipboard * gdk_display_get_clipboard (GdkDisplay
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkClipboard * gdk_display_get_primary_clipboard (GdkDisplay *display);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gdk_display_supports_shapes (GdkDisplay *display);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gdk_display_supports_input_shapes (GdkDisplay *display);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_display_notify_startup_complete (GdkDisplay *display,
|
||||
const gchar *startup_id);
|
||||
|
@ -102,6 +102,7 @@ struct _GdkDisplay
|
||||
#endif /* GDK_RENDERING_VULKAN */
|
||||
guint rgba : 1;
|
||||
guint composited : 1;
|
||||
guint input_shapes : 1;
|
||||
|
||||
GdkDebugFlags debug_flags;
|
||||
|
||||
@ -123,9 +124,7 @@ struct _GdkDisplayClass
|
||||
gboolean (*has_pending) (GdkDisplay *display);
|
||||
void (*queue_events) (GdkDisplay *display);
|
||||
void (*make_default) (GdkDisplay *display);
|
||||
GdkSurface * (*get_default_group) (GdkDisplay *display);
|
||||
gboolean (*supports_shapes) (GdkDisplay *display);
|
||||
gboolean (*supports_input_shapes) (GdkDisplay *display);
|
||||
GdkSurface * (*get_default_group) (GdkDisplay *display);
|
||||
|
||||
GdkAppLaunchContext * (*get_app_launch_context) (GdkDisplay *display);
|
||||
|
||||
@ -233,6 +232,8 @@ void gdk_display_set_rgba (GdkDisplay *display
|
||||
gboolean rgba);
|
||||
void gdk_display_set_composited (GdkDisplay *display,
|
||||
gboolean composited);
|
||||
void gdk_display_set_input_shapes (GdkDisplay *display,
|
||||
gboolean input_shapes);
|
||||
|
||||
void gdk_display_add_seat (GdkDisplay *display,
|
||||
GdkSeat *seat);
|
||||
|
@ -2042,17 +2042,14 @@ gdk_surface_get_root_coords (GdkSurface *surface,
|
||||
* corresponds to an unset bit in the mask will be passed on the
|
||||
* surface below @surface.
|
||||
*
|
||||
* An input shape is typically used with RGBA surfaces.
|
||||
* An input region is typically used with RGBA surfaces.
|
||||
* The alpha channel of the surface defines which pixels are
|
||||
* invisible and allows for nicely antialiased borders,
|
||||
* and the input shape controls where the surface is
|
||||
* and the input region controls where the surface is
|
||||
* “clickable”.
|
||||
*
|
||||
* On the X11 platform, this requires version 1.1 of the
|
||||
* shape extension.
|
||||
*
|
||||
* On the Win32 platform, this functionality is not present and the
|
||||
* function does nothing.
|
||||
* Use gdk_display_support_input_shapes() to find out if
|
||||
* a particular backend supports input regions.
|
||||
*/
|
||||
void
|
||||
gdk_surface_set_input_region (GdkSurface *surface,
|
||||
|
@ -848,18 +848,6 @@ gdk_wayland_display_get_default_group (GdkDisplay *display)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_wayland_display_supports_shapes (GdkDisplay *display)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_wayland_display_supports_input_shapes (GdkDisplay *display)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gulong
|
||||
gdk_wayland_display_get_next_serial (GdkDisplay *display)
|
||||
{
|
||||
@ -1019,8 +1007,6 @@ gdk_wayland_display_class_init (GdkWaylandDisplayClass *class)
|
||||
display_class->has_pending = gdk_wayland_display_has_pending;
|
||||
display_class->queue_events = _gdk_wayland_display_queue_events;
|
||||
display_class->get_default_group = gdk_wayland_display_get_default_group;
|
||||
display_class->supports_shapes = gdk_wayland_display_supports_shapes;
|
||||
display_class->supports_input_shapes = gdk_wayland_display_supports_input_shapes;
|
||||
display_class->get_app_launch_context = _gdk_wayland_display_get_app_launch_context;
|
||||
display_class->get_next_serial = gdk_wayland_display_get_next_serial;
|
||||
display_class->get_startup_notification_id = gdk_wayland_display_get_startup_notification_id;
|
||||
|
@ -622,23 +622,6 @@ gdk_win32_display_get_default_group (GdkDisplay *display)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_win32_display_supports_shapes (GdkDisplay *display)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_win32_display_supports_input_shapes (GdkDisplay *display)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
|
||||
|
||||
/* Partially supported, see WM_NCHITTEST handler. */
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_display_beep (GdkDisplay *display)
|
||||
{
|
||||
@ -1080,9 +1063,6 @@ gdk_win32_display_class_init (GdkWin32DisplayClass *klass)
|
||||
display_class->queue_events = _gdk_win32_display_queue_events;
|
||||
display_class->get_default_group = gdk_win32_display_get_default_group;
|
||||
|
||||
display_class->supports_shapes = gdk_win32_display_supports_shapes;
|
||||
display_class->supports_input_shapes = gdk_win32_display_supports_input_shapes;
|
||||
|
||||
//? display_class->get_app_launch_context = _gdk_win32_display_get_app_launch_context;
|
||||
|
||||
display_class->get_next_serial = gdk_win32_display_get_next_serial;
|
||||
|
@ -1493,6 +1493,8 @@ gdk_x11_display_open (const gchar *display_name)
|
||||
#endif
|
||||
}
|
||||
|
||||
gdk_display_set_input_shapes (display, display_x11->have_input_shapes);
|
||||
|
||||
display_x11->trusted_client = TRUE;
|
||||
{
|
||||
Window root, child;
|
||||
@ -2309,19 +2311,6 @@ gdk_x11_display_get_user_time (GdkDisplay *display)
|
||||
return GDK_X11_DISPLAY (display)->user_time;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_x11_display_supports_shapes (GdkDisplay *display)
|
||||
{
|
||||
return GDK_X11_DISPLAY (display)->have_shapes;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_x11_display_supports_input_shapes (GdkDisplay *display)
|
||||
{
|
||||
return GDK_X11_DISPLAY (display)->have_input_shapes;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* gdk_x11_display_get_startup_notification_id:
|
||||
* @display: (type GdkX11Display): a #GdkDisplay
|
||||
@ -2945,8 +2934,6 @@ gdk_x11_display_class_init (GdkX11DisplayClass * class)
|
||||
display_class->has_pending = gdk_x11_display_has_pending;
|
||||
display_class->queue_events = _gdk_x11_display_queue_events;
|
||||
display_class->get_default_group = gdk_x11_display_get_default_group;
|
||||
display_class->supports_shapes = gdk_x11_display_supports_shapes;
|
||||
display_class->supports_input_shapes = gdk_x11_display_supports_input_shapes;
|
||||
display_class->get_app_launch_context = _gdk_x11_display_get_app_launch_context;
|
||||
|
||||
display_class->get_next_serial = gdk_x11_display_get_next_serial;
|
||||
|
@ -665,12 +665,12 @@ is_pointer_within_shape (GdkDisplay *display,
|
||||
cairo_region_t *input_shape;
|
||||
|
||||
child->shape = NULL;
|
||||
if (gdk_display_supports_shapes (display))
|
||||
if (display_x11->have_shapes)
|
||||
child->shape = _gdk_x11_xwindow_get_shape (display_x11->xdisplay,
|
||||
child->xid, 1, ShapeBounding);
|
||||
#ifdef ShapeInput
|
||||
input_shape = NULL;
|
||||
if (gdk_display_supports_input_shapes (display))
|
||||
if (display_x11->have_input_shapes)
|
||||
input_shape = _gdk_x11_xwindow_get_shape (display_x11->xdisplay,
|
||||
child->xid, 1, ShapeInput);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user