mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 12:28:22 +01:00
Added a SlideWindows function to handle horizontally-aligned array of windows
The existing SlideWindow() function is changed to call SlideWindows() with an array of 1 window
This commit is contained in:
committed by
Carlos R. Mafra
parent
95a73e2783
commit
707ce34a5e
@@ -77,6 +77,7 @@ WWindow * NextToFocusBefore(WWindow *wwin);
|
|||||||
|
|
||||||
void move_window(Window win, int from_x, int from_y, int to_x, int to_y);
|
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 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);
|
||||||
|
|
||||||
RImage * wGetImageForWindowName(WScreen *scr, char *winstance, char *wclass);
|
RImage * wGetImageForWindowName(WScreen *scr, char *winstance, char *wclass);
|
||||||
|
|
||||||
|
|||||||
19
src/misc.c
19
src/misc.c
@@ -49,6 +49,7 @@
|
|||||||
|
|
||||||
/**** global variables *****/
|
/**** global variables *****/
|
||||||
extern WPreferences wPreferences;
|
extern WPreferences wPreferences;
|
||||||
|
#define ICON_SIZE wPreferences.icon_size
|
||||||
|
|
||||||
/* XFetchName Wrapper */
|
/* XFetchName Wrapper */
|
||||||
Bool wFetchName(Display *dpy, Window win, char **winname)
|
Bool wFetchName(Display *dpy, Window win, char **winname)
|
||||||
@@ -142,11 +143,21 @@ 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 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)
|
||||||
{
|
{
|
||||||
time_t time0 = time(NULL);
|
time_t time0 = time(NULL);
|
||||||
float dx, dy, x = from_x, y = from_y, sx, sy, px, py;
|
float dx, dy, x = from_x, y = from_y, sx, sy, px, py;
|
||||||
int dx_is_bigger = 0;
|
int dx_is_bigger = 0;
|
||||||
int slide_delay, slide_steps, slide_slowdown;
|
int slide_delay, slide_steps, slide_slowdown;
|
||||||
|
int i;
|
||||||
|
|
||||||
/* animation parameters */
|
/* animation parameters */
|
||||||
static struct {
|
static struct {
|
||||||
@@ -214,7 +225,9 @@ void SlideWindow(Window win, int from_x, int from_y, int to_x, int to_y)
|
|||||||
px = (sy == 0 ? 0 : py * dx / dy);
|
px = (sy == 0 ? 0 : py * dx / dy);
|
||||||
}
|
}
|
||||||
|
|
||||||
XMoveWindow(dpy, win, (int)x, (int)y);
|
for (i = 0; i < n; i++) {
|
||||||
|
XMoveWindow(dpy, *wins[i], (int)x + i * ICON_SIZE, (int)y);
|
||||||
|
}
|
||||||
XFlush(dpy);
|
XFlush(dpy);
|
||||||
if (slide_delay > 0) {
|
if (slide_delay > 0) {
|
||||||
wusleep(slide_delay * 1000L);
|
wusleep(slide_delay * 1000L);
|
||||||
@@ -224,7 +237,9 @@ void SlideWindow(Window win, int from_x, int from_y, int to_x, int to_y)
|
|||||||
if (time(NULL) - time0 > MAX_ANIMATION_TIME)
|
if (time(NULL) - time0 > MAX_ANIMATION_TIME)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
XMoveWindow(dpy, win, to_x, to_y);
|
for (i = 0; i < n; i++) {
|
||||||
|
XMoveWindow(dpy, *wins[i], to_x + i * ICON_SIZE, to_y);
|
||||||
|
}
|
||||||
|
|
||||||
XSync(dpy, 0);
|
XSync(dpy, 0);
|
||||||
/* compress expose events */
|
/* compress expose events */
|
||||||
|
|||||||
Reference in New Issue
Block a user