121 const Window dragroot =
Scr->XineramaRoot;
122 const Window rootw = eventp->xbutton.root;
133 if(tmp_win->OpaqueMove) {
134 if(
Scr->OpaqueMoveThreshold >= 200) {
135 Scr->OpaqueMove =
true;
138 const unsigned long sw = tmp_win->frame_width
139 * tmp_win->frame_height;
140 const unsigned long ss =
Scr->rootw *
Scr->rooth;
141 const float sf =
Scr->OpaqueMoveThreshold / 100.0;
144 Scr->OpaqueMove =
false;
147 Scr->OpaqueMove =
true;
152 Scr->OpaqueMove =
false;
157 if(tmp_win->winbox) {
158 XTranslateCoordinates(
dpy, dragroot, tmp_win->winbox->window,
159 eventp->xbutton.x_root, eventp->xbutton.y_root,
160 &(eventp->xbutton.x_root), &(eventp->xbutton.y_root), &
JunkChild);
172 XWarpPointer(
dpy, None,
Scr->Root,
173 0, 0, 0, 0, eventp->xbutton.x_root, eventp->xbutton.y_root);
182 if(!
Scr->NoGrabServer || !
Scr->OpaqueMove) {
195 XMapRaised(
dpy,
Scr->SizeWindow);
203 const Window grabwin = (tmp_win->winbox ? tmp_win->winbox->window
204 :
Scr->XineramaRoot);
206 const Window grabwin =
Scr->XineramaRoot;
209 XGrabPointer(
dpy, grabwin, True,
210 ButtonPressMask | ButtonReleaseMask |
211 ButtonMotionMask | PointerMotionMask,
212 GrabModeAsync, GrabModeAsync, grabwin,
Scr->MoveCursor,
222 if(context ==
C_ICON && tmp_win->icon && tmp_win->icon->w) {
223 w = tmp_win->icon->w;
224 DragX = eventp->xbutton.x;
225 DragY = eventp->xbutton.y;
227 if(tmp_win->OpaqueMove) {
228 Scr->OpaqueMove =
true;
231 else if(! tmp_win->icon || w != tmp_win->icon->w) {
232 XTranslateCoordinates(
dpy, w, tmp_win->frame,
251 origX = eventp->xbutton.x_root;
252 origY = eventp->xbutton.y_root;
279 XWarpPointer(
dpy, None, w,
288 if(!
Scr->OpaqueMove) {
290 if(!
Scr->MoveDelta) {
302 moving_icon ? 0 : tmp_win->title_height + tmp_win->frame_bw3D);
325 XWarpPointer(
dpy, None,
Scr->Root, 0, 0, 0, 0,
339 ButtonPress : ButtonRelease;
341 PointerMotionMask : ButtonMotionMask;
344 XMaskEvent(
dpy, ButtonPressMask | ButtonReleaseMask |
345 EnterWindowMask | LeaveWindowMask |
346 ExposureMask | movementMask |
347 VisibilityChangeMask, &
Event);
350 if(
Event.xany.type == EnterNotify ||
351 Event.xany.type == LeaveNotify) {
356 if(
Event.type == MotionNotify) {
357 while(XCheckMaskEvent(
dpy, movementMask | releaseEvent, &
Event))
358 if(
Event.type == releaseEvent) {
367 if(
Scr->OpaqueMove) {
379 XUnmapWindow(
dpy,
Scr->SizeWindow);
381 if(
Event.xbutton.button == Button2) {
384 else if(
Event.xbutton.button >= Button3) {
388 XGrabPointer(
dpy,
Scr->Root, True,
389 ButtonReleaseMask | ButtonPressMask,
390 GrabModeAsync, GrabModeAsync,
391 Scr->Root, cur, CurrentTime);
397 if(fromtitlebar &&
Event.type == ButtonPress) {
398 fromtitlebar =
false;
401 XTranslateCoordinates(
dpy, rootw, tmp_win->frame,
413 if(!
Scr->OpaqueMove) {
419 if(
Event.type == releaseEvent) {
424 tmp_win->icon_moved =
true;
442 if(
Event.type != MotionNotify) {
447 XQueryPointer(
dpy, rootw, &(eventp->xmotion.root), &
JunkChild,
448 &(eventp->xmotion.x_root), &(eventp->xmotion.y_root),
460 if(tmp_win->winbox) {
461 XTranslateCoordinates(
dpy, dragroot, tmp_win->winbox->window,
462 eventp->xmotion.x_root, eventp->xmotion.y_root,
463 &(eventp->xmotion.x_root), &(eventp->xmotion.y_root), &
JunkChild);
472 abs(eventp->xmotion.x_root - origX) <
Scr->MoveDelta &&
473 abs(eventp->xmotion.y_root - origY) <
Scr->MoveDelta) {
495 fprintf(stderr,
"%s(): Can't find TwmWindow.\n", __func__);
501 fprintf(stderr,
"%s(): DragWindow isn't tmp_win!\n", __func__);
510 fprintf(stderr,
"%s(): moving_icon is true incorrectly!\n",
517 fprintf(stderr,
"%s(): moving_icon is false incorrectly!\n",
523 fprintf(stderr,
"%s(): Couldn't figure what to raise.\n",
565 int xl, yt, width, height;
589 if(
Scr->OpaqueMove) {
592 tmp_win->frame_width, tmp_win->frame_height, -1);
597 tmp_win->icon->w_x = xl;
598 tmp_win->icon->w_y = yt;
605 yt +
Scr->currentvs->y, width, height,
607 moving_icon ? 0 : tmp_win->title_height + tmp_win->frame_bw3D);
620 const int xroot = eventp->xmotion.x_root;
621 const int yroot = eventp->xmotion.y_root;
653 if(
Scr->OpaqueMove) {
656 tmp_win->frame_width, tmp_win->frame_height, -1);
661 tmp_win->icon->w_x = xl;
662 tmp_win->icon->w_y = yt;
671 yt +
Scr->currentvs->y, width, height,
673 moving_icon ? 0 : tmp_win->title_height + tmp_win->frame_bw3D);
682 XUnmapWindow(
dpy,
Scr->SizeWindow);
886 if(tmp_win->squeezed) {
896 XWarpPointer(
dpy, None,
Scr->Root,
897 0, 0, 0, 0, eventp->xbutton.x_root, eventp->xbutton.y_root);
899 if(!tmp_win->icon || (w != tmp_win->icon->w)) {
911 bool from3dborder = (eventp->xbutton.window == tmp_win->frame);
912 bool fromtitlebar = !from3dborder &&
920 StartResize(eventp, tmp_win, fromtitlebar, from3dborder);
925 ButtonPressMask | ButtonReleaseMask |
926 EnterWindowMask | LeaveWindowMask |
927 ButtonMotionMask | VisibilityChangeMask | ExposureMask, &
Event);
929 if(fromtitlebar &&
Event.type == ButtonPress) {
930 fromtitlebar =
false;
934 if(
Event.type == MotionNotify) {
938 (
dpy, ButtonMotionMask | ButtonReleaseMask, &
Event))
939 if(
Event.type == ButtonRelease) {
1044 int cons, newx, newy, save;
1045 unsigned int neww, newh;
1047 const int winx = tmp_win->
frame_x;
1048 const int winy = tmp_win->
frame_y;
1052 if(!strcmp(direction,
"left")) {
1059 neww = winw + winx - newx;
1065 else if(!strcmp(direction,
"right")) {
1066 for(i = 0; i < 2; i++) {
1079 if((neww != winw) || (newh != winh) ||
1080 (cons ==
Scr->rootw -
Scr->BorderRight)) {
1087 else if(!strcmp(direction,
"top")) {
1095 newh = winh + winy - newy;
1100 else if(!strcmp(direction,
"bottom")) {
1101 for(i = 0; i < 2; i++) {
1114 if((neww != winw) || (newh != winh) ||
1115 (cons ==
Scr->rooth -
Scr->BorderBottom)) {
1122 else if(!strcmp(direction,
"vertical")) {
1146 tmp_win->
zoomed = F_ZOOM;