refactored Sanders code somewhat
8af1d973
3 file(s) · +8 −15
| 315 | 315 | *c->w = c->maxw; |
|
| 316 | 316 | if(c->maxh && *c->h > c->maxh) |
|
| 317 | 317 | *c->h = c->maxh; |
|
| 318 | - | if(sticky == TopRight || sticky == BottomRight) |
|
| 318 | + | if(sticky == TopRight || sticky == BotRight) |
|
| 319 | 319 | *c->x = right - *c->w; |
|
| 320 | - | if(sticky == BottomLeft || sticky == BottomRight) |
|
| 320 | + | if(sticky == BotLeft || sticky == BotRight) |
|
| 321 | 321 | *c->y = bottom - *c->h; |
|
| 322 | 322 | resizetitle(c); |
|
| 323 | 323 | XSetWindowBorderWidth(dpy, c->win, 1); |
| 25 | 25 | /********** CUSTOMIZE **********/ |
|
| 26 | 26 | ||
| 27 | 27 | typedef union Arg Arg; |
|
| 28 | + | typedef struct Client Client; |
|
| 28 | 29 | typedef enum Corner Corner; |
|
| 29 | 30 | typedef struct DC DC; |
|
| 30 | - | typedef struct Client Client; |
|
| 31 | 31 | typedef struct Fnt Fnt; |
|
| 32 | 32 | typedef struct Key Key; |
|
| 33 | 33 | typedef struct Rule Rule; |
|
| 44 | 44 | /* cursor */ |
|
| 45 | 45 | enum { CurNormal, CurResize, CurMove, CurLast }; |
|
| 46 | 46 | ||
| 47 | - | enum Corner { TopLeft, TopRight, BottomLeft, BottomRight }; |
|
| 47 | + | enum Corner { TopLeft, TopRight, BotLeft, BotRight }; |
|
| 48 | 48 | ||
| 49 | 49 | struct Fnt { |
|
| 50 | 50 | int ascent; |
|
| 114 | 114 | *c->h = abs(ocy - ev.xmotion.y); |
|
| 115 | 115 | *c->x = (ocx <= ev.xmotion.x) ? ocx : ocx - *c->w; |
|
| 116 | 116 | *c->y = (ocy <= ev.xmotion.y) ? ocy : ocy - *c->h; |
|
| 117 | - | if(ocx <= ev.xmotion.x) { |
|
| 118 | - | if(ocy <= ev.xmotion.y) |
|
| 119 | - | sticky = TopLeft; |
|
| 120 | - | else |
|
| 121 | - | sticky = BottomLeft; |
|
| 122 | - | } else { |
|
| 123 | - | if(ocy <= ev.xmotion.y) |
|
| 124 | - | sticky = TopRight; |
|
| 125 | - | else |
|
| 126 | - | sticky = BottomRight; |
|
| 127 | - | } |
|
| 117 | + | if(ocx <= ev.xmotion.x) |
|
| 118 | + | sticky = (ocy <= ev.xmotion.y) ? TopLeft : BotLeft; |
|
| 119 | + | else |
|
| 120 | + | sticky = (ocy <= ev.xmotion.y) ? TopRight : BotRight; |
|
| 128 | 121 | resize(c, True, sticky); |
|
| 129 | 122 | break; |
|
| 130 | 123 | case ButtonRelease: |