discomfitor pushed a commit to branch master.

http://git.enlightenment.org/core/enlightenment.git/commit/?id=c196ce0c12f964e38dadf4a787072f7f156311f6

commit c196ce0c12f964e38dadf4a787072f7f156311f6
Author: Mike Blumenkrantz <[email protected]>
Date:   Wed Feb 4 18:04:58 2015 -0500

    clamp wl popup coords to parent when possible
---
 src/modules/wl_desktop_shell/e_mod_main.c | 22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)

diff --git a/src/modules/wl_desktop_shell/e_mod_main.c 
b/src/modules/wl_desktop_shell/e_mod_main.c
index 025e944..374d399 100644
--- a/src/modules/wl_desktop_shell/e_mod_main.c
+++ b/src/modules/wl_desktop_shell/e_mod_main.c
@@ -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_DROPDOWN_MENU))
           {
-             x = ec->parent->client.x + ec->comp_data->popup.x;
-             y = ec->parent->client.y + ec->comp_data->popup.y;
+             x = E_CLAMP(ec->parent->client.x + ec->comp_data->popup.x,
+               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, 
                                   &_e_xdg_popup_interface, ec, NULL);
 
-   cdata->popup.x = x;
-   cdata->popup.y = y;
-
    cdata->surface = surface_resource;
    cdata->shell.configure_send = _e_xdg_shell_surface_configure_send;
    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 */
    _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);
 }
 

-- 


Reply via email to