start of showing/rendering menus. woot!
Dana Jansens danakj@orodu.net
9 files changed,
229 insertions(+),
49 deletions(-)
M
openbox/action.c
→
openbox/action.c
@@ -1,5 +1,6 @@
#include "client.h" #include "focus.h" +#include "menu.h" #include "stacking.h" #include "frame.h" #include "framerender.h"@@ -15,10 +16,6 @@ {
Action *a = g_new0(Action, 1); a->func = func; - /* deal with pointers */ - if (func == action_execute) - a->data.execute.path = NULL; - return a; }@@ -29,6 +26,8 @@
/* deal with pointers */ if (a->func == action_execute || a->func == action_restart) g_free(a->data.execute.path); + else if (a->func == action_showmenu) + g_free(a->data.showmenu.name); g_free(a); }@@ -708,7 +707,8 @@ }
void action_showmenu(union ActionData *data) { - g_message(__FUNCTION__); + menu_show(data->showmenu.name, data->showmenu.x, data->showmenu.y, + data->showmenu.c); } static void popup_cycle(Client *c, gboolean hide)
M
openbox/action.h
→
openbox/action.h
@@ -65,7 +65,9 @@ };
struct ShowMenu { Client *c; - char *menuName; + char *name; + int x; + int y; }; struct CycleWindows {@@ -87,7 +89,7 @@ struct Desktop desktop;
struct NextPreviousDesktop nextprevdesktop; struct Move move; struct Resize resize; - struct ShowMenu showMenu; + struct ShowMenu showmenu; struct CycleWindows cycle; };
M
openbox/framerender.c
→
openbox/framerender.c
@@ -242,7 +242,7 @@
a = theme_app_hilite_label; a->texture[0].data.text.string = text; - appearance_minsize(a, sz); + appearance_minsize(a, &sz->width, &sz->height); sz->width += theme_bevel * 2; sz->height += theme_bevel * 2; }
M
openbox/openbox.c
→
openbox/openbox.c
@@ -1,5 +1,6 @@
#include "openbox.h" #include "event.h" +#include "menu.h" #include "client.h" #include "dispatch.h" #include "xerror.h"@@ -178,6 +179,7 @@ theme = theme_load(config_theme);
g_free(theme); if (!theme) return 1; + menu_startup(); frame_startup(); focus_startup(); screen_startup();@@ -203,6 +205,7 @@ group_shutdown();
screen_shutdown(); focus_shutdown(); frame_shutdown(); + menu_shutdown(); grab_shutdown(); event_shutdown(); theme_shutdown();
M
plugins/keyboard/keyparse.c
→
plugins/keyboard/keyparse.c
@@ -82,6 +82,8 @@
/* these use the argument */ if (action->func == action_execute || action->func == action_restart) action->data.execute.path = g_strdup(arg_str); + else if (action->func == action_showmenu) + action->data.showmenu.name = g_strdup(arg_str); if ((action->func == action_desktop || action->func == action_send_to_desktop) && arg_int)
M
plugins/mouse/mouse.c
→
plugins/mouse/mouse.c
@@ -105,7 +105,7 @@ }
} static void fire_button(MouseAction a, Context context, Client *c, guint state, - guint button) + guint button, int x, int y) { GSList *it; MouseBinding *b;@@ -123,6 +123,11 @@ b->action[a]->data.any.c = c;
g_assert(!(b->action[a]->func == action_move || b->action[a]->func == action_resize)); + + if (b->action[a]->func == action_showmenu) { + b->action[a]->data.showmenu.x = x; + b->action[a]->data.showmenu.y = y; + } b->action[a]->func(&b->action[a]->data); }@@ -245,7 +250,8 @@ e->data.x.e->xbutton.window);
fire_button(MouseAction_Press, context, e->data.x.client, e->data.x.e->xbutton.state, - e->data.x.e->xbutton.button); + e->data.x.e->xbutton.button, + e->data.x.e->xbutton.x_root, e->data.x.e->xbutton.y_root); if (context == Context_Client) { /* Replay the event, so it goes to the client*/@@ -295,15 +301,20 @@ ltime = e->data.x.e->xbutton.time;
} fire_button(MouseAction_Release, context, e->data.x.client, e->data.x.e->xbutton.state, - e->data.x.e->xbutton.button); + e->data.x.e->xbutton.button, + e->data.x.e->xbutton.x_root, e->data.x.e->xbutton.y_root); if (click) fire_button(MouseAction_Click, context, e->data.x.client, e->data.x.e->xbutton.state, - e->data.x.e->xbutton.button); + e->data.x.e->xbutton.button, + e->data.x.e->xbutton.x_root, + e->data.x.e->xbutton.y_root); if (dclick) fire_button(MouseAction_DClick, context, e->data.x.client, e->data.x.e->xbutton.state, - e->data.x.e->xbutton.button); + e->data.x.e->xbutton.button, + e->data.x.e->xbutton.x_root, + e->data.x.e->xbutton.y_root); break; case Event_X_MotionNotify:
M
plugins/mouse/mouseparse.c
→
plugins/mouse/mouseparse.c
@@ -99,6 +99,8 @@
/* these use the argument */ if (action->func == action_execute || action->func == action_restart) action->data.execute.path = g_strdup(arg_str); + else if (action->func == action_showmenu) + action->data.showmenu.name = g_strdup(arg_str); if ((action->func == action_desktop || action->func == action_send_to_desktop) && arg_int)