Commit c8ea1e50 authored by Alexandre Julliard's avatar Alexandre Julliard

winex11: Avoid passing a window data structure to functions that can send messages.

parent c982e5f6
......@@ -1080,7 +1080,7 @@ static void X11DRV_GravityNotify( HWND hwnd, XEvent *xev )
/***********************************************************************
* get_window_wm_state
*/
static int get_window_wm_state( Display *display, struct x11drv_win_data *data )
static int get_window_wm_state( Display *display, Window window )
{
struct
{
......@@ -1091,7 +1091,7 @@ static int get_window_wm_state( Display *display, struct x11drv_win_data *data )
int format, ret = -1;
unsigned long count, remaining;
if (!XGetWindowProperty( display, data->whole_window, x11drv_atom(WM_STATE), 0,
if (!XGetWindowProperty( display, window, x11drv_atom(WM_STATE), 0,
sizeof(*state)/sizeof(CARD32), False, x11drv_atom(WM_STATE),
&type, &format, &count, &remaining, (unsigned char **)&state ))
{
......@@ -1108,11 +1108,13 @@ static int get_window_wm_state( Display *display, struct x11drv_win_data *data )
*
* Handle a PropertyNotify for WM_STATE.
*/
static void handle_wm_state_notify( struct x11drv_win_data *data, XPropertyEvent *event,
BOOL update_window )
static void handle_wm_state_notify( HWND hwnd, XPropertyEvent *event, BOOL update_window )
{
struct x11drv_win_data *data = X11DRV_get_win_data( hwnd );
DWORD style;
if (!data) return;
switch(event->state)
{
case PropertyDelete:
......@@ -1122,7 +1124,7 @@ static void handle_wm_state_notify( struct x11drv_win_data *data, XPropertyEvent
case PropertyNewValue:
{
int old_state = data->wm_state;
int new_state = get_window_wm_state( event->display, data );
int new_state = get_window_wm_state( event->display, data->whole_window );
if (new_state != -1 && new_state != data->wm_state)
{
TRACE( "%p/%lx: new WM_STATE %d from %d\n",
......@@ -1179,12 +1181,9 @@ static void handle_wm_state_notify( struct x11drv_win_data *data, XPropertyEvent
static void X11DRV_PropertyNotify( HWND hwnd, XEvent *xev )
{
XPropertyEvent *event = &xev->xproperty;
struct x11drv_win_data *data;
if (!hwnd) return;
if (!(data = X11DRV_get_win_data( hwnd ))) return;
if (event->atom == x11drv_atom(WM_STATE)) handle_wm_state_notify( data, event, TRUE );
if (event->atom == x11drv_atom(WM_STATE)) handle_wm_state_notify( hwnd, event, TRUE );
}
......@@ -1199,11 +1198,13 @@ static Bool is_wm_state_notify( Display *display, XEvent *event, XPointer arg )
/***********************************************************************
* wait_for_withdrawn_state
*/
void wait_for_withdrawn_state( Display *display, struct x11drv_win_data *data, BOOL set )
void wait_for_withdrawn_state( HWND hwnd, BOOL set )
{
Display *display = thread_display();
struct x11drv_win_data *data = X11DRV_get_win_data( hwnd );
DWORD end = GetTickCount() + 2000;
if (!data->managed) return;
if (!data || !data->managed) return;
TRACE( "waiting for window %p/%lx to become %swithdrawn\n",
data->hwnd, data->whole_window, set ? "" : "not " );
......@@ -1218,7 +1219,7 @@ void wait_for_withdrawn_state( Display *display, struct x11drv_win_data *data, B
count++;
if (XFilterEvent( &event, None )) continue; /* filtered, ignore it */
if (event.type == DestroyNotify) call_event_handler( display, &event );
else handle_wm_state_notify( data, &event.xproperty, FALSE );
else handle_wm_state_notify( hwnd, &event.xproperty, FALSE );
}
if (!count)
......
......@@ -1305,14 +1305,17 @@ BOOL CDECL X11DRV_ClipCursor( LPCRECT clip )
/***********************************************************************
* move_resize_window
*/
void move_resize_window( Display *display, struct x11drv_win_data *data, int dir )
void move_resize_window( HWND hwnd, int dir )
{
Display *display = thread_display();
DWORD pt;
int x, y, rootX, rootY, button = 0;
XEvent xev;
Window root, child;
Window win, root, child;
unsigned int xstate;
if (!(win = X11DRV_get_whole_window( hwnd ))) return;
pt = GetMessagePos();
x = (short)LOWORD( pt );
y = (short)HIWORD( pt );
......@@ -1321,11 +1324,10 @@ void move_resize_window( Display *display, struct x11drv_win_data *data, int dir
else if (GetKeyState( VK_MBUTTON ) & 0x8000) button = 2;
else if (GetKeyState( VK_RBUTTON ) & 0x8000) button = 3;
TRACE( "hwnd %p/%lx, x %d, y %d, dir %d, button %d\n",
data->hwnd, data->whole_window, x, y, dir, button );
TRACE( "hwnd %p/%lx, x %d, y %d, dir %d, button %d\n", hwnd, win, x, y, dir, button );
xev.xclient.type = ClientMessage;
xev.xclient.window = data->whole_window;
xev.xclient.window = win;
xev.xclient.message_type = x11drv_atom(_NET_WM_MOVERESIZE);
xev.xclient.serial = 0;
xev.xclient.display = display;
......@@ -1363,7 +1365,7 @@ void move_resize_window( Display *display, struct x11drv_win_data *data, int dir
input.u.mi.dwFlags = button_up_flags[button - 1] | MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE;
input.u.mi.time = GetTickCount();
input.u.mi.dwExtraInfo = 0;
__wine_send_input( data->hwnd, &input );
__wine_send_input( hwnd, &input );
}
while (PeekMessageW( &msg, 0, 0, 0, PM_REMOVE ))
......@@ -1379,7 +1381,7 @@ void move_resize_window( Display *display, struct x11drv_win_data *data, int dir
MsgWaitForMultipleObjects( 0, NULL, FALSE, 100, QS_ALLINPUT );
}
TRACE( "hwnd %p/%lx done\n", data->hwnd, data->whole_window );
TRACE( "hwnd %p/%lx done\n", hwnd, win );
}
......
......@@ -510,21 +510,20 @@ static BOOL init_systray(void)
/* dock the given icon with the NETWM system tray */
static void dock_systray_icon( Display *display, struct tray_icon *icon, Window systray_window )
{
struct x11drv_win_data *data;
Window window;
XEvent ev;
XSetWindowAttributes attr;
icon->window = CreateWindowW( icon_classname, NULL, WS_CLIPSIBLINGS | WS_POPUP,
CW_USEDEFAULT, CW_USEDEFAULT, icon_cx, icon_cy,
NULL, NULL, NULL, icon );
if (!(data = X11DRV_get_win_data( icon->window ))) return;
TRACE( "icon window %p/%lx managed %u\n", data->hwnd, data->whole_window, data->managed );
make_window_embedded( display, data );
make_window_embedded( icon->window );
create_tooltip( icon );
ShowWindow( icon->window, SW_SHOWNA );
if (!(window = X11DRV_get_whole_window( icon->window ))) return;
TRACE( "icon window %p/%lx\n", icon->window, window );
/* send the docking request message */
ev.xclient.type = ClientMessage;
ev.xclient.window = systray_window;
......@@ -532,13 +531,13 @@ static void dock_systray_icon( Display *display, struct tray_icon *icon, Window
ev.xclient.format = 32;
ev.xclient.data.l[0] = CurrentTime;
ev.xclient.data.l[1] = SYSTEM_TRAY_REQUEST_DOCK;
ev.xclient.data.l[2] = data->whole_window;
ev.xclient.data.l[2] = window;
ev.xclient.data.l[3] = 0;
ev.xclient.data.l[4] = 0;
XSendEvent( display, systray_window, False, NoEventMask, &ev );
attr.background_pixmap = ParentRelative;
attr.bit_gravity = ForgetGravity;
XChangeWindowAttributes( display, data->whole_window, CWBackPixmap | CWBitGravity, &attr );
XChangeWindowAttributes( display, window, CWBackPixmap | CWBitGravity, &attr );
}
/* dock systray windows again with the new owner */
......
......@@ -562,11 +562,11 @@ extern BOOL has_gl_drawable( HWND hwnd ) DECLSPEC_HIDDEN;
extern void sync_gl_drawable( HWND hwnd, const RECT *visible_rect, const RECT *client_rect ) DECLSPEC_HIDDEN;
extern void destroy_gl_drawable( HWND hwnd ) DECLSPEC_HIDDEN;
extern void wait_for_withdrawn_state( Display *display, struct x11drv_win_data *data, BOOL set ) DECLSPEC_HIDDEN;
extern void wait_for_withdrawn_state( HWND hwnd, BOOL set ) DECLSPEC_HIDDEN;
extern Window init_clip_window(void) DECLSPEC_HIDDEN;
extern void update_user_time( Time time ) DECLSPEC_HIDDEN;
extern void update_net_wm_states( Display *display, struct x11drv_win_data *data ) DECLSPEC_HIDDEN;
extern void make_window_embedded( Display *display, struct x11drv_win_data *data ) DECLSPEC_HIDDEN;
extern void make_window_embedded( HWND hwnd ) 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;
......@@ -610,7 +610,7 @@ extern LRESULT clip_cursor_notify( HWND hwnd, HWND new_clip_hwnd ) DECLSPEC_HIDD
extern void ungrab_clipping_window(void) DECLSPEC_HIDDEN;
extern void reset_clipping_window(void) DECLSPEC_HIDDEN;
extern BOOL clip_fullscreen_window( HWND hwnd, BOOL reset ) DECLSPEC_HIDDEN;
extern void move_resize_window( Display *display, struct x11drv_win_data *data, int dir ) DECLSPEC_HIDDEN;
extern void move_resize_window( HWND hwnd, int dir ) DECLSPEC_HIDDEN;
extern void X11DRV_InitKeyboard( Display *display ) DECLSPEC_HIDDEN;
extern DWORD CDECL X11DRV_MsgWaitForMultipleObjectsEx( DWORD count, const HANDLE *handles, DWORD timeout,
DWORD mask, DWORD flags ) DECLSPEC_HIDDEN;
......
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