--- a/XWorkstation.st Mon Apr 02 15:49:38 2001 +0200
+++ b/XWorkstation.st Tue Apr 03 18:22:33 2001 +0200
@@ -855,34 +855,38 @@
if (ISCONNECTED
&& __isExternalAddress(windowId)
&& __isPoint(aPoint)) {
- Display *dpy = myDpy;
-
- xp = _point_X(aPoint);
- yp = _point_Y(aPoint);
- if (__bothSmallInteger(xp, yp)) {
-
- ENTER_XLIB();
- XTranslateCoordinates(dpy,
- RootWindow(dpy, screen),
- __WindowVal(windowId),
- __intVal(xp), __intVal(yp),
- &xpos, &ypos, &child_ret);
- LEAVE_XLIB();
-
- if (child_ret) {
- RETURN ( __MKEXTERNALADDRESS(child_ret) );
- }
- RETURN ( nil );
- }
+ Display *dpy = myDpy;
+
+ xp = _point_X(aPoint);
+ yp = _point_Y(aPoint);
+ if (__bothSmallInteger(xp, yp)) {
+
+ ENTER_XLIB();
+ XTranslateCoordinates(dpy,
+ RootWindow(dpy, screen),
+ __WindowVal(windowId),
+ __intVal(xp), __intVal(yp),
+ &xpos, &ypos, &child_ret);
+ LEAVE_XLIB();
+
+ if (child_ret) {
+ RETURN ( __MKEXTERNALADDRESS(child_ret) );
+ }
+ RETURN ( nil );
+ }
}
%}.
windowId notNil ifTrue:[
- aPoint isPoint ifTrue:[
- ^ self viewIdFromPoint:aPoint asPoint truncated in:windowId
- ]
+ aPoint isPoint ifTrue:[
+ ^ self viewIdFromPoint:aPoint asPoint truncated in:windowId
+ ]
].
^ nil
+
+ "
+ Display viewIdFromPoint:100@100 in:Display realRootWindowId
+ "
!
virtualExtent
@@ -2409,77 +2413,104 @@
%{
int screen = __intVal(__INST(screen));
- Window rootWin, vRootWin;
+ Window rootWin, vRootWin = 0;
OBJ id;
if (__INST(virtualRootId) != nil) {
- RETURN (__INST(virtualRootId));
+ RETURN (__INST(virtualRootId));
}
if (ISCONNECTED) {
- Display *dpy = myDpy;
-
- vRootWin = rootWin = RootWindow(dpy, screen);
+ Display *dpy = myDpy;
+
+ rootWin = RootWindow(dpy, screen);
#ifndef IRIS
- /*
- * on IRIS, this creates a badwindow error - why ?
- * children contains a funny window (000034)
- */
-
- /*
- * care for virtual root windows (tvtwm & friends)
- */
- {
- Atom vRootAtom = None;
- int i;
- Window rootReturn, parentReturn;
- Window* children = (Window *)0;
- unsigned int numChildren;
-
- if (XQueryTree(dpy, rootWin,
- &rootReturn, &parentReturn,
- &children, &numChildren)) {
- vRootAtom = XInternAtom(dpy, "__SWM_VROOT", True );
- if (vRootAtom != None) {
- for (i=0; i < numChildren; i++) {
- Atom actual_type;
- int actual_format;
- unsigned long nitems, bytesafter;
- Window* newRoot = (Window*) 0;
-
- if (children[i]) {
- if (XGetWindowProperty(dpy, children[i], vRootAtom,
- 0L, 1L, False, XA_WINDOW,
- &actual_type, &actual_format,
- &nitems, &bytesafter,
- (unsigned char**) &newRoot
- ) == Success && newRoot) {
- vRootWin = *newRoot;
- XFree(newRoot); /* XXX */
- break;
- }
- }
- }
- }
- if (children) XFree( children );
- }
- }
-
-#endif
- }
-
- /* cannot happen */
+ /*
+ * on IRIS, this creates a badwindow error - why ?
+ * children contains a funny window (000034)
+ */
+
+ /*
+ * care for virtual root windows (tvtwm & friends)
+ */
+ {
+ Atom vRootAtom, kwinAtom;
+ int i;
+ Window rootReturn, parentReturn;
+ Window* children = (Window *)0;
+ unsigned int numChildren;
+ int ignoreVRoot = 0;
+
+ /*
+ * Take care of KDE 2.1.
+ * they define _SWM_ROOT but this is not the parent of
+ * the application windows.
+ * Instead it is used for background painting
+ */
+
+ kwinAtom = XInternAtom(dpy, "KWIN_RUNNING", True);
+ if (kwinAtom != None) {
+ Atom actual_type;
+ int actual_format;
+ unsigned long nitems, bytesafter;
+ unsigned char *retVal = 0;
+
+ ignoreVRoot = XGetWindowProperty(dpy, rootWin, kwinAtom,
+ 0L, 1L, False, kwinAtom,
+ &actual_type, &actual_format,
+ &nitems, &bytesafter, &retVal) == Success
+ && actual_type != 0;
+ XFree(retVal);
+ }
+
+ if (!ignoreVRoot) {
+ vRootAtom = XInternAtom(dpy, "__SWM_VROOT", True);
+ if (vRootAtom != None) {
+ if (XQueryTree(dpy, rootWin,
+ &rootReturn, &parentReturn,
+ &children, &numChildren)) {
+ for (i=0; i < numChildren; i++) {
+ Atom actual_type;
+ int actual_format;
+ unsigned long nitems, bytesafter;
+ Window* newRoot = (Window*) 0;
+
+ if (children[i]) {
+ if (XGetWindowProperty(dpy, children[i], vRootAtom,
+ 0L, 1L, False, XA_WINDOW,
+ &actual_type, &actual_format,
+ &nitems, &bytesafter,
+ (unsigned char**) &newRoot
+ ) == Success && newRoot) {
+ vRootWin = *newRoot;
+ XFree(newRoot); /* XXX */
+ break;
+ }
+ }
+ }
+ if (children) XFree( children );
+ }
+ }
+ }
+ }
+#endif
+ }
+
if (! vRootWin) {
- vRootWin = rootWin;
- if (! rootWin) {
- RETURN ( nil );
- }
+ vRootWin = rootWin;
+ if (! vRootWin) {
+ RETURN ( nil );
+ }
}
__INST(rootId) = id = __MKEXTERNALADDRESS(rootWin); __STORE(self, id);
__INST(virtualRootId) = id = __MKEXTERNALADDRESS(vRootWin); __STORE(self, id);
RETURN ( id );
%}
+
+ "
+ Display rootWindowId
+ "
! !
!XWorkstation methodsFor:'color stuff'!
@@ -5778,7 +5809,8 @@
"if not implemented in new dispatch, fall back to old dispatch"
self dispatchLastEvent
].
- ].!
+ ].
+!
setEventMask:aMask in:aWindowId
"tell X that we are only interested in events from aMask, which
@@ -11743,6 +11775,6 @@
!XWorkstation class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.382 2000-10-23 12:33:56 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.383 2001-04-03 16:22:33 stefan Exp $'
! !
XWorkstation initialize!