[Xfce4-commits] <exo:stephan/icon-bar-improvements> Add rudimentary support for release-activation
Stephan Arts
noreply at xfce.org
Sun Jan 29 22:14:03 CET 2012
Updating branch refs/heads/stephan/icon-bar-improvements
to 421c9dfec322fc34a8b8ce049007b60a1d20296c (commit)
from 743e2dfc052b1d730e260976befa1a37d3eef260 (commit)
commit 421c9dfec322fc34a8b8ce049007b60a1d20296c
Author: Stephan Arts <stephan at xfce.org>
Date: Sun Jan 29 22:04:37 2012 +0100
Add rudimentary support for release-activation
exo/exo-icon-bar.c | 40 ++++++++++++++++++++++++++++++++--------
1 files changed, 32 insertions(+), 8 deletions(-)
diff --git a/exo/exo-icon-bar.c b/exo/exo-icon-bar.c
index 21e390a..22732a6 100644
--- a/exo/exo-icon-bar.c
+++ b/exo/exo-icon-bar.c
@@ -140,6 +140,8 @@ static gboolean exo_icon_bar_motion (GtkWidget *wid
GdkEventMotion *event);
static gboolean exo_icon_bar_button_press (GtkWidget *widget,
GdkEventButton *event);
+static gboolean exo_icon_bar_button_release (GtkWidget *widget,
+ GdkEventButton *event);
static void exo_icon_bar_set_adjustments (ExoIconBar *icon_bar,
GtkAdjustment *hadj,
GtkAdjustment *vadj);
@@ -210,6 +212,7 @@ struct _ExoIconBarPrivate
gint text_column;
ExoIconBarItem *active_item;
+ ExoIconBarItem *single_click_item;
ExoIconBarItem *cursor_item;
GList *items;
gint item_width;
@@ -264,6 +267,7 @@ exo_icon_bar_class_init (ExoIconBarClass *klass)
gtkwidget_class->leave_notify_event = exo_icon_bar_leave;
gtkwidget_class->motion_notify_event = exo_icon_bar_motion;
gtkwidget_class->button_press_event = exo_icon_bar_button_press;
+ gtkwidget_class->button_release_event = exo_icon_bar_button_release;
klass->set_scroll_adjustments = exo_icon_bar_set_adjustments;
@@ -840,24 +844,39 @@ static gboolean
exo_icon_bar_button_press (GtkWidget *widget,
GdkEventButton *event)
{
- ExoIconBarItem *item;
- ExoIconBar *icon_bar = EXO_ICON_BAR (widget);
+ ExoIconBar *icon_bar;
+ ExoIconBarItem *item;
- if (!GTK_WIDGET_HAS_FOCUS (widget))
+ icon_bar = EXO_ICON_BAR (widget);
+
+ if (G_UNLIKELY (!GTK_WIDGET_HAS_FOCUS (widget)))
gtk_widget_grab_focus (widget);
if (event->button == 1 && event->type == GDK_BUTTON_PRESS)
{
item = exo_icon_bar_get_item_at_pos (icon_bar, event->x, event->y);
- if (G_LIKELY (item != NULL && item != icon_bar->priv->active_item))
- {
- exo_icon_bar_set_active (icon_bar, item->index);
- }
+ icon_bar->priv->single_click_item = item;
}
-
return TRUE;
}
+static gboolean
+exo_icon_bar_button_release (GtkWidget *widget,
+ GdkEventButton *event)
+{
+ ExoIconBar *icon_bar;
+ ExoIconBarItem *item;
+
+ icon_bar = EXO_ICON_BAR (widget);
+
+ if (event->button == 1 && event->type == GDK_BUTTON_RELEASE)
+ {
+ item = exo_icon_bar_get_item_at_pos (icon_bar, event->x, event->y);
+ if (G_LIKELY (item != NULL && item != icon_bar->priv->active_item && item == icon_bar->priv->single_click_item))
+ exo_icon_bar_set_active (icon_bar, item->index);
+ }
+ return TRUE;
+}
static void
@@ -1259,6 +1278,11 @@ exo_icon_bar_calculate_item_size (ExoIconBar *icon_bar,
item->height = item->layout_height + 2 * (focus_width + focus_pad + ICON_TEXT_PADDING)
+ item->pixbuf_height;
+ if (item->width < item->height)
+ {
+ item->width = item->height;
+ }
+
}
More information about the Xfce4-commits
mailing list