winex11: Support using an ARGB visual as default visual.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2018-01-26 13:39:03 +01:00
parent dcf526b5b1
commit e40ff92e7c
3 changed files with 14 additions and 10 deletions

View file

@ -644,14 +644,14 @@ static void dock_systray_icon( Display *display, struct tray_icon *icon, Window
get_systray_visual_info( display, systray_window, &visual );
icon->layered = (visual.visualid != default_visual.visualid);
icon->layered = (visual.depth == 32);
icon->window = CreateWindowExW( icon->layered ? WS_EX_LAYERED : 0,
icon_classname, NULL, WS_CLIPSIBLINGS | WS_POPUP,
CW_USEDEFAULT, CW_USEDEFAULT, icon_cx, icon_cy,
NULL, NULL, NULL, icon );
if (!(data = get_win_data( icon->window ))) return;
if (icon->layered) set_window_visual( data, &visual );
if (icon->layered) set_window_visual( data, &visual, TRUE );
make_window_embedded( data );
window = data->whole_window;
release_win_data( data );

View file

@ -1557,16 +1557,19 @@ static void destroy_whole_window( struct x11drv_win_data *data, BOOL already_des
*
* Change the visual by destroying and recreating the X window if needed.
*/
void set_window_visual( struct x11drv_win_data *data, const XVisualInfo *vis )
void set_window_visual( struct x11drv_win_data *data, const XVisualInfo *vis, BOOL use_alpha )
{
Window client_window = data->client_window;
Window whole_window = data->whole_window;
if (!data->use_alpha == !use_alpha) return;
if (data->surface) window_surface_release( data->surface );
data->surface = NULL;
data->use_alpha = use_alpha;
if (data->vis.visualid == vis->visualid) return;
data->client_window = 0;
destroy_whole_window( data, client_window != 0 /* don't destroy whole_window until reparented */ );
if (data->surface) window_surface_release( data->surface );
data->surface = NULL;
data->vis = *vis;
create_whole_window( data );
if (!client_window) return;
@ -1613,7 +1616,7 @@ void CDECL X11DRV_SetWindowStyle( HWND hwnd, INT offset, STYLESTRUCT *style )
if (offset == GWL_EXSTYLE && (changed & WS_EX_LAYERED)) /* changing WS_EX_LAYERED resets attributes */
{
data->layered = FALSE;
set_window_visual( data, &default_visual );
set_window_visual( data, &default_visual, FALSE );
sync_window_opacity( data->display, data->whole_window, 0, 0, 0 );
if (data->surface) set_surface_color_key( data->surface, CLR_INVALID );
}
@ -2197,7 +2200,7 @@ void CDECL X11DRV_WindowPosChanging( HWND hwnd, HWND insert_after, UINT swp_flag
if (!data->whole_window && !data->embedded) goto done;
if (swp_flags & SWP_HIDEWINDOW) goto done;
if (data->vis.visualid != default_visual.visualid) goto done;
if (data->use_alpha) goto done;
if (!get_surface_rect( visible_rect, &surface_rect )) goto done;
if (*surface) window_surface_release( *surface );
@ -2502,7 +2505,7 @@ void CDECL X11DRV_SetLayeredWindowAttributes( HWND hwnd, COLORREF key, BYTE alph
if (data)
{
set_window_visual( data, &default_visual );
set_window_visual( data, &default_visual, FALSE );
if (data->whole_window)
sync_window_opacity( data->display, data->whole_window, key, alpha, flags );
@ -2558,7 +2561,7 @@ BOOL CDECL X11DRV_UpdateLayeredWindow( HWND hwnd, const UPDATELAYEREDWINDOWINFO
if (!(data = get_win_data( hwnd ))) return FALSE;
data->layered = TRUE;
if (!data->embedded && argb_visual.visualid) set_window_visual( data, &argb_visual );
if (!data->embedded && argb_visual.visualid) set_window_visual( data, &argb_visual, TRUE );
rect = *window_rect;
OffsetRect( &rect, -window_rect->left, -window_rect->top );

View file

@ -562,6 +562,7 @@ struct x11drv_win_data
BOOL embedded : 1; /* is window an XEMBED client? */
BOOL shaped : 1; /* is window using a custom region shape? */
BOOL layered : 1; /* is window layered and with valid attributes? */
BOOL use_alpha : 1; /* does window use an alpha channel? */
int wm_state; /* current value of the WM_STATE property */
DWORD net_wm_state; /* bit mask of active x11drv_net_wm_state values */
Window embedder; /* window id of embedder */
@ -589,7 +590,7 @@ extern void read_net_wm_states( Display *display, struct x11drv_win_data *data )
extern void update_net_wm_states( struct x11drv_win_data *data ) DECLSPEC_HIDDEN;
extern void make_window_embedded( struct x11drv_win_data *data ) DECLSPEC_HIDDEN;
extern Window create_client_window( struct x11drv_win_data *data, const XVisualInfo *visual ) DECLSPEC_HIDDEN;
extern void set_window_visual( struct x11drv_win_data *data, const XVisualInfo *vis ) DECLSPEC_HIDDEN;
extern void set_window_visual( struct x11drv_win_data *data, const XVisualInfo *vis, BOOL use_alpha ) DECLSPEC_HIDDEN;
extern void change_systray_owner( Display *display, Window systray_window ) DECLSPEC_HIDDEN;
extern void update_systray_balloon_position(void) DECLSPEC_HIDDEN;
extern HWND create_foreign_window( Display *display, Window window ) DECLSPEC_HIDDEN;