clutter/stage: Remove hide/show cursor API
This removes it from the stage window API too. It's managed by the mutter backends, so we don't need the stage window to do it as well. https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1175
This commit is contained in:
parent
1301770dcb
commit
fe27a6ea3b
8 changed files with 1 additions and 159 deletions
|
@ -62,16 +62,6 @@ _clutter_stage_window_set_title (ClutterStageWindow *window,
|
|||
iface->set_title (window, title);
|
||||
}
|
||||
|
||||
void
|
||||
_clutter_stage_window_set_cursor_visible (ClutterStageWindow *window,
|
||||
gboolean is_visible)
|
||||
{
|
||||
ClutterStageWindowInterface *iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
|
||||
|
||||
if (iface->set_cursor_visible)
|
||||
iface->set_cursor_visible (window, is_visible);
|
||||
}
|
||||
|
||||
gboolean
|
||||
_clutter_stage_window_realize (ClutterStageWindow *window)
|
||||
{
|
||||
|
|
|
@ -30,8 +30,6 @@ struct _ClutterStageWindowInterface
|
|||
|
||||
void (* set_title) (ClutterStageWindow *stage_window,
|
||||
const gchar *title);
|
||||
void (* set_cursor_visible) (ClutterStageWindow *stage_window,
|
||||
gboolean cursor_visible);
|
||||
|
||||
gboolean (* realize) (ClutterStageWindow *stage_window);
|
||||
void (* unrealize) (ClutterStageWindow *stage_window);
|
||||
|
|
|
@ -146,7 +146,6 @@ struct _ClutterStagePrivate
|
|||
int update_freeze_count;
|
||||
|
||||
guint redraw_pending : 1;
|
||||
guint is_cursor_visible : 1;
|
||||
guint throttle_motion_events : 1;
|
||||
guint min_size_changed : 1;
|
||||
guint accept_focus : 1;
|
||||
|
@ -160,7 +159,6 @@ enum
|
|||
PROP_0,
|
||||
|
||||
PROP_COLOR,
|
||||
PROP_CURSOR_VISIBLE,
|
||||
PROP_PERSPECTIVE,
|
||||
PROP_TITLE,
|
||||
PROP_KEY_FOCUS,
|
||||
|
@ -1850,13 +1848,6 @@ clutter_stage_set_property (GObject *object,
|
|||
clutter_value_get_color (value));
|
||||
break;
|
||||
|
||||
case PROP_CURSOR_VISIBLE:
|
||||
if (g_value_get_boolean (value))
|
||||
clutter_stage_show_cursor (stage);
|
||||
else
|
||||
clutter_stage_hide_cursor (stage);
|
||||
break;
|
||||
|
||||
case PROP_PERSPECTIVE:
|
||||
clutter_stage_set_perspective (stage, g_value_get_boxed (value));
|
||||
break;
|
||||
|
@ -1899,10 +1890,6 @@ clutter_stage_get_property (GObject *gobject,
|
|||
}
|
||||
break;
|
||||
|
||||
case PROP_CURSOR_VISIBLE:
|
||||
g_value_set_boolean (value, priv->is_cursor_visible);
|
||||
break;
|
||||
|
||||
case PROP_PERSPECTIVE:
|
||||
g_value_set_boxed (value, &priv->perspective);
|
||||
break;
|
||||
|
@ -2026,18 +2013,6 @@ clutter_stage_class_init (ClutterStageClass *klass)
|
|||
|
||||
klass->paint_view = clutter_stage_real_paint_view;
|
||||
|
||||
/**
|
||||
* ClutterStage:cursor-visible:
|
||||
*
|
||||
* Whether the mouse pointer should be visible
|
||||
*/
|
||||
obj_props[PROP_CURSOR_VISIBLE] =
|
||||
g_param_spec_boolean ("cursor-visible",
|
||||
P_("Cursor Visible"),
|
||||
P_("Whether the mouse pointer is visible on the main stage"),
|
||||
TRUE,
|
||||
CLUTTER_PARAM_READWRITE);
|
||||
|
||||
/**
|
||||
* ClutterStage:color:
|
||||
*
|
||||
|
@ -2288,7 +2263,6 @@ clutter_stage_init (ClutterStage *self)
|
|||
|
||||
priv->event_queue = g_queue_new ();
|
||||
|
||||
priv->is_cursor_visible = TRUE;
|
||||
priv->throttle_motion_events = TRUE;
|
||||
priv->min_size_changed = FALSE;
|
||||
priv->sync_delay = -1;
|
||||
|
@ -2657,72 +2631,6 @@ _clutter_stage_get_viewport (ClutterStage *stage,
|
|||
*height = priv->viewport[3];
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_stage_show_cursor:
|
||||
* @stage: a #ClutterStage
|
||||
*
|
||||
* Shows the cursor on the stage window
|
||||
*/
|
||||
void
|
||||
clutter_stage_show_cursor (ClutterStage *stage)
|
||||
{
|
||||
ClutterStagePrivate *priv;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_STAGE (stage));
|
||||
|
||||
priv = stage->priv;
|
||||
if (!priv->is_cursor_visible)
|
||||
{
|
||||
ClutterStageWindow *impl = CLUTTER_STAGE_WINDOW (priv->impl);
|
||||
ClutterStageWindowInterface *iface;
|
||||
|
||||
iface = CLUTTER_STAGE_WINDOW_GET_IFACE (impl);
|
||||
if (iface->set_cursor_visible)
|
||||
{
|
||||
priv->is_cursor_visible = TRUE;
|
||||
|
||||
iface->set_cursor_visible (impl, TRUE);
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (stage),
|
||||
obj_props[PROP_CURSOR_VISIBLE]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_stage_hide_cursor:
|
||||
* @stage: a #ClutterStage
|
||||
*
|
||||
* Makes the cursor invisible on the stage window
|
||||
*
|
||||
* Since: 0.4
|
||||
*/
|
||||
void
|
||||
clutter_stage_hide_cursor (ClutterStage *stage)
|
||||
{
|
||||
ClutterStagePrivate *priv;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_STAGE (stage));
|
||||
|
||||
priv = stage->priv;
|
||||
if (priv->is_cursor_visible)
|
||||
{
|
||||
ClutterStageWindow *impl = CLUTTER_STAGE_WINDOW (priv->impl);
|
||||
ClutterStageWindowInterface *iface;
|
||||
|
||||
iface = CLUTTER_STAGE_WINDOW_GET_IFACE (impl);
|
||||
if (iface->set_cursor_visible)
|
||||
{
|
||||
priv->is_cursor_visible = FALSE;
|
||||
|
||||
iface->set_cursor_visible (impl, FALSE);
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (stage),
|
||||
obj_props[PROP_CURSOR_VISIBLE]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_stage_read_pixels:
|
||||
* @stage: A #ClutterStage
|
||||
|
|
|
@ -147,10 +147,6 @@ CLUTTER_EXPORT
|
|||
void clutter_stage_get_perspective (ClutterStage *stage,
|
||||
ClutterPerspective *perspective);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_stage_show_cursor (ClutterStage *stage);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_stage_hide_cursor (ClutterStage *stage);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_stage_set_title (ClutterStage *stage,
|
||||
const gchar *title);
|
||||
CLUTTER_EXPORT
|
||||
|
|
|
@ -291,9 +291,7 @@ meta_stage_new (MetaBackend *backend)
|
|||
MetaStage *stage;
|
||||
MetaMonitorManager *monitor_manager;
|
||||
|
||||
stage = g_object_new (META_TYPE_STAGE,
|
||||
"cursor-visible", FALSE,
|
||||
NULL);
|
||||
stage = g_object_new (META_TYPE_STAGE, NULL);
|
||||
|
||||
monitor_manager = meta_backend_get_monitor_manager (backend);
|
||||
g_signal_connect (monitor_manager, "power-save-mode-changed",
|
||||
|
|
|
@ -234,39 +234,6 @@ set_wm_title (MetaStageX11 *stage_x11)
|
|||
}
|
||||
}
|
||||
|
||||
static inline void
|
||||
set_cursor_visible (MetaStageX11 *stage_x11)
|
||||
{
|
||||
Display *xdisplay = clutter_x11_get_default_display ();
|
||||
|
||||
if (stage_x11->xwin == None)
|
||||
return;
|
||||
|
||||
g_debug ("setting cursor state ('%s') over stage window (%u)",
|
||||
stage_x11->is_cursor_visible ? "visible" : "invisible",
|
||||
(unsigned int) stage_x11->xwin);
|
||||
|
||||
if (stage_x11->is_cursor_visible)
|
||||
{
|
||||
XUndefineCursor (xdisplay, stage_x11->xwin);
|
||||
}
|
||||
else
|
||||
{
|
||||
XColor col;
|
||||
Pixmap pix;
|
||||
Cursor curs;
|
||||
|
||||
pix = XCreatePixmap (xdisplay, stage_x11->xwin, 1, 1, 1);
|
||||
memset (&col, 0, sizeof (col));
|
||||
curs = XCreatePixmapCursor (xdisplay,
|
||||
pix, pix,
|
||||
&col, &col,
|
||||
1, 1);
|
||||
XFreePixmap (xdisplay, pix);
|
||||
XDefineCursor (xdisplay, stage_x11->xwin, curs);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
meta_stage_x11_unrealize (ClutterStageWindow *stage_window)
|
||||
{
|
||||
|
@ -362,7 +329,6 @@ meta_stage_x11_realize (ClutterStageWindow *stage_window)
|
|||
|
||||
set_wm_pid (stage_x11);
|
||||
set_wm_title (stage_x11);
|
||||
set_cursor_visible (stage_x11);
|
||||
|
||||
/* we unconditionally select input events even with event retrieval
|
||||
* disabled because we need to guarantee that the Clutter internal
|
||||
|
@ -393,16 +359,6 @@ meta_stage_x11_realize (ClutterStageWindow *stage_window)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
meta_stage_x11_set_cursor_visible (ClutterStageWindow *stage_window,
|
||||
gboolean cursor_visible)
|
||||
{
|
||||
MetaStageX11 *stage_x11 = META_STAGE_X11 (stage_window);
|
||||
|
||||
stage_x11->is_cursor_visible = !!cursor_visible;
|
||||
set_cursor_visible (stage_x11);
|
||||
}
|
||||
|
||||
static void
|
||||
meta_stage_x11_set_title (ClutterStageWindow *stage_window,
|
||||
const char *title)
|
||||
|
@ -587,7 +543,6 @@ meta_stage_x11_init (MetaStageX11 *stage)
|
|||
|
||||
stage->wm_state = STAGE_X11_WITHDRAWN;
|
||||
|
||||
stage->is_cursor_visible = TRUE;
|
||||
stage->accept_focus = TRUE;
|
||||
|
||||
stage->title = NULL;
|
||||
|
@ -599,7 +554,6 @@ clutter_stage_window_iface_init (ClutterStageWindowInterface *iface)
|
|||
clutter_stage_window_parent_iface = g_type_interface_peek_parent (iface);
|
||||
|
||||
iface->set_title = meta_stage_x11_set_title;
|
||||
iface->set_cursor_visible = meta_stage_x11_set_cursor_visible;
|
||||
iface->set_accept_focus = meta_stage_x11_set_accept_focus;
|
||||
iface->show = meta_stage_x11_show;
|
||||
iface->hide = meta_stage_x11_hide;
|
||||
|
|
|
@ -67,7 +67,6 @@ struct _MetaStageX11
|
|||
|
||||
MetaStageX11State wm_state;
|
||||
|
||||
guint is_cursor_visible : 1;
|
||||
guint viewport_initialized : 1;
|
||||
guint accept_focus : 1;
|
||||
};
|
||||
|
|
|
@ -227,7 +227,6 @@ test_devices_main (int argc, char **argv)
|
|||
stage = clutter_stage_new ();
|
||||
clutter_actor_set_background_color (stage, CLUTTER_COLOR_LightSkyBlue);
|
||||
clutter_stage_set_title (CLUTTER_STAGE (stage), "Devices");
|
||||
clutter_stage_hide_cursor (CLUTTER_STAGE (stage));
|
||||
g_signal_connect (stage,
|
||||
"destroy", G_CALLBACK (clutter_main_quit),
|
||||
NULL);
|
||||
|
|
Loading…
Reference in a new issue