2232
2230
case F_INITSIZE: {
2233
2231
int grav, x, y;
2234
unsigned int w, h, sw, sh;
2232
unsigned int width, height, swidth, sheight;
2236
2234
if (DeferExecution (context, func, Scr->SelectCursor)) return TRUE;
2237
2235
grav = ((tmp_win->hints.flags & PWinGravity)
2240
2238
if (!(tmp_win->hints.flags & USSize) && !(tmp_win->hints.flags & PSize)) break;
2242
w = tmp_win->hints.width + 2 * tmp_win->frame_bw3D;
2243
h = tmp_win->hints.height + 2 * tmp_win->frame_bw3D + tmp_win->title_height;
2244
ConstrainSize (tmp_win, &w, &h);
2240
width = tmp_win->hints.width + 2 * tmp_win->frame_bw3D;
2241
height = tmp_win->hints.height + 2 * tmp_win->frame_bw3D + tmp_win->title_height;
2242
ConstrainSize (tmp_win, &width, &height);
2246
2244
x = tmp_win->frame_x;
2247
2245
y = tmp_win->frame_y;
2248
sw = tmp_win->frame_width;
2249
sh = tmp_win->frame_height;
2246
swidth = tmp_win->frame_width;
2247
sheight = tmp_win->frame_height;
2250
2248
switch (grav) {
2251
2249
case ForgetGravity :
2252
2250
case StaticGravity :
2259
2257
case NorthEastGravity :
2260
2258
case EastGravity :
2259
x += swidth - width;
2264
2262
case SouthWestGravity :
2265
2263
case SouthGravity :
2264
y += sheight - height;
2269
2267
case SouthEastGravity :
2268
x += swidth - width;
2269
y += sheight - height;
2274
SetupWindow (tmp_win, x, y, w, h, -1);
2272
SetupWindow (tmp_win, x, y, width, height, -1);
2278
2276
case F_MOVERESIZE: {
2279
2277
int x, y, mask;
2278
unsigned int width, height;
2281
2279
int px = 20, py = 30;
2283
2281
if (DeferExecution (context, func, Scr->SelectCursor)) return TRUE;
2284
mask = XParseGeometry (action, &x, &y, &w, &h);
2285
if (!(mask & WidthValue)) w = tmp_win->frame_width;
2286
else w += 2 * tmp_win->frame_bw3D;
2287
if (!(mask & HeightValue)) h = tmp_win->frame_height;
2288
else h += 2 * tmp_win->frame_bw3D + tmp_win->title_height;
2289
ConstrainSize (tmp_win, &w, &h);
2282
mask = XParseGeometry (action, &x, &y, &width, &height);
2283
if (!(mask & WidthValue)) width = tmp_win->frame_width;
2284
else width += 2 * tmp_win->frame_bw3D;
2285
if (!(mask & HeightValue)) height = tmp_win->frame_height;
2286
else height += 2 * tmp_win->frame_bw3D + tmp_win->title_height;
2287
ConstrainSize (tmp_win, &width, &height);
2290
2288
if (mask & XValue) {
2291
if (mask & XNegative) x += Scr->rootw - w;
2289
if (mask & XNegative) x += Scr->rootw - width;
2292
2290
} else x = tmp_win->frame_x;
2293
2291
if (mask & YValue) {
2294
if (mask & YNegative) y += Scr->rooth - h;
2292
if (mask & YNegative) y += Scr->rooth - height;
2295
2293
} else y = tmp_win->frame_y;
2301
2299
XQueryPointer (dpy, Scr->Root, &junkW, &junkW, &junkX, &junkY, &px, &py, &junkK);
2303
px -= tmp_win->frame_x; if (px > w) px = w / 2;
2304
py -= tmp_win->frame_y; if (py > h) px = h / 2;
2305
SetupWindow (tmp_win, x, y, w, h, -1);
2301
px -= tmp_win->frame_x; if (px > width) px = width / 2;
2302
py -= tmp_win->frame_y; if (py > height) px = height / 2;
2303
SetupWindow (tmp_win, x, y, width, height, -1);
2306
2304
XWarpPointer (dpy, Scr->Root, Scr->Root, 0, 0, 0, 0, x + px, y + py);
2856
2854
if (ConstMoveDir != MOVE_NONE)
2856
int xl, yt, width, height;
2860
2858
xl = ConstMoveX;
2861
2859
yt = ConstMoveY;
2862
w = DragWidth + 2 * JunkBW;
2863
h = DragHeight + 2 * JunkBW;
2860
width = DragWidth + 2 * JunkBW;
2861
height = DragHeight + 2 * JunkBW;
2865
2863
if (Scr->DontMoveOff && MoveFunction != F_FORCEMOVE)
2866
2864
TryToGrid (tmp_win, &xl, &yt);
2874
2872
if (Scr->DontMoveOff && MoveFunction != F_FORCEMOVE)
2876
ConstrainByBorders (tmp_win, &xl, w, &yt, h);
2874
ConstrainByBorders (tmp_win, &xl, width, &yt, height);
2878
2876
CurrentDragX = xl;
2879
2877
CurrentDragY = yt;
2887
2885
WMapSetupWindow (tmp_win, xl, yt, -1, -1);
2890
MoveOutline(eventp->xmotion.root, xl, yt, w, h,
2888
MoveOutline(eventp->xmotion.root, xl, yt, width, height,
2891
2889
tmp_win->frame_bw,
2892
2890
moving_icon ? 0 : tmp_win->title_height + tmp_win->frame_bw3D);
2895
2893
else if (DragWindow != None)
2895
int xl, yt, width, height;
2898
2896
if (!menuFromFrameOrWindowOrTitlebar) {
2899
2897
xl = eventp->xmotion.x_root - DragX - JunkBW;
2900
2898
yt = eventp->xmotion.y_root - DragY - JunkBW;
2903
2901
xl = eventp->xmotion.x_root - (DragWidth / 2);
2904
2902
yt = eventp->xmotion.y_root - (DragHeight / 2);
2906
w = DragWidth + 2 * JunkBW;
2907
h = DragHeight + 2 * JunkBW;
2904
width = DragWidth + 2 * JunkBW;
2905
height = DragHeight + 2 * JunkBW;
2909
2907
if (Scr->DontMoveOff && MoveFunction != F_FORCEMOVE)
2910
2908
TryToGrid (tmp_win, &xl, &yt);
2918
2916
if (Scr->DontMoveOff && MoveFunction != F_FORCEMOVE)
2920
ConstrainByBorders (tmp_win, &xl, w, &yt, h);
2918
ConstrainByBorders (tmp_win, &xl, width, &yt, height);
2923
2921
CurrentDragX = xl;
2932
2930
if (! moving_icon) WMapSetupWindow (tmp_win, xl, yt, -1, -1);
2935
MoveOutline(eventp->xmotion.root, xl, yt, w, h,
2933
MoveOutline(eventp->xmotion.root, xl, yt, width, height,
2936
2934
tmp_win->frame_bw,
2937
2935
moving_icon ? 0 : tmp_win->title_height + tmp_win->frame_bw3D);
3244
3242
printf ("curren iconmgr entry: %s", tmp_win->iconmgr->Current);
3246
3244
#endif /* #ifdef WARPTO_FROM_ICONMGR */
3247
for (t = Scr->TwmRoot.next; t != NULL; t = t->next) {
3248
if (!strncmp(action, t->full_name, len)) break;
3249
if (match (action, t->full_name)) break;
3245
for (tw = Scr->TwmRoot.next; tw != NULL; tw = tw->next) {
3246
if (!strncmp(action, tw->full_name, len)) break;
3247
if (match (action, tw->full_name)) break;
3252
for (t = Scr->TwmRoot.next; t != NULL; t = t->next) {
3253
if (!strncmp(action, t->class.res_name, len)) break;
3254
if (match (action, t->class.res_name)) break;
3250
for (tw = Scr->TwmRoot.next; tw != NULL; tw = tw->next) {
3251
if (!strncmp(action, tw->class.res_name, len)) break;
3252
if (match (action, tw->class.res_name)) break;
3257
for (t = Scr->TwmRoot.next; t != NULL; t = t->next) {
3258
if (!strncmp(action, t->class.res_class, len)) break;
3259
if (match (action, t->class.res_class)) break;
3255
for (tw = Scr->TwmRoot.next; tw != NULL; tw = tw->next) {
3256
if (!strncmp(action, tw->class.res_class, len)) break;
3257
if (match (action, tw->class.res_class)) break;
3265
if (Scr->WarpUnmapped || t->mapped) {
3266
if (!t->mapped) DeIconify (t);
3267
if (!Scr->NoRaiseWarp) RaiseWindow (t);
3263
if (Scr->WarpUnmapped || tw->mapped) {
3264
if (!tw->mapped) DeIconify (tw);
3265
if (!Scr->NoRaiseWarp) RaiseWindow (tw);
3271
3269
XBell (dpy, 0);
3289
3287
iconwin = Scr->iconmgr->active->w;
3292
for (t = Scr->TwmRoot.next; t != NULL; t = t->next) {
3293
if (strncmp (action, t->icon_name, len) == 0) {
3294
if (t->list && t->list->iconmgr->twm_win->mapped) {
3295
raisewin = t->list->iconmgr->twm_win->frame;
3296
iconwin = t->list->icon;
3290
for (tw = Scr->TwmRoot.next; tw != NULL; tw = tw->next) {
3291
if (strncmp (action, tw->icon_name, len) == 0) {
3292
if (tw->list && tw->list->iconmgr->twm_win->mapped) {
3293
raisewin = tw->list->iconmgr->twm_win->frame;
3294
iconwin = tw->list->icon;
5081
5079
void jump (TwmWindow *tmp_win, int direction, char *action)
5083
int fx, fy, px, py, step, stat, cons;
5081
int fx, fy, px, py, step, status, cons;
5084
5082
int fwidth, fheight;
5085
5083
int junkX, junkY;
5086
5084
unsigned int junkK;
5089
5087
if (! action) return;
5090
stat = sscanf (action, "%d", &step);
5091
if (stat != 1) return;
5088
status = sscanf (action, "%d", &step);
5089
if (status != 1) return;
5092
5090
if (step < 1) return;
5094
5092
fx = tmp_win->frame_x;