[maemo-commits] [maemo-commits] r10933 - projects/haf/trunk/hildon-desktop/libhildondesktop
From: subversion at stage.maemo.org subversion at stage.maemo.orgDate: Tue Apr 3 15:12:21 EEST 2007
- Previous message: [maemo-commits] r10932 - in projects/haf/trunk/hildon-theme-layout-4: . data
- Next message: [maemo-commits] r10934 - in projects/haf/trunk/gtkhtml: . debian upstream/patches
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Author: moimart
Date: 2007-04-03 15:12:19 +0300 (Tue, 03 Apr 2007)
New Revision: 10933
Modified:
projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-panel-expandable.c
Log:
* libhildondesktop/hildon-desktop-panel-expandable.c:
- Implemented grab/ungrab the focus and close for extension panel window.
* ChangeLog updated.
Modified: projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-panel-expandable.c
===================================================================
--- projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-panel-expandable.c 2007-04-03 11:17:02 UTC (rev 10932)
+++ projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-panel-expandable.c 2007-04-03 12:12:19 UTC (rev 10933)
@@ -105,7 +105,7 @@
static void hildon_desktop_panel_expandable_add_button (HildonDesktopPanel *panel, GtkWidget *widget);
-GObject *hildon_desktop_panel_expandable_constructor (GType gtype,guint n_params,GObjectConstructParam *params);
+static GObject *hildon_desktop_panel_expandable_constructor (GType gtype,guint n_params,GObjectConstructParam *params);
static void hildon_desktop_panel_expandable_finalize (GObject *object);
@@ -198,7 +198,84 @@
#endif
}
-GObject *
+static void
+hildon_desktop_panel_expandable_hide_extension (HildonDesktopPanelExpandable *panel)
+{
+ gdk_pointer_ungrab (GDK_CURRENT_TIME);
+ gdk_keyboard_ungrab (GDK_CURRENT_TIME);
+
+ g_object_set (panel->priv->arrow, "active", FALSE, NULL);
+
+ gtk_grab_remove (GTK_WIDGET (panel->priv->extension_window));
+
+ gtk_widget_hide (GTK_WIDGET (panel->priv->extension_window));
+}
+
+static gboolean
+hildon_desktop_panel_expandable_extension_winevent (GtkWidget *widget,
+ GdkEvent *event,
+ HildonDesktopPanelExpandable *panel)
+{
+ gboolean in_panel_area = FALSE,
+ in_button_area;
+ gint x,y,w,h;
+
+ if (!event)
+ return FALSE;
+
+ gtk_widget_get_pointer (widget, &x, &y);
+
+ w = widget->allocation.width;
+ h = widget->allocation.height;
+
+ /* Pointer on window popup area */
+ if ((x >= 0) && (x <= w) && (y >= 0) && (y <= h))
+ in_panel_area = TRUE;
+ else
+ if (panel->priv->extension_opened)
+ {
+ w = panel->priv->arrow->allocation.width;
+ h = panel->priv->arrow->allocation.height;
+
+ gtk_widget_get_pointer (panel->priv->arrow, &x, &y);
+
+ /* Pointer on button area */
+ if ((x >= 0) && (x <= w) && (y >= 0) && (y <= h))
+ in_button_area = TRUE;
+ }
+
+ /* Event outside of popup or in button area, close in clean way */
+ if (!in_panel_area || in_button_area)
+ hildon_desktop_panel_expandable_hide_extension (panel);
+
+ return TRUE;
+}
+
+static gboolean
+hildon_desktop_panel_expandable_grab_table_focus (GtkWidget *table_window,
+ GdkEventExpose *event,
+ HildonDesktopPanelExpandable *panel)
+{
+ (void)event;
+
+ if ((gdk_pointer_grab (table_window->window, TRUE,
+ GDK_BUTTON_PRESS_MASK |
+ GDK_BUTTON_RELEASE_MASK |
+ GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK |
+ GDK_POINTER_MOTION_MASK,
+ NULL, NULL,
+ GDK_CURRENT_TIME) == GDK_GRAB_SUCCESS ))
+ {
+ gtk_grab_add (table_window);
+ return TRUE;
+ }
+
+ hildon_desktop_panel_expandable_hide_extension (panel);
+
+ return FALSE;
+}
+
+static GObject *
hildon_desktop_panel_expandable_constructor (GType gtype,
guint n_params,
GObjectConstructParam *params)
@@ -239,6 +316,16 @@
G_CALLBACK (hildon_desktop_panel_expandable_resize_notify),
NULL);
+ g_signal_connect_after (panel->priv->extension_window,
+ "map-event",
+ G_CALLBACK (hildon_desktop_panel_expandable_grab_table_focus),
+ (gpointer)panel);
+
+ g_signal_connect (panel->priv->extension_window,
+ "button-release-event",
+ G_CALLBACK (hildon_desktop_panel_expandable_extension_winevent),
+ (gpointer)panel);
+
g_object_get (object, "item_width", &item_width, "item_height", &item_height, NULL);
if (item_width == 0 || item_height == 0)
@@ -665,7 +752,7 @@
}
else
{
- gtk_widget_hide (GTK_WIDGET (panel->priv->extension_window));
+ hildon_desktop_panel_expandable_hide_extension (panel);
}
}
- Previous message: [maemo-commits] r10932 - in projects/haf/trunk/hildon-theme-layout-4: . data
- Next message: [maemo-commits] r10934 - in projects/haf/trunk/gtkhtml: . debian upstream/patches
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
