Merge pull request #3214 from RedSoxFan/fix-3156

Fix default_orientation auto
This commit is contained in:
emersion 2018-11-28 21:00:34 +01:00 committed by GitHub
commit 659ab79b66
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -88,11 +88,12 @@ void output_enable(struct sway_output *output, struct output_config *oc) {
restore_workspaces(output); restore_workspaces(output);
struct sway_workspace *ws = NULL;
if (!output->workspaces->length) { if (!output->workspaces->length) {
// Create workspace // Create workspace
char *ws_name = workspace_next_name(wlr_output->name); char *ws_name = workspace_next_name(wlr_output->name);
wlr_log(WLR_DEBUG, "Creating default workspace %s", ws_name); wlr_log(WLR_DEBUG, "Creating default workspace %s", ws_name);
struct sway_workspace *ws = workspace_create(output, ws_name); ws = workspace_create(output, ws_name);
// Set each seat's focus if not already set // Set each seat's focus if not already set
struct sway_seat *seat = NULL; struct sway_seat *seat = NULL;
wl_list_for_each(seat, &server.input->seats, link) { wl_list_for_each(seat, &server.input->seats, link) {
@ -104,9 +105,15 @@ void output_enable(struct sway_output *output, struct output_config *oc) {
ipc_event_workspace(NULL, ws, "init"); ipc_event_workspace(NULL, ws, "init");
} }
apply_output_config(oc, output); apply_output_config(oc, output);
if (ws && config->default_orientation == L_NONE) {
// Since the output transformation and resolution could have changed
// due to applying the output config, the previously set layout for the
// created workspace may not be correct for `default_orientation auto`
ws->layout = output_get_default_layout(output);
}
input_manager_configure_xcursor(); input_manager_configure_xcursor();
wl_signal_add(&wlr_output->events.mode, &output->mode); wl_signal_add(&wlr_output->events.mode, &output->mode);