winex11: Explicitly request creation of the thread display where necessary.
This commit is contained in:
parent
9d53a1ae2b
commit
e7044cb8f8
|
@ -365,11 +365,14 @@ static void intern_atoms(void)
|
|||
int i, count, len;
|
||||
char **names;
|
||||
Atom *atoms;
|
||||
Display *display;
|
||||
|
||||
for (format = ClipFormats, count = 0; format; format = format->NextFormat)
|
||||
if (!format->drvData) count++;
|
||||
if (!count) return;
|
||||
|
||||
display = thread_init_display();
|
||||
|
||||
names = HeapAlloc( GetProcessHeap(), 0, count * sizeof(*names) );
|
||||
atoms = HeapAlloc( GetProcessHeap(), 0, count * sizeof(*atoms) );
|
||||
|
||||
|
@ -382,7 +385,7 @@ static void intern_atoms(void)
|
|||
}
|
||||
|
||||
wine_tsx11_lock();
|
||||
XInternAtoms( thread_display(), names, count, False, atoms );
|
||||
XInternAtoms( display, names, count, False, atoms );
|
||||
wine_tsx11_unlock();
|
||||
|
||||
for (format = ClipFormats, i = 0; format; format = format->NextFormat) {
|
||||
|
@ -754,7 +757,7 @@ static BOOL X11DRV_CLIPBOARD_UpdateCache(LPCLIPBOARDINFO lpcbinfo)
|
|||
{
|
||||
X11DRV_EmptyClipboard(TRUE);
|
||||
|
||||
if (X11DRV_CLIPBOARD_QueryAvailableData(thread_display(), lpcbinfo) < 0)
|
||||
if (X11DRV_CLIPBOARD_QueryAvailableData(thread_init_display(), lpcbinfo) < 0)
|
||||
{
|
||||
ERR("Failed to cache clipboard data owned by another process.\n");
|
||||
bret = FALSE;
|
||||
|
@ -2296,7 +2299,7 @@ int X11DRV_AcquireClipboard(HWND hWndClipWindow)
|
|||
{
|
||||
DWORD procid;
|
||||
Window owner;
|
||||
Display *display = thread_display();
|
||||
Display *display;
|
||||
|
||||
TRACE(" %p\n", hWndClipWindow);
|
||||
|
||||
|
@ -2325,6 +2328,7 @@ int X11DRV_AcquireClipboard(HWND hWndClipWindow)
|
|||
}
|
||||
|
||||
owner = thread_selection_wnd();
|
||||
display = thread_display();
|
||||
|
||||
wine_tsx11_lock();
|
||||
|
||||
|
@ -2508,7 +2512,7 @@ BOOL X11DRV_GetClipboardData(UINT wFormat, HANDLE16* phData16, HANDLE* phData32)
|
|||
if ((lpRender = X11DRV_CLIPBOARD_LookupData(wFormat)))
|
||||
{
|
||||
if ( !lpRender->hData32 )
|
||||
X11DRV_CLIPBOARD_RenderFormat(thread_display(), lpRender);
|
||||
X11DRV_CLIPBOARD_RenderFormat(thread_init_display(), lpRender);
|
||||
|
||||
/* Convert between 32 -> 16 bit data, if necessary */
|
||||
if (lpRender->hData32 && !lpRender->hData16)
|
||||
|
|
|
@ -132,7 +132,7 @@ Window X11DRV_create_desktop( UINT width, UINT height )
|
|||
{
|
||||
XSetWindowAttributes win_attr;
|
||||
Window win;
|
||||
Display *display = thread_display();
|
||||
Display *display = thread_init_display();
|
||||
|
||||
wine_tsx11_lock();
|
||||
|
||||
|
|
|
@ -1953,7 +1953,7 @@ void X11DRV_MappingNotify( HWND dummy, XEvent *event )
|
|||
*/
|
||||
SHORT X11DRV_VkKeyScanEx(WCHAR wChar, HKL hkl)
|
||||
{
|
||||
Display *display = thread_display();
|
||||
Display *display = thread_init_display();
|
||||
KeyCode keycode;
|
||||
KeySym keysym;
|
||||
int i, index;
|
||||
|
@ -2045,7 +2045,7 @@ SHORT X11DRV_VkKeyScanEx(WCHAR wChar, HKL hkl)
|
|||
*/
|
||||
UINT X11DRV_MapVirtualKeyEx(UINT wCode, UINT wMapType, HKL hkl)
|
||||
{
|
||||
Display *display = thread_display();
|
||||
Display *display = thread_init_display();
|
||||
|
||||
#define returnMVK(value) { TRACE("returning 0x%x.\n",value); return value; }
|
||||
|
||||
|
@ -2188,6 +2188,7 @@ UINT X11DRV_MapVirtualKeyEx(UINT wCode, UINT wMapType, HKL hkl)
|
|||
*/
|
||||
INT X11DRV_GetKeyNameText(LONG lParam, LPWSTR lpBuffer, INT nSize)
|
||||
{
|
||||
Display *display = thread_init_display();
|
||||
int vkey, ansi, scanCode;
|
||||
KeyCode keyc;
|
||||
int keyi;
|
||||
|
@ -2260,7 +2261,7 @@ INT X11DRV_GetKeyNameText(LONG lParam, LPWSTR lpBuffer, INT nSize)
|
|||
{
|
||||
wine_tsx11_lock();
|
||||
keyc = (KeyCode) keyi;
|
||||
keys = XKeycodeToKeysym(thread_display(), keyc, 0);
|
||||
keys = XKeycodeToKeysym(display, keyc, 0);
|
||||
name = XKeysymToString(keys);
|
||||
wine_tsx11_unlock();
|
||||
TRACE("found scan=%04x keyc=%04x keysym=%04x string=%s\n",
|
||||
|
@ -2380,7 +2381,7 @@ static char KEYBOARD_MapDeadKeysym(KeySym keysym)
|
|||
INT X11DRV_ToUnicodeEx(UINT virtKey, UINT scanCode, LPBYTE lpKeyState,
|
||||
LPWSTR bufW, int bufW_size, UINT flags, HKL hkl)
|
||||
{
|
||||
Display *display = thread_display();
|
||||
Display *display = thread_init_display();
|
||||
XKeyEvent e;
|
||||
KeySym keysym = 0;
|
||||
INT ret;
|
||||
|
@ -2638,6 +2639,6 @@ found:
|
|||
void X11DRV_Beep(void)
|
||||
{
|
||||
wine_tsx11_lock();
|
||||
XBell(thread_display(), 0);
|
||||
XBell(gdi_display, 0);
|
||||
wine_tsx11_unlock();
|
||||
}
|
||||
|
|
|
@ -950,7 +950,7 @@ void X11DRV_SetCursor( CURSORICONINFO *lpCursor )
|
|||
*/
|
||||
BOOL X11DRV_SetCursorPos( INT x, INT y )
|
||||
{
|
||||
Display *display = thread_display();
|
||||
Display *display = thread_init_display();
|
||||
POINT pt;
|
||||
|
||||
TRACE( "warping to (%d,%d)\n", x, y );
|
||||
|
@ -979,7 +979,7 @@ BOOL X11DRV_SetCursorPos( INT x, INT y )
|
|||
*/
|
||||
BOOL X11DRV_GetCursorPos(LPPOINT pos)
|
||||
{
|
||||
Display *display = thread_display();
|
||||
Display *display = thread_init_display();
|
||||
Window root, child;
|
||||
int rootX, rootY, winX, winY;
|
||||
unsigned int xstate;
|
||||
|
|
|
@ -423,7 +423,7 @@ int wine_notify_icon( DWORD msg, NOTIFYICONDATAW *data )
|
|||
switch (msg)
|
||||
{
|
||||
case NIM_ADD:
|
||||
if (!get_systray_selection_owner( thread_display() ))
|
||||
if (!get_systray_selection_owner( thread_init_display() ))
|
||||
return -1; /* fall back to default handling */
|
||||
ret = add_icon( data );
|
||||
break;
|
||||
|
|
|
@ -1431,11 +1431,13 @@ static void destroy_whole_window( Display *display, struct x11drv_win_data *data
|
|||
*/
|
||||
void X11DRV_SetWindowText( HWND hwnd, LPCWSTR text )
|
||||
{
|
||||
Display *display = thread_display();
|
||||
Window win;
|
||||
|
||||
if ((win = X11DRV_get_whole_window( hwnd )) && win != DefaultRootWindow(display))
|
||||
if ((win = X11DRV_get_whole_window( hwnd )) && win != DefaultRootWindow(gdi_display))
|
||||
{
|
||||
Display *display = thread_init_display();
|
||||
sync_window_text( display, win, text );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -1446,7 +1448,6 @@ void X11DRV_SetWindowText( HWND hwnd, LPCWSTR text )
|
|||
*/
|
||||
void X11DRV_SetWindowStyle( HWND hwnd, DWORD old_style )
|
||||
{
|
||||
Display *display = thread_display();
|
||||
struct x11drv_win_data *data;
|
||||
DWORD new_style, changed;
|
||||
|
||||
|
@ -1462,6 +1463,7 @@ void X11DRV_SetWindowStyle( HWND hwnd, DWORD old_style )
|
|||
|
||||
if (data->whole_window && is_window_rect_mapped( &data->window_rect ))
|
||||
{
|
||||
Display *display = thread_display();
|
||||
set_wm_hints( display, data );
|
||||
if (!data->mapped) map_window( display, data, new_style );
|
||||
}
|
||||
|
@ -1474,7 +1476,7 @@ void X11DRV_SetWindowStyle( HWND hwnd, DWORD old_style )
|
|||
{
|
||||
wine_tsx11_lock();
|
||||
data->wm_hints->input = !(new_style & WS_DISABLED);
|
||||
XSetWMHints( display, data->whole_window, data->wm_hints );
|
||||
XSetWMHints( thread_display(), data->whole_window, data->wm_hints );
|
||||
wine_tsx11_unlock();
|
||||
}
|
||||
}
|
||||
|
@ -1619,10 +1621,10 @@ BOOL X11DRV_CreateDesktopWindow( HWND hwnd )
|
|||
*/
|
||||
BOOL X11DRV_CreateWindow( HWND hwnd )
|
||||
{
|
||||
Display *display = thread_display();
|
||||
|
||||
if (hwnd == GetDesktopWindow() && root_window != DefaultRootWindow( display ))
|
||||
if (hwnd == GetDesktopWindow() && root_window != DefaultRootWindow( gdi_display ))
|
||||
{
|
||||
Display *display = thread_init_display();
|
||||
|
||||
/* the desktop win data can't be created lazily */
|
||||
if (!create_desktop_win_data( display, hwnd )) return FALSE;
|
||||
}
|
||||
|
@ -1654,11 +1656,13 @@ struct x11drv_win_data *X11DRV_get_win_data( HWND hwnd )
|
|||
*/
|
||||
struct x11drv_win_data *X11DRV_create_win_data( HWND hwnd )
|
||||
{
|
||||
Display *display = thread_display();
|
||||
Display *display;
|
||||
struct x11drv_win_data *data;
|
||||
HWND parent;
|
||||
|
||||
if (!(parent = GetAncestor( hwnd, GA_PARENT ))) return NULL; /* desktop */
|
||||
|
||||
display = thread_init_display();
|
||||
if (!(data = alloc_win_data( display, hwnd ))) return NULL;
|
||||
|
||||
GetWindowRect( hwnd, &data->window_rect );
|
||||
|
@ -1913,8 +1917,8 @@ void X11DRV_SetWindowPos( HWND hwnd, HWND insert_after, UINT swp_flags,
|
|||
const RECT *rectWindow, const RECT *rectClient,
|
||||
const RECT *visible_rect, const RECT *valid_rects )
|
||||
{
|
||||
struct x11drv_thread_data *thread_data = x11drv_init_thread_data();
|
||||
Display *display = thread_data->display;
|
||||
struct x11drv_thread_data *thread_data;
|
||||
Display *display;
|
||||
struct x11drv_win_data *data = X11DRV_get_win_data( hwnd );
|
||||
DWORD new_style = GetWindowLongW( hwnd, GWL_STYLE );
|
||||
RECT old_whole_rect, old_client_rect;
|
||||
|
@ -1927,6 +1931,9 @@ void X11DRV_SetWindowPos( HWND hwnd, HWND insert_after, UINT swp_flags,
|
|||
if (!(data = X11DRV_create_win_data( hwnd ))) return;
|
||||
}
|
||||
|
||||
thread_data = x11drv_thread_data();
|
||||
display = thread_data->display;
|
||||
|
||||
/* check if we need to switch the window to managed */
|
||||
if (!data->managed && data->whole_window && is_window_managed( hwnd, swp_flags, rectWindow ))
|
||||
{
|
||||
|
|
|
@ -108,11 +108,12 @@ static LRESULT WINAPI GrabWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM
|
|||
static void GrabPointer(BOOL grab)
|
||||
{
|
||||
if(grab) {
|
||||
Display *display = thread_display();
|
||||
Window window = X11DRV_get_whole_window(GetFocus());
|
||||
if(window)
|
||||
if(window && display)
|
||||
{
|
||||
wine_tsx11_lock();
|
||||
XSetInputFocus(thread_display(), window, RevertToParent, CurrentTime);
|
||||
XSetInputFocus(display, window, RevertToParent, CurrentTime);
|
||||
wine_tsx11_unlock();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -525,7 +525,19 @@ static inline struct x11drv_thread_data *x11drv_thread_data(void)
|
|||
return TlsGetValue( thread_data_tls_index );
|
||||
}
|
||||
|
||||
static inline Display *thread_display(void) { return x11drv_init_thread_data()->display; }
|
||||
/* retrieve the thread display, or NULL if not created yet */
|
||||
static inline Display *thread_display(void)
|
||||
{
|
||||
struct x11drv_thread_data *data = x11drv_thread_data();
|
||||
if (!data) return NULL;
|
||||
return data->display;
|
||||
}
|
||||
|
||||
/* retrieve the thread display, creating it if needed */
|
||||
static inline Display *thread_init_display(void)
|
||||
{
|
||||
return x11drv_init_thread_data()->display;
|
||||
}
|
||||
|
||||
static inline size_t get_property_size( int format, unsigned long count )
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue