changeset 4554:961906c766e4

introduce ui_skinned_window_button_press and ui_skinned_window_button_release
author Tomasz Mon <desowin@gmail.com>
date Sun, 18 May 2008 16:54:22 +0200
parents 47cc110bef0c
children 87b537f1e92e 332d2992e04c
files src/audacious/ui_equalizer.c src/audacious/ui_main.c src/audacious/ui_playlist.c src/audacious/ui_skinned_window.c
diffstat 4 files changed, 30 insertions(+), 33 deletions(-) [+]
line wrap: on
line diff
--- a/src/audacious/ui_equalizer.c	Sun May 18 16:06:33 2008 +0200
+++ b/src/audacious/ui_equalizer.c	Sun May 18 16:54:22 2008 +0200
@@ -227,35 +227,21 @@
 equalizerwin_press(GtkWidget * widget, GdkEventButton * event,
                    gpointer callback_data)
 {
-    if (event->button == 1 && event->type == GDK_BUTTON_PRESS &&
-        (cfg.easy_move || cfg.equalizer_shaded || event->y < 14)) {
-         dock_move_press(get_dock_window_list(), GTK_WINDOW(equalizerwin), event,
-                         FALSE);
-    }
-    else if (event->button == 1 && event->type == GDK_2BUTTON_PRESS
+    if (event->button == 1 && event->type == GDK_2BUTTON_PRESS
              && event->y < 14) {
         equalizerwin_set_shade(!cfg.equalizer_shaded);
         if (dock_is_moving(GTK_WINDOW(equalizerwin)))
             dock_move_release(GTK_WINDOW(equalizerwin));
+        return TRUE;
     }
-    else if (event->button == 3) {
+    if (event->button == 3) {
         /*
          * Pop up the main menu a few pixels down to avoid
          * anything to be selected initially.
          */
        ui_manager_popup_menu_show(GTK_MENU(mainwin_general_menu), event->x_root,
                                 event->y_root + 2, 3, event->time);
-    }
-
-    return FALSE;
-}
-
-static gboolean
-equalizerwin_release(GtkWidget * widget,
-                     GdkEventButton * event, gpointer callback_data)
-{
-    if (dock_is_moving(GTK_WINDOW(equalizerwin))) {
-        dock_move_release(GTK_WINDOW(equalizerwin));
+       return TRUE;
     }
 
     return FALSE;
@@ -544,8 +530,6 @@
                      G_CALLBACK(equalizerwin_delete), NULL);
     g_signal_connect(equalizerwin, "button_press_event",
                      G_CALLBACK(equalizerwin_press), NULL);
-    g_signal_connect(equalizerwin, "button_release_event",
-                     G_CALLBACK(equalizerwin_release), NULL);
     g_signal_connect(equalizerwin, "key_press_event",
                      G_CALLBACK(equalizerwin_keypress), NULL);
 }
--- a/src/audacious/ui_main.c	Sun May 18 16:06:33 2008 +0200
+++ b/src/audacious/ui_main.c	Sun May 18 16:54:22 2008 +0200
@@ -775,15 +775,11 @@
         event->y /= cfg.scale_factor;
     }
 
-    if (event->button == 1 && event->type == GDK_BUTTON_PRESS &&
-        (cfg.easy_move || event->y < 14)) {
-        dock_move_press(get_dock_window_list(), GTK_WINDOW(mainwin), event,
-                        TRUE);
-    }
-    else if (event->button == 1 && event->type == GDK_2BUTTON_PRESS && event->y < 14) {
+    if (event->button == 1 && event->type == GDK_2BUTTON_PRESS && event->y < 14) {
         mainwin_set_shade(!cfg.player_shaded);
         if (dock_is_moving(GTK_WINDOW(mainwin)))
             dock_move_release(GTK_WINDOW(mainwin));
+        return TRUE;
     }
 
     if (event->button == 3) {
@@ -821,6 +817,7 @@
                                        event->x_root,
                                        event->y_root, 3, event->time);
         }
+        return TRUE;
     }
 
     return FALSE;
--- a/src/audacious/ui_playlist.c	Sun May 18 16:06:33 2008 +0200
+++ b/src/audacious/ui_playlist.c	Sun May 18 16:54:22 2008 +0200
@@ -373,15 +373,13 @@
     playlistwin_set_shade_menu(!cfg.playlist_shaded);
 }
 
-static void
+static gboolean
 playlistwin_release(GtkWidget * widget,
                     GdkEventButton * event,
                     gpointer callback_data)
 {
     playlistwin_resizing = FALSE;
-
-    if (dock_is_moving(GTK_WINDOW(playlistwin)))
-       dock_move_release(GTK_WINDOW(playlistwin));
+    return FALSE;
 }
 
 void
@@ -1051,8 +1049,7 @@
     else if (event->button == 1 && event->type == GDK_BUTTON_PRESS &&
              (cfg.easy_move || event->y < 14))
     {
-        dock_move_press(get_dock_window_list(), GTK_WINDOW(playlistwin), event,
-                        FALSE);
+        return FALSE;
     }
     else if (event->button == 1 && event->type == GDK_2BUTTON_PRESS
              && event->y < 14) {
@@ -1071,7 +1068,7 @@
                                 event->y_root + 2, 3, event->time);
     }
 
-    return FALSE;
+    return TRUE;
 }
 
 static gboolean
--- a/src/audacious/ui_skinned_window.c	Sun May 18 16:06:33 2008 +0200
+++ b/src/audacious/ui_skinned_window.c	Sun May 18 16:54:22 2008 +0200
@@ -101,6 +101,23 @@
     return val;
 }
 
+static gboolean ui_skinned_window_button_press(GtkWidget *widget, GdkEventButton *event) {
+    if (event->button == 1 && event->type == GDK_BUTTON_PRESS &&
+        (cfg.easy_move || cfg.equalizer_shaded || (event->y / cfg.scale_factor) < 14)) {
+         dock_move_press(get_dock_window_list(), GTK_WINDOW(widget),
+                         event, SKINNED_WINDOW(widget)->type == WINDOW_MAIN ? TRUE : FALSE);
+    }
+
+    return TRUE;
+}
+
+static gboolean ui_skinned_window_button_release(GtkWidget *widget, GdkEventButton *event) {
+    if (dock_is_moving(GTK_WINDOW(widget)))
+       dock_move_release(GTK_WINDOW(widget));
+
+    return TRUE;
+}
+
 static gboolean ui_skinned_window_expose(GtkWidget *widget, GdkEventExpose *event) {
     SkinnedWindow *window = SKINNED_WINDOW(widget);
 
@@ -177,6 +194,8 @@
     widget_class->expose_event = ui_skinned_window_expose;
     widget_class->focus_in_event = ui_skinned_window_focus_in;
     widget_class->focus_out_event = ui_skinned_window_focus_out;
+    widget_class->button_press_event = ui_skinned_window_button_press;
+    widget_class->button_release_event = ui_skinned_window_button_release;
     widget_class->map = ui_skinned_window_map;
 }