See http://www.damtp.cam.ac.uk/user/crm66/clip_bug.png for a graphical
motivation for the patch below.

---8<---
>From 9bffff14d6faa2514395f329de971619ee277eca Mon Sep 17 00:00:00 2001
From: Carlos R. Mafra <[email protected]>
Date: Sat, 11 Feb 2012 20:44:28 +0000
Subject: [PATCH] clip: Do not display balloon with workspace name

When the mouse passes over the clip, wmaker would display a "odd" balloon
text with the workspace name, but the balloon itself was covered by the
clip icon!

So if the workspace name was short enough ("Internet" is, by my testing here)
the user wouldn't see anything, the balloon is completely under the clip icon.

I found this issue because one of my workspaces is called "Beyonder" and I
noticed a small "r" under the clip one day.

Instead of trying to fix this, I just removed the whole thing about displaying
the balloon because it is superfluous and I haven't seen any bug reports about
this yet, so it probably means most people are not even aware of it.

Signed-off-by: Carlos R. Mafra <[email protected]>
---
 src/dock.c   |   58 ----------------------------------------------------------
 src/event.c  |   13 -------------
 src/screen.h |    1 -
 3 files changed, 0 insertions(+), 72 deletions(-)

diff --git a/src/dock.c b/src/dock.c
index 96d8c61..f92dcd5 100644
--- a/src/dock.c
+++ b/src/dock.c
@@ -3048,8 +3048,6 @@ void wClipUpdateForWorkspaceChange(WScreen * scr, int 
workspace)
                        }
                        wDockShowIcons(scr->workspaces[workspace]->clip);
                }
-               if (scr->flags.clip_balloon_mapped)
-                       showClipBalloon(scr->clip_icon->dock, workspace);
        }
 }
 
@@ -3793,10 +3791,6 @@ static void iconMouseDown(WObjDescriptor * desc, XEvent 
* event)
                }
        }
 
-       if (dock->type == WM_CLIP && scr->flags.clip_balloon_mapped) {
-               XUnmapWindow(dpy, scr->clip_balloon);
-               scr->flags.clip_balloon_mapped = 0;
-       }
        if (event->xbutton.button == Button1) {
                if (event->xbutton.state & MOD_MASK)
                        wDockLower(dock);
@@ -3863,45 +3857,6 @@ static void iconMouseDown(WObjDescriptor * desc, XEvent 
* event)
        }
 }
 
-static void showClipBalloon(WDock * dock, int workspace)
-{
-       int w, h;
-       int x, y;
-       WScreen *scr = dock->screen_ptr;
-       char *text;
-       Window stack[2];
-
-       scr->flags.clip_balloon_mapped = 1;
-       XMapWindow(dpy, scr->clip_balloon);
-
-       text = scr->workspaces[workspace]->name;
-
-       w = WMWidthOfString(scr->clip_title_font, text, strlen(text));
-
-       h = WMFontHeight(scr->clip_title_font);
-       XResizeWindow(dpy, scr->clip_balloon, w, h);
-
-       x = dock->x_pos + CLIP_BUTTON_SIZE * ICON_SIZE / 64;
-       y = dock->y_pos + ICON_SIZE - WMFontHeight(scr->clip_title_font) - 3;
-
-       if (x + w > scr->scr_width) {
-               x = scr->scr_width - w;
-               if (dock->y_pos + ICON_SIZE + h > scr->scr_height)
-                       y = dock->y_pos - h - 1;
-               else
-                       y = dock->y_pos + ICON_SIZE;
-               XRaiseWindow(dpy, scr->clip_balloon);
-       } else {
-               stack[0] = scr->clip_icon->icon->core->window;
-               stack[1] = scr->clip_balloon;
-               XRestackWindows(dpy, stack, 2);
-       }
-       XMoveWindow(dpy, scr->clip_balloon, x, y);
-       XClearWindow(dpy, scr->clip_balloon);
-       WMDrawString(scr->wmscreen, scr->clip_balloon,
-                    scr->clip_title_color[CLIP_NORMAL], scr->clip_title_font, 
0, 0, text, strlen(text));
-}
-
 static void clipEnterNotify(WObjDescriptor * desc, XEvent * event)
 {
        WAppIcon *btn = (WAppIcon *) desc->parent;
@@ -3939,15 +3894,6 @@ static void clipEnterNotify(WObjDescriptor * desc, 
XEvent * event)
        if (dock->auto_collapse && !dock->auto_expand_magic) {
                dock->auto_expand_magic = WMAddTimerHandler(AUTO_EXPAND_DELAY, 
clipAutoExpand, (void *)dock);
        }
-
-       if (btn->xindex == 0 && btn->yindex == 0)
-               showClipBalloon(dock, dock->screen_ptr->current_workspace);
-       else {
-               if (dock->screen_ptr->flags.clip_balloon_mapped) {
-                       XUnmapWindow(dpy, dock->screen_ptr->clip_balloon);
-                       dock->screen_ptr->flags.clip_balloon_mapped = 0;
-               }
-       }
 }
 
 static void clipLeave(WDock * dock)
@@ -4054,10 +4000,6 @@ static void clipAutoRaise(void *cdata)
        if (dock->auto_raise_lower)
                wDockRaise(dock);
 
-       if (dock->screen_ptr->flags.clip_balloon_mapped) {
-               showClipBalloon(dock, dock->screen_ptr->current_workspace);
-       }
-
        dock->auto_raise_magic = NULL;
 }
 
diff --git a/src/event.c b/src/event.c
index 561b1f2..3bc3c40 100644
--- a/src/event.c
+++ b/src/event.c
@@ -1155,19 +1155,6 @@ static void handleEnterNotify(XEvent * event)
                }
        }
 
-       /* a little kluge to hide the clip balloon */
-       if (!wPreferences.flags.noclip && scr->flags.clip_balloon_mapped) {
-               if (!desc) {
-                       XUnmapWindow(dpy, scr->clip_balloon);
-                       scr->flags.clip_balloon_mapped = 0;
-               } else {
-                       if (desc->parent_type != WCLASS_DOCK_ICON || 
scr->clip_icon != desc->parent) {
-                               XUnmapWindow(dpy, scr->clip_balloon);
-                               scr->flags.clip_balloon_mapped = 0;
-                       }
-               }
-       }
-
        if (event->xcrossing.window == event->xcrossing.root
            && event->xcrossing.detail == NotifyNormal
            && event->xcrossing.detail != NotifyInferior && 
wPreferences.focus_mode != WKF_CLICK) {
diff --git a/src/screen.h b/src/screen.h
index b95ba29..5119f84 100644
--- a/src/screen.h
+++ b/src/screen.h
@@ -288,7 +288,6 @@ typedef struct _WScreen {
         unsigned int added_windows_menu:1;
         unsigned int startup2:1;       /* startup phase 2 */
         unsigned int supports_tiff:1;
-        unsigned int clip_balloon_mapped:1;
         unsigned int next_click_is_not_double:1;
         unsigned int backimage_helper_launched:1;
         /* some client has issued a WM_COLORMAP_NOTIFY */
-- 
1.7.3.4


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

Reply via email to