changeset 4135:07c1639b110b

the less calls to gdk_window_get_pointer the better
author Tomasz Mon <desowin@gmail.com>
date Sun, 30 Dec 2007 22:16:49 +0100
parents 3f1f84330007
children c1fd1dfaa53d
files src/audacious/ui_main.c src/audacious/ui_skinned_menurow.c src/audacious/ui_skinned_textbox.c
diffstat 3 files changed, 14 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/src/audacious/ui_main.c	Sun Dec 30 21:36:46 2007 +0100
+++ b/src/audacious/ui_main.c	Sun Dec 30 22:16:49 2007 +0100
@@ -1975,16 +1975,13 @@
 }
 
 static void
-mainwin_mr_release(GtkWidget *widget, MenuRowItem i)
+mainwin_mr_release(GtkWidget *widget, MenuRowItem i, GdkEventButton *event)
 {
-    GdkModifierType modmask;
-    gint x, y;
-
     switch (i) {
     case MENUROW_OPTIONS:
-        gdk_window_get_pointer(NULL, &x, &y, &modmask);
-        ui_manager_popup_menu_show(GTK_MENU(mainwin_view_menu), x, y, 1,
-                                GDK_CURRENT_TIME);
+        ui_manager_popup_menu_show(GTK_MENU(mainwin_view_menu),
+                                   event->x_root, event->y_root, 1,
+                                   event->time);
         break;
     case MENUROW_ALWAYS:
         gtk_toggle_action_set_active(
@@ -2002,8 +1999,9 @@
           UI_SKINNED_MENUROW(mainwin_menurow)->doublesize_selected );
         break;
     case MENUROW_VISUALIZATION:
-        gdk_window_get_pointer(NULL, &x, &y, &modmask);
-        ui_manager_popup_menu_show(GTK_MENU(mainwin_visualization_menu), x, y, 1, GDK_CURRENT_TIME);
+        ui_manager_popup_menu_show(GTK_MENU(mainwin_visualization_menu),
+                                   event->x_root, event->y_root, 1,
+                                   event->time);
         break;
     case MENUROW_NONE:
         break;
@@ -2296,10 +2294,8 @@
      playlist_fileinfo_current(playlist_get_active());
 }
 
-static void mainwin_info_right_clicked_cb(void) {
-     gint x, y;
-     gdk_window_get_pointer(NULL, &x, &y, NULL);
-     ui_manager_popup_menu_show(GTK_MENU(mainwin_songname_menu), x, y, 3, GDK_CURRENT_TIME);
+static void mainwin_info_right_clicked_cb(GtkWidget *widget, GdkEventButton *event) {
+     ui_manager_popup_menu_show(GTK_MENU(mainwin_songname_menu), event->x_root, event->y_root, 3, event->time);
 }
 
 static void
@@ -2408,7 +2404,7 @@
     ui_skinned_textbox_set_scroll(mainwin_info, cfg.autoscroll);
     ui_skinned_textbox_set_xfont(mainwin_info, !cfg.mainwin_use_bitmapfont, cfg.mainwin_font);
     g_signal_connect(mainwin_info, "double-clicked", mainwin_info_double_clicked_cb, NULL);
-    g_signal_connect(mainwin_info, "right-clicked", mainwin_info_right_clicked_cb, NULL);
+    g_signal_connect(mainwin_info, "right-clicked", G_CALLBACK(mainwin_info_right_clicked_cb), NULL);
 
     mainwin_othertext = ui_skinned_textbox_new(SKINNED_WINDOW(mainwin)->fixed, 112, 43, 153, 1, SKIN_TEXT);
 
--- a/src/audacious/ui_skinned_menurow.c	Sun Dec 30 21:36:46 2007 +0100
+++ b/src/audacious/ui_skinned_menurow.c	Sun Dec 30 22:16:49 2007 +0100
@@ -109,7 +109,7 @@
     menurow_signals[RELEASE] = 
         g_signal_new ("release", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
                       G_STRUCT_OFFSET (UiSkinnedMenurowClass, release), NULL, NULL,
-                      gtk_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
+                      g_cclosure_marshal_VOID__UINT_POINTER, G_TYPE_NONE, 2, G_TYPE_UINT, G_TYPE_POINTER);
 
 }
 
@@ -311,7 +311,7 @@
             menurow->doublesize_selected = !menurow->doublesize_selected;
 
         if ((int)(menurow->selected) != -1)
-            g_signal_emit_by_name(widget, "release", menurow->selected);
+            g_signal_emit_by_name(widget, "release", menurow->selected, event);
 
         menurow->selected = MENUROW_NONE;
         gtk_widget_queue_draw(widget);
--- a/src/audacious/ui_skinned_textbox.c	Sun Dec 30 21:36:46 2007 +0100
+++ b/src/audacious/ui_skinned_textbox.c	Sun Dec 30 22:16:49 2007 +0100
@@ -145,7 +145,7 @@
     textbox_signals[RIGHT_CLICKED] = 
         g_signal_new ("right-clicked", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
                       G_STRUCT_OFFSET (UiSkinnedTextboxClass, right_clicked), NULL, NULL,
-                      gtk_marshal_VOID__VOID, G_TYPE_NONE, 0);
+                      gtk_marshal_VOID__POINTER, G_TYPE_NONE, 1, G_TYPE_POINTER);
 
     textbox_signals[DOUBLED] = 
         g_signal_new ("toggle-double-size", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
@@ -365,7 +365,7 @@
                 g_signal_emit(widget, textbox_signals[CLICKED], 0);
 
         } else if (event->button == 3) {
-            g_signal_emit(widget, textbox_signals[RIGHT_CLICKED], 0);
+            g_signal_emit(widget, textbox_signals[RIGHT_CLICKED], 0, event);
         } else
             priv->is_dragging = FALSE;
     } else if (event->type == GDK_2BUTTON_PRESS) {