diff --git a/NEWS b/NEWS index f2b1b30c..ed1f9e5c 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,17 @@ NEWS for veteran Window Maker users -- 0.95.8 +Move pointer with maximized windows +----------------------------------- + +Implementation for moving mouse pointer within the maximized window. + +Mouse pointer can be now moved together with window if keyboard was used for +arrange maximized windows on screen. This feature can be turned on in WPrefs.app +in Expert tab by selecting "Move mouse pointer with half maximized windows.", or +setting "PointerWithHalfMaxWindows" to "Yes" on ~/GNUstep/Defaults/WindowMaker +file. + Alternative way for traverse half-maximized windows --------------------------------------------------- diff --git a/src/actions.c b/src/actions.c index cf0699e4..c9c3a7a2 100644 --- a/src/actions.c +++ b/src/actions.c @@ -2078,6 +2078,23 @@ void wMakeWindowVisible(WWindow *wwin) } } +void movePionterToWindowCenter(WWindow *wwin) +{ + if (!wPreferences.pointer_with_half_max_windows) { + wmessage("pointer_with_half_max_windows not set. do nothing"); + return; + } + + wmessage("move the pointer to: %dx%d", + wwin->frame_x + wwin->client.width / 2, + wwin->frame_y + wwin->client.height / 2); + XSelectInput(dpy, wwin->client_win, wwin->event_mask); + XWarpPointer(dpy, None, wwin->screen_ptr->root_win, 0, 0, 0, 0, + wwin->frame_x + wwin->client.width / 2, + wwin->frame_y + wwin->client.height / 2); + XFlush(dpy); +} + /* * Do the animation while shading (called with what = SHADE) * or unshading (what = UNSHADE). diff --git a/src/actions.h b/src/actions.h index a15cf488..210e53e7 100644 --- a/src/actions.h +++ b/src/actions.h @@ -81,5 +81,7 @@ void wUnfullscreenWindow(WWindow *wwin); void animateResize(WScreen *scr, int x, int y, int w, int h, int fx, int fy, int fw, int fh); void update_saved_geometry(WWindow *wwin); +void movePionterToWindowCenter(WWindow *wwin); + #endif diff --git a/src/event.c b/src/event.c index 5145e95f..440cc95f 100644 --- a/src/event.c +++ b/src/event.c @@ -1500,6 +1500,7 @@ static void handleKeyPress(XEvent * event) CloseWindowMenu(scr); handleMaximize(wwin, MAX_HORIZONTAL | MAX_KEYBOARD); + movePionterToWindowCenter(wwin); } break; case WKBD_LHMAXIMIZE: @@ -1507,6 +1508,7 @@ static void handleKeyPress(XEvent * event) CloseWindowMenu(scr); handleMaximize(wwin, MAX_VERTICAL | MAX_LEFTHALF | MAX_KEYBOARD); + movePionterToWindowCenter(wwin); } break; case WKBD_RHMAXIMIZE: @@ -1514,6 +1516,7 @@ static void handleKeyPress(XEvent * event) CloseWindowMenu(scr); handleMaximize(wwin, MAX_VERTICAL | MAX_RIGHTHALF | MAX_KEYBOARD); + movePionterToWindowCenter(wwin); } break; case WKBD_THMAXIMIZE: @@ -1521,6 +1524,7 @@ static void handleKeyPress(XEvent * event) CloseWindowMenu(scr); handleMaximize(wwin, MAX_HORIZONTAL | MAX_TOPHALF | MAX_KEYBOARD); + movePionterToWindowCenter(wwin); } break; case WKBD_BHMAXIMIZE: @@ -1528,6 +1532,7 @@ static void handleKeyPress(XEvent * event) CloseWindowMenu(scr); handleMaximize(wwin, MAX_HORIZONTAL | MAX_BOTTOMHALF | MAX_KEYBOARD); + movePionterToWindowCenter(wwin); } break; case WKBD_LTCMAXIMIZE: @@ -1535,6 +1540,7 @@ static void handleKeyPress(XEvent * event) CloseWindowMenu(scr); handleMaximize(wwin, MAX_LEFTHALF | MAX_TOPHALF | MAX_KEYBOARD); + movePionterToWindowCenter(wwin); } break; case WKBD_RTCMAXIMIZE: @@ -1542,6 +1548,7 @@ static void handleKeyPress(XEvent * event) CloseWindowMenu(scr); handleMaximize(wwin, MAX_RIGHTHALF | MAX_TOPHALF | MAX_KEYBOARD); + movePionterToWindowCenter(wwin); } break; case WKBD_LBCMAXIMIZE: @@ -1549,6 +1556,7 @@ static void handleKeyPress(XEvent * event) CloseWindowMenu(scr); handleMaximize(wwin, MAX_LEFTHALF | MAX_BOTTOMHALF | MAX_KEYBOARD); + movePionterToWindowCenter(wwin); } break; case WKBD_RBCMAXIMIZE: @@ -1556,6 +1564,7 @@ static void handleKeyPress(XEvent * event) CloseWindowMenu(scr); handleMaximize(wwin, MAX_RIGHTHALF | MAX_BOTTOMHALF | MAX_KEYBOARD); + movePionterToWindowCenter(wwin); } break; case WKBD_MAXIMUS: