Merge branch 'fix-instance-criterion'
This commit is contained in:
commit
8510a4e322
|
@ -167,6 +167,7 @@ ctrl { return TOKCONTROL; }
|
||||||
shift { return TOKSHIFT; }
|
shift { return TOKSHIFT; }
|
||||||
|
|
||||||
class { yy_push_state(WANT_QSTRING); return TOK_CLASS; }
|
class { yy_push_state(WANT_QSTRING); return TOK_CLASS; }
|
||||||
|
instance { yy_push_state(WANT_QSTRING); return TOK_INSTANCE; }
|
||||||
id { yy_push_state(WANT_QSTRING); return TOK_ID; }
|
id { yy_push_state(WANT_QSTRING); return TOK_ID; }
|
||||||
con_id { yy_push_state(WANT_QSTRING); return TOK_CON_ID; }
|
con_id { yy_push_state(WANT_QSTRING); return TOK_CON_ID; }
|
||||||
con_mark { yy_push_state(WANT_QSTRING); return TOK_MARK; }
|
con_mark { yy_push_state(WANT_QSTRING); return TOK_MARK; }
|
||||||
|
|
|
@ -547,6 +547,7 @@ void parse_file(const char *f) {
|
||||||
|
|
||||||
%token TOK_MARK "mark"
|
%token TOK_MARK "mark"
|
||||||
%token TOK_CLASS "class"
|
%token TOK_CLASS "class"
|
||||||
|
%token TOK_INSTANCE "instance"
|
||||||
%token TOK_ID "id"
|
%token TOK_ID "id"
|
||||||
%token TOK_CON_ID "con_id"
|
%token TOK_CON_ID "con_id"
|
||||||
%token TOK_TITLE "title"
|
%token TOK_TITLE "title"
|
||||||
|
@ -694,6 +695,11 @@ criterion:
|
||||||
printf("criteria: class = %s\n", $3);
|
printf("criteria: class = %s\n", $3);
|
||||||
current_match.class = $3;
|
current_match.class = $3;
|
||||||
}
|
}
|
||||||
|
| TOK_INSTANCE '=' STR
|
||||||
|
{
|
||||||
|
printf("criteria: instance = %s\n", $3);
|
||||||
|
current_match.instance = $3;
|
||||||
|
}
|
||||||
| TOK_CON_ID '=' STR
|
| TOK_CON_ID '=' STR
|
||||||
{
|
{
|
||||||
printf("criteria: id = %s\n", $3);
|
printf("criteria: id = %s\n", $3);
|
||||||
|
|
|
@ -153,6 +153,7 @@ false { return TOK_DISABLE; }
|
||||||
no { return TOK_DISABLE; }
|
no { return TOK_DISABLE; }
|
||||||
|
|
||||||
class { BEGIN(WANT_QSTRING); return TOK_CLASS; }
|
class { BEGIN(WANT_QSTRING); return TOK_CLASS; }
|
||||||
|
instance { BEGIN(WANT_QSTRING); return TOK_INSTANCE; }
|
||||||
id { BEGIN(WANT_QSTRING); return TOK_ID; }
|
id { BEGIN(WANT_QSTRING); return TOK_ID; }
|
||||||
con_id { BEGIN(WANT_QSTRING); return TOK_CON_ID; }
|
con_id { BEGIN(WANT_QSTRING); return TOK_CON_ID; }
|
||||||
con_mark { BEGIN(WANT_QSTRING); return TOK_MARK; }
|
con_mark { BEGIN(WANT_QSTRING); return TOK_MARK; }
|
||||||
|
|
|
@ -175,6 +175,7 @@ bool definitelyGreaterThan(float a, float b, float epsilon) {
|
||||||
%token TOK_NOP "nop"
|
%token TOK_NOP "nop"
|
||||||
|
|
||||||
%token TOK_CLASS "class"
|
%token TOK_CLASS "class"
|
||||||
|
%token TOK_INSTANCE "instance"
|
||||||
%token TOK_ID "id"
|
%token TOK_ID "id"
|
||||||
%token TOK_CON_ID "con_id"
|
%token TOK_CON_ID "con_id"
|
||||||
%token TOK_TITLE "title"
|
%token TOK_TITLE "title"
|
||||||
|
@ -300,6 +301,11 @@ criterion:
|
||||||
printf("criteria: class = %s\n", $3);
|
printf("criteria: class = %s\n", $3);
|
||||||
current_match.class = $3;
|
current_match.class = $3;
|
||||||
}
|
}
|
||||||
|
| TOK_INSTANCE '=' STR
|
||||||
|
{
|
||||||
|
printf("criteria: instance = %s\n", $3);
|
||||||
|
current_match.instance = $3;
|
||||||
|
}
|
||||||
| TOK_CON_ID '=' STR
|
| TOK_CON_ID '=' STR
|
||||||
{
|
{
|
||||||
printf("criteria: id = %s\n", $3);
|
printf("criteria: id = %s\n", $3);
|
||||||
|
|
|
@ -244,6 +244,73 @@ cmp_ok(@content, '==', 1, 'one node on this workspace now');
|
||||||
is($content[0]->{border}, 'normal', 'no border');
|
is($content[0]->{border}, 'normal', 'no border');
|
||||||
|
|
||||||
|
|
||||||
|
exit_gracefully($process->pid);
|
||||||
|
|
||||||
|
##############################################################
|
||||||
|
# 5: check that a class criterion does not match the instance
|
||||||
|
##############################################################
|
||||||
|
|
||||||
|
$config = <<EOT;
|
||||||
|
# i3 config file (v4)
|
||||||
|
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
|
||||||
|
for_window [class="foo"] border 1pixel
|
||||||
|
EOT
|
||||||
|
|
||||||
|
$process = launch_with_config($config);
|
||||||
|
|
||||||
|
$tmp = fresh_workspace;
|
||||||
|
|
||||||
|
$window = $x->root->create_child(
|
||||||
|
class => WINDOW_CLASS_INPUT_OUTPUT,
|
||||||
|
rect => [ 0, 0, 30, 30 ],
|
||||||
|
background_color => '#00ff00',
|
||||||
|
);
|
||||||
|
|
||||||
|
$window->_create;
|
||||||
|
|
||||||
|
set_wm_class($window->id, 'bar', 'foo');
|
||||||
|
$window->name('usethis');
|
||||||
|
$window->map;
|
||||||
|
sleep 0.25;
|
||||||
|
|
||||||
|
@content = @{get_ws_content($tmp)};
|
||||||
|
cmp_ok(@content, '==', 1, 'one node on this workspace now');
|
||||||
|
is($content[0]->{border}, 'normal', 'normal border, not matched');
|
||||||
|
|
||||||
|
exit_gracefully($process->pid);
|
||||||
|
|
||||||
|
##############################################################
|
||||||
|
# 6: check that the 'instance' criterion works
|
||||||
|
##############################################################
|
||||||
|
|
||||||
|
$config = <<EOT;
|
||||||
|
# i3 config file (v4)
|
||||||
|
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
|
||||||
|
for_window [class="foo"] border 1pixel
|
||||||
|
for_window [instance="foo"] border none
|
||||||
|
EOT
|
||||||
|
|
||||||
|
$process = launch_with_config($config);
|
||||||
|
|
||||||
|
$tmp = fresh_workspace;
|
||||||
|
|
||||||
|
$window = $x->root->create_child(
|
||||||
|
class => WINDOW_CLASS_INPUT_OUTPUT,
|
||||||
|
rect => [ 0, 0, 30, 30 ],
|
||||||
|
background_color => '#00ff00',
|
||||||
|
);
|
||||||
|
|
||||||
|
$window->_create;
|
||||||
|
|
||||||
|
set_wm_class($window->id, 'bar', 'foo');
|
||||||
|
$window->name('usethis');
|
||||||
|
$window->map;
|
||||||
|
sleep 0.25;
|
||||||
|
|
||||||
|
@content = @{get_ws_content($tmp)};
|
||||||
|
cmp_ok(@content, '==', 1, 'one node on this workspace now');
|
||||||
|
is($content[0]->{border}, 'none', 'no border');
|
||||||
|
|
||||||
exit_gracefully($process->pid);
|
exit_gracefully($process->pid);
|
||||||
|
|
||||||
done_testing;
|
done_testing;
|
||||||
|
|
Loading…
Reference in New Issue