mirror of
https://github.com/swaywm/sway.git
synced 2024-11-28 02:41:28 +00:00
Merge branch 'master' into feature/swap-workspace
This commit is contained in:
commit
5c335716f3
|
@ -12,12 +12,14 @@ struct cmd_results *cmd_primary_selection(int argc, char **argv) {
|
||||||
|
|
||||||
bool primary_selection = parse_boolean(argv[0], true);
|
bool primary_selection = parse_boolean(argv[0], true);
|
||||||
|
|
||||||
|
// config->primary_selection is reset to the previous value on reload in
|
||||||
|
// load_main_config()
|
||||||
if (config->reloading && config->primary_selection != primary_selection) {
|
if (config->reloading && config->primary_selection != primary_selection) {
|
||||||
return cmd_results_new(CMD_FAILURE,
|
return cmd_results_new(CMD_FAILURE,
|
||||||
"primary_selection can only be enabled/disabled at launch");
|
"primary_selection can only be enabled/disabled at launch");
|
||||||
}
|
}
|
||||||
|
|
||||||
config->primary_selection = parse_boolean(argv[0], true);
|
config->primary_selection = primary_selection;
|
||||||
|
|
||||||
return cmd_results_new(CMD_SUCCESS, NULL);
|
return cmd_results_new(CMD_SUCCESS, NULL);
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,8 @@ struct cmd_results *cmd_xwayland(int argc, char **argv) {
|
||||||
xwayland = XWAYLAND_MODE_DISABLED;
|
xwayland = XWAYLAND_MODE_DISABLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// config->xwayland is reset to the previous value on reload in
|
||||||
|
// load_main_config()
|
||||||
if (config->reloading && config->xwayland != xwayland) {
|
if (config->reloading && config->xwayland != xwayland) {
|
||||||
return cmd_results_new(CMD_FAILURE,
|
return cmd_results_new(CMD_FAILURE,
|
||||||
"xwayland can only be enabled/disabled at launch");
|
"xwayland can only be enabled/disabled at launch");
|
||||||
|
|
|
@ -475,6 +475,11 @@ bool load_main_config(const char *file, bool is_active, bool validating) {
|
||||||
old_config->xwayland ? "enabled" : "disabled");
|
old_config->xwayland ? "enabled" : "disabled");
|
||||||
config->xwayland = old_config->xwayland;
|
config->xwayland = old_config->xwayland;
|
||||||
|
|
||||||
|
// primary_selection can only be enabled/disabled at launch
|
||||||
|
sway_log(SWAY_DEBUG, "primary_selection will remain %s",
|
||||||
|
old_config->primary_selection ? "enabled" : "disabled");
|
||||||
|
config->primary_selection = old_config->primary_selection;
|
||||||
|
|
||||||
if (!config->validating) {
|
if (!config->validating) {
|
||||||
if (old_config->swaybg_client != NULL) {
|
if (old_config->swaybg_client != NULL) {
|
||||||
wl_client_destroy(old_config->swaybg_client);
|
wl_client_destroy(old_config->swaybg_client);
|
||||||
|
@ -494,56 +499,7 @@ bool load_main_config(const char *file, bool is_active, bool validating) {
|
||||||
|
|
||||||
config->reading = true;
|
config->reading = true;
|
||||||
|
|
||||||
// Read security configs
|
bool success = load_config(path, config, &config->swaynag_config_errors);
|
||||||
// TODO: Security
|
|
||||||
bool success = true;
|
|
||||||
/*
|
|
||||||
DIR *dir = opendir(SYSCONFDIR "/sway/security.d");
|
|
||||||
if (!dir) {
|
|
||||||
sway_log(SWAY_ERROR,
|
|
||||||
"%s does not exist, sway will have no security configuration"
|
|
||||||
" and will probably be broken", SYSCONFDIR "/sway/security.d");
|
|
||||||
} else {
|
|
||||||
list_t *secconfigs = create_list();
|
|
||||||
char *base = SYSCONFDIR "/sway/security.d/";
|
|
||||||
struct dirent *ent = readdir(dir);
|
|
||||||
struct stat s;
|
|
||||||
while (ent != NULL) {
|
|
||||||
char *_path = malloc(strlen(ent->d_name) + strlen(base) + 1);
|
|
||||||
strcpy(_path, base);
|
|
||||||
strcat(_path, ent->d_name);
|
|
||||||
lstat(_path, &s);
|
|
||||||
if (S_ISREG(s.st_mode) && ent->d_name[0] != '.') {
|
|
||||||
list_add(secconfigs, _path);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
free(_path);
|
|
||||||
}
|
|
||||||
ent = readdir(dir);
|
|
||||||
}
|
|
||||||
closedir(dir);
|
|
||||||
|
|
||||||
list_qsort(secconfigs, qstrcmp);
|
|
||||||
for (int i = 0; i < secconfigs->length; ++i) {
|
|
||||||
char *_path = secconfigs->items[i];
|
|
||||||
if (stat(_path, &s) || s.st_uid != 0 || s.st_gid != 0 ||
|
|
||||||
(((s.st_mode & 0777) != 0644) &&
|
|
||||||
(s.st_mode & 0777) != 0444)) {
|
|
||||||
sway_log(SWAY_ERROR,
|
|
||||||
"Refusing to load %s - it must be owned by root "
|
|
||||||
"and mode 644 or 444", _path);
|
|
||||||
success = false;
|
|
||||||
} else {
|
|
||||||
success = success && load_config(_path, config);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
list_free_items_and_destroy(secconfigs);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
success = success && load_config(path, config,
|
|
||||||
&config->swaynag_config_errors);
|
|
||||||
|
|
||||||
if (validating) {
|
if (validating) {
|
||||||
free_config(config);
|
free_config(config);
|
||||||
|
|
|
@ -58,11 +58,11 @@ struct text_buffer {
|
||||||
};
|
};
|
||||||
|
|
||||||
static int get_text_width(struct sway_text_node *props) {
|
static int get_text_width(struct sway_text_node *props) {
|
||||||
|
int width = props->width;
|
||||||
if (props->max_width) {
|
if (props->max_width) {
|
||||||
return MIN(props->max_width, props->width);
|
width = MIN(width, props->max_width);
|
||||||
}
|
}
|
||||||
|
return MAX(width, 0);
|
||||||
return props->width;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void update_source_box(struct text_buffer *buffer) {
|
static void update_source_box(struct text_buffer *buffer) {
|
||||||
|
|
Loading…
Reference in a new issue