From a018f8273fed6549d2fc529e5bb58cba11869ffb Mon Sep 17 00:00:00 2001 From: "Carsten Haitzler (Rasterman)" Date: Wed, 27 May 2020 14:17:07 +0100 Subject: [PATCH] e randr x - move pointer to a visible screen coord if outside screens on reconfigure if we find the pointer outside the screen region bounds it can get caught there until a warp forces it in. this is due to the barriers i added i think. this fixes that @fix --- src/bin/e_comp_x_randr.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/bin/e_comp_x_randr.c b/src/bin/e_comp_x_randr.c index 7754fd11e..da1b0759d 100644 --- a/src/bin/e_comp_x_randr.c +++ b/src/bin/e_comp_x_randr.c @@ -490,6 +490,8 @@ e_comp_x_randr_config_apply(void) int crtcs_num = 0, outputs_num = 0, i, numout; Ecore_X_Randr_Crtc_Info *info; int top_priority = 0; + int px, py; + Eina_Bool fix_pointer = EINA_TRUE; ecore_x_grab(); // set virtual resolution @@ -509,6 +511,8 @@ e_comp_x_randr_config_apply(void) if (nh < minh) nh = minh; ww = nw; if (nw < pw) ww = pw; hh = nh; if (nh < ph) hh = ph; + + ecore_x_pointer_xy_get(root, &px, &py); ecore_x_randr_screen_current_size_set(root, ww, hh, -1, -1); { int dww = 0, dhh = 0, dww2 = 0, dhh2 = 0; @@ -610,6 +614,16 @@ e_comp_x_randr_config_apply(void) screenconf[i]->config.geom.y, mode, orient)) printf("RRR: failed to set crtc!!!!!!\n"); + if (E_INSIDE(px, py, + screenconf[i]->config.geom.x, + screenconf[i]->config.geom.y, + screenconf[i]->config.geom.w, + screenconf[i]->config.geom.h)) + fix_pointer = EINA_FALSE; + px = screenconf[i]->config.geom.x + + (screenconf[i]->config.geom.w / 2); + py = screenconf[i]->config.geom.y + + (screenconf[i]->config.geom.h / 2); ecore_x_randr_crtc_panning_area_set (root, crtcs[i], screenconf[i]->config.geom.x, @@ -644,6 +658,10 @@ e_comp_x_randr_config_apply(void) ecore_x_root_screen_barriers_set(NULL, 0); } } + if (fix_pointer) + { + ecore_x_pointer_warp(root, px, py); + } free(outputs); free(crtcs);