implement 'move' command in the new parser
This commit is contained in:
parent
98dbe63e35
commit
a0e33c1d68
|
@ -107,6 +107,8 @@ vertical { return TOK_VERTICAL; }
|
|||
level { return TOK_LEVEL; }
|
||||
up { return TOK_UP; }
|
||||
down { return TOK_DOWN; }
|
||||
before { return TOK_BEFORE; }
|
||||
after { return TOK_AFTER; }
|
||||
|
||||
class { BEGIN(WANT_QSTRING); return TOK_CLASS; }
|
||||
id { BEGIN(WANT_QSTRING); return TOK_ID; }
|
||||
|
|
|
@ -120,6 +120,8 @@ void parse_cmd(const char *new) {
|
|||
%token TOK_LEVEL "level"
|
||||
%token TOK_UP "up"
|
||||
%token TOK_DOWN "down"
|
||||
%token TOK_AFTER "after"
|
||||
%token TOK_BEFORE "before"
|
||||
|
||||
%token TOK_CLASS "class"
|
||||
%token TOK_ID "id"
|
||||
|
@ -249,8 +251,8 @@ operation:
|
|||
/*| reload
|
||||
| mark
|
||||
| layout
|
||||
| border
|
||||
| move*/
|
||||
| border */
|
||||
| move
|
||||
| workspace
|
||||
| attach
|
||||
| focus
|
||||
|
@ -418,3 +420,18 @@ level_direction:
|
|||
TOK_UP { $<chr>$ = 'u'; }
|
||||
| TOK_DOWN { $<chr>$ = 'd'; }
|
||||
;
|
||||
|
||||
move:
|
||||
TOK_MOVE WHITESPACE before_after WHITESPACE direction
|
||||
{
|
||||
printf("moving: %s and %c\n", ($<number>3 == TOK_BEFORE ? "before" : "after"), $<chr>5);
|
||||
/* TODO: change API for the next call, we need to convert in both directions while ideally
|
||||
* we should not need any of both */
|
||||
tree_move(($<number>3 == TOK_BEFORE ? 'p' : 'n'), ($<chr>5 == 'v' ? VERT : HORIZ));
|
||||
}
|
||||
;
|
||||
|
||||
before_after:
|
||||
TOK_BEFORE { $<number>$ = TOK_BEFORE; }
|
||||
| TOK_AFTER { $<number>$ = TOK_AFTER; }
|
||||
;
|
||||
|
|
|
@ -271,6 +271,8 @@ void tree_next(char way, orientation_t orientation) {
|
|||
void tree_move(char way, orientation_t orientation) {
|
||||
/* 1: get the first parent with the same orientation */
|
||||
Con *parent = focused->parent;
|
||||
if (parent->type == CT_OUTPUT)
|
||||
return;
|
||||
bool level_changed = false;
|
||||
while (parent->orientation != orientation) {
|
||||
LOG("need to go one level further up\n");
|
||||
|
|
Loading…
Reference in New Issue