winex11: Remove the remaining X11 locking calls.

This commit is contained in:
Alexandre Julliard 2012-08-16 16:46:37 +02:00
parent 26fb3d4a69
commit cf1be58706
14 changed files with 44 additions and 205 deletions

View File

@ -112,15 +112,15 @@ static Pixmap BRUSH_DitherColor( COLORREF color, int depth)
Pixmap pixmap; Pixmap pixmap;
GC gc; GC gc;
wine_tsx11_lock(); XLockDisplay( gdi_display );
if (!ditherImage) if (!ditherImage)
{ {
ditherImage = XCreateImage( gdi_display, visual, depth, ZPixmap, 0, ditherImage = XCreateImage( gdi_display, visual, depth, ZPixmap, 0,
NULL, MATRIX_SIZE, MATRIX_SIZE, 32, 0 ); NULL, MATRIX_SIZE, MATRIX_SIZE, 32, 0 );
if (!ditherImage) if (!ditherImage)
{ {
wine_tsx11_unlock();
ERR("Could not create dither image\n"); ERR("Could not create dither image\n");
XUnlockDisplay( gdi_display );
return 0; return 0;
} }
ditherImage->data = HeapAlloc( GetProcessHeap(), 0, ditherImage->data = HeapAlloc( GetProcessHeap(), 0,
@ -152,7 +152,7 @@ static Pixmap BRUSH_DitherColor( COLORREF color, int depth)
gc = XCreateGC( gdi_display, pixmap, 0, NULL ); gc = XCreateGC( gdi_display, pixmap, 0, NULL );
XPutImage( gdi_display, pixmap, gc, ditherImage, 0, 0, 0, 0, MATRIX_SIZE, MATRIX_SIZE ); XPutImage( gdi_display, pixmap, gc, ditherImage, 0, 0, 0, 0, MATRIX_SIZE, MATRIX_SIZE );
XFreeGC( gdi_display, gc ); XFreeGC( gdi_display, gc );
wine_tsx11_unlock(); XUnlockDisplay( gdi_display );
return pixmap; return pixmap;
} }

View File

@ -2157,11 +2157,9 @@ static int X11DRV_CLIPBOARD_QueryAvailableData(Display *display, LPCLIPBOARDINFO
/* /*
* Query the selection owner for the TARGETS property * Query the selection owner for the TARGETS property
*/ */
wine_tsx11_lock();
if ((use_primary_selection && XGetSelectionOwner(display,XA_PRIMARY)) || if ((use_primary_selection && XGetSelectionOwner(display,XA_PRIMARY)) ||
XGetSelectionOwner(display,x11drv_atom(CLIPBOARD))) XGetSelectionOwner(display,x11drv_atom(CLIPBOARD)))
{ {
wine_tsx11_unlock();
if (use_primary_selection && (X11DRV_CLIPBOARD_QueryTargets(display, w, XA_PRIMARY, x11drv_atom(TARGETS), &xe))) if (use_primary_selection && (X11DRV_CLIPBOARD_QueryTargets(display, w, XA_PRIMARY, x11drv_atom(TARGETS), &xe)))
selectionCacheSrc = XA_PRIMARY; selectionCacheSrc = XA_PRIMARY;
else if (X11DRV_CLIPBOARD_QueryTargets(display, w, x11drv_atom(CLIPBOARD), x11drv_atom(TARGETS), &xe)) else if (X11DRV_CLIPBOARD_QueryTargets(display, w, x11drv_atom(CLIPBOARD), x11drv_atom(TARGETS), &xe))
@ -2190,24 +2188,13 @@ static int X11DRV_CLIPBOARD_QueryAvailableData(Display *display, LPCLIPBOARDINFO
} }
} }
} }
else /* No selection owner so report 0 targets available */ else return 0; /* No selection owner so report 0 targets available */
{
wine_tsx11_unlock();
return 0;
}
/* Read the TARGETS property contents */ /* Read the TARGETS property contents */
wine_tsx11_lock(); if (!XGetWindowProperty(display, xe.xselection.requestor, xe.xselection.property,
if(XGetWindowProperty(display, xe.xselection.requestor, xe.xselection.property,
0, 0x3FFF, True, AnyPropertyType/*XA_ATOM*/, &atype, &aformat, &cSelectionTargets, 0, 0x3FFF, True, AnyPropertyType/*XA_ATOM*/, &atype, &aformat, &cSelectionTargets,
&remain, (unsigned char**)&targetList) != Success) &remain, (unsigned char**)&targetList) != Success)
{ {
wine_tsx11_unlock();
WARN("Failed to read TARGETS property\n");
}
else
{
wine_tsx11_unlock();
TRACE("Type %lx,Format %d,nItems %ld, Remain %ld\n", TRACE("Type %lx,Format %d,nItems %ld, Remain %ld\n",
atype, aformat, cSelectionTargets, remain); atype, aformat, cSelectionTargets, remain);
/* /*
@ -2234,6 +2221,7 @@ static int X11DRV_CLIPBOARD_QueryAvailableData(Display *display, LPCLIPBOARDINFO
/* Free the list of targets */ /* Free the list of targets */
XFree(targetList); XFree(targetList);
} }
else WARN("Failed to read TARGETS property\n");
return cSelectionTargets; return cSelectionTargets;
} }
@ -2339,11 +2327,9 @@ static BOOL X11DRV_CLIPBOARD_GetProperty(Display *display, Window w, Atom prop,
for (;;) for (;;)
{ {
wine_tsx11_lock();
if (XGetWindowProperty(display, w, prop, pos, INT_MAX / 4, False, if (XGetWindowProperty(display, w, prop, pos, INT_MAX / 4, False,
AnyPropertyType, atype, &aformat, &nitems, &remain, &buffer) != Success) AnyPropertyType, atype, &aformat, &nitems, &remain, &buffer) != Success)
{ {
wine_tsx11_unlock();
WARN("Failed to read property\n"); WARN("Failed to read property\n");
HeapFree( GetProcessHeap(), 0, val ); HeapFree( GetProcessHeap(), 0, val );
return FALSE; return FALSE;
@ -2356,14 +2342,12 @@ static BOOL X11DRV_CLIPBOARD_GetProperty(Display *display, Window w, Atom prop,
if (!*data) if (!*data)
{ {
XFree( buffer ); XFree( buffer );
wine_tsx11_unlock();
HeapFree( GetProcessHeap(), 0, val ); HeapFree( GetProcessHeap(), 0, val );
return FALSE; return FALSE;
} }
val = *data; val = *data;
memcpy( (int *)val + pos, buffer, count ); memcpy( (int *)val + pos, buffer, count );
XFree( buffer ); XFree( buffer );
wine_tsx11_unlock();
if (!remain) if (!remain)
{ {
*datasize = pos * sizeof(int) + count; *datasize = pos * sizeof(int) + count;
@ -2572,7 +2556,6 @@ static void X11DRV_CLIPBOARD_ReleaseSelection(Display *display, Atom selType, Wi
{ {
TRACE("Lost clipboard. Check if we need to release PRIMARY\n"); TRACE("Lost clipboard. Check if we need to release PRIMARY\n");
wine_tsx11_lock();
if (selectionWindow == XGetSelectionOwner(display, XA_PRIMARY)) if (selectionWindow == XGetSelectionOwner(display, XA_PRIMARY))
{ {
TRACE("We still own PRIMARY. Releasing PRIMARY.\n"); TRACE("We still own PRIMARY. Releasing PRIMARY.\n");
@ -2580,13 +2563,11 @@ static void X11DRV_CLIPBOARD_ReleaseSelection(Display *display, Atom selType, Wi
} }
else else
TRACE("We no longer own PRIMARY\n"); TRACE("We no longer own PRIMARY\n");
wine_tsx11_unlock();
} }
else if ((selType == XA_PRIMARY) && (selectionAcquired & S_CLIPBOARD)) else if ((selType == XA_PRIMARY) && (selectionAcquired & S_CLIPBOARD))
{ {
TRACE("Lost PRIMARY. Check if we need to release CLIPBOARD\n"); TRACE("Lost PRIMARY. Check if we need to release CLIPBOARD\n");
wine_tsx11_lock();
if (selectionWindow == XGetSelectionOwner(display,x11drv_atom(CLIPBOARD))) if (selectionWindow == XGetSelectionOwner(display,x11drv_atom(CLIPBOARD)))
{ {
TRACE("We still own CLIPBOARD. Releasing CLIPBOARD.\n"); TRACE("We still own CLIPBOARD. Releasing CLIPBOARD.\n");
@ -2594,7 +2575,6 @@ static void X11DRV_CLIPBOARD_ReleaseSelection(Display *display, Atom selType, Wi
} }
else else
TRACE("We no longer own CLIPBOARD\n"); TRACE("We no longer own CLIPBOARD\n");
wine_tsx11_unlock();
} }
selectionWindow = None; selectionWindow = None;
@ -2631,8 +2611,6 @@ static void selection_acquire(void)
owner = thread_selection_wnd(); owner = thread_selection_wnd();
display = thread_display(); display = thread_display();
wine_tsx11_lock();
selectionAcquired = 0; selectionAcquired = 0;
selectionWindow = 0; selectionWindow = 0;
@ -2649,8 +2627,6 @@ static void selection_acquire(void)
if (XGetSelectionOwner(display,x11drv_atom(CLIPBOARD)) == owner) if (XGetSelectionOwner(display,x11drv_atom(CLIPBOARD)) == owner)
selectionAcquired |= S_CLIPBOARD; selectionAcquired |= S_CLIPBOARD;
wine_tsx11_unlock();
if (selectionAcquired) if (selectionAcquired)
{ {
selectionWindow = owner; selectionWindow = owner;
@ -3043,8 +3019,6 @@ static Atom X11DRV_SelectionRequest_TARGETS( Display *display, Window requestor,
format->lpDrvExportFunc && format->drvData) format->lpDrvExportFunc && format->drvData)
targets[i++] = format->drvData; targets[i++] = format->drvData;
wine_tsx11_lock();
if (TRACE_ON(clipboard)) if (TRACE_ON(clipboard))
{ {
unsigned int i; unsigned int i;
@ -3060,7 +3034,6 @@ static Atom X11DRV_SelectionRequest_TARGETS( Display *display, Window requestor,
* in case some apps expect this instead of XA_ATOM */ * in case some apps expect this instead of XA_ATOM */
XChangeProperty(display, requestor, rprop, XA_ATOM, 32, XChangeProperty(display, requestor, rprop, XA_ATOM, 32,
PropModeReplace, (unsigned char *)targets, cTargets); PropModeReplace, (unsigned char *)targets, cTargets);
wine_tsx11_unlock();
HeapFree(GetProcessHeap(), 0, targets); HeapFree(GetProcessHeap(), 0, targets);
@ -3102,16 +3075,10 @@ static Atom X11DRV_SelectionRequest_MULTIPLE( HWND hWnd, XSelectionRequestEvent
/* Read the MULTIPLE property contents. This should contain a list of /* Read the MULTIPLE property contents. This should contain a list of
* (target,property) atom pairs. * (target,property) atom pairs.
*/ */
wine_tsx11_lock(); if (!XGetWindowProperty(display, pevent->requestor, rprop,
if(XGetWindowProperty(display, pevent->requestor, rprop,
0, 0x3FFF, False, AnyPropertyType, &atype,&aformat, 0, 0x3FFF, False, AnyPropertyType, &atype,&aformat,
&cTargetPropList, &remain, &cTargetPropList, &remain,
(unsigned char**)&targetPropList) != Success) (unsigned char**)&targetPropList) != Success)
{
wine_tsx11_unlock();
TRACE("\tCouldn't read MULTIPLE property\n");
}
else
{ {
if (TRACE_ON(clipboard)) if (TRACE_ON(clipboard))
{ {
@ -3120,7 +3087,6 @@ static Atom X11DRV_SelectionRequest_MULTIPLE( HWND hWnd, XSelectionRequestEvent
typeName, aformat, cTargetPropList, remain); typeName, aformat, cTargetPropList, remain);
XFree(typeName); XFree(typeName);
} }
wine_tsx11_unlock();
/* /*
* Make sure we got what we expect. * Make sure we got what we expect.
@ -3174,6 +3140,7 @@ static Atom X11DRV_SelectionRequest_MULTIPLE( HWND hWnd, XSelectionRequestEvent
/* Free the list of targets/properties */ /* Free the list of targets/properties */
XFree(targetPropList); XFree(targetPropList);
} }
else TRACE("Couldn't read MULTIPLE property\n");
return rprop; return rprop;
} }
@ -3246,7 +3213,6 @@ static void X11DRV_HandleSelectionRequest( HWND hWnd, XSelectionRequestEvent *ev
TRACE("\tUpdating property %s, %d bytes\n", TRACE("\tUpdating property %s, %d bytes\n",
debugstr_format(lpFormat->wFormatID), cBytes); debugstr_format(lpFormat->wFormatID), cBytes);
wine_tsx11_lock();
do do
{ {
int nelements = min(cBytes, 65536); int nelements = min(cBytes, 65536);
@ -3256,7 +3222,6 @@ static void X11DRV_HandleSelectionRequest( HWND hWnd, XSelectionRequestEvent *ev
cBytes -= nelements; cBytes -= nelements;
lpClipData += nelements; lpClipData += nelements;
} while (cBytes > 0); } while (cBytes > 0);
wine_tsx11_unlock();
GlobalUnlock(hClipData); GlobalUnlock(hClipData);
GlobalFree(hClipData); GlobalFree(hClipData);

View File

@ -138,8 +138,6 @@ Window CDECL X11DRV_create_desktop( UINT width, UINT height )
TRACE( "%u x %u\n", width, height ); TRACE( "%u x %u\n", width, height );
wine_tsx11_lock();
/* Create window */ /* Create window */
win_attr.event_mask = ExposureMask | KeyPressMask | KeyReleaseMask | EnterWindowMask | win_attr.event_mask = ExposureMask | KeyPressMask | KeyReleaseMask | EnterWindowMask |
PointerMotionMask | ButtonPressMask | ButtonReleaseMask | FocusChangeMask; PointerMotionMask | ButtonPressMask | ButtonReleaseMask | FocusChangeMask;
@ -162,7 +160,6 @@ Window CDECL X11DRV_create_desktop( UINT width, UINT height )
1); 1);
} }
XFlush( display ); XFlush( display );
wine_tsx11_unlock();
if (win != None) X11DRV_init_desktop( win, width, height ); if (win != None) X11DRV_init_desktop( win, width, height );
return win; return win;
} }
@ -230,7 +227,6 @@ static void update_desktop_fullscreen( unsigned int width, unsigned int height)
TRACE("action=%li\n", xev.xclient.data.l[0]); TRACE("action=%li\n", xev.xclient.data.l[0]);
wine_tsx11_lock();
XSendEvent( display, DefaultRootWindow(display), False, XSendEvent( display, DefaultRootWindow(display), False,
SubstructureRedirectMask | SubstructureNotifyMask, &xev ); SubstructureRedirectMask | SubstructureNotifyMask, &xev );
@ -238,7 +234,6 @@ static void update_desktop_fullscreen( unsigned int width, unsigned int height)
xev.xclient.data.l[2] = x11drv_atom(_NET_WM_STATE_MAXIMIZED_HORZ); xev.xclient.data.l[2] = x11drv_atom(_NET_WM_STATE_MAXIMIZED_HORZ);
XSendEvent( display, DefaultRootWindow(display), False, XSendEvent( display, DefaultRootWindow(display), False,
SubstructureRedirectMask | SubstructureNotifyMask, &xev ); SubstructureRedirectMask | SubstructureNotifyMask, &xev );
wine_tsx11_unlock();
} }
/*********************************************************************** /***********************************************************************

View File

@ -366,13 +366,11 @@ static inline void call_event_handler( Display *display, XEvent *event )
TRACE( "%lu %s for hwnd/window %p/%lx\n", TRACE( "%lu %s for hwnd/window %p/%lx\n",
event->xany.serial, dbgstr_event( event->type ), hwnd, event->xany.window ); event->xany.serial, dbgstr_event( event->type ), hwnd, event->xany.window );
wine_tsx11_unlock();
thread_data = x11drv_thread_data(); thread_data = x11drv_thread_data();
prev = thread_data->current_event; prev = thread_data->current_event;
thread_data->current_event = event; thread_data->current_event = event;
handlers[event->type]( hwnd, event ); handlers[event->type]( hwnd, event );
thread_data->current_event = prev; thread_data->current_event = prev;
wine_tsx11_lock();
} }
@ -386,7 +384,6 @@ static int process_events( Display *display, Bool (*filter)(Display*, XEvent*,XP
enum event_merge_action action = MERGE_DISCARD; enum event_merge_action action = MERGE_DISCARD;
prev_event.type = 0; prev_event.type = 0;
wine_tsx11_lock();
while (XCheckIfEvent( display, &event, filter, (char *)arg )) while (XCheckIfEvent( display, &event, filter, (char *)arg ))
{ {
count++; count++;
@ -442,7 +439,6 @@ static int process_events( Display *display, Bool (*filter)(Display*, XEvent*,XP
if (prev_event.type) call_event_handler( display, &prev_event ); if (prev_event.type) call_event_handler( display, &prev_event );
free_event_data( &prev_event ); free_event_data( &prev_event );
XFlush( gdi_display ); XFlush( gdi_display );
wine_tsx11_unlock();
if (count) TRACE( "processed %d events\n", count ); if (count) TRACE( "processed %d events\n", count );
return count; return count;
} }
@ -880,7 +876,6 @@ static BOOL is_net_wm_state_maximized( Display *display, struct x11drv_win_data
if (!data->whole_window) return FALSE; if (!data->whole_window) return FALSE;
wine_tsx11_lock();
if (!XGetWindowProperty( display, data->whole_window, x11drv_atom(_NET_WM_STATE), 0, if (!XGetWindowProperty( display, data->whole_window, x11drv_atom(_NET_WM_STATE), 0,
65536/sizeof(CARD32), False, XA_ATOM, &type, &format, &count, 65536/sizeof(CARD32), False, XA_ATOM, &type, &format, &count,
&remaining, (unsigned char **)&state )) &remaining, (unsigned char **)&state ))
@ -896,7 +891,6 @@ static BOOL is_net_wm_state_maximized( Display *display, struct x11drv_win_data
} }
XFree( state ); XFree( state );
} }
wine_tsx11_unlock();
return (ret == 2); return (ret == 2);
} }
@ -1099,7 +1093,6 @@ static int get_window_wm_state( Display *display, struct x11drv_win_data *data )
int format, ret = -1; int format, ret = -1;
unsigned long count, remaining; unsigned long count, remaining;
wine_tsx11_lock();
if (!XGetWindowProperty( display, data->whole_window, x11drv_atom(WM_STATE), 0, if (!XGetWindowProperty( display, data->whole_window, x11drv_atom(WM_STATE), 0,
sizeof(*state)/sizeof(CARD32), False, x11drv_atom(WM_STATE), sizeof(*state)/sizeof(CARD32), False, x11drv_atom(WM_STATE),
&type, &format, &count, &remaining, (unsigned char **)&state )) &type, &format, &count, &remaining, (unsigned char **)&state ))
@ -1108,7 +1101,6 @@ static int get_window_wm_state( Display *display, struct x11drv_win_data *data )
ret = state->state; ret = state->state;
XFree( state ); XFree( state );
} }
wine_tsx11_unlock();
return ret; return ret;
} }
@ -1223,20 +1215,13 @@ void wait_for_withdrawn_state( Display *display, struct x11drv_win_data *data, B
XEvent event; XEvent event;
int count = 0; int count = 0;
wine_tsx11_lock();
while (XCheckIfEvent( display, &event, is_wm_state_notify, (char *)data->whole_window )) while (XCheckIfEvent( display, &event, is_wm_state_notify, (char *)data->whole_window ))
{ {
count++; count++;
if (XFilterEvent( &event, None )) continue; /* filtered, ignore it */ if (XFilterEvent( &event, None )) continue; /* filtered, ignore it */
if (event.type == DestroyNotify) call_event_handler( display, &event ); if (event.type == DestroyNotify) call_event_handler( display, &event );
else else handle_wm_state_notify( data, &event.xproperty, FALSE );
{
wine_tsx11_unlock();
handle_wm_state_notify( data, &event.xproperty, FALSE );
wine_tsx11_lock();
} }
}
wine_tsx11_unlock();
if (!count) if (!count)
{ {

View File

@ -176,7 +176,6 @@ static Cursor get_empty_cursor(void)
static Cursor cursor; static Cursor cursor;
static const char data[] = { 0 }; static const char data[] = { 0 };
wine_tsx11_lock();
if (!cursor) if (!cursor)
{ {
XColor bg; XColor bg;
@ -186,11 +185,12 @@ static Cursor get_empty_cursor(void)
pixmap = XCreateBitmapFromData( gdi_display, root_window, data, 1, 1 ); pixmap = XCreateBitmapFromData( gdi_display, root_window, data, 1, 1 );
if (pixmap) if (pixmap)
{ {
cursor = XCreatePixmapCursor( gdi_display, pixmap, pixmap, &bg, &bg, 0, 0 ); Cursor new = XCreatePixmapCursor( gdi_display, pixmap, pixmap, &bg, &bg, 0, 0 );
if (InterlockedCompareExchangePointer( (void **)&cursor, (void *)new, 0 ))
XFreeCursor( gdi_display, new );
XFreePixmap( gdi_display, pixmap ); XFreePixmap( gdi_display, pixmap );
} }
} }
wine_tsx11_unlock();
return cursor; return cursor;
} }
@ -207,7 +207,7 @@ void set_window_cursor( Window window, HCURSOR handle )
/* try to create it */ /* try to create it */
if (!(cursor = create_cursor( handle ))) return; if (!(cursor = create_cursor( handle ))) return;
wine_tsx11_lock(); XLockDisplay( gdi_display );
if (!XFindContext( gdi_display, (XID)handle, cursor_context, (char **)&prev )) if (!XFindContext( gdi_display, (XID)handle, cursor_context, (char **)&prev ))
{ {
/* someone else was here first */ /* someone else was here first */
@ -219,7 +219,7 @@ void set_window_cursor( Window window, HCURSOR handle )
XSaveContext( gdi_display, (XID)handle, cursor_context, (char *)cursor ); XSaveContext( gdi_display, (XID)handle, cursor_context, (char *)cursor );
TRACE( "cursor %p created %lx\n", handle, cursor ); TRACE( "cursor %p created %lx\n", handle, cursor );
} }
wine_tsx11_unlock(); XUnlockDisplay( gdi_display );
} }
XDefineCursor( gdi_display, window, cursor ); XDefineCursor( gdi_display, window, cursor );
@ -271,7 +271,6 @@ static void enable_xinput2(void)
} }
if (data->xi2_state == xi_unavailable) return; if (data->xi2_state == xi_unavailable) return;
wine_tsx11_lock();
if (data->xi2_devices) pXIFreeDeviceInfo( data->xi2_devices ); if (data->xi2_devices) pXIFreeDeviceInfo( data->xi2_devices );
data->xi2_devices = devices = pXIQueryDevice( data->display, XIAllDevices, &data->xi2_device_count ); data->xi2_devices = devices = pXIQueryDevice( data->display, XIAllDevices, &data->xi2_device_count );
for (i = 0; i < data->xi2_device_count; ++i) for (i = 0; i < data->xi2_device_count; ++i)
@ -312,8 +311,6 @@ static void enable_xinput2(void)
data->xi2_state = xi_enabled; data->xi2_state = xi_enabled;
} }
} }
wine_tsx11_unlock();
#endif #endif
} }
@ -336,7 +333,6 @@ static void disable_xinput2(void)
mask.mask = NULL; mask.mask = NULL;
mask.mask_len = 0; mask.mask_len = 0;
wine_tsx11_lock();
for (i = 0; i < data->xi2_device_count; ++i) for (i = 0; i < data->xi2_device_count; ++i)
{ {
if (devices[i].use == XISlavePointer && devices[i].attachment == data->xi2_core_pointer) if (devices[i].use == XISlavePointer && devices[i].attachment == data->xi2_core_pointer)
@ -348,7 +344,6 @@ static void disable_xinput2(void)
pXIFreeDeviceInfo( devices ); pXIFreeDeviceInfo( devices );
data->xi2_devices = NULL; data->xi2_devices = NULL;
data->xi2_device_count = 0; data->xi2_device_count = 0;
wine_tsx11_unlock();
#endif #endif
} }
@ -385,7 +380,6 @@ static BOOL grab_clipping_window( const RECT *clip )
TRACE( "clipping to %s win %lx\n", wine_dbgstr_rect(clip), clip_window ); TRACE( "clipping to %s win %lx\n", wine_dbgstr_rect(clip), clip_window );
wine_tsx11_lock();
if (!data->clip_hwnd) XUnmapWindow( data->display, clip_window ); if (!data->clip_hwnd) XUnmapWindow( data->display, clip_window );
XMoveResizeWindow( data->display, clip_window, XMoveResizeWindow( data->display, clip_window,
clip->left - virtual_screen_rect.left, clip->top - virtual_screen_rect.top, clip->left - virtual_screen_rect.left, clip->top - virtual_screen_rect.top,
@ -401,7 +395,6 @@ static BOOL grab_clipping_window( const RECT *clip )
PointerMotionMask | ButtonPressMask | ButtonReleaseMask, PointerMotionMask | ButtonPressMask | ButtonReleaseMask,
GrabModeAsync, GrabModeAsync, clip_window, None, CurrentTime )) GrabModeAsync, GrabModeAsync, clip_window, None, CurrentTime ))
clipping_cursor = 1; clipping_cursor = 1;
wine_tsx11_unlock();
if (!clipping_cursor) if (!clipping_cursor)
{ {
@ -1202,14 +1195,12 @@ void CDECL X11DRV_DestroyCursorIcon( HCURSOR handle )
{ {
Cursor cursor; Cursor cursor;
wine_tsx11_lock();
if (!XFindContext( gdi_display, (XID)handle, cursor_context, (char **)&cursor )) if (!XFindContext( gdi_display, (XID)handle, cursor_context, (char **)&cursor ))
{ {
TRACE( "%p xid %lx\n", handle, cursor ); TRACE( "%p xid %lx\n", handle, cursor );
XFreeCursor( gdi_display, cursor ); XFreeCursor( gdi_display, cursor );
XDeleteContext( gdi_display, (XID)handle, cursor_context ); XDeleteContext( gdi_display, (XID)handle, cursor_context );
} }
wine_tsx11_unlock();
} }
/*********************************************************************** /***********************************************************************
@ -1252,7 +1243,6 @@ BOOL CDECL X11DRV_GetCursorPos(LPPOINT pos)
unsigned int xstate; unsigned int xstate;
BOOL ret; BOOL ret;
wine_tsx11_lock();
ret = XQueryPointer( display, root_window, &root, &child, &rootX, &rootY, &winX, &winY, &xstate ); ret = XQueryPointer( display, root_window, &root, &child, &rootX, &rootY, &winX, &winY, &xstate );
if (ret) if (ret)
{ {
@ -1261,7 +1251,6 @@ BOOL CDECL X11DRV_GetCursorPos(LPPOINT pos)
pos->y = winY + virtual_screen_rect.top; pos->y = winY + virtual_screen_rect.top;
TRACE( "pointer at (%d,%d) server pos %d,%d\n", pos->x, pos->y, old.x, old.y ); TRACE( "pointer at (%d,%d) server pos %d,%d\n", pos->x, pos->y, old.x, old.y );
} }
wine_tsx11_unlock();
return ret; return ret;
} }
@ -1520,7 +1509,6 @@ static void X11DRV_RawMotion( XGenericEventCookie *xev )
input.u.mi.dx = 0; input.u.mi.dx = 0;
input.u.mi.dy = 0; input.u.mi.dy = 0;
wine_tsx11_lock();
for (i = 0; i < thread_data->xi2_device_count; ++i) for (i = 0; i < thread_data->xi2_device_count; ++i)
{ {
if (devices[i].deviceid != event->deviceid) continue; if (devices[i].deviceid != event->deviceid) continue;
@ -1551,8 +1539,6 @@ static void X11DRV_RawMotion( XGenericEventCookie *xev )
break; break;
} }
wine_tsx11_unlock();
if (thread_data->warp_serial) if (thread_data->warp_serial)
{ {
if ((long)(xev->serial - thread_data->warp_serial) < 0) if ((long)(xev->serial - thread_data->warp_serial) < 0)

View File

@ -493,7 +493,6 @@ static BOOL init_systray(void)
} }
display = thread_init_display(); display = thread_init_display();
wine_tsx11_lock();
if (DefaultScreen( display ) == 0) if (DefaultScreen( display ) == 0)
systray_atom = x11drv_atom(_NET_SYSTEM_TRAY_S0); systray_atom = x11drv_atom(_NET_SYSTEM_TRAY_S0);
else else
@ -503,7 +502,6 @@ static BOOL init_systray(void)
systray_atom = XInternAtom( display, systray_buffer, False ); systray_atom = XInternAtom( display, systray_buffer, False );
} }
XSelectInput( display, root_window, StructureNotifyMask ); XSelectInput( display, root_window, StructureNotifyMask );
wine_tsx11_unlock();
init_done = TRUE; init_done = TRUE;
return TRUE; return TRUE;

View File

@ -135,7 +135,6 @@ static void remove_startup_notification(Display *display, Window window)
src = message; src = message;
srclen = strlen(src) + 1; srclen = strlen(src) + 1;
wine_tsx11_lock();
while (srclen > 0) while (srclen > 0)
{ {
int msglen = srclen; int msglen = srclen;
@ -149,7 +148,6 @@ static void remove_startup_notification(Display *display, Window window)
XSendEvent( display, DefaultRootWindow( display ), False, PropertyChangeMask, &xevent ); XSendEvent( display, DefaultRootWindow( display ), False, PropertyChangeMask, &xevent );
xevent.xclient.message_type = x11drv_atom(_NET_STARTUP_INFO); xevent.xclient.message_type = x11drv_atom(_NET_STARTUP_INFO);
} }
wine_tsx11_unlock();
} }
@ -343,8 +341,6 @@ static Window create_client_window( Display *display, struct x11drv_win_data *da
if ((cy = data->client_rect.bottom - data->client_rect.top) <= 0) cy = 1; if ((cy = data->client_rect.bottom - data->client_rect.top) <= 0) cy = 1;
else if (cy > 65535) cy = 65535; else if (cy > 65535) cy = 65535;
wine_tsx11_lock();
if (vis) if (vis)
{ {
attr.colormap = XCreateColormap( display, root_window, vis->visual, attr.colormap = XCreateColormap( display, root_window, vis->visual,
@ -360,7 +356,7 @@ static Window create_client_window( Display *display, struct x11drv_win_data *da
client_visual, mask, &attr ); client_visual, mask, &attr );
if (!client) if (!client)
{ {
wine_tsx11_unlock(); if (vis) XFreeColormap( display, attr.colormap );
return 0; return 0;
} }
@ -377,8 +373,6 @@ static Window create_client_window( Display *display, struct x11drv_win_data *da
XMapWindow( display, data->client_window ); XMapWindow( display, data->client_window );
XSaveContext( display, data->client_window, winContext, (char *)data->hwnd ); XSaveContext( display, data->client_window, winContext, (char *)data->hwnd );
wine_tsx11_unlock();
SetPropA( data->hwnd, client_window_prop, (HANDLE)data->client_window ); SetPropA( data->hwnd, client_window_prop, (HANDLE)data->client_window );
return data->client_window; return data->client_window;
} }
@ -499,7 +493,6 @@ static void sync_window_text( Display *display, Window win, const WCHAR *text )
} }
WideCharToMultiByte(CP_UTF8, 0, text, strlenW(text), utf8_buffer, count, NULL, NULL); WideCharToMultiByte(CP_UTF8, 0, text, strlenW(text), utf8_buffer, count, NULL, NULL);
wine_tsx11_lock();
if (XmbTextListToTextProperty( display, &buffer, 1, XStdICCTextStyle, &prop ) == Success) if (XmbTextListToTextProperty( display, &buffer, 1, XStdICCTextStyle, &prop ) == Success)
{ {
XSetWMName( display, win, &prop ); XSetWMName( display, win, &prop );
@ -513,7 +506,6 @@ static void sync_window_text( Display *display, Window win, const WCHAR *text )
*/ */
XChangeProperty( display, win, x11drv_atom(_NET_WM_NAME), x11drv_atom(UTF8_STRING), XChangeProperty( display, win, x11drv_atom(_NET_WM_NAME), x11drv_atom(UTF8_STRING),
8, PropModeReplace, (unsigned char *) utf8_buffer, count); 8, PropModeReplace, (unsigned char *) utf8_buffer, count);
wine_tsx11_unlock();
HeapFree( GetProcessHeap(), 0, utf8_buffer ); HeapFree( GetProcessHeap(), 0, utf8_buffer );
HeapFree( GetProcessHeap(), 0, buffer ); HeapFree( GetProcessHeap(), 0, buffer );
@ -562,7 +554,6 @@ static BOOL set_win_format( HWND hwnd, XID fbconfig_id )
XSetWindowAttributes attrib; XSetWindowAttributes attrib;
static Window dummy_parent; static Window dummy_parent;
wine_tsx11_lock();
attrib.override_redirect = True; attrib.override_redirect = True;
if (!dummy_parent) if (!dummy_parent)
{ {
@ -591,21 +582,17 @@ static BOOL set_win_format( HWND hwnd, XID fbconfig_id )
} }
XFree(vis); XFree(vis);
XFlush( gdi_display ); XFlush( gdi_display );
wine_tsx11_unlock();
} }
else else
#endif #endif
{ {
WARN("XComposite is not available, using GLXPixmap hack\n"); WARN("XComposite is not available, using GLXPixmap hack\n");
wine_tsx11_lock();
if(data->pixmap) XFreePixmap(gdi_display, data->pixmap); if(data->pixmap) XFreePixmap(gdi_display, data->pixmap);
data->pixmap = XCreatePixmap(gdi_display, root_window, w, h, vis->depth); data->pixmap = XCreatePixmap(gdi_display, root_window, w, h, vis->depth);
if(!data->pixmap) if(!data->pixmap)
{ {
XFree(vis); XFree(vis);
wine_tsx11_unlock();
return FALSE; return FALSE;
} }
@ -618,7 +605,6 @@ static BOOL set_win_format( HWND hwnd, XID fbconfig_id )
} }
XFree(vis); XFree(vis);
XFlush( gdi_display ); XFlush( gdi_display );
wine_tsx11_unlock();
if (data->pixmap) SetPropA(hwnd, pixmap_prop, (HANDLE)data->pixmap); if (data->pixmap) SetPropA(hwnd, pixmap_prop, (HANDLE)data->pixmap);
} }
@ -663,13 +649,11 @@ static void sync_gl_drawable(struct x11drv_win_data *data)
if (!(vis = visual_from_fbconfig_id(data->fbconfig_id))) return; if (!(vis = visual_from_fbconfig_id(data->fbconfig_id))) return;
wine_tsx11_lock();
pix = XCreatePixmap(gdi_display, root_window, w, h, vis->depth); pix = XCreatePixmap(gdi_display, root_window, w, h, vis->depth);
if(!pix) if(!pix)
{ {
ERR("Failed to create pixmap for offscreen rendering\n"); ERR("Failed to create pixmap for offscreen rendering\n");
XFree(vis); XFree(vis);
wine_tsx11_unlock();
return; return;
} }
@ -679,7 +663,6 @@ static void sync_gl_drawable(struct x11drv_win_data *data)
ERR("Failed to create drawable for offscreen rendering\n"); ERR("Failed to create drawable for offscreen rendering\n");
XFreePixmap(gdi_display, pix); XFreePixmap(gdi_display, pix);
XFree(vis); XFree(vis);
wine_tsx11_unlock();
return; return;
} }
@ -695,7 +678,6 @@ static void sync_gl_drawable(struct x11drv_win_data *data)
data->gl_drawable = glxp; data->gl_drawable = glxp;
XFlush( gdi_display ); XFlush( gdi_display );
wine_tsx11_unlock();
SetPropA(data->hwnd, gl_drawable_prop, (HANDLE)data->gl_drawable); SetPropA(data->hwnd, gl_drawable_prop, (HANDLE)data->gl_drawable);
SetPropA(data->hwnd, pixmap_prop, (HANDLE)data->pixmap); SetPropA(data->hwnd, pixmap_prop, (HANDLE)data->pixmap);
@ -750,7 +732,6 @@ static Window create_icon_window( Display *display, struct x11drv_win_data *data
attr.backing_store = NotUseful/*WhenMapped*/; attr.backing_store = NotUseful/*WhenMapped*/;
attr.colormap = X11DRV_PALETTE_PaletteXColormap; /* Needed due to our visual */ attr.colormap = X11DRV_PALETTE_PaletteXColormap; /* Needed due to our visual */
wine_tsx11_lock();
data->icon_window = XCreateWindow( display, root_window, 0, 0, data->icon_window = XCreateWindow( display, root_window, 0, 0,
GetSystemMetrics( SM_CXICON ), GetSystemMetrics( SM_CXICON ),
GetSystemMetrics( SM_CYICON ), GetSystemMetrics( SM_CYICON ),
@ -759,7 +740,6 @@ static Window create_icon_window( Display *display, struct x11drv_win_data *data
CWEventMask | CWBitGravity | CWBackingStore | CWColormap, &attr ); CWEventMask | CWBitGravity | CWBackingStore | CWColormap, &attr );
XSaveContext( display, data->icon_window, winContext, (char *)data->hwnd ); XSaveContext( display, data->icon_window, winContext, (char *)data->hwnd );
XFlush( display ); /* make sure the window exists before we start painting to it */ XFlush( display ); /* make sure the window exists before we start painting to it */
wine_tsx11_unlock();
TRACE( "created %lx\n", data->icon_window ); TRACE( "created %lx\n", data->icon_window );
SetPropA( data->hwnd, icon_window_prop, (HANDLE)data->icon_window ); SetPropA( data->hwnd, icon_window_prop, (HANDLE)data->icon_window );
@ -1113,8 +1093,6 @@ static void set_initial_wm_hints( Display *display, struct x11drv_win_data *data
XClassHint *class_hints; XClassHint *class_hints;
char *process_name = get_process_name(); char *process_name = get_process_name();
wine_tsx11_lock();
/* wm protocols */ /* wm protocols */
i = 0; i = 0;
protocols[i++] = x11drv_atom(WM_DELETE_WINDOW); protocols[i++] = x11drv_atom(WM_DELETE_WINDOW);
@ -1150,8 +1128,6 @@ static void set_initial_wm_hints( Display *display, struct x11drv_win_data *data
XA_WINDOW, 32, PropModeReplace, (unsigned char *)&user_time_window, 1 ); XA_WINDOW, 32, PropModeReplace, (unsigned char *)&user_time_window, 1 );
data->wm_hints = XAllocWMHints(); data->wm_hints = XAllocWMHints();
wine_tsx11_unlock();
if (data->wm_hints) if (data->wm_hints)
{ {
data->wm_hints->flags = 0; data->wm_hints->flags = 0;
@ -1215,8 +1191,6 @@ static void set_wm_hints( Display *display, struct x11drv_win_data *data )
if ((owner_win = get_owner_whole_window( owner, data->managed ))) group_leader = owner_win; if ((owner_win = get_owner_whole_window( owner, data->managed ))) group_leader = owner_win;
} }
wine_tsx11_lock();
if (owner_win) XSetTransientForHint( display, data->whole_window, owner_win ); if (owner_win) XSetTransientForHint( display, data->whole_window, owner_win );
/* size hints */ /* size hints */
@ -1242,8 +1216,6 @@ static void set_wm_hints( Display *display, struct x11drv_win_data *data )
data->wm_hints->window_group = group_leader; data->wm_hints->window_group = group_leader;
XSetWMHints( display, data->whole_window, data->wm_hints ); XSetWMHints( display, data->whole_window, data->wm_hints );
} }
wine_tsx11_unlock();
} }
@ -1268,20 +1240,24 @@ Window init_clip_window(void)
*/ */
void update_user_time( Time time ) void update_user_time( Time time )
{ {
wine_tsx11_lock();
if (!user_time_window) if (!user_time_window)
{ {
user_time_window = XCreateWindow( gdi_display, root_window, -1, -1, 1, 1, 0, 0, InputOnly, Window win = XCreateWindow( gdi_display, root_window, -1, -1, 1, 1, 0, 0, InputOnly,
DefaultVisual(gdi_display,DefaultScreen(gdi_display)), 0, NULL ); DefaultVisual(gdi_display,DefaultScreen(gdi_display)), 0, NULL );
if (InterlockedCompareExchangePointer( (void **)&user_time_window, (void *)win, 0 ))
XDestroyWindow( gdi_display, win );
TRACE( "user time window %lx\n", user_time_window ); TRACE( "user time window %lx\n", user_time_window );
} }
if (time && (!last_user_time || (long)(time - last_user_time) > 0))
if (!time) return;
XLockDisplay( gdi_display );
if (!last_user_time || (long)(time - last_user_time) > 0)
{ {
last_user_time = time; last_user_time = time;
XChangeProperty( gdi_display, user_time_window, x11drv_atom(_NET_WM_USER_TIME), XChangeProperty( gdi_display, user_time_window, x11drv_atom(_NET_WM_USER_TIME),
XA_CARDINAL, 32, PropModeReplace, (unsigned char *)&time, 1 ); XA_CARDINAL, 32, PropModeReplace, (unsigned char *)&time, 1 );
} }
wine_tsx11_unlock(); XUnlockDisplay( gdi_display );
} }
/*********************************************************************** /***********************************************************************
@ -1783,7 +1759,6 @@ static void destroy_whole_window( Display *display, struct x11drv_win_data *data
TRACE( "win %p xwin %lx/%lx\n", data->hwnd, data->whole_window, data->client_window ); TRACE( "win %p xwin %lx/%lx\n", data->hwnd, data->whole_window, data->client_window );
wine_tsx11_lock();
XDeleteContext( display, data->whole_window, winContext ); XDeleteContext( display, data->whole_window, winContext );
XDeleteContext( display, data->client_window, winContext ); XDeleteContext( display, data->client_window, winContext );
if (!already_destroyed) XDestroyWindow( display, data->whole_window ); if (!already_destroyed) XDestroyWindow( display, data->whole_window );
@ -1801,7 +1776,6 @@ static void destroy_whole_window( Display *display, struct x11drv_win_data *data
XFlush( display ); XFlush( display );
XFree( data->wm_hints ); XFree( data->wm_hints );
data->wm_hints = NULL; data->wm_hints = NULL;
wine_tsx11_unlock();
RemovePropA( data->hwnd, whole_window_prop ); RemovePropA( data->hwnd, whole_window_prop );
RemovePropA( data->hwnd, client_window_prop ); RemovePropA( data->hwnd, client_window_prop );
} }
@ -2706,7 +2680,6 @@ static BOOL is_netwm_supported( Display *display, Atom atom )
static int net_supported_count = -1; static int net_supported_count = -1;
int i; int i;
wine_tsx11_lock();
if (net_supported_count == -1) if (net_supported_count == -1)
{ {
Atom type; Atom type;
@ -2720,7 +2693,6 @@ static BOOL is_netwm_supported( Display *display, Atom atom )
else else
net_supported_count = 0; net_supported_count = 0;
} }
wine_tsx11_unlock();
for (i = 0; i < net_supported_count; i++) for (i = 0; i < net_supported_count; i++)
if (net_supported[i] == atom) return TRUE; if (net_supported[i] == atom) return TRUE;

View File

@ -550,13 +550,10 @@ BOOL CDECL X11DRV_LoadTabletInfo(HWND hwnddefault)
PK_BUTTONS | PK_X | PK_Y | PK_NORMAL_PRESSURE | PK_ORIENTATION; PK_BUTTONS | PK_X | PK_Y | PK_NORMAL_PRESSURE | PK_ORIENTATION;
strcpyW(gSysDevice.PNPID, SZ_NON_PLUGINPLAY); strcpyW(gSysDevice.PNPID, SZ_NON_PLUGINPLAY);
wine_tsx11_lock();
devices = pXListInputDevices(data->display, &num_devices); devices = pXListInputDevices(data->display, &num_devices);
if (!devices) if (!devices)
{ {
WARN("XInput Extensions reported as not available\n"); WARN("XInput Extensions reported as not available\n");
wine_tsx11_unlock();
return FALSE; return FALSE;
} }
TRACE("XListInputDevices reports %d devices\n", num_devices); TRACE("XListInputDevices reports %d devices\n", num_devices);
@ -777,7 +774,6 @@ BOOL CDECL X11DRV_LoadTabletInfo(HWND hwnddefault)
WARN("Did not find a valid stylus, unable to determine system context parameters. Wintab is disabled.\n"); WARN("Did not find a valid stylus, unable to determine system context parameters. Wintab is disabled.\n");
} }
wine_tsx11_unlock();
return TRUE; return TRUE;
} }
@ -807,7 +803,6 @@ static void set_button_state(int curnum, XID deviceid)
int loop; int loop;
int rc = 0; int rc = 0;
wine_tsx11_lock();
device = pXOpenDevice(data->display,deviceid); device = pXOpenDevice(data->display,deviceid);
state = pXQueryDeviceState(data->display,device); state = pXQueryDeviceState(data->display,device);
@ -832,7 +827,6 @@ static void set_button_state(int curnum, XID deviceid)
} }
} }
pXFreeDeviceState(state); pXFreeDeviceState(state);
wine_tsx11_unlock();
button_state[curnum] = rc; button_state[curnum] = rc;
} }
@ -976,7 +970,6 @@ int CDECL X11DRV_AttachEventQueueToTablet(HWND hOwner)
TRACE("Creating context for window %p (%lx) %i cursors\n", hOwner, win, gNumCursors); TRACE("Creating context for window %p (%lx) %i cursors\n", hOwner, win, gNumCursors);
wine_tsx11_lock();
devices = pXListInputDevices(data->display, &num_devices); devices = pXListInputDevices(data->display, &num_devices);
X11DRV_expect_error(data->display,Tablet_ErrorHandler,NULL); X11DRV_expect_error(data->display,Tablet_ErrorHandler,NULL);
@ -1046,7 +1039,6 @@ int CDECL X11DRV_AttachEventQueueToTablet(HWND hOwner)
X11DRV_check_error(); X11DRV_check_error();
if (NULL != devices) pXFreeDeviceList(devices); if (NULL != devices) pXFreeDeviceList(devices);
wine_tsx11_unlock();
return 0; return 0;
} }

View File

@ -244,12 +244,9 @@ static inline BOOL ignore_error( Display *display, XErrorEvent *event )
* *
* Setup a callback function that will be called on an X error. The * Setup a callback function that will be called on an X error. The
* callback must return non-zero if the error is the one it expected. * callback must return non-zero if the error is the one it expected.
* This function acquires the x11 lock; X11DRV_check_error must be
* called in all cases to release it.
*/ */
void X11DRV_expect_error( Display *display, x11drv_error_callback callback, void *arg ) void X11DRV_expect_error( Display *display, x11drv_error_callback callback, void *arg )
{ {
wine_tsx11_lock();
err_callback = callback; err_callback = callback;
err_callback_display = display; err_callback_display = display;
err_callback_arg = arg; err_callback_arg = arg;
@ -262,16 +259,12 @@ void X11DRV_expect_error( Display *display, x11drv_error_callback callback, void
* X11DRV_check_error * X11DRV_check_error
* *
* Check if an expected X11 error occurred; return non-zero if yes. * Check if an expected X11 error occurred; return non-zero if yes.
* Also release the x11 lock obtained in X11DRV_expect_error.
* The caller is responsible for calling XSync first if necessary. * The caller is responsible for calling XSync first if necessary.
*/ */
int X11DRV_check_error(void) int X11DRV_check_error(void)
{ {
int ret;
err_callback = NULL; err_callback = NULL;
ret = err_callback_result; return err_callback_result;
wine_tsx11_unlock();
return ret;
} }
@ -657,10 +650,8 @@ struct x11drv_thread_data *x11drv_init_thread_data(void)
ERR( "could not create data\n" ); ERR( "could not create data\n" );
ExitProcess(1); ExitProcess(1);
} }
wine_tsx11_lock();
if (!(data->display = XOpenDisplay(NULL))) if (!(data->display = XOpenDisplay(NULL)))
{ {
wine_tsx11_unlock();
ERR_(winediag)( "x11drv: Can't open display: %s. Please ensure that your X server is running and that $DISPLAY is set correctly.\n", XDisplayName(NULL)); ERR_(winediag)( "x11drv: Can't open display: %s. Please ensure that your X server is running and that $DISPLAY is set correctly.\n", XDisplayName(NULL));
ExitProcess(1); ExitProcess(1);
} }
@ -673,7 +664,6 @@ struct x11drv_thread_data *x11drv_init_thread_data(void)
#endif #endif
if (TRACE_ON(synchronous)) XSynchronize( data->display, True ); if (TRACE_ON(synchronous)) XSynchronize( data->display, True );
wine_tsx11_unlock();
set_queue_display_fd( data->display ); set_queue_display_fd( data->display );
TlsSetValue( thread_data_tls_index, data ); TlsSetValue( thread_data_tls_index, data );
@ -726,7 +716,7 @@ void CDECL X11DRV_SetScreenSaveActive(BOOL bActivate)
int timeout, interval, prefer_blanking, allow_exposures; int timeout, interval, prefer_blanking, allow_exposures;
static int last_timeout = 15 * 60; static int last_timeout = 15 * 60;
wine_tsx11_lock(); XLockDisplay( gdi_display );
XGetScreenSaver(gdi_display, &timeout, &interval, &prefer_blanking, XGetScreenSaver(gdi_display, &timeout, &interval, &prefer_blanking,
&allow_exposures); &allow_exposures);
if (timeout) last_timeout = timeout; if (timeout) last_timeout = timeout;
@ -734,5 +724,5 @@ void CDECL X11DRV_SetScreenSaveActive(BOOL bActivate)
timeout = bActivate ? last_timeout : 0; timeout = bActivate ? last_timeout : 0;
XSetScreenSaver(gdi_display, timeout, interval, prefer_blanking, XSetScreenSaver(gdi_display, timeout, interval, prefer_blanking,
allow_exposures); allow_exposures);
wine_tsx11_unlock(); XUnlockDisplay( gdi_display );
} }

View File

@ -242,10 +242,9 @@ void X11DRV_XDND_EnterEvent( HWND hWnd, XClientMessageEvent *event )
if (TRACE_ON(xdnd)) if (TRACE_ON(xdnd))
{ {
unsigned int i = 0; unsigned int i;
wine_tsx11_lock(); for (i = 0; i < count; i++)
for (; i < count; i++)
{ {
if (xdndtypes[i] != 0) if (xdndtypes[i] != 0)
{ {
@ -254,7 +253,6 @@ void X11DRV_XDND_EnterEvent( HWND hWnd, XClientMessageEvent *event )
XFree(pn); XFree(pn);
} }
} }
wine_tsx11_unlock();
} }
/* Do a one-time data read and cache results */ /* Do a one-time data read and cache results */

View File

@ -257,10 +257,8 @@ void X11DRV_ForceXIMReset(HWND hwnd)
{ {
char* leftover; char* leftover;
TRACE("Forcing Reset %p\n",ic); TRACE("Forcing Reset %p\n",ic);
wine_tsx11_lock();
leftover = XmbResetIC(ic); leftover = XmbResetIC(ic);
XFree(leftover); XFree(leftover);
wine_tsx11_unlock();
} }
} }
@ -279,16 +277,12 @@ void X11DRV_SetPreeditState(HWND hwnd, BOOL fOpen)
else else
state = XIMPreeditDisable; state = XIMPreeditDisable;
wine_tsx11_lock();
attr = XVaCreateNestedList(0, XNPreeditState, state, NULL); attr = XVaCreateNestedList(0, XNPreeditState, state, NULL);
if (attr != NULL) if (attr != NULL)
{ {
XSetICValues(ic, XNPreeditAttributes, attr, NULL); XSetICValues(ic, XNPreeditAttributes, attr, NULL);
XFree(attr); XFree(attr);
} }
wine_tsx11_unlock();
} }
@ -299,8 +293,6 @@ void X11DRV_SetPreeditState(HWND hwnd, BOOL fOpen)
*/ */
BOOL X11DRV_InitXIM( const char *input_style ) BOOL X11DRV_InitXIM( const char *input_style )
{ {
BOOL ret;
if (!strcasecmp(input_style, "offthespot")) if (!strcasecmp(input_style, "offthespot"))
ximStyleRequest = STYLE_OFFTHESPOT; ximStyleRequest = STYLE_OFFTHESPOT;
else if (!strcasecmp(input_style, "overthespot")) else if (!strcasecmp(input_style, "overthespot"))
@ -308,18 +300,17 @@ BOOL X11DRV_InitXIM( const char *input_style )
else if (!strcasecmp(input_style, "root")) else if (!strcasecmp(input_style, "root"))
ximStyleRequest = STYLE_ROOT; ximStyleRequest = STYLE_ROOT;
wine_tsx11_lock(); if (!XSupportsLocale())
if (!(ret = XSupportsLocale()))
{ {
WARN("X does not support locale.\n"); WARN("X does not support locale.\n");
return FALSE;
} }
else if (XSetLocaleModifiers("") == NULL) if (XSetLocaleModifiers("") == NULL)
{ {
WARN("Could not set locale modifiers.\n"); WARN("Could not set locale modifiers.\n");
ret = FALSE; return FALSE;
} }
wine_tsx11_unlock(); return TRUE;
return ret;
} }
@ -332,9 +323,7 @@ static void X11DRV_DestroyIM(XIM xim, XPointer p, XPointer data)
TRACE("xim = %p, p = %p\n", xim, p); TRACE("xim = %p, p = %p\n", xim, p);
thread_data->xim = NULL; thread_data->xim = NULL;
ximStyle = 0; ximStyle = 0;
wine_tsx11_lock();
XRegisterIMInstantiateCallback( thread_data->display, NULL, NULL, NULL, open_xim_callback, NULL ); XRegisterIMInstantiateCallback( thread_data->display, NULL, NULL, NULL, open_xim_callback, NULL );
wine_tsx11_unlock();
} }
/*********************************************************************** /***********************************************************************
@ -456,9 +445,7 @@ static BOOL open_xim( Display *display )
else else
thread_data->font_set = NULL; thread_data->font_set = NULL;
wine_tsx11_unlock();
IME_UpdateAssociation(NULL); IME_UpdateAssociation(NULL);
wine_tsx11_lock();
return TRUE; return TRUE;
} }
@ -472,10 +459,8 @@ void X11DRV_SetupXIM(void)
{ {
Display *display = thread_display(); Display *display = thread_display();
wine_tsx11_lock();
if (!open_xim( display )) if (!open_xim( display ))
XRegisterIMInstantiateCallback( display, NULL, NULL, NULL, open_xim_callback, NULL ); XRegisterIMInstantiateCallback( display, NULL, NULL, NULL, open_xim_callback, NULL );
wine_tsx11_unlock();
} }
static BOOL X11DRV_DestroyIC(XIC xic, XPointer p, XPointer data) static BOOL X11DRV_DestroyIC(XIC xic, XPointer p, XPointer data)
@ -501,8 +486,6 @@ XIC X11DRV_CreateIC(XIM xim, struct x11drv_win_data *data)
TRACE("xim = %p\n", xim); TRACE("xim = %p\n", xim);
wine_tsx11_lock();
/* use complex and slow XIC initialization method only for CJK */ /* use complex and slow XIC initialization method only for CJK */
if (langid != LANG_CHINESE && if (langid != LANG_CHINESE &&
langid != LANG_JAPANESE && langid != LANG_JAPANESE &&
@ -514,7 +497,6 @@ XIC X11DRV_CreateIC(XIM xim, struct x11drv_win_data *data)
XNFocusWindow, win, XNFocusWindow, win,
XNDestroyCallback, &destroy, XNDestroyCallback, &destroy,
NULL); NULL);
wine_tsx11_unlock();
data->xic = xic; data->xic = xic;
return xic; return xic;
} }
@ -614,7 +596,5 @@ XIC X11DRV_CreateIC(XIM xim, struct x11drv_win_data *data)
if (status != NULL) if (status != NULL)
XFree(status); XFree(status);
wine_tsx11_unlock();
return xic; return xic;
} }

View File

@ -163,8 +163,6 @@ void xinerama_init( unsigned int width, unsigned int height )
int i; int i;
RECT rect; RECT rect;
wine_tsx11_lock();
SetRect( &rect, 0, 0, width, height ); SetRect( &rect, 0, 0, width, height );
if (root_window != DefaultRootWindow( gdi_display ) || !query_screens()) if (root_window != DefaultRootWindow( gdi_display ) || !query_screens())
@ -196,8 +194,6 @@ void xinerama_init( unsigned int width, unsigned int height )
screen_height = primary->rcMonitor.bottom - primary->rcMonitor.top; screen_height = primary->rcMonitor.bottom - primary->rcMonitor.top;
TRACE( "virtual size: %s primary size: %dx%d\n", TRACE( "virtual size: %s primary size: %dx%d\n",
wine_dbgstr_rect(&virtual_screen_rect), screen_width, screen_height ); wine_dbgstr_rect(&virtual_screen_rect), screen_width, screen_height );
wine_tsx11_unlock();
} }

View File

@ -116,19 +116,16 @@ static int xrandr10_get_current_mode(void)
{ {
SizeID size; SizeID size;
Rotation rot; Rotation rot;
Window root;
XRRScreenConfiguration *sc; XRRScreenConfiguration *sc;
short rate; short rate;
unsigned int i; unsigned int i;
int res = -1; int res = -1;
wine_tsx11_lock(); sc = pXRRGetScreenInfo (gdi_display, DefaultRootWindow( gdi_display ));
root = RootWindow (gdi_display, DefaultScreen(gdi_display));
sc = pXRRGetScreenInfo (gdi_display, root);
size = pXRRConfigCurrentConfiguration (sc, &rot); size = pXRRConfigCurrentConfiguration (sc, &rot);
rate = pXRRConfigCurrentRate (sc); rate = pXRRConfigCurrentRate (sc);
pXRRFreeScreenConfigInfo(sc); pXRRFreeScreenConfigInfo(sc);
wine_tsx11_unlock();
for (i = 0; i < xrandr_mode_count; ++i) for (i = 0; i < xrandr_mode_count; ++i)
{ {
if (xrandr10_modes[i] == size && dd_modes[i].refresh_rate == rate) if (xrandr10_modes[i] == size && dd_modes[i].refresh_rate == rate)
@ -154,8 +151,7 @@ static LONG xrandr10_set_current_mode( int mode )
Status stat; Status stat;
short rate; short rate;
wine_tsx11_lock(); root = DefaultRootWindow( gdi_display );
root = RootWindow (gdi_display, DefaultScreen(gdi_display));
sc = pXRRGetScreenInfo (gdi_display, root); sc = pXRRGetScreenInfo (gdi_display, root);
size = pXRRConfigCurrentConfiguration (sc, &rot); size = pXRRConfigCurrentConfiguration (sc, &rot);
mode = mode % xrandr_mode_count; mode = mode % xrandr_mode_count;
@ -174,7 +170,7 @@ static LONG xrandr10_set_current_mode( int mode )
stat = pXRRSetScreenConfig( gdi_display, sc, root, size, rot, CurrentTime ); stat = pXRRSetScreenConfig( gdi_display, sc, root, size, rot, CurrentTime );
pXRRFreeScreenConfigInfo(sc); pXRRFreeScreenConfigInfo(sc);
wine_tsx11_unlock();
if (stat == RRSetConfigSuccess) if (stat == RRSetConfigSuccess)
{ {
X11DRV_resize_desktop( dd_modes[mode].width, dd_modes[mode].height ); X11DRV_resize_desktop( dd_modes[mode].width, dd_modes[mode].height );
@ -271,10 +267,8 @@ static int xrandr12_get_current_mode(void)
XRRCrtcInfo *crtc_info; XRRCrtcInfo *crtc_info;
int i, ret = -1; int i, ret = -1;
wine_tsx11_lock();
if (!(resources = xrandr_get_screen_resources( gdi_display, root_window ))) if (!(resources = xrandr_get_screen_resources( gdi_display, root_window )))
{ {
wine_tsx11_unlock();
ERR("Failed to get screen resources.\n"); ERR("Failed to get screen resources.\n");
return 0; return 0;
} }
@ -282,7 +276,6 @@ static int xrandr12_get_current_mode(void)
if (!resources->ncrtc || !(crtc_info = pXRRGetCrtcInfo( gdi_display, resources, resources->crtcs[0] ))) if (!resources->ncrtc || !(crtc_info = pXRRGetCrtcInfo( gdi_display, resources, resources->crtcs[0] )))
{ {
pXRRFreeScreenResources( resources ); pXRRFreeScreenResources( resources );
wine_tsx11_unlock();
ERR("Failed to get CRTC info.\n"); ERR("Failed to get CRTC info.\n");
return 0; return 0;
} }
@ -301,7 +294,6 @@ static int xrandr12_get_current_mode(void)
pXRRFreeCrtcInfo( crtc_info ); pXRRFreeCrtcInfo( crtc_info );
pXRRFreeScreenResources( resources ); pXRRFreeScreenResources( resources );
wine_tsx11_unlock();
if (ret == -1) if (ret == -1)
{ {
@ -320,10 +312,8 @@ static LONG xrandr12_set_current_mode( int mode )
mode = mode % xrandr_mode_count; mode = mode % xrandr_mode_count;
wine_tsx11_lock();
if (!(resources = xrandr_get_screen_resources( gdi_display, root_window ))) if (!(resources = xrandr_get_screen_resources( gdi_display, root_window )))
{ {
wine_tsx11_unlock();
ERR("Failed to get screen resources.\n"); ERR("Failed to get screen resources.\n");
return DISP_CHANGE_FAILED; return DISP_CHANGE_FAILED;
} }
@ -331,7 +321,6 @@ static LONG xrandr12_set_current_mode( int mode )
if (!resources->ncrtc || !(crtc_info = pXRRGetCrtcInfo( gdi_display, resources, resources->crtcs[0] ))) if (!resources->ncrtc || !(crtc_info = pXRRGetCrtcInfo( gdi_display, resources, resources->crtcs[0] )))
{ {
pXRRFreeScreenResources( resources ); pXRRFreeScreenResources( resources );
wine_tsx11_unlock();
ERR("Failed to get CRTC info.\n"); ERR("Failed to get CRTC info.\n");
return DISP_CHANGE_FAILED; return DISP_CHANGE_FAILED;
} }
@ -344,7 +333,6 @@ static LONG xrandr12_set_current_mode( int mode )
pXRRFreeCrtcInfo( crtc_info ); pXRRFreeCrtcInfo( crtc_info );
pXRRFreeScreenResources( resources ); pXRRFreeScreenResources( resources );
wine_tsx11_unlock();
if (status != RRSetConfigSuccess) if (status != RRSetConfigSuccess)
{ {
@ -448,11 +436,10 @@ void X11DRV_XRandR_Init(void)
if (!(ret = load_xrandr())) return; /* can't load the Xrandr library */ if (!(ret = load_xrandr())) return; /* can't load the Xrandr library */
/* see if Xrandr is available */ /* see if Xrandr is available */
wine_tsx11_lock(); if (!pXRRQueryExtension( gdi_display, &event_base, &error_base )) return;
if (!pXRRQueryExtension( gdi_display, &event_base, &error_base )) goto done;
X11DRV_expect_error( gdi_display, XRandRErrorHandler, NULL ); X11DRV_expect_error( gdi_display, XRandRErrorHandler, NULL );
ok = pXRRQueryVersion( gdi_display, &major, &minor ); ok = pXRRQueryVersion( gdi_display, &major, &minor );
if (X11DRV_check_error() || !ok) goto done; if (X11DRV_check_error() || !ok) return;
TRACE("Found XRandR %d.%d.\n", major, minor); TRACE("Found XRandR %d.%d.\n", major, minor);
@ -470,9 +457,6 @@ void X11DRV_XRandR_Init(void)
else else
#endif #endif
xrandr10_init_modes(); xrandr10_init_modes();
done:
wine_tsx11_unlock();
} }
#else /* SONAME_LIBXRANDR */ #else /* SONAME_LIBXRANDR */

View File

@ -137,7 +137,6 @@ static LONG X11DRV_XF86VM_SetCurrentMode(int mode)
} }
mode = mode % real_xf86vm_mode_count; mode = mode % real_xf86vm_mode_count;
wine_tsx11_lock();
TRACE("Resizing X display to %dx%d\n", TRACE("Resizing X display to %dx%d\n",
real_xf86vm_modes[mode]->hdisplay, real_xf86vm_modes[mode]->vdisplay); real_xf86vm_modes[mode]->hdisplay, real_xf86vm_modes[mode]->vdisplay);
pXF86VidModeSwitchToMode(gdi_display, DefaultScreen(gdi_display), real_xf86vm_modes[mode]); pXF86VidModeSwitchToMode(gdi_display, DefaultScreen(gdi_display), real_xf86vm_modes[mode]);
@ -147,7 +146,6 @@ static LONG X11DRV_XF86VM_SetCurrentMode(int mode)
XWarpPointer(gdi_display, None, DefaultRootWindow(gdi_display), 0, 0, 0, 0, 0, 0); XWarpPointer(gdi_display, None, DefaultRootWindow(gdi_display), 0, 0, 0, 0, 0, 0);
#endif #endif
XSync(gdi_display, False); XSync(gdi_display, False);
wine_tsx11_unlock();
X11DRV_resize_desktop( real_xf86vm_modes[mode]->hdisplay, real_xf86vm_modes[mode]->vdisplay ); X11DRV_resize_desktop( real_xf86vm_modes[mode]->hdisplay, real_xf86vm_modes[mode]->vdisplay );
return DISP_CHANGE_SUCCESSFUL; return DISP_CHANGE_SUCCESSFUL;
} }