Changeset 7048 in vbox for trunk/src/VBox/Additions/x11/xclient
- Timestamp:
- Feb 20, 2008 4:02:21 PM (17 years ago)
- Location:
- trunk/src/VBox/Additions/x11/xclient
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/x11/xclient/Makefile.kmk
r6970 r7048 47 47 displaychange-x11.cpp 48 48 VBoxClient_LIBS += \ 49 Xext 49 Xext Xmu 50 50 endif 51 51 … … 81 81 $(LIB_RUNTIME) \ 82 82 Xext \ 83 Xmu \ 83 84 X11 84 85 endif -
trunk/src/VBox/Additions/x11/xclient/seamless-x11.cpp
r6959 r7048 29 29 30 30 #include <X11/Xatom.h> 31 #include <X11/Xmu/WinUtil.h> 31 32 32 33 /***************************************************************************** … … 34 35 *****************************************************************************/ 35 36 36 static VBoxGuestX11Pointer<unsigned char> XXGetProperty (Display *aDpy, Window aWnd, 37 Atom aPropType, const char *aPropName, 38 unsigned long *nItems) 37 static unsigned char *XXGetProperty (Display *aDpy, Window aWnd, Atom aPropType, 38 const char *aPropName, unsigned long *nItems) 39 39 { 40 40 Atom propNameAtom = XInternAtom (aDpy, aPropName, … … 42 42 if (propNameAtom == None) 43 43 { 44 return VBoxGuestX11Pointer<unsigned char>(0);44 return NULL; 45 45 } 46 46 … … 54 54 nItems, &nBytesAfter, &propVal); 55 55 if (rc != Success) 56 return VBoxGuestX11Pointer<unsigned char>(0);57 58 return VBoxGuestX11Pointer<unsigned char>(propVal);56 return NULL; 57 58 return propVal; 59 59 } 60 60 … … 67 67 { 68 68 int rc = VINF_SUCCESS; 69 /** Dummy value for XXGetProperty */70 unsigned long nItems;71 69 72 70 if (0 != mObserver) /* Assertion */ … … 79 77 LogRel(("VBoxClient: seamless guest object failed to acquire a connection to the display.\n")); 80 78 return VERR_ACCESS_DENIED; 81 }82 if (0 == XXGetProperty(mDisplay, DefaultRootWindow(mDisplay.get()), XA_WINDOW,83 NET_CLIENT_LIST, &nItems).get())84 {85 LogRel(("VBoxClient: _NET_CLIENT_LIST property not supported by guest window manager. Seamless mode will not be enabled.\n"));86 79 } 87 80 mObserver = pObserver; … … 129 122 } 130 123 124 /** 125 * Recreate the table of toplevel windows of clients on the default root window of the 126 * X server. 127 */ 131 128 void VBoxGuestSeamlessX11::rebuildWindowTree(void) 132 129 { 133 VBoxGuestX11Pointer<unsigned char> clientListRaw;134 VBoxGuestX11Pointer<Window> clientList;135 unsigned long nItems;136 137 130 freeWindowTree(); 138 clientListRaw = XXGetProperty(mDisplay, DefaultRootWindow(mDisplay.get()), XA_WINDOW, 139 NET_CLIENT_LIST, &nItems); 140 clientList = reinterpret_cast<Window *>(clientListRaw.release()); 141 for (unsigned i = 0; i < nItems; ++i) 142 { 143 VBoxGuestX11Pointer<unsigned char> windowTypeRaw; 144 VBoxGuestX11Pointer<Atom> windowType; 145 unsigned long ulCount; 146 147 windowTypeRaw = XXGetProperty(mDisplay, clientList.get()[i], XA_ATOM, 148 WM_TYPE_PROP, &ulCount); 149 windowType = reinterpret_cast<Atom *>(windowTypeRaw.release()); 150 if ( (ulCount != 0) 151 && (*windowType != XInternAtom(mDisplay, WM_TYPE_DESKTOP_PROP, True))) 152 { 153 addClientWindow(clientList.get()[i]); 154 } 155 } 156 } 131 addClients(DefaultRootWindow(mDisplay.get())); 132 } 133 134 135 /** 136 * Look at the list of children of a virtual root window and add them to the list of clients 137 * if they belong to a client which is not a virtual root. 138 * 139 * @param hRoot the virtual root window to be examined 140 */ 141 void VBoxGuestSeamlessX11::addClients(const Window hRoot) 142 { 143 /** Unused out parameters of XQueryTree */ 144 Window hRealRoot, hParent; 145 /** The list of children of the root supplied, raw pointer */ 146 Window *phChildrenRaw; 147 /** The list of children of the root supplied, auto-pointer */ 148 VBoxGuestX11Pointer<Window> phChildren; 149 /** The number of children of the root supplied */ 150 unsigned cChildren; 151 152 if (!XQueryTree(mDisplay.get(), hRoot, &hRealRoot, &hParent, &phChildrenRaw, &cChildren)) 153 return; 154 phChildren = phChildrenRaw; 155 for (unsigned i = 0; i < cChildren; ++i) 156 { 157 Window hClient = XmuClientWindow(mDisplay.get(), phChildren.get()[i]); 158 if (hClient != phChildren.get()[i] && !isVirtualRoot(hClient)) 159 addClientWindow(phChildren.get()[i]); 160 } 161 } 162 163 164 /** 165 * Checks whether a window is a virtual root. 166 * @returns true if it is, false otherwise 167 * @param hWin the window to be examined 168 */ 169 bool VBoxGuestSeamlessX11::isVirtualRoot(Window hWin) 170 { 171 unsigned char *windowTypeRaw; 172 VBoxGuestX11Pointer<Atom> windowType; 173 unsigned long ulCount; 174 bool rc = false; 175 176 windowTypeRaw = XXGetProperty(mDisplay, hWin, XA_ATOM, WM_TYPE_PROP, &ulCount); 177 windowType = reinterpret_cast<Atom *>(windowTypeRaw); 178 if ( (ulCount != 0) 179 && (*windowType == XInternAtom(mDisplay, WM_TYPE_DESKTOP_PROP, True))) 180 rc = true; 181 return rc; 182 } 183 157 184 158 185 void VBoxGuestSeamlessX11::addClientWindow(const Window hWin) -
trunk/src/VBox/Additions/x11/xclient/seamless-x11.h
r6893 r7048 294 294 void unmonitorClientList(void); 295 295 void rebuildWindowTree(void); 296 void addClients(const Window hRoot); 297 bool isVirtualRoot(Window hWin); 296 298 void addClientWindow(Window hWin); 297 299 void freeWindowTree(void);
Note:
See TracChangeset
for help on using the changeset viewer.