prefix and capitalize ObMenu ObMenuEntry and ObMenuEntryRenderType
authorDana Jansens <danakj@orodu.net>
Thu, 10 Jul 2003 19:27:12 +0000 (19:27 +0000)
committerDana Jansens <danakj@orodu.net>
Thu, 10 Jul 2003 19:27:12 +0000 (19:27 +0000)
make the ObMenuEntryRenderType a standard enum instead bitflags

openbox/client.c
openbox/event.c
openbox/menu.c
openbox/menu.h
openbox/menu_render.c
openbox/window.c
openbox/window.h
plugins/menu/client_menu.c
plugins/menu/fifo_menu.c
plugins/menu/timed_menu.c

index 339c2a1..aa6e5be 100644 (file)
@@ -318,8 +318,8 @@ void client_unmanage_all()
 /* called by client_unmanage() to close any menus referencing this client */
 void client_close_menus(gpointer key, gpointer value, gpointer self)
 {
-    if (((Menu *)value)->client == (ObClient *)self)
-        menu_hide((Menu *)value);
+    if (((ObMenu *)value)->client == (ObClient *)self)
+        menu_hide((ObMenu *)value);
 }
 
 void client_unmanage(ObClient *self)
index 6d74a27..cdac868 100644 (file)
@@ -449,7 +449,7 @@ static void event_process(XEvent *e)
     ObClient *client = NULL;
     ObDock *dock = NULL;
     ObDockApp *dockapp = NULL;
-    Menu *menu = NULL;
+    ObMenu *menu = NULL;
     ObWindow *obwin = NULL;
 
     window = event_get_window(e);
@@ -963,9 +963,9 @@ static void event_handle_client(ObClient *client, XEvent *e)
 
 static void event_handle_menu(ObClient *client, XEvent *e)
 {
-    static MenuEntry *over = NULL;
-    MenuEntry *entry;
-    Menu *top;
+    static ObMenuEntry *over = NULL;
+    ObMenuEntry *entry;
+    ObMenu *top;
     GSList *it;
 
     top = g_slist_nth_data(menu_visible, 0);
@@ -999,7 +999,7 @@ static void event_handle_menu(ObClient *client, XEvent *e)
        g_message("BUTTON RELEASED");
 
         for (it = menu_visible; it; it = g_slist_next(it)) {
-            Menu *m = it->data;
+            ObMenu *m = it->data;
             if (e->xbutton.x_root >= m->location.x - ob_rr_theme->bwidth &&
                 e->xbutton.y_root >= m->location.y - ob_rr_theme->bwidth &&
                 e->xbutton.x_root < m->location.x + m->size.width +
@@ -1046,7 +1046,7 @@ static void event_handle_menu(ObClient *client, XEvent *e)
     case MotionNotify:
         g_message("motion");
         for (it = menu_visible; it; it = g_slist_next(it)) {
-            Menu *m = it->data;
+            ObMenu *m = it->data;
             if ((entry = menu_find_entry_by_pos(it->data,
                                                 e->xmotion.x_root -
                                                 m->location.x,
index aef0356..a8a5111 100644 (file)
@@ -21,7 +21,7 @@ static void parse_menu(xmlDocPtr doc, xmlNodePtr node, void *data)
     Action *act;
     xmlNodePtr nact;
     gchar *id = NULL, *title = NULL, *label = NULL;
-    Menu *menu, *parent;
+    ObMenu *menu, *parent;
 
     if (!parse_attr_string("id", node->parent, &id))
         goto parse_menu_fail;
@@ -30,9 +30,9 @@ static void parse_menu(xmlDocPtr doc, xmlNodePtr node, void *data)
 
     g_message("menu label %s", title);
 
-    menu = menu_new(title, id, data ? *((Menu**)data) : NULL);
+    menu = menu_new(title, id, data ? *((ObMenu**)data) : NULL);
     if (data)
-        *((Menu**)data) = menu;
+        *((ObMenu**)data) = menu;
 
     while (node) {
         if (!xmlStrcasecmp(node->name, (const xmlChar*) "menu")) {
@@ -62,14 +62,14 @@ parse_menu_fail:
     g_free(title);
 }
 
-void menu_control_show(Menu *self, int x, int y, ObClient *client);
+void menu_control_show(ObMenu *self, int x, int y, ObClient *client);
 
-void menu_destroy_hash_key(Menu *menu)
+void menu_destroy_hash_key(ObMenu *menu)
 {
     g_free(menu);
 }
 
-void menu_destroy_hash_value(Menu *self)
+void menu_destroy_hash_value(ObMenu *self)
 {
     GList *it;
 
@@ -94,7 +94,7 @@ void menu_destroy_hash_value(Menu *self)
     g_free(self);
 }
 
-void menu_entry_free(MenuEntry *self)
+void menu_entry_free(ObMenuEntry *self)
 {
     g_free(self->label);
     action_free(self->action);
@@ -112,9 +112,9 @@ void menu_entry_free(MenuEntry *self)
 void menu_startup()
 {
 /*
-    Menu *m;
-    Menu *s;
-    Menu *t;
+    ObMenu *m;
+    ObMenu *s;
+    ObMenu *t;
     Action *a;
 */
 
@@ -183,13 +183,13 @@ static Window createWindow(Window parent, unsigned long mask,
                        
 }
 
-Menu *menu_new_full(char *label, char *name, Menu *parent, 
+ObMenu *menu_new_full(char *label, char *name, ObMenu *parent, 
                     menu_controller_show show, menu_controller_update update)
 {
     XSetWindowAttributes attrib;
-    Menu *self;
+    ObMenu *self;
 
-    self = g_new0(Menu, 1);
+    self = g_new0(ObMenu, 1);
     self->obwin.type = Window_Menu;
     self->label = g_strdup(label);
     self->name = g_strdup(name);
@@ -239,11 +239,11 @@ void menu_free(char *name)
     g_hash_table_remove(menu_hash, name);
 }
 
-MenuEntry *menu_entry_new_full(char *label, Action *action,
-                               MenuEntryRenderType render_type,
+ObMenuEntry *menu_entry_new_full(char *label, Action *action,
+                               ObMenuEntryRenderType render_type,
                                gpointer submenu)
 {
-    MenuEntry *menu_entry = g_new0(MenuEntry, 1);
+    ObMenuEntry *menu_entry = g_new0(ObMenuEntry, 1);
 
     menu_entry->label = g_strdup(label);
     menu_entry->render_type = render_type;
@@ -257,7 +257,7 @@ MenuEntry *menu_entry_new_full(char *label, Action *action,
     return menu_entry;
 }
 
-void menu_entry_set_submenu(MenuEntry *entry, Menu *submenu)
+void menu_entry_set_submenu(ObMenuEntry *entry, ObMenu *submenu)
 {
     g_assert(entry != NULL);
     
@@ -267,7 +267,7 @@ void menu_entry_set_submenu(MenuEntry *entry, Menu *submenu)
         entry->parent->invalid = TRUE;
 }
 
-void menu_add_entry(Menu *menu, MenuEntry *entry)
+void menu_add_entry(ObMenu *menu, ObMenuEntry *entry)
 {
     XSetWindowAttributes attrib;
 
@@ -291,7 +291,7 @@ void menu_add_entry(Menu *menu, MenuEntry *entry)
 
 void menu_show(char *name, int x, int y, ObClient *client)
 {
-    Menu *self;
+    ObMenu *self;
   
     self = g_hash_table_lookup(menu_hash, name);
     if (!self) {
@@ -303,7 +303,7 @@ void menu_show(char *name, int x, int y, ObClient *client)
     menu_show_full(self, x, y, client);
 }  
 
-void menu_show_full(Menu *self, int x, int y, ObClient *client)
+void menu_show_full(ObMenu *self, int x, int y, ObClient *client)
 {
     g_assert(self != NULL);
        
@@ -326,7 +326,7 @@ void menu_show_full(Menu *self, int x, int y, ObClient *client)
     }
 }
 
-void menu_hide(Menu *self) {
+void menu_hide(ObMenu *self) {
     if (self->shown) {
         XUnmapWindow(ob_display, self->frame);
         self->shown = FALSE;
@@ -343,11 +343,11 @@ void menu_hide(Menu *self) {
     }
 }
 
-void menu_clear(Menu *self) {
+void menu_clear(ObMenu *self) {
     GList *it;
   
     for (it = self->entries; it; it = it->next) {
-       MenuEntry *entry = it->data;
+       ObMenuEntry *entry = it->data;
        menu_entry_free(entry);
     }
     self->entries = NULL;
@@ -355,19 +355,19 @@ void menu_clear(Menu *self) {
 }
 
 
-MenuEntry *menu_find_entry(Menu *menu, Window win)
+ObMenuEntry *menu_find_entry(ObMenu *menu, Window win)
 {
     GList *it;
 
     for (it = menu->entries; it; it = it->next) {
-        MenuEntry *entry = it->data;
+        ObMenuEntry *entry = it->data;
         if (entry->item == win)
             return entry;
     }
     return NULL;
 }
 
-MenuEntry *menu_find_entry_by_pos(Menu *menu, int x, int y)
+ObMenuEntry *menu_find_entry_by_pos(ObMenu *menu, int x, int y)
 {
     if (x < 0 || x >= menu->size.width || y < 0 || y >= menu->size.height)
         return NULL;
@@ -379,9 +379,9 @@ MenuEntry *menu_find_entry_by_pos(Menu *menu, int x, int y)
     return g_list_nth_data(menu->entries, y / menu->item_h);
 }
 
-void menu_entry_fire(MenuEntry *self)
+void menu_entry_fire(ObMenuEntry *self)
 {
-    Menu *m;
+    ObMenu *m;
 
     if (self->action) {
         self->action->data.any.c = self->parent->client;
@@ -398,7 +398,7 @@ void menu_entry_fire(MenuEntry *self)
    Default menu controller action for showing.
 */
 
-void menu_control_show(Menu *self, int x, int y, ObClient *client) {
+void menu_control_show(ObMenu *self, int x, int y, ObClient *client) {
     guint i;
     Rect *a = NULL;
 
@@ -426,7 +426,7 @@ void menu_control_show(Menu *self, int x, int y, ObClient *client) {
     }
 }
 
-void menu_control_mouseover(MenuEntry *self, gboolean enter) {
+void menu_control_mouseover(ObMenuEntry *self, gboolean enter) {
     int x;
     Rect *a;
 
index 9beb8f2..72a7ed2 100644 (file)
 
 struct _ObClient;
 
-struct Menu;
-struct MenuEntry;
+typedef struct _ObMenu      ObMenu;
+typedef struct _ObMenuEntry ObMenuEntry;
 
-typedef void(*menu_controller_show)(struct Menu *self,
-                                    int x, int y, struct _ObClient *);
-typedef void(*menu_controller_update)(struct Menu *self);
-typedef void(*menu_controller_mouseover)(struct MenuEntry *self,
-                                         gboolean enter);
+typedef void(*menu_controller_show)(ObMenu *self, int x, int y,
+                                    struct _ObClient *);
+typedef void(*menu_controller_update)(ObMenu *self);
+typedef void(*menu_controller_mouseover)(ObMenuEntry *self, gboolean enter);
 
 extern GHashTable *menu_hash;
 extern GSList *menu_visible;
 
-typedef struct Menu {
+struct _ObMenu
+{
     ObWindow obwin;
 
-    char *label;
-    char *name;
+    gchar *label;
+    gchar *name;
     
     GList *entries;
 
     gboolean shown;
     gboolean invalid;
 
-    struct Menu *parent;
+    ObMenu *parent;
     
-    struct Menu *open_submenu;
+    ObMenu *open_submenu;
 
     /* place a menu on screen */
     menu_controller_show show;
@@ -52,11 +52,11 @@ typedef struct Menu {
     Window frame;
     Window title;
     RrAppearance *a_title;
-    int title_min_w, title_h;
+    gint title_min_w, title_h;
     Window items;
     RrAppearance *a_items;
-    int bullet_w;
-    int item_h;
+    gint bullet_w;
+    gint item_h;
     Point location;
     Size size;
     guint xin_area; /* index of the xinerama head/area */
@@ -64,38 +64,39 @@ typedef struct Menu {
     /* plugin stuff */
     char *plugin;
     void *plugin_data;
-} Menu;
-
-typedef enum MenuEntryRenderType {
-    MenuEntryRenderType_None = 0,
-    MenuEntryRenderType_Submenu = 1 << 0,
-    MenuEntryRenderType_Boolean = 1 << 1,
-    MenuEntryRenderType_Separator = 1 << 2,
-    
-    MenuEntryRenderType_Other = 1 << 7
-} MenuEntryRenderType;
-
-typedef struct MenuEntry {
+};
+
+typedef enum
+{
+    OB_MENU_ENTRY_RENDER_TYPE_NONE,
+    OB_MENU_ENTRY_RENDER_TYPE_SUBMENU,
+    OB_MENU_ENTRY_RENDER_TYPE_BOOLEAN,
+    OB_MENU_ENTRY_RENDER_TYPE_SEPARATOR,
+    OB_MENU_ENTRY_RENDER_TYPE_OTHER /* XXX what is this? */
+} ObMenuEntryRenderType;
+
+struct _ObMenuEntry
+{
     char *label;
-    Menu *parent;
+    ObMenu *parent;
 
     Action *action;    
     
-    MenuEntryRenderType render_type;
+    ObMenuEntryRenderType render_type;
     gboolean hilite;
     gboolean enabled;
     gboolean boolean_value;
 
-    Menu *submenu;
+    ObMenu *submenu;
 
     /* render stuff */
     Window item;
     RrAppearance *a_item;
     RrAppearance *a_disabled;
     RrAppearance *a_hilite;
-    int y;
-    int min_w;
-} MenuEntry;
+    gint y;
+    gint min_w;
+};
 
 void menu_startup();
 void menu_shutdown();
@@ -103,48 +104,48 @@ void menu_shutdown();
 #define menu_new(l, n, p) \
   menu_new_full(l, n, p, NULL, NULL)
 
-Menu *menu_new_full(char *label, char *name, Menu *parent, 
+ObMenu *menu_new_full(char *label, char *name, ObMenu *parent, 
                     menu_controller_show show, menu_controller_update update);
 void menu_free(char *name);
 
 void menu_show(char *name, int x, int y, struct _ObClient *client);
-void menu_show_full(Menu *menu, int x, int y, struct _ObClient *client);
+void menu_show_full(ObMenu *menu, int x, int y, struct _ObClient *client);
 
-void menu_hide(Menu *self);
+void menu_hide(ObMenu *self);
 
-void menu_clear(Menu *self);
+void menu_clear(ObMenu *self);
 
-MenuEntry *menu_entry_new_full(char *label, Action *action,
-                               MenuEntryRenderType render_type,
+ObMenuEntry *menu_entry_new_full(char *label, Action *action,
+                               ObMenuEntryRenderType render_type,
                                gpointer submenu);
 
 #define menu_entry_new(label, action) \
-menu_entry_new_full(label, action, MenuEntryRenderType_None, NULL)
+menu_entry_new_full(label, action, OB_MENU_ENTRY_RENDER_TYPE_NONE, NULL)
 
 #define menu_entry_new_separator(label) \
-menu_entry_new_full(label, NULL, MenuEntryRenderType_Separator, NULL)
+menu_entry_new_full(label, NULL, OB_MENU_ENTRY_RENDER_TYPE_SEPARATOR, NULL)
 
 #define menu_entry_new_submenu(label, submenu) \
-menu_entry_new_full(label, NULL, MenuEntryRenderType_Submenu, submenu)
+menu_entry_new_full(label, NULL, OB_MENU_ENTRY_RENDER_TYPE_SUBMENU, submenu)
 
 #define menu_entry_new_boolean(label, action) \
-menu_entry_new_full(label, action, MenuEntryRenderType_Boolean, NULL)
+menu_entry_new_full(label, action, OB_MENU_ENTRY_RENDER_TYPE_BOOLEAN, NULL)
 
-void menu_entry_free(MenuEntry *entry);
+void menu_entry_free(ObMenuEntry *entry);
 
-void menu_entry_set_submenu(MenuEntry *entry, Menu *submenu);
+void menu_entry_set_submenu(ObMenuEntry *entry, ObMenu *submenu);
 
-void menu_add_entry(Menu *menu, MenuEntry *entry);
+void menu_add_entry(ObMenu *menu, ObMenuEntry *entry);
 
-MenuEntry *menu_find_entry(Menu *menu, Window win);
-MenuEntry *menu_find_entry_by_pos(Menu *menu, int x, int y);
+ObMenuEntry *menu_find_entry(ObMenu *menu, Window win);
+ObMenuEntry *menu_find_entry_by_pos(ObMenu *menu, int x, int y);
 
-void menu_entry_render(MenuEntry *self);
+void menu_entry_render(ObMenuEntry *self);
 
-void menu_entry_fire(MenuEntry *self);
+void menu_entry_fire(ObMenuEntry *self);
 
-void menu_render(Menu *self);
-void menu_render_full(Menu *self);
+void menu_render(ObMenu *self);
+void menu_render_full(ObMenu *self);
 
-void menu_control_mouseover(MenuEntry *entry, gboolean enter);
+void menu_control_mouseover(ObMenuEntry *entry, gboolean enter);
 #endif
index 4b6e7d8..d534253 100644 (file)
@@ -4,9 +4,9 @@
 #include "openbox.h"
 #include "render/theme.h"
 
-void menu_render_full(Menu *self);
+void menu_render_full(ObMenu *self);
 
-void menu_render(Menu *self) {
+void menu_render(ObMenu *self) {
     if (self->update) {
         self->update(self);
     } else if (self->invalid) {
@@ -14,7 +14,7 @@ void menu_render(Menu *self) {
     }
 }
 
-void menu_render_full(Menu *self) {
+void menu_render_full(ObMenu *self) {
     GList *it;
     int items_h = 0;
     int nitems = 0; /* each item, only one is used */
@@ -47,7 +47,7 @@ void menu_render_full(Menu *self) {
     }
 
     for (it = self->entries; it; it = it->next) {
-        MenuEntry *e = it->data;
+        ObMenuEntry *e = it->data;
         int h;
 
         if (e->a_item == NULL) {
@@ -95,7 +95,7 @@ void menu_render_full(Menu *self) {
 
     item_y = 0;
     for (it = self->entries; it; it = it->next) {
-        ((MenuEntry*)it->data)->y = item_y;
+        ((ObMenuEntry*)it->data)->y = item_y;
         menu_entry_render(it->data);
         item_y += self->item_h;
     }
@@ -103,24 +103,24 @@ void menu_render_full(Menu *self) {
     self->invalid = FALSE;
 }
 
-void menu_entry_render(MenuEntry *self)
+void menu_entry_render(ObMenuEntry *self)
 {
-    Menu *menu = self->parent;
+    ObMenu *menu = self->parent;
     RrAppearance *a;
     
     switch (self->render_type) {
-    case MenuEntryRenderType_Submenu:
+    case OB_MENU_ENTRY_RENDER_TYPE_SUBMENU:
        /* TODO: submenu mask */
-    case MenuEntryRenderType_Boolean:
+    case OB_MENU_ENTRY_RENDER_TYPE_BOOLEAN:
        /* TODO: boolean check */
        a = self->enabled ? (self->hilite ? self->a_hilite : self->a_item) 
            : self->a_disabled;
        break;
-    case MenuEntryRenderType_None:
+    case OB_MENU_ENTRY_RENDER_TYPE_NONE:
        a = self->enabled ? (self->hilite ? self->a_hilite : self->a_item )
            : self->a_disabled;
        break;
-    case MenuEntryRenderType_Separator:
+    case OB_MENU_ENTRY_RENDER_TYPE_SEPARATOR:
        a = self->a_item;
        break;
 
@@ -128,7 +128,8 @@ void menu_entry_render(MenuEntry *self)
        g_message("unhandled render_type");
        a = !self->enabled ? self->a_disabled :
         (self->hilite && 
-         (self->action || self->render_type == MenuEntryRenderType_Submenu) ? 
+         (self->action ||
+          self->render_type == OB_MENU_ENTRY_RENDER_TYPE_SUBMENU) ? 
          self->a_hilite : self->a_item);
        break;
     }
index 8ca01b6..521d9e2 100644 (file)
@@ -21,7 +21,7 @@ Window window_top(ObWindow *self)
 {
     switch (self->type) {
     case Window_Menu:
-        return ((Menu*)self)->frame;
+        return ((ObMenu*)self)->frame;
     case Window_Dock:
         return ((ObDock*)self)->frame;
     case Window_DockApp:
index fbdcf02..b38bc42 100644 (file)
@@ -33,12 +33,12 @@ typedef struct InternalWindow {
 #define WINDOW_IS_CLIENT(win) (((ObWindow*)win)->type == Window_Client)
 #define WINDOW_IS_INTERNAL(win) (((ObWindow*)win)->type == Window_Internal)
 
-struct Menu;
+struct _ObMenu;
 struct _ObDock;
 struct _ObDockApp;
 struct _ObClient;
 
-#define WINDOW_AS_MENU(win) ((struct Menu*)win)
+#define WINDOW_AS_MENU(win) ((struct _ObMenu*)win)
 #define WINDOW_AS_DOCK(win) ((struct _ObDock*)win)
 #define WINDOW_AS_DOCKAPP(win) ((struct _ObDockApp*)win)
 #define WINDOW_AS_CLIENT(win) ((struct _ObClient*)win)
index d4c94aa..31578d6 100644 (file)
 static char *PLUGIN_NAME = "client_menu";
 #endif
 
-static Menu *send_to_menu;
-static Menu *layer_menu;
+static ObMenu *send_to_menu;
+static ObMenu *layer_menu;
 
 typedef struct {
     gint foo;
 } Client_Menu_Data;
 
-#define CLIENT_MENU(m) ((Menu *)m)
-#define CLIENT_MENU_DATA(m) ((Client_Menu_Data *)((Menu *)m)->plugin_data)
+#define CLIENT_MENU(m) ((ObMenu *)m)
+#define CLIENT_MENU_DATA(m) ((Client_Menu_Data *)((ObMenu *)m)->plugin_data)
 
-void client_menu_clean_up(Menu *m) {
+void client_menu_clean_up(ObMenu *m) {
 }
 
-void client_send_to_update(Menu *self)
+void client_send_to_update(ObMenu *self)
 {
     guint i = 0;
     GList *it = self->entries;
@@ -36,7 +36,7 @@ void client_send_to_update(Menu *self)
         if (i >= screen_num_desktops)
             break;
         if (strcmp(screen_desktop_names[i],
-                   ((MenuEntry *)it->data)->label) != 0)
+                   ((ObMenuEntry *)it->data)->label) != 0)
             break;
         ++i;
         it = it->next;
@@ -46,7 +46,7 @@ void client_send_to_update(Menu *self)
         menu_clear(self);
         g_message("update");
         for (i = 0; i < screen_num_desktops; ++i) {
-            MenuEntry *e;
+            ObMenuEntry *e;
             Action *a = action_from_string("sendtodesktop");
             a->data.sendto.desk = i;
             a->data.sendto.follow = FALSE;
@@ -59,7 +59,7 @@ void client_send_to_update(Menu *self)
 }
 
 #if 0
-void client_menu_show(Menu *self, int x, int y, Client *client)
+void client_menu_show(ObMenu *self, int x, int y, Client *client)
 {
     int newy;
     g_assert(!self->invalid);
@@ -91,13 +91,13 @@ void plugin_setup_config() { }
 
 void plugin_shutdown() { }
 
-void plugin_destroy (Menu *m)
+void plugin_destroy (ObMenu *m)
 {
 }
 
 void *plugin_create() /* TODO: need config */
 {
-    Menu *m = menu_new_full(NULL, "client-menu", NULL,
+    ObMenu *m = menu_new_full(NULL, "client-menu", NULL,
                             /*client_menu_show*/NULL, NULL);
     menu_add_entry(m, menu_entry_new_submenu("Send To Workspace",
                                              send_to_menu));
@@ -136,8 +136,8 @@ void *plugin_create() /* TODO: need config */
 
 void plugin_startup()
 {
-    Menu *t;
-    /* create a Send To Workspace Menu */
+    ObMenu *t;
+    /* create a Send To Workspace ObMenu */
     send_to_menu = menu_new_full(NULL, "send-to-workspace",
                           NULL, NULL, client_send_to_update);
     
@@ -149,6 +149,6 @@ void plugin_startup()
     menu_add_entry(layer_menu, menu_entry_new("Bottom Layer",
                                      action_from_string("sendtobottomlayer")));
                           
-    t = (Menu *)plugin_create("client_menu");
+    t = (ObMenu *)plugin_create("client_menu");
 }
 
index 8f4ac20..e5580b0 100644 (file)
@@ -20,11 +20,11 @@ typedef struct Fifo_Menu_Data{
     event_fd_handler *handler;
 } Fifo_Menu_Data;
 
-#define FIFO_MENU(m) ((Menu *)m)
-#define FIFO_MENU_DATA(m) ((Fifo_Menu_Data *)((Menu *)m)->plugin_data)
+#define FIFO_MENU(m) ((ObMenu *)m)
+#define FIFO_MENU_DATA(m) ((Fifo_Menu_Data *)((ObMenu *)m)->plugin_data)
 
 
-void fifo_menu_clean_up(Menu *m) {
+void fifo_menu_clean_up(ObMenu *m) {
     if (FIFO_MENU_DATA(m)->buf != NULL) {
         g_free(FIFO_MENU_DATA(m)->buf);
         FIFO_MENU_DATA(m)->buf = NULL;
@@ -43,7 +43,7 @@ void plugin_startup()
 void plugin_shutdown() { }
 
 void fifo_menu_handler(int fd, void *d) {
-    Menu *menu = d;
+    ObMenu *menu = d;
     char *tmpbuf = NULL;
     unsigned long num_read;
 #ifdef DEBUG
@@ -116,7 +116,7 @@ void fifo_menu_handler(int fd, void *d) {
     }
 }
 
-void plugin_destroy (Menu *m)
+void plugin_destroy (ObMenu *m)
 {
     fifo_menu_clean_up(m);
     if (FIFO_MENU_DATA(m)->handler != NULL) {
@@ -141,7 +141,7 @@ void *plugin_create() /* TODO: need config */
     event_fd_handler *h;
     
     Fifo_Menu_Data *d = g_new(Fifo_Menu_Data, 1);
-    Menu *m = menu_new("", PLUGIN_NAME, NULL);
+    ObMenu *m = menu_new("", PLUGIN_NAME, NULL);
 
     d->fd = -1;
     d->buf = NULL;
index e7665b5..a6e2e8d 100644 (file)
@@ -15,8 +15,8 @@
 #include "kernel/action.h"
 #include "kernel/event.h"
 
-#define TIMED_MENU(m) ((Menu *)m)
-#define TIMED_MENU_DATA(m) ((Timed_Menu_Data *)((Menu *)m)->plugin_data)
+#define TIMED_MENU(m) ((ObMenu *)m)
+#define TIMED_MENU_DATA(m) ((Timed_Menu_Data *)((ObMenu *)m)->plugin_data)
 static char *PLUGIN_NAME = "timed_menu";
 
 typedef enum {
@@ -41,7 +41,7 @@ void plugin_startup()
 { }
 void plugin_shutdown() { }
 
-void timed_menu_clean_up(Menu *m) {
+void timed_menu_clean_up(ObMenu *m) {
     if (TIMED_MENU_DATA(m)->buf != NULL) {
         fprintf(stderr, "%s", TIMED_MENU_DATA(m)->buf);
         g_free(TIMED_MENU_DATA(m)->buf);
@@ -66,7 +66,7 @@ void timed_menu_clean_up(Menu *m) {
 
 void timed_menu_read_pipe(int fd, void *d)
 {
-    Menu *menu = d;
+    ObMenu *menu = d;
     char *tmpbuf = NULL;
     unsigned long num_read;
 #ifdef DEBUG
@@ -125,7 +125,7 @@ void timed_menu_read_pipe(int fd, void *d)
 
 void timed_menu_timeout_handler(void *d)
 {
-    Menu *data = d;
+    ObMenu *data = d;
     if (!data->shown && TIMED_MENU_DATA(data)->fd == -1) {
         switch (TIMED_MENU_DATA(data)->type) {
             case (TIMED_MENU_PIPE): {
@@ -187,7 +187,7 @@ void timed_menu_timeout_handler(void *d)
 void *plugin_create()
 {
     Timed_Menu_Data *d = g_new(Timed_Menu_Data, 1);
-    Menu *m = menu_new("", PLUGIN_NAME, NULL);
+    ObMenu *m = menu_new("", PLUGIN_NAME, NULL);
     
     m->plugin = PLUGIN_NAME;