summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'x11-base/xorg-server/files/xorg-server-xf86CoordinatesToWindow.patch')
-rw-r--r--x11-base/xorg-server/files/xorg-server-xf86CoordinatesToWindow.patch97
1 files changed, 97 insertions, 0 deletions
diff --git a/x11-base/xorg-server/files/xorg-server-xf86CoordinatesToWindow.patch b/x11-base/xorg-server/files/xorg-server-xf86CoordinatesToWindow.patch
new file mode 100644
index 0000000..b823d13
--- /dev/null
+++ b/x11-base/xorg-server/files/xorg-server-xf86CoordinatesToWindow.patch
@@ -0,0 +1,97 @@
+diff --git a/dix/events.c b/dix/events.c
+index 8c590f0..43803ab 100644
+--- a/dix/events.c
++++ b/dix/events.c
+@@ -5837,3 +5837,47 @@ IsInterferingGrab(ClientPtr client, DeviceIntPtr dev, xEvent* event)
+ return FALSE;
+ }
+
++WindowPtr
++CoordinatesToWindow(int x, int y, int screen)
++{
++ WindowPtr pWin;
++ WindowPtr ret = NullWindow;
++ BoxRec box;
++
++ pWin = screenInfo.screens[screen]->root;
++ while (pWin)
++ {
++ if ((pWin->mapped) &&
++ (x >= pWin->drawable.x - wBorderWidth (pWin)) &&
++ (x < pWin->drawable.x + (int)pWin->drawable.width +
++ wBorderWidth(pWin)) &&
++ (y >= pWin->drawable.y - wBorderWidth (pWin)) &&
++ (y < pWin->drawable.y + (int)pWin->drawable.height +
++ wBorderWidth (pWin))
++ /* When a window is shaped, a further check
++ * is made to see if the point is inside
++ * borderSize
++ */
++ && (!wBoundingShape(pWin) || PointInBorderSize(pWin, x, y))
++ && (!wInputShape(pWin) ||
++ RegionContainsPoint(wInputShape(pWin),
++ x - pWin->drawable.x,
++ y - pWin->drawable.y, &box))
++#ifdef ROOTLESS
++ /* In rootless mode windows may be offscreen, even when
++ * they're in X's stack. (E.g. if the native window system
++ * implements some form of virtual desktop system).
++ */
++ && !pWin->rootlessUnhittable
++#endif
++ )
++ {
++ ret = pWin;
++ pWin = pWin->firstChild;
++ }
++ else
++ pWin = pWin->nextSib;
++ }
++ return ret;
++}
++
+diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
+index 9b21c31..adef044 100644
+--- a/hw/xfree86/common/xf86Xinput.c
++++ b/hw/xfree86/common/xf86Xinput.c
+@@ -1441,4 +1441,10 @@ xf86PostTouchEvent(DeviceIntPtr dev, uint32_t touchid, uint16_t type,
+ mieqEnqueue(dev, (InternalEvent *)((xf86Events + i)->event));
+ }
+
++WindowPtr
++xf86CoordinatesToWindow(int x, int y, int screen)
++{
++ return CoordinatesToWindow(x, y, screen);
++}
++
+ /* end of xf86Xinput.c */
+diff --git a/hw/xfree86/common/xf86Xinput.h b/hw/xfree86/common/xf86Xinput.h
+index f1afb09..b6254c6 100644
+--- a/hw/xfree86/common/xf86Xinput.h
++++ b/hw/xfree86/common/xf86Xinput.h
+@@ -184,4 +184,6 @@ extern _X_EXPORT void xf86VIDrvMsgVerb(InputInfoPtr dev,
+ /* xf86Option.c */
+ extern _X_EXPORT void xf86CollectInputOptions(InputInfoPtr pInfo, const char **defaultOpts);
+
++extern _X_EXPORT WindowPtr xf86CoordinatesToWindow(int x, int y, int screen);
++
+ #endif /* _xf86Xinput_h */
+diff --git a/include/events.h b/include/events.h
+index 222cc3d..8b87cb6 100644
+--- a/include/events.h
++++ b/include/events.h
+@@ -24,6 +24,7 @@
+
+ #ifndef EVENTS_H
+ #define EVENTS_H
++
+ typedef struct _DeviceEvent DeviceEvent;
+ typedef struct _DeviceChangedEvent DeviceChangedEvent;
+ typedef struct _TouchOwnershipEvent TouchOwnershipEvent;
+@@ -36,4 +37,6 @@ typedef struct _XQuartzEvent XQuartzEvent;
+ #endif
+ typedef union _InternalEvent InternalEvent;
+
++extern WindowPtr CoordinatesToWindow(int x, int y, int screen);
++
+ #endif