Re-implement the 'mode' command

next
Michael Stapelberg 2011-06-10 02:38:07 +02:00
parent c6352ded4e
commit 39b1c1bf75
4 changed files with 11 additions and 3 deletions

View File

@ -171,7 +171,7 @@ void grab_all_keys(xcb_connection_t *conn, bool bind_mode_switch);
* Switches the key bindings to the given mode, if the mode exists
*
*/
void switch_mode(xcb_connection_t *conn, const char *new_mode);
void switch_mode(const char *new_mode);
/**
* Returns a pointer to the Binding with the specified modifiers and keycode

View File

@ -112,7 +112,7 @@ border { return TOK_BORDER; }
normal { return TOK_NORMAL; }
none { return TOK_NONE; }
1pixel { return TOK_1PIXEL; }
mode { return TOK_MODE; }
mode { BEGIN(WANT_QSTRING); return TOK_MODE; }
tiling { return TOK_TILING; }
floating { return TOK_FLOATING; }
toggle { return TOK_TOGGLE; }

View File

@ -352,6 +352,7 @@ operation:
| mark
| resize
| nop
| mode
;
exec:
@ -784,3 +785,10 @@ direction:
| TOK_LEFT { $$ = TOK_LEFT; }
| TOK_RIGHT { $$ = TOK_RIGHT; }
;
mode:
TOK_MODE STR
{
switch_mode($2);
}
;

View File

@ -150,7 +150,7 @@ void grab_all_keys(xcb_connection_t *conn, bool bind_mode_switch) {
* Switches the key bindings to the given mode, if the mode exists
*
*/
void switch_mode(xcb_connection_t *conn, const char *new_mode) {
void switch_mode(const char *new_mode) {
struct Mode *mode;
LOG("Switching to mode %s\n", new_mode);