Commit e705764c authored by Alexandre Julliard's avatar Alexandre Julliard

winex11: Pass the display as parameter to a few more functions instead of using thread_display().

parent 06a1407c
...@@ -441,7 +441,7 @@ static inline BOOL can_activate_window( HWND hwnd ) ...@@ -441,7 +441,7 @@ static inline BOOL can_activate_window( HWND hwnd )
/********************************************************************** /**********************************************************************
* set_focus * set_focus
*/ */
static void set_focus( HWND hwnd, Time time ) static void set_focus( Display *display, HWND hwnd, Time time )
{ {
HWND focus; HWND focus;
Window win; Window win;
...@@ -457,7 +457,7 @@ static void set_focus( HWND hwnd, Time time ) ...@@ -457,7 +457,7 @@ static void set_focus( HWND hwnd, Time time )
{ {
TRACE( "setting focus to %p (%lx) time=%ld\n", focus, win, time ); TRACE( "setting focus to %p (%lx) time=%ld\n", focus, win, time );
wine_tsx11_lock(); wine_tsx11_lock();
XSetInputFocus( thread_display(), win, RevertToParent, time ); XSetInputFocus( display, win, RevertToParent, time );
wine_tsx11_unlock(); wine_tsx11_unlock();
} }
} }
...@@ -532,7 +532,7 @@ static void handle_wm_protocols( HWND hwnd, XClientMessageEvent *event ) ...@@ -532,7 +532,7 @@ static void handle_wm_protocols( HWND hwnd, XClientMessageEvent *event )
MAKELONG(HTCAPTION,WM_LBUTTONDOWN) ); MAKELONG(HTCAPTION,WM_LBUTTONDOWN) );
if (ma != MA_NOACTIVATEANDEAT && ma != MA_NOACTIVATE) if (ma != MA_NOACTIVATEANDEAT && ma != MA_NOACTIVATE)
{ {
set_focus( hwnd, event_time ); set_focus( event->display, hwnd, event_time );
return; return;
} }
} }
...@@ -541,7 +541,7 @@ static void handle_wm_protocols( HWND hwnd, XClientMessageEvent *event ) ...@@ -541,7 +541,7 @@ static void handle_wm_protocols( HWND hwnd, XClientMessageEvent *event )
if (hwnd) hwnd = GetAncestor( hwnd, GA_ROOT ); if (hwnd) hwnd = GetAncestor( hwnd, GA_ROOT );
if (!hwnd) hwnd = GetActiveWindow(); if (!hwnd) hwnd = GetActiveWindow();
if (!hwnd) hwnd = last_focus; if (!hwnd) hwnd = last_focus;
if (hwnd && can_activate_window(hwnd)) set_focus( hwnd, event_time ); if (hwnd && can_activate_window(hwnd)) set_focus( event->display, hwnd, event_time );
} }
else if (protocol == x11drv_atom(_NET_WM_PING)) else if (protocol == x11drv_atom(_NET_WM_PING))
{ {
...@@ -599,7 +599,7 @@ static void X11DRV_FocusIn( HWND hwnd, XEvent *xev ) ...@@ -599,7 +599,7 @@ static void X11DRV_FocusIn( HWND hwnd, XEvent *xev )
if (hwnd) hwnd = GetAncestor( hwnd, GA_ROOT ); if (hwnd) hwnd = GetAncestor( hwnd, GA_ROOT );
if (!hwnd) hwnd = GetActiveWindow(); if (!hwnd) hwnd = GetActiveWindow();
if (!hwnd) hwnd = x11drv_thread_data()->last_focus; if (!hwnd) hwnd = x11drv_thread_data()->last_focus;
if (hwnd && can_activate_window(hwnd)) set_focus( hwnd, CurrentTime ); if (hwnd && can_activate_window(hwnd)) set_focus( event->display, hwnd, CurrentTime );
} }
else SetForegroundWindow( hwnd ); else SetForegroundWindow( hwnd );
} }
...@@ -639,10 +639,10 @@ static void X11DRV_FocusOut( HWND hwnd, XEvent *xev ) ...@@ -639,10 +639,10 @@ static void X11DRV_FocusOut( HWND hwnd, XEvent *xev )
getting the focus is a Wine window */ getting the focus is a Wine window */
wine_tsx11_lock(); wine_tsx11_lock();
XGetInputFocus( thread_display(), &focus_win, &revert ); XGetInputFocus( event->display, &focus_win, &revert );
if (focus_win) if (focus_win)
{ {
if (XFindContext( thread_display(), focus_win, winContext, (char **)&hwnd_tmp ) != 0) if (XFindContext( event->display, focus_win, winContext, (char **)&hwnd_tmp ) != 0)
focus_win = 0; focus_win = 0;
} }
wine_tsx11_unlock(); wine_tsx11_unlock();
......
...@@ -1937,7 +1937,7 @@ void X11DRV_MappingNotify( HWND dummy, XEvent *event ) ...@@ -1937,7 +1937,7 @@ void X11DRV_MappingNotify( HWND dummy, XEvent *event )
wine_tsx11_lock(); wine_tsx11_lock();
XRefreshKeyboardMapping(&event->xmapping); XRefreshKeyboardMapping(&event->xmapping);
wine_tsx11_unlock(); wine_tsx11_unlock();
X11DRV_InitKeyboard( thread_display() ); X11DRV_InitKeyboard( event->xmapping.display );
hwnd = GetFocus(); hwnd = GetFocus();
if (!hwnd) hwnd = GetActiveWindow(); if (!hwnd) hwnd = GetActiveWindow();
......
...@@ -230,9 +230,8 @@ static Window get_systray_selection_owner( Display *display ) ...@@ -230,9 +230,8 @@ static Window get_systray_selection_owner( Display *display )
/* dock the given X window with the NETWM system tray */ /* dock the given X window with the NETWM system tray */
static void dock_systray_window( HWND hwnd, Window systray_window ) static void dock_systray_window( Display *display, HWND hwnd, Window systray_window )
{ {
Display *display = thread_display();
struct x11drv_win_data *data; struct x11drv_win_data *data;
XEvent ev; XEvent ev;
XSetWindowAttributes attr; XSetWindowAttributes attr;
...@@ -284,6 +283,7 @@ static BOOL show_icon( struct tray_icon *icon ) ...@@ -284,6 +283,7 @@ static BOOL show_icon( struct tray_icon *icon )
RECT rect; RECT rect;
static BOOL class_registered; static BOOL class_registered;
Window systray_window; Window systray_window;
Display *display = thread_display();
TRACE( "id=0x%x, hwnd=%p\n", icon->id, icon->owner ); TRACE( "id=0x%x, hwnd=%p\n", icon->id, icon->owner );
...@@ -308,7 +308,7 @@ static BOOL show_icon( struct tray_icon *icon ) ...@@ -308,7 +308,7 @@ static BOOL show_icon( struct tray_icon *icon )
class_registered = TRUE; class_registered = TRUE;
} }
if (!(systray_window = get_systray_selection_owner( thread_display() ))) return FALSE; if (!(systray_window = get_systray_selection_owner( display ))) return FALSE;
rect.left = 0; rect.left = 0;
rect.top = 0; rect.top = 0;
...@@ -320,7 +320,7 @@ static BOOL show_icon( struct tray_icon *icon ) ...@@ -320,7 +320,7 @@ static BOOL show_icon( struct tray_icon *icon )
rect.right - rect.left, rect.bottom - rect.top, rect.right - rect.left, rect.bottom - rect.top,
NULL, NULL, NULL, icon ); NULL, NULL, NULL, icon );
create_tooltip( icon ); create_tooltip( icon );
dock_systray_window( icon->window, systray_window ); dock_systray_window( display, icon->window, systray_window );
SetTimer( icon->window, 1, 1000, NULL ); SetTimer( icon->window, 1, 1000, NULL );
ShowWindow( icon->window, SW_SHOWNA ); ShowWindow( icon->window, SW_SHOWNA );
return TRUE; return TRUE;
......
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