forked from enlightenment/enlightenment
clamp wl popup coords to parent when possible
This commit is contained in:
parent
ad41e45b84
commit
c196ce0c12
|
@ -468,8 +468,12 @@ _e_shell_surface_configure(struct wl_resource *resource, Evas_Coord x, Evas_Coor
|
||||||
(ec->netwm.type == E_WINDOW_TYPE_POPUP_MENU) ||
|
(ec->netwm.type == E_WINDOW_TYPE_POPUP_MENU) ||
|
||||||
(ec->netwm.type == E_WINDOW_TYPE_DROPDOWN_MENU))
|
(ec->netwm.type == E_WINDOW_TYPE_DROPDOWN_MENU))
|
||||||
{
|
{
|
||||||
x = ec->parent->client.x + ec->comp_data->popup.x;
|
x = E_CLAMP(ec->parent->client.x + ec->comp_data->popup.x,
|
||||||
y = ec->parent->client.y + ec->comp_data->popup.y;
|
ec->parent->client.x,
|
||||||
|
ec->parent->client.x + ec->parent->client.w - ec->client.w);
|
||||||
|
y = E_CLAMP(ec->parent->client.y + ec->comp_data->popup.y,
|
||||||
|
ec->parent->client.y,
|
||||||
|
ec->parent->client.y + ec->parent->client.h - ec->client.h);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1296,9 +1300,6 @@ _e_xdg_shell_cb_popup_get(struct wl_client *client, struct wl_resource *resource
|
||||||
wl_resource_set_implementation(cdata->shell.surface,
|
wl_resource_set_implementation(cdata->shell.surface,
|
||||||
&_e_xdg_popup_interface, ec, NULL);
|
&_e_xdg_popup_interface, ec, NULL);
|
||||||
|
|
||||||
cdata->popup.x = x;
|
|
||||||
cdata->popup.y = y;
|
|
||||||
|
|
||||||
cdata->surface = surface_resource;
|
cdata->surface = surface_resource;
|
||||||
cdata->shell.configure_send = _e_xdg_shell_surface_configure_send;
|
cdata->shell.configure_send = _e_xdg_shell_surface_configure_send;
|
||||||
cdata->shell.configure = _e_xdg_shell_surface_configure;
|
cdata->shell.configure = _e_xdg_shell_surface_configure;
|
||||||
|
@ -1320,6 +1321,17 @@ _e_xdg_shell_cb_popup_get(struct wl_client *client, struct wl_resource *resource
|
||||||
/* set this client as a transient for parent */
|
/* set this client as a transient for parent */
|
||||||
_e_shell_surface_parent_set(ec, parent_resource);
|
_e_shell_surface_parent_set(ec, parent_resource);
|
||||||
|
|
||||||
|
if (ec->parent)
|
||||||
|
{
|
||||||
|
cdata->popup.x = E_CLAMP(x, 0, ec->parent->client.w);
|
||||||
|
cdata->popup.y = E_CLAMP(y, 0, ec->parent->client.y);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cdata->popup.x = x;
|
||||||
|
cdata->popup.y = y;
|
||||||
|
}
|
||||||
|
|
||||||
EC_CHANGED(ec);
|
EC_CHANGED(ec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue