[gnome-shell] Use clutter_event_get_* instead of ShellGlobal



commit 37ee16b34da390c6639e6643765f92bfb6df411e
Author: Colin Walters <walters verbum org>
Date:   Tue Sep 8 16:58:57 2009 -0400

    Use clutter_event_get_* instead of ShellGlobal
    
    Before Clutter gained accessors for event information, we had
    shell_global_ functions.  Now that Clutter has them, use them and
    delete the ShellGlobal code.
    
    http://bugzilla.gnome.org/show_bug.cgi?id=594561

 js/ui/button.js       |    5 ++---
 js/ui/dash.js         |    2 +-
 js/ui/lookingGlass.js |    2 +-
 js/ui/main.js         |    4 ++--
 js/ui/panel.js        |    4 ++--
 js/ui/runDialog.js    |    2 +-
 js/ui/widgetBox.js    |    2 +-
 src/shell-global.c    |   41 -----------------------------------------
 src/shell-global.h    |    4 ----
 9 files changed, 10 insertions(+), 56 deletions(-)
---
diff --git a/js/ui/button.js b/js/ui/button.js
index 3cc5570..5fb5947 100644
--- a/js/ui/button.js
+++ b/js/ui/button.js
@@ -108,16 +108,15 @@ iconButton.prototype = {
         this.actor.set_opacity(0);
         parent.connect("enter-event", Lang.bind(this, function(actor, event) {
             this._shouldHide = false;
-
             // Nothing to do if the cursor has come back from a child of the parent actor
-            if (actor.get_children().indexOf(Shell.get_event_related(event)) != -1)
+            if (actor.get_children().indexOf(event.get_related()) != -1)
                 return;
 
             this._fadeIn();
         }));
         parent.connect("leave-event", Lang.bind(this, function(actor, event) {
             // Nothing to do if the cursor has merely entered a child of the parent actor
-            if (actor.get_children().indexOf(Shell.get_event_related(event)) != -1)
+            if (actor.get_children().indexOf(event.get_related()) != -1)
                 return;
 
             // Remember that we should not be visible to hide the button if forceShow is unset
diff --git a/js/ui/dash.js b/js/ui/dash.js
index db40361..f7f0658 100644
--- a/js/ui/dash.js
+++ b/js/ui/dash.js
@@ -641,7 +641,7 @@ Dash.prototype = {
         }));
         this._searchEntry.entry.connect('key-press-event', Lang.bind(this, function (se, e) {
             let text = this._searchEntry.getText();
-            let symbol = Shell.get_event_key_symbol(e);
+            let symbol = e.get_key_symbol();
             if (symbol == Clutter.Escape) {
                 // Escape will keep clearing things back to the desktop.
                 // If we are showing a particular section of search, go back to all sections.
diff --git a/js/ui/lookingGlass.js b/js/ui/lookingGlass.js
index dab0f52..120af32 100644
--- a/js/ui/lookingGlass.js
+++ b/js/ui/lookingGlass.js
@@ -418,7 +418,7 @@ LookingGlass.prototype = {
             return true;
         }));
         this._entry.connect('key-press-event', Lang.bind(this, function(o, e) {
-            let symbol = Shell.get_event_key_symbol(e);
+            let symbol = e.get_key_symbol();
             if (symbol == Clutter.Escape) {
                 this.close();
                 return true;
diff --git a/js/ui/main.js b/js/ui/main.js
index c331410..9df8be3 100644
--- a/js/ui/main.js
+++ b/js/ui/main.js
@@ -155,7 +155,7 @@ function _globalKeyPressHandler(actor, event) {
     let type = event.type();
 
     if (type == Clutter.EventType.KEY_PRESS) {
-        let symbol = Shell.get_event_key_symbol (event);
+        let symbol = event.get_key_symbol();
         if (symbol == Clutter.Print) {
             // We want to be able to take screenshots of the shell at all times
             let gconf = Shell.GConf.get_default();
@@ -169,7 +169,7 @@ function _globalKeyPressHandler(actor, event) {
             return true;
         }
     } else if (type == Clutter.EventType.KEY_RELEASE) {
-        let symbol = Shell.get_event_key_symbol (event);
+        let symbol = event.get_key_symbol();
         if (symbol == Clutter.Super_L || symbol == Clutter.Super_R) {
             // The super key is the default for triggering the overview, and should
             // get us out of the overview when we are already in it.
diff --git a/js/ui/panel.js b/js/ui/panel.js
index 4e969c0..3ef12c2 100644
--- a/js/ui/panel.js
+++ b/js/ui/panel.js
@@ -472,14 +472,14 @@ Panel.prototype = {
     },
 
     _onHotCornerLeft : function(actor, event) {
-        if (Shell.get_event_related(event) != this._hotCornerEnvirons) {
+        if (event.get_related() != this._hotCornerEnvirons) {
             this._hotCornerEntered = false;
         }
         return false;
     },
 
     _onHotCornerEnvironsLeft : function(actor, event) {
-        if (Shell.get_event_related(event) != this._hotCorner) {
+        if (event.get_related() != this._hotCorner) {
             this._hotCornerEntered = false;
         }
         return false;
diff --git a/js/ui/runDialog.js b/js/ui/runDialog.js
index c0d4b98..67d5b8b 100644
--- a/js/ui/runDialog.js
+++ b/js/ui/runDialog.js
@@ -132,7 +132,7 @@ RunDialog.prototype = {
         }));
 
         this._entry.connect('key-press-event', Lang.bind(this, function(o, e) {
-            let symbol = Shell.get_event_key_symbol(e); 
+            let symbol = e.get_key_symbol();
             if (symbol == Clutter.Escape) {
                 this.close();
                 return true;
diff --git a/js/ui/widgetBox.js b/js/ui/widgetBox.js
index 5eab6e5..e12dd73 100644
--- a/js/ui/widgetBox.js
+++ b/js/ui/widgetBox.js
@@ -296,7 +296,7 @@ WidgetBox.prototype = {
                     this.state == Widget.STATE_POPPING_OUT)) {
             // If moving into another actor within this._hbox, let the
             // event be propagated
-            let into = Shell.get_event_related(event);
+            let into = event.get_related();
             while (into) {
                 if (into == this._hbox)
                     return false;
diff --git a/src/shell-global.c b/src/shell-global.c
index f8eff40..7279570 100644
--- a/src/shell-global.c
+++ b/src/shell-global.c
@@ -296,47 +296,6 @@ shell_clutter_texture_set_from_pixbuf (ClutterTexture *texture,
 }
 
 /**
- * shell_get_event_key_symbol:
- *
- * Return value: Clutter key value for the key press and release events, 
- *               as specified in clutter-keysyms.h  
- */
-guint16
-shell_get_event_key_symbol(ClutterEvent *event)
-{
-  g_return_val_if_fail(event->type == CLUTTER_KEY_PRESS ||
-                       event->type == CLUTTER_KEY_RELEASE, 0);
-
-  return event->key.keyval;
-}
-
-/**
- * shell_get_button_event_click_count:
- *
- * Return value: click count for button press and release events
- */
-guint16
-shell_get_button_event_click_count(ClutterEvent *event)
-{
-  g_return_val_if_fail(event->type == CLUTTER_BUTTON_PRESS ||
-                       event->type == CLUTTER_BUTTON_RELEASE, 0);
-  return event->button.click_count;
-}
-
-/**
- * shell_get_event_related:
- *
- * Return value: (transfer none): related actor
- */
-ClutterActor *
-shell_get_event_related (ClutterEvent *event)
-{
-  g_return_val_if_fail (event->type == CLUTTER_ENTER ||
-                        event->type == CLUTTER_LEAVE, NULL);
-  return event->crossing.related;
-}
-
-/**
  * shell_global_get:
  *
  * Gets the singleton global object that represents the desktop.
diff --git a/src/shell-global.h b/src/shell-global.h
index 3cda07b..998fef2 100644
--- a/src/shell-global.h
+++ b/src/shell-global.h
@@ -36,10 +36,6 @@ GType            shell_global_get_type            (void) G_GNUC_CONST;
 gboolean shell_clutter_texture_set_from_pixbuf (ClutterTexture *texture,
                                                 GdkPixbuf      *pixbuf);
 
-guint16 shell_get_event_key_symbol(ClutterEvent *event);
-
-guint16 shell_get_button_event_click_count(ClutterEvent *event);
-
 ClutterActor *shell_get_event_related(ClutterEvent *event);
 
 ShellGlobal *shell_global_get (void);



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