lexer/parser: implement 'border' command

This commit is contained in:
Michael Stapelberg 2010-11-12 18:41:54 +01:00
parent c6c084faa5
commit 6eb7f2a01d
3 changed files with 29 additions and 2 deletions

View File

@ -316,6 +316,7 @@ struct Con {
enum { CF_NONE = 0, CF_OUTPUT = 1, CF_GLOBAL = 2 } fullscreen_mode; enum { CF_NONE = 0, CF_OUTPUT = 1, CF_GLOBAL = 2 } fullscreen_mode;
enum { L_DEFAULT = 0, L_STACKED = 1, L_TABBED = 2 } layout; enum { L_DEFAULT = 0, L_STACKED = 1, L_TABBED = 2 } layout;
enum { BS_NORMAL = 0, BS_NONE = 1, BS_1PIXEL = 3 } border_style;
/** floating? (= not in tiling layout) This cannot be simply a bool /** floating? (= not in tiling layout) This cannot be simply a bool
* because we want to keep track of whether the status was set by the * because we want to keep track of whether the status was set by the
* application (by setting _NET_WM_WINDOW_TYPE appropriately) or by the * application (by setting _NET_WM_WINDOW_TYPE appropriately) or by the

View File

@ -91,6 +91,7 @@ stacked { return TOK_STACKED; }
stacking { return TOK_STACKED; } stacking { return TOK_STACKED; }
tabbed { return TOK_TABBED; } tabbed { return TOK_TABBED; }
border { return TOK_BORDER; } border { return TOK_BORDER; }
normal { return TOK_NORMAL; }
none { return TOK_NONE; } none { return TOK_NONE; }
1pixel { return TOK_1PIXEL; } 1pixel { return TOK_1PIXEL; }
mode { return TOK_MODE; } mode { return TOK_MODE; }

View File

@ -109,6 +109,7 @@ char *parse_cmd(const char *new) {
%token TOK_STACKED "stacked" %token TOK_STACKED "stacked"
%token TOK_TABBED "tabbed" %token TOK_TABBED "tabbed"
%token TOK_BORDER "border" %token TOK_BORDER "border"
%token TOK_NORMAL "normal"
%token TOK_NONE "none" %token TOK_NONE "none"
%token TOK_1PIXEL "1pixel" %token TOK_1PIXEL "1pixel"
%token TOK_MODE "mode" %token TOK_MODE "mode"
@ -284,8 +285,7 @@ operation:
| exit | exit
| restart | restart
| reload | reload
/* | border
| border */
| layout | layout
| restore | restore
| move | move
@ -479,6 +479,31 @@ window_mode:
| TOK_TOGGLE { $<number>$ = TOK_TOGGLE; } | TOK_TOGGLE { $<number>$ = TOK_TOGGLE; }
; ;
border:
TOK_BORDER WHITESPACE border_style
{
printf("border style should be changed to %d\n", $<number>3);
owindow *current;
/* check if the match is empty, not if the result is empty */
if (match_is_empty(&current_match))
focused->border_style = $<number>3;
else {
TAILQ_FOREACH(current, &owindows, owindows) {
printf("matching: %p / %s\n", current->con, current->con->name);
current->con->border_style = $<number>3;
}
}
}
;
border_style:
TOK_NORMAL { $<number>$ = BS_NORMAL; }
| TOK_NONE { $<number>$ = BS_NONE; }
| TOK_1PIXEL { $<number>$ = BS_1PIXEL; }
;
level: level:
TOK_LEVEL WHITESPACE level_direction TOK_LEVEL WHITESPACE level_direction
{ {