diff src/audacious/ui_main.c @ 3600:aba660a4a15d trunk

Pop up playback menu if right clicked over playback-control widgets
author Tomasz Mon <desowin@gmail.com>
date Sun, 23 Sep 2007 15:36:35 +0200
parents 24ae9b303a9d
children 9e4edc01a0e3
line wrap: on
line diff
--- a/src/audacious/ui_main.c	Sat Sep 22 22:50:57 2007 +0300
+++ b/src/audacious/ui_main.c	Sun Sep 23 15:36:35 2007 +0200
@@ -371,17 +371,6 @@
                             1, GDK_CURRENT_TIME);
 }
 
-static void
-mainwin_about_cb(void)
-{
-    gint x, y;
-    gdk_window_get_pointer(NULL, &x, &y, NULL);
-    ui_manager_popup_menu_show(GTK_MENU(mainwin_general_menu),
-                            x + 6 * (1 + cfg.doublesize),
-                            y + MAINWIN_SHADED_HEIGHT * (1 + cfg.doublesize),
-                            1, GDK_CURRENT_TIME);
-}
-
 void
 mainwin_minimize_cb(void)
 {
@@ -860,6 +849,16 @@
 }
 
 static gboolean
+mainwin_widget_contained(GdkEventButton *event, int x, int y, int w, int h)
+{
+    if ((event->x > x && event->y > y) &&
+        (event->x < x+w && event->y < y+h))
+    return TRUE;
+
+    return FALSE;
+}
+
+static gboolean
 mainwin_mouse_button_press(GtkWidget * widget,
                            GdkEventButton * event,
                            gpointer callback_data)
@@ -887,7 +886,21 @@
     }
 
     if (event->button == 3) {
-        if ( (event->y > 70) && (event->x < 128) )
+        /* Pop up playback menu if right clicked over playback-control widgets,
+         * otherwise popup general menu
+         */
+        if (mainwin_widget_contained(event, bmp_active_skin->properties.mainwin_position_x,
+                                     bmp_active_skin->properties.mainwin_position_y, 248, 10) ||
+            mainwin_widget_contained(event, bmp_active_skin->properties.mainwin_previous_x,
+                                     bmp_active_skin->properties.mainwin_previous_y, 23, 18) ||
+            mainwin_widget_contained(event, bmp_active_skin->properties.mainwin_play_x,
+                                     bmp_active_skin->properties.mainwin_play_y, 23, 18) ||
+            mainwin_widget_contained(event, bmp_active_skin->properties.mainwin_pause_x,
+                                     bmp_active_skin->properties.mainwin_pause_y, 23, 18) ||
+            mainwin_widget_contained(event, bmp_active_skin->properties.mainwin_stop_x,
+                                     bmp_active_skin->properties.mainwin_stop_y, 23, 18) ||
+            mainwin_widget_contained(event, bmp_active_skin->properties.mainwin_next_x,
+                                     bmp_active_skin->properties.mainwin_next_y, 23, 18))
         {
 
             ui_manager_popup_menu_show(GTK_MENU(mainwin_playback_menu),
@@ -2477,7 +2490,6 @@
     mainwin_about = ui_skinned_button_new();
     ui_skinned_small_button_setup(mainwin_about, SKINNED_WINDOW(mainwin)->fixed, 247, 83, 20, 25);
     g_signal_connect(mainwin_about, "clicked", show_about_window, NULL);
-    g_signal_connect(mainwin_about, "right-clicked", mainwin_about_cb, NULL );
 
     mainwin_vis = ui_vis_new(SKINNED_WINDOW(mainwin)->fixed, 24, 43, 76);
     g_signal_connect(mainwin_vis, "button-press-event", G_CALLBACK(mainwin_vis_cb), NULL);