summaryrefslogtreecommitdiffstats
path: root/unix/tkUnixWm.c
diff options
context:
space:
mode:
authorculler <culler>2018-12-13 16:47:28 (GMT)
committerculler <culler>2018-12-13 16:47:28 (GMT)
commit7a5f3dba4c643c1bc760f4f9d7dda5cc34cb717d (patch)
tree1b8e4c8341400913dd09b33f3e5acb83be6da7be /unix/tkUnixWm.c
parentc506faa54e44b717a08939ddb801fa695db52e07 (diff)
downloadtk-7a5f3dba4c643c1bc760f4f9d7dda5cc34cb717d.zip
tk-7a5f3dba4c643c1bc760f4f9d7dda5cc34cb717d.tar.gz
tk-7a5f3dba4c643c1bc760f4f9d7dda5cc34cb717d.tar.bz2
Make the minimal change needed to fix the issue with Gnome 3 invisible borders,
without changing any other behavior.
Diffstat (limited to 'unix/tkUnixWm.c')
-rw-r--r--unix/tkUnixWm.c30
1 files changed, 28 insertions, 2 deletions
diff --git a/unix/tkUnixWm.c b/unix/tkUnixWm.c
index 19ac86c..2537ed9 100644
--- a/unix/tkUnixWm.c
+++ b/unix/tkUnixWm.c
@@ -5855,8 +5855,34 @@ Tk_CoordsToWindow(
}
for (wmPtr = (WmInfo *) dispPtr->firstWmPtr; wmPtr != NULL;
wmPtr = wmPtr->nextPtr) {
- if (wmPtr->reparent == child) {
- goto gotToplevel;
+ if (child == wmPtr->reparent) {
+ XWindowChanges changes = wmPtr->winPtr->changes;
+
+ /* Gnome3-based window managers place an invisible border
+ * around a window to help grab the edge for resizing.
+ * XTranslateCoordinates returns a reparent of the window as
+ * the child whenever the point is inside the invisible
+ * border. But we only want to use the window as our toplevel
+ * when the point is actually inside the window. If the point
+ * is outside, we replace the window by the next window in the
+ * stack, provided it is a Tk window. (Gnome3 adds its own
+ * private window below when no lower Tk window contains the
+ * point. We can detect this by checking whether the winPtr
+ * is NULL.)
+ */
+
+ if (x >= changes.x &&
+ x < changes.x + changes.width &&
+ y >= changes.y - wmPtr->menuHeight &&
+ y < changes.y + changes.height) {
+ goto gotToplevel;
+ } else if (wmPtr->nextPtr != NULL) {
+ wmPtr = wmPtr->nextPtr;
+ if (wmPtr->winPtr == NULL) {
+ return NULL;
+ }
+ goto gotToplevel;
+ }
}
if (wmPtr->wrapperPtr != NULL) {
if (child == wmPtr->wrapperPtr->window) {