mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-22 12:55:58 +01:00
compositor.c: determine xdg position by window geom
This commit is contained in:
parent
7a3edf6e62
commit
675a71dce7
1 changed files with 8 additions and 4 deletions
|
@ -67,6 +67,7 @@ struct sample_state {
|
||||||
struct example_xdg_surface_v6 {
|
struct example_xdg_surface_v6 {
|
||||||
struct wlr_xdg_surface_v6 *surface;
|
struct wlr_xdg_surface_v6 *surface;
|
||||||
|
|
||||||
|
// position of the wlr_surface in the layout
|
||||||
struct {
|
struct {
|
||||||
int lx;
|
int lx;
|
||||||
int ly;
|
int ly;
|
||||||
|
@ -338,11 +339,14 @@ static struct wlr_xdg_surface_v6 *example_xdg_surface_at(
|
||||||
wl_list_for_each(xdg_surface, &xdg_client->surfaces, link) {
|
wl_list_for_each(xdg_surface, &xdg_client->surfaces, link) {
|
||||||
struct example_xdg_surface_v6 *esurface = xdg_surface->data;
|
struct example_xdg_surface_v6 *esurface = xdg_surface->data;
|
||||||
|
|
||||||
if (sample->cursor->x >= esurface->position.lx &&
|
double window_x = esurface->position.lx + xdg_surface->geometry->x;
|
||||||
sample->cursor->y >= esurface->position.ly &&
|
double window_y = esurface->position.ly + xdg_surface->geometry->y;
|
||||||
sample->cursor->x <= esurface->position.lx +
|
|
||||||
|
if (sample->cursor->x >= window_x &&
|
||||||
|
sample->cursor->y >= window_y &&
|
||||||
|
sample->cursor->x <= window_x +
|
||||||
xdg_surface->geometry->width &&
|
xdg_surface->geometry->width &&
|
||||||
sample->cursor->y <= esurface->position.ly +
|
sample->cursor->y <= window_y +
|
||||||
xdg_surface->geometry->height) {
|
xdg_surface->geometry->height) {
|
||||||
return xdg_surface;
|
return xdg_surface;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue