Skip to content

Commit 199e59e

Browse files
authored
Merge branch 'master' into fix-cursor-events
2 parents 6cd51ff + 5312376 commit 199e59e

File tree

7 files changed

+30
-11
lines changed

7 files changed

+30
-11
lines changed

include/sway/config.h

+2
Original file line numberDiff line numberDiff line change
@@ -705,6 +705,8 @@ struct output_config *find_output_config(struct sway_output *output);
705705
void free_output_config(struct output_config *oc);
706706

707707
void request_modeset(void);
708+
void force_modeset(void);
709+
bool modeset_is_pending(void);
708710

709711
bool spawn_swaybg(void);
710712

sway/commands/include.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33

44
struct cmd_results *cmd_include(int argc, char **argv) {
55
struct cmd_results *error = NULL;
6-
if ((error = checkarg(argc, "include", EXPECTED_EQUAL_TO, 1))) {
6+
if ((error = checkarg(argc, "include", EXPECTED_AT_LEAST, 1))) {
77
return error;
88
}
9-
9+
char *files = join_args(argv, argc);
1010
// We don't care if the included config(s) fails to load.
11-
load_include_configs(argv[0], config, &config->swaynag_config_errors);
11+
load_include_configs(files, config, &config->swaynag_config_errors);
1212

1313
return cmd_results_new(CMD_SUCCESS, NULL);
1414
}

sway/desktop/output.c

+16-5
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,18 @@ void request_modeset(void) {
408408
}
409409
}
410410

411+
bool modeset_is_pending(void) {
412+
return server.delayed_modeset != NULL;
413+
}
414+
415+
void force_modeset(void) {
416+
if (server.delayed_modeset != NULL) {
417+
wl_event_source_remove(server.delayed_modeset);
418+
server.delayed_modeset = NULL;
419+
}
420+
apply_stored_output_configs();
421+
}
422+
411423
static void begin_destroy(struct sway_output *output) {
412424
if (output->enabled) {
413425
output_disable(output);
@@ -428,6 +440,9 @@ static void begin_destroy(struct sway_output *output) {
428440
output->wlr_output->data = NULL;
429441
output->wlr_output = NULL;
430442

443+
wl_event_source_remove(output->repaint_timer);
444+
output->repaint_timer = NULL;
445+
431446
request_modeset();
432447
}
433448

@@ -493,12 +508,8 @@ static void handle_request_state(struct wl_listener *listener, void *data) {
493508
// We do not expect or support any other changes here
494509
assert(committed == 0);
495510
store_output_config(oc);
496-
apply_stored_output_configs();
497511

498-
if (server.delayed_modeset != NULL) {
499-
wl_event_source_remove(server.delayed_modeset);
500-
server.delayed_modeset = NULL;
501-
}
512+
force_modeset();
502513
}
503514

504515
static unsigned int last_headless_num = 0;

sway/ipc-server.c

+6
Original file line numberDiff line numberDiff line change
@@ -648,6 +648,12 @@ void ipc_client_handle_command(struct ipc_client *client, uint32_t payload_lengt
648648
}
649649

650650
list_t *res_list = execute_command(buf, NULL, NULL);
651+
if (modeset_is_pending()) {
652+
// IPC expects commands to have taken immediate effect, so we need
653+
// to force a modeset after output commands. We do a single modeset
654+
// here to avoid modesetting for every output command in sequence.
655+
force_modeset();
656+
}
651657
transaction_commit_dirty();
652658
char *json = cmd_results_to_json(res_list);
653659
int length = strlen(json);

sway/main.c

+1
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,7 @@ int main(int argc, char **argv) {
361361
}
362362

363363
config->active = true;
364+
force_modeset();
364365
load_swaybars();
365366
run_deferred_commands();
366367
run_deferred_bindings();

sway/sway.5.scd

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ The following commands may only be used in the configuration file.
6666
*default_orientation* horizontal|vertical|auto
6767
Sets the default container layout for tiled containers.
6868

69-
*include* <path>
70-
Includes another file from _path_. _path_ can be either a full path or a
69+
*include* <paths...>
70+
Include files from _paths_. _paths_ can include either a full path or a
7171
path relative to the parent config, and expands shell syntax (see
7272
*wordexp*(3) for details). The same include file can only be included once;
7373
subsequent attempts will be ignored.

sway/tree/output.c

-1
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,6 @@ void output_destroy(struct sway_output *output) {
273273
destroy_scene_layers(output);
274274
list_free(output->workspaces);
275275
list_free(output->current.workspaces);
276-
wl_event_source_remove(output->repaint_timer);
277276
wlr_color_transform_unref(output->color_transform);
278277
free(output);
279278
}

0 commit comments

Comments
 (0)