>From c260c846a57c8e70d8fb18d3e39779d948d4ca85 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?"Rodolfo=20Garc=C3=ADa=20Pe=C3=B1as=20(kix)"?= <[email protected]>
Date: Fri, 22 Jun 2012 17:35:03 +0200
Subject: [PATCH 02/11] New move_window function
---
src/actions.c | 20 ++++++--------------
src/dock.c | 17 +++++------------
src/funcs.h | 1 +
src/misc.c | 12 ++++++++++++
4 files changed, 24 insertions(+), 26 deletions(-)
diff --git a/src/actions.c b/src/actions.c
index 9617fb5..ba395b6 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -1767,9 +1767,8 @@ void wArrangeIcons(WScreen *scr, Bool arrangeAll)
if (aicon->x_pos != X || aicon->y_pos != Y) {
#ifdef ANIMATIONS
- if (!wPreferences.no_animations) {
+ if (!wPreferences.no_animations)
SlideWindow(aicon->icon->core->window,
aicon->x_pos, aicon->y_pos, X, Y);
- }
#endif /* ANIMATIONS */
}
wAppIconMove(aicon, X, Y);
@@ -1796,18 +1795,11 @@ void wArrangeIcons(WScreen *scr, Bool arrangeAll)
head = wGetHeadForWindow(wwin);
if (arrangeAll || !wwin->flags.icon_moved) {
- if (wwin->icon_x != X || wwin->icon_y != Y) {
-#ifdef ANIMATIONS
- if (wPreferences.no_animations) {
- XMoveWindow(dpy,
wwin->icon->core->window, X, Y);
- } else {
-
SlideWindow(wwin->icon->core->window, wwin->icon_x,
- wwin->icon_y, X, Y);
- }
-#else
- XMoveWindow(dpy,
wwin->icon->core->window, X, Y);
-#endif /* ANIMATIONS */
- }
+ if (wwin->icon_x != X || wwin->icon_y != Y)
+ move_window(wwin->icon->core->window,
+ wwin->icon_x, wwin->icon_y,
+ X, Y);
+
wwin->icon_x = X;
wwin->icon_y = Y;
diff --git a/src/dock.c b/src/dock.c
index d5d5003..e4d71eb 100644
--- a/src/dock.c
+++ b/src/dock.c
@@ -592,18 +592,11 @@ static void colectIconsCallback(WMenu *menu, WMenuEntry
*entry)
if (!aicon->docked && wDockFindFreeSlot(clip, &x, &y)) {
x_pos = clip->x_pos + x * ICON_SIZE;
y_pos = clip->y_pos + y * ICON_SIZE;
- if (aicon->x_pos != x_pos || aicon->y_pos != y_pos) {
-#ifdef ANIMATIONS
- if (wPreferences.no_animations) {
- XMoveWindow(dpy,
aicon->icon->core->window, x_pos, y_pos);
- } else {
- SlideWindow(aicon->icon->core->window,
- aicon->x_pos, aicon->y_pos,
x_pos, y_pos);
- }
-#else
- XMoveWindow(dpy, aicon->icon->core->window,
x_pos, y_pos);
-#endif /* ANIMATIONS */
- }
+ if (aicon->x_pos != x_pos || aicon->y_pos != y_pos)
+ move_window(aicon->icon->core->window,
+ aicon->x_pos, aicon->y_pos,
+ x_pos, y_pos);
+
aicon->attracted = 1;
if (!aicon->icon->shadowed) {
aicon->icon->shadowed = 1;
diff --git a/src/funcs.h b/src/funcs.h
index ff6ee6c..65ceb4a 100644
--- a/src/funcs.h
+++ b/src/funcs.h
@@ -85,6 +85,7 @@ Bool UpdateDomainFile(WDDomain *domain);
WWindow * NextToFocusAfter(WWindow *wwin);
WWindow * NextToFocusBefore(WWindow *wwin);
+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);
RImage * wGetImageForWindowName(WScreen *scr, char *winstance, char *wclass);
diff --git a/src/misc.c b/src/misc.c
index 389ad00..3353a63 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -247,6 +247,18 @@ static void eatExpose(void)
}
}
+void move_window(Window win, int from_x, int from_y, int to_x, int to_y)
+{
+#ifdef ANIMATIONS
+ if (wPreferences.no_animations)
+ XMoveWindow(dpy, win, to_x, to_y);
+ else
+ SlideWindow(win, from_x, from_y, to_x, to_y);
+#else
+ XMoveWindow(dpy, win, to_x, to_y);
+#endif
+}
+
void SlideWindow(Window win, int from_x, int from_y, int to_x, int to_y)
{
time_t time0 = time(NULL);
--
1.7.10
--
||// //\\// Rodolfo "kix" Garcia
||\\// //\\ http://www.kix.es/
>From c260c846a57c8e70d8fb18d3e39779d948d4ca85 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?"Rodolfo=20Garc=C3=ADa=20Pe=C3=B1as=20(kix)"?= <[email protected]>
Date: Fri, 22 Jun 2012 17:35:03 +0200
Subject: [PATCH 02/11] New move_window function
---
src/actions.c | 20 ++++++--------------
src/dock.c | 17 +++++------------
src/funcs.h | 1 +
src/misc.c | 12 ++++++++++++
4 files changed, 24 insertions(+), 26 deletions(-)
diff --git a/src/actions.c b/src/actions.c
index 9617fb5..ba395b6 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -1767,9 +1767,8 @@ void wArrangeIcons(WScreen *scr, Bool arrangeAll)
if (aicon->x_pos != X || aicon->y_pos != Y) {
#ifdef ANIMATIONS
- if (!wPreferences.no_animations) {
+ if (!wPreferences.no_animations)
SlideWindow(aicon->icon->core->window, aicon->x_pos, aicon->y_pos, X, Y);
- }
#endif /* ANIMATIONS */
}
wAppIconMove(aicon, X, Y);
@@ -1796,18 +1795,11 @@ void wArrangeIcons(WScreen *scr, Bool arrangeAll)
head = wGetHeadForWindow(wwin);
if (arrangeAll || !wwin->flags.icon_moved) {
- if (wwin->icon_x != X || wwin->icon_y != Y) {
-#ifdef ANIMATIONS
- if (wPreferences.no_animations) {
- XMoveWindow(dpy, wwin->icon->core->window, X, Y);
- } else {
- SlideWindow(wwin->icon->core->window, wwin->icon_x,
- wwin->icon_y, X, Y);
- }
-#else
- XMoveWindow(dpy, wwin->icon->core->window, X, Y);
-#endif /* ANIMATIONS */
- }
+ if (wwin->icon_x != X || wwin->icon_y != Y)
+ move_window(wwin->icon->core->window,
+ wwin->icon_x, wwin->icon_y,
+ X, Y);
+
wwin->icon_x = X;
wwin->icon_y = Y;
diff --git a/src/dock.c b/src/dock.c
index d5d5003..e4d71eb 100644
--- a/src/dock.c
+++ b/src/dock.c
@@ -592,18 +592,11 @@ static void colectIconsCallback(WMenu *menu, WMenuEntry *entry)
if (!aicon->docked && wDockFindFreeSlot(clip, &x, &y)) {
x_pos = clip->x_pos + x * ICON_SIZE;
y_pos = clip->y_pos + y * ICON_SIZE;
- if (aicon->x_pos != x_pos || aicon->y_pos != y_pos) {
-#ifdef ANIMATIONS
- if (wPreferences.no_animations) {
- XMoveWindow(dpy, aicon->icon->core->window, x_pos, y_pos);
- } else {
- SlideWindow(aicon->icon->core->window,
- aicon->x_pos, aicon->y_pos, x_pos, y_pos);
- }
-#else
- XMoveWindow(dpy, aicon->icon->core->window, x_pos, y_pos);
-#endif /* ANIMATIONS */
- }
+ if (aicon->x_pos != x_pos || aicon->y_pos != y_pos)
+ move_window(aicon->icon->core->window,
+ aicon->x_pos, aicon->y_pos,
+ x_pos, y_pos);
+
aicon->attracted = 1;
if (!aicon->icon->shadowed) {
aicon->icon->shadowed = 1;
diff --git a/src/funcs.h b/src/funcs.h
index ff6ee6c..65ceb4a 100644
--- a/src/funcs.h
+++ b/src/funcs.h
@@ -85,6 +85,7 @@ Bool UpdateDomainFile(WDDomain *domain);
WWindow * NextToFocusAfter(WWindow *wwin);
WWindow * NextToFocusBefore(WWindow *wwin);
+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);
RImage * wGetImageForWindowName(WScreen *scr, char *winstance, char *wclass);
diff --git a/src/misc.c b/src/misc.c
index 389ad00..3353a63 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -247,6 +247,18 @@ static void eatExpose(void)
}
}
+void move_window(Window win, int from_x, int from_y, int to_x, int to_y)
+{
+#ifdef ANIMATIONS
+ if (wPreferences.no_animations)
+ XMoveWindow(dpy, win, to_x, to_y);
+ else
+ SlideWindow(win, from_x, from_y, to_x, to_y);
+#else
+ XMoveWindow(dpy, win, to_x, to_y);
+#endif
+}
+
void SlideWindow(Window win, int from_x, int from_y, int to_x, int to_y)
{
time_t time0 = time(NULL);
--
1.7.10