--- a/XWorkstation.st Tue Mar 06 14:55:43 2012 +0100
+++ b/XWorkstation.st Tue Mar 06 18:26:39 2012 +0100
@@ -458,57 +458,6 @@
}
}
-#ifdef VIRTUAL_ROOT
-/*
- * added since RootWindow-macro is not sufficient
- * when virtual root-windows are involved (i.e. tvtwm)
- */
-static Window
-getRootWindow(dpy, screen)
- Display *dpy;
-{
- Window root;
- Atom vRootAtom = None;
- int i;
- Window rootReturn, parentReturn;
- Window* children = (Window *)0;
- unsigned int numChildren;
-
- root = RootWindow(dpy, screen);
- /*
- * on IRIS, this creates a badwindow error - why ?
- * children contains a funny window (000034)
- */
-# if !defined(IRIS) || defined(IRIX5)
- if (root) {
- vRootAtom = XInternAtom(dpy, "__SWM_VROOT", True);
- if (vRootAtom != None) {
- if (XQueryTree(dpy, root, &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) {
- root = *newRoot;
- XFree(newRoot); /* XXX */
- break;
- }
- }
- }
- }
- if (children) XFree( children );
- }
- }
-# endif
- return root;
-}
-#endif
%}
! !
@@ -724,11 +673,6 @@
!XWorkstation methodsFor:'accessing & queries'!
-monitorHandles
- ^#()
-
-!
-
activateOnClick:aBoolean
"set/clear the activateOnClick behavior.
If on, a click into a window raises and activates
@@ -853,6 +797,11 @@
displayName := something
!
+monitorHandles
+ ^#()
+
+!
+
protocolVersion
"return the X-servers protocol version - should normally not be of
any interest"
@@ -900,10 +849,12 @@
<context: #return>
- |x1 y1 x2 y2|
+ |x1 y1 x2 y2 rootWindowId|
x1 := x2 := aPoint x truncated.
y1 := y2 := aPoint y truncated.
+ rootWindowId := self rootWindowId.
+
%{
int xpos, ypos;
Window w1, w2, child_ret;
@@ -919,19 +870,13 @@
w1 = __WindowVal(windowId1);
w2 = __WindowVal(windowId2);
-#ifdef VIRTUAL_ROOT
rootWin = RootWindow(dpy, screen);
if (w1 == rootWin) {
- ENTER_XLIB();
- w1 = getRootWindow(dpy, screen);
- LEAVE_XLIB();
+ w1 = (Window)__externalAddressVal(rootWindowId);
}
if (w2 == rootWin) {
- ENTER_XLIB();
- w2 = getRootWindow(dpy, screen);
- LEAVE_XLIB();
- }
-#endif
+ w2 = (Window)__externalAddressVal(rootWindowId);
+ }
ENTER_XLIB();
XTranslateCoordinates(dpy, w1, w2,
@@ -1043,6 +988,10 @@
}
%}.
^ width @ height
+ "
+ Display virtualExtent
+ Display extent
+ "
!
whitepixel
@@ -4851,9 +4800,12 @@
!
-reparentedView:aView
+reparentedView:aView parentId:parentId x:x y:y
"ignored for now"
+"/ parentView := self viewFromId:parentId.
+"/ parentView infoPrintCR.
+
"/ aView reparented
!
@@ -5302,6 +5254,7 @@
# define mape ((XMappingEvent *)&ev)
# define gre ((XGravityEvent *)&ev)
# define rr ((XResizeRequestEvent *)&ev)
+# define rpe ((XReparentEvent *)&ev)
# define cie ((XCirculateEvent *)&ev)
# define pe ((XPropertyEvent *)&ev)
# define sce ((XSelectionClearEvent *)&ev)
@@ -5662,7 +5615,11 @@
break;
case ReparentNotify:
- __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(reparentedView:);
+ __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(reparentedView:parentId:x:y:);
+ t = __MKEXTERNALADDRESS(rpe->parent);
+ __ArrayInstPtr(anEventArray)->a_element[3] = t; __STORE(anEventArray, t);
+ __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(rpe->x);
+ __ArrayInstPtr(anEventArray)->a_element[5] = __mkSmallInteger(rpe->y);
break;
default:
@@ -5687,6 +5644,7 @@
#undef ve
#undef fe
#undef rr
+#undef rpe
#undef pe
#undef cie
#undef sce
@@ -9082,15 +9040,7 @@
if (ISCONNECTED) {
Display *dpy = myDpy;
-
-#ifdef VIRTUAL_ROOT
- ENTER_XLIB();
- w = getRootWindow(dpy, screen);
- LEAVE_XLIB();
-#else
w = RootWindow(dpy, screen);
-#endif
-
if (w) {
ENTER_XLIB();
@@ -9146,30 +9096,24 @@
!
pointerPosition
- "return the current pointer position in root-window coordinates"
-
- <context: #return>
-
- |xpos ypos|
-
-%{
- Window w;
+ "return the current pointer position in (virtual) root-window coordinates"
+
+ <context: #return>
+
+ |xpos ypos rootWindowId|
+
+ rootWindowId := self rootWindowId.
+
+%{
int screen = __intVal(__INST(screen));
Window rootRet, childRet;
int rootX, rootY, winX, winY;
unsigned int mask;
- if (ISCONNECTED) {
+ if (ISCONNECTED && rootWindowId != nil) {
Display *dpy = myDpy;
-
-
-#ifdef VIRTUAL_ROOT
- ENTER_XLIB();
- w = getRootWindow(dpy, screen);
- LEAVE_XLIB();
-#else
- w = RootWindow(dpy, screen);
-#endif
+ Window w = (Window)__externalAddressVal(rootWindowId);
+
ENTER_XLIB();
XQueryPointer(dpy, w, &rootRet, &childRet,
&rootX, &rootY,
@@ -9506,12 +9450,12 @@
"
"
(Display propertiesOf:nil) do:[:atm |
- |v|
+ |v prop|
Transcript show:((Display atomName:atm) printStringLeftPaddedTo:5).
Transcript show:': '.
- Display getProperty:atm from:nil delete:false into:[:type :val | v := (Display atomName:type)->val].
- Transcript showCR:v.
+ prop := Display getProperty:atm from:nil delete:false.
+ Transcript showCR:prop value.
]
"
!
@@ -10509,6 +10453,11 @@
%}.
self primitiveFailedOrClosedConnection.
^ nil
+
+ "
+ Display rootWindowId
+ Display realRootWindowId
+ "
!
rootWindowId
@@ -11250,9 +11199,9 @@
|activeWindowAtom|
- self raiseWindow:aWindowId.
-
- activeWindowAtom := self atomIDOf:#'_NET_ACTIVE_WINDOW'.
+"/ self raiseWindow:aWindowId.
+
+ activeWindowAtom := self atomIDOf:#'_NET_ACTIVE_WINDOW' create:false.
activeWindowAtom notNil ifTrue:[
self
sendClientEvent:activeWindowAtom
@@ -11267,6 +11216,10 @@
data4:nil
data5:nil.
].
+
+ "
+ Transcript topView setForegroundWindow
+ "
!
setIconName:aString in:aWindowId
@@ -11762,6 +11715,74 @@
self primitiveFailedOrClosedConnection
!
+setWindowState:aSymbol in:aWindowId
+ "tell the window type to the window manager.
+ Send a specific message to the WindowManager"
+
+ |netWmWindowStateAtom stateAtom|
+
+ netWmWindowStateAtom := self atomIDOf:#'_NET_WM_WINDOW_STATE' create:false.
+ stateAtom := self atomIDOf:aSymbol create:false.
+
+ (netWmWindowStateAtom notNil and:[stateAtom notNil]) ifTrue:[
+ self
+ sendClientEvent:netWmWindowStateAtom
+ format:32
+ to:(self rootWindowId)
+ propagate:true
+ eventMask:((self eventMaskFor:#substructureNotify) bitOr:(self eventMaskFor:#substructureRedirect))
+ window:aWindowId
+ data1:(self atomIDOf:#'_NET_WM_STATE_ADD' create:false)
+ data2:stateAtom
+ data3:nil
+ data4:1
+ data5:nil.
+ ] ifFalse:[self halt.].
+
+ "
+ |v|
+
+ v := TopView new create.
+ Display setWindowState:#'_NET_WM_WINDOW_STATE_STICKY' in:v id.
+ v open.
+ "
+!
+
+setWindowType:aSymbol in:aWindowId
+ "tell the window type to the window manager.
+ Send a specific message to the WindowManager"
+
+ |netWmWindowTypeAtom typeAtom|
+
+ netWmWindowTypeAtom := self atomIDOf:#'_NET_WM_WINDOW_TYPE' create:false.
+ typeAtom := self atomIDOf:aSymbol create:false.
+
+ (netWmWindowTypeAtom notNil and:[typeAtom notNil]) ifTrue:[
+ self
+ sendClientEvent:netWmWindowTypeAtom
+ format:32
+ to:(self rootWindowId)
+ propagate:true
+ eventMask:((self eventMaskFor:#substructureNotify) bitOr:(self eventMaskFor:#substructureRedirect))
+ window:aWindowId
+ data1:typeAtom
+ data2:nil
+ data3:nil
+ data4:nil
+ data5:nil.
+ ].
+
+ "
+ |v|
+
+ v := TopView new create.
+ Display setWindowType:#'_NET_WM_WINDOW_TYPE_DOCK' in:v id.
+ v open.
+
+ Display setWindowType:#'_NET_WM_WINDOW_TYPE_NORMAL' in:Transcript topView id
+ "
+!
+
unmapWindow:aWindowId
"make a window invisible"
@@ -12047,11 +12068,11 @@
!XWorkstation class methodsFor:'documentation'!
version_CVS
- ^ '$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.521 2012-02-23 00:02:35 vrany Exp $'
+ ^ '$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.522 2012-03-06 17:26:39 stefan Exp $'
!
version_SVN
- ^ ' Id '
+ ^ '§ Id §'
! !
XWorkstation initialize!