Commit 64c0e2ac authored by Alexandre Julliard's avatar Alexandre Julliard

Removed the remaining TSX calls.

parent 3976f463
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#define NONAMELESSUNION #define NONAMELESSUNION
#define NONAMELESSSTRUCT #define NONAMELESSSTRUCT
#include "ts_xlib.h" #include <X11/Xlib.h>
#include <X11/extensions/xf86dga.h> #include <X11/extensions/xf86dga.h>
#include "x11drv.h" #include "x11drv.h"
...@@ -126,7 +126,9 @@ void X11DRV_XF86DGA2_Init(void) ...@@ -126,7 +126,9 @@ void X11DRV_XF86DGA2_Init(void)
void X11DRV_XF86DGA2_Cleanup(void) void X11DRV_XF86DGA2_Cleanup(void)
{ {
if (modes) TSXFree(modes); wine_tsx11_lock();
if (modes) XFree(modes);
wine_tsx11_unlock();
} }
static XDGADevice *dga_dev; static XDGADevice *dga_dev;
......
...@@ -24,8 +24,7 @@ ...@@ -24,8 +24,7 @@
#include <X11/Xatom.h> #include <X11/Xatom.h>
#include <X11/keysym.h> #include <X11/keysym.h>
#include <X11/Xlib.h>
#include "ts_xlib.h"
#include <X11/Xresource.h> #include <X11/Xresource.h>
#include <X11/Xutil.h> #include <X11/Xutil.h>
#ifdef HAVE_LIBXXF86DGA2 #ifdef HAVE_LIBXXF86DGA2
...@@ -632,6 +631,8 @@ static Atom EVENT_SelectionRequest_TARGETS( Display *display, Window requestor, ...@@ -632,6 +631,8 @@ static Atom EVENT_SelectionRequest_TARGETS( Display *display, Window requestor,
EVENT_SelectionRequest_AddTARGETS(targets, &cTargets, alias); EVENT_SelectionRequest_AddTARGETS(targets, &cTargets, alias);
} }
wine_tsx11_lock();
if (TRACE_ON(clipboard)) if (TRACE_ON(clipboard))
{ {
int i; int i;
...@@ -639,17 +640,18 @@ static Atom EVENT_SelectionRequest_TARGETS( Display *display, Window requestor, ...@@ -639,17 +640,18 @@ static Atom EVENT_SelectionRequest_TARGETS( Display *display, Window requestor,
{ {
if (targets[i]) if (targets[i])
{ {
char *itemFmtName = TSXGetAtomName(display, targets[i]); char *itemFmtName = XGetAtomName(display, targets[i]);
TRACE_(clipboard)("\tAtom# %d: Property %ld Type %s\n", i, targets[i], itemFmtName); TRACE_(clipboard)("\tAtom# %d: Property %ld Type %s\n", i, targets[i], itemFmtName);
TSXFree(itemFmtName); XFree(itemFmtName);
} }
} }
} }
/* We may want to consider setting the type to xaTargets instead, /* We may want to consider setting the type to xaTargets instead,
* in case some apps expect this instead of XA_ATOM */ * in case some apps expect this instead of XA_ATOM */
TSXChangeProperty(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);
...@@ -678,7 +680,6 @@ static Atom EVENT_SelectionRequest_MULTIPLE( HWND hWnd, XSelectionRequestEvent * ...@@ -678,7 +680,6 @@ static Atom EVENT_SelectionRequest_MULTIPLE( HWND hWnd, XSelectionRequestEvent *
unsigned long remain; unsigned long remain;
Atom* targetPropList=NULL; Atom* targetPropList=NULL;
unsigned long cTargetPropList = 0; unsigned long cTargetPropList = 0;
/* Atom xAtomPair = TSXInternAtom(display, "ATOM_PAIR", False); */
/* If the specified property is None the requestor is an obsolete client. /* If the specified property is None the requestor is an obsolete client.
* We support these by using the specified target atom as the reply property. * We support these by using the specified target atom as the reply property.
...@@ -692,15 +693,20 @@ static Atom EVENT_SelectionRequest_MULTIPLE( HWND hWnd, XSelectionRequestEvent * ...@@ -692,15 +693,20 @@ static Atom EVENT_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.
*/ */
if(TSXGetWindowProperty(display, pevent->requestor, rprop, wine_tsx11_lock();
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"); TRACE("\tCouldn't read MULTIPLE property\n");
}
else else
{ {
TRACE("\tType %s,Format %d,nItems %ld, Remain %ld\n", TRACE("\tType %s,Format %d,nItems %ld, Remain %ld\n",
TSXGetAtomName(display, atype), aformat, cTargetPropList, remain); XGetAtomName(display, atype), aformat, cTargetPropList, remain);
wine_tsx11_unlock();
/* /*
* Make sure we got what we expect. * Make sure we got what we expect.
...@@ -723,12 +729,15 @@ static Atom EVENT_SelectionRequest_MULTIPLE( HWND hWnd, XSelectionRequestEvent * ...@@ -723,12 +729,15 @@ static Atom EVENT_SelectionRequest_MULTIPLE( HWND hWnd, XSelectionRequestEvent *
if (TRACE_ON(event)) if (TRACE_ON(event))
{ {
char *targetName = TSXGetAtomName(display, targetPropList[i]); char *targetName, *propName;
char *propName = TSXGetAtomName(display, targetPropList[i+1]); wine_tsx11_lock();
targetName = XGetAtomName(display, targetPropList[i]);
propName = XGetAtomName(display, targetPropList[i+1]);
TRACE("MULTIPLE(%d): Target='%s' Prop='%s'\n", TRACE("MULTIPLE(%d): Target='%s' Prop='%s'\n",
i/2, targetName, propName); i/2, targetName, propName);
TSXFree(targetName); XFree(targetName);
TSXFree(propName); XFree(propName);
wine_tsx11_unlock();
} }
/* We must have a non "None" property to service a MULTIPLE target atom */ /* We must have a non "None" property to service a MULTIPLE target atom */
...@@ -751,7 +760,9 @@ static Atom EVENT_SelectionRequest_MULTIPLE( HWND hWnd, XSelectionRequestEvent * ...@@ -751,7 +760,9 @@ static Atom EVENT_SelectionRequest_MULTIPLE( HWND hWnd, XSelectionRequestEvent *
} }
/* Free the list of targets/properties */ /* Free the list of targets/properties */
TSXFree(targetPropList); wine_tsx11_lock();
XFree(targetPropList);
wine_tsx11_unlock();
} }
END: END:
...@@ -829,19 +840,16 @@ static void EVENT_SelectionRequest( HWND hWnd, XSelectionRequestEvent *event, BO ...@@ -829,19 +840,16 @@ static void EVENT_SelectionRequest( HWND hWnd, XSelectionRequestEvent *event, BO
TRACE_(clipboard)("\tUpdating property %s, %ld bytes\n", TRACE_(clipboard)("\tUpdating property %s, %ld bytes\n",
lpFormat->Name, cBytes); lpFormat->Name, cBytes);
TSXChangeProperty(display, request, rprop, event->target, wine_tsx11_lock();
XChangeProperty(display, request, rprop, event->target,
8, PropModeReplace, (unsigned char *)lpClipData, cBytes); 8, PropModeReplace, (unsigned char *)lpClipData, cBytes);
wine_tsx11_unlock();
GlobalUnlock(hClipData); GlobalUnlock(hClipData);
GlobalFree(hClipData); GlobalFree(hClipData);
} }
} }
} }
else
{
TRACE_(clipboard)("Request for property %s (%ld) failed\n",
TSXGetAtomName(display, event->target), event->target);
}
} }
END: END:
...@@ -887,15 +895,15 @@ static void EVENT_PropertyNotify( XPropertyEvent *event ) ...@@ -887,15 +895,15 @@ static void EVENT_PropertyNotify( XPropertyEvent *event )
{ {
case PropertyDelete: case PropertyDelete:
{ {
TRACE("\tPropertyDelete for atom %s on window %ld\n", TRACE("\tPropertyDelete for atom %ld on window %ld\n",
TSXGetAtomName(event->display, event->atom), (long)event->window); event->atom, (long)event->window);
break; break;
} }
case PropertyNewValue: case PropertyNewValue:
{ {
TRACE("\tPropertyNewValue for atom %s on window %ld\n\n", TRACE("\tPropertyNewValue for atom %ld on window %ld\n\n",
TSXGetAtomName(event->display, event->atom), (long)event->window); event->atom, (long)event->window);
break; break;
} }
...@@ -980,9 +988,11 @@ static void EVENT_DropFromOffiX( HWND hWnd, XClientMessageEvent *event ) ...@@ -980,9 +988,11 @@ static void EVENT_DropFromOffiX( HWND hWnd, XClientMessageEvent *event )
pWnd = WIN_FindWndPtr(hWnd); pWnd = WIN_FindWndPtr(hWnd);
TSXQueryPointer( event->display, get_whole_window(pWnd), &w_aux_root, &w_aux_child, wine_tsx11_lock();
XQueryPointer( event->display, get_whole_window(pWnd), &w_aux_root, &w_aux_child,
&x, &y, (int *) &u.pt_aux.x, (int *) &u.pt_aux.y, &x, &y, (int *) &u.pt_aux.x, (int *) &u.pt_aux.y,
(unsigned int*)&aux_long); (unsigned int*)&aux_long);
wine_tsx11_unlock();
/* find out drop point and drop window */ /* find out drop point and drop window */
if( x < 0 || y < 0 || if( x < 0 || y < 0 ||
...@@ -1013,10 +1023,12 @@ static void EVENT_DropFromOffiX( HWND hWnd, XClientMessageEvent *event ) ...@@ -1013,10 +1023,12 @@ static void EVENT_DropFromOffiX( HWND hWnd, XClientMessageEvent *event )
if (!bAccept) return; if (!bAccept) return;
TSXGetWindowProperty( event->display, DefaultRootWindow(event->display), wine_tsx11_lock();
XGetWindowProperty( event->display, DefaultRootWindow(event->display),
x11drv_atom(DndSelection), 0, 65535, FALSE, x11drv_atom(DndSelection), 0, 65535, FALSE,
AnyPropertyType, &u.atom_aux, (int *) &u.pt_aux.y, AnyPropertyType, &u.atom_aux, (int *) &u.pt_aux.y,
&data_length, &aux_long, &p_data); &data_length, &aux_long, &p_data);
wine_tsx11_unlock();
if( !aux_long && p_data) /* don't bother if > 64K */ if( !aux_long && p_data) /* don't bother if > 64K */
{ {
...@@ -1073,7 +1085,9 @@ static void EVENT_DropFromOffiX( HWND hWnd, XClientMessageEvent *event ) ...@@ -1073,7 +1085,9 @@ static void EVENT_DropFromOffiX( HWND hWnd, XClientMessageEvent *event )
} }
} }
} }
if( p_data ) TSXFree(p_data); wine_tsx11_lock();
if( p_data ) XFree(p_data);
wine_tsx11_unlock();
} }
/********************************************************************** /**********************************************************************
...@@ -1102,10 +1116,12 @@ static void EVENT_DropURLs( HWND hWnd, XClientMessageEvent *event ) ...@@ -1102,10 +1116,12 @@ static void EVENT_DropURLs( HWND hWnd, XClientMessageEvent *event )
if (!(GetWindowLongW( hWnd, GWL_EXSTYLE ) & WS_EX_ACCEPTFILES)) return; if (!(GetWindowLongW( hWnd, GWL_EXSTYLE ) & WS_EX_ACCEPTFILES)) return;
TSXGetWindowProperty( event->display, DefaultRootWindow(event->display), wine_tsx11_lock();
XGetWindowProperty( event->display, DefaultRootWindow(event->display),
x11drv_atom(DndSelection), 0, 65535, FALSE, x11drv_atom(DndSelection), 0, 65535, FALSE,
AnyPropertyType, &u.atom_aux, &u.i, AnyPropertyType, &u.atom_aux, &u.i,
&data_length, &aux_long, &p_data); &data_length, &aux_long, &p_data);
wine_tsx11_unlock();
if (aux_long) if (aux_long)
WARN("property too large, truncated!\n"); WARN("property too large, truncated!\n");
TRACE("urls=%s\n", p_data); TRACE("urls=%s\n", p_data);
...@@ -1130,8 +1146,10 @@ static void EVENT_DropURLs( HWND hWnd, XClientMessageEvent *event ) ...@@ -1130,8 +1146,10 @@ static void EVENT_DropURLs( HWND hWnd, XClientMessageEvent *event )
} }
if( drop_len && drop_len < 65535 ) { if( drop_len && drop_len < 65535 ) {
TSXQueryPointer( event->display, root_window, &u.w_aux, &u.w_aux, wine_tsx11_lock();
XQueryPointer( event->display, root_window, &u.w_aux, &u.w_aux,
&x, &y, &u.i, &u.i, &u.i); &x, &y, &u.i, &u.i, &u.i);
wine_tsx11_unlock();
drop_len += sizeof(DROPFILES) + 1; drop_len += sizeof(DROPFILES) + 1;
hDrop = GlobalAlloc( GMEM_SHARE, drop_len ); hDrop = GlobalAlloc( GMEM_SHARE, drop_len );
...@@ -1183,7 +1201,9 @@ static void EVENT_DropURLs( HWND hWnd, XClientMessageEvent *event ) ...@@ -1183,7 +1201,9 @@ static void EVENT_DropURLs( HWND hWnd, XClientMessageEvent *event )
PostMessageA( hWnd, WM_DROPFILES, (WPARAM)hDrop, 0L ); PostMessageA( hWnd, WM_DROPFILES, (WPARAM)hDrop, 0L );
} }
} }
if( p_data ) TSXFree(p_data); wine_tsx11_lock();
if( p_data ) XFree(p_data);
wine_tsx11_unlock();
} }
} }
...@@ -1223,10 +1243,12 @@ static void EVENT_ClientMessage( HWND hWnd, XClientMessageEvent *event ) ...@@ -1223,10 +1243,12 @@ static void EVENT_ClientMessage( HWND hWnd, XClientMessageEvent *event )
int i; int i;
Atom atom; Atom atom;
} u; /* unused */ } u; /* unused */
TSXGetWindowProperty( event->display, DefaultRootWindow(event->display), wine_tsx11_lock();
XGetWindowProperty( event->display, DefaultRootWindow(event->display),
dndSelection, 0, 65535, FALSE, dndSelection, 0, 65535, FALSE,
AnyPropertyType, &u.atom, &u.i, AnyPropertyType, &u.atom, &u.i,
&u.l, &u.l, &p_data); &u.l, &u.l, &p_data);
wine_tsx11_unlock();
TRACE("message_type=%ld, data=%ld,%ld,%ld,%ld,%ld, msg=%s\n", TRACE("message_type=%ld, data=%ld,%ld,%ld,%ld,%ld, msg=%s\n",
event->message_type, event->data.l[0], event->data.l[1], event->message_type, event->data.l[0], event->data.l[1],
event->data.l[2], event->data.l[3], event->data.l[4], event->data.l[2], event->data.l[3], event->data.l[4],
......
...@@ -27,8 +27,7 @@ ...@@ -27,8 +27,7 @@
#include <X11/Xatom.h> #include <X11/Xatom.h>
#include <X11/keysym.h> #include <X11/keysym.h>
#include <X11/Xlib.h>
#include "ts_xlib.h"
#include <X11/Xresource.h> #include <X11/Xresource.h>
#include <X11/Xutil.h> #include <X11/Xutil.h>
#ifdef HAVE_XKB #ifdef HAVE_XKB
...@@ -1108,7 +1107,9 @@ void X11DRV_KeyEvent( HWND hwnd, XKeyEvent *event ) ...@@ -1108,7 +1107,9 @@ void X11DRV_KeyEvent( HWND hwnd, XKeyEvent *event )
if ((keysym >= XK_ISO_Lock && keysym <= XK_ISO_Last_Group_Lock) || if ((keysym >= XK_ISO_Lock && keysym <= XK_ISO_Last_Group_Lock) ||
keysym == XK_Mode_switch) keysym == XK_Mode_switch)
{ {
TRACE("Ignoring %s keyboard event\n", TSXKeysymToString(keysym)); wine_tsx11_lock();
TRACE("Ignoring %s keyboard event\n", XKeysymToString(keysym));
wine_tsx11_unlock();
return; return;
} }
...@@ -1130,7 +1131,9 @@ void X11DRV_KeyEvent( HWND hwnd, XKeyEvent *event ) ...@@ -1130,7 +1131,9 @@ void X11DRV_KeyEvent( HWND hwnd, XKeyEvent *event )
if (TRACE_ON(key)){ if (TRACE_ON(key)){
char *ksname; char *ksname;
ksname = TSXKeysymToString(keysym); wine_tsx11_lock();
ksname = XKeysymToString(keysym);
wine_tsx11_unlock();
if (!ksname) if (!ksname)
ksname = "No Name"; ksname = "No Name";
TRACE_(key)("%s : keysym=%lX (%s), # of chars=%d / 0x%02x / '%s'\n", TRACE_(key)("%s : keysym=%lX (%s), # of chars=%d / 0x%02x / '%s'\n",
...@@ -1662,12 +1665,14 @@ SHORT X11DRV_VkKeyScanEx(WCHAR wChar, HKL hkl) ...@@ -1662,12 +1665,14 @@ SHORT X11DRV_VkKeyScanEx(WCHAR wChar, HKL hkl)
keysym = (unsigned char)cChar; /* (!) cChar is signed */ keysym = (unsigned char)cChar; /* (!) cChar is signed */
if (keysym <= 27) keysym += 0xFF00; /* special chars : return, backspace... */ if (keysym <= 27) keysym += 0xFF00; /* special chars : return, backspace... */
keycode = TSXKeysymToKeycode(display, keysym); /* keysym -> keycode */ wine_tsx11_lock();
keycode = XKeysymToKeycode(display, keysym); /* keysym -> keycode */
if (!keycode) if (!keycode)
{ /* It didn't work ... let's try with deadchar code. */ { /* It didn't work ... let's try with deadchar code. */
TRACE("retrying with | 0xFE00\n"); TRACE("retrying with | 0xFE00\n");
keycode = TSXKeysymToKeycode(display, keysym | 0xFE00); keycode = XKeysymToKeycode(display, keysym | 0xFE00);
} }
wine_tsx11_unlock();
TRACE("'%c'(%#lx, %lu): got keycode %#.2x (%d)\n", TRACE("'%c'(%#lx, %lu): got keycode %#.2x (%d)\n",
cChar, keysym, keysym, keycode, keycode); cChar, keysym, keysym, keycode, keycode);
...@@ -1682,14 +1687,16 @@ SHORT X11DRV_VkKeyScanEx(WCHAR wChar, HKL hkl) ...@@ -1682,14 +1687,16 @@ SHORT X11DRV_VkKeyScanEx(WCHAR wChar, HKL hkl)
} }
index = -1; index = -1;
wine_tsx11_lock();
for (i = 0; i < 4; i++) /* find shift state */ for (i = 0; i < 4; i++) /* find shift state */
{ {
if (TSXKeycodeToKeysym(display, keycode, i) == keysym) if (XKeycodeToKeysym(display, keycode, i) == keysym)
{ {
index = i; index = i;
break; break;
} }
} }
wine_tsx11_unlock();
switch (index) switch (index)
{ {
...@@ -1894,9 +1901,11 @@ INT X11DRV_GetKeyNameText(LONG lParam, LPWSTR lpBuffer, INT nSize) ...@@ -1894,9 +1901,11 @@ INT X11DRV_GetKeyNameText(LONG lParam, LPWSTR lpBuffer, INT nSize)
break; break;
if (keyi <= max_keycode) if (keyi <= max_keycode)
{ {
wine_tsx11_lock();
keyc = (KeyCode) keyi; keyc = (KeyCode) keyi;
keys = TSXKeycodeToKeysym(thread_display(), keyc, 0); keys = XKeycodeToKeysym(thread_display(), keyc, 0);
name = TSXKeysymToString(keys); name = XKeysymToString(keys);
wine_tsx11_unlock();
TRACE("found scan=%04x keyc=%04x keysym=%04x string=%s\n", TRACE("found scan=%04x keyc=%04x keysym=%04x string=%s\n",
scanCode, keyc, (int)keys, name); scanCode, keyc, (int)keys, name);
if (lpBuffer && nSize && name) if (lpBuffer && nSize && name)
...@@ -2130,7 +2139,9 @@ INT X11DRV_ToUnicodeEx(UINT virtKey, UINT scanCode, LPBYTE lpKeyState, ...@@ -2130,7 +2139,9 @@ INT X11DRV_ToUnicodeEx(UINT virtKey, UINT scanCode, LPBYTE lpKeyState,
{ {
char *ksname; char *ksname;
ksname = TSXKeysymToString(keysym); wine_tsx11_lock();
ksname = XKeysymToString(keysym);
wine_tsx11_unlock();
if (!ksname) if (!ksname)
ksname = "No Name"; ksname = "No Name";
if ((keysym >> 8) != 0xff) if ((keysym >> 8) != 0xff)
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#include "config.h" #include "config.h"
#include "ts_xlib.h" #include <X11/Xlib.h>
#ifdef HAVE_LIBXXF86DGA2 #ifdef HAVE_LIBXXF86DGA2
#include <X11/extensions/xf86dga.h> #include <X11/extensions/xf86dga.h>
#endif #endif
...@@ -527,15 +527,17 @@ void X11DRV_GetCursorPos(LPPOINT pos) ...@@ -527,15 +527,17 @@ void X11DRV_GetCursorPos(LPPOINT pos)
int rootX, rootY, winX, winY; int rootX, rootY, winX, winY;
unsigned int xstate; unsigned int xstate;
if (!TSXQueryPointer( display, root_window, &root, &child, wine_tsx11_lock();
if (XQueryPointer( display, root_window, &root, &child,
&rootX, &rootY, &winX, &winY, &xstate )) &rootX, &rootY, &winX, &winY, &xstate ))
return; {
update_key_state( xstate ); update_key_state( xstate );
update_button_state( xstate ); update_button_state( xstate );
TRACE("pointer at (%d,%d)\n", winX, winY ); TRACE("pointer at (%d,%d)\n", winX, winY );
pos->x = winX; pos->x = winX;
pos->y = winY; pos->y = winY;
}
wine_tsx11_unlock();
} }
/*********************************************************************** /***********************************************************************
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
# include <unistd.h> # include <unistd.h>
#endif #endif
#include "ts_xlib.h" #include <X11/Xlib.h>
#include <X11/Xresource.h> #include <X11/Xresource.h>
#include <X11/Xutil.h> #include <X11/Xutil.h>
...@@ -977,7 +977,9 @@ BOOL X11DRV_CreateWindow( HWND hwnd, CREATESTRUCTA *cs, BOOL unicode ) ...@@ -977,7 +977,9 @@ BOOL X11DRV_CreateWindow( HWND hwnd, CREATESTRUCTA *cs, BOOL unicode )
if (!create_whole_window( display, wndPtr )) goto failed; if (!create_whole_window( display, wndPtr )) goto failed;
if (!create_client_window( display, wndPtr )) goto failed; if (!create_client_window( display, wndPtr )) goto failed;
TSXSync( display, False ); wine_tsx11_lock();
XSync( display, False );
wine_tsx11_unlock();
SetPropA( hwnd, whole_window_atom, (HANDLE)data->whole_window ); SetPropA( hwnd, whole_window_atom, (HANDLE)data->whole_window );
SetPropA( hwnd, client_window_atom, (HANDLE)data->client_window ); SetPropA( hwnd, client_window_atom, (HANDLE)data->client_window );
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
#include "config.h" #include "config.h"
#include "ts_xlib.h" #include <X11/Xlib.h>
#ifdef HAVE_LIBXSHAPE #ifdef HAVE_LIBXSHAPE
#include <X11/IntrinsicP.h> #include <X11/IntrinsicP.h>
#include <X11/extensions/shape.h> #include <X11/extensions/shape.h>
...@@ -804,7 +804,9 @@ static void set_visible_style( HWND hwnd, BOOL set ) ...@@ -804,7 +804,9 @@ static void set_visible_style( HWND hwnd, BOOL set )
X11DRV_sync_window_style( display, win ); X11DRV_sync_window_style( display, win );
X11DRV_set_wm_hints( display, win ); X11DRV_set_wm_hints( display, win );
TRACE( "mapping win %p\n", hwnd ); TRACE( "mapping win %p\n", hwnd );
TSXMapWindow( display, get_whole_window(win) ); wine_tsx11_lock();
XMapWindow( display, get_whole_window(win) );
wine_tsx11_unlock();
} }
} }
else else
...@@ -814,7 +816,9 @@ static void set_visible_style( HWND hwnd, BOOL set ) ...@@ -814,7 +816,9 @@ static void set_visible_style( HWND hwnd, BOOL set )
if (!IsRectEmpty( &win->rectWindow ) && get_whole_window(win) && is_window_top_level(win)) if (!IsRectEmpty( &win->rectWindow ) && get_whole_window(win) && is_window_top_level(win))
{ {
TRACE( "unmapping win %p\n", hwnd ); TRACE( "unmapping win %p\n", hwnd );
TSXUnmapWindow( thread_display(), get_whole_window(win) ); wine_tsx11_lock();
XUnmapWindow( thread_display(), get_whole_window(win) );
wine_tsx11_unlock();
} }
} }
done: done:
...@@ -851,12 +855,16 @@ void X11DRV_SetWindowStyle( HWND hwnd, LONG oldStyle ) ...@@ -851,12 +855,16 @@ void X11DRV_SetWindowStyle( HWND hwnd, LONG oldStyle )
X11DRV_sync_window_style( display, wndPtr ); X11DRV_sync_window_style( display, wndPtr );
X11DRV_set_wm_hints( display, wndPtr ); X11DRV_set_wm_hints( display, wndPtr );
} }
TSXMapWindow( display, get_whole_window(wndPtr) ); wine_tsx11_lock();
XMapWindow( display, get_whole_window(wndPtr) );
wine_tsx11_unlock();
} }
else if (!is_window_top_level(wndPtr)) /* don't unmap managed windows */ else if (!is_window_top_level(wndPtr)) /* don't unmap managed windows */
{ {
TRACE( "unmapping win %p\n", hwnd ); TRACE( "unmapping win %p\n", hwnd );
TSXUnmapWindow( display, get_whole_window(wndPtr) ); wine_tsx11_lock();
XUnmapWindow( display, get_whole_window(wndPtr) );
wine_tsx11_unlock();
} }
} }
} }
...@@ -974,7 +982,9 @@ BOOL X11DRV_SetWindowPos( WINDOWPOS *winpos ) ...@@ -974,7 +982,9 @@ BOOL X11DRV_SetWindowPos( WINDOWPOS *winpos )
{ {
/* resizing to zero size -> unmap */ /* resizing to zero size -> unmap */
TRACE( "unmapping zero size win %p\n", winpos->hwnd ); TRACE( "unmapping zero size win %p\n", winpos->hwnd );
TSXUnmapWindow( display, get_whole_window(wndPtr) ); wine_tsx11_lock();
XUnmapWindow( display, get_whole_window(wndPtr) );
wine_tsx11_unlock();
} }
wine_tsx11_lock(); wine_tsx11_lock();
...@@ -1430,19 +1440,22 @@ static Window __get_common_ancestor( Display *display, Window A, Window B, ...@@ -1430,19 +1440,22 @@ static Window __get_common_ancestor( Display *display, Window A, Window B,
Window root, *childrenB; Window root, *childrenB;
unsigned totalB; unsigned totalB;
wine_tsx11_lock();
while( A != B && A && B ) while( A != B && A && B )
{ {
TSXQueryTree( display, A, &root, &A, children, total ); XQueryTree( display, A, &root, &A, children, total );
TSXQueryTree( display, B, &root, &B, &childrenB, &totalB ); XQueryTree( display, B, &root, &B, &childrenB, &totalB );
if( childrenB ) TSXFree( childrenB ); if( childrenB ) XFree( childrenB );
if( *children ) TSXFree( *children ), *children = NULL; if( *children ) XFree( *children ), *children = NULL;
} }
if( A && B ) if( A && B )
{ {
TSXQueryTree( display, A, &root, &B, children, total ); XQueryTree( display, A, &root, &B, children, total );
wine_tsx11_unlock();
return A; return A;
} }
wine_tsx11_unlock();
return 0 ; return 0 ;
} }
...@@ -1451,12 +1464,14 @@ static Window __get_top_decoration( Display *display, Window w, Window ancestor ...@@ -1451,12 +1464,14 @@ static Window __get_top_decoration( Display *display, Window w, Window ancestor
Window* children, root, prev = w, parent = w; Window* children, root, prev = w, parent = w;
unsigned total; unsigned total;
wine_tsx11_lock();
do do
{ {
w = parent; w = parent;
TSXQueryTree( display, w, &root, &parent, &children, &total ); XQueryTree( display, w, &root, &parent, &children, &total );
if( children ) TSXFree( children ); if( children ) XFree( children );
} while( parent && parent != ancestor ); } while( parent && parent != ancestor );
wine_tsx11_unlock();
TRACE("\t%08x -> %08x\n", (unsigned)prev, (unsigned)w ); TRACE("\t%08x -> %08x\n", (unsigned)prev, (unsigned)w );
return ( parent ) ? w : 0 ; return ( parent ) ? w : 0 ;
} }
...@@ -1524,7 +1539,9 @@ static HWND query_zorder( Display *display, HWND hWndCheck) ...@@ -1524,7 +1539,9 @@ static HWND query_zorder( Display *display, HWND hWndCheck)
} }
} }
} }
if( children ) TSXFree( children ); wine_tsx11_lock();
if( children ) XFree( children );
wine_tsx11_unlock();
done: done:
HeapFree( GetProcessHeap(), 0, list ); HeapFree( GetProcessHeap(), 0, list );
......
...@@ -53,6 +53,9 @@ struct tagCURSORICONINFO; ...@@ -53,6 +53,9 @@ struct tagCURSORICONINFO;
struct tagPALETTEOBJ; struct tagPALETTEOBJ;
struct tagWINDOWPOS; struct tagWINDOWPOS;
extern void wine_tsx11_lock(void);
extern void wine_tsx11_unlock(void);
/* X physical pen */ /* X physical pen */
typedef struct typedef struct
{ {
......
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
#include "config.h" #include "config.h"
#include "ts_xlib.h"
#include <string.h> #include <string.h>
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
# include <unistd.h> # include <unistd.h>
...@@ -123,15 +122,17 @@ int X11DRV_XDND_Event(HWND hWnd, XClientMessageEvent *event) ...@@ -123,15 +122,17 @@ int X11DRV_XDND_Event(HWND hWnd, XClientMessageEvent *event)
{ {
unsigned int i = 0; unsigned int i = 0;
wine_tsx11_lock();
for (; i < count; i++) for (; i < count; i++)
{ {
if (xdndtypes[i] != 0) if (xdndtypes[i] != 0)
{ {
char * pn = TSXGetAtomName(event->display, xdndtypes[i]); char * pn = XGetAtomName(event->display, xdndtypes[i]);
TRACE("XDNDEnterAtom %ld: %s\n", xdndtypes[i], pn); TRACE("XDNDEnterAtom %ld: %s\n", xdndtypes[i], pn);
TSXFree(pn); XFree(pn);
} }
} }
wine_tsx11_unlock();
} }
/* Do a one-time data read and cache results */ /* Do a one-time data read and cache results */
...@@ -275,7 +276,9 @@ static void X11DRV_XDND_ResolveProperty(Display *display, Window xwin, Time tm, ...@@ -275,7 +276,9 @@ static void X11DRV_XDND_ResolveProperty(Display *display, Window xwin, Time tm,
wine_tsx11_unlock(); wine_tsx11_unlock();
entries += X11DRV_XDND_MapFormat(types[i], data, icount * (actfmt / 8)); entries += X11DRV_XDND_MapFormat(types[i], data, icount * (actfmt / 8));
TSXFree(data); wine_tsx11_lock();
XFree(data);
wine_tsx11_unlock();
} }
*count = entries; *count = entries;
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include "ts_xlib.h" #include <X11/Xlib.h>
#ifdef HAVE_LIBXXF86VM #ifdef HAVE_LIBXXF86VM
#define XMD_H #define XMD_H
...@@ -216,7 +216,9 @@ void X11DRV_XF86VM_Init(void) ...@@ -216,7 +216,9 @@ void X11DRV_XF86VM_Init(void)
void X11DRV_XF86VM_Cleanup(void) void X11DRV_XF86VM_Cleanup(void)
{ {
if (real_xf86vm_modes) TSXFree(real_xf86vm_modes); wine_tsx11_lock();
if (real_xf86vm_modes) XFree(real_xf86vm_modes);
wine_tsx11_unlock();
} }
void X11DRV_XF86VM_SetExclusiveMode(int lock) void X11DRV_XF86VM_SetExclusiveMode(int lock)
......
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