Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Map touch inputs to the single enabled display when the 'last' multi-display mode is in use #388

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions output.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,26 @@ update_output_manager_config(struct cg_server *server)
wlr_output_manager_v1_set_configuration(server->output_manager_v1, config);
}

static void
update_cursor_map_to_output(struct cg_server *server)
{
struct cg_output *only_enabled_output = NULL;
struct cg_output *output;
wl_list_for_each (output, &server->outputs, link) {
if (!only_enabled_output && output->wlr_output->enabled) {
only_enabled_output = output;
} else {
only_enabled_output = NULL;
}
}

if (only_enabled_output) {
wlr_cursor_map_to_output(server->seat->cursor, only_enabled_output->wlr_output);
} else {
wlr_cursor_map_to_output(server->seat->cursor, NULL);
}
}

static inline void
output_layout_add_auto(struct cg_output *output)
{
Expand Down Expand Up @@ -112,6 +132,7 @@ output_enable(struct cg_output *output)
output_layout_add_auto(output);
}

update_cursor_map_to_output(output->server);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure you have to call this function in other case than handle_new_output() and handle_output_destroy()?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly, no I’m not sure. I think that it’s only needed when the outputs change but I only have limited experience with wlroots.

Happy to make any changes to this which you recommend.

update_output_manager_config(output->server);
}

Expand Down Expand Up @@ -183,6 +204,7 @@ handle_output_commit(struct wl_listener *listener, void *data)
* - always update output manager configuration even if the output is now disabled */

if (event->state->committed & OUTPUT_CONFIG_UPDATED) {
update_cursor_map_to_output(output->server);
update_output_manager_config(output->server);
}
}
Expand All @@ -194,6 +216,7 @@ handle_output_request_state(struct wl_listener *listener, void *data)
struct wlr_output_event_request_state *event = data;

if (wlr_output_commit_state(output->wlr_output, event->state)) {
update_cursor_map_to_output(output->server);
update_output_manager_config(output->server);
}
}
Expand All @@ -204,6 +227,7 @@ handle_output_layout_change(struct wl_listener *listener, void *data)
struct cg_server *server = wl_container_of(listener, server, output_layout_change);

view_position_all(server);
update_cursor_map_to_output(server);
update_output_manager_config(server);
}

Expand Down Expand Up @@ -331,6 +355,7 @@ handle_new_output(struct wl_listener *listener, void *data)
}

view_position_all(output->server);
update_cursor_map_to_output(output->server);
update_output_manager_config(output->server);
}

Expand Down