diff --git a/src/actions.c b/src/actions.c index 23499782..299bc78d 100644 --- a/src/actions.c +++ b/src/actions.c @@ -1843,7 +1843,7 @@ void wArrangeIcons(WScreen *scr, Bool arrangeAll) if (aicon->x_pos != X || aicon->y_pos != Y) { #ifdef USE_ANIMATIONS if (!wPreferences.no_animations) - SlideWindow(aicon->icon->core->window, aicon->x_pos, aicon->y_pos, X, Y); + slide_window(aicon->icon->core->window, aicon->x_pos, aicon->y_pos, X, Y); #endif /* USE_ANIMATIONS */ } wAppIconMove(aicon, X, Y); diff --git a/src/appicon.c b/src/appicon.c index 14dba971..302066d8 100644 --- a/src/appicon.c +++ b/src/appicon.c @@ -967,7 +967,7 @@ Bool wHandleAppIconMove(WAppIcon *aicon, XEvent *event) Bool docked = False; if (ondock) { - SlideWindow(icon->core->window, x, y, shad_x, shad_y); + slide_window(icon->core->window, x, y, shad_x, shad_y); XUnmapWindow(dpy, scr->dock_shadow); if (originalDock == NULL) { // docking an undocked appicon docked = wDockAttachIcon(lastDock, aicon, ix, iy, False); @@ -980,7 +980,7 @@ Bool wHandleAppIconMove(WAppIcon *aicon, XEvent *event) // Also fill the gap left in the drawer wDrawerFillTheGap(lastDock, aicon, False); } - SlideWindow(icon->core->window, x, y, oldX, oldY); + slide_window(icon->core->window, x, y, oldX, oldY); } } else { // moving a docked appicon to a dock @@ -1016,7 +1016,7 @@ Bool wHandleAppIconMove(WAppIcon *aicon, XEvent *event) // Trust the appicon is inserted at exactly the same place, so its oldX/oldY are consistent with its "new" location? } - SlideWindow(icon->core->window, x, y, oldX, oldY); + slide_window(icon->core->window, x, y, oldX, oldY); wDockReattachIcon(originalDock, aicon, aicon->xindex, aicon->yindex); } else { diff --git a/src/dock.c b/src/dock.c index e72c0c8b..2f325e99 100644 --- a/src/dock.c +++ b/src/dock.c @@ -3271,7 +3271,7 @@ void wDockTrackWindowLaunch(WDock *dock, Window window) XMapWindow(dpy, aicon->icon->core->window); aicon->launching = 1; wAppIconPaint(aicon); - SlideWindow(aicon->icon->core->window, x0, y0, icon->x_pos, icon->y_pos); + slide_window(aicon->icon->core->window, x0, y0, icon->x_pos, icon->y_pos); XUnmapWindow(dpy, aicon->icon->core->window); wAppIconDestroy(aicon); } @@ -3834,15 +3834,15 @@ static void handleDockMove(WDock *dock, WAppIcon *aicon, XEvent *event) break; XUngrabPointer(dpy, CurrentTime); if (dock->type == WM_DRAWER) { - Window *wins[dock->icon_count]; + Window wins[dock->icon_count]; for (i = 0; i < dock->max_icons; i++) { tmpaicon = dock->icon_array[i]; if (tmpaicon == NULL) continue; - wins[ tmpaicon->xindex + (dock->on_right_side ? dock->icon_count - 1 : 0) ] = &tmpaicon->icon->core->window; + wins[ tmpaicon->xindex + (dock->on_right_side ? dock->icon_count - 1 : 0) ] = tmpaicon->icon->core->window; } - SlideWindows(wins, dock->icon_count, + slide_windows(wins, dock->icon_count, (dock->on_right_side ? x - (dock->icon_count - 1) * ICON_SIZE : x), y, (dock->on_right_side ? shad_x - (dock->icon_count - 1) * ICON_SIZE : shad_x), @@ -4665,7 +4665,7 @@ void wSlideAppicons(WAppIcon **appicons, int n, int to_the_left) { int i; int leftmost = -1, min_index = 9999, from_x = -1; // leftmost and from_x initialized to avoid warning - Window *wins[n]; + Window wins[n]; WAppIcon *aicon; if (n < 1) @@ -4684,10 +4684,10 @@ void wSlideAppicons(WAppIcon **appicons, int n, int to_the_left) for (i = 0; i < n; i++) { aicon = appicons[i]; - wins[aicon->xindex - min_index] = &aicon->icon->core->window; + wins[aicon->xindex - min_index] = aicon->icon->core->window; } aicon = appicons[leftmost]; - SlideWindows(wins, n, from_x, aicon->y_pos, aicon->x_pos, aicon->y_pos); + slide_windows(wins, n, from_x, aicon->y_pos, aicon->x_pos, aicon->y_pos); } diff --git a/src/misc.c b/src/misc.c index 4144c7de..99341d32 100644 --- a/src/misc.c +++ b/src/misc.c @@ -145,7 +145,7 @@ void move_window(Window win, int from_x, int from_y, int to_x, int to_y) if (wPreferences.no_animations) XMoveWindow(dpy, win, to_x, to_y); else - SlideWindow(win, from_x, from_y, to_x, to_y); + slide_window(win, from_x, from_y, to_x, to_y); #else XMoveWindow(dpy, win, to_x, to_y); @@ -155,16 +155,10 @@ void move_window(Window win, int from_x, int from_y, int to_x, int to_y) #endif } -void SlideWindow(Window win, int from_x, int from_y, int to_x, int to_y) -{ - Window *wins[1] = { &win }; - SlideWindows(wins, 1, from_x, from_y, to_x, to_y); -} - /* wins is an array of Window, sorted from left to right, the first is * going to be moved from (from_x,from_y) to (to_x,to_y) and the * following windows are going to be offset by (ICON_SIZE*i,0) */ -void SlideWindows(Window *wins[], int n, int from_x, int from_y, int to_x, int to_y) +void slide_windows(Window wins[], int n, int from_x, int from_y, int to_x, int to_y) { time_t time0 = time(NULL); float dx, dy, x = from_x, y = from_y, px, py; @@ -243,7 +237,7 @@ void SlideWindows(Window *wins[], int n, int from_x, int from_y, int to_x, int t } for (i = 0; i < n; i++) { - XMoveWindow(dpy, *wins[i], (int)x + i * ICON_SIZE, (int)y); + XMoveWindow(dpy, wins[i], (int)x + i * ICON_SIZE, (int)y); } XFlush(dpy); if (slide_delay > 0) { @@ -255,7 +249,7 @@ void SlideWindows(Window *wins[], int n, int from_x, int from_y, int to_x, int t break; } for (i = 0; i < n; i++) { - XMoveWindow(dpy, *wins[i], to_x + i * ICON_SIZE, to_y); + XMoveWindow(dpy, wins[i], to_x + i * ICON_SIZE, to_y); } XSync(dpy, 0); diff --git a/src/misc.h b/src/misc.h index 36f08a0e..c4b98254 100644 --- a/src/misc.h +++ b/src/misc.h @@ -30,10 +30,14 @@ Bool wGetIconName(Display *dpy, Window win, char **iconname); Bool UpdateDomainFile(WDDomain * domain); void move_window(Window win, int from_x, int from_y, int to_x, int to_y); -void SlideWindow(Window win, int from_x, int from_y, int to_x, int to_y); -void SlideWindows(Window *wins[], int n, int from_x, int from_y, int to_x, int to_y); +void slide_windows(Window wins[], int n, int from_x, int from_y, int to_x, int to_y); void ParseWindowName(WMPropList *value, char **winstance, char **wclass, const char *where); +static inline void slide_window(Window win, int from_x, int from_y, int to_x, int to_y) +{ + slide_windows(&win, 1, from_x, from_y, to_x, to_y); +} + /* Helper is a 'wmsetbg' subprocess with sets the background for the current workspace */ Bool start_bg_helper(WScreen *scr); void SendHelperMessage(WScreen *scr, char type, int workspace, const char *msg); diff --git a/src/wsmap.c b/src/wsmap.c index 3e84c980..40281a73 100644 --- a/src/wsmap.c +++ b/src/wsmap.c @@ -96,17 +96,17 @@ void wWorkspaceMapUpdate(WScreen *scr) static void workspace_map_slide(WWorkspaceMap *wsmap) { if (wsmap->edge == WD_TOP) - SlideWindow(WMWidgetXID(wsmap->win), 0, -1 * wsmap->wsheight, wsmap->xcount, wsmap->ycount); + slide_window(WMWidgetXID(wsmap->win), 0, -1 * wsmap->wsheight, wsmap->xcount, wsmap->ycount); else - SlideWindow(WMWidgetXID(wsmap->win), 0, wsmap->scr->scr_height, wsmap->xcount, wsmap->ycount); + slide_window(WMWidgetXID(wsmap->win), 0, wsmap->scr->scr_height, wsmap->xcount, wsmap->ycount); } static void workspace_map_unslide(WWorkspaceMap *wsmap) { if (wsmap->edge == WD_TOP) - SlideWindow(WMWidgetXID(wsmap->win), wsmap->xcount, wsmap->ycount, 0, -1 * wsmap->wsheight); + slide_window(WMWidgetXID(wsmap->win), wsmap->xcount, wsmap->ycount, 0, -1 * wsmap->wsheight); else - SlideWindow(WMWidgetXID(wsmap->win), wsmap->xcount, wsmap->ycount, 0, wsmap->scr->scr_height); + slide_window(WMWidgetXID(wsmap->win), wsmap->xcount, wsmap->ycount, 0, wsmap->scr->scr_height); } static void workspace_map_destroy(WWorkspaceMap *wsmap)