aboutsummaryrefslogtreecommitdiff
path: root/examples/pointer.c
diff options
context:
space:
mode:
authorTony Crisci <tony@dubstepdish.com>2017-08-25 08:58:02 -0400
committerTony Crisci <tony@dubstepdish.com>2017-08-26 08:32:11 -0400
commit699d489f936826a808f955c47442342e850bfc1b (patch)
treec29dad502c08ff2e5ec8beb56f3aef23dd7acdd1 /examples/pointer.c
parentb3a43e226140d9b5d49c4ed24798e3f3006dcae5 (diff)
add cursor configuration
Diffstat (limited to 'examples/pointer.c')
-rw-r--r--examples/pointer.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/examples/pointer.c b/examples/pointer.c
index fcf9805f..88fdaef7 100644
--- a/examples/pointer.c
+++ b/examples/pointer.c
@@ -70,6 +70,11 @@ static void handle_output_add(struct output_state *ostate) {
sample->layout = configure_layout(sample->config, &ostate->compositor->outputs);
wlr_cursor_attach_output_layout(sample->cursor, sample->layout);
+ char *mapped_output = sample->config->cursor.mapped_output;
+ if (mapped_output && strcmp(mapped_output, wlr_output->name) == 0) {
+ wlr_cursor_map_to_output(sample->cursor, wlr_output);
+ }
+
/*
// TODO configuration
if (strcmp("DP-1", ostate->output->name) == 0) {
@@ -95,6 +100,10 @@ static void handle_output_remove(struct output_state *ostate) {
wlr_output_layout_destroy(sample->layout);
sample->layout = configure_layout(sample->config, &ostate->compositor->outputs);
wlr_cursor_attach_output_layout(sample->cursor, sample->layout);
+
+ if (strcmp(sample->config->cursor.mapped_output, ostate->output->name) == 0) {
+ wlr_cursor_map_to_output(sample->cursor, NULL);
+ }
}
static void handle_output_resolution(struct compositor_state *state,