From: "Rodolfo García Peñas (kix)" <[email protected]>

This patch includes check that is enough extra space below the clicked
point and the bottom of the screen, to show the Dock menu.

Before this patch, if the Dock/Clip is in the screen bottom, and clip to
show the menu in the bottom area, the menu is hidden outside the screen.
---
 src/dock.c |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/dock.c b/src/dock.c
index 0140bd1..5d56528 100644
--- a/src/dock.c
+++ b/src/dock.c
@@ -61,6 +61,8 @@
 #define CLIP_IDLE         0
 #define CLIP_FORWARD      2
 
+#define BORDER_SPACE 10
+
 /**** Global variables ****/
 extern Cursor wCursor[WCUR_LAST];
 extern WPreferences wPreferences;
@@ -3070,7 +3072,7 @@ static void openDockMenu(WDock *dock, WAppIcon *aicon, 
XEvent *event)
        WMenuEntry *entry;
        WApplication *wapp = NULL;
        int index = 0;
-       int x_pos;
+       int x_pos, y_pos;
        int n_selected;
        int appIsRunning = aicon->running && aicon->icon && aicon->icon->owner;
 
@@ -3219,7 +3221,12 @@ static void openDockMenu(WDock *dock, WAppIcon *aicon, 
XEvent *event)
                x_pos = dock->on_right_side ? scr->scr_width - 
dock->menu->frame->core->width - 3 : 0;
        }
 
-       wMenuMapAt(dock->menu, x_pos, event->xbutton.y_root + 2, False);
+       /* If the menu is near of the screen's bottom, move it up 20px */
+       y_pos = event->xbutton.y_root;
+       if (y_pos >= scr->scr_height - BORDER_SPACE)
+               y_pos = y_pos - (2 * BORDER_SPACE);
+
+       wMenuMapAt(dock->menu, x_pos, y_pos, False);
 
        /* allow drag select */
        event->xany.send_event = True;
-- 
1.7.10.4


-- 
To unsubscribe, send mail to [email protected].

Reply via email to