1633
1647
/***********************************************************************
1650
* resizeFromCenter -
1652
***********************************************************************
1655
void resizeFromCenter(Window w, TwmWindow *tmp_win)
1657
int lastx, lasty, bw2;
1659
bw2 = tmp_win->frame_bw * 2;
1660
AddingW = tmp_win->attr.width + bw2 + 2 * tmp_win->frame_bw3D;
1661
AddingH = tmp_win->attr.height + tmp_win->title_height + bw2 + 2 *
1662
tmp_win->frame_bw3D;
1664
XGetGeometry(dpy, w, &JunkRoot, &origDragX, &origDragY,
1665
&DragWidth, &DragHeight,
1666
&JunkBW, &JunkDepth);
1668
XWarpPointer(dpy, None, w,
1669
0, 0, 0, 0, DragWidth / 2, DragHeight / 2);
1670
XQueryPointer(dpy, Scr->Root, &JunkRoot,
1671
&JunkChild, &JunkX, &JunkY,
1672
&AddingX, &AddingY, &JunkMask);
1677
MenuStartResize(tmp_win, origDragX, origDragY, DragWidth, DragHeight);
1680
ButtonPressMask | PointerMotionMask | ExposureMask, &Event);
1682
if(Event.type == MotionNotify) {
1683
/* discard any extra motion events before a release */
1684
while(XCheckMaskEvent(dpy,
1685
ButtonMotionMask | ButtonPressMask, &Event))
1686
if(Event.type == ButtonPress) {
1691
if(Event.type == ButtonPress) {
1692
MenuEndResize(tmp_win);
1693
// Next line should be unneeded, done by MenuEndResize() ?
1694
XMoveResizeWindow(dpy, w, AddingX, AddingY, AddingW, AddingH);
1698
if(Event.type != MotionNotify) {
1702
MenuEndResize(tmp_win);
1709
* XXX - if we are going to do a loop, we ought to consider
1710
* using multiple GXxor lines so that we don't need to
1713
XQueryPointer(dpy, Scr->Root, &JunkRoot, &JunkChild,
1714
&JunkX, &JunkY, &AddingX, &AddingY, &JunkMask);
1716
if(lastx != AddingX || lasty != AddingY) {
1717
MenuDoResize(AddingX, AddingY, tmp_win);
1728
/***********************************************************************
1636
1731
* ReGrab - regrab the pointer with the LastCursor;
1638
1733
***********************************************************************
1750
/***********************************************************************
1753
* FocusOnRoot - put input focus on the root window
1755
***********************************************************************
1758
void FocusOnRoot(void)
1760
SetFocus(NULL, LastTimestamp());
1761
InstallColormaps(0, &Scr->RootColormaps);
1762
if(! Scr->ClickToFocus) {
1763
Scr->FocusRoot = true;
1767
static void ReMapOne(TwmWindow *t, TwmWindow *leader)
1770
Zoom(t->icon->w, t->frame);
1772
else if(leader->icon) {
1773
Zoom(leader->icon->w, t->frame);
1777
XMapWindow(dpy, t->w);
1780
if(False && Scr->Root != Scr->CaptiveRoot) { /* XXX dubious test */
1781
ReparentWindow(dpy, t, WinWin, Scr->Root, t->frame_x, t->frame_y);
1783
if(!Scr->NoRaiseDeicon) {
1784
OtpRaise(t, WinWin);
1786
XMapWindow(dpy, t->frame);
1787
SetMapStateProp(t, NormalState);
1789
if(t->icon && t->icon->w) {
1790
XUnmapWindow(dpy, t->icon->w);
1792
if(Scr->ShrinkIconTitles) {
1793
t->icon->title_shrunk = true;
1796
if(t->iconmanagerlist) {
1799
for(wl = t->iconmanagerlist; wl != NULL; wl = wl->nextv) {
1800
XUnmapWindow(dpy, wl->icon);
1808
static void ReMapTransients(TwmWindow *tmp_win)
1812
/* find t such that it is a transient or group member window */
1813
for(t = Scr->FirstWindow; t != NULL; t = t->next) {
1815
((t->istransient && t->transientfor == tmp_win->w) ||
1816
(t->group == tmp_win->w && t->isicon))) {
1817
ReMapOne(t, tmp_win);
1822
void DeIconify(TwmWindow *tmp_win)
1824
TwmWindow *t = tmp_win;
1825
bool isicon = false;
1827
/* de-iconify the main window */
1828
if(Scr->WindowMask) {
1829
XRaiseWindow(dpy, Scr->WindowMask);
1831
if(tmp_win->isicon) {
1833
if(tmp_win->icon_on && tmp_win->icon && tmp_win->icon->w) {
1834
Zoom(tmp_win->icon->w, tmp_win->frame);
1836
else if(tmp_win->group != (Window) 0) {
1837
t = GetTwmWindow(tmp_win->group);
1838
if(t && t->icon_on && t->icon && t->icon->w) {
1839
Zoom(t->icon->w, tmp_win->frame);
1844
ReMapOne(tmp_win, t);
1848
LookInList(Scr->WarpCursorL, tmp_win->full_name, &tmp_win->class))) {
1849
WarpToWindow(tmp_win, false);
1852
/* now de-iconify any window group transients */
1853
ReMapTransients(tmp_win);
1855
if(! Scr->WindowMask && Scr->DeIconifyFunction.func != 0) {
1859
action = Scr->DeIconifyFunction.item ?
1860
Scr->DeIconifyFunction.item->action : NULL;
1861
ExecuteFunction(Scr->DeIconifyFunction.func, action,
1862
(Window) 0, tmp_win, &event, C_ROOT, false);
1868
UnmapTransients(TwmWindow *tmp_win, bool iconify, long eventMask)
1872
for(t = Scr->FirstWindow; t != NULL; t = t->next) {
1874
((t->istransient && t->transientfor == tmp_win->w) ||
1875
t->group == tmp_win->w)) {
1878
Zoom(t->icon->w, tmp_win->icon->w);
1880
else if(tmp_win->icon) {
1881
Zoom(t->frame, tmp_win->icon->w);
1886
* Prevent the receipt of an UnmapNotify, since that would
1887
* cause a transition to the Withdrawn state.
1892
* Note that here, we're setting masks relative to what we
1893
* were passed, which is that of the window these are
1894
* transient for, rather than relative to these windows'
1895
* current masks. I believe in practice it's the same thing,
1896
* and it saves getting attributes on each for masking.
1897
* Still, a little odd...
1899
mask_out_event_mask(t->w, StructureNotifyMask, eventMask);
1900
XUnmapWindow(dpy, t->w);
1901
XUnmapWindow(dpy, t->frame);
1902
restore_mask(t->w, eventMask);
1904
if(t->icon && t->icon->w) {
1905
XUnmapWindow(dpy, t->icon->w);
1907
SetMapStateProp(t, IconicState);
1908
if(t == Scr->Focus) {
1909
SetFocus(NULL, LastTimestamp());
1910
if(! Scr->ClickToFocus) {
1911
Scr->FocusRoot = true;
1914
if(t->iconmanagerlist) {
1915
XMapWindow(dpy, t->iconmanagerlist->icon);
1924
void Iconify(TwmWindow *tmp_win, int def_x, int def_y)
1930
Window leader = (Window) - 1;
1931
Window blanket = (Window) - 1;
1933
iconify = (!tmp_win->iconify_by_unmapping);
1935
if(tmp_win->istransient) {
1936
leader = tmp_win->transientfor;
1937
t = GetTwmWindow(leader);
1939
else if((leader = tmp_win->group) != 0 && leader != tmp_win->w) {
1940
t = GetTwmWindow(leader);
1942
if(t && t->icon_on) {
1946
if(!tmp_win->icon || !tmp_win->icon->w) {
1947
CreateIconWindow(tmp_win, def_x, def_y);
1952
if(visible(tmp_win)) {
1953
if(Scr->WindowMask) {
1954
OtpRaise(tmp_win, IconWin);
1955
XMapWindow(dpy, tmp_win->icon->w);
1958
OtpRaise(tmp_win, IconWin);
1959
XMapWindow(dpy, tmp_win->icon->w);
1963
if(tmp_win->iconmanagerlist) {
1964
for(wl = tmp_win->iconmanagerlist; wl != NULL; wl = wl->nextv) {
1965
XMapWindow(dpy, wl->icon);
1969
/* Don't mask anything yet, just get the current for various uses */
1970
eventMask = mask_out_event(tmp_win->w, 0);
1972
/* iconify transients and window group first */
1973
UnmapTransients(tmp_win, iconify, eventMask);
1976
Zoom(tmp_win->frame, tmp_win->icon->w);
1980
* Prevent the receipt of an UnmapNotify, since that would
1981
* cause a transition to the Withdrawn state.
1983
tmp_win->mapped = false;
1985
if((Scr->IconifyStyle != ICONIFY_NORMAL) && !Scr->WindowMask) {
1986
XWindowAttributes winattrs;
1987
XSetWindowAttributes attr;
1989
XGetWindowAttributes(dpy, tmp_win->frame, &winattrs);
1990
attr.backing_store = NotUseful;
1991
attr.save_under = False;
1992
blanket = XCreateWindow(dpy, Scr->Root, winattrs.x, winattrs.y,
1993
winattrs.width, winattrs.height, 0,
1994
CopyFromParent, CopyFromParent,
1995
CopyFromParent, CWBackingStore | CWSaveUnder, &attr);
1996
XMapWindow(dpy, blanket);
1999
mask_out_event_mask(tmp_win->w, StructureNotifyMask, eventMask);
2000
XUnmapWindow(dpy, tmp_win->w);
2001
XUnmapWindow(dpy, tmp_win->frame);
2002
restore_mask(tmp_win->w, eventMask);
2004
SetMapStateProp(tmp_win, IconicState);
2006
if((Scr->IconifyStyle != ICONIFY_NORMAL) && !Scr->WindowMask) {
2007
switch(Scr->IconifyStyle) {
2008
case ICONIFY_MOSAIC:
2009
MosaicFade(tmp_win, blanket);
2011
case ICONIFY_ZOOMIN:
2012
ZoomInWindow(tmp_win, blanket);
2014
case ICONIFY_ZOOMOUT:
2015
ZoomOutWindow(tmp_win, blanket);
2018
FadeWindow(tmp_win, blanket);
2021
SweepWindow(tmp_win, blanket);
2023
case ICONIFY_NORMAL:
2024
/* Placate insufficiently smart clang warning */
2027
XDestroyWindow(dpy, blanket);
2029
if(tmp_win == Scr->Focus) {
2030
SetFocus(NULL, LastTimestamp());
2031
if(! Scr->ClickToFocus) {
2032
Scr->FocusRoot = true;
2035
tmp_win->isicon = true;
2036
tmp_win->icon_on = iconify;
2037
WMapIconify(tmp_win);
2038
if(! Scr->WindowMask && Scr->IconifyFunction.func != 0) {
2042
action = Scr->IconifyFunction.item ? Scr->IconifyFunction.item->action : NULL;
2043
ExecuteFunction(Scr->IconifyFunction.func, action,
2044
(Window) 0, tmp_win, &event, C_ROOT, false);
2049
void AutoSqueeze(TwmWindow *tmp_win)
2051
if(tmp_win->isiconmgr) {
2054
if(Scr->RaiseWhenAutoUnSqueeze && tmp_win->squeezed) {
2055
OtpRaise(tmp_win, WinWin);
2060
void Squeeze(TwmWindow *tmp_win)
2062
long fx, fy, savex, savey;
2065
int grav = ((tmp_win->hints.flags & PWinGravity)
2066
? tmp_win->hints.win_gravity : NorthWestGravity);
2068
if(tmp_win->squeezed) {
2069
tmp_win->squeezed = False;
2071
EwmhSet_NET_WM_STATE(tmp_win, EWMH_STATE_SHADED);
2073
if(!tmp_win->isicon) {
2074
XMapWindow(dpy, tmp_win->w);
2076
SetupWindow(tmp_win, tmp_win->actual_frame_x, tmp_win->actual_frame_y,
2077
tmp_win->actual_frame_width, tmp_win->actual_frame_height, -1);
2078
ReMapTransients(tmp_win);
2082
newh = tmp_win->title_height + 2 * tmp_win->frame_bw3D;
2088
case SouthWestGravity :
2090
case SouthEastGravity :
2097
if(tmp_win->title_height && !tmp_win->AlwaysSqueezeToGravity) {
2101
tmp_win->squeezed = true;
2102
tmp_win->actual_frame_width = tmp_win->frame_width;
2103
tmp_win->actual_frame_height = tmp_win->frame_height;
2104
savex = fx = tmp_win->frame_x;
2105
savey = fy = tmp_win->frame_y;
2106
neww = tmp_win->actual_frame_width;
2108
fy += tmp_win->frame_height - newh;
2110
if(tmp_win->squeeze_info) {
2111
fx += tmp_win->title_x - tmp_win->frame_bw3D;
2112
neww = tmp_win->title_width + 2 * (tmp_win->frame_bw + tmp_win->frame_bw3D);
2115
eventMask = mask_out_event(tmp_win->w, StructureNotifyMask);
2117
EwmhSet_NET_WM_STATE(tmp_win, EWMH_STATE_SHADED);
2119
XUnmapWindow(dpy, tmp_win->w);
2120
restore_mask(tmp_win->w, eventMask);
2122
if(fx + neww >= Scr->rootw - Scr->BorderRight) {
2123
fx = Scr->rootw - Scr->BorderRight - neww;
2125
if(fy + newh >= Scr->rooth - Scr->BorderBottom) {
2126
fy = Scr->rooth - Scr->BorderBottom - newh;
2128
SetupWindow(tmp_win, fx, fy, neww, newh, -1);
2129
tmp_win->actual_frame_x = savex;
2130
tmp_win->actual_frame_y = savey;
2132
/* Now make the group members disappear */
2133
UnmapTransients(tmp_win, false, eventMask);
2137
* Set WM_STATE; x-ref ICCCM section 4.1.3.1
2138
* https://tronche.com/gui/x/icccm/sec-4.html#s-4.1.3.1
2140
void SetMapStateProp(TwmWindow *tmp_win, int state)
2142
unsigned long data[2]; /* "suggested" by ICCCM version 1 */
2144
data[0] = (unsigned long) state;
2145
data[1] = (unsigned long)(tmp_win->iconify_by_unmapping ? None :
2146
(tmp_win->icon ? tmp_win->icon->w : None));
2148
XChangeProperty(dpy, tmp_win->w, XA_WM_STATE, XA_WM_STATE, 32,
2149
PropModeReplace, (unsigned char *) data, 2);
2154
GetWMState(Window w, int *statep, Window *iwp)
2158
unsigned long nitems, bytesafter;
2159
unsigned long *datap = NULL;
2160
bool retval = false;
2162
if(XGetWindowProperty(dpy, w, XA_WM_STATE, 0L, 2L, False, XA_WM_STATE,
2163
&actual_type, &actual_format, &nitems, &bytesafter,
2164
(unsigned char **) &datap) != Success || !datap) {
2168
if(nitems <= 2) { /* "suggested" by ICCCM version 1 */
2169
*statep = (int) datap[0];
2170
*iwp = (Window) datap[1];
1655
2179
int WarpToScreen(int n, int inc)
2535
/***********************************************************************
2538
* DisplayPosition - display the position in the dimensions window
2541
* tmp_win - the current twm window
2542
* x, y - position of the window
2544
***********************************************************************
2547
void DisplayPosition(TwmWindow *tmp_win, int x, int y)
2561
(void) sprintf(str, " %c%-4d %c%-4d ", signx, x, signy, y);
2562
XRaiseWindow(dpy, Scr->SizeWindow);
2564
Draw3DBorder(Scr->SizeWindow, 0, 0,
2565
Scr->SizeStringOffset + Scr->SizeStringWidth + SIZE_HINDENT,
2566
Scr->SizeFont.height + SIZE_VINDENT * 2,
2567
2, Scr->DefaultC, off, false, false);
2569
FB(Scr->DefaultC.fore, Scr->DefaultC.back);
2570
XmbDrawImageString(dpy, Scr->SizeWindow, Scr->SizeFont.font_set,
2571
Scr->NormalGC, Scr->SizeStringOffset,
2572
Scr->SizeFont.ascent + SIZE_VINDENT , str, 13);
2575
static void MosaicFade(TwmWindow *tmp_win, Window blanket)
2582
XRectangle *rectangles;
2583
int width = tmp_win->frame_width;
2584
int height = tmp_win->frame_height;
2586
srect = (width < height) ? (width / 20) : (height / 20);
2587
mask = XCreatePixmap(dpy, blanket, width, height, 1);
2590
gc = XCreateGC(dpy, mask, GCForeground, &gcv);
2591
XFillRectangle(dpy, mask, gc, 0, 0, width, height);
2592
gcv.function = GXclear;
2593
XChangeGC(dpy, gc, GCFunction, &gcv);
2595
nrects = ((width * height) / (srect * srect)) / 10;
2596
rectangles = calloc(nrects, sizeof(XRectangle));
2597
for(j = 0; j < nrects; j++) {
2598
rectangles [j].width = srect;
2599
rectangles [j].height = srect;
2601
for(i = 0; i < 10; i++) {
2602
for(j = 0; j < nrects; j++) {
2603
rectangles [j].x = ((lrand48() % width) / srect) * srect;
2604
rectangles [j].y = ((lrand48() % height) / srect) * srect;
2606
XFillRectangles(dpy, mask, gc, rectangles, nrects);
2607
XShapeCombineMask(dpy, blanket, ShapeBounding, 0, 0, mask, ShapeSet);
2611
XFreePixmap(dpy, mask);
2616
static void ZoomInWindow(TwmWindow *tmp_win, Window blanket)
2623
int w = tmp_win->frame_width;
2624
int h = tmp_win->frame_height;
2625
int step = (MAX(w, h)) / (2.0 * nsteps);
2627
mask = XCreatePixmap(dpy, blanket, w, h, 1);
2629
gc = XCreateGC(dpy, mask, GCForeground, &gcv);
2630
gcv.function = GXclear;
2631
gcn = XCreateGC(dpy, mask, GCForeground | GCFunction, &gcv);
2633
for(i = 0; i < nsteps; i++) {
2634
XFillRectangle(dpy, mask, gcn, 0, 0, w, h);
2635
XFillArc(dpy, mask, gc, (w / 2) - ((nsteps - i) * step),
2636
(h / 2) - ((nsteps - i) * step),
2637
2 * (nsteps - i) * step,
2638
2 * (nsteps - i) * step,
2640
XShapeCombineMask(dpy, blanket, ShapeBounding, 0, 0, mask, ShapeSet);
2646
static void ZoomOutWindow(TwmWindow *tmp_win, Window blanket)
2653
int w = tmp_win->frame_width;
2654
int h = tmp_win->frame_height;
2655
int step = (MAX(w, h)) / (2.0 * nsteps);
2657
mask = XCreatePixmap(dpy, blanket, w, h, 1);
2659
gc = XCreateGC(dpy, mask, GCForeground, &gcv);
2660
XFillRectangle(dpy, mask, gc, 0, 0, w, h);
2661
gcv.function = GXclear;
2662
XChangeGC(dpy, gc, GCFunction, &gcv);
2664
for(i = 0; i < nsteps; i++) {
2665
XFillArc(dpy, mask, gc, (w / 2) - (i * step),
2666
(h / 2) - (i * step),
2670
XShapeCombineMask(dpy, blanket, ShapeBounding, 0, 0, mask, ShapeSet);
2676
void FadeWindow(TwmWindow *tmp_win, Window blanket)
2678
Pixmap mask, stipple;
2681
static unsigned char stipple_bits[] = { 0x0F, 0x0F,
2690
int w = tmp_win->frame_width;
2691
int h = tmp_win->frame_height;
2693
stipple = XCreateBitmapFromData(dpy, blanket, (char *)stipple_bits, 8, 8);
2694
mask = XCreatePixmap(dpy, blanket, w, h, 1);
2697
gcv.stipple = stipple;
2698
gcv.fill_style = FillOpaqueStippled;
2699
gc = XCreateGC(dpy, mask, GCBackground | GCForeground | GCFillStyle | GCStipple,
2701
XFillRectangle(dpy, mask, gc, 0, 0, w, h);
2703
XShapeCombineMask(dpy, blanket, ShapeBounding, 0, 0, mask, ShapeSet);
2706
XFreePixmap(dpy, stipple);
2710
static void SweepWindow(TwmWindow *tmp_win, Window blanket)
2714
int dir = 0, dist = tmp_win->frame_x, dist1;
2716
dist1 = tmp_win->frame_y;
2721
dist1 = tmp_win->vs->w - (tmp_win->frame_x + tmp_win->frame_width);
2726
dist1 = tmp_win->vs->h - (tmp_win->frame_y + tmp_win->frame_height);
2734
step = tmp_win->frame_x + tmp_win->frame_width;
2737
step = tmp_win->frame_y + tmp_win->frame_height;
2740
step = tmp_win->vs->w - tmp_win->frame_x;
2743
step = tmp_win->vs->h - tmp_win->frame_y;
2746
step /= (float) nsteps;
2747
step /= (float) nsteps;
2748
for(i = 0; i < 20; i++) {
2749
int x = tmp_win->frame_x;
2750
int y = tmp_win->frame_y;
2765
XMoveWindow(dpy, blanket, x, y);
2771
static void waitamoment(float timeout)
2773
struct timeval timeoutstruct;
2774
int usec = timeout * 1000000;
2775
timeoutstruct.tv_usec = usec % (unsigned long) 1000000;
2776
timeoutstruct.tv_sec = usec / (unsigned long) 1000000;
2777
select(0, NULL, NULL, NULL, &timeoutstruct);
2780
void TryToPack(TwmWindow *tmp_win, int *x, int *y)
2785
int winw = tmp_win->frame_width + 2 * tmp_win->frame_bw;
2786
int winh = tmp_win->frame_height + 2 * tmp_win->frame_bw;
2790
for(t = Scr->FirstWindow; t != NULL; t = t->next) {
2794
if(t->winbox != tmp_win->winbox) {
2797
if(t->vs != tmp_win->vs) {
2804
w = t->frame_width + 2 * t->frame_bw;
2805
h = t->frame_height + 2 * t->frame_bw;
2806
if(newx >= t->frame_x + w) {
2809
if(newy >= t->frame_y + h) {
2812
if(newx + winw <= t->frame_x) {
2815
if(newy + winh <= t->frame_y) {
2819
if(newx + Scr->MovePackResistance > t->frame_x + w) { /* left */
2820
newx = MAX(newx, t->frame_x + w);
2823
if(newx + winw < t->frame_x + Scr->MovePackResistance) { /* right */
2824
newx = MIN(newx, t->frame_x - winw);
2827
if(newy + Scr->MovePackResistance > t->frame_y + h) { /* top */
2828
newy = MAX(newy, t->frame_y + h);
2831
if(newy + winh < t->frame_y + Scr->MovePackResistance) { /* bottom */
2832
newy = MIN(newy, t->frame_y - winh);
2842
TryToPush(TwmWindow *tmp_win, int x, int y)
2844
TryToPush_be(tmp_win, x, y, PD_ANY);
2848
TryToPush_be(TwmWindow *tmp_win, int x, int y, PushDirection dir)
2851
int newx, newy, ndir;
2854
int winw = tmp_win->frame_width + 2 * tmp_win->frame_bw;
2855
int winh = tmp_win->frame_height + 2 * tmp_win->frame_bw;
2857
for(t = Scr->FirstWindow; t != NULL; t = t->next) {
2861
if(t->winbox != tmp_win->winbox) {
2864
if(t->vs != tmp_win->vs) {
2871
w = t->frame_width + 2 * t->frame_bw;
2872
h = t->frame_height + 2 * t->frame_bw;
2873
if(x >= t->frame_x + w) {
2876
if(y >= t->frame_y + h) {
2879
if(x + winw <= t->frame_x) {
2882
if(y + winh <= t->frame_y) {
2887
if((dir == PD_ANY || dir == PD_LEFT) &&
2888
(x + Scr->MovePackResistance > t->frame_x + w)) {
2894
else if((dir == PD_ANY || dir == PD_RIGHT) &&
2895
(x + winw < t->frame_x + Scr->MovePackResistance)) {
2901
else if((dir == PD_ANY || dir == PD_TOP) &&
2902
(y + Scr->MovePackResistance > t->frame_y + h)) {
2908
else if((dir == PD_ANY || dir == PD_BOTTOM) &&
2909
(y + winh < t->frame_y + Scr->MovePackResistance)) {
2916
TryToPush_be(t, newx, newy, ndir);
2917
TryToPack(t, &newx, &newy);
2918
ConstrainByBorders(tmp_win,
2919
&newx, t->frame_width + 2 * t->frame_bw,
2920
&newy, t->frame_height + 2 * t->frame_bw);
2921
SetupWindow(t, newx, newy, t->frame_width, t->frame_height, -1);
2927
void TryToGrid(TwmWindow *tmp_win, int *x, int *y)
2929
int w = tmp_win->frame_width + 2 * tmp_win->frame_bw;
2930
int h = tmp_win->frame_height + 2 * tmp_win->frame_bw;
2931
int grav = ((tmp_win->hints.flags & PWinGravity)
2932
? tmp_win->hints.win_gravity : NorthWestGravity);
2935
case ForgetGravity :
2936
case StaticGravity :
2937
case NorthWestGravity :
2940
case CenterGravity :
2941
*x = ((*x - Scr->BorderLeft) / Scr->XMoveGrid) * Scr->XMoveGrid
2943
*y = ((*y - Scr->BorderTop) / Scr->YMoveGrid) * Scr->YMoveGrid
2946
case NorthEastGravity :
2948
*x = (((*x + w - Scr->BorderLeft) / Scr->XMoveGrid) *
2949
Scr->XMoveGrid) - w + Scr->BorderLeft;
2950
*y = ((*y - Scr->BorderTop) / Scr->YMoveGrid) *
2951
Scr->YMoveGrid + Scr->BorderTop;
2953
case SouthWestGravity :
2955
*x = ((*x - Scr->BorderLeft) / Scr->XMoveGrid) * Scr->XMoveGrid
2957
*y = (((*y + h - Scr->BorderTop) / Scr->YMoveGrid) * Scr->YMoveGrid)
2958
- h + Scr->BorderTop;
2960
case SouthEastGravity :
2961
*x = (((*x + w - Scr->BorderLeft) / Scr->XMoveGrid) *
2962
Scr->XMoveGrid) - w + Scr->BorderLeft;
2963
*y = (((*y + h - Scr->BorderTop) / Scr->YMoveGrid) *
2964
Scr->YMoveGrid) - h + Scr->BorderTop;
2013
2969
void WarpCursorToDefaultEntry(MenuRoot *menu)