r1515 - trunk/src/target/OM-2007/panel-plugins/openmoko-panel-mainmenu/src

zhiyong_sun at sita.openmoko.org zhiyong_sun at sita.openmoko.org
Tue Mar 27 03:57:37 CEST 2007


Author: zhiyong_sun
Date: 2007-03-27 03:57:29 +0200 (Tue, 27 Mar 2007)
New Revision: 1515

Modified:
   trunk/src/target/OM-2007/panel-plugins/openmoko-panel-mainmenu/src/openmoko-panel-mainmenu.c
   trunk/src/target/OM-2007/panel-plugins/openmoko-panel-mainmenu/src/stylusmenu.c
   trunk/src/target/OM-2007/panel-plugins/openmoko-panel-mainmenu/src/stylusmenu.h
Log:
fix popup menu position calculate function

Modified: trunk/src/target/OM-2007/panel-plugins/openmoko-panel-mainmenu/src/openmoko-panel-mainmenu.c
===================================================================
--- trunk/src/target/OM-2007/panel-plugins/openmoko-panel-mainmenu/src/openmoko-panel-mainmenu.c	2007-03-26 17:38:14 UTC (rev 1514)
+++ trunk/src/target/OM-2007/panel-plugins/openmoko-panel-mainmenu/src/openmoko-panel-mainmenu.c	2007-03-27 01:57:29 UTC (rev 1515)
@@ -38,12 +38,13 @@
   if (sm)
    gtk_menu_popup (sm, NULL, NULL,
                    (GtkMenuPositionFunc)moko_menu_position_cb,
-                   NULL, 0, gtk_get_current_event_time());
+                   GTK_WIDGET(applet), 0, gtk_get_current_event_time());
   else g_debug ("no stylus menu objcet");
 }
 
 static void tap_hold( MokoPanelApplet* applet )
 {
+	g_debug ("tap hold event callback");
     GtkWidget* widget = GTK_WIDGET(applet);
     Screen* screen = GDK_SCREEN_XSCREEN(gtk_widget_get_screen (widget));
     XEvent xev;

Modified: trunk/src/target/OM-2007/panel-plugins/openmoko-panel-mainmenu/src/stylusmenu.c
===================================================================
--- trunk/src/target/OM-2007/panel-plugins/openmoko-panel-mainmenu/src/stylusmenu.c	2007-03-26 17:38:14 UTC (rev 1514)
+++ trunk/src/target/OM-2007/panel-plugins/openmoko-panel-mainmenu/src/stylusmenu.c	2007-03-27 01:57:29 UTC (rev 1515)
@@ -20,64 +20,6 @@
 #include "stylusmenu.h"
 //#include "callbacks.h"
 
-struct _MokoStylusMenuPrivate{
-
-};
-enum {
-    MENU_SIGNAL = 0,
-    LAST_SIGNAL
-};
-
-static void moko_stylus_menu_class_init(MokoStylusMenuClass *klass);
-
-static void moko_stylus_menu_init(MokoStylusMenu *self);
-
-static guint stylus_menu_signals[LAST_SIGNAL] = { 0 };
-
-GType 
-moko_stylus_menu_get_type (void) /* Typechecking */
-{
-    static GType menu_type = 0;
-g_debug("get >");
-    if (!menu_type)
-    {
-        static const GTypeInfo menu_info =
-        {
-            sizeof (MokoStylusMenuClass),
-            NULL, /* base_init */
-            NULL, /* base_finalize */
-            (GClassInitFunc) moko_stylus_menu_class_init,
-            NULL, /* class_finalize */
-            NULL, /* class_data */
-            sizeof (MokoStylusMenu),
-            0,
-            (GInstanceInitFunc) moko_stylus_menu_init,
-            NULL
-        };
-        menu_type = g_type_register_static (GTK_TYPE_MENU_SHELL, "MokoStylusMenu", &menu_info, 0);
-    }
-
-g_debug("get <");
-    return menu_type;
-}
-
-void
-moko_stylus_menu_class_init (MokoStylusMenuClass * klass)
-{
-
-}
-
-void 
-moko_stylus_menu_init (MokoStylusMenu * self)
-{
-}
-
-MokoStylusMenu *
-moko_stylus_menu_new ()
-{
-    return STYLUSMENU(g_object_new(moko_stylus_menu_get_type, NULL));
-}
-
 static GtkImageMenuItem *moko_build_new_menu_item (const char *icon_name, const char *icon_path);
 
 void
@@ -169,19 +111,12 @@
 }
 
 void
-moko_menu_position_cb (GtkMenu *menu, int *x, int *y, gboolean *push_in, gpointer *p)
+moko_menu_position_cb (GtkMenu *menu, int *x, int *y, gboolean *push_in, GtkWidget *data)
 {
- //   GtkAllocation* allocation = &GTK_WIDGET(button)->allocation;
-    //GtkRequisition req;
-    //GtkRequisition menu_req;
-    //GtkOrientation orientation;
-    //GtkTextDirection direction;
-
-   // gdk_window_get_origin(GTK_BUTTON(button)->event_window, x, y);
+    GtkAllocation* allocation = &GTK_WIDGET(data)->allocation;
     
-    //FIXME: 
-    *x = 0;
-    *y = 44;
+    *x = allocation->x;
+    *y = allocation->y + allocation->height;
 
     *push_in = TRUE;
 }

Modified: trunk/src/target/OM-2007/panel-plugins/openmoko-panel-mainmenu/src/stylusmenu.h
===================================================================
--- trunk/src/target/OM-2007/panel-plugins/openmoko-panel-mainmenu/src/stylusmenu.h	2007-03-26 17:38:14 UTC (rev 1514)
+++ trunk/src/target/OM-2007/panel-plugins/openmoko-panel-mainmenu/src/stylusmenu.h	2007-03-27 01:57:29 UTC (rev 1515)
@@ -32,7 +32,7 @@
 
 //void moko_stylus_menu_build (GtkMenu *menu, MokoDesktopItem *item);
 
-void moko_menu_position_cb (GtkMenu *menu, int *x, int *y, gboolean *push_in, gpointer *p);
+void moko_menu_position_cb (GtkMenu *menu, int *x, int *y, gboolean *push_in, GtkWidget *data);
  
 G_END_DECLS
 #endif /*_MOKO_STYLUS_MAIN_MENU_H*/





More information about the commitlog mailing list