Merge lp:~charlesk/ido/lp-898611 into lp:ido/0.3

Proposed by Charles Kerr
Status: Merged
Approved by: Lars Karlitski
Approved revision: 104
Merged at revision: 104
Proposed branch: lp:~charlesk/ido/lp-898611
Merge into: lp:ido/0.3
Diff against target: 37 lines (+20/-0)
1 file modified
src/idoscalemenuitem.c (+20/-0)
To merge this branch: bzr merge lp:~charlesk/ido/lp-898611
Reviewer Review Type Date Requested Status
Lars Karlitski (community) Approve
Review via email: mp+97140@code.launchpad.net

Description of the change

The commit message in r104 says it all:

Alter mouse button 2 clicks to behave like mouse button 2 clicks for lp bug #898611.

This solution was taken from gvc-channel-bar.c in gnome-control-center. The idea of cribbing from g-c-c came from Christian Giordano in duplicate lp bug #932919 where he suggested "using the same behavior the volume slider has in the Sound System Settings."

To post a comment you must log in.
Revision history for this message
Lars Karlitski (larsu) wrote :

For the sake of consistency, I'd recommend not doing this kind of change in applications, but in gtk+ itself.

Approving anyway because this fixes a specific bug and changing gtk+ requires more thought. Also, the comment clearly states that this is a hack ;)

I've filed bug #953757 so that we don't lose track of the issue.

Good Work!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/idoscalemenuitem.c'
--- src/idoscalemenuitem.c 2012-03-10 06:04:36 +0000
+++ src/idoscalemenuitem.c 2012-03-13 04:34:18 +0000
@@ -217,6 +217,21 @@
217 priv->toggle_size = toggle_size;217 priv->toggle_size = toggle_size;
218}218}
219219
220static gboolean
221on_scale_button_press_or_release_event (GtkWidget * widget G_GNUC_UNUSED,
222 GdkEventButton * event,
223 gpointer unused G_GNUC_UNUSED)
224{
225 /* HACK: we want the behaviour you get with the middle button, so we
226 * mangle the event. clicking with other buttons moves the slider in
227 * step increments, clicking with the middle button moves the slider to
228 * the location of the click. */
229 if (event->button == 1)
230 event->button = 2;
231
232 return FALSE;
233}
234
220static void235static void
221ido_scale_menu_item_constructed (GObject *object)236ido_scale_menu_item_constructed (GObject *object)
222{237{
@@ -235,6 +250,11 @@
235 priv->scale = ido_range_new (adj, range_style);250 priv->scale = ido_range_new (adj, range_style);
236 g_object_ref (priv->scale);251 g_object_ref (priv->scale);
237 gtk_scale_set_draw_value (GTK_SCALE (priv->scale), FALSE);252 gtk_scale_set_draw_value (GTK_SCALE (priv->scale), FALSE);
253 g_signal_connect (G_OBJECT (priv->scale), "button-press-event",
254 G_CALLBACK (on_scale_button_press_or_release_event), NULL);
255 g_signal_connect (G_OBJECT (priv->scale), "button-release-event",
256 G_CALLBACK (on_scale_button_press_or_release_event), NULL);
257
238 258
239#ifdef USE_GTK3259#ifdef USE_GTK3
240 hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);260 hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);

Subscribers

People subscribed via source and target branches