From be95172c951639cb1c92c15ea147bb5750406162 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20D=C3=A9chelotte?= Date: Fri, 12 Apr 2013 01:42:28 +0200 Subject: [PATCH] Avoid clip flickering when docking an appicon In handleIconMove, when moving an appicon near the clip, all clips were systematically shown each time the mouse moved, causing some flickering (perhaps only perceptible on a low-end machine?). This patch introduces a showed_all_clips boolean to expand clips only once. --- src/dock.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/dock.c b/src/dock.c index 6b6c1849..8b75a167 100644 --- a/src/dock.c +++ b/src/dock.c @@ -3429,6 +3429,7 @@ static Bool handleIconMove(WDock *dock, WAppIcon *aicon, XEvent *event) Bool docked; int superfluous = wPreferences.superfluous; /* we catch it to avoid problems */ int omnipresent = aicon->omnipresent; /* this must be cached!!! */ + Bool showed_all_clips = False; Bool hasMoved = False; if (wPreferences.flags.noupdates) @@ -3489,13 +3490,17 @@ static Bool handleIconMove(WDock *dock, WAppIcon *aicon, XEvent *event) } } - if (omnipresent) { + if (omnipresent && !showed_all_clips) { int i; for (i = 0; i < scr->workspace_count; i++) { if (i == scr->current_workspace) continue; wDockShowIcons(scr->workspaces[i]->clip); + /* Note: if dock is collapsed (for instance, + because it auto-collapses), its icons + still won't show up */ } + showed_all_clips = True; /* To prevent flickering */ } x = ev.xmotion.x_root - ofs_x; @@ -3605,7 +3610,7 @@ static Bool handleIconMove(WDock *dock, WAppIcon *aicon, XEvent *event) XFreePixmap(dpy, ghost); XSetWindowBackground(dpy, scr->dock_shadow, scr->white_pixel); } - if (omnipresent) { + if (showed_all_clips) { int i; for (i = 0; i < scr->workspace_count; i++) { if (i == scr->current_workspace)