wDockAttachIcon paint argument
authorRodolfo García Peñas (kix) <kix@kix.es>
Sat, 10 Nov 2012 19:25:10 +0000 (10 20:25 +0100)
committerCarlos R. Mafra <crmafra@gmail.com>
Sun, 11 Nov 2012 11:57:58 +0000 (11 11:57 +0000)
The function wDockAttachIcon has a new argument. This argument is used
to force an icon create if needed.

src/appicon.c
src/dock.c
src/dock.h

index 77c5e30..8a6841d 100644 (file)
@@ -194,6 +194,7 @@ void paint_app_icon(WApplication *wapp)
        WScreen *scr = wapp->main_window_desc->screen_ptr;
        WDock *clip = scr->workspaces[scr->current_workspace]->clip;
        int x = 0, y = 0;
+       Bool update_icon = False;
 
        if (!wapp || !wapp->app_icon)
                return;
@@ -209,9 +210,9 @@ void paint_app_icon(WApplication *wapp)
                wapp->app_icon->attracted = 1;
                if (!icon->shadowed) {
                        icon->shadowed = 1;
-                       icon->force_paint = 1;
+                       update_icon = True;
                }
-               wDockAttachIcon(clip, wapp->app_icon, x, y);
+               wDockAttachIcon(clip, wapp->app_icon, x, y, update_icon);
        } else {
                /* We must know if the icon is painted in the screen,
                 * because if painted, then PlaceIcon will return the next
@@ -849,7 +850,7 @@ void appIconMouseDown(WObjDescriptor * desc, XEvent * event)
                                /* icon is trying to be docked */
                                SlideWindow(icon->core->window, x, y, shad_x, shad_y);
                                XUnmapWindow(dpy, scr->dock_shadow);
-                               docked = wDockAttachIcon(scr->last_dock, aicon, ix, iy);
+                               docked = wDockAttachIcon(scr->last_dock, aicon, ix, iy, False);
                                if (scr->last_dock->auto_collapse)
                                        collapsed = 0;
 
index 58ef31a..e6a575b 100644 (file)
@@ -577,6 +577,7 @@ static void colectIconsCallback(WMenu *menu, WMenuEntry *entry)
        WDock *clip;
        WAppIcon *aicon;
        int x, y, x_pos, y_pos;
+       Bool update_icon = False;
 
        assert(entry->clientdata != NULL);
        clip = clickedIcon->dock;
@@ -593,12 +594,9 @@ static void colectIconsCallback(WMenu *menu, WMenuEntry *entry)
                        aicon->attracted = 1;
                        if (!aicon->icon->shadowed) {
                                aicon->icon->shadowed = 1;
-                               aicon->icon->force_paint = 1;
-                               /* We don't do an wAppIconPaint() here because it's in
-                                * wDockAttachIcon(). -Dan
-                                */
+                               update_icon = True;
                        }
-                       wDockAttachIcon(clip, aicon, x, y);
+                       wDockAttachIcon(clip, aicon, x, y, update_icon);
                        if (clip->collapsed || !clip->mapped)
                                XUnmapWindow(dpy, aicon->icon->core->window);
                }
@@ -1848,7 +1846,7 @@ int wDockReceiveDNDDrop(WScreen *scr, XEvent *event)
 }
 #endif                         /* XDND */
 
-Bool wDockAttachIcon(WDock *dock, WAppIcon *icon, int x, int y)
+Bool wDockAttachIcon(WDock *dock, WAppIcon *icon, int x, int y, Bool update_icon)
 {
        WWindow *wwin;
        int index;
@@ -1856,6 +1854,9 @@ Bool wDockAttachIcon(WDock *dock, WAppIcon *icon, int x, int y)
        wwin = icon->icon->owner;
        icon->editing = 0;
 
+       if (update_icon)
+               icon->icon->force_paint = 1;
+
        if (icon->command == NULL) {
                char *command;
 
index be10095..08ae8de 100644 (file)
@@ -79,7 +79,7 @@ void wDockRaise(WDock *dock);
 void wDockRaiseLower(WDock *dock);
 void wDockSaveState(WScreen *scr, WMPropList *old_state);
 
-Bool wDockAttachIcon(WDock *dock, WAppIcon *icon, int x, int y);
+Bool wDockAttachIcon(WDock *dock, WAppIcon *icon, int x, int y, Bool update_icon);
 Bool wDockSnapIcon(WDock *dock, WAppIcon *icon, int req_x, int req_y,
                    int *ret_x, int *ret_y, int redocking);
 Bool wDockFindFreeSlot(WDock *dock, int *req_x, int *req_y);