Commit 9d45cfde authored by Alexandre Julliard's avatar Alexandre Julliard

winex11: Support setting the window region on windows belonging to other threads.

parent 370368aa
...@@ -336,12 +336,24 @@ static void sync_window_style( Display *display, struct x11drv_win_data *data ) ...@@ -336,12 +336,24 @@ static void sync_window_style( Display *display, struct x11drv_win_data *data )
* *
* Update the X11 window region. * Update the X11 window region.
*/ */
static void sync_window_region( Display *display, struct x11drv_win_data *data, HRGN hrgn ) static void sync_window_region( Display *display, struct x11drv_win_data *data, HRGN win_region )
{ {
#ifdef HAVE_LIBXSHAPE #ifdef HAVE_LIBXSHAPE
HRGN hrgn = win_region;
if (!data->whole_window) return; if (!data->whole_window) return;
data->shaped = FALSE; data->shaped = FALSE;
if (hrgn == (HRGN)1) /* hack: win_region == 1 means retrieve region from server */
{
if (!(hrgn = CreateRectRgn( 0, 0, 0, 0 ))) return;
if (GetWindowRgn( data->hwnd, hrgn ) == ERROR)
{
DeleteObject( hrgn );
hrgn = 0;
}
}
if (!hrgn) if (!hrgn)
{ {
wine_tsx11_lock(); wine_tsx11_lock();
...@@ -364,6 +376,7 @@ static void sync_window_region( Display *display, struct x11drv_win_data *data, ...@@ -364,6 +376,7 @@ static void sync_window_region( Display *display, struct x11drv_win_data *data,
data->shaped = TRUE; data->shaped = TRUE;
} }
} }
if (hrgn && hrgn != win_region) DeleteObject( hrgn );
#endif /* HAVE_LIBXSHAPE */ #endif /* HAVE_LIBXSHAPE */
} }
...@@ -1327,7 +1340,6 @@ static Window create_whole_window( Display *display, struct x11drv_win_data *dat ...@@ -1327,7 +1340,6 @@ static Window create_whole_window( Display *display, struct x11drv_win_data *dat
int cx, cy, mask; int cx, cy, mask;
XSetWindowAttributes attr; XSetWindowAttributes attr;
WCHAR text[1024]; WCHAR text[1024];
HRGN hrgn;
if (!(cx = data->window_rect.right - data->window_rect.left)) cx = 1; if (!(cx = data->window_rect.right - data->window_rect.left)) cx = 1;
if (!(cy = data->window_rect.bottom - data->window_rect.top)) cy = 1; if (!(cy = data->window_rect.bottom - data->window_rect.top)) cy = 1;
...@@ -1375,11 +1387,8 @@ static Window create_whole_window( Display *display, struct x11drv_win_data *dat ...@@ -1375,11 +1387,8 @@ static Window create_whole_window( Display *display, struct x11drv_win_data *dat
sync_window_text( display, data->whole_window, text ); sync_window_text( display, data->whole_window, text );
/* set the window region */ /* set the window region */
if ((hrgn = CreateRectRgn( 0, 0, 0, 0 ))) sync_window_region( display, data, (HRGN)1 );
{
if (GetWindowRgn( data->hwnd, hrgn ) != ERROR) sync_window_region( display, data, hrgn );
DeleteObject( hrgn );
}
wine_tsx11_lock(); wine_tsx11_lock();
XFlush( display ); /* make sure the window exists before we start painting to it */ XFlush( display ); /* make sure the window exists before we start painting to it */
wine_tsx11_unlock(); wine_tsx11_unlock();
...@@ -2142,13 +2151,10 @@ int X11DRV_SetWindowRgn( HWND hwnd, HRGN hrgn, BOOL redraw ) ...@@ -2142,13 +2151,10 @@ int X11DRV_SetWindowRgn( HWND hwnd, HRGN hrgn, BOOL redraw )
{ {
sync_window_region( thread_display(), data, hrgn ); sync_window_region( thread_display(), data, hrgn );
} }
else if (GetWindowThreadProcessId( hwnd, NULL ) != GetCurrentThreadId()) else if (X11DRV_get_whole_window( hwnd ))
{ {
FIXME( "not supported on other thread window %p\n", hwnd ); SendMessageW( hwnd, WM_X11DRV_SET_WIN_REGION, 0, 0 );
SetLastError( ERROR_INVALID_WINDOW_HANDLE );
return FALSE;
} }
return TRUE; return TRUE;
} }
...@@ -2158,6 +2164,8 @@ int X11DRV_SetWindowRgn( HWND hwnd, HRGN hrgn, BOOL redraw ) ...@@ -2158,6 +2164,8 @@ int X11DRV_SetWindowRgn( HWND hwnd, HRGN hrgn, BOOL redraw )
*/ */
LRESULT X11DRV_WindowMessage( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp ) LRESULT X11DRV_WindowMessage( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp )
{ {
struct x11drv_win_data *data;
switch(msg) switch(msg)
{ {
case WM_X11DRV_ACQUIRE_SELECTION: case WM_X11DRV_ACQUIRE_SELECTION:
...@@ -2166,6 +2174,9 @@ LRESULT X11DRV_WindowMessage( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp ) ...@@ -2166,6 +2174,9 @@ LRESULT X11DRV_WindowMessage( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp )
return SendMessageW( hwnd, WM_SYSCOMMAND, SC_CLOSE, 0 ); return SendMessageW( hwnd, WM_SYSCOMMAND, SC_CLOSE, 0 );
case WM_X11DRV_SET_WIN_FORMAT: case WM_X11DRV_SET_WIN_FORMAT:
return set_win_format( hwnd, (XID)wp ); return set_win_format( hwnd, (XID)wp );
case WM_X11DRV_SET_WIN_REGION:
if ((data = X11DRV_get_win_data( hwnd ))) sync_window_region( thread_display(), data, (HRGN)1 );
return 0;
case WM_X11DRV_RESIZE_DESKTOP: case WM_X11DRV_RESIZE_DESKTOP:
X11DRV_resize_desktop( LOWORD(lp), HIWORD(lp) ); X11DRV_resize_desktop( LOWORD(lp), HIWORD(lp) );
return 0; return 0;
......
...@@ -668,6 +668,7 @@ enum x11drv_window_messages ...@@ -668,6 +668,7 @@ enum x11drv_window_messages
WM_X11DRV_ACQUIRE_SELECTION = 0x80001000, WM_X11DRV_ACQUIRE_SELECTION = 0x80001000,
WM_X11DRV_DELETE_WINDOW, WM_X11DRV_DELETE_WINDOW,
WM_X11DRV_SET_WIN_FORMAT, WM_X11DRV_SET_WIN_FORMAT,
WM_X11DRV_SET_WIN_REGION,
WM_X11DRV_RESIZE_DESKTOP WM_X11DRV_RESIZE_DESKTOP
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment