#1 Gala fixes for mutter 42 dependency issues
Closed 2 years ago by decathorpe. Opened 2 years ago by amz.
rpms/ amz/gala rawhide  into  rawhide

@@ -0,0 +1,202 @@ 

+ From c544150634911e4f7a294a3fdf64d765b6def4a6 Mon Sep 17 00:00:00 2001

+ From: =?UTF-8?q?Corentin=20No=C3=ABl?= <tintou@noel.tf>

+ Date: Fri, 22 Apr 2022 00:01:11 +0200

+ Subject: [PATCH] Use Clutter.Grab with Mutter 42

+ 

+ This is the new way of grabbing the keyboard input.

+ ---

+  lib/WindowManager.vala            |  5 ++++-

+  plugins/pip/SelectionArea.vala    |  2 +-

+  src/Widgets/MultitaskingView.vala |  2 +-

+  src/Widgets/PixelPicker.vala      |  2 +-

+  src/Widgets/ScreenShield.vala     |  2 +-

+  src/Widgets/SelectionArea.vala    |  2 +-

+  src/Widgets/WindowOverview.vala   |  2 +-

+  src/Widgets/WindowSwitcher.vala   |  2 +-

+  src/WindowManager.vala            | 18 ++++++++++++++----

+  vapi/mutter-clutter.vapi          |  2 +-

+  10 files changed, 26 insertions(+), 13 deletions(-)

+ 

+ diff --git a/lib/WindowManager.vala b/lib/WindowManager.vala

+ index 08f29eabc..199731ce9 100644

+ --- a/lib/WindowManager.vala

+ +++ b/lib/WindowManager.vala

+ @@ -60,6 +60,9 @@ namespace Gala {

+       * to end your modal mode again with {@link WindowManager.pop_modal}

+       */

+      public class ModalProxy : Object {

+ +#if HAS_MUTTER42

+ +        public Clutter.Grab? grab { get; set; }

+ +#endif

+          /**

+           * A function which is called whenever a keybinding is pressed. If you supply a custom

+           * one you can filter out those that'd you like to be passed through and block all others.

+ @@ -132,7 +135,7 @@ namespace Gala {

+           * @return a {@link ModalProxy} which is needed to end the modal mode again and provides some

+           *         some basic control on the behavior of the window manager while it is in modal mode.

+           */

+ -        public abstract ModalProxy push_modal ();

+ +        public abstract ModalProxy push_modal (Clutter.Actor actor);

+  

+          /**

+           * May exit the modal mode again, unless another component has called {@link push_modal}

+ diff --git a/plugins/pip/SelectionArea.vala b/plugins/pip/SelectionArea.vala

+ index 5eb1d2718..7a7e7b82e 100644

+ --- a/plugins/pip/SelectionArea.vala

+ +++ b/plugins/pip/SelectionArea.vala

+ @@ -129,7 +129,7 @@ public class Gala.Plugins.PIP.SelectionArea : Clutter.Actor {

+          wm.get_display ().set_cursor (Meta.Cursor.CROSSHAIR);

+          grab_key_focus ();

+  

+ -        modal_proxy = wm.push_modal ();

+ +        modal_proxy = wm.push_modal (this);

+      }

+  

+      private void get_selection_rectangle (out int x, out int y, out int width, out int height) {

+ diff --git a/src/Widgets/MultitaskingView.vala b/src/Widgets/MultitaskingView.vala

+ index ba1364ae0..cfaa9ff29 100644

+ --- a/src/Widgets/MultitaskingView.vala

+ +++ b/src/Widgets/MultitaskingView.vala

+ @@ -592,7 +592,7 @@ namespace Gala {

+              }

+  

+              if (opening) {

+ -                modal_proxy = wm.push_modal ();

+ +                modal_proxy = wm.push_modal (this);

+                  modal_proxy.set_keybinding_filter (keybinding_filter);

+  

+                  wm.background_group.hide ();

+ diff --git a/src/Widgets/PixelPicker.vala b/src/Widgets/PixelPicker.vala

+ index 0490f5764..649ee7661 100644

+ --- a/src/Widgets/PixelPicker.vala

+ +++ b/src/Widgets/PixelPicker.vala

+ @@ -83,7 +83,7 @@ namespace Gala {

+              wm.get_display ().set_cursor (Meta.Cursor.CROSSHAIR);

+              grab_key_focus ();

+  

+ -            modal_proxy = wm.push_modal ();

+ +            modal_proxy = wm.push_modal (this);

+          }

+  

+          public void get_point (out int x, out int y) {

+ diff --git a/src/Widgets/ScreenShield.vala b/src/Widgets/ScreenShield.vala

+ index 05e55aad4..ce873f8a7 100644

+ --- a/src/Widgets/ScreenShield.vala

+ +++ b/src/Widgets/ScreenShield.vala

+ @@ -334,7 +334,7 @@ namespace Gala {

+              wm.get_display ().get_cursor_tracker ().set_pointer_visible (false);

+              visible = true;

+              grab_key_focus ();

+ -            modal_proxy = wm.push_modal ();

+ +            modal_proxy = wm.push_modal (this);

+  

+              if (animate) {

+                  animate_and_lock (animation_time);

+ diff --git a/src/Widgets/SelectionArea.vala b/src/Widgets/SelectionArea.vala

+ index d3053f00a..f776c4b73 100644

+ --- a/src/Widgets/SelectionArea.vala

+ +++ b/src/Widgets/SelectionArea.vala

+ @@ -127,7 +127,7 @@ namespace Gala {

+              wm.get_display ().set_cursor (Meta.Cursor.CROSSHAIR);

+              grab_key_focus ();

+  

+ -            modal_proxy = wm.push_modal ();

+ +            modal_proxy = wm.push_modal (this);

+          }

+  

+          public void get_selection_rectangle (out int x, out int y, out int width, out int height) {

+ diff --git a/src/Widgets/WindowOverview.vala b/src/Widgets/WindowOverview.vala

+ index d17497ac0..ba55323ab 100644

+ --- a/src/Widgets/WindowOverview.vala

+ +++ b/src/Widgets/WindowOverview.vala

+ @@ -157,7 +157,7 @@ namespace Gala {

+  

+              grab_key_focus ();

+  

+ -            modal_proxy = wm.push_modal ();

+ +            modal_proxy = wm.push_modal (this);

+              modal_proxy.set_keybinding_filter (keybinding_filter);

+  

+              visible = true;

+ diff --git a/src/Widgets/WindowSwitcher.vala b/src/Widgets/WindowSwitcher.vala

+ index 9297d314f..847f2ced3 100644

+ --- a/src/Widgets/WindowSwitcher.vala

+ +++ b/src/Widgets/WindowSwitcher.vala

+ @@ -331,7 +331,7 @@ namespace Gala {

+          }

+  

+          void push_modal () {

+ -            modal_proxy = wm.push_modal ();

+ +            modal_proxy = wm.push_modal (this);

+              modal_proxy.set_keybinding_filter ((binding) => {

+                  // if it's not built-in, we can block it right away

+                  if (!binding.is_builtin ())

+ diff --git a/src/WindowManager.vala b/src/WindowManager.vala

+ index 0a23c9271..90a67b18c 100644

+ --- a/src/WindowManager.vala

+ +++ b/src/WindowManager.vala

+ @@ -664,7 +664,7 @@ namespace Gala {

+          /**

+           * {@inheritDoc}

+           */

+ -        public ModalProxy push_modal () {

+ +        public ModalProxy push_modal (Clutter.Actor actor) {

+              var proxy = new ModalProxy ();

+  

+              modal_stack.offer_head (proxy);

+ @@ -674,14 +674,20 @@ namespace Gala {

+                  return proxy;

+  

+              unowned Meta.Display display = get_display ();

+ +#if !HAS_MUTTER42

+              var time = display.get_current_time ();

+ +#endif

+  

+              update_input_area ();

+ -#if !HAS_MUTTER42

+ +#if HAS_MUTTER42

+ +            proxy.grab = stage.grab (actor);

+ +#else

+              begin_modal (0, time);

+  #endif

+  

+ -            display.disable_unredirect ();

+ +            if (modal_stack.size == 1) {

+ +                display.disable_unredirect ();

+ +            }

+  

+              return proxy;

+          }

+ @@ -695,6 +701,10 @@ namespace Gala {

+                  return;

+              }

+  

+ +#if HAS_MUTTER42

+ +            proxy.grab.dismiss ();

+ +#endif

+ +

+              if (is_modal ())

+                  return;

+  

+ @@ -712,7 +722,7 @@ namespace Gala {

+           * {@inheritDoc}

+           */

+          public bool is_modal () {

+ -            return (modal_stack.size > 0);

+ +            return !modal_stack.is_empty;

+          }

+  

+          /**

+ diff --git a/vapi/mutter-clutter.vapi b/vapi/mutter-clutter.vapi

+ index 0c364f83f..c2a63a093 100644

+ --- a/vapi/mutter-clutter.vapi

+ +++ b/vapi/mutter-clutter.vapi

+ @@ -7412,7 +7412,7 @@ namespace Clutter {

+  		[Version (since = "0.4")]

+  		public unowned string get_title ();

+  #if HAS_MUTTER42

+ -		public unowned Clutter.Grab grab (Clutter.Actor actor);

+ +		public Clutter.Grab grab (Clutter.Actor actor);

+  #endif

+  #if !HAS_MUTTER42

+  		[Version (since = "1.2")]

@@ -0,0 +1,107 @@ 

+ From c4a746e3bb8d5008f2bb4c43561f9ca1ab16abe8 Mon Sep 17 00:00:00 2001

+ From: Vishal Rao <vishalrao@gmail.com>

+ Date: Fri, 22 Apr 2022 14:41:20 +0530

+ Subject: [PATCH 1/4] Fix window switcher not focussing selected window upon

+  release key.

+ 

+ ---

+  src/Widgets/WindowSwitcher.vala | 2 +-

+  1 file changed, 1 insertion(+), 1 deletion(-)

+ 

+ diff --git a/src/Widgets/WindowSwitcher.vala b/src/Widgets/WindowSwitcher.vala

+ index 847f2ced..eae5eea9 100644

+ --- a/src/Widgets/WindowSwitcher.vala

+ +++ b/src/Widgets/WindowSwitcher.vala

+ @@ -344,7 +344,7 @@ namespace Gala {

+                      || name == "switch-windows" || name == "switch-windows-backward");

+              });

+  

+ -            grab_key_focus ();

+ +            get_stage ().grab (this);

+          }

+  

+          void close_switcher (uint32 time, bool cancel = false) {

+ 

+ From 220d260f1f29a0426ca1b47397672ccdd911c687 Mon Sep 17 00:00:00 2001

+ From: Vishal Rao <vishalrao@gmail.com>

+ Date: Fri, 22 Apr 2022 15:03:07 +0530

+ Subject: [PATCH 2/4] Remove extraneous grab.

+ 

+ ---

+  src/Widgets/WindowSwitcher.vala | 2 --

+  1 file changed, 2 deletions(-)

+ 

+ diff --git a/src/Widgets/WindowSwitcher.vala b/src/Widgets/WindowSwitcher.vala

+ index eae5eea9..27025c1d 100644

+ --- a/src/Widgets/WindowSwitcher.vala

+ +++ b/src/Widgets/WindowSwitcher.vala

+ @@ -343,8 +343,6 @@ namespace Gala {

+                  return !(name == "switch-applications" || name == "switch-applications-backward"

+                      || name == "switch-windows" || name == "switch-windows-backward");

+              });

+ -

+ -            get_stage ().grab (this);

+          }

+  

+          void close_switcher (uint32 time, bool cancel = false) {

+ 

+ From 9033dbe91b564b66f623f3e883067ecfa5378a99 Mon Sep 17 00:00:00 2001

+ From: Vishal Rao <vishalrao@gmail.com>

+ Date: Fri, 22 Apr 2022 16:59:34 +0530

+ Subject: [PATCH 3/4] Restore original code but with mutter version check.

+ 

+ ---

+  src/Widgets/WindowSwitcher.vala | 4 ++++

+  1 file changed, 4 insertions(+)

+ 

+ diff --git a/src/Widgets/WindowSwitcher.vala b/src/Widgets/WindowSwitcher.vala

+ index 27025c1d..9887f20d 100644

+ --- a/src/Widgets/WindowSwitcher.vala

+ +++ b/src/Widgets/WindowSwitcher.vala

+ @@ -308,6 +308,10 @@ namespace Gala {

+              if ((get_current_modifiers () & modifier_mask) == 0) {

+                  close_switcher (wm.get_display ().get_current_time ());

+              }

+ +

+ +#if !HAS_MUTTER42

+ +            grab_key_focus ();

+ +#endif

+          }

+  

+          void toggle_display (bool show) {

+ 

+ From 8c3258fa073cbaa345fa6bde46ffa4dbdd4f7244 Mon Sep 17 00:00:00 2001

+ From: Vishal Rao <vishalrao@gmail.com>

+ Date: Fri, 22 Apr 2022 17:01:35 +0530

+ Subject: [PATCH 4/4] Fix code location.

+ 

+ ---

+  src/Widgets/WindowSwitcher.vala | 8 ++++----

+  1 file changed, 4 insertions(+), 4 deletions(-)

+ 

+ diff --git a/src/Widgets/WindowSwitcher.vala b/src/Widgets/WindowSwitcher.vala

+ index 9887f20d..c1521e52 100644

+ --- a/src/Widgets/WindowSwitcher.vala

+ +++ b/src/Widgets/WindowSwitcher.vala

+ @@ -308,10 +308,6 @@ namespace Gala {

+              if ((get_current_modifiers () & modifier_mask) == 0) {

+                  close_switcher (wm.get_display ().get_current_time ());

+              }

+ -

+ -#if !HAS_MUTTER42

+ -            grab_key_focus ();

+ -#endif

+          }

+  

+          void toggle_display (bool show) {

+ @@ -347,6 +343,10 @@ namespace Gala {

+                  return !(name == "switch-applications" || name == "switch-applications-backward"

+                      || name == "switch-windows" || name == "switch-windows-backward");

+              });

+ +

+ +#if !HAS_MUTTER42

+ +            grab_key_focus ();

+ +#endif

+          }

+  

+          void close_switcher (uint32 time, bool cancel = false) {

file modified
+6
@@ -12,6 +12,12 @@ 

  # patch some default settings to better match Fedora

  Patch0:         0000-Modify-default-settings-for-Fedora.patch

  

+ # patch gala to use mutter 42's clutter grab

+ Patch1:         0001-Use-clutter-grab-with-mutter-42.patch

+ 

+ # patch bug with alt-tab window switching

+ Patch2:         0002-Fix-for-alt-tab-switching.patch

+ 

  BuildRequires:  desktop-file-utils

  BuildRequires:  gettext

  BuildRequires:  libappstream-glib