VirtualBox

Changeset 8476

Show
Ignore:
Timestamp:
04/29/08 18:46:04 (7 months ago)
Author:
vboxsync
Message:

Additions/x11: do not respond to stale resize hints when VBoxClient is first started

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/VBox/Additions/x11/xclient/displaychange-x11.cpp

    r8155 r8476  
    6666 
    6767/** 
    68  * Display change request monitor thread function 
     68 * Display change request monitor thread function. 
     69 * Before entering the loop, we re-read the last request 
     70 * received, and if the first one received inside the 
     71 * loop is identical we ignore it, because it is probably 
     72 * stale. 
    6973 */ 
    7074int VBoxGuestDisplayChangeThreadX11::threadFunction(VBoxGuestThread *pThread) 
     
    7276    mThread = pThread; 
    7377    LogFlowThisFunc(("\n")); 
     78    uint32_t cx0 = 0, cy0 = 0, cBits0 = 0, iDisplay0 = 0; 
     79    int rc = VbglR3GetLastDisplayChangeRequest(&cx0, &cy0, &cBits0, &iDisplay0); 
    7480    while (!mThread->isStopping()) 
    7581    { 
    76         uint32_t cx, cy, cBits, iDisplay
     82        uint32_t cx = 0, cy = 0, cBits = 0, iDisplay = 0
    7783        int rc = VbglR3DisplayChangeWaitEvent(&cx, &cy, &cBits, &iDisplay); 
    78         /* If we are not stopping, sleep for a bit to avoid using up too 
    79             much CPU while retrying. */ 
    80         if (RT_FAILURE(rc) && !mThread->isStopping()) 
    81             mThread->yield(); 
    82         else 
    83             system("VBoxRandR"); 
     84        /* Ignore the request if it is stale */ 
     85        if ((cx != cx0) || (cy != cy0)) 
     86        { 
     87                /* If we are not stopping, sleep for a bit to avoid using up too 
     88                    much CPU while retrying. */ 
     89                if (RT_FAILURE(rc) && !mThread->isStopping()) 
     90                    mThread->yield(); 
     91                else 
     92                    system("VBoxRandR"); 
     93        } 
     94        /* We do not want to ignore any further requests. */ 
     95        cx0 = 0; 
     96        cy0 = 0; 
    8497    } 
    8598    LogFlowThisFunc(("returning VINF_SUCCESS\n")); 

© 2008 Sun Microsystems, Inc.
ContactPrivacy policy