panel: Restore Alt-F1 and Alt-F3 key binds
This commit is contained in:
parent
2252d437a2
commit
145478b595
38
apps/panel.c
38
apps/panel.c
@ -435,17 +435,6 @@ static void handle_key_event(struct yutani_msg_key_event * ke) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO Alt-F1 = Show the application menu */
|
|
||||||
#if 0
|
|
||||||
if ((ke->event.modifiers & KEY_MOD_LEFT_ALT) &&
|
|
||||||
(ke->event.keycode == KEY_F1) &&
|
|
||||||
(ke->event.action == KEY_ACTION_DOWN)) {
|
|
||||||
/* show menu */
|
|
||||||
|
|
||||||
show_app_menu();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Alt-F2 = Show the command entry window */
|
/* Alt-F2 = Show the command entry window */
|
||||||
if ((ke->event.modifiers & KEY_MOD_LEFT_ALT) &&
|
if ((ke->event.modifiers & KEY_MOD_LEFT_ALT) &&
|
||||||
(ke->event.keycode == KEY_F2) &&
|
(ke->event.keycode == KEY_F2) &&
|
||||||
@ -459,19 +448,11 @@ static void handle_key_event(struct yutani_msg_key_event * ke) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Alt-F3 = Show the context menu for the currently active window */
|
/* Maybe a plugin wants to handle this key bind */
|
||||||
#if 0
|
foreach(widget_node, widgets_enabled) {
|
||||||
if ((ke->event.modifiers & KEY_MOD_LEFT_ALT) &&
|
struct PanelWidget * widget = widget_node->value;
|
||||||
(ke->event.keycode == KEY_F3) &&
|
widget->onkey(widget, ke);
|
||||||
(ke->event.action == KEY_ACTION_DOWN)) {
|
|
||||||
foreach(node, window_list) {
|
|
||||||
struct window_ad * ad = node->value;
|
|
||||||
if (ad->flags & 1) {
|
|
||||||
window_show_menu(ad->wid, ad->left, DROPDOWN_OFFSET);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Releasing Alt when the Alt-Tab switcher is visible */
|
/* Releasing Alt when the Alt-Tab switcher is visible */
|
||||||
if ((was_tabbing) && (ke->event.keycode == 0 || ke->event.keycode == KEY_LEFT_ALT) &&
|
if ((was_tabbing) && (ke->event.keycode == 0 || ke->event.keycode == KEY_LEFT_ALT) &&
|
||||||
@ -668,15 +649,9 @@ static void bind_keys(void) {
|
|||||||
/* Ctrl-F11 = toggle panel visibility */
|
/* Ctrl-F11 = toggle panel visibility */
|
||||||
yutani_key_bind(yctx, KEY_F11, KEY_MOD_LEFT_CTRL, YUTANI_BIND_STEAL);
|
yutani_key_bind(yctx, KEY_F11, KEY_MOD_LEFT_CTRL, YUTANI_BIND_STEAL);
|
||||||
|
|
||||||
/* Alt+F1 = show menu */
|
|
||||||
yutani_key_bind(yctx, KEY_F1, KEY_MOD_LEFT_ALT, YUTANI_BIND_STEAL);
|
|
||||||
|
|
||||||
/* Alt+F2 = show app runner */
|
/* Alt+F2 = show app runner */
|
||||||
yutani_key_bind(yctx, KEY_F2, KEY_MOD_LEFT_ALT, YUTANI_BIND_STEAL);
|
yutani_key_bind(yctx, KEY_F2, KEY_MOD_LEFT_ALT, YUTANI_BIND_STEAL);
|
||||||
|
|
||||||
/* Alt+F3 = window context menu */
|
|
||||||
yutani_key_bind(yctx, KEY_F3, KEY_MOD_LEFT_ALT, YUTANI_BIND_STEAL);
|
|
||||||
|
|
||||||
/* This lets us receive all just-modifier key releases */
|
/* This lets us receive all just-modifier key releases */
|
||||||
yutani_key_bind(yctx, KEY_LEFT_ALT, 0, YUTANI_BIND_PASSTHROUGH);
|
yutani_key_bind(yctx, KEY_LEFT_ALT, 0, YUTANI_BIND_PASSTHROUGH);
|
||||||
|
|
||||||
@ -720,6 +695,10 @@ static int widget_update_generic(struct PanelWidget * this) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int widget_onkey_generic(struct PanelWidget * this, struct yutani_msg_key_event * evt) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
struct PanelWidget * widget_new(void) {
|
struct PanelWidget * widget_new(void) {
|
||||||
struct PanelWidget * out = calloc(1, sizeof(struct PanelWidget));
|
struct PanelWidget * out = calloc(1, sizeof(struct PanelWidget));
|
||||||
out->draw = widget_draw_generic;
|
out->draw = widget_draw_generic;
|
||||||
@ -728,6 +707,7 @@ struct PanelWidget * widget_new(void) {
|
|||||||
out->leave = widget_leave_generic;
|
out->leave = widget_leave_generic;
|
||||||
out->enter = widget_enter_generic;
|
out->enter = widget_enter_generic;
|
||||||
out->update = widget_update_generic;
|
out->update = widget_update_generic;
|
||||||
|
out->onkey = widget_onkey_generic;
|
||||||
out->move = mouse_event_ignore; /* move_generic */
|
out->move = mouse_event_ignore; /* move_generic */
|
||||||
out->highlighted = 0;
|
out->highlighted = 0;
|
||||||
out->fill = 0;
|
out->fill = 0;
|
||||||
|
@ -31,6 +31,7 @@ struct PanelWidget {
|
|||||||
int (*move)(struct PanelWidget *, struct yutani_msg_window_mouse_event *);
|
int (*move)(struct PanelWidget *, struct yutani_msg_window_mouse_event *);
|
||||||
int (*draw)(struct PanelWidget *, gfx_context_t * ctx);
|
int (*draw)(struct PanelWidget *, gfx_context_t * ctx);
|
||||||
int (*update)(struct PanelWidget *);
|
int (*update)(struct PanelWidget *);
|
||||||
|
int (*onkey)(struct PanelWidget *, struct yutani_msg_key_event *);
|
||||||
};
|
};
|
||||||
|
|
||||||
extern yutani_t * yctx;
|
extern yutani_t * yctx;
|
||||||
|
@ -25,14 +25,27 @@ static int widget_click_appmenu(struct PanelWidget * this, struct yutani_msg_win
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int widget_onkey_appmenu(struct PanelWidget * this, struct yutani_msg_key_event * ke) {
|
||||||
|
if ((ke->event.modifiers & KEY_MOD_LEFT_ALT) &&
|
||||||
|
(ke->event.keycode == KEY_F1) &&
|
||||||
|
(ke->event.action == KEY_ACTION_DOWN)) {
|
||||||
|
panel_menu_show(this,appmenu);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
struct PanelWidget * widget_init_appmenu(void) {
|
struct PanelWidget * widget_init_appmenu(void) {
|
||||||
appmenu = menu_set_get_root(menu_set_from_description("/etc/panel.menu", launch_application_menu));
|
appmenu = menu_set_get_root(menu_set_from_description("/etc/panel.menu", launch_application_menu));
|
||||||
appmenu->flags = MENU_FLAG_BUBBLE_CENTER;
|
appmenu->flags = MENU_FLAG_BUBBLE_CENTER;
|
||||||
|
|
||||||
|
/* Bind Alt+F1 */
|
||||||
|
yutani_key_bind(yctx, KEY_F1, KEY_MOD_LEFT_ALT, YUTANI_BIND_STEAL);
|
||||||
|
|
||||||
struct PanelWidget * widget = widget_new();
|
struct PanelWidget * widget = widget_new();
|
||||||
widget->width = 130;
|
widget->width = 130;
|
||||||
widget->draw = widget_draw_appmenu;
|
widget->draw = widget_draw_appmenu;
|
||||||
widget->click = widget_click_appmenu;
|
widget->click = widget_click_appmenu;
|
||||||
|
widget->onkey = widget_onkey_appmenu;
|
||||||
list_insert(widgets_enabled, widget);
|
list_insert(widgets_enabled, widget);
|
||||||
return widget;
|
return widget;
|
||||||
}
|
}
|
||||||
|
@ -193,6 +193,19 @@ static int widget_leave_windowlist(struct PanelWidget * this, struct yutani_msg_
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int widget_onkey_windowlist(struct PanelWidget * this, struct yutani_msg_key_event * ke) {
|
||||||
|
if ((ke->event.modifiers & KEY_MOD_LEFT_ALT) &&
|
||||||
|
(ke->event.keycode == KEY_F3) &&
|
||||||
|
(ke->event.action == KEY_ACTION_DOWN)) {
|
||||||
|
foreach(node, window_list) {
|
||||||
|
struct window_ad * ad = node->value;
|
||||||
|
if (ad->flags & 1) {
|
||||||
|
window_show_menu(ad->wid, ad->left + title_width / 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
struct PanelWidget * widget_init_windowlist(void) {
|
struct PanelWidget * widget_init_windowlist(void) {
|
||||||
window_menu = menu_create();
|
window_menu = menu_create();
|
||||||
@ -202,6 +215,9 @@ struct PanelWidget * widget_init_windowlist(void) {
|
|||||||
menu_insert(window_menu, menu_create_separator());
|
menu_insert(window_menu, menu_create_separator());
|
||||||
menu_insert(window_menu, menu_create_normal(NULL, NULL, "Close", _window_menu_close));
|
menu_insert(window_menu, menu_create_normal(NULL, NULL, "Close", _window_menu_close));
|
||||||
|
|
||||||
|
/* Alt+F3 = window context menu */
|
||||||
|
yutani_key_bind(yctx, KEY_F3, KEY_MOD_LEFT_ALT, YUTANI_BIND_STEAL);
|
||||||
|
|
||||||
struct PanelWidget * widget = widget_new();
|
struct PanelWidget * widget = widget_new();
|
||||||
widget->fill = 1;
|
widget->fill = 1;
|
||||||
widget->draw = widget_draw_windowlist;
|
widget->draw = widget_draw_windowlist;
|
||||||
@ -209,6 +225,7 @@ struct PanelWidget * widget_init_windowlist(void) {
|
|||||||
widget->right_click = widget_rightclick_windowlist;
|
widget->right_click = widget_rightclick_windowlist;
|
||||||
widget->move = widget_move_windowlist;
|
widget->move = widget_move_windowlist;
|
||||||
widget->leave = widget_leave_windowlist;
|
widget->leave = widget_leave_windowlist;
|
||||||
|
widget->onkey = widget_onkey_windowlist;
|
||||||
list_insert(widgets_enabled, widget);
|
list_insert(widgets_enabled, widget);
|
||||||
return widget;
|
return widget;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user