[cinnamon] backport some menu fixes

leigh123linux leigh123linux at fedoraproject.org
Tue Jul 8 09:17:37 UTC 2014


commit c98b4b9024c84994f18ee5a698770cba62ceff5a
Author: leigh123linux <leigh123linux at googlemail.com>
Date:   Tue Jul 8 10:17:42 2014 +0100

    backport some menu fixes

 ...s-Filter-out-button-release-events-while-.patch |  148 ++++++++++++++++++++
 ...s-Recalculate-separator-widgets-when-the-.patch |   30 ++++
 cinnamon.spec                                      |    7 +-
 3 files changed, 184 insertions(+), 1 deletions(-)
---
diff --git a/0001-popupMenu.js-Filter-out-button-release-events-while-.patch b/0001-popupMenu.js-Filter-out-button-release-events-while-.patch
new file mode 100644
index 0000000..241d556
--- /dev/null
+++ b/0001-popupMenu.js-Filter-out-button-release-events-while-.patch
@@ -0,0 +1,148 @@
+From 0b7cbf894e27c22f12ad952dde885c550e405a00 Mon Sep 17 00:00:00 2001
+From: Michael Webster <miketwebster at gmail.com>
+Date: Fri, 27 Jun 2014 01:24:12 -0400
+Subject: [PATCH] popupMenu.js: Filter out button-release events while a popup
+ is opening, to avoid unintentional selection of popup items due to busy event
+ handling.
+
+Fixes #3294
+Fixes #3331
+Fixes #3116
+Fixes #3221
+---
+ .../cinnamon/applets/menu at cinnamon.org/applet.js   |  6 ++---
+ js/ui/main.js                                      | 11 +++++----
+ js/ui/popupMenu.js                                 | 28 +++++++++++++++++++++-
+ 3 files changed, 37 insertions(+), 8 deletions(-)
+
+diff --git a/files/usr/share/cinnamon/applets/menu at cinnamon.org/applet.js b/files/usr/share/cinnamon/applets/menu at cinnamon.org/applet.js
+index c9b7822..11e63d7 100644
+--- a/files/usr/share/cinnamon/applets/menu at cinnamon.org/applet.js
++++ b/files/usr/share/cinnamon/applets/menu at cinnamon.org/applet.js
+@@ -1672,7 +1672,7 @@ MyApplet.prototype = {
+                 this.selectedAppTitle.set_text("");
+                 this.selectedAppDescription.set_text("");
+             }));        
+-        button.actor.connect('clicked', Lang.bind(this, function() {            
++        button.actor.connect('button-release-event', Lang.bind(this, function() {            
+             this.menu.close();
+             
+             let screensaver_settings = new Gio.Settings({ schema: "org.cinnamon.screensaver" });                        
+@@ -1702,7 +1702,7 @@ MyApplet.prototype = {
+                 this.selectedAppTitle.set_text("");
+                 this.selectedAppDescription.set_text("");
+             }));        
+-        button.actor.connect('clicked', Lang.bind(this, function() {            
++        button.actor.connect('button-release-event', Lang.bind(this, function() {            
+             this.menu.close();
+             this._session.LogoutRemote(0);
+         }));
+@@ -1719,7 +1719,7 @@ MyApplet.prototype = {
+                 this.selectedAppTitle.set_text("");
+                 this.selectedAppDescription.set_text("");
+             }));        
+-        button.actor.connect('clicked', Lang.bind(this, function() {            
++        button.actor.connect('button-release-event', Lang.bind(this, function() {            
+             this.menu.close();
+             this._session.ShutdownRemote();
+         }));
+diff --git a/js/ui/main.js b/js/ui/main.js
+index 658d382..85f3a73 100644
+--- a/js/ui/main.js
++++ b/js/ui/main.js
+@@ -137,6 +137,8 @@ let software_rendering = false;
+ let lg_log_file;
+ let can_log = false;
+ 
++let popup_rendering = false;
++
+ // Override Gettext localization
+ const Gettext = imports.gettext;
+ Gettext.bindtextdomain('cinnamon', '/usr/share/cinnamon/locale');
+@@ -378,7 +380,7 @@ function start() {
+ 
+     _startDate = new Date();
+ 
+-    global.stage.connect('captured-event', _globalKeyPressHandler);
++    global.stage.connect('captured-event', _stageEventHandler);
+ 
+     global.log('loaded at ' + _startDate);
+     log('Cinnamon started at ' + _startDate);
+@@ -1058,11 +1060,12 @@ function getWindowActorsForWorkspace(workspaceIndex) {
+ // are disabled with a global grab. (When there is a global grab, then
+ // all key events will be delivered to the stage, so ::captured-event
+ // on the stage can be used for global keybindings.)
+-function _globalKeyPressHandler(actor, event) {
++function _stageEventHandler(actor, event) {
+     if (modalCount == 0)
+         return false;
+-    if (event.type() != Clutter.EventType.KEY_PRESS)
+-        return false;
++    if (event.type() != Clutter.EventType.KEY_PRESS) {
++        return popup_rendering && event.type() == Clutter.EventType.BUTTON_RELEASE;
++    }
+ 
+     let symbol = event.get_key_symbol();
+     let keyCode = event.get_key_code();
+diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js
+index 13dca48..a2e81ed 100644
+--- a/js/ui/popupMenu.js
++++ b/js/ui/popupMenu.js
+@@ -1179,6 +1179,9 @@ PopupMenu.prototype = {
+         this._boxWrapper.add_actor(this.box);
+         this.actor.add_style_class_name('popup-menu');
+ 
++        this.paint_id = 0;
++        this.paint_count = 0;
++        this.animating = false;
+         global.focus_manager.add_group(this.actor);
+         this.actor.reactive = true;
+     },
+@@ -1234,6 +1237,13 @@ PopupMenu.prototype = {
+         if (this.isOpen)
+             return;
+ 
++        Main.popup_rendering = true;
++
++        if (animate)
++            this.animating = animate;
++        else
++            this.animating = false;
++
+         this.setMaxHeight();
+ 
+         this.isOpen = true;
+@@ -1243,13 +1253,29 @@ PopupMenu.prototype = {
+         global.menuStackLength += 1;
+ 
+         this._boxPointer.setPosition(this.sourceActor, this._arrowAlignment);
+-        this._boxPointer.show(animate);
++
++        this.paint_id = this.actor.connect("paint", Lang.bind(this, this.on_paint));
++
++        this._boxPointer.show(animate, Lang.bind(this, function () {
++            this.animating = false;
++        }));
+ 
+         this.actor.raise_top();
+ 
+         this.emit('open-state-changed', true);
+     },
+ 
++    on_paint: function(actor) {
++        if (this.paint_count < 2 || this.animating) {
++            this.paint_count++;
++            return;
++        }
++
++        this.actor.disconnect(this.paint_id);
++        this.paint_count = 0;
++        Main.popup_rendering = false;
++    },
++
+     // Setting the max-height won't do any good if the minimum height of the
+     // menu is higher then the screen; it's useful if part of the menu is
+     // scrollable so the minimum height is smaller than the natural height
+-- 
+1.9.3
+
diff --git a/0001-popupMenu.js-Recalculate-separator-widgets-when-the-.patch b/0001-popupMenu.js-Recalculate-separator-widgets-when-the-.patch
new file mode 100644
index 0000000..d73c2d2
--- /dev/null
+++ b/0001-popupMenu.js-Recalculate-separator-widgets-when-the-.patch
@@ -0,0 +1,30 @@
+From 1d07cf016ab68c7f21bba5f392ff158bd2907502 Mon Sep 17 00:00:00 2001
+From: Michael Webster <miketwebster at gmail.com>
+Date: Fri, 4 Jul 2014 14:02:51 -0400
+Subject: [PATCH] popupMenu.js - Recalculate separator widgets when the
+ allocation of the menu changes.
+
+Some popup menu actions that don't close the menu upon triggering can
+leave the menu in an inconsistent state.  This adds a listener to the
+menu's actor, any time a menu item is removed/hidden/shown/added, the
+separator widget visibilities are recalculated to make sure no two
+separators appear visible adjacent to one another.
+---
+ js/ui/popupMenu.js | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js
+index 41e8986..13dca48 100644
+--- a/js/ui/popupMenu.js
++++ b/js/ui/popupMenu.js
+@@ -1049,6 +1049,7 @@ PopupMenuBase.prototype = {
+             // open-state-changed isn't exactly that, but doing it in more
+             // precise ways would require a lot more bookkeeping.
+             this.connect('open-state-changed', Lang.bind(this, function() { this._updateSeparatorVisibility(menuItem); }));
++            this.box.connect('allocation-changed', Lang.bind(this, function() { this._updateSeparatorVisibility(menuItem); }));
+         } else if (menuItem instanceof PopupBaseMenuItem)
+             this._connectItemSignals(menuItem);
+         else
+-- 
+1.9.3
+
diff --git a/cinnamon.spec b/cinnamon.spec
index cb2a9d7..213aead 100644
--- a/cinnamon.spec
+++ b/cinnamon.spec
@@ -2,7 +2,7 @@
 
 Name:           cinnamon
 Version:        2.2.14
-Release:        2%{?dist}
+Release:        3%{?dist}
 Summary:        Window management and application launching for GNOME
 License:        GPLv2+ and LGPLv2+
 URL:            http://cinnamon.linuxmint.com 
@@ -31,6 +31,8 @@ Patch5:         remove_bluetootoh.patch
 Patch6:         set_wheel.patch
 Patch7:         0001-Touchpad-Added-support-for-2-and-3-finger-clicks.patch
 Patch8:         network-user-connections.patch
+Patch9:         0001-popupMenu.js-Recalculate-separator-widgets-when-the-.patch
+Patch10:        0001-popupMenu.js-Filter-out-button-release-events-while-.patch
 
 %global clutter_version 1.12.2
 %global cjs_version 2.2.1
@@ -255,6 +257,9 @@ fi
 %{_mandir}/man1/*
 
 %changelog
+* Tue Jul 08 2014 Leigh Scott <leigh123linux at googlemail.com> - 2.2.14-3
+- backport some menu fixes
+
 * Wed Jul 02 2014 Leigh Scott <leigh123linux at googlemail.com> - 2.2.14-2
 - add network applet patch for nm-applet changes
 


More information about the scm-commits mailing list