2001-04-25 01:28:52 +02:00
|
|
|
/*
|
|
|
|
* Window related functions
|
|
|
|
*
|
|
|
|
* Copyright 1993, 1994, 1995, 1996, 2001 Alexandre Julliard
|
|
|
|
* Copyright 1993 David Metcalfe
|
|
|
|
* Copyright 1995, 1996 Alex Korobka
|
2002-03-10 00:29:33 +01:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
2001-04-25 01:28:52 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
2003-09-06 01:08:26 +02:00
|
|
|
#include <stdarg.h>
|
2001-06-19 05:32:44 +02:00
|
|
|
#include <stdlib.h>
|
2003-08-08 23:07:23 +02:00
|
|
|
#ifdef HAVE_UNISTD_H
|
|
|
|
# include <unistd.h>
|
|
|
|
#endif
|
2001-06-19 05:32:44 +02:00
|
|
|
|
2003-11-21 22:48:36 +01:00
|
|
|
#include <X11/Xlib.h>
|
2002-09-24 20:36:51 +02:00
|
|
|
#include <X11/Xresource.h>
|
|
|
|
#include <X11/Xutil.h>
|
2001-04-25 01:28:52 +02:00
|
|
|
|
2003-09-06 01:08:26 +02:00
|
|
|
#include "windef.h"
|
2001-04-25 01:28:52 +02:00
|
|
|
#include "winbase.h"
|
|
|
|
#include "wingdi.h"
|
2001-06-19 05:32:44 +02:00
|
|
|
#include "winreg.h"
|
2001-04-25 01:28:52 +02:00
|
|
|
#include "winuser.h"
|
2001-10-02 20:44:56 +02:00
|
|
|
#include "wine/unicode.h"
|
2001-04-25 01:28:52 +02:00
|
|
|
|
2002-03-10 00:29:33 +01:00
|
|
|
#include "wine/debug.h"
|
2001-04-25 01:28:52 +02:00
|
|
|
#include "x11drv.h"
|
2005-01-17 20:17:47 +01:00
|
|
|
#include "win.h"
|
2001-10-22 21:08:33 +02:00
|
|
|
#include "winpos.h"
|
2002-01-21 19:41:27 +01:00
|
|
|
#include "mwm.h"
|
2001-04-25 01:28:52 +02:00
|
|
|
|
2002-03-10 00:29:33 +01:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(x11drv);
|
2001-04-25 01:28:52 +02:00
|
|
|
|
|
|
|
extern Pixmap X11DRV_BITMAP_Pixmap( HBITMAP );
|
|
|
|
|
|
|
|
/* X context to associate a hwnd to an X window */
|
|
|
|
XContext winContext = 0;
|
|
|
|
|
2003-11-20 05:24:18 +01:00
|
|
|
Atom X11DRV_Atoms[NB_XATOMS - FIRST_XATOM];
|
|
|
|
|
|
|
|
static const char * const atom_names[NB_XATOMS - FIRST_XATOM] =
|
|
|
|
{
|
|
|
|
"CLIPBOARD",
|
|
|
|
"COMPOUND_TEXT",
|
|
|
|
"MULTIPLE",
|
|
|
|
"SELECTION_DATA",
|
|
|
|
"TARGETS",
|
|
|
|
"TEXT",
|
|
|
|
"UTF8_STRING",
|
|
|
|
"RAW_ASCENT",
|
|
|
|
"RAW_DESCENT",
|
|
|
|
"RAW_CAP_HEIGHT",
|
|
|
|
"WM_PROTOCOLS",
|
|
|
|
"WM_DELETE_WINDOW",
|
|
|
|
"WM_TAKE_FOCUS",
|
|
|
|
"KWM_DOCKWINDOW",
|
|
|
|
"DndProtocol",
|
|
|
|
"DndSelection",
|
|
|
|
"_MOTIF_WM_HINTS",
|
|
|
|
"_KDE_NET_WM_SYSTEM_TRAY_WINDOW_FOR",
|
2004-08-19 01:47:48 +02:00
|
|
|
"_NET_WM_MOVERESIZE",
|
2003-11-20 05:24:18 +01:00
|
|
|
"_NET_WM_PID",
|
|
|
|
"_NET_WM_PING",
|
|
|
|
"_NET_WM_NAME",
|
2003-12-04 22:54:13 +01:00
|
|
|
"_NET_WM_WINDOW_TYPE",
|
|
|
|
"_NET_WM_WINDOW_TYPE_UTILITY",
|
2003-11-20 23:09:51 +01:00
|
|
|
"XdndAware",
|
|
|
|
"XdndEnter",
|
|
|
|
"XdndPosition",
|
|
|
|
"XdndStatus",
|
|
|
|
"XdndLeave",
|
|
|
|
"XdndFinished",
|
|
|
|
"XdndDrop",
|
|
|
|
"XdndActionCopy",
|
|
|
|
"XdndActionMove",
|
|
|
|
"XdndActionLink",
|
|
|
|
"XdndActionAsk",
|
|
|
|
"XdndActionPrivate",
|
|
|
|
"XdndSelection",
|
|
|
|
"XdndTarget",
|
|
|
|
"XdndTypeList",
|
2004-02-20 06:43:00 +01:00
|
|
|
"WCF_DIB",
|
2003-11-20 05:24:18 +01:00
|
|
|
"image/gif",
|
2003-11-20 23:09:51 +01:00
|
|
|
"text/html",
|
|
|
|
"text/plain",
|
2003-11-20 05:24:18 +01:00
|
|
|
"text/rtf",
|
|
|
|
"text/richtext"
|
|
|
|
};
|
2001-04-25 01:28:52 +02:00
|
|
|
|
2001-10-15 19:56:45 +02:00
|
|
|
static LPCSTR whole_window_atom;
|
|
|
|
static LPCSTR client_window_atom;
|
|
|
|
static LPCSTR icon_window_atom;
|
2001-04-25 01:28:52 +02:00
|
|
|
|
|
|
|
/***********************************************************************
|
2001-06-04 23:55:17 +02:00
|
|
|
* is_window_managed
|
2001-04-25 01:28:52 +02:00
|
|
|
*
|
2001-06-04 23:55:17 +02:00
|
|
|
* Check if a given window should be managed
|
2001-04-25 01:28:52 +02:00
|
|
|
*/
|
2005-01-17 20:17:47 +01:00
|
|
|
inline static BOOL is_window_managed( HWND hwnd )
|
2001-04-25 01:28:52 +02:00
|
|
|
{
|
2005-01-17 20:17:47 +01:00
|
|
|
DWORD style, ex_style;
|
|
|
|
|
2002-05-23 18:32:32 +02:00
|
|
|
if (!managed_mode) return FALSE;
|
2001-06-04 23:55:17 +02:00
|
|
|
/* tray window is always managed */
|
2005-01-17 20:17:47 +01:00
|
|
|
ex_style = GetWindowLongW( hwnd, GWL_EXSTYLE );
|
|
|
|
if (ex_style & WS_EX_TRAYWINDOW) return TRUE;
|
2001-06-04 23:55:17 +02:00
|
|
|
/* child windows are not managed */
|
2005-01-17 20:17:47 +01:00
|
|
|
style = GetWindowLongW( hwnd, GWL_STYLE );
|
|
|
|
if (style & WS_CHILD) return FALSE;
|
2003-12-04 22:54:13 +01:00
|
|
|
/* windows with caption are managed */
|
2005-01-17 20:17:47 +01:00
|
|
|
if ((style & WS_CAPTION) == WS_CAPTION) return TRUE;
|
2003-12-04 22:54:13 +01:00
|
|
|
/* tool windows are not managed */
|
2005-01-17 20:17:47 +01:00
|
|
|
if (ex_style & WS_EX_TOOLWINDOW) return FALSE;
|
2003-12-04 22:54:13 +01:00
|
|
|
/* windows with thick frame are managed */
|
2005-01-17 20:17:47 +01:00
|
|
|
if (style & WS_THICKFRAME) return TRUE;
|
2003-12-13 01:05:53 +01:00
|
|
|
/* application windows are managed */
|
2005-01-17 20:17:47 +01:00
|
|
|
if (ex_style & WS_EX_APPWINDOW) return TRUE;
|
2004-02-06 06:17:55 +01:00
|
|
|
/* full-screen popup windows are managed */
|
2005-01-17 20:17:47 +01:00
|
|
|
if (style & WS_POPUP)
|
2004-02-06 06:17:55 +01:00
|
|
|
{
|
2005-01-17 20:17:47 +01:00
|
|
|
RECT rect;
|
|
|
|
GetWindowRect( hwnd, &rect );
|
|
|
|
if ((rect.right - rect.left) == screen_width && (rect.bottom - rect.top) == screen_height)
|
|
|
|
return TRUE;
|
2004-02-06 06:17:55 +01:00
|
|
|
}
|
2001-06-04 23:55:17 +02:00
|
|
|
/* default: not managed */
|
|
|
|
return FALSE;
|
2001-04-25 01:28:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-06-12 06:02:10 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* is_client_window_mapped
|
|
|
|
*
|
|
|
|
* Check if the X client window should be mapped
|
|
|
|
*/
|
2005-01-17 20:17:47 +01:00
|
|
|
inline static BOOL is_client_window_mapped( struct x11drv_win_data *data )
|
2001-06-12 06:02:10 +02:00
|
|
|
{
|
2005-01-17 20:17:47 +01:00
|
|
|
return !(GetWindowLongW( data->hwnd, GWL_STYLE ) & WS_MINIMIZE) && !IsRectEmpty( &data->client_rect );
|
2001-06-12 06:02:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-04-28 01:32:01 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* X11DRV_is_window_rect_mapped
|
|
|
|
*
|
|
|
|
* Check if the X whole window should be mapped based on its rectangle
|
|
|
|
*/
|
|
|
|
BOOL X11DRV_is_window_rect_mapped( const RECT *rect )
|
|
|
|
{
|
|
|
|
/* don't map if rect is empty */
|
|
|
|
if (IsRectEmpty( rect )) return FALSE;
|
|
|
|
|
|
|
|
/* don't map if rect is off-screen */
|
2004-04-28 02:31:21 +02:00
|
|
|
if (rect->left >= (int)screen_width || rect->top >= (int)screen_height) return FALSE;
|
2004-04-28 01:32:01 +02:00
|
|
|
if (rect->right < 0 || rect->bottom < 0) return FALSE;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-06-04 23:55:17 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* get_window_attributes
|
|
|
|
*
|
2001-06-12 06:02:10 +02:00
|
|
|
* Fill the window attributes structure for an X window.
|
2001-06-04 23:55:17 +02:00
|
|
|
*/
|
2005-01-17 20:17:47 +01:00
|
|
|
static int get_window_attributes( struct x11drv_win_data *data, XSetWindowAttributes *attr )
|
2001-06-04 23:55:17 +02:00
|
|
|
{
|
2005-01-17 20:17:47 +01:00
|
|
|
BOOL is_top_level = is_window_top_level( data->hwnd );
|
|
|
|
BOOL managed = is_top_level && is_window_managed( data->hwnd );
|
|
|
|
DWORD ex_style = GetWindowLongW( data->hwnd, GWL_EXSTYLE );
|
2001-06-04 23:55:17 +02:00
|
|
|
|
2005-01-17 20:17:47 +01:00
|
|
|
if (managed) WIN_SetExStyle( data->hwnd, ex_style | WS_EX_MANAGED );
|
|
|
|
else WIN_SetExStyle( data->hwnd, ex_style & ~WS_EX_MANAGED );
|
2001-06-04 23:55:17 +02:00
|
|
|
|
|
|
|
attr->override_redirect = !managed;
|
|
|
|
attr->colormap = X11DRV_PALETTE_PaletteXColormap;
|
2005-01-17 20:17:47 +01:00
|
|
|
attr->save_under = ((GetClassLongW( data->hwnd, GCL_STYLE ) & CS_SAVEBITS) != 0);
|
2002-06-14 02:08:40 +02:00
|
|
|
attr->cursor = x11drv_thread_data()->cursor;
|
2003-01-21 21:16:20 +01:00
|
|
|
attr->event_mask = (ExposureMask | PointerMotionMask |
|
2002-06-14 02:08:40 +02:00
|
|
|
ButtonPressMask | ButtonReleaseMask | EnterWindowMask);
|
|
|
|
|
2005-01-17 20:17:47 +01:00
|
|
|
if (is_top_level)
|
2003-01-21 21:16:20 +01:00
|
|
|
attr->event_mask |= (KeyPressMask | KeyReleaseMask | StructureNotifyMask |
|
|
|
|
FocusChangeMask | KeymapStateMask);
|
2002-06-14 02:08:40 +02:00
|
|
|
|
2001-06-12 06:02:10 +02:00
|
|
|
return (CWOverrideRedirect | CWSaveUnder | CWEventMask | CWColormap | CWCursor);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
2002-08-20 02:36:45 +02:00
|
|
|
* X11DRV_sync_window_style
|
2001-06-12 06:02:10 +02:00
|
|
|
*
|
|
|
|
* Change the X window attributes when the window style has changed.
|
|
|
|
*/
|
2005-01-17 20:17:47 +01:00
|
|
|
void X11DRV_sync_window_style( Display *display, struct x11drv_win_data *data )
|
2001-06-12 06:02:10 +02:00
|
|
|
{
|
|
|
|
XSetWindowAttributes attr;
|
2005-01-17 20:17:47 +01:00
|
|
|
int mask = get_window_attributes( data, &attr );
|
2001-06-04 23:55:17 +02:00
|
|
|
|
2001-06-12 06:02:10 +02:00
|
|
|
wine_tsx11_lock();
|
2005-01-17 20:17:47 +01:00
|
|
|
XChangeWindowAttributes( display, data->whole_window, mask, &attr );
|
2001-06-12 06:02:10 +02:00
|
|
|
wine_tsx11_unlock();
|
2001-06-04 23:55:17 +02:00
|
|
|
}
|
2001-04-25 01:28:52 +02:00
|
|
|
|
2001-06-04 23:55:17 +02:00
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* get_window_changes
|
|
|
|
*
|
|
|
|
* fill the window changes structure
|
|
|
|
*/
|
|
|
|
static int get_window_changes( XWindowChanges *changes, const RECT *old, const RECT *new )
|
|
|
|
{
|
|
|
|
int mask = 0;
|
|
|
|
|
|
|
|
if (old->right - old->left != new->right - new->left )
|
|
|
|
{
|
|
|
|
if (!(changes->width = new->right - new->left)) changes->width = 1;
|
|
|
|
mask |= CWWidth;
|
|
|
|
}
|
|
|
|
if (old->bottom - old->top != new->bottom - new->top)
|
|
|
|
{
|
|
|
|
if (!(changes->height = new->bottom - new->top)) changes->height = 1;
|
|
|
|
mask |= CWHeight;
|
|
|
|
}
|
|
|
|
if (old->left != new->left)
|
|
|
|
{
|
|
|
|
changes->x = new->left;
|
|
|
|
mask |= CWX;
|
|
|
|
}
|
|
|
|
if (old->top != new->top)
|
|
|
|
{
|
|
|
|
changes->y = new->top;
|
|
|
|
mask |= CWY;
|
2001-04-25 01:28:52 +02:00
|
|
|
}
|
2001-06-04 23:55:17 +02:00
|
|
|
return mask;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* create_icon_window
|
|
|
|
*/
|
2005-01-17 20:17:47 +01:00
|
|
|
static Window create_icon_window( Display *display, struct x11drv_win_data *data )
|
2001-06-04 23:55:17 +02:00
|
|
|
{
|
|
|
|
XSetWindowAttributes attr;
|
|
|
|
|
|
|
|
attr.event_mask = (ExposureMask | KeyPressMask | KeyReleaseMask | PointerMotionMask |
|
2002-06-14 02:08:40 +02:00
|
|
|
ButtonPressMask | ButtonReleaseMask | EnterWindowMask);
|
2001-06-04 23:55:17 +02:00
|
|
|
attr.bit_gravity = NorthWestGravity;
|
|
|
|
attr.backing_store = NotUseful/*WhenMapped*/;
|
2001-07-13 00:27:56 +02:00
|
|
|
attr.colormap = X11DRV_PALETTE_PaletteXColormap; /* Needed due to our visual */
|
2001-06-04 23:55:17 +02:00
|
|
|
|
2001-06-26 23:10:11 +02:00
|
|
|
wine_tsx11_lock();
|
|
|
|
data->icon_window = XCreateWindow( display, root_window, 0, 0,
|
|
|
|
GetSystemMetrics( SM_CXICON ),
|
|
|
|
GetSystemMetrics( SM_CYICON ),
|
|
|
|
0, screen_depth,
|
|
|
|
InputOutput, visual,
|
2001-07-13 00:27:56 +02:00
|
|
|
CWEventMask | CWBitGravity | CWBackingStore | CWColormap, &attr );
|
2005-01-17 20:17:47 +01:00
|
|
|
XSaveContext( display, data->icon_window, winContext, (char *)data->hwnd );
|
2001-06-26 23:10:11 +02:00
|
|
|
wine_tsx11_unlock();
|
|
|
|
|
2001-06-04 23:55:17 +02:00
|
|
|
TRACE( "created %lx\n", data->icon_window );
|
2005-01-17 20:17:47 +01:00
|
|
|
SetPropA( data->hwnd, icon_window_atom, (HANDLE)data->icon_window );
|
2001-06-04 23:55:17 +02:00
|
|
|
return data->icon_window;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* destroy_icon_window
|
|
|
|
*/
|
2005-01-17 20:17:47 +01:00
|
|
|
inline static void destroy_icon_window( Display *display, struct x11drv_win_data *data )
|
2001-06-04 23:55:17 +02:00
|
|
|
{
|
|
|
|
if (!data->icon_window) return;
|
2002-06-14 02:08:40 +02:00
|
|
|
if (x11drv_thread_data()->cursor_window == data->icon_window)
|
|
|
|
x11drv_thread_data()->cursor_window = None;
|
2001-07-12 04:49:31 +02:00
|
|
|
wine_tsx11_lock();
|
2001-06-04 23:55:17 +02:00
|
|
|
XDeleteContext( display, data->icon_window, winContext );
|
|
|
|
XDestroyWindow( display, data->icon_window );
|
|
|
|
data->icon_window = 0;
|
2001-07-12 04:49:31 +02:00
|
|
|
wine_tsx11_unlock();
|
2005-01-17 20:17:47 +01:00
|
|
|
RemovePropA( data->hwnd, icon_window_atom );
|
2001-04-25 01:28:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* set_icon_hints
|
|
|
|
*
|
|
|
|
* Set the icon wm hints
|
|
|
|
*/
|
2005-01-17 20:17:47 +01:00
|
|
|
static void set_icon_hints( Display *display, struct x11drv_win_data *data,
|
|
|
|
XWMHints *hints, HICON hIcon, DWORD ex_style )
|
2001-04-25 01:28:52 +02:00
|
|
|
{
|
|
|
|
if (data->hWMIconBitmap) DeleteObject( data->hWMIconBitmap );
|
|
|
|
if (data->hWMIconMask) DeleteObject( data->hWMIconMask);
|
2001-06-12 06:02:10 +02:00
|
|
|
data->hWMIconBitmap = 0;
|
|
|
|
data->hWMIconMask = 0;
|
2001-04-25 01:28:52 +02:00
|
|
|
|
2005-01-17 20:17:47 +01:00
|
|
|
if (!(ex_style & WS_EX_MANAGED))
|
2001-06-12 06:02:10 +02:00
|
|
|
{
|
2005-01-17 20:17:47 +01:00
|
|
|
destroy_icon_window( display, data );
|
2001-06-12 06:02:10 +02:00
|
|
|
hints->flags &= ~(IconPixmapHint | IconMaskHint | IconWindowHint);
|
|
|
|
}
|
|
|
|
else if (!hIcon)
|
2001-04-25 01:28:52 +02:00
|
|
|
{
|
2005-01-17 20:17:47 +01:00
|
|
|
if (!data->icon_window) create_icon_window( display, data );
|
2001-06-04 23:55:17 +02:00
|
|
|
hints->icon_window = data->icon_window;
|
|
|
|
hints->flags = (hints->flags & ~(IconPixmapHint | IconMaskHint)) | IconWindowHint;
|
2001-04-25 01:28:52 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
HBITMAP hbmOrig;
|
|
|
|
RECT rcMask;
|
|
|
|
BITMAP bmMask;
|
|
|
|
ICONINFO ii;
|
|
|
|
HDC hDC;
|
|
|
|
|
|
|
|
GetIconInfo(hIcon, &ii);
|
|
|
|
|
|
|
|
GetObjectA(ii.hbmMask, sizeof(bmMask), &bmMask);
|
|
|
|
rcMask.top = 0;
|
|
|
|
rcMask.left = 0;
|
|
|
|
rcMask.right = bmMask.bmWidth;
|
|
|
|
rcMask.bottom = bmMask.bmHeight;
|
|
|
|
|
|
|
|
hDC = CreateCompatibleDC(0);
|
|
|
|
hbmOrig = SelectObject(hDC, ii.hbmMask);
|
|
|
|
InvertRect(hDC, &rcMask);
|
2002-05-31 20:43:22 +02:00
|
|
|
SelectObject(hDC, ii.hbmColor); /* force the color bitmap to x11drv mode too */
|
2001-04-25 01:28:52 +02:00
|
|
|
SelectObject(hDC, hbmOrig);
|
|
|
|
DeleteDC(hDC);
|
|
|
|
|
|
|
|
data->hWMIconBitmap = ii.hbmColor;
|
|
|
|
data->hWMIconMask = ii.hbmMask;
|
|
|
|
|
|
|
|
hints->icon_pixmap = X11DRV_BITMAP_Pixmap(data->hWMIconBitmap);
|
|
|
|
hints->icon_mask = X11DRV_BITMAP_Pixmap(data->hWMIconMask);
|
2005-01-17 20:17:47 +01:00
|
|
|
destroy_icon_window( display, data );
|
2001-06-04 23:55:17 +02:00
|
|
|
hints->flags = (hints->flags & ~IconWindowHint) | IconPixmapHint | IconMaskHint;
|
2001-04-25 01:28:52 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
2001-06-04 23:55:17 +02:00
|
|
|
* set_size_hints
|
2001-04-25 01:28:52 +02:00
|
|
|
*
|
2001-06-04 23:55:17 +02:00
|
|
|
* set the window size hints
|
2001-04-25 01:28:52 +02:00
|
|
|
*/
|
2005-01-17 20:17:47 +01:00
|
|
|
static void set_size_hints( Display *display, struct x11drv_win_data *data, DWORD style )
|
2001-04-25 01:28:52 +02:00
|
|
|
{
|
2001-06-04 23:55:17 +02:00
|
|
|
XSizeHints* size_hints;
|
|
|
|
|
|
|
|
if ((size_hints = XAllocSizeHints()))
|
|
|
|
{
|
|
|
|
size_hints->win_gravity = StaticGravity;
|
|
|
|
size_hints->x = data->whole_rect.left;
|
|
|
|
size_hints->y = data->whole_rect.top;
|
|
|
|
size_hints->flags = PWinGravity | PPosition;
|
|
|
|
|
2005-01-17 20:17:47 +01:00
|
|
|
if ( !(style & WS_THICKFRAME) )
|
2001-06-04 23:55:17 +02:00
|
|
|
{
|
|
|
|
size_hints->max_width = data->whole_rect.right - data->whole_rect.left;
|
|
|
|
size_hints->max_height = data->whole_rect.bottom - data->whole_rect.top;
|
|
|
|
size_hints->min_width = size_hints->max_width;
|
|
|
|
size_hints->min_height = size_hints->max_height;
|
|
|
|
size_hints->flags |= PMinSize | PMaxSize;
|
|
|
|
}
|
|
|
|
XSetWMNormalHints( display, data->whole_window, size_hints );
|
|
|
|
XFree( size_hints );
|
|
|
|
}
|
2001-04-25 01:28:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-06-04 23:55:17 +02:00
|
|
|
/***********************************************************************
|
2002-08-20 02:36:45 +02:00
|
|
|
* X11DRV_set_wm_hints
|
2001-06-04 23:55:17 +02:00
|
|
|
*
|
|
|
|
* Set the window manager hints for a newly-created window
|
2001-04-25 01:28:52 +02:00
|
|
|
*/
|
2005-01-17 20:17:47 +01:00
|
|
|
void X11DRV_set_wm_hints( Display *display, struct x11drv_win_data *data )
|
2001-04-25 01:28:52 +02:00
|
|
|
{
|
2001-06-04 23:55:17 +02:00
|
|
|
Window group_leader;
|
|
|
|
XClassHint *class_hints;
|
|
|
|
XWMHints* wm_hints;
|
2003-11-20 05:24:18 +01:00
|
|
|
Atom protocols[3];
|
|
|
|
MwmHints mwm_hints;
|
2003-11-20 23:09:51 +01:00
|
|
|
Atom dndVersion = 4;
|
2001-06-04 23:55:17 +02:00
|
|
|
int i;
|
2005-01-17 20:17:47 +01:00
|
|
|
DWORD style = GetWindowLongW( data->hwnd, GWL_STYLE );
|
|
|
|
DWORD ex_style = GetWindowLongW( data->hwnd, GWL_EXSTYLE );
|
|
|
|
HWND owner = GetWindow( data->hwnd, GW_OWNER );
|
|
|
|
|
|
|
|
/* transient for hint */
|
|
|
|
if (owner)
|
|
|
|
{
|
|
|
|
Window owner_win = X11DRV_get_whole_window( owner );
|
|
|
|
wine_tsx11_lock();
|
|
|
|
XSetTransientForHint( display, data->whole_window, owner_win );
|
|
|
|
wine_tsx11_unlock();
|
|
|
|
group_leader = owner_win;
|
|
|
|
}
|
|
|
|
else group_leader = data->whole_window;
|
2001-06-04 23:55:17 +02:00
|
|
|
|
|
|
|
wine_tsx11_lock();
|
|
|
|
|
|
|
|
/* wm protocols */
|
|
|
|
i = 0;
|
2003-11-20 05:24:18 +01:00
|
|
|
protocols[i++] = x11drv_atom(WM_DELETE_WINDOW);
|
|
|
|
protocols[i++] = x11drv_atom(_NET_WM_PING);
|
|
|
|
if (use_take_focus) protocols[i++] = x11drv_atom(WM_TAKE_FOCUS);
|
|
|
|
XChangeProperty( display, data->whole_window, x11drv_atom(WM_PROTOCOLS),
|
|
|
|
XA_ATOM, 32, PropModeReplace, (char *)protocols, i );
|
2001-06-04 23:55:17 +02:00
|
|
|
|
|
|
|
/* class hints */
|
|
|
|
if ((class_hints = XAllocClassHint()))
|
|
|
|
{
|
|
|
|
class_hints->res_name = "wine";
|
|
|
|
class_hints->res_class = "Wine";
|
|
|
|
XSetClassHint( display, data->whole_window, class_hints );
|
|
|
|
XFree( class_hints );
|
|
|
|
}
|
2001-04-25 01:28:52 +02:00
|
|
|
|
2001-06-04 23:55:17 +02:00
|
|
|
/* size hints */
|
2005-01-17 20:17:47 +01:00
|
|
|
set_size_hints( display, data, style );
|
2001-06-04 23:55:17 +02:00
|
|
|
|
|
|
|
/* systray properties (KDE only for now) */
|
2005-01-17 20:17:47 +01:00
|
|
|
if (ex_style & WS_EX_TRAYWINDOW)
|
2001-06-04 23:55:17 +02:00
|
|
|
{
|
|
|
|
int val = 1;
|
2003-11-20 05:24:18 +01:00
|
|
|
XChangeProperty( display, data->whole_window, x11drv_atom(KWM_DOCKWINDOW),
|
|
|
|
x11drv_atom(KWM_DOCKWINDOW), 32, PropModeReplace, (char*)&val, 1 );
|
|
|
|
XChangeProperty( display, data->whole_window, x11drv_atom(_KDE_NET_WM_SYSTEM_TRAY_WINDOW_FOR),
|
|
|
|
XA_WINDOW, 32, PropModeReplace, (char*)&data->whole_window, 1 );
|
2002-01-21 19:41:27 +01:00
|
|
|
}
|
|
|
|
|
2003-05-04 04:27:20 +02:00
|
|
|
/* set the WM_CLIENT_MACHINE and WM_LOCALE_NAME properties */
|
|
|
|
XSetWMProperties(display, data->whole_window, NULL, NULL, NULL, 0, NULL, NULL, NULL);
|
|
|
|
/* set the pid. together, these properties are needed so the window manager can kill us if we freeze */
|
|
|
|
i = getpid();
|
2003-11-20 05:24:18 +01:00
|
|
|
XChangeProperty(display, data->whole_window, x11drv_atom(_NET_WM_PID),
|
|
|
|
XA_CARDINAL, 32, PropModeReplace, (char *)&i, 1);
|
|
|
|
|
2003-12-04 22:54:13 +01:00
|
|
|
/* map WS_EX_TOOLWINDOW to _NET_WM_WINDOW_TYPE_UTILITY */
|
2005-01-17 20:17:47 +01:00
|
|
|
if (ex_style & WS_EX_TOOLWINDOW)
|
2003-12-04 22:54:13 +01:00
|
|
|
{
|
|
|
|
Atom a = x11drv_atom(_NET_WM_WINDOW_TYPE_UTILITY);
|
|
|
|
XChangeProperty(display, data->whole_window, x11drv_atom(_NET_WM_WINDOW_TYPE),
|
|
|
|
XA_ATOM, 32, PropModeReplace, (char*)&a, 1);
|
|
|
|
}
|
|
|
|
|
2003-11-20 05:24:18 +01:00
|
|
|
mwm_hints.flags = MWM_HINTS_FUNCTIONS | MWM_HINTS_DECORATIONS;
|
|
|
|
mwm_hints.functions = 0;
|
2005-01-17 20:17:47 +01:00
|
|
|
if ((style & WS_CAPTION) == WS_CAPTION) mwm_hints.functions |= MWM_FUNC_MOVE;
|
|
|
|
if (style & WS_THICKFRAME) mwm_hints.functions |= MWM_FUNC_MOVE | MWM_FUNC_RESIZE;
|
|
|
|
if (style & WS_MINIMIZEBOX) mwm_hints.functions |= MWM_FUNC_MINIMIZE;
|
|
|
|
if (style & WS_MAXIMIZEBOX) mwm_hints.functions |= MWM_FUNC_MAXIMIZE;
|
|
|
|
if (style & WS_SYSMENU) mwm_hints.functions |= MWM_FUNC_CLOSE;
|
2003-11-20 05:24:18 +01:00
|
|
|
mwm_hints.decorations = 0;
|
2005-01-17 20:17:47 +01:00
|
|
|
if ((style & WS_CAPTION) == WS_CAPTION) mwm_hints.decorations |= MWM_DECOR_TITLE;
|
|
|
|
if (ex_style & WS_EX_DLGMODALFRAME) mwm_hints.decorations |= MWM_DECOR_BORDER;
|
|
|
|
else if (style & WS_THICKFRAME) mwm_hints.decorations |= MWM_DECOR_BORDER | MWM_DECOR_RESIZEH;
|
|
|
|
else if ((style & (WS_DLGFRAME|WS_BORDER)) == WS_DLGFRAME) mwm_hints.decorations |= MWM_DECOR_BORDER;
|
|
|
|
else if (style & WS_BORDER) mwm_hints.decorations |= MWM_DECOR_BORDER;
|
|
|
|
else if (!(style & (WS_CHILD|WS_POPUP))) mwm_hints.decorations |= MWM_DECOR_BORDER;
|
|
|
|
if (style & WS_SYSMENU) mwm_hints.decorations |= MWM_DECOR_MENU;
|
|
|
|
if (style & WS_MINIMIZEBOX) mwm_hints.decorations |= MWM_DECOR_MINIMIZE;
|
|
|
|
if (style & WS_MAXIMIZEBOX) mwm_hints.decorations |= MWM_DECOR_MAXIMIZE;
|
2003-11-20 05:24:18 +01:00
|
|
|
|
|
|
|
XChangeProperty( display, data->whole_window, x11drv_atom(_MOTIF_WM_HINTS),
|
|
|
|
x11drv_atom(_MOTIF_WM_HINTS), 32, PropModeReplace,
|
|
|
|
(char*)&mwm_hints, sizeof(mwm_hints)/sizeof(long) );
|
2001-06-04 23:55:17 +02:00
|
|
|
|
2003-11-20 23:09:51 +01:00
|
|
|
XChangeProperty( display, data->whole_window, x11drv_atom(XdndAware),
|
|
|
|
XA_ATOM, 32, PropModeReplace, (unsigned char*)&dndVersion, 1 );
|
|
|
|
|
2002-09-24 20:36:51 +02:00
|
|
|
wm_hints = XAllocWMHints();
|
2001-06-04 23:55:17 +02:00
|
|
|
wine_tsx11_unlock();
|
2001-07-12 04:49:31 +02:00
|
|
|
|
|
|
|
/* wm hints */
|
2002-09-24 20:36:51 +02:00
|
|
|
if (wm_hints)
|
2001-07-12 04:49:31 +02:00
|
|
|
{
|
|
|
|
wm_hints->flags = InputHint | StateHint | WindowGroupHint;
|
2005-01-17 20:17:47 +01:00
|
|
|
wm_hints->input = !(style & WS_DISABLED);
|
2001-07-12 04:49:31 +02:00
|
|
|
|
2005-01-17 20:17:47 +01:00
|
|
|
set_icon_hints( display, data, wm_hints,
|
|
|
|
(HICON)GetClassLongW( data->hwnd, GCL_HICON ), ex_style );
|
2001-07-12 04:49:31 +02:00
|
|
|
|
2005-01-17 20:17:47 +01:00
|
|
|
wm_hints->initial_state = (style & WS_MINIMIZE) ? IconicState : NormalState;
|
2001-07-12 04:49:31 +02:00
|
|
|
wm_hints->window_group = group_leader;
|
|
|
|
|
|
|
|
wine_tsx11_lock();
|
|
|
|
XSetWMHints( display, data->whole_window, wm_hints );
|
|
|
|
XFree(wm_hints);
|
|
|
|
wine_tsx11_unlock();
|
|
|
|
}
|
2001-04-25 01:28:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-06-04 23:55:17 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* X11DRV_set_iconic_state
|
|
|
|
*
|
|
|
|
* Set the X11 iconic state according to the window style.
|
2001-04-25 01:28:52 +02:00
|
|
|
*/
|
2005-01-17 20:17:47 +01:00
|
|
|
void X11DRV_set_iconic_state( HWND hwnd )
|
2001-04-25 01:28:52 +02:00
|
|
|
{
|
2001-05-16 21:52:29 +02:00
|
|
|
Display *display = thread_display();
|
2005-01-17 20:17:47 +01:00
|
|
|
struct x11drv_win_data *data;
|
|
|
|
RECT rect;
|
2001-06-04 23:55:17 +02:00
|
|
|
XWMHints* wm_hints;
|
2005-01-17 20:17:47 +01:00
|
|
|
DWORD style = GetWindowLongW( hwnd, GWL_STYLE );
|
|
|
|
BOOL iconic = (style & WS_MINIMIZE) != 0;
|
|
|
|
|
|
|
|
if (!(data = X11DRV_get_win_data( hwnd ))) return;
|
|
|
|
|
|
|
|
GetWindowRect( hwnd, &rect );
|
2001-04-25 01:28:52 +02:00
|
|
|
|
2001-06-04 23:55:17 +02:00
|
|
|
wine_tsx11_lock();
|
|
|
|
|
2001-07-12 04:49:31 +02:00
|
|
|
if (iconic) XUnmapWindow( display, data->client_window );
|
2005-01-17 20:17:47 +01:00
|
|
|
else if (!IsRectEmpty( &data->client_rect )) XMapWindow( display, data->client_window );
|
2001-07-12 04:49:31 +02:00
|
|
|
|
2001-06-04 23:55:17 +02:00
|
|
|
if (!(wm_hints = XGetWMHints( display, data->whole_window ))) wm_hints = XAllocWMHints();
|
|
|
|
wm_hints->flags |= StateHint | IconPositionHint;
|
|
|
|
wm_hints->initial_state = iconic ? IconicState : NormalState;
|
2005-01-17 20:17:47 +01:00
|
|
|
wm_hints->icon_x = rect.left;
|
|
|
|
wm_hints->icon_y = rect.top;
|
2001-06-04 23:55:17 +02:00
|
|
|
XSetWMHints( display, data->whole_window, wm_hints );
|
|
|
|
|
2005-01-17 20:17:47 +01:00
|
|
|
if (style & WS_VISIBLE)
|
2001-04-25 01:28:52 +02:00
|
|
|
{
|
2001-06-04 23:55:17 +02:00
|
|
|
if (iconic)
|
|
|
|
XIconifyWindow( display, data->whole_window, DefaultScreen(display) );
|
|
|
|
else
|
2005-01-17 20:17:47 +01:00
|
|
|
if (X11DRV_is_window_rect_mapped( &rect ))
|
2004-04-28 01:32:01 +02:00
|
|
|
XMapWindow( display, data->whole_window );
|
2001-04-25 01:28:52 +02:00
|
|
|
}
|
|
|
|
|
2001-06-04 23:55:17 +02:00
|
|
|
XFree(wm_hints);
|
|
|
|
wine_tsx11_unlock();
|
|
|
|
}
|
|
|
|
|
2001-04-25 01:28:52 +02:00
|
|
|
|
2001-06-04 23:55:17 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* X11DRV_window_to_X_rect
|
|
|
|
*
|
|
|
|
* Convert a rect from client to X window coordinates
|
|
|
|
*/
|
2005-01-17 20:17:47 +01:00
|
|
|
void X11DRV_window_to_X_rect( HWND hwnd, RECT *rect )
|
2001-06-04 23:55:17 +02:00
|
|
|
{
|
2001-07-20 20:37:37 +02:00
|
|
|
RECT rc;
|
2005-01-17 20:17:47 +01:00
|
|
|
DWORD ex_style = GetWindowLongW( hwnd, GWL_EXSTYLE );
|
2001-07-20 20:37:37 +02:00
|
|
|
|
2005-01-17 20:17:47 +01:00
|
|
|
if (!(ex_style & WS_EX_MANAGED)) return;
|
2001-06-04 23:55:17 +02:00
|
|
|
if (IsRectEmpty( rect )) return;
|
|
|
|
|
2001-07-20 20:37:37 +02:00
|
|
|
rc.top = rc.bottom = rc.left = rc.right = 0;
|
2001-06-04 23:55:17 +02:00
|
|
|
|
2005-01-17 20:17:47 +01:00
|
|
|
AdjustWindowRectEx( &rc, GetWindowLongW(hwnd, GWL_STYLE) & ~(WS_HSCROLL|WS_VSCROLL),
|
|
|
|
FALSE, ex_style );
|
2001-06-04 23:55:17 +02:00
|
|
|
|
2001-07-20 20:37:37 +02:00
|
|
|
rect->left -= rc.left;
|
|
|
|
rect->right -= rc.right;
|
|
|
|
rect->top -= rc.top;
|
|
|
|
rect->bottom -= rc.bottom;
|
2001-06-04 23:55:17 +02:00
|
|
|
if (rect->top >= rect->bottom) rect->bottom = rect->top + 1;
|
|
|
|
if (rect->left >= rect->right) rect->right = rect->left + 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* X11DRV_X_to_window_rect
|
|
|
|
*
|
|
|
|
* Opposite of X11DRV_window_to_X_rect
|
|
|
|
*/
|
2005-01-17 20:17:47 +01:00
|
|
|
void X11DRV_X_to_window_rect( HWND hwnd, RECT *rect )
|
2001-06-04 23:55:17 +02:00
|
|
|
{
|
2005-01-17 20:17:47 +01:00
|
|
|
DWORD ex_style = GetWindowLongW( hwnd, GWL_EXSTYLE );
|
|
|
|
|
|
|
|
if (!(ex_style & WS_EX_MANAGED)) return;
|
2001-06-04 23:55:17 +02:00
|
|
|
if (IsRectEmpty( rect )) return;
|
|
|
|
|
2005-01-17 20:17:47 +01:00
|
|
|
AdjustWindowRectEx( rect, GetWindowLongW(hwnd, GWL_STYLE) & ~(WS_HSCROLL|WS_VSCROLL),
|
|
|
|
FALSE, ex_style );
|
2001-04-25 01:28:52 +02:00
|
|
|
|
2001-06-04 23:55:17 +02:00
|
|
|
if (rect->top >= rect->bottom) rect->bottom = rect->top + 1;
|
|
|
|
if (rect->left >= rect->right) rect->right = rect->left + 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* X11DRV_sync_whole_window_position
|
|
|
|
*
|
|
|
|
* Synchronize the X whole window position with the Windows one
|
|
|
|
*/
|
2005-01-17 20:17:47 +01:00
|
|
|
int X11DRV_sync_whole_window_position( Display *display, struct x11drv_win_data *data, int zorder )
|
2001-06-04 23:55:17 +02:00
|
|
|
{
|
|
|
|
XWindowChanges changes;
|
|
|
|
int mask;
|
2005-01-17 20:17:47 +01:00
|
|
|
RECT whole_rect;
|
2001-06-04 23:55:17 +02:00
|
|
|
|
2005-01-17 20:17:47 +01:00
|
|
|
whole_rect = data->window_rect;
|
|
|
|
X11DRV_window_to_X_rect( data->hwnd, &whole_rect );
|
2001-06-04 23:55:17 +02:00
|
|
|
mask = get_window_changes( &changes, &data->whole_rect, &whole_rect );
|
|
|
|
|
|
|
|
if (zorder)
|
|
|
|
{
|
2005-01-17 20:17:47 +01:00
|
|
|
if (is_window_top_level( data->hwnd ))
|
2001-04-25 01:28:52 +02:00
|
|
|
{
|
2003-05-19 21:08:57 +02:00
|
|
|
/* find window that this one must be after */
|
2005-01-17 20:17:47 +01:00
|
|
|
HWND prev = GetWindow( data->hwnd, GW_HWNDPREV );
|
2003-05-19 21:08:57 +02:00
|
|
|
while (prev && !(GetWindowLongW( prev, GWL_STYLE ) & WS_VISIBLE))
|
|
|
|
prev = GetWindow( prev, GW_HWNDPREV );
|
|
|
|
if (!prev) /* top child */
|
|
|
|
{
|
|
|
|
changes.stack_mode = Above;
|
|
|
|
mask |= CWStackMode;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* should use stack_mode Below but most window managers don't get it right */
|
|
|
|
/* so move it above the next one in Z order */
|
2005-01-17 20:17:47 +01:00
|
|
|
HWND next = GetWindow( data->hwnd, GW_HWNDNEXT );
|
2003-05-19 21:08:57 +02:00
|
|
|
while (next && !(GetWindowLongW( next, GWL_STYLE ) & WS_VISIBLE))
|
|
|
|
next = GetWindow( next, GW_HWNDNEXT );
|
|
|
|
if (next)
|
|
|
|
{
|
|
|
|
changes.stack_mode = Above;
|
|
|
|
changes.sibling = X11DRV_get_whole_window(next);
|
|
|
|
mask |= CWStackMode | CWSibling;
|
|
|
|
}
|
|
|
|
}
|
2001-04-25 01:28:52 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2005-01-17 20:17:47 +01:00
|
|
|
HWND next = GetWindow( data->hwnd, GW_HWNDNEXT );
|
2003-10-02 06:47:35 +02:00
|
|
|
|
2005-01-17 20:17:47 +01:00
|
|
|
if (GetAncestor( data->hwnd, GA_PARENT ) == GetDesktopWindow() &&
|
2003-10-03 05:38:05 +02:00
|
|
|
root_window != DefaultRootWindow(display))
|
2003-10-02 06:47:35 +02:00
|
|
|
{
|
|
|
|
/* in desktop mode we need the sibling to belong to the same process */
|
|
|
|
while (next)
|
|
|
|
{
|
2005-01-17 20:17:47 +01:00
|
|
|
if (X11DRV_get_win_data( next )) break;
|
2003-10-02 06:47:35 +02:00
|
|
|
next = GetWindow( next, GW_HWNDNEXT );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-05-19 21:08:57 +02:00
|
|
|
if (!next) /* bottom child */
|
|
|
|
{
|
|
|
|
changes.stack_mode = Below;
|
|
|
|
mask |= CWStackMode;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
changes.stack_mode = Above;
|
|
|
|
changes.sibling = X11DRV_get_whole_window(next);
|
|
|
|
mask |= CWStackMode | CWSibling;
|
|
|
|
}
|
2001-04-25 01:28:52 +02:00
|
|
|
}
|
2001-06-04 23:55:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
data->whole_rect = whole_rect;
|
2001-04-25 01:28:52 +02:00
|
|
|
|
2001-06-04 23:55:17 +02:00
|
|
|
if (mask)
|
|
|
|
{
|
2003-01-08 22:09:25 +01:00
|
|
|
TRACE( "setting win %lx pos %ld,%ld,%ldx%ld after %lx changes=%x\n",
|
2001-06-04 23:55:17 +02:00
|
|
|
data->whole_window, whole_rect.left, whole_rect.top,
|
|
|
|
whole_rect.right - whole_rect.left, whole_rect.bottom - whole_rect.top,
|
|
|
|
changes.sibling, mask );
|
2001-05-16 21:52:29 +02:00
|
|
|
wine_tsx11_lock();
|
2001-06-04 23:55:17 +02:00
|
|
|
XSync( gdi_display, False ); /* flush graphics operations before moving the window */
|
2005-01-17 20:17:47 +01:00
|
|
|
wine_tsx11_unlock();
|
|
|
|
|
|
|
|
if (is_window_top_level( data->hwnd ))
|
2001-06-04 23:55:17 +02:00
|
|
|
{
|
2005-01-17 20:17:47 +01:00
|
|
|
DWORD style = GetWindowLongW( data->hwnd, GWL_STYLE );
|
|
|
|
|
|
|
|
wine_tsx11_lock();
|
|
|
|
if (mask & (CWWidth|CWHeight)) set_size_hints( display, data, style );
|
2001-06-04 23:55:17 +02:00
|
|
|
XReconfigureWMWindow( display, data->whole_window,
|
|
|
|
DefaultScreen(display), mask, &changes );
|
2005-01-17 20:17:47 +01:00
|
|
|
wine_tsx11_unlock();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
wine_tsx11_lock();
|
|
|
|
XConfigureWindow( display, data->whole_window, mask, &changes );
|
|
|
|
wine_tsx11_unlock();
|
2001-06-04 23:55:17 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return mask;
|
|
|
|
}
|
2001-05-16 21:52:29 +02:00
|
|
|
|
2001-04-25 01:28:52 +02:00
|
|
|
|
2001-06-04 23:55:17 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* X11DRV_sync_client_window_position
|
|
|
|
*
|
|
|
|
* Synchronize the X client window position with the Windows one
|
|
|
|
*/
|
2005-01-17 20:17:47 +01:00
|
|
|
int X11DRV_sync_client_window_position( Display *display, struct x11drv_win_data *data,
|
|
|
|
const RECT *new_client_rect )
|
2001-06-04 23:55:17 +02:00
|
|
|
{
|
|
|
|
XWindowChanges changes;
|
|
|
|
int mask;
|
2005-01-17 20:17:47 +01:00
|
|
|
RECT client_rect = *new_client_rect;
|
2001-06-04 23:55:17 +02:00
|
|
|
|
|
|
|
OffsetRect( &client_rect, -data->whole_rect.left, -data->whole_rect.top );
|
|
|
|
|
|
|
|
if ((mask = get_window_changes( &changes, &data->client_rect, &client_rect )))
|
|
|
|
{
|
2005-01-17 20:17:47 +01:00
|
|
|
BOOL is_mapped;
|
2001-06-12 06:02:10 +02:00
|
|
|
|
2003-01-08 22:09:25 +01:00
|
|
|
TRACE( "setting win %lx pos %ld,%ld,%ldx%ld (was %ld,%ld,%ldx%ld) after %lx changes=%x\n",
|
2001-06-04 23:55:17 +02:00
|
|
|
data->client_window, client_rect.left, client_rect.top,
|
|
|
|
client_rect.right - client_rect.left, client_rect.bottom - client_rect.top,
|
|
|
|
data->client_rect.left, data->client_rect.top,
|
|
|
|
data->client_rect.right - data->client_rect.left,
|
|
|
|
data->client_rect.bottom - data->client_rect.top,
|
|
|
|
changes.sibling, mask );
|
2005-01-17 20:17:47 +01:00
|
|
|
|
2001-06-04 23:55:17 +02:00
|
|
|
data->client_rect = client_rect;
|
2005-01-17 20:17:47 +01:00
|
|
|
is_mapped = is_client_window_mapped( data );
|
2001-06-04 23:55:17 +02:00
|
|
|
wine_tsx11_lock();
|
|
|
|
XSync( gdi_display, False ); /* flush graphics operations before moving the window */
|
2005-01-17 20:17:47 +01:00
|
|
|
if (!is_mapped) XUnmapWindow( display, data->client_window );
|
2001-06-04 23:55:17 +02:00
|
|
|
XConfigureWindow( display, data->client_window, mask, &changes );
|
2005-01-17 20:17:47 +01:00
|
|
|
if (is_mapped) XMapWindow( display, data->client_window );
|
2001-05-16 21:52:29 +02:00
|
|
|
wine_tsx11_unlock();
|
2001-06-04 23:55:17 +02:00
|
|
|
}
|
|
|
|
return mask;
|
|
|
|
}
|
2001-05-16 21:52:29 +02:00
|
|
|
|
2001-04-25 01:28:52 +02:00
|
|
|
|
2001-06-04 23:55:17 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* X11DRV_register_window
|
|
|
|
*
|
|
|
|
* Associate an X window to a HWND.
|
|
|
|
*/
|
|
|
|
void X11DRV_register_window( Display *display, HWND hwnd, struct x11drv_win_data *data )
|
|
|
|
{
|
|
|
|
wine_tsx11_lock();
|
|
|
|
XSaveContext( display, data->whole_window, winContext, (char *)hwnd );
|
|
|
|
XSaveContext( display, data->client_window, winContext, (char *)hwnd );
|
|
|
|
wine_tsx11_unlock();
|
|
|
|
}
|
2001-04-25 01:28:52 +02:00
|
|
|
|
|
|
|
|
2001-06-04 23:55:17 +02:00
|
|
|
/**********************************************************************
|
|
|
|
* create_desktop
|
|
|
|
*/
|
2005-01-17 20:17:47 +01:00
|
|
|
static void create_desktop( Display *display, struct x11drv_win_data *data )
|
2001-06-04 23:55:17 +02:00
|
|
|
{
|
2004-12-27 18:03:15 +01:00
|
|
|
VisualID visualid;
|
2001-04-25 01:28:52 +02:00
|
|
|
|
2001-06-04 23:55:17 +02:00
|
|
|
wine_tsx11_lock();
|
2003-11-20 05:24:18 +01:00
|
|
|
winContext = XUniqueContext();
|
|
|
|
XInternAtoms( display, (char **)atom_names, NB_XATOMS - FIRST_XATOM, False, X11DRV_Atoms );
|
2004-12-27 18:03:15 +01:00
|
|
|
visualid = XVisualIDFromVisual(visual);
|
2001-06-04 23:55:17 +02:00
|
|
|
wine_tsx11_unlock();
|
|
|
|
|
2001-10-15 19:56:45 +02:00
|
|
|
whole_window_atom = MAKEINTATOMA( GlobalAddAtomA( "__wine_x11_whole_window" ));
|
|
|
|
client_window_atom = MAKEINTATOMA( GlobalAddAtomA( "__wine_x11_client_window" ));
|
|
|
|
icon_window_atom = MAKEINTATOMA( GlobalAddAtomA( "__wine_x11_icon_window" ));
|
|
|
|
|
2001-06-04 23:55:17 +02:00
|
|
|
data->whole_window = data->client_window = root_window;
|
2005-01-17 20:17:47 +01:00
|
|
|
data->whole_rect = data->client_rect = data->window_rect;
|
2001-06-26 23:10:11 +02:00
|
|
|
|
2005-01-17 20:17:47 +01:00
|
|
|
SetPropA( data->hwnd, whole_window_atom, (HANDLE)root_window );
|
|
|
|
SetPropA( data->hwnd, client_window_atom, (HANDLE)root_window );
|
|
|
|
SetPropA( data->hwnd, "__wine_x11_visual_id", (HANDLE)visualid );
|
2001-06-26 23:10:11 +02:00
|
|
|
|
2003-11-21 06:23:17 +01:00
|
|
|
X11DRV_InitClipboard();
|
2003-11-20 05:24:18 +01:00
|
|
|
|
2001-06-08 21:00:56 +02:00
|
|
|
if (root_window != DefaultRootWindow(display)) X11DRV_create_desktop_thread();
|
2001-06-04 23:55:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* create_whole_window
|
|
|
|
*
|
|
|
|
* Create the whole X window for a given window
|
|
|
|
*/
|
2005-01-17 20:17:47 +01:00
|
|
|
static Window create_whole_window( Display *display, struct x11drv_win_data *data, DWORD style )
|
2001-06-04 23:55:17 +02:00
|
|
|
{
|
|
|
|
int cx, cy, mask;
|
|
|
|
XSetWindowAttributes attr;
|
|
|
|
Window parent;
|
|
|
|
RECT rect;
|
2005-01-17 20:17:47 +01:00
|
|
|
BOOL is_top_level = is_window_top_level( data->hwnd );
|
2001-06-04 23:55:17 +02:00
|
|
|
|
2005-01-17 20:17:47 +01:00
|
|
|
rect = data->window_rect;
|
|
|
|
X11DRV_window_to_X_rect( data->hwnd, &rect );
|
2001-06-04 23:55:17 +02:00
|
|
|
|
|
|
|
if (!(cx = rect.right - rect.left)) cx = 1;
|
|
|
|
if (!(cy = rect.bottom - rect.top)) cy = 1;
|
|
|
|
|
2005-01-17 20:17:47 +01:00
|
|
|
parent = X11DRV_get_client_window( GetAncestor( data->hwnd, GA_PARENT ) );
|
2001-06-04 23:55:17 +02:00
|
|
|
|
2005-01-17 20:17:47 +01:00
|
|
|
mask = get_window_attributes( data, &attr );
|
2001-06-12 06:02:10 +02:00
|
|
|
|
|
|
|
/* set the attributes that don't change over the lifetime of the window */
|
|
|
|
attr.bit_gravity = ForgetGravity;
|
|
|
|
attr.win_gravity = NorthWestGravity;
|
|
|
|
attr.backing_store = NotUseful/*WhenMapped*/;
|
|
|
|
mask |= CWBitGravity | CWWinGravity | CWBackingStore;
|
|
|
|
|
2005-01-17 20:17:47 +01:00
|
|
|
wine_tsx11_lock();
|
|
|
|
|
2001-06-04 23:55:17 +02:00
|
|
|
data->whole_rect = rect;
|
|
|
|
data->whole_window = XCreateWindow( display, parent, rect.left, rect.top, cx, cy,
|
|
|
|
0, screen_depth, InputOutput, visual,
|
|
|
|
mask, &attr );
|
|
|
|
|
2001-07-12 04:49:31 +02:00
|
|
|
if (!data->whole_window)
|
|
|
|
{
|
|
|
|
wine_tsx11_unlock();
|
|
|
|
return 0;
|
|
|
|
}
|
2001-06-04 23:55:17 +02:00
|
|
|
|
|
|
|
/* non-maximized child must be at bottom of Z order */
|
2005-01-17 20:17:47 +01:00
|
|
|
if ((style & (WS_CHILD|WS_MAXIMIZE)) == WS_CHILD)
|
2001-06-04 23:55:17 +02:00
|
|
|
{
|
|
|
|
XWindowChanges changes;
|
|
|
|
changes.stack_mode = Below;
|
|
|
|
XConfigureWindow( display, data->whole_window, CWStackMode, &changes );
|
|
|
|
}
|
|
|
|
|
2001-07-12 04:49:31 +02:00
|
|
|
wine_tsx11_unlock();
|
|
|
|
|
2004-01-21 03:22:26 +01:00
|
|
|
if (is_top_level)
|
|
|
|
{
|
|
|
|
XIM xim = x11drv_thread_data()->xim;
|
|
|
|
if (xim) data->xic = X11DRV_CreateIC( xim, display, data->whole_window );
|
2005-01-17 20:17:47 +01:00
|
|
|
X11DRV_set_wm_hints( display, data );
|
2004-01-21 03:22:26 +01:00
|
|
|
}
|
2001-06-04 23:55:17 +02:00
|
|
|
|
|
|
|
return data->whole_window;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* create_client_window
|
|
|
|
*
|
|
|
|
* Create the client window for a given window
|
|
|
|
*/
|
2005-01-17 20:17:47 +01:00
|
|
|
static Window create_client_window( Display *display, struct x11drv_win_data *data )
|
2001-06-04 23:55:17 +02:00
|
|
|
{
|
2001-06-12 06:02:10 +02:00
|
|
|
RECT rect = data->whole_rect;
|
2001-06-04 23:55:17 +02:00
|
|
|
XSetWindowAttributes attr;
|
2005-01-17 20:17:47 +01:00
|
|
|
BOOL is_mapped;
|
2001-06-04 23:55:17 +02:00
|
|
|
|
|
|
|
OffsetRect( &rect, -data->whole_rect.left, -data->whole_rect.top );
|
|
|
|
data->client_rect = rect;
|
2005-01-17 20:17:47 +01:00
|
|
|
is_mapped = is_client_window_mapped( data );
|
2001-06-04 23:55:17 +02:00
|
|
|
|
2003-01-21 21:16:20 +01:00
|
|
|
attr.event_mask = (ExposureMask | PointerMotionMask |
|
2002-06-14 02:08:40 +02:00
|
|
|
ButtonPressMask | ButtonReleaseMask | EnterWindowMask);
|
2005-01-17 20:17:47 +01:00
|
|
|
attr.bit_gravity = (GetClassLongW( data->hwnd, GCL_STYLE ) & (CS_VREDRAW | CS_HREDRAW)) ?
|
2001-06-04 23:55:17 +02:00
|
|
|
ForgetGravity : NorthWestGravity;
|
|
|
|
attr.backing_store = NotUseful/*WhenMapped*/;
|
|
|
|
|
2001-06-12 06:02:10 +02:00
|
|
|
wine_tsx11_lock();
|
|
|
|
data->client_window = XCreateWindow( display, data->whole_window, 0, 0,
|
|
|
|
max( rect.right - rect.left, 1 ),
|
|
|
|
max( rect.bottom - rect.top, 1 ),
|
|
|
|
0, screen_depth,
|
|
|
|
InputOutput, visual,
|
|
|
|
CWEventMask | CWBitGravity | CWBackingStore, &attr );
|
2005-01-17 20:17:47 +01:00
|
|
|
if (data->client_window && is_mapped) XMapWindow( display, data->client_window );
|
2001-06-12 06:02:10 +02:00
|
|
|
wine_tsx11_unlock();
|
2001-06-04 23:55:17 +02:00
|
|
|
return data->client_window;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*****************************************************************
|
|
|
|
* SetWindowText (X11DRV.@)
|
|
|
|
*/
|
|
|
|
BOOL X11DRV_SetWindowText( HWND hwnd, LPCWSTR text )
|
|
|
|
{
|
|
|
|
Display *display = thread_display();
|
|
|
|
UINT count;
|
|
|
|
char *buffer;
|
2001-10-02 20:44:56 +02:00
|
|
|
char *utf8_buffer;
|
2001-06-04 23:55:17 +02:00
|
|
|
Window win;
|
2003-06-21 01:29:06 +02:00
|
|
|
XTextProperty prop;
|
2001-04-25 01:28:52 +02:00
|
|
|
|
2001-10-15 19:56:45 +02:00
|
|
|
if ((win = X11DRV_get_whole_window( hwnd )))
|
2001-06-04 23:55:17 +02:00
|
|
|
{
|
|
|
|
/* allocate new buffer for window text */
|
2003-07-09 06:22:57 +02:00
|
|
|
count = WideCharToMultiByte(CP_UNIXCP, 0, text, -1, NULL, 0, NULL, NULL);
|
2001-08-22 20:04:00 +02:00
|
|
|
if (!(buffer = HeapAlloc( GetProcessHeap(), 0, count )))
|
2001-04-25 01:28:52 +02:00
|
|
|
{
|
2001-06-04 23:55:17 +02:00
|
|
|
ERR("Not enough memory for window text\n");
|
|
|
|
return FALSE;
|
|
|
|
}
|
2003-07-09 06:22:57 +02:00
|
|
|
WideCharToMultiByte(CP_UNIXCP, 0, text, -1, buffer, count, NULL, NULL);
|
2001-04-25 01:28:52 +02:00
|
|
|
|
2001-10-02 20:44:56 +02:00
|
|
|
count = WideCharToMultiByte(CP_UTF8, 0, text, strlenW(text), NULL, 0, NULL, NULL);
|
|
|
|
if (!(utf8_buffer = HeapAlloc( GetProcessHeap(), 0, count )))
|
|
|
|
{
|
|
|
|
ERR("Not enough memory for window text in UTF-8\n");
|
2004-12-14 12:38:50 +01:00
|
|
|
HeapFree( GetProcessHeap(), 0, buffer );
|
2001-10-02 20:44:56 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
WideCharToMultiByte(CP_UTF8, 0, text, strlenW(text), utf8_buffer, count, NULL, NULL);
|
|
|
|
|
2001-06-04 23:55:17 +02:00
|
|
|
wine_tsx11_lock();
|
2003-06-21 01:29:06 +02:00
|
|
|
if (XmbTextListToTextProperty( display, &buffer, 1, XStdICCTextStyle, &prop ) == Success)
|
|
|
|
{
|
|
|
|
XSetWMName( display, win, &prop );
|
|
|
|
XSetWMIconName( display, win, &prop );
|
|
|
|
XFree( prop.value );
|
|
|
|
}
|
2001-10-02 20:44:56 +02:00
|
|
|
/*
|
|
|
|
Implements a NET_WM UTF-8 title. It should be without a trailing \0,
|
|
|
|
according to the standard
|
|
|
|
( http://www.pps.jussieu.fr/~jch/software/UTF8_STRING/UTF8_STRING.text ).
|
|
|
|
*/
|
2003-11-20 05:24:18 +01:00
|
|
|
XChangeProperty( display, win, x11drv_atom(_NET_WM_NAME), x11drv_atom(UTF8_STRING),
|
|
|
|
8, PropModeReplace, (unsigned char *) utf8_buffer, count);
|
2001-06-04 23:55:17 +02:00
|
|
|
wine_tsx11_unlock();
|
2001-04-25 01:28:52 +02:00
|
|
|
|
2001-10-02 20:44:56 +02:00
|
|
|
HeapFree( GetProcessHeap(), 0, utf8_buffer );
|
2001-06-04 23:55:17 +02:00
|
|
|
HeapFree( GetProcessHeap(), 0, buffer );
|
2001-04-25 01:28:52 +02:00
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* DestroyWindow (X11DRV.@)
|
|
|
|
*/
|
|
|
|
BOOL X11DRV_DestroyWindow( HWND hwnd )
|
|
|
|
{
|
2002-06-14 02:08:40 +02:00
|
|
|
struct x11drv_thread_data *thread_data = x11drv_thread_data();
|
|
|
|
Display *display = thread_data->display;
|
2001-10-15 19:56:45 +02:00
|
|
|
WND *wndPtr = WIN_GetPtr( hwnd );
|
2005-01-17 20:17:47 +01:00
|
|
|
struct x11drv_win_data *data = wndPtr->pDriverData;
|
2001-04-25 01:28:52 +02:00
|
|
|
|
2001-06-04 23:55:17 +02:00
|
|
|
if (!data) goto done;
|
|
|
|
|
|
|
|
if (data->whole_window)
|
2001-04-25 01:28:52 +02:00
|
|
|
{
|
2002-10-31 03:38:20 +01:00
|
|
|
TRACE( "win %p xwin %lx/%lx\n", hwnd, data->whole_window, data->client_window );
|
2002-06-14 02:08:40 +02:00
|
|
|
if (thread_data->cursor_window == data->whole_window) thread_data->cursor_window = None;
|
2002-09-19 01:09:50 +02:00
|
|
|
if (thread_data->last_focus == hwnd) thread_data->last_focus = 0;
|
2001-05-16 21:52:29 +02:00
|
|
|
wine_tsx11_lock();
|
|
|
|
XSync( gdi_display, False ); /* flush any reference to this drawable in GDI queue */
|
2001-06-04 23:55:17 +02:00
|
|
|
XDeleteContext( display, data->whole_window, winContext );
|
|
|
|
XDeleteContext( display, data->client_window, winContext );
|
|
|
|
XDestroyWindow( display, data->whole_window ); /* this destroys client too */
|
2003-01-23 02:28:12 +01:00
|
|
|
if (data->xic)
|
|
|
|
{
|
|
|
|
XUnsetICFocus( data->xic );
|
|
|
|
XDestroyIC( data->xic );
|
|
|
|
}
|
2001-05-16 21:52:29 +02:00
|
|
|
wine_tsx11_unlock();
|
2005-01-17 20:17:47 +01:00
|
|
|
destroy_icon_window( display, data );
|
2001-04-25 01:28:52 +02:00
|
|
|
}
|
2001-06-04 23:55:17 +02:00
|
|
|
|
|
|
|
if (data->hWMIconBitmap) DeleteObject( data->hWMIconBitmap );
|
|
|
|
if (data->hWMIconMask) DeleteObject( data->hWMIconMask);
|
2001-04-25 01:28:52 +02:00
|
|
|
HeapFree( GetProcessHeap(), 0, data );
|
|
|
|
wndPtr->pDriverData = NULL;
|
2001-06-04 23:55:17 +02:00
|
|
|
done:
|
2001-10-15 19:56:45 +02:00
|
|
|
WIN_ReleasePtr( wndPtr );
|
2001-04-25 01:28:52 +02:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-06-04 23:55:17 +02:00
|
|
|
/**********************************************************************
|
|
|
|
* CreateWindow (X11DRV.@)
|
|
|
|
*/
|
2001-06-06 23:26:50 +02:00
|
|
|
BOOL X11DRV_CreateWindow( HWND hwnd, CREATESTRUCTA *cs, BOOL unicode )
|
2001-06-04 23:55:17 +02:00
|
|
|
{
|
|
|
|
Display *display = thread_display();
|
|
|
|
WND *wndPtr;
|
|
|
|
struct x11drv_win_data *data;
|
2004-12-07 18:31:53 +01:00
|
|
|
HWND insert_after;
|
2001-06-12 06:02:10 +02:00
|
|
|
RECT rect;
|
2005-01-17 20:17:47 +01:00
|
|
|
DWORD style;
|
2002-10-29 01:41:42 +01:00
|
|
|
CBT_CREATEWNDA cbtc;
|
2001-06-04 23:55:17 +02:00
|
|
|
BOOL ret = FALSE;
|
|
|
|
|
2002-05-07 03:52:15 +02:00
|
|
|
if (cs->cx > 65535)
|
|
|
|
{
|
|
|
|
ERR( "invalid window width %d\n", cs->cx );
|
|
|
|
cs->cx = 65535;
|
|
|
|
}
|
|
|
|
if (cs->cy > 65535)
|
|
|
|
{
|
2004-08-26 20:11:29 +02:00
|
|
|
ERR( "invalid window height %d\n", cs->cy );
|
2002-05-07 03:52:15 +02:00
|
|
|
cs->cy = 65535;
|
|
|
|
}
|
2004-12-09 17:58:00 +01:00
|
|
|
if (cs->cx < 0)
|
|
|
|
{
|
|
|
|
ERR( "invalid window width %d\n", cs->cx );
|
|
|
|
cs->cx = 0;
|
|
|
|
}
|
|
|
|
if (cs->cy < 0)
|
|
|
|
{
|
|
|
|
ERR( "invalid window height %d\n", cs->cy );
|
|
|
|
cs->cy = 0;
|
|
|
|
}
|
2002-05-07 03:52:15 +02:00
|
|
|
|
2001-06-04 23:55:17 +02:00
|
|
|
if (!(data = HeapAlloc(GetProcessHeap(), 0, sizeof(*data)))) return FALSE;
|
2005-01-17 20:17:47 +01:00
|
|
|
data->hwnd = hwnd;
|
2001-06-04 23:55:17 +02:00
|
|
|
data->whole_window = 0;
|
|
|
|
data->client_window = 0;
|
|
|
|
data->icon_window = 0;
|
2003-01-23 02:28:12 +01:00
|
|
|
data->xic = 0;
|
2001-06-04 23:55:17 +02:00
|
|
|
data->hWMIconBitmap = 0;
|
|
|
|
data->hWMIconMask = 0;
|
|
|
|
|
2001-10-22 21:08:33 +02:00
|
|
|
wndPtr = WIN_GetPtr( hwnd );
|
2001-06-04 23:55:17 +02:00
|
|
|
wndPtr->pDriverData = data;
|
2001-06-12 06:02:10 +02:00
|
|
|
|
2001-10-22 21:08:33 +02:00
|
|
|
/* initialize the dimensions before sending WM_GETMINMAXINFO */
|
|
|
|
SetRect( &rect, cs->x, cs->y, cs->x + cs->cx, cs->y + cs->cy );
|
2004-12-07 18:31:53 +01:00
|
|
|
X11DRV_set_window_pos( hwnd, 0, &rect, &rect, SWP_NOZORDER, 0 );
|
2001-10-22 21:08:33 +02:00
|
|
|
|
2001-06-12 06:02:10 +02:00
|
|
|
if (!wndPtr->parent)
|
|
|
|
{
|
2005-01-17 20:17:47 +01:00
|
|
|
create_desktop( display, data );
|
2001-10-22 21:08:33 +02:00
|
|
|
WIN_ReleasePtr( wndPtr );
|
2001-06-12 06:02:10 +02:00
|
|
|
return TRUE;
|
|
|
|
}
|
2005-01-17 20:17:47 +01:00
|
|
|
WIN_ReleasePtr( wndPtr );
|
2001-06-12 06:02:10 +02:00
|
|
|
|
2005-01-17 20:17:47 +01:00
|
|
|
if (!create_whole_window( display, data, cs->style )) goto failed;
|
|
|
|
if (!create_client_window( display, data )) goto failed;
|
2003-11-21 22:48:36 +01:00
|
|
|
wine_tsx11_lock();
|
|
|
|
XSync( display, False );
|
|
|
|
wine_tsx11_unlock();
|
2001-06-12 06:02:10 +02:00
|
|
|
|
2001-10-15 19:56:45 +02:00
|
|
|
SetPropA( hwnd, whole_window_atom, (HANDLE)data->whole_window );
|
|
|
|
SetPropA( hwnd, client_window_atom, (HANDLE)data->client_window );
|
2001-06-26 23:10:11 +02:00
|
|
|
|
2002-01-09 20:09:06 +01:00
|
|
|
/* Call the WH_CBT hook */
|
2002-10-29 01:41:42 +01:00
|
|
|
cbtc.lpcs = cs;
|
2003-10-24 06:21:46 +02:00
|
|
|
cbtc.hwndInsertAfter = HWND_TOP;
|
2002-10-29 01:41:42 +01:00
|
|
|
if (HOOK_CallHooks( WH_CBT, HCBT_CREATEWND, (WPARAM)hwnd, (LPARAM)&cbtc, unicode ))
|
2002-01-09 20:09:06 +01:00
|
|
|
{
|
2002-10-29 01:41:42 +01:00
|
|
|
TRACE("CBT-hook returned !0\n");
|
|
|
|
goto failed;
|
2002-01-09 20:09:06 +01:00
|
|
|
}
|
|
|
|
|
2001-10-22 21:08:33 +02:00
|
|
|
/* Send the WM_GETMINMAXINFO message and fix the size if needed */
|
|
|
|
if ((cs->style & WS_THICKFRAME) || !(cs->style & (WS_POPUP | WS_CHILD)))
|
|
|
|
{
|
|
|
|
POINT maxSize, maxPos, minTrack, maxTrack;
|
|
|
|
|
|
|
|
WINPOS_GetMinMaxInfo( hwnd, &maxSize, &maxPos, &minTrack, &maxTrack);
|
|
|
|
if (maxSize.x < cs->cx) cs->cx = maxSize.x;
|
|
|
|
if (maxSize.y < cs->cy) cs->cy = maxSize.y;
|
|
|
|
if (cs->cx < 0) cs->cx = 0;
|
|
|
|
if (cs->cy < 0) cs->cy = 0;
|
|
|
|
|
|
|
|
SetRect( &rect, cs->x, cs->y, cs->x + cs->cx, cs->y + cs->cy );
|
2005-01-17 20:17:47 +01:00
|
|
|
if (!X11DRV_set_window_pos( hwnd, 0, &rect, &rect, SWP_NOZORDER, 0 )) return FALSE;
|
2001-10-22 21:08:33 +02:00
|
|
|
}
|
|
|
|
|
2001-06-12 06:02:10 +02:00
|
|
|
/* send WM_NCCREATE */
|
2002-10-31 03:38:20 +01:00
|
|
|
TRACE( "hwnd %p cs %d,%d %dx%d\n", hwnd, cs->x, cs->y, cs->cx, cs->cy );
|
2001-06-06 23:26:50 +02:00
|
|
|
if (unicode)
|
2001-06-04 23:55:17 +02:00
|
|
|
ret = SendMessageW( hwnd, WM_NCCREATE, 0, (LPARAM)cs );
|
|
|
|
else
|
|
|
|
ret = SendMessageA( hwnd, WM_NCCREATE, 0, (LPARAM)cs );
|
2001-06-08 21:00:56 +02:00
|
|
|
if (!ret)
|
|
|
|
{
|
2001-10-22 21:08:33 +02:00
|
|
|
WARN("aborted by WM_xxCREATE!\n");
|
2001-06-08 21:00:56 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
2001-06-04 23:55:17 +02:00
|
|
|
|
2005-01-17 20:17:47 +01:00
|
|
|
/* make sure the window is still valid */
|
|
|
|
if (!(data = X11DRV_get_win_data( hwnd ))) return FALSE;
|
|
|
|
X11DRV_sync_window_style( display, data );
|
2001-06-04 23:55:17 +02:00
|
|
|
|
2001-06-12 06:02:10 +02:00
|
|
|
/* send WM_NCCALCSIZE */
|
2005-01-17 20:17:47 +01:00
|
|
|
rect = data->window_rect;
|
2001-06-12 06:02:10 +02:00
|
|
|
SendMessageW( hwnd, WM_NCCALCSIZE, FALSE, (LPARAM)&rect );
|
2001-10-22 21:08:33 +02:00
|
|
|
|
|
|
|
if (!(wndPtr = WIN_GetPtr(hwnd))) return FALSE;
|
2004-12-07 18:31:53 +01:00
|
|
|
if (rect.left < wndPtr->rectWindow.left) rect.left = wndPtr->rectWindow.left;
|
|
|
|
if (rect.right > wndPtr->rectWindow.right) rect.right = wndPtr->rectWindow.right;
|
|
|
|
if (rect.top < wndPtr->rectWindow.top) rect.top = wndPtr->rectWindow.top;
|
|
|
|
if (rect.bottom > wndPtr->rectWindow.bottom) rect.bottom = wndPtr->rectWindow.bottom;
|
2001-06-12 06:02:10 +02:00
|
|
|
if (rect.left > rect.right || rect.top > rect.bottom) rect = wndPtr->rectWindow;
|
2004-12-07 18:31:53 +01:00
|
|
|
|
|
|
|
/* yes, even if the CBT hook was called with HWND_TOP */
|
|
|
|
insert_after = ((wndPtr->dwStyle & (WS_CHILD|WS_MAXIMIZE)) == WS_CHILD) ? HWND_BOTTOM : HWND_TOP;
|
|
|
|
|
|
|
|
X11DRV_set_window_pos( hwnd, insert_after, &wndPtr->rectWindow, &rect, 0, 0 );
|
2001-06-12 06:02:10 +02:00
|
|
|
X11DRV_register_window( display, hwnd, data );
|
2001-06-04 23:55:17 +02:00
|
|
|
|
2003-01-08 22:09:25 +01:00
|
|
|
TRACE( "win %p window %ld,%ld,%ld,%ld client %ld,%ld,%ld,%ld whole %ld,%ld,%ld,%ld X client %ld,%ld,%ld,%ld xwin %x/%x\n",
|
2001-06-04 23:55:17 +02:00
|
|
|
hwnd, wndPtr->rectWindow.left, wndPtr->rectWindow.top,
|
|
|
|
wndPtr->rectWindow.right, wndPtr->rectWindow.bottom,
|
|
|
|
wndPtr->rectClient.left, wndPtr->rectClient.top,
|
|
|
|
wndPtr->rectClient.right, wndPtr->rectClient.bottom,
|
|
|
|
data->whole_rect.left, data->whole_rect.top,
|
|
|
|
data->whole_rect.right, data->whole_rect.bottom,
|
|
|
|
data->client_rect.left, data->client_rect.top,
|
|
|
|
data->client_rect.right, data->client_rect.bottom,
|
|
|
|
(unsigned int)data->whole_window, (unsigned int)data->client_window );
|
|
|
|
|
2001-10-22 21:08:33 +02:00
|
|
|
WIN_ReleasePtr( wndPtr );
|
2001-06-04 23:55:17 +02:00
|
|
|
|
2001-06-06 23:26:50 +02:00
|
|
|
if (unicode)
|
2001-06-04 23:55:17 +02:00
|
|
|
ret = (SendMessageW( hwnd, WM_CREATE, 0, (LPARAM)cs ) != -1);
|
|
|
|
else
|
|
|
|
ret = (SendMessageA( hwnd, WM_CREATE, 0, (LPARAM)cs ) != -1);
|
|
|
|
|
|
|
|
if (!ret)
|
|
|
|
{
|
|
|
|
WIN_UnlinkWindow( hwnd );
|
2001-06-19 21:16:41 +02:00
|
|
|
return FALSE;
|
2001-06-04 23:55:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Send the size messages */
|
|
|
|
|
2001-06-08 21:00:56 +02:00
|
|
|
if (!(wndPtr = WIN_FindWndPtr(hwnd))) return FALSE;
|
2001-06-04 23:55:17 +02:00
|
|
|
if (!(wndPtr->flags & WIN_NEED_SIZE))
|
|
|
|
{
|
|
|
|
/* send it anyway */
|
|
|
|
if (((wndPtr->rectClient.right-wndPtr->rectClient.left) <0)
|
|
|
|
||((wndPtr->rectClient.bottom-wndPtr->rectClient.top)<0))
|
|
|
|
WARN("sending bogus WM_SIZE message 0x%08lx\n",
|
|
|
|
MAKELONG(wndPtr->rectClient.right-wndPtr->rectClient.left,
|
|
|
|
wndPtr->rectClient.bottom-wndPtr->rectClient.top));
|
|
|
|
SendMessageW( hwnd, WM_SIZE, SIZE_RESTORED,
|
|
|
|
MAKELONG(wndPtr->rectClient.right-wndPtr->rectClient.left,
|
|
|
|
wndPtr->rectClient.bottom-wndPtr->rectClient.top));
|
|
|
|
SendMessageW( hwnd, WM_MOVE, 0,
|
|
|
|
MAKELONG( wndPtr->rectClient.left, wndPtr->rectClient.top ) );
|
|
|
|
}
|
2005-01-17 20:17:47 +01:00
|
|
|
WIN_ReleaseWndPtr( wndPtr );
|
2001-06-04 23:55:17 +02:00
|
|
|
|
|
|
|
/* Show the window, maximizing or minimizing if needed */
|
|
|
|
|
2005-01-17 20:17:47 +01:00
|
|
|
style = GetWindowLongW( hwnd, GWL_STYLE );
|
|
|
|
if (style & (WS_MINIMIZE | WS_MAXIMIZE))
|
2001-06-04 23:55:17 +02:00
|
|
|
{
|
|
|
|
extern UINT WINPOS_MinMaximize( HWND hwnd, UINT cmd, LPRECT rect ); /*FIXME*/
|
|
|
|
|
|
|
|
RECT newPos;
|
2005-01-17 20:17:47 +01:00
|
|
|
UINT swFlag = (style & WS_MINIMIZE) ? SW_MINIMIZE : SW_MAXIMIZE;
|
|
|
|
WIN_SetStyle( hwnd, style & ~(WS_MAXIMIZE | WS_MINIMIZE) );
|
2001-06-04 23:55:17 +02:00
|
|
|
WINPOS_MinMaximize( hwnd, swFlag, &newPos );
|
2005-01-17 20:17:47 +01:00
|
|
|
swFlag = ((style & WS_CHILD) || GetActiveWindow())
|
2001-06-04 23:55:17 +02:00
|
|
|
? SWP_NOACTIVATE | SWP_NOZORDER | SWP_FRAMECHANGED
|
|
|
|
: SWP_NOZORDER | SWP_FRAMECHANGED;
|
|
|
|
SetWindowPos( hwnd, 0, newPos.left, newPos.top,
|
|
|
|
newPos.right, newPos.bottom, swFlag );
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
failed:
|
2001-10-22 21:08:33 +02:00
|
|
|
X11DRV_DestroyWindow( hwnd );
|
2001-06-04 23:55:17 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
2005-01-17 20:17:47 +01:00
|
|
|
* X11DRV_get_win_data
|
2001-06-04 23:55:17 +02:00
|
|
|
*
|
2005-01-17 20:17:47 +01:00
|
|
|
* Return the X11 data structure associated with a window.
|
2001-06-04 23:55:17 +02:00
|
|
|
*/
|
2005-01-17 20:17:47 +01:00
|
|
|
struct x11drv_win_data *X11DRV_get_win_data( HWND hwnd )
|
2001-06-04 23:55:17 +02:00
|
|
|
{
|
2005-01-17 20:17:47 +01:00
|
|
|
struct x11drv_win_data *ret = NULL;
|
2001-10-15 19:56:45 +02:00
|
|
|
WND *win = WIN_GetPtr( hwnd );
|
|
|
|
|
2005-01-17 20:17:47 +01:00
|
|
|
if (win && win != WND_OTHER_PROCESS)
|
2001-06-04 23:55:17 +02:00
|
|
|
{
|
2005-01-17 20:17:47 +01:00
|
|
|
ret = win->pDriverData;
|
2001-10-15 19:56:45 +02:00
|
|
|
WIN_ReleasePtr( win );
|
2001-06-04 23:55:17 +02:00
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-01-17 20:17:47 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* X11DRV_get_client_window
|
|
|
|
*
|
|
|
|
* Return the X window associated with the client area of a window
|
|
|
|
*/
|
|
|
|
Window X11DRV_get_client_window( HWND hwnd )
|
|
|
|
{
|
|
|
|
struct x11drv_win_data *data = X11DRV_get_win_data( hwnd );
|
|
|
|
|
|
|
|
if (!data) return (Window)GetPropA( hwnd, client_window_atom );
|
|
|
|
return data->client_window;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-06-04 23:55:17 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* X11DRV_get_whole_window
|
|
|
|
*
|
|
|
|
* Return the X window associated with the full area of a window
|
|
|
|
*/
|
|
|
|
Window X11DRV_get_whole_window( HWND hwnd )
|
|
|
|
{
|
2005-01-17 20:17:47 +01:00
|
|
|
struct x11drv_win_data *data = X11DRV_get_win_data( hwnd );
|
2001-10-15 19:56:45 +02:00
|
|
|
|
2005-01-17 20:17:47 +01:00
|
|
|
if (!data) return (Window)GetPropA( hwnd, whole_window_atom );
|
|
|
|
return data->whole_window;
|
2001-06-04 23:55:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-01-23 02:28:12 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* X11DRV_get_ic
|
|
|
|
*
|
|
|
|
* Return the X input context associated with a window
|
|
|
|
*/
|
|
|
|
XIC X11DRV_get_ic( HWND hwnd )
|
|
|
|
{
|
2005-01-17 20:17:47 +01:00
|
|
|
struct x11drv_win_data *data = X11DRV_get_win_data( hwnd );
|
2003-01-23 02:28:12 +01:00
|
|
|
|
2005-01-17 20:17:47 +01:00
|
|
|
if (!data) return 0;
|
|
|
|
return data->xic;
|
2003-01-23 02:28:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-04-25 01:28:52 +02:00
|
|
|
/*****************************************************************
|
|
|
|
* SetParent (X11DRV.@)
|
|
|
|
*/
|
|
|
|
HWND X11DRV_SetParent( HWND hwnd, HWND parent )
|
|
|
|
{
|
2001-05-16 21:52:29 +02:00
|
|
|
Display *display = thread_display();
|
2001-04-25 01:28:52 +02:00
|
|
|
WND *wndPtr;
|
|
|
|
HWND retvalue;
|
|
|
|
|
|
|
|
/* Windows hides the window first, then shows it again
|
|
|
|
* including the WM_SHOWWINDOW messages and all */
|
2001-10-16 23:58:58 +02:00
|
|
|
BOOL was_visible = ShowWindow( hwnd, SW_HIDE );
|
|
|
|
|
|
|
|
if (!IsWindow( parent )) return 0;
|
|
|
|
if (!(wndPtr = WIN_GetPtr(hwnd)) || wndPtr == WND_OTHER_PROCESS) return 0;
|
2001-04-25 01:28:52 +02:00
|
|
|
|
2001-10-10 22:28:17 +02:00
|
|
|
retvalue = wndPtr->parent; /* old parent */
|
2001-09-14 02:24:39 +02:00
|
|
|
if (parent != retvalue)
|
2001-04-25 01:28:52 +02:00
|
|
|
{
|
2001-06-04 23:55:17 +02:00
|
|
|
struct x11drv_win_data *data = wndPtr->pDriverData;
|
2005-01-17 20:17:47 +01:00
|
|
|
Window new_parent = X11DRV_get_client_window( parent );
|
2001-06-04 23:55:17 +02:00
|
|
|
|
2001-08-28 20:44:52 +02:00
|
|
|
WIN_LinkWindow( hwnd, parent, HWND_TOP );
|
2001-04-25 01:28:52 +02:00
|
|
|
|
2001-06-04 23:55:17 +02:00
|
|
|
if (parent != GetDesktopWindow()) /* a child window */
|
2001-04-25 01:28:52 +02:00
|
|
|
{
|
2001-10-16 23:58:58 +02:00
|
|
|
if (!(wndPtr->dwStyle & WS_CHILD))
|
2001-04-25 01:28:52 +02:00
|
|
|
{
|
2004-09-22 21:14:08 +02:00
|
|
|
HMENU menu = (HMENU)SetWindowLongPtrW( hwnd, GWLP_ID, 0 );
|
2001-09-14 02:24:39 +02:00
|
|
|
if (menu) DestroyMenu( menu );
|
2001-04-25 01:28:52 +02:00
|
|
|
}
|
|
|
|
}
|
2001-06-04 23:55:17 +02:00
|
|
|
|
2005-01-17 20:17:47 +01:00
|
|
|
if (is_window_top_level( data->hwnd )) X11DRV_set_wm_hints( display, data );
|
|
|
|
X11DRV_sync_window_style( display, data );
|
2001-06-04 23:55:17 +02:00
|
|
|
wine_tsx11_lock();
|
2005-01-17 20:17:47 +01:00
|
|
|
XReparentWindow( display, data->whole_window, new_parent,
|
2001-06-04 23:55:17 +02:00
|
|
|
data->whole_rect.left, data->whole_rect.top );
|
|
|
|
wine_tsx11_unlock();
|
2001-04-25 01:28:52 +02:00
|
|
|
}
|
2001-10-16 23:58:58 +02:00
|
|
|
WIN_ReleasePtr( wndPtr );
|
2001-04-25 01:28:52 +02:00
|
|
|
|
|
|
|
/* SetParent additionally needs to make hwnd the topmost window
|
|
|
|
in the x-order and send the expected WM_WINDOWPOSCHANGING and
|
2002-06-01 01:06:46 +02:00
|
|
|
WM_WINDOWPOSCHANGED notification messages.
|
2001-04-25 01:28:52 +02:00
|
|
|
*/
|
|
|
|
SetWindowPos( hwnd, HWND_TOPMOST, 0, 0, 0, 0,
|
2001-10-16 23:58:58 +02:00
|
|
|
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE | (was_visible ? SWP_SHOWWINDOW : 0) );
|
2001-04-25 01:28:52 +02:00
|
|
|
/* FIXME: a WM_MOVE is also generated (in the DefWindowProc handler
|
|
|
|
* for WM_WINDOWPOSCHANGED) in Windows, should probably remove SWP_NOMOVE */
|
|
|
|
|
|
|
|
return retvalue;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*****************************************************************
|
|
|
|
* SetFocus (X11DRV.@)
|
|
|
|
*
|
|
|
|
* Set the X focus.
|
|
|
|
* Explicit colormap management seems to work only with OLVWM.
|
|
|
|
*/
|
|
|
|
void X11DRV_SetFocus( HWND hwnd )
|
|
|
|
{
|
2001-05-16 21:52:29 +02:00
|
|
|
Display *display = thread_display();
|
2001-04-25 01:28:52 +02:00
|
|
|
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. */
|
2001-08-24 02:26:59 +02:00
|
|
|
if (root_window != DefaultRootWindow(display)) return;
|
2001-04-25 01:28:52 +02:00
|
|
|
|
|
|
|
if (!hwnd) /* If setting the focus to 0, uninstall the colormap */
|
|
|
|
{
|
2003-11-21 01:17:33 +01:00
|
|
|
wine_tsx11_lock();
|
2001-04-25 01:28:52 +02:00
|
|
|
if (X11DRV_PALETTE_PaletteFlags & X11DRV_PALETTE_PRIVATE)
|
2003-11-21 01:17:33 +01:00
|
|
|
XUninstallColormap( display, X11DRV_PALETTE_PaletteXColormap );
|
|
|
|
wine_tsx11_unlock();
|
2001-08-24 02:26:59 +02:00
|
|
|
return;
|
2001-04-25 01:28:52 +02:00
|
|
|
}
|
2001-08-24 02:26:59 +02:00
|
|
|
|
|
|
|
hwnd = GetAncestor( hwnd, GA_ROOT );
|
|
|
|
if (GetWindowLongW( hwnd, GWL_EXSTYLE ) & WS_EX_MANAGED) return;
|
|
|
|
if (!(win = X11DRV_get_whole_window( hwnd ))) return;
|
|
|
|
|
|
|
|
/* Set X focus and install colormap */
|
|
|
|
wine_tsx11_lock();
|
|
|
|
if (XGetWindowAttributes( display, win, &win_attr ) &&
|
|
|
|
(win_attr.map_state == IsViewable))
|
2001-04-25 01:28:52 +02:00
|
|
|
{
|
2001-08-24 02:26:59 +02:00
|
|
|
/* If window is not viewable, don't change anything */
|
2001-04-25 01:28:52 +02:00
|
|
|
|
2001-08-24 02:26:59 +02:00
|
|
|
/* we must not use CurrentTime (ICCCM), so try to use last message time instead */
|
|
|
|
/* FIXME: this is not entirely correct */
|
|
|
|
XSetInputFocus( display, win, RevertToParent,
|
2005-01-14 18:06:40 +01:00
|
|
|
/* CurrentTime */
|
|
|
|
GetMessageTime() - EVENT_x11_time_to_win32_time(0));
|
2001-08-24 02:26:59 +02:00
|
|
|
if (X11DRV_PALETTE_PaletteFlags & X11DRV_PALETTE_PRIVATE)
|
|
|
|
XInstallColormap( display, X11DRV_PALETTE_PaletteXColormap );
|
|
|
|
}
|
|
|
|
wine_tsx11_unlock();
|
2001-04-25 01:28:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2001-07-02 21:59:40 +02:00
|
|
|
* SetWindowIcon (X11DRV.@)
|
2001-04-25 01:28:52 +02:00
|
|
|
*
|
|
|
|
* hIcon or hIconSm has changed (or is being initialised for the
|
|
|
|
* first time). Complete the X11 driver-specific initialisation
|
|
|
|
* and set the window hints.
|
|
|
|
*
|
|
|
|
* This is not entirely correct, may need to create
|
|
|
|
* an icon window and set the pixmap as a background
|
|
|
|
*/
|
2004-01-01 00:51:52 +01:00
|
|
|
void X11DRV_SetWindowIcon( HWND hwnd, UINT type, HICON icon )
|
2001-04-25 01:28:52 +02:00
|
|
|
{
|
2001-05-16 21:52:29 +02:00
|
|
|
Display *display = thread_display();
|
2005-01-17 20:17:47 +01:00
|
|
|
struct x11drv_win_data *data;
|
|
|
|
DWORD ex_style;
|
2001-04-25 01:28:52 +02:00
|
|
|
|
2004-01-01 00:51:52 +01:00
|
|
|
if (type != ICON_BIG) return; /* nothing to do here */
|
2001-04-25 01:28:52 +02:00
|
|
|
|
2005-01-17 20:17:47 +01:00
|
|
|
if (!(data = X11DRV_get_win_data( hwnd ))) return;
|
2001-10-15 19:56:45 +02:00
|
|
|
|
2005-01-17 20:17:47 +01:00
|
|
|
ex_style = GetWindowLongW( hwnd, GWL_EXSTYLE );
|
|
|
|
if (ex_style & WS_EX_MANAGED)
|
2001-04-25 01:28:52 +02:00
|
|
|
{
|
2002-09-24 20:36:51 +02:00
|
|
|
XWMHints* wm_hints;
|
2001-04-25 01:28:52 +02:00
|
|
|
|
2002-09-24 20:36:51 +02:00
|
|
|
wine_tsx11_lock();
|
2005-01-17 20:17:47 +01:00
|
|
|
if (!(wm_hints = XGetWMHints( display, data->whole_window ))) wm_hints = XAllocWMHints();
|
2002-09-24 20:36:51 +02:00
|
|
|
wine_tsx11_unlock();
|
2001-04-25 01:28:52 +02:00
|
|
|
if (wm_hints)
|
|
|
|
{
|
2005-01-17 20:17:47 +01:00
|
|
|
set_icon_hints( display, data, wm_hints, icon, ex_style );
|
2002-09-24 20:36:51 +02:00
|
|
|
wine_tsx11_lock();
|
2005-01-17 20:17:47 +01:00
|
|
|
XSetWMHints( display, data->whole_window, wm_hints );
|
2002-09-24 20:36:51 +02:00
|
|
|
XFree( wm_hints );
|
|
|
|
wine_tsx11_unlock();
|
2001-04-25 01:28:52 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|