XWorkstation.st
changeset 3789 712d129efee8
parent 3788 765f9c81f481
child 3790 43261db5b846
equal deleted inserted replaced
3788:765f9c81f481 3789:712d129efee8
 10857 bad: ;
 10857 bad: ;
 10858 %}.
 10858 %}.
 10859     self primitiveFailedOrClosedConnection
 10859     self primitiveFailedOrClosedConnection
 10860 !
 10860 !
 10861 
 10861 
       
 10862 getGeometryOf:aWindowId
       
 10863     "get a windows geometry. 
       
 10864      NOTICE: X-WindowManagers usually do wrap client topViews into their own 
       
 10865      decoration views (top label, resize boundaries etc.).
       
 10866      Thus, the numbers returned here for topViews are the physical (real) dimensions
       
 10867      relative to such a wrapper.
       
 10868      In contrast, the values found in the views instance variables are virtual dimensions
       
 10869      (i.e. ST/X makes this decoration view transparent to the program."
       
 10870 
       
 10871     <context: #return>
       
 10872 
       
 10873     |x y width height depth borderWidth info|
       
 10874 
       
 10875 %{  
       
 10876     int x_return, y_return;
       
 10877     unsigned int width_return, height_return, 
       
 10878                  border_width_return, depth_return;
       
 10879     Window root_return;
       
 10880 
       
 10881     if (ISCONNECTED
       
 10882      && __isExternalAddress(aWindowId)) {
       
 10883         ENTER_XLIB();
       
 10884         XGetGeometry(myDpy, __WindowVal(aWindowId), 
       
 10885                      &root_return, 
       
 10886                      &x_return, &y_return, 
       
 10887                      &width_return, &height_return, &border_width_return,
       
 10888                      &depth_return);
       
 10889         LEAVE_XLIB();
       
 10890 
       
 10891         x = __MKSMALLINT(x_return);
       
 10892         y = __MKSMALLINT(y_return);
       
 10893         width = __MKSMALLINT(width_return);
       
 10894         height = __MKSMALLINT(height_return);
       
 10895         depth = __MKSMALLINT(depth_return);
       
 10896         borderWidth = __MKSMALLINT(border_width_return);
       
 10897     }
       
 10898 %}.
       
 10899     borderWidth isNil ifTrue:[
       
 10900         self primitiveFailedOrClosedConnection.
       
 10901         ^ nil
       
 10902     ].
       
 10903     info := Dictionary new.
       
 10904     info at:#origin put:(x @ y).
       
 10905     info at:#extent put:(width @ height).
       
 10906     info at:#depth  put:depth.
       
 10907     info at:#borderWidth put:borderWidth.
       
 10908     ^ info
       
 10909 
       
 10910     "
       
 10911      Transcript topView device
       
 10912         getGeometryOf:(Transcript id)
       
 10913     "
       
 10914     "
       
 10915      Transcript topView device
       
 10916         getGeometryOf:(Transcript topView id)
       
 10917     "
       
 10918     "
       
 10919      |d|
       
 10920 
       
 10921      d := Transcript topView device.
       
 10922      d getGeometryOf:(d parentWindowIdOf:Transcript topView id)
       
 10923     "
       
 10924 !
       
 10925 
 10862 isValidWindowId:aWindowId
 10926 isValidWindowId:aWindowId
 10863     "return true, if the given window ID is (still) valid.
 10927     "return true, if the given window ID is (still) valid.
 10864      Especially useful, if the passed windowID is 
 10928      Especially useful, if the passed windowID is 
 10865      an alien (external) windows id."
 10929      an alien (external) windows id."
 10866 
 10930 
 11107 	LEAVE_XLIB();
 11171 	LEAVE_XLIB();
 11108 	RETURN ( self );
 11172 	RETURN ( self );
 11109     }
 11173     }
 11110 %}.
 11174 %}.
 11111     self primitiveFailedOrClosedConnection
 11175     self primitiveFailedOrClosedConnection
       
 11176 !
       
 11177 
       
 11178 parentWindowIdOf:aWindowId
       
 11179     "return a windows parent-window id.
       
 11180      Useful with getGeometryOf:, to compute information about the decoration."
       
 11181 
       
 11182 %{ 
       
 11183 
       
 11184     if (ISCONNECTED
       
 11185      && __isExternalAddress(aWindowId)) {
       
 11186         Status ok;
       
 11187         Window root, parent, *children = NULL;
       
 11188         int nChildren;
       
 11189 
       
 11190 /*        ENTER_XLIB(); */
       
 11191         ok = XQueryTree(myDpy, __WindowVal(aWindowId), 
       
 11192                         &root, &parent, &children, &nChildren);
       
 11193         if (children) {
       
 11194             XFree(children);
       
 11195         }
       
 11196 /*        LEAVE_XLIB();   */
       
 11197         if (! ok) {
       
 11198             RETURN ( nil );
       
 11199         }
       
 11200         RETURN ( __MKEXTERNALADDRESS(parent) );
       
 11201     }
       
 11202 %}.
       
 11203     self primitiveFailedOrClosedConnection.
       
 11204     ^ false
       
 11205 
       
 11206     "
       
 11207      |id|
       
 11208 
       
 11209      id := Transcript device parentWindowIdOf:(Transcript id).
       
 11210      self assert: ( Transcript container id = id ).
       
 11211     "
 11112 !
 11212 !
 11113 
 11213 
 11114 raiseWindow:aWindowId
 11214 raiseWindow:aWindowId
 11115     "bring a window to front"
 11215     "bring a window to front"
 11116 
 11216 
 11790 ! !
 11890 ! !
 11791 
 11891 
 11792 !XWorkstation class methodsFor:'documentation'!
 11892 !XWorkstation class methodsFor:'documentation'!
 11793 
 11893 
 11794 version
 11894 version
 11795     ^ '$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.418 2003-02-08 20:33:28 stefan Exp $'
 11895     ^ '$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.419 2003-02-10 16:47:22 cg Exp $'
 11796 ! !
 11896 ! !
 11797 
 11897 
 11798 XWorkstation initialize!
 11898 XWorkstation initialize!