void CMD_WarpToWindow(F_CMD_ARGS) { int val1_unit, val2_unit, n; int val1, val2; n = GetTwoArguments(action, &val1, &val2, &val1_unit, &val2_unit); if (context != C_UNMANAGED) { if (DeferExecution(eventp,&w,&tmp_win,&context,CRS_SELECT,ButtonRelease)) return; if (n == 2) warp_to_fvwm_window(eventp, tmp_win, val1, val1_unit, val2, val2_unit); else warp_to_fvwm_window(eventp, tmp_win, 0, 0, 0, 0); } else { int x = 0; int y = 0; if (n == 2) { int wx; int wy; unsigned int ww; unsigned int wh; if (!XGetGeometry( dpy, w, &JunkRoot, &wx, &wy, &ww, &wh, &JunkBW, &JunkDepth)) { return; } if (val1_unit != Scr.MyDisplayWidth) x = val1; else x = (ww - 1) * val1 / 100; if (val2_unit != Scr.MyDisplayHeight) y = val2; else y = (wh - 1) * val2 / 100; if (x < 0) x += ww; if (y < 0) y += wh; } XWarpPointer(dpy, None, w, 0, 0, 0, 0, x, y); } }
/* * Change by PRB ([email protected]), 31/10/93. Prepend a hot key * specifier to each item in the list. This means allocating the * memory for each item (& freeing it) rather than just using the window * title directly. */ void do_windowList (XEvent *eventp, Window w, FVWMWIN *tmp_win, ulong context, char *action, int *Module) { MenuRoot *mr; FVWMWIN *t; char *tname; char loc[40], *name = NULL; int dwidth, dheight; char tlabel[50]; int last_desk_done = MY_INT_MIN; int next_desk; int val1, val2, val1_unit, val2_unit, n; char *t_hot; /* Menu label with hotkey added */ char scut = '0'; /* Current short cut key */ n = GetTwoArguments (action, &val1, &val2, &val1_unit, &val2_unit); sprintf (tlabel, "Desk corrente: %d\tGeometria", Scr.CurrentDesk); mr = NewMenuRoot (tlabel, 0); AddToMenu (mr, tlabel, "TITLE"); next_desk = 0; while (next_desk != MY_INT_MAX) { /* Sort window list by desktop number */ if (val1 < 2 && val1 > -2) { next_desk = MY_INT_MAX; for (t = Scr.FvwmRoot.next; t != NULL; t = t->next) { if ( (t->Desk > last_desk_done) && (t->Desk < next_desk) ) next_desk = t->Desk; } } else if (val1 < 4 && val1 > -4) { if (last_desk_done == MY_INT_MIN) next_desk = Scr.CurrentDesk; else next_desk = MY_INT_MAX; } else { if (last_desk_done == MY_INT_MIN) next_desk = val2; else next_desk = MY_INT_MAX; } last_desk_done = next_desk; for (t = Scr.FvwmRoot.next; t != NULL; t = t->next) { if ( t->Desk == next_desk && (t->flags & WINDOWLISTSKIP) == 0 ) { if (++scut == ('9' + 1)) scut = 'A'; /* Next shortcut key */ if (val1 % 2 != 0) name = t->icon_name; else name = t->name; t_hot = safemalloc (strlen (name) + 48); sprintf (t_hot, "&%c. %s", scut, name); /* Generate label */ tname = safemalloc(40); tname[0] = 0; if(t->flags & ICONIFIED) strcpy (tname, "("); sprintf (loc, "%d:", t->Desk); strcat (tname, loc); if (t->frame_x >= 0) sprintf (loc, "+%d", t->frame_x); else sprintf (loc, "%d", t->frame_x); strcat (tname, loc); if (t->frame_y >=0) sprintf (loc, "+%d", t->frame_y); else sprintf (loc, "%d", t->frame_y); strcat (tname, loc); dheight = t->frame_height - t->title_height - 2*t->boundary_width; dwidth = t->frame_width - 2*t->boundary_width; dwidth -= t->hints.base_width; dheight -= t->hints.base_height; dwidth /= t->hints.width_inc; dheight /= t->hints.height_inc; sprintf (loc, "x%d", dwidth); strcat (tname, loc); sprintf (loc, "x%d", dheight); strcat (tname, loc); if (t->flags & ICONIFIED) strcat (tname, ")"); sprintf (tlabel, "RAISE_IT %ld %ld", t, t->w); strcat (t_hot, "\t"); strcat (t_hot, tname); AddToMenu (mr, t_hot, tlabel); free (t_hot); free (tname); } } } MakeMenu (mr); /* If the menu is a result of a ButtonPress, then tell do_menu() to expect (and ignore) a button release event. Otherwise, it was as a result of a keypress or something, so we shouldn't expect a button release event. Fixes problem with keyboard short cuts not working if window list is popped up by keyboard. [email protected], 27/6/96 */ if (eventp->type == ButtonPress) do_menu (mr,1); else do_menu (mr,0); DestroyMenu (mr); } /* end do_windowList */
void CMD_WarpToWindow(F_CMD_ARGS) { int val1_unit, val2_unit, n; int val1, val2; int do_raise; char *next; char *token; next = GetNextToken(action, &token); if (StrEquals(token, "!raise")) { do_raise = 0; action = next; } else if (StrEquals(token, "raise")) { do_raise = 1; action = next; } else { do_raise = 1; } n = GetTwoArguments(action, &val1, &val2, &val1_unit, &val2_unit); if (exc->w.wcontext != C_UNMANAGED) { if (n == 2) { warp_to_fvwm_window( exc, val1, val1_unit, val2, val2_unit, do_raise); } else { warp_to_fvwm_window(exc, 0, 0, 0, 0, do_raise); } } else { int x = 0; int y = 0; if (n == 2) { int wx; int wy; int ww; int wh; if (!XGetGeometry( dpy, exc->w.w, &JunkRoot, &wx, &wy, (unsigned int*)&ww, (unsigned int*)&wh, (unsigned int*)&JunkBW, (unsigned int*)&JunkDepth)) { return; } if (val1_unit != Scr.MyDisplayWidth) { x = val1; } else { x = (ww - 1) * val1 / 100; } if (val2_unit != Scr.MyDisplayHeight) { y = val2; } else { y = (wh - 1) * val2 / 100; } if (x < 0) { x += ww; } if (y < 0) { y += wh; } } FWarpPointerUpdateEvpos( exc->x.elast, dpy, None, exc->w.w, 0, 0, 0, 0, x, y); } return; }
void CMD_WarpToWindow(F_CMD_ARGS) { int val1_unit, val2_unit, n; int val1, val2; struct monitor *m; int do_raise; char *next; char *token; next = GetNextToken(action, &token); if (StrEquals(token, "!raise")) { do_raise = 0; action = next; } else if (StrEquals(token, "raise")) { do_raise = 1; action = next; } else { do_raise = 1; } n = GetTwoArguments(action, &val1, &val2, &val1_unit, &val2_unit); if (exc->w.wcontext != C_UNMANAGED) { if (n == 2) { warp_to_mvwm_window( exc, val1, val1_unit, val2, val2_unit, do_raise); } else { warp_to_mvwm_window(exc, 0, 0, 0, 0, do_raise); } } else { int x = 0; int y = 0; if (n == 2) { int wx; int wy; int ww; int wh; if (exc->w.w == None || !XGetGeometry( dpy, exc->w.w, &JunkRoot, &wx, &wy, (unsigned int*)&ww, (unsigned int*)&wh, (unsigned int*)&JunkBW, (unsigned int*)&JunkDepth)) { return; } /* TA: 2014-09-11: This window is unmanaged. Since * mvwm won't have created a window for this, fw will be * NULL and hence no monitor information will be * present. Since we already know the coordinates of * the unmanaged window, use those in determining the * monitor to use. */ m = monitor_by_xy(wx, wy); if (val1_unit != m->coord.w) { x = val1; } else { x = (ww - 1) * val1 / 100; } if (val2_unit != m->coord.h) { y = val2; } else { y = (wh - 1) * val2 / 100; } if (x < 0) { x += ww; } if (y < 0) { y += wh; } } FWarpPointerUpdateEvpos( exc->x.elast, dpy, None, exc->w.w, 0, 0, 0, 0, x, y); } return; }