[Pkg-wmaker-commits] [wmaker] 23/40: Implementation for moving mouse pointer within the maximized window.

Doug Torrance dtorrance-guest at moszumanska.debian.org
Sat Mar 11 13:08:18 UTC 2017


This is an automated email from the git hooks/post-receive script.

dtorrance-guest pushed a commit to branch upstream
in repository wmaker.

commit 9328ba5b3ce423207808d2ebdd7dc8f78510fded
Author: Roman Dobosz <gryf73 at gmail.com>
Date:   Tue Feb 21 18:56:15 2017 +0100

    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.
---
 NEWS          | 11 +++++++++++
 src/actions.c | 17 +++++++++++++++++
 src/actions.h |  2 ++
 src/event.c   |  9 +++++++++
 4 files changed, 39 insertions(+)

diff --git a/NEWS b/NEWS
index f2b1b30..ed1f9e5 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 cf0699e..c9c3a7a 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 a15cf48..210e53e 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 5145e95..440cc95 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:

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-wmaker/wmaker.git



More information about the Pkg-wmaker-commits mailing list