Changeset 36806 in vbox
- Timestamp:
- Apr 21, 2011 10:41:21 PM (14 years ago)
- Location:
- trunk/src/VBox/Additions/x11/VBoxClient
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/x11/VBoxClient/seamless-guest.h
r28800 r36806 19 19 #ifndef __Additions_client_seamless_guest_h 20 20 # define __Additions_client_seamless_guest_h 21 22 #include <memory> /* for auto_ptr */23 #include <vector> /* for vector */24 21 25 22 #include <iprt/types.h> /* for RTRECT */ … … 45 42 INCAPABLE 46 43 }; 47 48 /**49 * Initialise the guest and ensure that it is capable of handling seamless mode50 *51 * @param pObserver An observer object to which to report changes in state and events52 * by calling its notify() method. A state change to CAPABLE also53 * signals new seamless data.54 * @returns iprt status code55 */56 int init(VBoxGuestSeamlessObserver *pObserver);57 58 /**59 * Shutdown seamless event monitoring.60 */61 void uninit(void);62 63 /**64 * Initialise seamless event reporting in the guest.65 *66 * @returns IPRT status code67 */68 int start(void);69 /** Stop reporting seamless events. */70 void stop(void);71 /** Get the current state of the guest (capable or incapable of seamless mode). */72 // meEvent getState(void);73 /** Get the current list of visible rectangles. */74 std::auto_ptr<std::vector<RTRECT> > getRects(void);75 /** Process next event in the guest event queue - called by the event thread. */76 void nextEvent(void);77 /** Wake up the event thread if it is waiting for an event so that it can exit. */78 bool interruptEvent(void);79 44 }; 80 45 -
trunk/src/VBox/Additions/x11/VBoxClient/seamless-host.cpp
r28800 r36806 134 134 * Update the set of visible rectangles in the host. 135 135 */ 136 void VBoxGuestSeamlessHost::updateRects( std::auto_ptr<std::vector<RTRECT> > pRects)136 void VBoxGuestSeamlessHost::updateRects(RTRECT *pRects, size_t cRects) 137 137 { 138 138 LogRelFlowFunc(("\n")); 139 if ( 0 == pRects.get()) /* Assertion */139 if (!pRects) /* Assertion */ 140 140 { 141 141 LogRelThisFunc(("ERROR: called with null pointer!\n")); 142 142 return; 143 143 } 144 VbglR3SeamlessSendRects( pRects.get()->size(), pRects.get()->empty() ? NULL : &pRects.get()->front());144 VbglR3SeamlessSendRects(cRects, pRects); 145 145 LogRelFlowFunc(("returning\n")); 146 146 } -
trunk/src/VBox/Additions/x11/VBoxClient/seamless-host.h
r28800 r36806 18 18 #ifndef __Additions_client_seamless_host_h 19 19 # define __Additions_client_seamless_host_h 20 21 #include <memory> /* for auto_ptr */22 #include <vector> /* for vector */23 20 24 21 #include <VBox/log.h> … … 151 148 * Update the set of visible rectangles in the host. 152 149 */ 153 void updateRects( std::auto_ptr<std::vector<RTRECT> > pRects);150 void updateRects(RTRECT *pRects, size_t cRects); 154 151 155 152 VBoxGuestSeamlessHost(void) : mThreadFunction(this), -
trunk/src/VBox/Additions/x11/VBoxClient/seamless-x11.cpp
r36804 r36806 29 29 30 30 #include <limits.h> 31 32 #include "vector.h" 31 33 32 34 #ifdef TESTCASE … … 297 299 here because we want to send all such information from a single thread. */ 298 300 if (mChanged) 301 { 302 updateRects(); 299 303 mObserver->notify(); 304 } 300 305 mChanged = false; 301 306 XNextEvent(mDisplay, &event); … … 418 423 } 419 424 425 /** 426 * Gets the list of visible rectangles 427 */ 428 RTRECT *VBoxGuestSeamlessX11::getRects(void) 429 { 430 return mpRects; 431 } 432 433 /** 434 * Gets the number of rectangles in the visible rectangle list 435 */ 436 size_t VBoxGuestSeamlessX11::getRectCount(void) 437 { 438 return mcRects; 439 } 440 441 RTVEC_DECL(RectList, RTRECT) 442 420 443 DECLCALLBACK(int) getRectsCallback(VBoxGuestWinInfo *pInfo, 421 st d::vector<RTRECT>*pRects)444 struct RectList *pRects) 422 445 { 423 446 if (pInfo->mhasShape) … … 425 448 for (int i = 0; i < pInfo->mcRects; ++i) 426 449 { 427 RTRECT rect; 428 rect.xLeft = pInfo->mX 429 + pInfo->mpRects[i].x; 430 rect.yBottom = pInfo->mY 431 + pInfo->mpRects[i].y 432 + pInfo->mpRects[i].height; 433 rect.xRight = pInfo->mX 434 + pInfo->mpRects[i].x 435 + pInfo->mpRects[i].width; 436 rect.yTop = pInfo->mY 437 + pInfo->mpRects[i].y; 438 pRects->push_back(rect); 450 RTRECT *pRect; 451 452 pRect = RectListPushBack(pRects); 453 if (!pRect) 454 return VERR_NO_MEMORY; 455 pRect->xLeft = pInfo->mX 456 + pInfo->mpRects[i].x; 457 pRect->yBottom = pInfo->mY 458 + pInfo->mpRects[i].y 459 + pInfo->mpRects[i].height; 460 pRect->xRight = pInfo->mX 461 + pInfo->mpRects[i].x 462 + pInfo->mpRects[i].width; 463 pRect->yTop = pInfo->mY 464 + pInfo->mpRects[i].y; 439 465 } 440 466 } 441 467 else 442 468 { 443 RTRECT rect; 444 rect.xLeft = pInfo->mX; 445 rect.yBottom = pInfo->mY 446 + pInfo->mHeight; 447 rect.xRight = pInfo->mX 448 + pInfo->mWidth; 449 rect.yTop = pInfo->mY; 450 pRects->push_back(rect); 469 RTRECT *pRect; 470 471 pRect = RectListPushBack(pRects); 472 if (!pRect) 473 return VERR_NO_MEMORY; 474 pRect->xLeft = pInfo->mX; 475 pRect->yBottom = pInfo->mY 476 + pInfo->mHeight; 477 pRect->xRight = pInfo->mX 478 + pInfo->mWidth; 479 pRect->yTop = pInfo->mY; 451 480 } 452 481 return VINF_SUCCESS; … … 454 483 455 484 /** 456 * Sends an updated list of visible rectangles to the host457 */ 458 std::auto_ptr<std::vector<RTRECT> > VBoxGuestSeamlessX11::getRects(void)485 * Updates the list of seamless rectangles 486 */ 487 int VBoxGuestSeamlessX11::updateRects(void) 459 488 { 460 489 LogRelFlowFunc(("\n")); 461 490 unsigned cRects = 0; 462 st d::auto_ptr<std::vector<RTRECT> > apRects(new std::vector<RTRECT>);491 struct RectList rects = RTVEC_INITIALIZER; 463 492 464 493 if (0 != mcRects) 465 494 { 466 apRects.get()->reserve(mcRects * 2); 495 int rc = RectListReserve(&rects, mcRects * 2); 496 if (RT_FAILURE(rc)) 497 return rc; 467 498 } 468 499 mGuestWindows.doWithAll((PVBOXGUESTWINCALLBACK)getRectsCallback, 469 apRects.get()); 470 mcRects = apRects->size(); 471 LogRelFlowFunc(("returning\n")); 472 return apRects; 500 &rects); 501 if (mpRects) 502 RTMemFree(mpRects); 503 mcRects = RectListSize(&rects); 504 mpRects = RectListDetach(&rects); 505 LogRelFlowFunc(("returning\n")); 506 return VINF_SUCCESS; 473 507 } 474 508 -
trunk/src/VBox/Additions/x11/VBoxClient/seamless-x11.h
r36803 r36806 28 28 #include <X11/Xutil.h> 29 29 #include <X11/extensions/shape.h> 30 31 #include <vector>32 30 33 31 #define WM_TYPE_PROP "_NET_WM_WINDOW_TYPE" … … 164 162 /** Class to keep track of visible guest windows. */ 165 163 VBoxGuestWindowList mGuestWindows; 166 /** Keeps track of the total number of rectangles needed for the visible area of all167 guest windows on the last call to getRects. Used for pre-allocating space in168 the vector of rectangles passed to the host. */164 /** The current set of seamless rectangles. */ 165 RTRECT *mpRects; 166 /** The current number of seamless rectangles. */ 169 167 int mcRects; 170 168 /** Do we support the X shaped window extension? */ … … 194 192 void freeWindowTree(void); 195 193 void updateHostSeamlessInfo(void); 194 int updateRects(void); 196 195 197 196 public: … … 225 224 void stop(void); 226 225 /** Get the current list of visible rectangles. */ 227 std::auto_ptr<std::vector<RTRECT> > getRects(void); 226 RTRECT *getRects(void); 227 /** Get the number of visible rectangles in the current list */ 228 size_t getRectCount(void); 228 229 229 230 /** Process next event in the guest event queue - called by the event thread. */ … … 240 241 241 242 VBoxGuestSeamlessX11(void) 242 : mObserver(0), mDisplay(NULL), m cRects(0), mSupportsShape(false),243 m Enabled(false), mChanged(false) {}243 : mObserver(0), mDisplay(NULL), mpRects(NULL), mcRects(0), 244 mSupportsShape(false), mEnabled(false), mChanged(false) {} 244 245 245 246 ~VBoxGuestSeamlessX11() -
trunk/src/VBox/Additions/x11/VBoxClient/seamless.h
r28800 r36806 124 124 virtual void notify(void) 125 125 { 126 mHost->updateRects(mGuest->getRects() );126 mHost->updateRects(mGuest->getRects(), mGuest->getRectCount()); 127 127 } 128 128 };
Note:
See TracChangeset
for help on using the changeset viewer.