1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-20 21:08:08 +01:00

wmaker: src/action.c merge duplicate code

This patch is merging some duplicate code related
to animation position.
This commit is contained in:
David Maciejak
2014-08-22 19:29:19 +08:00
committed by Carlos R. Mafra
parent ef659ca1fb
commit adebdf41c6

View File

@@ -1060,6 +1060,34 @@ static WWindow *recursiveTransientFor(WWindow * wwin)
return wwin; return wwin;
} }
static int getAnimationGeometry(WWindow *wwin, int *ix, int *iy, int *iw, int *ih)
{
if (!wwin->screen_ptr->flags.startup && !wPreferences.no_animations
&& !wwin->flags.skip_next_animation && wwin->icon != NULL) {
if (!wPreferences.disable_miniwindows
&& !wwin->flags.net_handle_icon) {
*ix = wwin->icon_x;
*iy = wwin->icon_y;
*iw = wwin->icon->core->width;
*ih = wwin->icon->core->height;
} else {
if (wwin->flags.net_handle_icon) {
*ix = wwin->icon_x;
*iy = wwin->icon_y;
*iw = wwin->icon_w;
*ih = wwin->icon_h;
} else {
*ix = 0;
*iy = 0;
*iw = wwin->screen_ptr->scr_width;
*ih = wwin->screen_ptr->scr_height;
}
}
return 1;
}
return 0;
}
void wIconifyWindow(WWindow * wwin) void wIconifyWindow(WWindow * wwin)
{ {
XWindowAttributes attribs; XWindowAttributes attribs;
@@ -1137,6 +1165,9 @@ void wIconifyWindow(WWindow * wwin)
unmapTransientsFor(wwin); unmapTransientsFor(wwin);
if (present) { if (present) {
#ifdef ANIMATIONS
int ix, iy, iw, ih;
#endif
XUngrabPointer(dpy, CurrentTime); XUngrabPointer(dpy, CurrentTime);
wWindowUnmap(wwin); wWindowUnmap(wwin);
/* let all Expose events arrive so that we can repaint /* let all Expose events arrive so that we can repaint
@@ -1150,28 +1181,7 @@ void wIconifyWindow(WWindow * wwin)
flushExpose(); flushExpose();
#ifdef ANIMATIONS #ifdef ANIMATIONS
if (!wwin->screen_ptr->flags.startup && !wwin->flags.skip_next_animation if (getAnimationGeometry(wwin, &ix, &iy, &iw, &ih)) {
&& !wPreferences.no_animations) {
int ix, iy, iw, ih;
if (!wPreferences.disable_miniwindows && !wwin->flags.net_handle_icon) {
ix = wwin->icon_x;
iy = wwin->icon_y;
iw = wwin->icon->core->width;
ih = wwin->icon->core->height;
} else {
if (wwin->flags.net_handle_icon) {
ix = wwin->icon_x;
iy = wwin->icon_y;
iw = wwin->icon_w;
ih = wwin->icon_h;
} else {
ix = 0;
iy = 0;
iw = wwin->screen_ptr->scr_width;
ih = wwin->screen_ptr->scr_height;
}
}
animateResize(wwin->screen_ptr, wwin->frame_x, wwin->frame_y, animateResize(wwin->screen_ptr, wwin->frame_x, wwin->frame_y,
wwin->frame->core->width, wwin->frame->core->height, ix, iy, iw, ih); wwin->frame->core->width, wwin->frame->core->height, ix, iy, iw, ih);
} }
@@ -1291,34 +1301,13 @@ void wDeiconifyWindow(WWindow *wwin)
/* if the window is in another workspace, do it silently */ /* if the window is in another workspace, do it silently */
if (!netwm_hidden) { if (!netwm_hidden) {
#ifdef ANIMATIONS #ifdef ANIMATIONS
if (!wwin->screen_ptr->flags.startup && !wPreferences.no_animations
&& !wwin->flags.skip_next_animation && wwin->icon != NULL) {
int ix, iy, iw, ih; int ix, iy, iw, ih;
if (getAnimationGeometry(wwin, &ix, &iy, &iw, &ih)) {
if (!wPreferences.disable_miniwindows
&& !wwin->flags.net_handle_icon) {
ix = wwin->icon_x;
iy = wwin->icon_y;
iw = wwin->icon->core->width;
ih = wwin->icon->core->height;
} else {
if (wwin->flags.net_handle_icon) {
ix = wwin->icon_x;
iy = wwin->icon_y;
iw = wwin->icon_w;
ih = wwin->icon_h;
} else {
ix = 0;
iy = 0;
iw = wwin->screen_ptr->scr_width;
ih = wwin->screen_ptr->scr_height;
}
}
animateResize(wwin->screen_ptr, ix, iy, iw, ih, animateResize(wwin->screen_ptr, ix, iy, iw, ih,
wwin->frame_x, wwin->frame_y, wwin->frame_x, wwin->frame_y,
wwin->frame->core->width, wwin->frame->core->height); wwin->frame->core->width, wwin->frame->core->height);
} }
#endif /* ANIMATIONS */ #endif
wwin->flags.skip_next_animation = 0; wwin->flags.skip_next_animation = 0;
XGrabServer(dpy); XGrabServer(dpy);
if (!wwin->flags.shaded) if (!wwin->flags.shaded)