Store the "managed" flag as a window property instead of the
Wine-specific WS_EX_MANAGED style bit.
This commit is contained in:
parent
6a367dbf8d
commit
d7726c3a73
|
@ -890,9 +890,9 @@ STATUSBAR_WMCreate (HWND hwnd, LPCREATESTRUCTA lpCreate)
|
|||
dwStyle = GetWindowLongW (hwnd, GWL_STYLE);
|
||||
|
||||
/* statusbars on managed windows should not have SIZEGRIP style */
|
||||
if ((dwStyle & SBARS_SIZEGRIP) && lpCreate->hwndParent)
|
||||
if (GetWindowLongW (lpCreate->hwndParent, GWL_EXSTYLE) & WS_EX_MANAGED)
|
||||
SetWindowLongW (hwnd, GWL_STYLE, dwStyle & ~SBARS_SIZEGRIP);
|
||||
if ((dwStyle & SBARS_SIZEGRIP) && lpCreate->hwndParent &&
|
||||
GetPropA( lpCreate->hwndParent, "__wine_x11_managed" ))
|
||||
SetWindowLongW (hwnd, GWL_STYLE, dwStyle & ~SBARS_SIZEGRIP);
|
||||
|
||||
if ((hdc = GetDC (hwnd))) {
|
||||
TEXTMETRICW tm;
|
||||
|
|
|
@ -115,7 +115,7 @@ static BOOL set_active_window( HWND hwnd, HWND *prev, BOOL mouse, BOOL focus )
|
|||
SendMessageTimeoutW( HWND_BROADCAST, WM_PALETTEISCHANGING, (WPARAM)hwnd, 0,
|
||||
SMTO_ABORTIFHUNG, 2000, NULL );
|
||||
|
||||
if (!(GetWindowLongW( hwnd, GWL_EXSTYLE ) & WS_EX_MANAGED))
|
||||
if (!GetPropA( hwnd, "__wine_x11_managed" ))
|
||||
SetWindowPos( hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE );
|
||||
|
||||
if (!IsWindow(hwnd)) return FALSE;
|
||||
|
|
|
@ -2948,7 +2948,7 @@ void MENU_TrackKbdMenuBar( HWND hwnd, UINT wParam, WCHAR wChar)
|
|||
if (wParam & HTSYSMENU)
|
||||
{
|
||||
/* prevent sysmenu activation for managed windows on Alt down/up */
|
||||
if (GetWindowLongW(hwnd, GWL_EXSTYLE) & WS_EX_MANAGED)
|
||||
if (GetPropA( hwnd, "__wine_x11_managed" ))
|
||||
wFlags |= TF_ENDMENU; /* schedule end of menu tracking */
|
||||
}
|
||||
else
|
||||
|
|
|
@ -107,6 +107,7 @@ static const char * const atom_names[NB_XATOMS - FIRST_XATOM] =
|
|||
static LPCSTR whole_window_atom;
|
||||
static LPCSTR icon_window_atom;
|
||||
static LPCSTR client_offset_atom;
|
||||
static LPCSTR managed_atom;
|
||||
|
||||
/***********************************************************************
|
||||
* is_window_managed
|
||||
|
@ -170,13 +171,12 @@ BOOL X11DRV_is_window_rect_mapped( const RECT *rect )
|
|||
*/
|
||||
static int get_window_attributes( struct x11drv_win_data *data, XSetWindowAttributes *attr )
|
||||
{
|
||||
BOOL managed = !using_wine_desktop && is_window_managed( data->hwnd );
|
||||
DWORD ex_style = GetWindowLongW( data->hwnd, GWL_EXSTYLE );
|
||||
|
||||
if (managed) WIN_SetExStyle( data->hwnd, ex_style | WS_EX_MANAGED );
|
||||
else WIN_SetExStyle( data->hwnd, ex_style & ~WS_EX_MANAGED );
|
||||
|
||||
attr->override_redirect = !managed;
|
||||
if (!data->managed && !using_wine_desktop && is_window_managed( data->hwnd ))
|
||||
{
|
||||
data->managed = TRUE;
|
||||
SetPropA( data->hwnd, managed_atom, (HANDLE)1 );
|
||||
}
|
||||
attr->override_redirect = !data->managed;
|
||||
attr->colormap = X11DRV_PALETTE_PaletteXColormap;
|
||||
attr->save_under = ((GetClassLongW( data->hwnd, GCL_STYLE ) & CS_SAVEBITS) != 0);
|
||||
attr->cursor = x11drv_thread_data()->cursor;
|
||||
|
@ -291,14 +291,14 @@ static void destroy_icon_window( Display *display, struct x11drv_win_data *data
|
|||
* Set the icon wm hints
|
||||
*/
|
||||
static void set_icon_hints( Display *display, struct x11drv_win_data *data,
|
||||
XWMHints *hints, HICON hIcon, DWORD ex_style )
|
||||
XWMHints *hints, HICON hIcon )
|
||||
{
|
||||
if (data->hWMIconBitmap) DeleteObject( data->hWMIconBitmap );
|
||||
if (data->hWMIconMask) DeleteObject( data->hWMIconMask);
|
||||
data->hWMIconBitmap = 0;
|
||||
data->hWMIconMask = 0;
|
||||
|
||||
if (!(ex_style & WS_EX_MANAGED))
|
||||
if (!data->managed)
|
||||
{
|
||||
destroy_icon_window( display, data );
|
||||
hints->flags &= ~(IconPixmapHint | IconMaskHint | IconWindowHint);
|
||||
|
@ -484,7 +484,7 @@ void X11DRV_set_wm_hints( Display *display, struct x11drv_win_data *data )
|
|||
wm_hints->input = !(style & WS_DISABLED);
|
||||
|
||||
set_icon_hints( display, data, wm_hints,
|
||||
(HICON)GetClassLongW( data->hwnd, GCL_HICON ), ex_style );
|
||||
(HICON)GetClassLongW( data->hwnd, GCL_HICON ) );
|
||||
|
||||
wm_hints->initial_state = (style & WS_MINIMIZE) ? IconicState : NormalState;
|
||||
wm_hints->window_group = group_leader;
|
||||
|
@ -544,18 +544,17 @@ void X11DRV_set_iconic_state( HWND hwnd )
|
|||
*
|
||||
* Convert a rect from client to X window coordinates
|
||||
*/
|
||||
void X11DRV_window_to_X_rect( HWND hwnd, RECT *rect )
|
||||
void X11DRV_window_to_X_rect( struct x11drv_win_data *data, RECT *rect )
|
||||
{
|
||||
RECT rc;
|
||||
DWORD ex_style = GetWindowLongW( hwnd, GWL_EXSTYLE );
|
||||
|
||||
if (!(ex_style & WS_EX_MANAGED)) return;
|
||||
if (!data->managed) return;
|
||||
if (IsRectEmpty( rect )) return;
|
||||
|
||||
rc.top = rc.bottom = rc.left = rc.right = 0;
|
||||
|
||||
AdjustWindowRectEx( &rc, GetWindowLongW(hwnd, GWL_STYLE) & ~(WS_HSCROLL|WS_VSCROLL),
|
||||
FALSE, ex_style );
|
||||
AdjustWindowRectEx( &rc, GetWindowLongW( data->hwnd, GWL_STYLE ) & ~(WS_HSCROLL|WS_VSCROLL),
|
||||
FALSE, GetWindowLongW( data->hwnd, GWL_EXSTYLE ) );
|
||||
|
||||
rect->left -= rc.left;
|
||||
rect->right -= rc.right;
|
||||
|
@ -571,15 +570,13 @@ void X11DRV_window_to_X_rect( HWND hwnd, RECT *rect )
|
|||
*
|
||||
* Opposite of X11DRV_window_to_X_rect
|
||||
*/
|
||||
void X11DRV_X_to_window_rect( HWND hwnd, RECT *rect )
|
||||
void X11DRV_X_to_window_rect( struct x11drv_win_data *data, RECT *rect )
|
||||
{
|
||||
DWORD ex_style = GetWindowLongW( hwnd, GWL_EXSTYLE );
|
||||
|
||||
if (!(ex_style & WS_EX_MANAGED)) return;
|
||||
if (!data->managed) return;
|
||||
if (IsRectEmpty( rect )) return;
|
||||
|
||||
AdjustWindowRectEx( rect, GetWindowLongW(hwnd, GWL_STYLE) & ~(WS_HSCROLL|WS_VSCROLL),
|
||||
FALSE, ex_style );
|
||||
AdjustWindowRectEx( rect, GetWindowLongW( data->hwnd, GWL_STYLE ) & ~(WS_HSCROLL|WS_VSCROLL),
|
||||
FALSE, GetWindowLongW( data->hwnd, GWL_EXSTYLE ));
|
||||
|
||||
if (rect->top >= rect->bottom) rect->bottom = rect->top + 1;
|
||||
if (rect->left >= rect->right) rect->right = rect->left + 1;
|
||||
|
@ -600,7 +597,7 @@ void X11DRV_sync_window_position( Display *display, struct x11drv_win_data *data
|
|||
|
||||
old_whole_rect = data->whole_rect;
|
||||
data->whole_rect = data->window_rect;
|
||||
X11DRV_window_to_X_rect( data->hwnd, &data->whole_rect );
|
||||
X11DRV_window_to_X_rect( data, &data->whole_rect );
|
||||
|
||||
data->client_rect = *new_client_rect;
|
||||
OffsetRect( &data->client_rect, -data->whole_rect.left, -data->whole_rect.top );
|
||||
|
@ -674,6 +671,7 @@ static void create_desktop( Display *display, struct x11drv_win_data *data )
|
|||
whole_window_atom = MAKEINTATOMA( GlobalAddAtomA( "__wine_x11_whole_window" ));
|
||||
icon_window_atom = MAKEINTATOMA( GlobalAddAtomA( "__wine_x11_icon_window" ));
|
||||
client_offset_atom = MAKEINTATOMA( GlobalAddAtomA( "__wine_x11_client_area_offset" ));
|
||||
managed_atom = MAKEINTATOMA( GlobalAddAtomA( "__wine_x11_managed" ));
|
||||
|
||||
data->whole_window = root_window;
|
||||
data->whole_rect = data->client_rect = data->window_rect;
|
||||
|
@ -700,7 +698,7 @@ static Window create_whole_window( Display *display, struct x11drv_win_data *dat
|
|||
RECT rect;
|
||||
|
||||
rect = data->window_rect;
|
||||
X11DRV_window_to_X_rect( data->hwnd, &rect );
|
||||
X11DRV_window_to_X_rect( data, &rect );
|
||||
|
||||
if (!(cx = rect.right - rect.left)) cx = 1;
|
||||
if (!(cy = rect.bottom - rect.top)) cy = 1;
|
||||
|
@ -900,6 +898,7 @@ BOOL X11DRV_CreateWindow( HWND hwnd, CREATESTRUCTA *cs, BOOL unicode )
|
|||
data->whole_window = 0;
|
||||
data->icon_window = 0;
|
||||
data->xic = 0;
|
||||
data->managed = FALSE;
|
||||
data->hWMIconBitmap = 0;
|
||||
data->hWMIconMask = 0;
|
||||
|
||||
|
@ -1181,8 +1180,8 @@ HWND X11DRV_SetParent( HWND hwnd, HWND parent )
|
|||
void X11DRV_SetFocus( HWND hwnd )
|
||||
{
|
||||
Display *display = thread_display();
|
||||
struct x11drv_win_data *data;
|
||||
XWindowAttributes win_attr;
|
||||
Window win;
|
||||
|
||||
/* Only mess with the X focus if there's */
|
||||
/* no desktop window and if the window is not managed by the WM. */
|
||||
|
@ -1198,19 +1197,20 @@ void X11DRV_SetFocus( HWND hwnd )
|
|||
}
|
||||
|
||||
hwnd = GetAncestor( hwnd, GA_ROOT );
|
||||
if (GetWindowLongW( hwnd, GWL_EXSTYLE ) & WS_EX_MANAGED) return;
|
||||
if (!(win = X11DRV_get_whole_window( hwnd ))) return;
|
||||
|
||||
if (!(data = X11DRV_get_win_data( hwnd ))) return;
|
||||
if (!data->managed || !data->whole_window) return;
|
||||
|
||||
/* Set X focus and install colormap */
|
||||
wine_tsx11_lock();
|
||||
if (XGetWindowAttributes( display, win, &win_attr ) &&
|
||||
if (XGetWindowAttributes( display, data->whole_window, &win_attr ) &&
|
||||
(win_attr.map_state == IsViewable))
|
||||
{
|
||||
/* If window is not viewable, don't change anything */
|
||||
|
||||
/* we must not use CurrentTime (ICCCM), so try to use last message time instead */
|
||||
/* FIXME: this is not entirely correct */
|
||||
XSetInputFocus( display, win, RevertToParent,
|
||||
XSetInputFocus( display, data->whole_window, RevertToParent,
|
||||
/* CurrentTime */
|
||||
GetMessageTime() - EVENT_x11_time_to_win32_time(0));
|
||||
if (X11DRV_PALETTE_PaletteFlags & X11DRV_PALETTE_PRIVATE)
|
||||
|
@ -1234,28 +1234,23 @@ void X11DRV_SetWindowIcon( HWND hwnd, UINT type, HICON icon )
|
|||
{
|
||||
Display *display = thread_display();
|
||||
struct x11drv_win_data *data;
|
||||
DWORD ex_style;
|
||||
XWMHints* wm_hints;
|
||||
|
||||
if (type != ICON_BIG) return; /* nothing to do here */
|
||||
|
||||
if (!(data = X11DRV_get_win_data( hwnd ))) return;
|
||||
if (!data->whole_window) return;
|
||||
if (!data->managed) return;
|
||||
|
||||
ex_style = GetWindowLongW( hwnd, GWL_EXSTYLE );
|
||||
if (ex_style & WS_EX_MANAGED)
|
||||
wine_tsx11_lock();
|
||||
if (!(wm_hints = XGetWMHints( display, data->whole_window ))) wm_hints = XAllocWMHints();
|
||||
wine_tsx11_unlock();
|
||||
if (wm_hints)
|
||||
{
|
||||
XWMHints* wm_hints;
|
||||
|
||||
set_icon_hints( display, data, wm_hints, icon );
|
||||
wine_tsx11_lock();
|
||||
if (!(wm_hints = XGetWMHints( display, data->whole_window ))) wm_hints = XAllocWMHints();
|
||||
XSetWMHints( display, data->whole_window, wm_hints );
|
||||
XFree( wm_hints );
|
||||
wine_tsx11_unlock();
|
||||
if (wm_hints)
|
||||
{
|
||||
set_icon_hints( display, data, wm_hints, icon, ex_style );
|
||||
wine_tsx11_lock();
|
||||
XSetWMHints( display, data->whole_window, wm_hints );
|
||||
XFree( wm_hints );
|
||||
wine_tsx11_unlock();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(x11drv);
|
|||
#define SWP_EX_PAINTSELF 0x0002
|
||||
#define SWP_EX_NONCLIENT 0x0004
|
||||
|
||||
#define HAS_THICKFRAME(style,exStyle) \
|
||||
#define HAS_THICKFRAME(style) \
|
||||
(((style) & WS_THICKFRAME) && \
|
||||
!(((style) & (WS_DLGFRAME|WS_BORDER)) == WS_DLGFRAME))
|
||||
|
||||
|
@ -582,7 +582,7 @@ void X11DRV_SetWindowStyle( HWND hwnd, DWORD old_style )
|
|||
|
||||
if (changed & WS_DISABLED)
|
||||
{
|
||||
if (data->whole_window && (GetWindowLongW( hwnd, GWL_EXSTYLE ) & WS_EX_MANAGED))
|
||||
if (data->whole_window && data->managed)
|
||||
{
|
||||
XWMHints *wm_hints;
|
||||
wine_tsx11_lock();
|
||||
|
@ -1115,9 +1115,7 @@ void X11DRV_MapNotify( HWND hwnd, XMapEvent *event )
|
|||
|
||||
if (!(win = WIN_GetPtr( hwnd ))) return;
|
||||
|
||||
if ((win->dwStyle & WS_VISIBLE) &&
|
||||
(win->dwStyle & WS_MINIMIZE) &&
|
||||
(win->dwExStyle & WS_EX_MANAGED))
|
||||
if (data->managed && (win->dwStyle & WS_VISIBLE) && (win->dwStyle & WS_MINIMIZE))
|
||||
{
|
||||
int x, y;
|
||||
unsigned int width, height, border, depth;
|
||||
|
@ -1135,7 +1133,7 @@ void X11DRV_MapNotify( HWND hwnd, XMapEvent *event )
|
|||
rect.top = y;
|
||||
rect.right = x + width;
|
||||
rect.bottom = y + height;
|
||||
X11DRV_X_to_window_rect( hwnd, &rect );
|
||||
X11DRV_X_to_window_rect( data, &rect );
|
||||
|
||||
DCE_InvalidateDCE( hwnd, &data->window_rect );
|
||||
|
||||
|
@ -1157,11 +1155,14 @@ void X11DRV_MapNotify( HWND hwnd, XMapEvent *event )
|
|||
*/
|
||||
void X11DRV_UnmapNotify( HWND hwnd, XUnmapEvent *event )
|
||||
{
|
||||
struct x11drv_win_data *data;
|
||||
WND *win;
|
||||
|
||||
if (!(data = X11DRV_get_win_data( hwnd ))) return;
|
||||
|
||||
if (!(win = WIN_GetPtr( hwnd ))) return;
|
||||
|
||||
if ((win->dwStyle & WS_VISIBLE) && (win->dwExStyle & WS_EX_MANAGED) &&
|
||||
if ((win->dwStyle & WS_VISIBLE) && data->managed &&
|
||||
X11DRV_is_window_rect_mapped( &win->rectWindow ))
|
||||
{
|
||||
if (win->dwStyle & WS_MAXIMIZE)
|
||||
|
@ -1250,8 +1251,8 @@ static HWND query_zorder( Display *display, HWND hWndCheck)
|
|||
if (!list) return 0;
|
||||
for (i = 0; list[i]; i++)
|
||||
{
|
||||
if (!(GetWindowLongW( list[i], GWL_EXSTYLE ) & WS_EX_MANAGED)) continue;
|
||||
if (!(GetWindowLongW( list[i], GWL_STYLE ) & WS_VISIBLE)) continue;
|
||||
if (!GetPropA( list[i], "__wine_x11_managed" )) continue;
|
||||
if (!hwndA) hwndA = list[i];
|
||||
else
|
||||
{
|
||||
|
@ -1279,7 +1280,7 @@ static HWND query_zorder( Display *display, HWND hWndCheck)
|
|||
for (i = 0; list[i]; i++)
|
||||
{
|
||||
if (list[i] == hWndCheck) continue;
|
||||
if (!(GetWindowLongW( list[i], GWL_EXSTYLE ) & WS_EX_MANAGED)) continue;
|
||||
if (!GetPropA( list[i], "__wine_x11_managed" )) continue;
|
||||
if (!(w = __get_top_decoration( display, X11DRV_get_whole_window(list[i]),
|
||||
parent ))) continue;
|
||||
pos = __td_lookup( w, children, total );
|
||||
|
@ -1351,7 +1352,7 @@ void X11DRV_ConfigureNotify( HWND hwnd, XConfigureEvent *event )
|
|||
TRACE( "win %p new X rect %ld,%ld,%ldx%ld (event %d,%d,%dx%d)\n",
|
||||
hwnd, rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top,
|
||||
event->x, event->y, event->width, event->height );
|
||||
X11DRV_X_to_window_rect( hwnd, &rect );
|
||||
X11DRV_X_to_window_rect( data, &rect );
|
||||
|
||||
winpos.hwnd = hwnd;
|
||||
winpos.x = rect.left;
|
||||
|
@ -1650,8 +1651,7 @@ void X11DRV_SysCommandSizeMove( HWND hwnd, WPARAM wParam )
|
|||
POINT minTrack, maxTrack;
|
||||
POINT capturePoint, pt;
|
||||
LONG style = GetWindowLongA( hwnd, GWL_STYLE );
|
||||
LONG exstyle = GetWindowLongA( hwnd, GWL_EXSTYLE );
|
||||
BOOL thickframe = HAS_THICKFRAME( style, exstyle );
|
||||
BOOL thickframe = HAS_THICKFRAME( style );
|
||||
BOOL iconic = style & WS_MINIMIZE;
|
||||
BOOL moved = FALSE;
|
||||
DWORD dwPoint = GetMessagePos ();
|
||||
|
@ -1660,6 +1660,7 @@ void X11DRV_SysCommandSizeMove( HWND hwnd, WPARAM wParam )
|
|||
Window parent_win, whole_win;
|
||||
Display *old_gdi_display = NULL;
|
||||
Display *display = thread_display();
|
||||
struct x11drv_win_data *data;
|
||||
|
||||
pt.x = (short)LOWORD(dwPoint);
|
||||
pt.y = (short)HIWORD(dwPoint);
|
||||
|
@ -1667,8 +1668,10 @@ void X11DRV_SysCommandSizeMove( HWND hwnd, WPARAM wParam )
|
|||
|
||||
if (IsZoomed(hwnd) || !IsWindowVisible(hwnd)) return;
|
||||
|
||||
if (!(data = X11DRV_get_win_data( hwnd ))) return;
|
||||
|
||||
/* if we are managed then we let the WM do all the work */
|
||||
if (exstyle & WS_EX_MANAGED)
|
||||
if (data->managed)
|
||||
{
|
||||
int dir;
|
||||
if (syscommand == SC_MOVE)
|
||||
|
|
|
@ -536,6 +536,7 @@ struct x11drv_win_data
|
|||
RECT whole_rect; /* X window rectangle for the whole window relative to parent */
|
||||
RECT client_rect; /* client area relative to whole window */
|
||||
XIC xic; /* X input context */
|
||||
BOOL managed; /* is window managed? */
|
||||
HBITMAP hWMIconBitmap;
|
||||
HBITMAP hWMIconMask;
|
||||
};
|
||||
|
@ -558,8 +559,8 @@ typedef int (*x11drv_error_callback)( Display *display, XErrorEvent *event, void
|
|||
extern void X11DRV_expect_error( Display *display, x11drv_error_callback callback, void *arg );
|
||||
extern int X11DRV_check_error(void);
|
||||
extern void X11DRV_set_iconic_state( HWND hwnd );
|
||||
extern void X11DRV_window_to_X_rect( HWND hwnd, RECT *rect );
|
||||
extern void X11DRV_X_to_window_rect( HWND hwnd, RECT *rect );
|
||||
extern void X11DRV_window_to_X_rect( struct x11drv_win_data *data, RECT *rect );
|
||||
extern void X11DRV_X_to_window_rect( struct x11drv_win_data *data, RECT *rect );
|
||||
extern void X11DRV_create_desktop_thread(void);
|
||||
extern Window X11DRV_create_desktop( XVisualInfo *desktop_vi, const char *geometry );
|
||||
extern void X11DRV_sync_window_style( Display *display, struct x11drv_win_data *data );
|
||||
|
|
|
@ -2923,7 +2923,6 @@ typedef struct tagMINIMIZEDMETRICS {
|
|||
|
||||
/* WINE internal... */
|
||||
#define WS_EX_TRAYWINDOW 0x80000000L
|
||||
#define WS_EX_MANAGED 0x40000000L /* Window managed by the window system */
|
||||
|
||||
/* Window scrolling */
|
||||
#define SW_SCROLLCHILDREN 0x0001
|
||||
|
|
|
@ -696,7 +696,7 @@ BOOL WINPOS_ShowIconTitle( HWND hwnd, BOOL bShow )
|
|||
{
|
||||
LPINTERNALPOS lpPos = (LPINTERNALPOS)GetPropA( hwnd, atomInternalPos );
|
||||
|
||||
if( lpPos && !(GetWindowLongA( hwnd, GWL_EXSTYLE) & WS_EX_MANAGED))
|
||||
if (lpPos && !GetPropA( hwnd, "__wine_x11_managed" ))
|
||||
{
|
||||
HWND title = lpPos->hwndIconTitle;
|
||||
|
||||
|
|
Loading…
Reference in New Issue