mirror of
https://github.com/swaywm/sway.git
synced 2024-11-26 18:01:29 +00:00
Fixed window_type with disabled xwayland support.
This commit is contained in:
parent
c9276f04c9
commit
587e320cd8
|
@ -29,9 +29,9 @@ struct criteria {
|
||||||
uint32_t con_id; // internal ID
|
uint32_t con_id; // internal ID
|
||||||
#ifdef HAVE_XWAYLAND
|
#ifdef HAVE_XWAYLAND
|
||||||
uint32_t id; // X11 window ID
|
uint32_t id; // X11 window ID
|
||||||
|
enum atom_name window_type;
|
||||||
#endif
|
#endif
|
||||||
pcre *window_role;
|
pcre *window_role;
|
||||||
enum atom_name window_type;
|
|
||||||
bool floating;
|
bool floating;
|
||||||
bool tiling;
|
bool tiling;
|
||||||
char urgent; // 'l' for latest or 'o' for oldest
|
char urgent; // 'l' for latest or 'o' for oldest
|
||||||
|
|
|
@ -4,4 +4,4 @@ option('default-wallpaper', type: 'boolean', value: true, description: 'Install
|
||||||
option('zsh-completions', type: 'boolean', value: true, description: 'Install zsh shell completions.')
|
option('zsh-completions', type: 'boolean', value: true, description: 'Install zsh shell completions.')
|
||||||
option('bash-completions', type: 'boolean', value: true, description: 'Install bash shell completions.')
|
option('bash-completions', type: 'boolean', value: true, description: 'Install bash shell completions.')
|
||||||
option('fish-completions', type: 'boolean', value: true, description: 'Install fish shell completions.')
|
option('fish-completions', type: 'boolean', value: true, description: 'Install fish shell completions.')
|
||||||
option('enable-xwayland', type: 'boolean', value: true, description: 'Enable support for X11 applications')
|
option('enable-xwayland', type: 'boolean', value: false, description: 'Enable support for X11 applications')
|
||||||
|
|
|
@ -24,9 +24,9 @@ bool criteria_is_empty(struct criteria *criteria) {
|
||||||
&& !criteria->con_id
|
&& !criteria->con_id
|
||||||
#ifdef HAVE_XWAYLAND
|
#ifdef HAVE_XWAYLAND
|
||||||
&& !criteria->id
|
&& !criteria->id
|
||||||
|
&& criteria->window_type == ATOM_LAST
|
||||||
#endif
|
#endif
|
||||||
&& !criteria->window_role
|
&& !criteria->window_role
|
||||||
&& criteria->window_type == ATOM_LAST
|
|
||||||
&& !criteria->floating
|
&& !criteria->floating
|
||||||
&& !criteria->tiling
|
&& !criteria->tiling
|
||||||
&& !criteria->urgent
|
&& !criteria->urgent
|
||||||
|
@ -51,8 +51,8 @@ static int regex_cmp(const char *item, const pcre *regex) {
|
||||||
return pcre_exec(regex, NULL, item, strlen(item), 0, 0, NULL, 0);
|
return pcre_exec(regex, NULL, item, strlen(item), 0, 0, NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool view_has_window_type(struct sway_view *view, enum atom_name name) {
|
|
||||||
#ifdef HAVE_XWAYLAND
|
#ifdef HAVE_XWAYLAND
|
||||||
|
static bool view_has_window_type(struct sway_view *view, enum atom_name name) {
|
||||||
if (view->type != SWAY_VIEW_XWAYLAND) {
|
if (view->type != SWAY_VIEW_XWAYLAND) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -64,9 +64,9 @@ static bool view_has_window_type(struct sway_view *view, enum atom_name name) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static int cmp_urgent(const void *_a, const void *_b) {
|
static int cmp_urgent(const void *_a, const void *_b) {
|
||||||
struct sway_view *a = *(void **)_a;
|
struct sway_view *a = *(void **)_a;
|
||||||
|
@ -162,11 +162,13 @@ static bool criteria_matches_view(struct criteria *criteria,
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_XWAYLAND
|
||||||
if (criteria->window_type != ATOM_LAST) {
|
if (criteria->window_type != ATOM_LAST) {
|
||||||
if (!view_has_window_type(view, criteria->window_type)) {
|
if (!view_has_window_type(view, criteria->window_type)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (criteria->floating) {
|
if (criteria->floating) {
|
||||||
if (!container_is_floating(view->swayc)) {
|
if (!container_is_floating(view->swayc)) {
|
||||||
|
@ -271,6 +273,7 @@ static bool generate_regex(pcre **regex, char *value) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_XWAYLAND
|
||||||
static enum atom_name parse_window_type(const char *type) {
|
static enum atom_name parse_window_type(const char *type) {
|
||||||
if (strcasecmp(type, "normal") == 0) {
|
if (strcasecmp(type, "normal") == 0) {
|
||||||
return NET_WM_WINDOW_TYPE_NORMAL;
|
return NET_WM_WINDOW_TYPE_NORMAL;
|
||||||
|
@ -285,6 +288,7 @@ static enum atom_name parse_window_type(const char *type) {
|
||||||
}
|
}
|
||||||
return ATOM_LAST; // ie. invalid
|
return ATOM_LAST; // ie. invalid
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
enum criteria_token {
|
enum criteria_token {
|
||||||
T_APP_ID,
|
T_APP_ID,
|
||||||
|
@ -294,6 +298,7 @@ enum criteria_token {
|
||||||
T_FLOATING,
|
T_FLOATING,
|
||||||
#ifdef HAVE_XWAYLAND
|
#ifdef HAVE_XWAYLAND
|
||||||
T_ID,
|
T_ID,
|
||||||
|
T_WINDOW_TYPE,
|
||||||
#endif
|
#endif
|
||||||
T_INSTANCE,
|
T_INSTANCE,
|
||||||
T_SHELL,
|
T_SHELL,
|
||||||
|
@ -301,7 +306,6 @@ enum criteria_token {
|
||||||
T_TITLE,
|
T_TITLE,
|
||||||
T_URGENT,
|
T_URGENT,
|
||||||
T_WINDOW_ROLE,
|
T_WINDOW_ROLE,
|
||||||
T_WINDOW_TYPE,
|
|
||||||
T_WORKSPACE,
|
T_WORKSPACE,
|
||||||
|
|
||||||
T_INVALID,
|
T_INVALID,
|
||||||
|
@ -319,6 +323,8 @@ static enum criteria_token token_from_name(char *name) {
|
||||||
#ifdef HAVE_XWAYLAND
|
#ifdef HAVE_XWAYLAND
|
||||||
} else if (strcmp(name, "id") == 0) {
|
} else if (strcmp(name, "id") == 0) {
|
||||||
return T_ID;
|
return T_ID;
|
||||||
|
} else if (strcmp(name, "window_type") == 0) {
|
||||||
|
return T_WINDOW_TYPE;
|
||||||
#endif
|
#endif
|
||||||
} else if (strcmp(name, "instance") == 0) {
|
} else if (strcmp(name, "instance") == 0) {
|
||||||
return T_INSTANCE;
|
return T_INSTANCE;
|
||||||
|
@ -330,8 +336,6 @@ static enum criteria_token token_from_name(char *name) {
|
||||||
return T_URGENT;
|
return T_URGENT;
|
||||||
} else if (strcmp(name, "window_role") == 0) {
|
} else if (strcmp(name, "window_role") == 0) {
|
||||||
return T_WINDOW_ROLE;
|
return T_WINDOW_ROLE;
|
||||||
} else if (strcmp(name, "window_type") == 0) {
|
|
||||||
return T_WINDOW_TYPE;
|
|
||||||
} else if (strcmp(name, "workspace") == 0) {
|
} else if (strcmp(name, "workspace") == 0) {
|
||||||
return T_WORKSPACE;
|
return T_WORKSPACE;
|
||||||
}
|
}
|
||||||
|
@ -397,10 +401,10 @@ static char *get_focused_prop(enum criteria_token token) {
|
||||||
case T_FLOATING:
|
case T_FLOATING:
|
||||||
#ifdef HAVE_XWAYLAND
|
#ifdef HAVE_XWAYLAND
|
||||||
case T_ID:
|
case T_ID:
|
||||||
|
case T_WINDOW_TYPE:
|
||||||
#endif
|
#endif
|
||||||
case T_TILING:
|
case T_TILING:
|
||||||
case T_URGENT:
|
case T_URGENT:
|
||||||
case T_WINDOW_TYPE:
|
|
||||||
case T_INVALID:
|
case T_INVALID:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -465,10 +469,10 @@ static bool parse_token(struct criteria *criteria, char *name, char *value) {
|
||||||
case T_WINDOW_ROLE:
|
case T_WINDOW_ROLE:
|
||||||
generate_regex(&criteria->window_role, effective_value);
|
generate_regex(&criteria->window_role, effective_value);
|
||||||
break;
|
break;
|
||||||
|
#ifdef HAVE_XWAYLAND
|
||||||
case T_WINDOW_TYPE:
|
case T_WINDOW_TYPE:
|
||||||
criteria->window_type = parse_window_type(effective_value);
|
criteria->window_type = parse_window_type(effective_value);
|
||||||
break;
|
break;
|
||||||
#ifdef HAVE_XWAYLAND
|
|
||||||
case T_ID:
|
case T_ID:
|
||||||
criteria->id = strtoul(effective_value, &endptr, 10);
|
criteria->id = strtoul(effective_value, &endptr, 10);
|
||||||
if (*endptr != 0) {
|
if (*endptr != 0) {
|
||||||
|
@ -559,7 +563,9 @@ struct criteria *criteria_parse(char *raw, char **error_arg) {
|
||||||
++head;
|
++head;
|
||||||
|
|
||||||
struct criteria *criteria = calloc(1, sizeof(struct criteria));
|
struct criteria *criteria = calloc(1, sizeof(struct criteria));
|
||||||
|
#ifdef HAVE_XWAYLAND
|
||||||
criteria->window_type = ATOM_LAST; // default value
|
criteria->window_type = ATOM_LAST; // default value
|
||||||
|
#endif
|
||||||
char *name = NULL, *value = NULL;
|
char *name = NULL, *value = NULL;
|
||||||
bool in_quotes = false;
|
bool in_quotes = false;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue