change the menu plugin interface, no need for the create/destroy functions any more. redo the client-menu plugin to work with the new menu api
Dana Jansens danakj@orodu.net
13 files changed,
249 insertions(+),
228 deletions(-)
M
Makefile.am
→
Makefile.am
@@ -26,10 +26,10 @@ kernel/openbox \
tools/kdetrayproxy/kdetrayproxy plugin_LTLIBRARIES = \ - plugins/placement/placement.la + plugins/placement/placement.la \ + plugins/menu/client_menu.la # plugins/menu/timed_menu.la \ # plugins/menu/fifo_menu.la \ -# plugins/menu/client_menu.la \ # plugins/menu/include_menu.la \ # plugins/menu/client_list_menu.la
M
openbox/client.c
→
openbox/client.c
@@ -17,7 +17,7 @@ #include "dispatch.h"
#include "openbox.h" #include "group.h" #include "config.h" -#include "menu.h" +#include "menuframe.h" #include "keyboard.h" #include "mouse.h" #include "render/render.h"@@ -406,7 +406,9 @@
if (moveresize_client == self) moveresize_end(TRUE); - /* XXX close any windows that are attached to this window */ + /* menus can be associated with a client, so close any that are since + we are disappearing now */ + menu_frame_hide_all_client(self); if (focus_client == self) { XEvent e;
M
openbox/event.c
→
openbox/event.c
@@ -1183,8 +1183,8 @@ case MotionNotify:
if ((f = menu_frame_under(ev->xmotion.x_root, ev->xmotion.y_root))) { menu_frame_move_on_screen(f); - if (e = menu_entry_frame_under(ev->xmotion.x_root, - ev->xmotion.y_root)) + if ((e = menu_entry_frame_under(ev->xmotion.x_root, + ev->xmotion.y_root))) menu_frame_select(f, e); } break;
M
openbox/openbox.c
→
openbox/openbox.c
@@ -266,8 +266,8 @@
dock_remove_all(); client_unmanage_all(); - menu_shutdown(); /* destroy menus before unloading plugins */ plugin_shutdown(); /* calls all the plugins' shutdown functions */ + menu_shutdown(); mouse_shutdown(); keyboard_shutdown(); dock_shutdown();
M
openbox/plugin.c
→
openbox/plugin.c
@@ -11,8 +11,6 @@
PluginSetupConfig config; PluginStartup startup; PluginShutdown shutdown; - PluginCreate create; - PluginDestroy destroy; } Plugin; static gpointer load_sym(GModule *module, char *name, char *symbol,@@ -58,9 +56,6 @@ p->startup = (PluginStartup)load_sym(p->module, name, "plugin_startup",
FALSE); p->shutdown = (PluginShutdown)load_sym(p->module, name, "plugin_shutdown", FALSE); - p->create = (PluginCreate)load_sym(p->module, name, "plugin_create", TRUE); - p->destroy = (PluginDestroy)load_sym(p->module, name, "plugin_destroy", - TRUE); if (p->config == NULL || p->startup == NULL || p->shutdown == NULL) { g_module_close(p->module);@@ -174,41 +169,3 @@ }
g_io_channel_unref(io); } } - -void *plugin_create(char *name, void *data) -{ - Plugin *p = (Plugin *)g_datalist_get_data(&plugins, name); - - if (p == NULL) { - g_warning("Unable to find plugin for create: %s", name); - return NULL; - } - - if (p->create == NULL || p->destroy == NULL) { - g_critical("Unsupported create/destroy: %s", name); - return NULL; - } - - return p->create(data); -} - -void plugin_destroy(char *name, void *data) -{ - Plugin *p = (Plugin *)g_datalist_get_data(&plugins, name); - - if (p == NULL) { - g_critical("Unable to find plugin for destroy: %s", name); - /* really shouldn't happen, but attempt to free something anyway? */ - g_free(data); - return; - } - - if (p->destroy == NULL || p->create == NULL) { - g_critical("Unsupported create/destroy: %s", name); - /* really, really shouldn't happen, but attempt to free anyway? */ - g_free(data); - return; - } - - p->destroy(data); -}
M
openbox/plugin.h
→
openbox/plugin.h
@@ -15,9 +15,4 @@ /* load a plugin, but don't warn about reopens. for menus */
gboolean plugin_open_reopen(char *name, struct _ObParseInst *i); void plugin_close(char *name); -/* call plugin's generic constructor */ -void *plugin_create(char *name, void *data); -/* free memory allocated by plugin_create() */ -void plugin_destroy(char *name, void *object); - #endif
M
plugins/interface.h
→
plugins/interface.h
@@ -12,10 +12,4 @@
/* plugin_shutdown() */ typedef void (*PluginShutdown)(void); -/* plugin_create() - for menu plugins only */ -typedef void *(*PluginCreate)(/* TODO */); - -/* plugin_destroy() - for menu plugins only */ -typedef void (*PluginDestroy)(void *); - #endif