VirtualBox

Changeset 18565 in vbox for trunk/src/VBox/HostServices


Ignore:
Timestamp:
Mar 31, 2009 12:24:11 PM (16 years ago)
Author:
vboxsync
Message:

crOpenGL-OSX: initial fix for compiz enabled linux guest

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu_agl.c

    r17022 r18565  
    2929{
    3030    /* Event classes */
    31     kEventClassVBox        = 'vbox',
     31    kEventClassVBox         = 'vbox',
    3232    /* Event kinds */
    33     kEventVBoxShowWindow   = 'swin',
    34     kEventVBoxMoveWindow   = 'mwin',
    35     kEventVBoxResizeWindow = 'rwin',
    36     kEventVBoxUpdateDock   = 'udck'
     33    kEventVBoxShowWindow    = 'swin',
     34    kEventVBoxHideWindow    = 'hwin',
     35    kEventVBoxMoveWindow    = 'mwin',
     36    kEventVBoxResizeWindow  = 'rwin',
     37    kEventVBoxDisposeWindow = 'dwin',
     38    kEventVBoxUpdateDock    = 'udck'
    3739};
    3840
     
    5052
    5153/* Debug macros */
     54#ifdef DEBUG_poetzsch
     55#define DEBUG_MSG_POETZSCH(text) \
     56    printf text
     57#endif
     58
    5259#define DEBUG_MSG_RESULT(result, text) \
    5360        crDebug(text" (%d; %s:%d)", (int)(result), __FILE__, __LINE__)
     
    268275        return render_spu.ws.aglSetCurrentContext( NULL );
    269276
     277    DEBUG_MSG_POETZSCH (("WindowAttachContext %d\n", wi->id));
     278
    270279    /* Flush old context first */
    271280    if (context->currentWindow->window != window)
     
    275284    if (wi->bufferName == -1)
    276285    {
     286        DEBUG_MSG_POETZSCH (("WindowAttachContext: create context %d\n", wi->id));
    277287        /* Use the same visual bits as those in the context structure */
    278288        AGLPixelFormat pix;
     
    357367
    358368    if(!window->nativeWindow)
    359         DisposeWindow(window->window);
     369    {
     370        EventRef evt;
     371        OSStatus status = CreateEvent(NULL, kEventClassVBox, kEventVBoxDisposeWindow, 0, kEventAttributeNone, &evt);
     372        CHECK_CARBON_RC_RETURN_VOID (status, "Render SPU: CreateEvent Failed");
     373        status = SetEventParameter(evt, kEventParamWindowRef, typeWindowRef, sizeof (window->window), &window->window);
     374        CHECK_CARBON_RC_RETURN_VOID (status, "Render SPU: SetEventParameter Failed");
     375        status = SendEventToEventTarget (evt, GetWindowEventTarget (HIViewGetWindow ((HIViewRef)render_spu_parent_window_id)));
     376        CHECK_CARBON_RC_RETURN_VOID (status, "Render SPU: PostEventToQueue Failed");
     377    }
    360378
    361379    /* Delete the dummy context */
     
    390408    status = SetEventParameter(evt, kEventParamDimensions, typeHISize, sizeof (s), &s);
    391409    CHECK_CARBON_RC_RETURN_VOID (status, "Render SPU: SetEventParameter Failed");
    392     status = PostEventToQueue(GetMainEventQueue(), evt, kEventPriorityStandard);
     410    status = SendEventToEventTarget (evt, GetWindowEventTarget (HIViewGetWindow ((HIViewRef)render_spu_parent_window_id)));
    393411    CHECK_CARBON_RC_RETURN_VOID (status, "Render SPU: PostEventToQueue Failed");
    394412
     
    399417        context->context)
    400418    {
     419        DEBUG_MSG_POETZSCH (("Size %d context %x visible %d\n", window->id, context->context, IsWindowVisible (window->window)));
    401420        result = render_spu.ws.aglUpdateContext(context->context);
    402421        CHECK_AGL_RC (result, "Render SPU: UpdateContext Failed");
     422        render_spu.self.Flush();
    403423    }
    404424    /* save the new size */
     
    464484    status = SetEventParameter(evt, kEventParamOrigin, typeHIPoint, sizeof (p), &p);
    465485    CHECK_CARBON_RC_RETURN_VOID (status, "Render SPU: SetEventParameter Failed");
    466     status = PostEventToQueue(GetMainEventQueue(), evt, kEventPriorityStandard);
     486    status = SendEventToEventTarget (evt, GetWindowEventTarget (HIViewGetWindow ((HIViewRef)render_spu_parent_window_id)));
    467487    CHECK_CARBON_RC_RETURN_VOID (status, "Render SPU: PostEventToQueue Failed");
    468488
     
    473493        context->context)
    474494    {
     495        DEBUG_MSG_POETZSCH (("Position %d context %x visible %d\n", window->id, context->context, IsWindowVisible (window->window)));
    475496        result = render_spu.ws.aglUpdateContext(context->context);
    476497        CHECK_AGL_RC (result, "Render SPU: UpdateContext Failed");
     498        render_spu.self.Flush();
    477499    }
    478500}
     
    500522        status = SetEventParameter(evt, kEventParamWindowRef, typeWindowRef, sizeof (window->window), &window->window);
    501523        CHECK_CARBON_RC_RETURN_VOID (status, "Render SPU: SetEventParameter Failed");
    502         status = PostEventToQueue(GetMainEventQueue(), evt, kEventPriorityStandard);
     524        status = SendEventToEventTarget (evt, GetWindowEventTarget (HIViewGetWindow ((HIViewRef)render_spu_parent_window_id)));
    503525        CHECK_CARBON_RC_RETURN_VOID (status, "Render SPU: PostEventToQueue Failed");
    504526    }
    505527    else
    506         HideWindow(window->window);
     528    {
     529        EventRef evt;
     530        OSStatus status = CreateEvent(NULL, kEventClassVBox, kEventVBoxHideWindow, 0, kEventAttributeNone, &evt);
     531        CHECK_CARBON_RC_RETURN_VOID (status, "Render SPU: CreateEvent Failed");
     532        status = SetEventParameter(evt, kEventParamWindowRef, typeWindowRef, sizeof (window->window), &window->window);
     533        CHECK_CARBON_RC_RETURN_VOID (status, "Render SPU: SetEventParameter Failed");
     534        status = SendEventToEventTarget (evt, GetWindowEventTarget (HIViewGetWindow ((HIViewRef)render_spu_parent_window_id)));
     535        CHECK_CARBON_RC_RETURN_VOID (status, "Render SPU: PostEventToQueue Failed");
     536    }
    507537
    508538    /* Update the context */
     
    512542        context->context)
    513543    {
     544        DEBUG_MSG_POETZSCH (("Showed %d context %x visible %d\n", window->id, context->context, IsWindowVisible (window->window)));
    514545        result = render_spu.ws.aglUpdateContext(context->context);
    515546        CHECK_AGL_RC (result, "Render SPU: UpdateContext Failed");
     547        render_spu.self.Flush();
    516548    }
    517549
     
    524556{
    525557    Boolean result;
     558    DEBUG_MSG_POETZSCH (("makecurrent %d: \n", window->id));
    526559
    527560    CRASSERT(render_spu.ws.aglSetCurrentContext);
    528 /*  crDebug( "renderspu_SystemMakeCurrent( %x, %i, %x )", window, nativeWindow, context );*/
     561    crDebug( "renderspu_SystemMakeCurrent( %x, %i, %x )", window, nativeWindow, context );
    529562
    530563    if(window && context)
     
    578611        crError("Render SPU: SwapBuffers got a null context from the window");
    579612
     613    DEBUG_MSG_POETZSCH (("Swapped %d context %x visible: %d\n", window->id, context->context, IsWindowVisible (window->window)));
    580614    render_spu.ws.aglSwapBuffers(context->context);
    581 
    582615
    583616    /* This method seems called very often. To prevent the dock using all free
     
    650683
    651684    if(window->window && IsValidWindowPtr(window->window))
    652         /* Destroy the old one */
    653         DisposeWindow(window->window);
     685    {
     686        EventRef evt;
     687        status = CreateEvent(NULL, kEventClassVBox, kEventVBoxDisposeWindow, 0, kEventAttributeNone, &evt);
     688        CHECK_CARBON_RC_RETURN (status, "Render SPU: CreateEvent Failed", false);
     689        status = SetEventParameter(evt, kEventParamWindowRef, typeWindowRef, sizeof (window->window), &window->window);
     690        CHECK_CARBON_RC_RETURN (status, "Render SPU: SetEventParameter Failed", false);
     691        status = SendEventToEventTarget (evt, GetWindowEventTarget (HIViewGetWindow ((HIViewRef)render_spu_parent_window_id)));
     692        CHECK_CARBON_RC_RETURN (status, "Render SPU: PostEventToQueue Failed", false);
     693    }
    654694
    655695    windowRect.left = window->x;
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