summaryrefslogtreecommitdiff
path: root/gtk/gtkscalebutton.c
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2009-06-22 17:19:21 +0100
committerBastien Nocera <hadess@hadess.net>2009-06-22 17:25:21 +0100
commitb436f5b8a3c8ad0468d2420895fa97dc7c711969 (patch)
treebec5ecb524ca7a5fd63c28166f775018679bcbca /gtk/gtkscalebutton.c
parent515a0b61a173cbea511242823aa6e9418f5ca6ed (diff)
downloadgtk+-b436f5b8a3c8ad0468d2420895fa97dc7c711969.tar.gz
Bug 461944 – pressing the volume icon in full screen shuts down the sound
Don't pass the click on the button through to the scale when the dock popup will be moved, otherwise we could end up changing the sound in unexcepted ways (to zero for vertical popups at the bottom of the screen for example).
Diffstat (limited to 'gtk/gtkscalebutton.c')
-rw-r--r--gtk/gtkscalebutton.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/gtk/gtkscalebutton.c b/gtk/gtkscalebutton.c
index 628121e4c4..e159560423 100644
--- a/gtk/gtkscalebutton.c
+++ b/gtk/gtkscalebutton.c
@@ -927,7 +927,9 @@ gtk_scale_popup (GtkWidget *widget,
gdouble v;
GdkDisplay *display;
GdkScreen *screen;
+ gboolean is_moved;
+ is_moved = FALSE;
button = GTK_SCALE_BUTTON (widget);
priv = button->priv;
adj = priv->adjustment;
@@ -1004,15 +1006,24 @@ gtk_scale_popup (GtkWidget *widget,
else
x += button_event->x;
- if (y < rect.y)
+ /* Move the dock, but set is_moved so we
+ * don't forward the first click later on,
+ * as it could make the scale go to the bottom */
+ if (y < rect.y) {
y = rect.y;
- else if (y + d->allocation.height > rect.height + rect.y)
+ is_moved = TRUE;
+ } else if (y + d->allocation.height > rect.height + rect.y) {
y = rect.y + rect.height - d->allocation.height;
+ is_moved = TRUE;
+ }
- if (x < rect.x)
+ if (x < rect.x) {
x = rect.x;
- else if (x + d->allocation.width > rect.width + rect.x)
+ is_moved = TRUE;
+ } else if (x + d->allocation.width > rect.width + rect.x) {
x = rect.x + rect.width - d->allocation.width;
+ is_moved = TRUE;
+ }
}
gtk_window_move (GTK_WINDOW (priv->dock), x, y);
@@ -1043,7 +1054,7 @@ gtk_scale_popup (GtkWidget *widget,
gtk_widget_grab_focus (priv->dock);
- if (event->type == GDK_BUTTON_PRESS)
+ if (event->type == GDK_BUTTON_PRESS && !is_moved)
{
GdkEventButton *e;
GdkEventButton *button_event = (GdkEventButton *) event;