clutter: Simplify stage state management
Making this an event is overly convoluted, accounting that we emit the event, then convert it to a ClutterStage signal, then its only consumer (a11y) sets the active ATK state. Take the event out of the equation, unify activation/deactivation of the stage in MetaStage, and use it from the X11 backend too. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1623>
This commit is contained in:

committed by
Marge Bot

parent
96e320ba5a
commit
4a0c56f928
@@ -434,40 +434,13 @@ void
|
||||
meta_stage_set_active (MetaStage *stage,
|
||||
gboolean is_active)
|
||||
{
|
||||
ClutterEvent *event;
|
||||
|
||||
/* Used by the native backend to inform accessibility technologies
|
||||
* about when the stage loses and gains input focus.
|
||||
*
|
||||
* For the X11 backend, clutter transparently takes care of this
|
||||
* for us.
|
||||
*/
|
||||
|
||||
if (stage->is_active == is_active)
|
||||
return;
|
||||
|
||||
event = clutter_event_new (CLUTTER_STAGE_STATE);
|
||||
clutter_event_set_stage (event, CLUTTER_STAGE (stage));
|
||||
event->stage_state.changed_mask = CLUTTER_STAGE_STATE_ACTIVATED;
|
||||
|
||||
if (is_active)
|
||||
event->stage_state.new_state = CLUTTER_STAGE_STATE_ACTIVATED;
|
||||
|
||||
/* Emitting this StageState event will result in the stage getting
|
||||
* activated or deactivated (with the activated or deactivated signal
|
||||
* getting emitted from the stage)
|
||||
*
|
||||
* FIXME: This won't update ClutterStage's own notion of its
|
||||
* activeness. For that we would need to somehow trigger a
|
||||
* _clutter_stage_update_state call, which will probably
|
||||
* require new API in clutter. In practice, nothing relies
|
||||
* on the ClutterStage's own notion of activeness when using
|
||||
* the EGL backend.
|
||||
*
|
||||
* See http://bugzilla.gnome.org/746670
|
||||
*/
|
||||
clutter_stage_event (CLUTTER_STAGE (stage), event);
|
||||
clutter_event_free (event);
|
||||
g_signal_emit_by_name (CLUTTER_STAGE (stage), "activate");
|
||||
else
|
||||
g_signal_emit_by_name (CLUTTER_STAGE (stage), "deactivate");
|
||||
}
|
||||
|
||||
MetaStageWatch *
|
||||
|
@@ -26,6 +26,7 @@
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include "backends/meta-stage-private.h"
|
||||
#include "backends/x11/cm/meta-backend-x11-cm.h"
|
||||
#include "backends/x11/cm/meta-renderer-x11-cm.h"
|
||||
#include "backends/x11/meta-backend-x11.h"
|
||||
@@ -692,21 +693,11 @@ meta_stage_x11_translate_event (MetaStageX11 *stage_x11,
|
||||
break;
|
||||
|
||||
case FocusIn:
|
||||
if (!_clutter_stage_is_activated (stage_cogl->wrapper))
|
||||
{
|
||||
_clutter_stage_update_state (stage_cogl->wrapper,
|
||||
0,
|
||||
CLUTTER_STAGE_STATE_ACTIVATED);
|
||||
}
|
||||
meta_stage_set_active ((MetaStage *) stage_cogl->wrapper, TRUE);
|
||||
break;
|
||||
|
||||
case FocusOut:
|
||||
if (_clutter_stage_is_activated (stage_cogl->wrapper))
|
||||
{
|
||||
_clutter_stage_update_state (stage_cogl->wrapper,
|
||||
CLUTTER_STAGE_STATE_ACTIVATED,
|
||||
0);
|
||||
}
|
||||
meta_stage_set_active ((MetaStage *) stage_cogl->wrapper, FALSE);
|
||||
break;
|
||||
|
||||
case Expose:
|
||||
|
Reference in New Issue
Block a user