mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 12:28:22 +01:00
wmaker: remove one level of pointers for the function SlideWindows
The function does not need to be passed a array of pointer to windows because it does not change content of the pointers. It is more efficient to directly use an array of windows as the parameter, and simpler also. As 'SlideWindow' is also concerned, it can be simplified and turned into an inlinable function so the compiler can optimise it. Took opportunity to de-CamelCase the name of the functions to comply with the project's coding style. Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
This commit is contained in:
committed by
Carlos R. Mafra
parent
8fa16bef00
commit
784f6794e5
14
src/misc.c
14
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);
|
||||
|
||||
Reference in New Issue
Block a user