mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-26 22:55:58 +01:00
Merge pull request #1320 from emersion/fix-duplicate-cursors
output-layout, cursor: fix duplicate cursors
This commit is contained in:
commit
9e060be04b
2 changed files with 19 additions and 4 deletions
|
@ -620,8 +620,14 @@ static void handle_layout_output_destroy(struct wl_listener *listener,
|
||||||
|
|
||||||
static void layout_add(struct wlr_cursor_state *state,
|
static void layout_add(struct wlr_cursor_state *state,
|
||||||
struct wlr_output_layout_output *l_output) {
|
struct wlr_output_layout_output *l_output) {
|
||||||
struct wlr_cursor_output_cursor *output_cursor =
|
struct wlr_cursor_output_cursor *output_cursor;
|
||||||
calloc(1, sizeof(struct wlr_cursor_output_cursor));
|
wl_list_for_each(output_cursor, &state->output_cursors, link) {
|
||||||
|
if (output_cursor->output_cursor->output == l_output->output) {
|
||||||
|
return; // already added
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
output_cursor = calloc(1, sizeof(struct wlr_cursor_output_cursor));
|
||||||
if (output_cursor == NULL) {
|
if (output_cursor == NULL) {
|
||||||
wlr_log(WLR_ERROR, "Failed to allocate wlr_cursor_output_cursor");
|
wlr_log(WLR_ERROR, "Failed to allocate wlr_cursor_output_cursor");
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -204,6 +204,7 @@ void wlr_output_layout_add(struct wlr_output_layout *layout,
|
||||||
struct wlr_output *output, int lx, int ly) {
|
struct wlr_output *output, int lx, int ly) {
|
||||||
struct wlr_output_layout_output *l_output =
|
struct wlr_output_layout_output *l_output =
|
||||||
wlr_output_layout_get(layout, output);
|
wlr_output_layout_get(layout, output);
|
||||||
|
bool is_new = l_output == NULL;
|
||||||
if (!l_output) {
|
if (!l_output) {
|
||||||
l_output = output_layout_output_create(layout, output);
|
l_output = output_layout_output_create(layout, output);
|
||||||
if (!l_output) {
|
if (!l_output) {
|
||||||
|
@ -211,12 +212,16 @@ void wlr_output_layout_add(struct wlr_output_layout *layout,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
l_output->x = lx;
|
l_output->x = lx;
|
||||||
l_output->y = ly;
|
l_output->y = ly;
|
||||||
l_output->state->auto_configured = false;
|
l_output->state->auto_configured = false;
|
||||||
output_layout_reconfigure(layout);
|
output_layout_reconfigure(layout);
|
||||||
output_update_global(output);
|
output_update_global(output);
|
||||||
|
|
||||||
|
if (is_new) {
|
||||||
wlr_signal_emit_safe(&layout->events.add, l_output);
|
wlr_signal_emit_safe(&layout->events.add, l_output);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_output_layout_output *wlr_output_layout_get(
|
struct wlr_output_layout_output *wlr_output_layout_get(
|
||||||
|
@ -409,6 +414,7 @@ void wlr_output_layout_add_auto(struct wlr_output_layout *layout,
|
||||||
struct wlr_output *output) {
|
struct wlr_output *output) {
|
||||||
struct wlr_output_layout_output *l_output =
|
struct wlr_output_layout_output *l_output =
|
||||||
wlr_output_layout_get(layout, output);
|
wlr_output_layout_get(layout, output);
|
||||||
|
bool is_new = l_output == NULL;
|
||||||
if (!l_output) {
|
if (!l_output) {
|
||||||
l_output = output_layout_output_create(layout, output);
|
l_output = output_layout_output_create(layout, output);
|
||||||
if (!l_output) {
|
if (!l_output) {
|
||||||
|
@ -420,7 +426,10 @@ void wlr_output_layout_add_auto(struct wlr_output_layout *layout,
|
||||||
l_output->state->auto_configured = true;
|
l_output->state->auto_configured = true;
|
||||||
output_layout_reconfigure(layout);
|
output_layout_reconfigure(layout);
|
||||||
output_update_global(output);
|
output_update_global(output);
|
||||||
|
|
||||||
|
if (is_new) {
|
||||||
wlr_signal_emit_safe(&layout->events.add, l_output);
|
wlr_signal_emit_safe(&layout->events.add, l_output);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_output *wlr_output_layout_get_center_output(
|
struct wlr_output *wlr_output_layout_get_center_output(
|
||||||
|
|
Loading…
Reference in a new issue