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

Removed the remaining TSX calls.

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