Commit d6818475 authored by Matthias Clasen's avatar Matthias Clasen
Browse files

gdk: Simplify gdk_display_supports_input_shapes

Make this a display property, and do away with
the vfunc in favor of a private setter, to match
how we handle other display characteristics.
parent 287c4027
Pipeline #180049 passed with stages
in 57 minutes and 35 seconds
......@@ -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,12 +315,6 @@ gdk_broadway_display_notify_startup_complete (GdkDisplay *display,
{
}
static gboolean
gdk_broadway_display_supports_input_shapes (GdkDisplay *display)
{
return FALSE;
}
static gulong
gdk_broadway_display_get_next_serial (GdkDisplay *display)
{
......@@ -446,7 +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_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
......@@ -1108,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,8 +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_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;
......@@ -124,7 +125,6 @@ struct _GdkDisplayClass
void (*queue_events) (GdkDisplay *display);
void (*make_default) (GdkDisplay *display);
GdkSurface * (*get_default_group) (GdkDisplay *display);
gboolean (*supports_input_shapes) (GdkDisplay *display);
GdkAppLaunchContext * (*get_app_launch_context) (GdkDisplay *display);
......@@ -232,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);
......
......@@ -848,12 +848,6 @@ gdk_wayland_display_get_default_group (GdkDisplay *display)
return NULL;
}
static gboolean
gdk_wayland_display_supports_input_shapes (GdkDisplay *display)
{
return TRUE;
}
static gulong
gdk_wayland_display_get_next_serial (GdkDisplay *display)
{
......@@ -1013,7 +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_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,15 +622,6 @@ gdk_win32_display_get_default_group (GdkDisplay *display)
return NULL;
}
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)
{
......@@ -1072,8 +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_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,13 +2311,6 @@ gdk_x11_display_get_user_time (GdkDisplay *display)
return GDK_X11_DISPLAY (display)->user_time;
}
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
......@@ -2939,7 +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_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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment