Menu stuff.
Testing may begin.
This commit is contained in:
parent
632b2af7a8
commit
f37a919095
3 changed files with 23 additions and 13 deletions
|
@ -1008,6 +1008,7 @@ static void event_handle_menu(ObClient *client, XEvent *e)
|
||||||
e->xbutton.y_root);
|
e->xbutton.y_root);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -297,7 +297,7 @@ void menu_show_full(ObMenu *self, int x, int y, ObClient *client)
|
||||||
{
|
{
|
||||||
g_assert(self != NULL);
|
g_assert(self != NULL);
|
||||||
|
|
||||||
menu_render(self);
|
self->update(self);
|
||||||
|
|
||||||
self->client = client;
|
self->client = client;
|
||||||
|
|
||||||
|
@ -319,7 +319,6 @@ void menu_hide(ObMenu *self) {
|
||||||
if (self->open_submenu)
|
if (self->open_submenu)
|
||||||
menu_hide(self->open_submenu);
|
menu_hide(self->open_submenu);
|
||||||
if (self->parent && self->parent->open_submenu == self) {
|
if (self->parent && self->parent->open_submenu == self) {
|
||||||
self->over = NULL;
|
|
||||||
self->parent->open_submenu = NULL;
|
self->parent->open_submenu = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -328,6 +327,11 @@ void menu_hide(ObMenu *self) {
|
||||||
grab_pointer(FALSE, None);
|
grab_pointer(FALSE, None);
|
||||||
}
|
}
|
||||||
menu_visible = g_list_remove(menu_visible, self);
|
menu_visible = g_list_remove(menu_visible, self);
|
||||||
|
if (self->over) {
|
||||||
|
((ObMenuEntry *)self->over->data)->hilite = FALSE;
|
||||||
|
menu_entry_render(self->over->data);
|
||||||
|
self->over = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -385,7 +389,7 @@ void menu_entry_fire(ObMenuEntry *self, unsigned int button, unsigned int x,
|
||||||
{
|
{
|
||||||
ObMenu *m;
|
ObMenu *m;
|
||||||
|
|
||||||
if (button > 3) return;
|
if (button != 1) return;
|
||||||
|
|
||||||
if (self->action) {
|
if (self->action) {
|
||||||
self->action->data.any.c = self->parent->client;
|
self->action->data.any.c = self->parent->client;
|
||||||
|
@ -461,7 +465,7 @@ void menu_control_mouseover(ObMenuEntry *self, gboolean enter)
|
||||||
ob_rr_theme->bwidth - ob_rr_theme->menu_overlap;
|
ob_rr_theme->bwidth - ob_rr_theme->menu_overlap;
|
||||||
|
|
||||||
/* need to get the width. is this bad?*/
|
/* need to get the width. is this bad?*/
|
||||||
menu_render(self->submenu);
|
self->parent->update(self->submenu);
|
||||||
|
|
||||||
a = screen_physical_area_monitor(self->parent->xin_area);
|
a = screen_physical_area_monitor(self->parent->xin_area);
|
||||||
|
|
||||||
|
@ -485,6 +489,7 @@ void menu_control_mouseover(ObMenuEntry *self, gboolean enter)
|
||||||
void menu_control_keyboard_nav(unsigned int key)
|
void menu_control_keyboard_nav(unsigned int key)
|
||||||
{
|
{
|
||||||
static ObMenu *current_menu = NULL;
|
static ObMenu *current_menu = NULL;
|
||||||
|
ObMenuEntry *e = NULL;
|
||||||
|
|
||||||
ObKey obkey = OB_NUM_KEYS;
|
ObKey obkey = OB_NUM_KEYS;
|
||||||
|
|
||||||
|
@ -532,25 +537,29 @@ void menu_control_keyboard_nav(unsigned int key)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case OB_KEY_RIGHT: {
|
case OB_KEY_RIGHT: {
|
||||||
ObMenuEntry *e;
|
|
||||||
if (current_menu->over == NULL)
|
if (current_menu->over == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
e = (ObMenuEntry *)current_menu->over->data;
|
e = (ObMenuEntry *)current_menu->over->data;
|
||||||
if (e->submenu) {
|
if (e->submenu) {
|
||||||
current_menu = e->submenu;
|
current_menu = e->submenu;
|
||||||
current_menu->over = current_menu->entries;
|
current_menu->over = current_menu->entries;
|
||||||
if (current_menu->over)
|
if (current_menu->over)
|
||||||
current_menu->mouseover(current_menu->over->data, TRUE);
|
current_menu->mouseover(current_menu->over->data, TRUE);
|
||||||
} else {
|
|
||||||
current_menu->mouseover(e, FALSE);
|
|
||||||
current_menu->over = NULL;
|
|
||||||
|
|
||||||
/* zero is enter */
|
|
||||||
menu_entry_fire(e, 0, 0, 0);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case OB_KEY_RETURN: {
|
||||||
|
if (current_menu->over == NULL)
|
||||||
|
return;
|
||||||
|
e = (ObMenuEntry *)current_menu->over->data;
|
||||||
|
|
||||||
|
current_menu->mouseover(e, FALSE);
|
||||||
|
current_menu->over = NULL;
|
||||||
|
/* zero is enter */
|
||||||
|
menu_entry_fire(e, 0, 0, 0);
|
||||||
|
|
||||||
|
}
|
||||||
case OB_KEY_LEFT: {
|
case OB_KEY_LEFT: {
|
||||||
if (current_menu->over != NULL) {
|
if (current_menu->over != NULL) {
|
||||||
current_menu->mouseover(current_menu->over->data, FALSE);
|
current_menu->mouseover(current_menu->over->data, FALSE);
|
||||||
|
|
|
@ -52,7 +52,7 @@ void client_send_to_update(ObMenu *self)
|
||||||
menu_add_entry(self, e);
|
menu_add_entry(self, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
self->update(self);
|
menu_render(self);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue