Changeset 50324 in vbox for trunk/src/VBox/Additions/x11
- Timestamp:
- Feb 5, 2014 10:26:34 AM (11 years ago)
- Location:
- trunk/src/VBox/Additions/x11/VBoxClient
- Files:
-
- 2 deleted
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/x11/VBoxClient/seamless-host.cpp
r48945 r50324 106 106 #endif 107 107 mState = ENABLE; 108 m Observer->notify();108 mX11MonitorThread->start(); 109 109 break; 110 110 case VMMDev_Seamless_Host_Window: … … 120 120 #endif 121 121 mState = DISABLE; 122 m Observer->notify();122 mX11MonitorThread->stop(RT_INDEFINITE_WAIT, 0); 123 123 } 124 124 } … … 134 134 * Update the set of visible rectangles in the host. 135 135 */ 136 void VBoxGuestSeamlessHost:: updateRects(RTRECT *pRects, size_t cRects)136 void VBoxGuestSeamlessHost::notify(RTRECT *pRects, size_t cRects) 137 137 { 138 138 LogRelFlowFunc(("\n")); -
trunk/src/VBox/Additions/x11/VBoxClient/seamless-host.h
r44528 r50324 22 22 #include <VBox/VBoxGuestLib.h> /* for the R3 guest library functions */ 23 23 24 #include "seamless-glue.h" /* for VBoxGuestSeamlessObserver */25 24 #include "thread.h" /* for VBoxGuestThread */ 26 25 … … 64 63 65 64 /** 65 * Small virtual class which provides the interface for notifying the host of 66 * changes to the X11 window configuration, mainly split out from 67 * @a VBoxGuestSeamlessHost to simplify the unit test. 68 */ 69 class VBoxGuestSeamlessHostInt 70 { 71 public: 72 virtual void notify(RTRECT *pRects, size_t cRects) = 0; 73 }; 74 75 /** 66 76 * Interface to the host 67 77 */ 68 class VBoxGuestSeamlessHost 78 class VBoxGuestSeamlessHost : public VBoxGuestSeamlessHostInt 69 79 { 70 80 friend class VBoxGuestSeamlessHostThread; … … 86 96 VBoxGuestSeamlessHost& operator=(const VBoxGuestSeamlessHost&); 87 97 88 /** Observer to connect guest and host and ferry events back and forth. */ 89 VBoxGuestSeamlessObserver *mObserver; 98 /** Thread to start and stop when we enter and leave seamless mode which 99 * monitors X11 windows in the guest. */ 100 VBoxGuestThread *mX11MonitorThread; 90 101 /** Host seamless event (i.e. enter and leave) thread function. */ 91 102 VBoxGuestSeamlessHostThread mThreadFunction; … … 113 124 /** 114 125 * Initialise the guest and ensure that it is capable of handling seamless mode 115 * @param p Observer Observer class to connect host and guest interfaces126 * @param pX11MonitorThread Thread class to monitor guest windows. 116 127 * 117 128 * @returns iprt status code 118 129 */ 119 int init(VBoxGuest SeamlessObserver *pObserver)130 int init(VBoxGuestThread *pX11MonitorThread) 120 131 { 121 132 LogRelFlowFunc(("\n")); 122 if (m Observer!= 0) /* Assertion */133 if (mX11MonitorThread != 0) /* Assertion */ 123 134 { 124 135 LogRel(("VBoxClient: ERROR: attempt to initialise seamless host object twice!\n")); 125 136 return VERR_INTERNAL_ERROR; 126 137 } 127 m Observer = pObserver;138 mX11MonitorThread = pX11MonitorThread; 128 139 LogRelFlowFunc(("returning VINF_SUCCESS\n")); 129 140 return VINF_SUCCESS; … … 148 159 * Update the set of visible rectangles in the host. 149 160 */ 150 v oid updateRects(RTRECT *pRects, size_t cRects);161 virtual void notify(RTRECT *pRects, size_t cRects); 151 162 152 163 VBoxGuestSeamlessHost(void) : mThreadFunction(this), … … 154 165 RTTHREADFLAGS_WAITABLE, "Host events") 155 166 { 156 m Observer= 0;167 mX11MonitorThread = 0; 157 168 mRunning = false; 158 169 mState = NONE; -
trunk/src/VBox/Additions/x11/VBoxClient/seamless-x11.cpp
r48945 r50324 24 24 #include <VBox/log.h> 25 25 26 #include "seamless- guest.h"26 #include "seamless-x11.h" 27 27 28 28 #include <X11/Xatom.h> … … 71 71 * @returns true if it can handle seamless, false otherwise 72 72 */ 73 int VBoxGuestSeamlessX11::init(VBoxGuestSeamless Observer *pObserver)73 int VBoxGuestSeamlessX11::init(VBoxGuestSeamlessHostInt *pHost) 74 74 { 75 75 int rc = VINF_SUCCESS; 76 76 77 77 LogRelFlowFunc(("\n")); 78 if (0 != m Observer) /* Assertion */78 if (0 != mHost) /* Assertion */ 79 79 { 80 80 LogRel(("VBoxClient: ERROR: attempt to initialise seamless guest object twice!\n")); … … 86 86 return VERR_ACCESS_DENIED; 87 87 } 88 m Observer = pObserver;88 mHost = pHost; 89 89 LogRelFlowFunc(("returning %Rrc\n", rc)); 90 90 return rc; … … 299 299 { 300 300 updateRects(); 301 m Observer->notify();301 mHost->notify(mpRects, mcRects); 302 302 } 303 303 mChanged = false; -
trunk/src/VBox/Additions/x11/VBoxClient/seamless-x11.h
r44528 r50324 23 23 #include <iprt/avl.h> 24 24 25 #include "seamless-guest.h" 25 #include "seamless-x11.h" 26 #include "seamless-host.h" 26 27 27 28 #include <X11/Xlib.h> … … 148 149 class VBoxGuestSeamlessX11; 149 150 150 class VBoxGuestSeamlessX11 : public VBoxGuestSeamlessGuest151 class VBoxGuestSeamlessX11 151 152 { 152 153 private: … … 156 157 157 158 // Private member variables 158 /** Pointer to the observerclass. */159 VBoxGuestSeamless Observer *mObserver;159 /** Pointer to the host class. */ 160 VBoxGuestSeamlessHostInt *mHost; 160 161 /** Our connection to the X11 display we are running on. */ 161 162 Display *mDisplay; … … 197 198 /** 198 199 * Initialise the guest and ensure that it is capable of handling seamless mode 199 * @param pObserver Observer class to connect host and guest interfaces 200 * @param pHost Host interface class to notify of window configuration 201 * changes. 200 202 * 201 203 * @returns iprt status code 202 204 */ 203 int init(VBoxGuestSeamless Observer *pObserver);205 int init(VBoxGuestSeamlessHostInt *pHost); 204 206 205 207 /** … … 208 210 void uninit(void) 209 211 { 210 if (0 != m Observer)212 if (0 != mHost) 211 213 { 212 214 stop(); 213 215 } 214 m Observer= 0;216 mHost = 0; 215 217 } 216 218 … … 241 243 242 244 VBoxGuestSeamlessX11(void) 243 : m Observer(0), mDisplay(NULL), mpRects(NULL), mcRects(0),245 : mHost(0), mDisplay(NULL), mpRects(NULL), mcRects(0), 244 246 mSupportsShape(false), mEnabled(false), mChanged(false) {} 245 247 … … 252 254 }; 253 255 254 typedef VBoxGuestSeamlessX11 VBoxGuestSeamlessGuestImpl;255 256 256 #endif /* __Additions_linux_seamless_x11_h not defined */ -
trunk/src/VBox/Additions/x11/VBoxClient/seamless.h
r44528 r50324 22 22 23 23 #include "seamless-host.h" 24 #include "seamless-guest.h" 25 #include "seamless-glue.h" 24 #include "seamless-x11.h" 26 25 27 /** Thread function class for VBoxGuestSeamless Guest. */26 /** Thread function class for VBoxGuestSeamlessX11. */ 28 27 class VBoxGuestSeamlessGuestThread: public VBoxGuestThreadFunction 29 28 { 30 29 private: 31 30 /** The guest class "owning" us. */ 32 VBoxGuestSeamlessGuestImpl *mGuest; 33 /** The guest observer monitoring the guest. */ 34 VBoxGuestSeamlessObserver *mObserver; 31 VBoxGuestSeamlessX11 *mGuest; 35 32 /** Should we exit the thread? */ 36 33 bool mExit; … … 41 38 42 39 public: 43 VBoxGuestSeamlessGuestThread(VBoxGuestSeamlessGuestImpl *pGuest, 44 VBoxGuestSeamlessObserver *pObserver) 45 { mGuest = pGuest; mObserver = pObserver; mExit = false; } 40 VBoxGuestSeamlessGuestThread(VBoxGuestSeamlessX11 *pGuest) 41 { mGuest = pGuest; mExit = false; } 46 42 virtual ~VBoxGuestSeamlessGuestThread(void) {} 47 43 /** … … 74 70 }; 75 71 76 /** Observer for the host class - start and stop seamless reporting in the guest when the77 host requests. */78 class VBoxGuestSeamlessHostObserver : public VBoxGuestSeamlessObserver79 {80 private:81 VBoxGuestSeamlessHost *mHost;82 VBoxGuestThread *mGuestThread;83 84 public:85 VBoxGuestSeamlessHostObserver(VBoxGuestSeamlessHost *pHost,86 VBoxGuestThread *pGuestThread)87 {88 mHost = pHost;89 mGuestThread = pGuestThread;90 }91 92 virtual void notify(void)93 {94 switch (mHost->getState())95 {96 case VBoxGuestSeamlessHost::ENABLE:97 mGuestThread->start();98 break;99 case VBoxGuestSeamlessHost::DISABLE:100 mGuestThread->stop(RT_INDEFINITE_WAIT, 0);101 break;102 default:103 break;104 }105 }106 };107 108 /** Observer for the guest class - send the host updated seamless rectangle information when109 it becomes available. */110 class VBoxGuestSeamlessGuestObserver : public VBoxGuestSeamlessObserver111 {112 private:113 VBoxGuestSeamlessHost *mHost;114 VBoxGuestSeamlessGuestImpl *mGuest;115 116 public:117 VBoxGuestSeamlessGuestObserver(VBoxGuestSeamlessHost *pHost,118 VBoxGuestSeamlessGuestImpl *pGuest)119 {120 mHost = pHost;121 mGuest = pGuest;122 }123 124 virtual void notify(void)125 {126 mHost->updateRects(mGuest->getRects(), mGuest->getRectCount());127 }128 };129 130 72 class VBoxGuestSeamless 131 73 { 132 74 private: 133 75 VBoxGuestSeamlessHost mHost; 134 VBoxGuestSeamless GuestImplmGuest;76 VBoxGuestSeamlessX11 mGuest; 135 77 VBoxGuestSeamlessGuestThread mGuestFunction; 136 78 VBoxGuestThread mGuestThread; 137 VBoxGuestSeamlessHostObserver mHostObs;138 VBoxGuestSeamlessGuestObserver mGuestObs;139 79 140 80 bool isInitialised; … … 152 92 if (RT_SUCCESS(rc)) 153 93 { 154 rc = mHost.init(&m HostObs);94 rc = mHost.init(&mGuestThread); 155 95 } 156 96 if (RT_SUCCESS(rc)) 157 97 { 158 rc = mGuest.init(&m GuestObs);98 rc = mGuest.init(&mHost); 159 99 } 160 100 if (RT_SUCCESS(rc)) … … 187 127 } 188 128 189 VBoxGuestSeamless() : mGuestFunction(&mGuest , &mGuestObs),129 VBoxGuestSeamless() : mGuestFunction(&mGuest), 190 130 mGuestThread(&mGuestFunction, 0, RTTHREADTYPE_MSG_PUMP, 191 RTTHREADFLAGS_WAITABLE, "Guest events"), 192 mHostObs(&mHost, &mGuestThread), mGuestObs(&mHost, &mGuest) 131 RTTHREADFLAGS_WAITABLE, "Guest events") 193 132 { 194 133 isInitialised = false; -
trunk/src/VBox/Additions/x11/VBoxClient/testcase/tstSeamlessX11-auto.cpp
r44529 r50324 29 29 30 30 #include "../seamless.h" 31 #include "../seamless-host.h" 31 32 32 33 #undef DefaultRootWindow … … 297 298 } 298 299 299 /** Dummy observerclass */300 class test Observer: public VBoxGuestSeamlessObserver300 /** Dummy host class */ 301 class testHost: public VBoxGuestSeamlessHostInt 301 302 { 302 303 bool mfNotified; 303 304 public: 304 test Observer() : mfNotified(false) {}305 virtual void notify( void)305 testHost() : mfNotified(false) {} 306 virtual void notify(RTRECT *pRects, size_t cRects) 306 307 { 307 308 mfNotified = true; 308 309 } 309 virtual ~test Observer() {}310 virtual ~testHost() {} 310 311 bool isNotified(void) { return mfNotified; } 311 312 }; … … 599 600 { 600 601 VBoxGuestSeamlessX11 subject; 601 test Observer observer;602 testHost host; 602 603 unsigned cErrs = 0; 603 604 604 subject.init(& observer);605 subject.init(&host); 605 606 smlsSetWindowAttributes(pFixture->paAttribsBefore, 606 607 pFixture->pahWindowsBefore, … … 619 620 pFixture->paShapeRectsAfter); 620 621 smlsSetNextEvent(pFixture->x11EventType, pFixture->hEventWindow); 621 if ( observer.isNotified()) /* Initial window tree rebuild */622 if (host.isNotified()) /* Initial window tree rebuild */ 622 623 { 623 624 RTPrintf("%s: fixture: %s. Notification was set before the first event!!!\n", … … 626 627 } 627 628 subject.nextEvent(); 628 if (! observer.isNotified())629 if (!host.isNotified()) 629 630 { 630 631 RTPrintf("%s: fixture: %s. No notification was sent for the initial window tree rebuild.\n", … … 634 635 smlsSetNextEvent(0, 0); 635 636 subject.nextEvent(); 636 if (! observer.isNotified())637 if (!host.isNotified()) 637 638 { 638 639 RTPrintf("%s: fixture: %s. No notification was sent after the event.\n",
Note:
See TracChangeset
for help on using the changeset viewer.