VirtualBox

Changeset 21216 in vbox for trunk/src


Ignore:
Timestamp:
Jul 3, 2009 11:13:33 PM (16 years ago)
Author:
vboxsync
Message:

Additions/x11/VBoxClient: fix resizing of shaped windows

Location:
trunk/src/VBox/Additions/x11/VBoxClient
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/x11/VBoxClient/seamless-x11.cpp

    r21207 r21216  
    293293    {
    294294    case ConfigureNotify:
    295         doConfigureEvent(&event.xconfigure);
     295        doConfigureEvent(event.xconfigure.window);
    296296        break;
    297297    case MapNotify:
    298         doMapEvent(&event.xmap);
     298        doMapEvent(event.xmap.window);
    299299        break;
    300300    case VBoxShapeNotify:  /* This is defined wrong in my X11 header files! */
    301         doShapeEvent(reinterpret_cast<XShapeEvent *>(&event));
     301    /* the window member in xany is in the same place as in the shape event */
     302        doShapeEvent(event.xany.window);
    302303        break;
    303304    case UnmapNotify:
    304         doUnmapEvent(&event.xunmap);
     305        doUnmapEvent(event.xunmap.window);
    305306        break;
    306307    default:
     
    315316 * @param event the X11 event structure
    316317 */
    317 void VBoxGuestSeamlessX11::doConfigureEvent(const XConfigureEvent *event)
     318void VBoxGuestSeamlessX11::doConfigureEvent(Window hWin)
    318319{
    319320    LogFlowThisFunc(("\n"));
    320321    VBoxGuestWindowList::iterator iter;
    321322
    322     iter = mGuestWindows.find(event->window);
     323    iter = mGuestWindows.find(hWin);
    323324    if (iter != mGuestWindows.end())
    324325    {
    325326        XWindowAttributes winAttrib;
    326327
    327         if (XGetWindowAttributes(mDisplay, event->window, &winAttrib))
     328        if (XGetWindowAttributes(mDisplay, hWin, &winAttrib))
    328329        {
    329330            iter->second->mX = winAttrib.x;
     
    332333            iter->second->mHeight = winAttrib.height;
    333334        }
     335        if (iter->second->mhasShape)
     336        {
     337            VBoxGuestX11Pointer<XRectangle> rects;
     338            int cRects = 0, iOrdering;
     339
     340            rects = XShapeGetRectangles(mDisplay, hWin, ShapeBounding,
     341                                        &cRects, &iOrdering);
     342            iter->second->mcRects = cRects;
     343            iter->second->mapRects = rects;
     344        }
    334345    }
    335346    LogFlowThisFunc(("returning\n"));
     
    341352 * @param event the X11 event structure
    342353 */
    343 void VBoxGuestSeamlessX11::doMapEvent(const XMapEvent *event)
     354void VBoxGuestSeamlessX11::doMapEvent(Window hWin)
    344355{
    345356    LogFlowThisFunc(("\n"));
    346357    VBoxGuestWindowList::iterator iter;
    347358
    348     iter = mGuestWindows.find(event->window);
     359    iter = mGuestWindows.find(hWin);
    349360    if (mGuestWindows.end() == iter)
    350361    {
    351         addClientWindow(event->window);
     362        addClientWindow(hWin);
    352363    }
    353364    LogFlowThisFunc(("returning\n"));
     
    360371 * @param event the X11 event structure
    361372 */
    362 void VBoxGuestSeamlessX11::doShapeEvent(const XShapeEvent *event)
     373void VBoxGuestSeamlessX11::doShapeEvent(Window hWin)
    363374{
    364375    LogFlowThisFunc(("\n"));
    365376    VBoxGuestWindowList::iterator iter;
    366377
    367     iter = mGuestWindows.find(event->window);
     378    iter = mGuestWindows.find(hWin);
    368379    if (iter != mGuestWindows.end())
    369380    {
     
    371382        int cRects = 0, iOrdering;
    372383
    373         rects = XShapeGetRectangles(mDisplay, event->window, ShapeBounding, &cRects, &iOrdering);
     384        rects = XShapeGetRectangles(mDisplay, hWin, ShapeBounding, &cRects,
     385                                    &iOrdering);
    374386        iter->second->mhasShape = true;
    375387        iter->second->mcRects = cRects;
     
    384396 * @param event the X11 event structure
    385397 */
    386 void VBoxGuestSeamlessX11::doUnmapEvent(const XUnmapEvent *event)
     398void VBoxGuestSeamlessX11::doUnmapEvent(Window hWin)
    387399{
    388400    LogFlowThisFunc(("\n"));
    389401    VBoxGuestWindowList::iterator iter;
    390402
    391     iter = mGuestWindows.find(event->window);
     403    iter = mGuestWindows.find(hWin);
    392404    if (mGuestWindows.end() != iter)
    393405    {
  • trunk/src/VBox/Additions/x11/VBoxClient/seamless-x11.h

    r21207 r21216  
    349349    /* Methods to handle X11 events.  These are public so that the unit test
    350350     * can call them. */
    351     void doConfigureEvent(const XConfigureEvent *event);
    352     void doMapEvent(const XMapEvent *event);
    353     void doUnmapEvent(const XUnmapEvent *event);
    354     void doShapeEvent(const XShapeEvent *event);
     351    void doConfigureEvent(Window hWin);
     352    void doMapEvent(Window hWin);
     353    void doUnmapEvent(Window hWin);
     354    void doShapeEvent(Window hWin);
    355355
    356356    VBoxGuestSeamlessX11(void)
  • trunk/src/VBox/Additions/x11/VBoxClient/testcase/tstSeamlessX11-auto.cpp

    r21214 r21216  
    426426    RT_ELEMENTS(g_aRectangle1),
    427427    g_aRectangle1,
    428     MapNotify,
     428    ConfigureNotify,
    429429    20,
    430430    RT_ELEMENTS(g_aRects1),
     
    563563                           pFixture->cShapeRectsAfter,
    564564                           pFixture->paShapeRectsAfter);
    565     XEvent event = { 0 };
    566565    switch(pFixture->x11EventType)
    567566    {
    568567        case ConfigureNotify:
    569             event.xconfigure.window = pFixture->hEventWindow;
    570             subject.doConfigureEvent(&event.xconfigure);
     568            subject.doConfigureEvent(pFixture->hEventWindow);
    571569            break;
    572570        case MapNotify:
    573             event.xmap.window = pFixture->hEventWindow;
    574             subject.doMapEvent(&event.xmap);
     571            subject.doMapEvent(pFixture->hEventWindow);
    575572            break;
    576573        case UnmapNotify:
    577             event.xunmap.window = pFixture->hEventWindow;
    578             subject.doUnmapEvent(&event.xunmap);
     574            subject.doUnmapEvent(pFixture->hEventWindow);
    579575            break;
    580576        case VBoxShapeNotify:
    581             event.xany.window = pFixture->hEventWindow;
    582             subject.doShapeEvent((XShapeEvent *)&event);
     577            subject.doShapeEvent(pFixture->hEventWindow);
    583578            break;
    584579        default:
     
    637632                           "ConfigureNotify event (window moved)");
    638633    // Currently not working
    639     // cErrs += smlsDoFixture(&g_testResize,
    640     //                        "ConfigureNotify event (window resized)");
     634    cErrs += smlsDoFixture(&g_testResize,
     635                           "ConfigureNotify event (window resized)");
    641636    cErrs += smlsDoFixture(&g_testMap, "MapNotify event");
    642637    cErrs += smlsDoFixture(&g_testUnmap, "UnmapNotify event");
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette