[gnome-shell] Use St.Button for preview close buttons



commit 0770fd5be53c42a3dfd8403a49d4b2e01d4ae5cf
Author: Florian Müllner <fmuellner src gnome org>
Date:   Thu Feb 18 05:15:10 2010 +0100

    Use St.Button for preview close buttons
    
    Originally, we used St.Bin for the preview close buttons - using
    St.Button instead adds support for pseudo classes to style different
    button states.

 js/ui/workspace.js |   14 ++++++--------
 1 files changed, 6 insertions(+), 8 deletions(-)
---
diff --git a/js/ui/workspace.js b/js/ui/workspace.js
index c91ea12..3af8c71 100644
--- a/js/ui/workspace.js
+++ b/js/ui/workspace.js
@@ -371,22 +371,20 @@ WindowOverlay.prototype = {
                 this.title.text = w.title;
             }));
 
-        let button = new St.Bin({ style_class: "window-close",
-                                  reactive: true });
+        let button = new St.Button({ style_class: "window-close" });
         button.connect('style-changed',
                        Lang.bind(this, this._onStyleChanged));
         button._overlap = 0;
 
+        this._idleToggleCloseId = 0;
+        button.connect('clicked', Lang.bind(this, this._closeWindow));
+
         windowClone.actor.connect('destroy', Lang.bind(this, this._onDestroy));
         windowClone.actor.connect('enter-event',
                                   Lang.bind(this, this._onEnter));
         windowClone.actor.connect('leave-event',
                                   Lang.bind(this, this._onLeave));
 
-        this._idleToggleCloseId = 0;
-        button.connect('button-release-event',
-                       Lang.bind(this, this._closeWindow));
-
         this._windowAddedId = 0;
         windowClone.connect('zoom-start', Lang.bind(this, this.hide));
         windowClone.connect('zoom-end', Lang.bind(this, this.show));
@@ -461,7 +459,7 @@ WindowOverlay.prototype = {
         title.set_position(Math.floor(titleX), Math.floor(titleY));
     },
 
-    _closeWindow: function(actor, event) {
+    _closeWindow: function(actor) {
         let metaWindow = this._windowClone.metaWindow;
         this._workspace = metaWindow.get_workspace();
 
@@ -469,7 +467,7 @@ WindowOverlay.prototype = {
                                                       Lang.bind(this,
                                                                 this._onWindowAdded));
 
-        metaWindow.delete(event.get_time());
+        metaWindow.delete(global.get_current_time());
     },
 
     _onWindowAdded: function(workspace, win) {



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