Changeset 52564 in vbox
- Timestamp:
- Sep 2, 2014 8:53:51 AM (10 years ago)
- Location:
- trunk/src/VBox/Additions/x11/VBoxClient
- Files:
-
- 5 edited
-
seamless-x11.cpp (modified) (3 diffs)
-
seamless-x11.h (modified) (5 diffs)
-
seamless.cpp (modified) (3 diffs)
-
seamless.h (modified) (2 diffs)
-
testcase/tstSeamlessX11-auto.cpp (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/x11/VBoxClient/seamless-x11.cpp
r50375 r52564 71 71 * @returns true if it can handle seamless, false otherwise 72 72 */ 73 int SeamlessX11::init( SeamlessHostProxy *pHost)73 int SeamlessX11::init(PFNSENDREGIONUPDATE pHostCallback) 74 74 { 75 75 int rc = VINF_SUCCESS; 76 76 77 77 LogRelFlowFunc(("\n")); 78 if ( 0 != mHost) /* Assertion */78 if (mHostCallback != NULL) /* 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 mHost = pHost;88 mHostCallback = pHostCallback; 89 89 LogRelFlowFunc(("returning %Rrc\n", rc)); 90 90 return rc; … … 299 299 { 300 300 updateRects(); 301 mHost ->sendRegionUpdate(mpRects, mcRects);301 mHostCallback(mpRects, mcRects); 302 302 } 303 303 mChanged = false; -
trunk/src/VBox/Additions/x11/VBoxClient/seamless-x11.h
r50376 r52564 34 34 35 35 /** 36 * Small virtual class which provides the interface for notifying the host of 37 * changes to the X11 window configuration, mainly split out from 38 * @a VBoxGuestSeamlessHost to simplify the unit test. 39 */ 40 class SeamlessHostProxy 41 { 42 public: 43 virtual void sendRegionUpdate(RTRECT *pRects, size_t cRects) = 0; 44 virtual ~SeamlessHostProxy() {} 45 }; 36 * Callback which provides the interface for notifying the host of changes to 37 * the X11 window configuration, mainly split out from @a VBoxGuestSeamlessHost 38 * to simplify the unit test. 39 */ 40 typedef void FNSENDREGIONUPDATE(RTRECT *pRects, size_t cRects); 41 typedef FNSENDREGIONUPDATE *PFNSENDREGIONUPDATE; 46 42 47 43 /** Structure containing information about a guest window's position and visible area. … … 164 160 165 161 // Private member variables 166 /** Pointer to the host c lass. */167 SeamlessHostProxy *mHost;162 /** Pointer to the host callback. */ 163 PFNSENDREGIONUPDATE mHostCallback; 168 164 /** Our connection to the X11 display we are running on. */ 169 165 Display *mDisplay; … … 205 201 /** 206 202 * Initialise the guest and ensure that it is capable of handling seamless mode 207 * @param pHost Host interface c lassto notify of window configuration203 * @param pHost Host interface callback to notify of window configuration 208 204 * changes. 209 205 * 210 206 * @returns iprt status code 211 207 */ 212 int init( SeamlessHostProxy *pHost);208 int init(PFNSENDREGIONUPDATE pHostCallback); 213 209 214 210 /** … … 217 213 void uninit(void) 218 214 { 219 if (mHost )215 if (mHostCallback) 220 216 stop(); 221 mHost = NULL;217 mHostCallback = NULL; 222 218 if (mDisplay) 223 219 XCloseDisplay(mDisplay); … … 251 247 252 248 SeamlessX11(void) 253 : mHost (0), mDisplay(NULL), mpRects(NULL), mcRects(0),249 : mHostCallback(NULL), mDisplay(NULL), mpRects(NULL), mcRects(0), 254 250 mSupportsShape(false), mEnabled(false), mChanged(false) {} 255 251 -
trunk/src/VBox/Additions/x11/VBoxClient/seamless.cpp
r52562 r52564 50 50 51 51 /** 52 * Update the set of visible rectangles in the host. 53 */ 54 static void sendRegionUpdate(RTRECT *pRects, size_t cRects) 55 { 56 LogRelFlowFunc(("\n")); 57 if (cRects && !pRects) /* Assertion */ 58 { 59 LogRelFunc(("ERROR: called with null pointer!\n")); 60 return; 61 } 62 VbglR3SeamlessSendRects(cRects, pRects); 63 LogRelFlowFunc(("returning\n")); 64 } 65 66 /** 52 67 * initialise the service. 53 68 */ … … 60 75 do { 61 76 pcszStage = "Connecting to the X server"; 62 rc = mX11Monitor.init( this);77 rc = mX11Monitor.init(sendRegionUpdate); 63 78 if (RT_FAILURE(rc)) 64 79 break; … … 175 190 176 191 /** 177 * Update the set of visible rectangles in the host.178 */179 void SeamlessMain::sendRegionUpdate(RTRECT *pRects, size_t cRects)180 {181 LogRelFlowFunc(("\n"));182 if (cRects && !pRects) /* Assertion */183 {184 LogRelThisFunc(("ERROR: called with null pointer!\n"));185 return;186 }187 VbglR3SeamlessSendRects(cRects, pRects);188 LogRelFlowFunc(("returning\n"));189 }190 191 192 /**193 192 * The actual X11 window configuration change monitor thread function. 194 193 */ -
trunk/src/VBox/Additions/x11/VBoxClient/seamless.h
r50495 r52564 29 29 * Interface to the host 30 30 */ 31 class SeamlessMain : public SeamlessHostProxy31 class SeamlessMain 32 32 { 33 33 private: … … 109 109 int resume(); 110 110 111 /**112 * Update the set of visible rectangles in the host.113 */114 virtual void sendRegionUpdate(RTRECT *pRects, size_t cRects);115 116 111 /** Run a few tests to be sure everything is working as intended. */ 117 112 int selfTest(); -
trunk/src/VBox/Additions/x11/VBoxClient/testcase/tstSeamlessX11-auto.cpp
r50346 r52564 297 297 } 298 298 299 /** Dummy host class */ 300 class testHost: public SeamlessHostProxy 301 { 302 bool mfNotified; 303 public: 304 testHost() : mfNotified(false) {} 305 virtual void sendRegionUpdate(RTRECT *pRects, size_t cRects) 306 { 307 mfNotified = true; 308 } 309 virtual ~testHost() {} 310 bool isNotified(void) { return mfNotified; } 311 }; 299 /** Global "received a notification" flag. */ 300 static bool g_fNotified = false; 301 302 /** Dummy host call-back. */ 303 static void sendRegionUpdate(RTRECT *pRects, size_t cRects) 304 { 305 g_fNotified = true; 306 } 307 308 static bool gotNotification(void) 309 { 310 if (!g_fNotified) 311 return false; 312 g_fNotified = false; 313 return true; 314 } 312 315 313 316 /***************************** … … 372 375 /** The onscreen positions of those windows. */ 373 376 RTRECT *paReportedRects; 377 /** Do we expect notification after the event? */ 378 bool fExpectNotification; 374 379 }; 375 380 … … 419 424 20, 420 425 RT_ELEMENTS(g_aRects1), 421 g_aRects1 426 g_aRects1, 427 true 422 428 }; 423 429 … … 454 460 20, 455 461 RT_ELEMENTS(g_aRects1), 456 g_aRects1 462 g_aRects1, 463 true 457 464 }; 458 465 … … 484 491 20, 485 492 RT_ELEMENTS(g_aRects1), 486 g_aRects1 493 g_aRects1, 494 true 487 495 }; 488 496 … … 514 522 20, 515 523 0, 516 NULL 524 NULL, 525 true 517 526 }; 518 527 … … 545 554 21, 546 555 RT_ELEMENTS(g_aRects2), 547 g_aRects2 556 g_aRects2, 557 false 548 558 }; 549 559 … … 574 584 20, 575 585 RT_ELEMENTS(g_aRects1), 576 g_aRects1 586 g_aRects1, 587 true 577 588 }; 578 589 … … 599 610 { 600 611 SeamlessX11 subject; 601 testHost host;602 612 unsigned cErrs = 0; 603 613 604 subject.init( &host);614 subject.init(sendRegionUpdate); 605 615 smlsSetWindowAttributes(pFixture->paAttribsBefore, 606 616 pFixture->pahWindowsBefore, … … 619 629 pFixture->paShapeRectsAfter); 620 630 smlsSetNextEvent(pFixture->x11EventType, pFixture->hEventWindow); 621 if ( host.isNotified()) /* Initial window tree rebuild */631 if (gotNotification()) /* Initial window tree rebuild */ 622 632 { 623 633 RTPrintf("%s: fixture: %s. Notification was set before the first event!!!\n", … … 626 636 } 627 637 subject.nextConfigurationEvent(); 628 if (! host.isNotified())638 if (!gotNotification()) 629 639 { 630 640 RTPrintf("%s: fixture: %s. No notification was sent for the initial window tree rebuild.\n", … … 634 644 smlsSetNextEvent(0, 0); 635 645 subject.nextConfigurationEvent(); 636 if ( !host.isNotified())646 if (pFixture->fExpectNotification && !gotNotification()) 637 647 { 638 648 RTPrintf("%s: fixture: %s. No notification was sent after the event.\n",
Note:
See TracChangeset
for help on using the changeset viewer.

