EINA_SAFETY_ON_NULL_RETURN(window);
- if ((window->input_rect.x == x) && (window->input_rect.y == y) &&
- (window->input_rect.w == w) && (window->input_rect.h == h))
- return;
-
- window->input_rect.x = x;
- window->input_rect.y = y;
- window->input_rect.w = w;
- window->input_rect.h = h;
- window->input_set = 1;
-
- if (window->type == ECORE_WL2_WINDOW_TYPE_DND) return;
- if (!window->surface) return; //surface not created yet
-
- region = wl_compositor_create_region(window->display->wl.compositor);
- if (!region)
+ if ((x == 0) && (y == 0) && (w == 0) && (h == 0))
{
- ERR("Failed to create opaque region");
+ if (window->surface)
+ wl_surface_set_input_region(window->surface, NULL);
return;
}
switch (window->rotation)
{
case 0:
- wl_region_add(region, x, y, w, h);
- break;
- case 180:
- wl_region_add(region, x, x + y, w, h);
+ window->input_rect.x = x;
+ window->input_rect.y = y;
+ window->input_rect.w = w;
+ window->input_rect.h = h;
break;
case 90:
- wl_region_add(region, y, x, h, w);
+ window->input_rect.x = y;
+ window->input_rect.y = x;
+ window->input_rect.w = h;
+ window->input_rect.h = w;
+ break;
+ case 180:
+ window->input_rect.x = x;
+ window->input_rect.y = x + y;
+ window->input_rect.w = w;
+ window->input_rect.h = h;
break;
case 270:
- wl_region_add(region, x + y, x, h, w);
+ window->input_rect.x = x + y;
+ window->input_rect.y = x;
+ window->input_rect.w = h;
+ window->input_rect.h = w;
+ break;
+ default:
break;
}
+ window->input_set = EINA_TRUE;
+
+ if (!window->surface) return;
+ if (window->type == ECORE_WL2_WINDOW_TYPE_DND) return;
+
+ region = wl_compositor_create_region(window->display->wl.compositor);
+ if (!region)
+ {
+ ERR("Failed to create input region");
+ return;
+ }
+
+ wl_region_add(region, window->input_rect.x, window->input_rect.y,
+ window->input_rect.w, window->input_rect.h);
wl_surface_set_input_region(window->surface, region);
wl_region_destroy(region);
}