[gnome-documents] view: use gdk_event_get_coords()



commit 0d2eec26b17671b744cf4ee448d7b7406e669aab
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Sun Aug 28 15:18:57 2011 -0400

    view: use gdk_event_get_coords()
    
    Didn't find this accessor the first time I looked.

 src/lib/gd-utils.c |   21 ---------------------
 src/lib/gd-utils.h |    3 ---
 src/view.js        |    4 ++--
 3 files changed, 2 insertions(+), 26 deletions(-)
---
diff --git a/src/lib/gd-utils.c b/src/lib/gd-utils.c
index 52d5289..14f9b8a 100644
--- a/src/lib/gd-utils.c
+++ b/src/lib/gd-utils.c
@@ -284,24 +284,3 @@ gd_gdk_event_get_button (GdkEvent *event)
 
   return button_ev->button;
 }
-
-/**
- * gd_gdk_event_get_position:
- * @event:
- * @x: (out):
- * @y: (out):
- *
- */
-void
-gd_gdk_event_get_position (GdkEvent *event,
-                           gdouble *x,
-                           gdouble *y)
-{
-  GdkEventButton *button_ev = (GdkEventButton *) event;
-
-  if (x)
-    *x = button_ev->x;
-
-  if (y)
-    *y = button_ev->y;
-}
diff --git a/src/lib/gd-utils.h b/src/lib/gd-utils.h
index 18ad1f2..1c1a6b0 100644
--- a/src/lib/gd-utils.h
+++ b/src/lib/gd-utils.h
@@ -57,9 +57,6 @@ void gd_sidebar_store_set (GtkListStore *store,
                            gboolean heading);
 
 guint gd_gdk_event_get_button (GdkEvent *event);
-void  gd_gdk_event_get_position (GdkEvent *event,
-                                 gdouble *x,
-                                 gdouble *y);
 
 void gd_queue_thumbnail_job_for_file_async (GFile *file,
                                             GAsyncReadyCallback callback,
diff --git a/src/view.js b/src/view.js
index a567269..191fa92 100644
--- a/src/view.js
+++ b/src/view.js
@@ -118,13 +118,13 @@ View.prototype = {
 
     _onButtonRelease: function(view, event) {
         let button = Gd.gdk_event_get_button(event);
-        let position = Gd.gdk_event_get_position(event);
+        let coords = [ event.get_coords()[1] , event.get_coords()[2] ];
         let timestamp = event.get_time();
 
         if (button != 3)
             return false;
 
-        let path = this.getPathAtPos(position);
+        let path = this.getPathAtPos(coords);
         let iter = this._treeModel.get_iter(path)[1];
 
         let urn = this._treeModel.get_value(iter, Documents.ModelColumns.URN);



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