aboutsummaryrefslogtreecommitdiff
path: root/src/idoscalemenuitem.c
diff options
context:
space:
mode:
authorRobert Carr <racarr@canonical.com>2011-09-02 14:54:40 -0400
committerRobert Carr <racarr@canonical.com>2011-09-02 14:54:40 -0400
commit8de6cb9023955fbc1034062aa2f46bdd1598ac8b (patch)
treed7b9cb16262490b4a8600972079d3bbd1cc2e929 /src/idoscalemenuitem.c
parent0b3ce25c4bebb38f0845c0a0e983b3cc91ff13ce (diff)
downloadayatana-ido-8de6cb9023955fbc1034062aa2f46bdd1598ac8b.tar.gz
ayatana-ido-8de6cb9023955fbc1034062aa2f46bdd1598ac8b.tar.bz2
ayatana-ido-8de6cb9023955fbc1034062aa2f46bdd1598ac8b.zip
Implement an IdoOffscreenProxy object to work around GtkRange/Scale needing grabs, change IdoScaleMenuItem to make use of this. Fixes lp: #804009
Diffstat (limited to 'src/idoscalemenuitem.c')
-rw-r--r--src/idoscalemenuitem.c32
1 files changed, 20 insertions, 12 deletions
diff --git a/src/idoscalemenuitem.c b/src/idoscalemenuitem.c
index 8b9e1ac..1f0881a 100644
--- a/src/idoscalemenuitem.c
+++ b/src/idoscalemenuitem.c
@@ -26,6 +26,7 @@
#include <gtk/gtk.h>
#include "idorange.h"
#include "idoscalemenuitem.h"
+#include "idooffscreenproxy.h"
#include "idotypebuiltins.h"
static void ido_scale_menu_item_set_property (GObject *object,
@@ -57,6 +58,7 @@ static void update_packing (IdoScaleMenuItem
struct _IdoScaleMenuItemPrivate {
GtkWidget *scale;
+ GtkWidget *proxy;
GtkAdjustment *adjustment;
GtkWidget *primary_image;
GtkWidget *secondary_image;
@@ -226,6 +228,12 @@ ido_scale_menu_item_constructed (GObject *object)
priv->scale = ido_range_new (adj, range_style);
g_object_ref (priv->scale);
gtk_scale_set_draw_value (GTK_SCALE (priv->scale), FALSE);
+
+ gtk_widget_set_can_focus (priv->scale, FALSE);
+
+ priv->proxy = ido_offscreen_proxy_new ();
+ g_object_ref (priv->proxy);
+ gtk_container_add (GTK_CONTAINER (priv->proxy), priv->scale);
hbox = gtk_hbox_new (FALSE, 0);
@@ -338,23 +346,23 @@ update_packing (IdoScaleMenuItem *self, IdoScaleMenuItemStyle style, IdoScaleMen
switch (old_style)
{
case IDO_SCALE_MENU_ITEM_STYLE_NONE:
- gtk_container_remove (container, priv->scale);
+ gtk_container_remove (container, priv->proxy);
break;
case IDO_SCALE_MENU_ITEM_STYLE_IMAGE:
gtk_container_remove (container, priv->primary_image);
gtk_container_remove (container, priv->secondary_image);
- gtk_container_remove (container, priv->scale);
+ gtk_container_remove (container, priv->proxy);
break;
case IDO_SCALE_MENU_ITEM_STYLE_LABEL:
gtk_container_remove (container, priv->primary_label);
gtk_container_remove (container, priv->secondary_label);
- gtk_container_remove (container, priv->scale);
+ gtk_container_remove (container, priv->proxy);
break;
default:
- gtk_container_remove (container, priv->scale);
+ gtk_container_remove (container, priv->proxy);
break;
}
}
@@ -362,23 +370,23 @@ update_packing (IdoScaleMenuItem *self, IdoScaleMenuItemStyle style, IdoScaleMen
switch (style)
{
case IDO_SCALE_MENU_ITEM_STYLE_NONE:
- gtk_box_pack_start (GTK_BOX (priv->hbox), priv->scale, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (priv->hbox), priv->proxy, FALSE, FALSE, 0);
break;
case IDO_SCALE_MENU_ITEM_STYLE_IMAGE:
gtk_box_pack_start (GTK_BOX (priv->hbox), priv->primary_image, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (priv->hbox), priv->scale, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (priv->hbox), priv->proxy, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (priv->hbox), priv->secondary_image, FALSE, FALSE, 0);
break;
case IDO_SCALE_MENU_ITEM_STYLE_LABEL:
gtk_box_pack_start (GTK_BOX (priv->hbox), priv->primary_label, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (priv->hbox), priv->scale, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (priv->hbox), priv->proxy, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (priv->hbox), priv->secondary_label, FALSE, FALSE, 0);
break;
default:
- gtk_box_pack_start (GTK_BOX (priv->hbox), priv->scale, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (priv->hbox), priv->proxy, FALSE, FALSE, 0);
break;
}
@@ -480,12 +488,12 @@ ido_scale_menu_item_button_press_event (GtkWidget *menuitem,
translate_event_coordinates (menuitem, event->x_root, &x);
event->x_root = x;
- ubuntu_gtk_widget_set_has_grab (scale, TRUE);
+ // ubuntu_gtk_widget_set_has_grab (scale, TRUE);
- gtk_widget_event (scale,
+ gtk_widget_event (priv->scale,
((GdkEvent *)(void*)(event)));
- ubuntu_gtk_widget_set_has_grab (scale, FALSE);
+ // ubuntu_gtk_widget_set_has_grab (scale, FALSE);
if (!priv->grabbed)
{
@@ -493,7 +501,7 @@ ido_scale_menu_item_button_press_event (GtkWidget *menuitem,
g_signal_emit (menuitem, signals[SLIDER_GRABBED], 0);
}
- return TRUE;
+ return FALSE;
}
static gboolean