dlls/winemac.drv/window.c
/***********************************************************************
 *              sync_window_region
 *
 * Update the window region.
 */
sync_window_region
Update the window region.
sync_window_region Update the window region .
static void sync_window_region(struct macdrv_win_data *data, HRGN win_region)
{
    HRGN hrgn = win_region;
    RGNDATA *region_data;
    const CGRect* rects;
    int count;
    if (!data->cocoa_window) return;
    data->shaped = FALSE;
    if (hrgn == (HRGN)1)  
    {
        if (!(hrgn = CreateRectRgn(0, 0, 0, 0))) return;
        if (GetWindowRgn(data->hwnd, hrgn) == ERROR)
        {
            DeleteObject(hrgn);
            hrgn = 0;
        }
    }
    if (hrgn && GetWindowLongW(data->hwnd, GWL_EXSTYLE) & WS_EX_LAYOUTRTL)
        MirrorRgn(data->hwnd, hrgn);
    if (hrgn)
    {
        OffsetRgn(hrgn, data->window_rect.left - data->whole_rect.left,
                  data->window_rect.top - data->whole_rect.top);
    }
    region_data = get_region_data(hrgn, 0);
    if (region_data)
    {
        rects = (CGRect*)region_data->Buffer;
        count = region_data->rdh.nCount;
        if (count == 1 && CGRectContainsRect(rects[0], cgrect_from_rect(data->whole_rect)))
        {
            TRACE("optimizing for simple region that contains Cocoa content rect\n");
            rects = NULL;
            count = 0;
        }
    }
    else
    {
        rects = NULL;
        count = 0;
    }
    TRACE("win %p/%p win_region %p rects %p count %d\n", data->hwnd, data->cocoa_window, win_region, rects, count);
    macdrv_set_window_shape(data->cocoa_window, rects, count);
    HeapFree(GetProcessHeap(), 0, region_data);
    data->shaped = (region_data != NULL);
    if (hrgn && hrgn != win_region) DeleteObject(hrgn);
}
static void sync_window_region ( struct macdrv_win_data * data , HRGN win_region ) { HRGN hrgn = win_region ; RGNDATA * region_data ; const CGRect * rects ; int count ; if ( ! data -> cocoa_window ) return ; data -> shaped = FALSE ; if ( hrgn == ( HRGN ) 1 ) { if ( ! ( hrgn = CreateRectRgn ( 0 , 0 , 0 , 0 ) ) ) return ; if ( GetWindowRgn ( data -> hwnd , hrgn ) == ERROR ) { DeleteObject ( hrgn ) ; hrgn = 0 ; } } if ( hrgn && GetWindowLongW ( data -> hwnd , GWL_EXSTYLE ) & WS_EX_LAYOUTRTL ) MirrorRgn ( data -> hwnd , hrgn ) ; if ( hrgn ) { OffsetRgn ( hrgn , data -> window_rect . left - data -> whole_rect . left , data -> window_rect . top - data -> whole_rect . top ) ; } region_data = get_region_data ( hrgn , 0 ) ; if ( region_data ) { rects = ( CGRect * ) region_data -> Buffer ; count = region_data -> rdh . nCount ; if ( count == 1 && CGRectContainsRect ( rects [ 0 ] , cgrect_from_rect ( data -> whole_rect ) ) ) { TRACE ( " \n " ) ; rects = NULL ; count = 0 ; } } else { rects = NULL ; count = 0 ; } TRACE ( " \n " , data -> hwnd , data -> cocoa_window , win_region , rects , count ) ; macdrv_set_window_shape ( data -> cocoa_window , rects , count ) ; HeapFree ( GetProcessHeap ( ) , 0 , region_data ) ; data -> shaped = ( region_data != NULL ) ; if ( hrgn && hrgn != win_region ) DeleteObject ( hrgn ) ; }
sync_window_region
 Update the window region.
sync_window_region Update the window region .
/* hack: win_region == 1 means retrieve region from server */ /* Special case optimization.  If the region entirely encloses the Cocoa
           window, it's the same as there being no region.  It's potentially
           hard/slow to test this for arbitrary regions, so we just check for
           very simple regions. */