EwinMove/Resize - Change various global/ewin flags to function parameter.

SVN revision: 70390
This commit is contained in:
Kim Woelders 2012-04-22 17:39:37 +00:00
parent f1a0df9392
commit 0786a813d0
16 changed files with 78 additions and 84 deletions

View File

@ -380,7 +380,6 @@ typedef struct {
unsigned int mod_combos[8];
} masks;
struct {
char check; /* Avoid losing windows offscreen */
char swap;
} move;
struct {

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
* Copyright (C) 2004-2011 Kim Woelders
* Copyright (C) 2004-2012 Kim Woelders
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
@ -700,7 +700,7 @@ ArrangeEwin(EWin * ewin)
int x, y;
ArrangeEwinXY(ewin, &x, &y);
EwinMove(ewin, x, y);
EwinMove(ewin, x, y, 0);
}
void
@ -709,7 +709,7 @@ ArrangeEwinCentered(EWin * ewin)
int x, y;
ArrangeEwinCenteredXY(ewin, &x, &y);
EwinMove(ewin, x, y);
EwinMove(ewin, x, y, 0);
}
static void
@ -952,7 +952,7 @@ ArrangeEwins(const char *params)
ret[i].x, ret[i].y, Conf.place.slidespeedcleanup,
Conf.place.slidemode);
else
EwinMove(ewin, ret[i].x, ret[i].y);
EwinMove(ewin, ret[i].x, ret[i].y, 0);
}
Efree(fixed);

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
* Copyright (C) 2004-2011 Kim Woelders
* Copyright (C) 2004-2012 Kim Woelders
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
@ -637,7 +637,7 @@ EwinBorderChange(EWin * ewin, const Border * b, int normal)
EwinBorderSetTo(ewin, b);
EwinMoveResize(ewin, EoGetX(ewin), EoGetY(ewin),
ewin->client.w, ewin->client.h);
ewin->client.w, ewin->client.h, 0);
if (normal)
ewin->normal_border = b;

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
* Copyright (C) 2004-2010 Kim Woelders
* Copyright (C) 2004-2012 Kim Woelders
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
@ -292,14 +292,14 @@ ContainerShow(Container * ct)
if (ewin->state.placed)
{
EwinMoveResize(ewin, EoGetX(ewin), EoGetY(ewin),
ewin->client.w, ewin->client.h);
ewin->client.w, ewin->client.h, 0);
}
else
{
/* The first one */
EwinResize(ewin, 128, 32);
EwinResize(ewin, 128, 32, 0);
EwinMove(ewin, WinGetW(VROOT) - EoGetW(ewin),
WinGetH(VROOT) - EoGetH(ewin));
WinGetH(VROOT) - EoGetH(ewin), 0);
}
EwinShow(ewin);
@ -1152,7 +1152,7 @@ ContainerRedraw(Container * ct)
EWin *ewin = ct->ewin;
ct->do_update = 1;
EwinResize(ct->ewin, ewin->client.w, ewin->client.h);
EwinResize(ct->ewin, ewin->client.w, ewin->client.h, 0);
}
static int

View File

@ -1712,7 +1712,6 @@ DeskCurrentGotoArea(int ax, int ay)
}
/* move all windows to their final positions */
Mode.move.check = 0;
for (i = 0; i < num; i++)
{
ewin = lst[i];
@ -1724,11 +1723,11 @@ DeskCurrentGotoArea(int ax, int ay)
if (EoIsSticky(ewin) ||
(EoIsFloating(ewin) && Conf.movres.mode_move == MR_OPAQUE) ||
(!ewin->state.iconified && Conf.desks.slidein))
EwinMove(ewin, EoGetX(ewin), EoGetY(ewin));
EwinMove(ewin, EoGetX(ewin), EoGetY(ewin), MRF_NOCHECK_ONSCREEN);
else
EwinMove(ewin, EoGetX(ewin) - dx, EoGetY(ewin) - dy);
EwinMove(ewin, EoGetX(ewin) - dx, EoGetY(ewin) - dy,
MRF_NOCHECK_ONSCREEN);
}
Mode.move.check = 1;
if (!Conf.desks.slidein)
EobjsRepaint();

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
* Copyright (C) 2004-2011 Kim Woelders
* Copyright (C) 2004-2012 Kim Woelders
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
@ -412,7 +412,7 @@ DialogArrange(Dialog * d, int resize)
if (resize)
{
EwinResize(d->ewin, d->w, d->h);
EwinResize(d->ewin, d->w, d->h, 0);
d->resize = 1;
DialogRedraw(d);
DialogUpdate(d);
@ -448,11 +448,11 @@ DialogShowArranged(Dialog * d, int center)
if (ewin->state.placed)
{
EwinMoveResize(ewin, EoGetX(ewin), EoGetY(ewin), d->w, d->h);
EwinMoveResize(ewin, EoGetX(ewin), EoGetY(ewin), d->w, d->h, 0);
}
else
{
EwinResize(ewin, d->w, d->h);
EwinResize(ewin, d->w, d->h, 0);
if (center || FindADialog() == 1)
ArrangeEwinCentered(ewin);
else

View File

@ -221,7 +221,7 @@ doEwinMoveResize(EWin * ewin, Desk * dsk, int x, int y, int w, int h, int flags)
flags |= MRF_DESK;
}
if (Mode.mode == MODE_NONE && Mode.move.check)
if (Mode.mode == MODE_NONE && !(flags & MRF_NOCHECK_ONSCREEN))
{
/* Don't throw windows offscreen */
sw = WinGetW(VROOT);
@ -379,7 +379,7 @@ doEwinMoveResize(EWin * ewin, Desk * dsk, int x, int y, int w, int h, int flags)
EwinPropagateShapes(ewin);
/* Clear maximized state on move or resize */
if ((move || resize) && !ewin->state.maximizing && !ewin->state.shading)
if ((move || resize) && !(flags & MRF_KEEP_MAXIMIZED))
{
if (ewin->state.maximized_horz || ewin->state.maximized_vert)
{
@ -413,7 +413,9 @@ doEwinMoveResize(EWin * ewin, Desk * dsk, int x, int y, int w, int h, int flags)
doEwinMoveResize(lst[i], dsk, EoGetX(lst[i]) + dx,
EoGetY(lst[i]) + dy, 0, 0,
flags & (MRF_DESK | MRF_MOVE |
MRF_FLOAT | MRF_UNFLOAT));
MRF_FLOAT | MRF_UNFLOAT |
MRF_NOCHECK_ONSCREEN |
MRF_KEEP_MAXIMIZED));
Efree(lst);
}
@ -468,13 +470,13 @@ EwinSlideSizeTo(EWin * ewin, int tx, int ty, int tw, int th)
y = ((fy * (1024 - k)) + (ty * k)) >> 10;
w = ((fw * (1024 - k)) + (tw * k)) >> 10;
h = ((fh * (1024 - k)) + (th * k)) >> 10;
EwinMoveResize(ewin, x, y, w, h);
EwinMoveResize(ewin, x, y, w, h, MRF_KEEP_MAXIMIZED);
k = ETimedLoopNext();
}
}
EwinMoveResize(ewin, tx, ty, tw, th);
EwinMoveResize(ewin, tx, ty, tw, th, MRF_KEEP_MAXIMIZED);
if (warp && ewin != GetEwinPointerInClient())
{
@ -484,21 +486,25 @@ EwinSlideSizeTo(EWin * ewin, int tx, int ty, int tw, int th)
}
void
EwinMove(EWin * ewin, int x, int y)
EwinMove(EWin * ewin, int x, int y, int flags)
{
doEwinMoveResize(ewin, NULL, x, y, 0, 0, MRF_MOVE);
doEwinMoveResize(ewin, NULL, x, y, 0, 0,
MRF_MOVE | (flags & MRF_NOCHECK_ONSCREEN));
}
void
EwinResize(EWin * ewin, int w, int h)
EwinResize(EWin * ewin, int w, int h, int flags)
{
doEwinMoveResize(ewin, NULL, 0, 0, w, h, MRF_RESIZE);
doEwinMoveResize(ewin, NULL, 0, 0, w, h,
MRF_RESIZE | (flags & MRF_KEEP_MAXIMIZED));
}
void
EwinMoveResize(EWin * ewin, int x, int y, int w, int h)
EwinMoveResize(EWin * ewin, int x, int y, int w, int h, int flags)
{
doEwinMoveResize(ewin, NULL, x, y, w, h, MRF_MOVE | MRF_RESIZE);
doEwinMoveResize(ewin, NULL, x, y, w, h,
MRF_MOVE | MRF_RESIZE |
(flags & (MRF_NOCHECK_ONSCREEN | MRF_KEEP_MAXIMIZED)));
}
void
@ -524,7 +530,7 @@ void
EwinOpMove(EWin * ewin, int source, int x, int y)
{
Mode.op_source = source;
EwinMove(ewin, x, y);
EwinMove(ewin, x, y, 0);
Mode.op_source = OPSRC_NA;
}
@ -532,7 +538,7 @@ void
EwinOpResize(EWin * ewin, int source, int w, int h)
{
Mode.op_source = source;
EwinResize(ewin, w, h);
EwinResize(ewin, w, h, 0);
Mode.op_source = OPSRC_NA;
}
@ -540,7 +546,7 @@ void
EwinOpMoveResize(EWin * ewin, int source, int x, int y, int w, int h)
{
Mode.op_source = source;
EwinMoveResize(ewin, x, y, w, h);
EwinMoveResize(ewin, x, y, w, h, 0);
Mode.op_source = OPSRC_NA;
}
@ -834,7 +840,8 @@ EwinInstantShade(EWin * ewin, int force)
ewin->state.shaded = 2;
EoMoveResize(ewin, x, y, w, h);
EMoveResizeWindow(ewin->win_container, -30, -30, 1, 1);
EwinMoveResize(ewin, x, y, ewin->client.w, ewin->client.h);
EwinMoveResize(ewin, x, y, ewin->client.w, ewin->client.h,
MRF_KEEP_MAXIMIZED);
}
void
@ -875,7 +882,8 @@ EwinInstantUnShade(EWin * ewin)
ewin->client.w, ewin->client.h, 0);
ewin->state.shaded = 0;
EwinMoveResize(ewin, x, y, ewin->client.w, ewin->client.h);
EwinMoveResize(ewin, x, y, ewin->client.w, ewin->client.h,
MRF_KEEP_MAXIMIZED);
}
#define _EWIN_ADJUST_SHAPE(ewin, xo, yo) \
@ -967,8 +975,8 @@ _EwinShadeEnd(_ewin_shade_data * esd)
if (ewin->state.shaped)
_EWIN_ADJUST_SHAPE(ewin, 0, 0);
EwinMoveResize(ewin, EoGetX(ewin), EoGetY(ewin), ewin->client.w,
ewin->client.h);
EwinMoveResize(ewin, EoGetX(ewin), EoGetY(ewin),
ewin->client.w, ewin->client.h, MRF_KEEP_MAXIMIZED);
#if 0
EUngrabServer();
@ -1198,8 +1206,8 @@ _EwinUnshadeEnd(_ewin_shade_data * esd)
if (ewin->state.shaped)
_EWIN_ADJUST_SHAPE(ewin, 0, 0);
EwinMoveResize(ewin, EoGetX(ewin), EoGetY(ewin), ewin->client.w,
ewin->client.h);
EwinMoveResize(ewin, EoGetX(ewin), EoGetY(ewin),
ewin->client.w, ewin->client.h, MRF_KEEP_MAXIMIZED);
#if 0
EUngrabServer();
@ -1384,9 +1392,7 @@ EwinOpFullscreen(EWin * ewin, int source __UNUSED__, int on)
}
EwinRaise(ewin);
ewin->state.maximizing = 1;
EwinMoveResize(ewin, x, y, w, h);
ewin->state.maximizing = 0;
EwinMoveResize(ewin, x, y, w, h, MRF_KEEP_MAXIMIZED);
EwinStateUpdate(ewin);
}
else
@ -1411,9 +1417,7 @@ EwinOpFullscreen(EWin * ewin, int source __UNUSED__, int on)
ewin->state.fullscreen = 0;
EwinStateUpdate(ewin);
EwinRaise(ewin);
ewin->state.maximizing = 1;
EwinMoveResize(ewin, x, y, w, h);
ewin->state.maximizing = 0;
EwinMoveResize(ewin, x, y, w, h, MRF_KEEP_MAXIMIZED);
}
HintsSetWindowState(ewin);
@ -1462,7 +1466,7 @@ EwinMoveToArea(EWin * ewin, int ax, int ay)
{
DesksFixArea(&ax, &ay);
EwinMove(ewin, EoGetX(ewin) + (WinGetW(VROOT) * (ax - ewin->area_x)),
EoGetY(ewin) + (WinGetH(VROOT) * (ay - ewin->area_y)));
EoGetY(ewin) + (WinGetH(VROOT) * (ay - ewin->area_y)), 0);
}
void

View File

@ -882,7 +882,7 @@ AddToFamily(EWin * ewin, Window xwin, int startup)
}
else
{
EwinResize(ewin, ewin->client.w, ewin->client.h);
EwinResize(ewin, ewin->client.w, ewin->client.h, 0);
}
/* if the window asked to be iconified at the start */
@ -1324,9 +1324,7 @@ EwinEventConfigureRequest(EWin * ewin, XEvent * ev)
EwinKeepOnScreen(ewin, w, h, &x, &y);
}
Mode.move.check = 0; /* Don't restrict client requests */
EwinMoveResize(ewin, x, y, w, h);
Mode.move.check = 1;
EwinMoveResize(ewin, x, y, w, h, MRF_NOCHECK_ONSCREEN);
ReZoom(ewin);
}
else
@ -1348,7 +1346,8 @@ EwinEventResizeRequest(EWin * ewin, XEvent * ev)
{
if (ewin)
{
EwinResize(ewin, ev->xresizerequest.width, ev->xresizerequest.height);
EwinResize(ewin, ev->xresizerequest.width, ev->xresizerequest.height,
0);
ReZoom(ewin);
}
else
@ -1875,7 +1874,7 @@ EwinReposition(EWin * ewin)
xn += ax * wdn;
yn += ay * hdn;
EwinMove(ewin, xn, yn);
EwinMove(ewin, xn, yn, 0);
}
void
@ -2186,11 +2185,7 @@ EwinsTouch(Desk * dsk)
{
ewin = lst[i];
if (EoIsMapped(ewin) && EwinIsOnScreen(ewin))
#if 1 /* FIXME - Which one? */
EwinMove(ewin, EoGetX(ewin), EoGetY(ewin));
#else
EwinResize(ewin, ewin->client.w, ewin->client.h);
#endif
EwinMove(ewin, EoGetX(ewin), EoGetY(ewin), 0);
}
}

View File

@ -104,7 +104,6 @@ struct _ewin {
unsigned moving:1;
unsigned resizing:1;
unsigned show_coords:1;
unsigned maximizing:1;
unsigned shading:1;
unsigned in_action:1;
@ -391,13 +390,18 @@ void EwinsShowDesktop(int on);
void EwinsMoveStickyToDesk(Desk * d);
/* ewin-ops.c */
/* Move/resize flags */
#define MRF_NOCHECK_ONSCREEN (1<<16)
#define MRF_KEEP_MAXIMIZED (1<<17)
void SlideEwinTo(EWin * ewin, int fx, int fy, int tx, int ty,
int speed, int mode);
void SlideEwinsTo(EWin ** ewin, int *fx, int *fy, int *tx,
int *ty, int num_wins, int speed, int mode);
void EwinMove(EWin * ewin, int x, int y);
void EwinResize(EWin * ewin, int w, int h);
void EwinMoveResize(EWin * ewin, int x, int y, int w, int h);
void EwinMove(EWin * ewin, int x, int y, int flags);
void EwinResize(EWin * ewin, int w, int h, int flags);
void EwinMoveResize(EWin * ewin, int x, int y, int w, int h,
int flags);
void EwinSlideSizeTo(EWin * ewin, int tx, int ty,
int tw, int th);
void EwinMoveResizeWithGravity(EWin * ewin, int x, int y, int w,

View File

@ -504,7 +504,7 @@ MagwinCreate(const char *title, int width, int height)
mw->ewin->o.ghost = 1;
EoSetLayer(mw->ewin, 10);
EwinMoveResize(mw->ewin, EoGetX(mw->ewin), EoGetY(mw->ewin),
mw->ewin->client.w, mw->ewin->client.h);
mw->ewin->client.w, mw->ewin->client.h, 0);
mw->ewin->client.event_mask |=
KeyPressMask | ButtonPressMask | ButtonReleaseMask | PointerMotionMask |

View File

@ -106,7 +106,6 @@ main(int argc, char **argv)
Mode.wm.startup = 1;
Mode.mode = MODE_NONE;
Mode.move.check = 1;
EXInit();
Dpy.screen = -1;

View File

@ -345,7 +345,7 @@ MenuShow(Menu * m, char noshow)
ewin->head = head_num;
EwinResize(ewin, ewin->client.w, ewin->client.h);
EwinResize(ewin, ewin->client.w, ewin->client.h, 0);
if (Conf.menus.animate)
EwinInstantShade(ewin, 0);
@ -680,7 +680,7 @@ MenuRepack(Menu * m)
ICCCM_SetSizeConstraints(ewin, m->w, m->h, m->w, m->h, 0, 0, 1, 1,
0.0, 65535.0);
EwinResize(ewin, m->w, m->h);
EwinResize(ewin, m->w, m->h, 0);
EwinRaise(ewin);
}
#endif
@ -1625,9 +1625,7 @@ _SubmenuCheckSlide(Menu * m, MenuItem * mi, EWin * ewin, EWin * ewin2,
}
MenusSetEvents(0); /* Disable menu item events while sliding */
Mode.move.check = 0; /* Bypass on-screen checks */
SlideEwinsTo(menus, fx, fy, tx, ty, i, Conf.shading.speed, 0);
Mode.move.check = 1;
MenusSetEvents(1);
if (Conf.menus.warp)
@ -1695,9 +1693,7 @@ SubmenuShowTimeout(void *dat)
_SubmenuCheckSlide(m, mi, ewin, ewin2, xo, yo, ww, hh);
Mode.move.check = 0; /* Bypass on-screen checks */
EwinMove(ewin2, EoGetX(ewin) + xo, EoGetY(ewin) + yo);
Mode.move.check = 1;
EwinMove(ewin2, EoGetX(ewin) + xo, EoGetY(ewin) + yo, MRF_NOCHECK_ONSCREEN);
EwinOpFloatAt(ewin2, OPSRC_NA, EoGetX(ewin2), EoGetY(ewin2));
EwinRaise(ewin2);
EwinShow(ewin2);

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
* Copyright (C) 2004-2011 Kim Woelders
* Copyright (C) 2004-2012 Kim Woelders
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
@ -1017,7 +1017,7 @@ SlideEwinsTo(EWin ** ewin, int *fx, int *fy, int *tx, int *ty, int num_wins,
if (mode > 0)
DrawEwinShape(ewin[i], mode, tx[i], ty[i], ewin[i]->client.w,
ewin[i]->client.h, 2, i);
EwinMove(ewin[i], tx[i], ty[i]);
EwinMove(ewin[i], tx[i], ty[i], MRF_NOCHECK_ONSCREEN);
}
FocusEnable(1);

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
* Copyright (C) 2004-2011 Kim Woelders
* Copyright (C) 2004-2012 Kim Woelders
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
@ -554,7 +554,7 @@ PagerReconfigure(Pager * p, int apply)
{
w = (int)((double)ax * (double)WinGetW(VROOT) / (double)p->scale + .5);
h = (int)((double)ay * (double)WinGetH(VROOT) / (double)p->scale + .5);
EwinResize(p->ewin, w + (dx * ax) / 2, h + (dy * ay) / 2);
EwinResize(p->ewin, w + (dx * ax) / 2, h + (dy * ay) / 2, 0);
EwinReposition(p->ewin);
}
}
@ -743,7 +743,7 @@ PagerShow(Pager * p)
if (ewin->state.placed)
{
EwinMoveResize(ewin, EoGetX(ewin), EoGetY(ewin),
ewin->client.w, ewin->client.h);
ewin->client.w, ewin->client.h, 0);
}
else
{
@ -753,10 +753,10 @@ PagerShow(Pager * p)
DesksGetAreaSize(&ax, &ay);
w = ((48 * WinGetW(VROOT)) / WinGetH(VROOT)) * ax;
h = 48 * ay;
EwinResize(ewin, w, h); /* Does layout */
EwinResize(ewin, w, h, 0); /* Does layout */
x = 0;
y = WinGetH(VROOT) - (DesksGetNumber() - p->dsk->num) * EoGetH(ewin);
EwinMove(ewin, x, y);
EwinMove(ewin, x, y, 0);
}
EwinShow(ewin);
@ -1508,7 +1508,7 @@ PagerHandleMouseUp(Pager * p, int px, int py, int button)
{
if (gwins[i]->type != EWIN_TYPE_PAGER)
{
EwinMove(gwins[i], gwin_px[i], gwin_py[i]);
EwinMove(gwins[i], gwin_px[i], gwin_py[i], 0);
EwinIconify(gwins[i]);
}
}

View File

@ -841,7 +841,6 @@ MaxSizeHV(EWin * ewin, const char *resize_type, int hor, int ver)
ver = (ver) ? !old_ver : old_ver;
}
ewin->state.maximizing = 1;
ewin->state.maximized_horz = hor;
ewin->state.maximized_vert = ver;
@ -991,6 +990,5 @@ MaxSizeHV(EWin * ewin, const char *resize_type, int hor, int ver)
EwinSlideSizeTo(ewin, x, y, w, h);
done:
ewin->state.maximizing = 0;
HintsSetWindowState(ewin);
}

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
* Copyright (C) 2004-2011 Kim Woelders
* Copyright (C) 2004-2012 Kim Woelders
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
@ -381,7 +381,7 @@ _ZoomEwinRestore(EWin * ewin)
EwinBorderSetTo(ewin, ewin->normal_border);
ewin->state.zoomed = 0;
EwinMoveResize(ewin, ewin->save_fs.x, ewin->save_fs.y,
ewin->client.w, ewin->client.h);
ewin->client.w, ewin->client.h, 0);
}
/* outstanding BUG: zooming on shaped windows leaves stuff exposed beneath them..... */
@ -461,7 +461,7 @@ Zoom(EWin * ewin, int on)
EwinRaise(ewin);
EwinBorderSetTo(ewin, BorderCreateFiller(ewin->client.w,
ewin->client.h, zw, zh));
EwinMoveResize(ewin, 0, 0, ewin->client.w, ewin->client.h);
EwinMoveResize(ewin, 0, 0, ewin->client.w, ewin->client.h, 0);
ewin->state.zoomed = 1;
FocusToEWin(ewin, FOCUS_SET);
zoom_last_ewin = ewin;