[maemo-commits] [maemo-commits] r13448 - in projects/haf/trunk/hildon-desktop: libhildondesktop src

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Wed Aug 29 12:02:32 EEST 2007
Author: lucasr
Date: 2007-08-29 12:02:29 +0300 (Wed, 29 Aug 2007)
New Revision: 13448

Modified:
   projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-popup-window.c
   projects/haf/trunk/hildon-desktop/src/hd-applications-menu.c
Log:
2007-08-29  Lucas Rocha  <lucas.rocha at nokia.com>

	* src/hd-applications-menu.c
	(hd_applications_menu_button_button_press,
	hd_applications_menu_init): popup the menu on button press instead of
	button release. Fixes NB#33935.
	* libhildondesktop/hildon-desktop-popup-window.c
	(hildon_desktop_popup_window_button_press_event): handle button
	press instead of button release for checking if the window should pop
	down.


Modified: projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-popup-window.c
===================================================================
--- projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-popup-window.c	2007-08-29 08:58:15 UTC (rev 13447)
+++ projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-popup-window.c	2007-08-29 09:02:29 UTC (rev 13448)
@@ -101,13 +101,13 @@
 						     		     GdkEventCrossing *event,
 						     		     HildonDesktopPopupWindow *popup);
 
-static gboolean hildon_desktop_popup_window_composited_button_release (GtkWidget *widget,
-		                                                       GdkEventButton *event,
-	                                                               HildonDesktopPopupWindow *popup);
+static gboolean hildon_desktop_popup_window_composited_button_press (GtkWidget *widget,
+		                                                     GdkEventButton *event,
+	                                                             HildonDesktopPopupWindow *popup);
 
 static gboolean popup_grab_on_window (GdkWindow *window, guint32 activate_time, gboolean grab_keyboard);
 
-static gboolean hildon_desktop_popup_window_button_release_event (GtkWidget *widget, GdkEventButton *event);
+static gboolean hildon_desktop_popup_window_button_press_event (GtkWidget *widget, GdkEventButton *event);
 #if defined (MAEMO_CHANGES) && defined(HAVE_XTEST)
 static void hildon_desktop_popup_menu_fake_button_event (GdkEventButton *event, gboolean press);
 #endif
@@ -178,7 +178,7 @@
 
   widget_class->motion_notify_event     = hildon_desktop_popup_window_motion_notify;
   widget_class->leave_notify_event      = hildon_desktop_popup_window_leave_notify;
-  widget_class->button_release_event    = hildon_desktop_popup_window_button_release_event;
+  widget_class->button_press_event    = hildon_desktop_popup_window_button_press_event;
   widget_class->key_press_event 	= hildon_desktop_popup_window_key_press_event;
 	  
   widget_class->realize    = hildon_desktop_popup_window_realize;
@@ -309,8 +309,8 @@
 		    	      GDK_WINDOW_TYPE_HINT_MENU);
 
     g_signal_connect (popup->priv->extra_panes[i],
-		      "button-release-event",
-		      G_CALLBACK (hildon_desktop_popup_window_composited_button_release),
+		      "button-press-event",
+		      G_CALLBACK (hildon_desktop_popup_window_composited_button_press),
 		      (gpointer)popup); 
     
     g_signal_connect (popup->priv->extra_panes[i],
@@ -707,9 +707,9 @@
 }
 #endif
 static gboolean
-hildon_desktop_popup_window_composited_button_release (GtkWidget *widget,
-                                                       GdkEventButton *event,
-                                                       HildonDesktopPopupWindow *popup)
+hildon_desktop_popup_window_composited_button_press (GtkWidget *widget,
+                                                     GdkEventButton *event,
+                                                     HildonDesktopPopupWindow *popup)
 {
   gboolean in_panes_area  = FALSE,
            in_window_area = FALSE;
@@ -786,8 +786,8 @@
 }
 
 static gboolean
-hildon_desktop_popup_window_button_release_event (GtkWidget *widget,
-                                                  GdkEventButton *event)
+hildon_desktop_popup_window_button_press_event (GtkWidget *widget,
+                                                GdkEventButton *event)
 {
   HildonDesktopPopupWindow *popup = HILDON_DESKTOP_POPUP_WINDOW (widget);  	
   gboolean in_panes_area  = FALSE,
@@ -839,7 +839,7 @@
       
       if ((x < 0) || (x > w) || (y < 0) || (y > h))
       {	      
-        hildon_desktop_popup_menu_fake_button_event (event, TRUE);	      
+        hildon_desktop_popup_menu_fake_button_event (event, TRUE);
         hildon_desktop_popup_menu_fake_button_event (event, FALSE);
       }
     }

Modified: projects/haf/trunk/hildon-desktop/src/hd-applications-menu.c
===================================================================
--- projects/haf/trunk/hildon-desktop/src/hd-applications-menu.c	2007-08-29 08:58:15 UTC (rev 13447)
+++ projects/haf/trunk/hildon-desktop/src/hd-applications-menu.c	2007-08-29 09:02:29 UTC (rev 13448)
@@ -112,6 +112,7 @@
 static void hd_applications_menu_register_monitors (HDApplicationsMenu *button);
 static void hd_applications_menu_create_menu (HDApplicationsMenu *button);
 static void hd_applications_menu_button_toggled (GtkWidget *widget, HDApplicationsMenu *button);
+static gboolean hd_applications_menu_button_button_press (GtkWidget *widget, GdkEventButton *event, HDApplicationsMenu *button);
 static gboolean hd_applications_menu_button_key_press (GtkWidget* widget, GdkEventKey *event, HDApplicationsMenu *button);
 
 static void
@@ -190,7 +191,17 @@
       	            G_CALLBACK (hd_applications_menu_button_toggled), 
 		    button);
 
+   g_signal_connect (G_OBJECT (priv->button), 
+		    "button-press-event",
+      	            G_CALLBACK (hd_applications_menu_button_button_press), 
+		    button);
+
   g_signal_connect (G_OBJECT (priv->button), 
+		    "button-release-event",
+      	            G_CALLBACK (gtk_true), 
+		    NULL);
+
+  g_signal_connect (G_OBJECT (priv->button), 
 		    "key-press-event",
  		     G_CALLBACK (hd_applications_menu_button_key_press), 
 		     button);
@@ -821,6 +832,19 @@
 }
 
 static gboolean 
+hd_applications_menu_button_button_press (GtkWidget *widget, 
+					  GdkEventButton *event,
+					  HDApplicationsMenu *button)
+{
+  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), 
+		  		!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)));
+
+  gtk_toggle_button_toggled (GTK_TOGGLE_BUTTON (widget));
+  
+  return TRUE;
+}
+
+static gboolean 
 hd_applications_menu_categories_motion_notify (GtkWidget      *widget,
 					       GdkEventMotion *event,
 					       HDApplicationsMenu *button)
@@ -875,7 +899,7 @@
 #if 0
   hildon_desktop_popup_window_attach_widget (popup_window, NULL);
 #endif
-  
+
   button->priv->menu_categories =
     HILDON_DESKTOP_POPUP_MENU (g_object_new (HILDON_DESKTOP_TYPE_POPUP_MENU,
 		  		    	     "item-height", 72,


More information about the maemo-commits mailing list