[gnome-shell/wip/focus-management: 7/8] layout: Don't use the input mode to block events to windows



commit 40b8e60ddfacc5b1923703a8d01e0aa5107e6862
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Sat May 18 19:06:50 2013 -0400

    layout: Don't use the input mode to block events to windows
    
    Instead, use the standard Clutter scene graph and our Chrome system.
    
    This also removes our last use of the input mode, so remove that as
    well.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=700735

 js/ui/layout.js    |   13 ++++++++---
 src/shell-global.c |   54 +--------------------------------------------------
 src/shell-global.h |    7 ------
 3 files changed, 11 insertions(+), 63 deletions(-)
---
diff --git a/js/ui/layout.js b/js/ui/layout.js
index e8dcf1d..6df7cb6 100644
--- a/js/ui/layout.js
+++ b/js/ui/layout.js
@@ -589,9 +589,13 @@ const LayoutManager = new Lang.Class({
     // screen. So, we set no_clear_hint at the end of the animation.
 
     _prepareStartupAnimation: function() {
-        // Set ourselves to FULLSCREEN input mode while the animation is running
-        // so events don't get delivered to X11 windows (which are distorted by the animation)
-        global.stage_input_mode = Shell.StageInputMode.FULLSCREEN;
+        // During the initial transition, add a simple actor to block all events,
+        // so they don't get delivered to X11 windows that have been transformed.
+        this._coverPane = new Clutter.Actor({ opacity: 0,
+                                              width: global.screen_width,
+                                              height: global.screen_height,
+                                              reactive: true });
+        this.addChrome(this._coverPane);
 
         if (Main.sessionMode.isGreeter) {
             this.panelBox.translation_y = -this.panelBox.height;
@@ -661,7 +665,8 @@ const LayoutManager = new Lang.Class({
         // we no longer need to clear the stage
         global.stage.no_clear_hint = true;
 
-        global.stage_input_mode = Shell.StageInputMode.NORMAL;
+        this._coverPane.destroy();
+        this._coverPane = null;
 
         this._systemBackground.actor.destroy();
         this._systemBackground = null;
diff --git a/src/shell-global.c b/src/shell-global.c
index 62e0f61..8e08a11 100644
--- a/src/shell-global.c
+++ b/src/shell-global.c
@@ -70,7 +70,6 @@ struct _ShellGlobal {
   GtkWindow *grab_notifier;
   gboolean gtk_grab_active;
 
-  ShellStageInputMode input_mode;
   XserverRegion input_region;
 
   GjsContext *js_context;
@@ -108,7 +107,6 @@ enum {
   PROP_SCREEN_WIDTH,
   PROP_SCREEN_HEIGHT,
   PROP_STAGE,
-  PROP_STAGE_INPUT_MODE,
   PROP_WINDOW_GROUP,
   PROP_TOP_WINDOW_GROUP,
   PROP_WINDOW_MANAGER,
@@ -143,9 +141,6 @@ shell_global_set_property(GObject         *object,
 
   switch (prop_id)
     {
-    case PROP_STAGE_INPUT_MODE:
-      shell_global_set_stage_input_mode (global, g_value_get_enum (value));
-      break;
     case PROP_SESSION_MODE:
       g_clear_pointer (&global->session_mode, g_free);
       global->session_mode = g_ascii_strdown (g_value_get_string (value), -1);
@@ -197,9 +192,6 @@ shell_global_get_property(GObject         *object,
     case PROP_STAGE:
       g_value_set_object (value, global->stage);
       break;
-    case PROP_STAGE_INPUT_MODE:
-      g_value_set_enum (value, global->input_mode);
-      break;
     case PROP_WINDOW_GROUP:
       g_value_set_object (value, meta_get_window_group_for_screen (global->meta_screen));
       break;
@@ -280,8 +272,6 @@ shell_global_init (ShellGlobal *global)
   g_signal_connect (global->grab_notifier, "grab-notify", G_CALLBACK (grab_notify), global);
   global->gtk_grab_active = FALSE;
 
-  global->input_mode = SHELL_STAGE_INPUT_MODE_NORMAL;
-
   global->sound_context = ca_gtk_context_get ();
   ca_context_change_props (global->sound_context,
                            CA_PROP_APPLICATION_NAME, "GNOME Shell",
@@ -420,14 +410,6 @@ shell_global_class_init (ShellGlobalClass *klass)
                                                         CLUTTER_TYPE_ACTOR,
                                                         G_PARAM_READABLE));
   g_object_class_install_property (gobject_class,
-                                   PROP_STAGE_INPUT_MODE,
-                                   g_param_spec_enum ("stage-input-mode",
-                                                      "Stage input mode",
-                                                      "The stage input mode",
-                                                      SHELL_TYPE_STAGE_INPUT_MODE,
-                                                      SHELL_STAGE_INPUT_MODE_NORMAL,
-                                                      G_PARAM_READWRITE));
-  g_object_class_install_property (gobject_class,
                                    PROP_WINDOW_GROUP,
                                    g_param_spec_object ("window-group",
                                                         "Window Group",
@@ -601,40 +583,13 @@ sync_input_region (ShellGlobal *global)
 
   if (global->gtk_grab_active)
     meta_empty_stage_input_region (screen);
-  else if (global->input_mode == SHELL_STAGE_INPUT_MODE_FULLSCREEN || !global->input_region || 
global->has_modal)
+  else if (global->has_modal)
     meta_set_stage_input_region (screen, None);
   else
     meta_set_stage_input_region (screen, global->input_region);
 }
 
 /**
- * shell_global_set_stage_input_mode:
- * @global: the #ShellGlobal
- * @mode: the stage input mode
- *
- * Sets the input mode of the stage; when @mode is
- * %SHELL_STAGE_INPUT_MODE_NORMAL, then the stage accepts clicks in
- * the region defined by shell_global_set_stage_input_region() but
- * passes through clicks outside that region. When it is
- * %SHELL_STAGE_INPUT_MODE_FULLSCREEN, the stage absorbs all input.
- *
- * Note that whenever a mutter-internal Gtk widget has a pointer grab,
- * the shell goes unresponsive and passes things to the underlying GTK+
- * widget to ensure that the widget gets any clicks it is expecting.
- */
-void
-shell_global_set_stage_input_mode (ShellGlobal         *global,
-                                   ShellStageInputMode  mode)
-{
-  if (mode == global->input_mode)
-    return;
-
-  global->input_mode = mode;
-  sync_input_region (global);
-  g_object_notify (G_OBJECT (global), "stage-input-mode");
-}
-
-/**
  * shell_global_set_cursor:
  * @global: A #ShellGlobal
  * @type: the type of the cursor
@@ -726,8 +681,7 @@ shell_global_unset_cursor (ShellGlobal  *global)
  * describing the input region.
  *
  * Sets the area of the stage that is responsive to mouse clicks when
- * the stage mode is %SHELL_STAGE_INPUT_MODE_NORMAL (but does not change the
- * current stage mode).
+ * we don't have a modal or grab.
  */
 void
 shell_global_set_stage_input_region (ShellGlobal *global,
@@ -1371,10 +1325,6 @@ shell_global_sync_pointer (ShellGlobal *global)
   event.type = CLUTTER_MOTION;
   event.time = shell_global_get_current_time (global);
   event.flags = 0;
-  /* This is wrong: we should be setting event.stage to NULL if the
-   * pointer is not inside the bounds of the stage given the current
-   * stage_input_mode. For our current purposes however, this works.
-   */
   event.stage = global->stage;
   event.x = x;
   event.y = y;
diff --git a/src/shell-global.h b/src/shell-global.h
index 7d61165..0e11cc7 100644
--- a/src/shell-global.h
+++ b/src/shell-global.h
@@ -47,13 +47,6 @@ void     shell_global_end_modal              (ShellGlobal         *global,
 void     shell_global_freeze_keyboard        (ShellGlobal         *global,
                                               guint32              timestamp);
 
-typedef enum {
-  SHELL_STAGE_INPUT_MODE_NORMAL,
-  SHELL_STAGE_INPUT_MODE_FULLSCREEN
-} ShellStageInputMode;
-
-void     shell_global_set_stage_input_mode   (ShellGlobal         *global,
-                                              ShellStageInputMode  mode);
 void     shell_global_set_stage_input_region (ShellGlobal         *global,
                                               GSList              *rectangles);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]