winex11: Avoid using kernel32 functions in user driver.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2022-05-02 20:00:27 +02:00 committed by Alexandre Julliard
parent 1a89cea4f6
commit a34669b238
4 changed files with 21 additions and 19 deletions

View File

@ -736,7 +736,7 @@ NTSTATUS x11drv_tablet_load_info( void *hwnd )
Button = (XButtonInfoPtr) any;
TRACE(" ButtonInput %d: [class %d|length %d|num_buttons %d]\n",
class_loop, (int) Button->class, Button->length, Button->num_buttons);
cursor.BTNNAMES = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR)*cchBuf);
cursor.BTNNAMES = malloc( sizeof(WCHAR) * cchBuf );
for (i = 0; i < cursor.BUTTONS; i++)
{
/* FIXME - these names are probably incorrect */
@ -744,14 +744,14 @@ NTSTATUS x11drv_tablet_load_info( void *hwnd )
while (cch > cchBuf - cchPos - 1) /* we want one extra byte for the last NUL */
{
cchBuf *= 2;
cursor.BTNNAMES = HeapReAlloc(GetProcessHeap(), 0, cursor.BTNNAMES, sizeof(WCHAR)*cchBuf);
cursor.BTNNAMES = realloc( cursor.BTNNAMES, sizeof(WCHAR) * cchBuf );
}
strcpyW(cursor.BTNNAMES + cchPos, cursor.NAME);
cchPos += cch;
}
cursor.BTNNAMES[cchPos++] = 0;
cursor.BTNNAMES = HeapReAlloc(GetProcessHeap(), 0, cursor.BTNNAMES, sizeof(WCHAR)*cchPos);
cursor.BTNNAMES = realloc( cursor.BTNNAMES, sizeof(WCHAR)*cchPos );
cursor.cchBTNNAMES = cchPos;
}
break;

View File

@ -28,6 +28,7 @@
#include <string.h>
#include <sys/time.h>
#include <unistd.h>
#include <assert.h>
#include <dlfcn.h>
#include <X11/cursorfont.h>
#include <X11/Xlib.h>
@ -293,7 +294,7 @@ static int error_handler( Display *display, XErrorEvent *error_evt )
{
ERR( "X protocol error: serial=%ld, request_code=%d - breaking into debugger\n",
error_evt->serial, error_evt->request_code );
DebugBreak(); /* force an entry in the debugger */
assert( 0 );
}
old_error_handler( display, error_evt );
return 0;

View File

@ -72,13 +72,7 @@ static void X11DRV_ImmSetInternalString(DWORD dwOffset,
if (byte_expansion + dwCompStringLength >= dwCompStringSize)
{
if (CompositionString)
ptr_new = HeapReAlloc(GetProcessHeap(), 0, CompositionString,
dwCompStringSize + byte_expansion);
else
ptr_new = HeapAlloc(GetProcessHeap(), 0,
dwCompStringSize + byte_expansion);
ptr_new = realloc( CompositionString, dwCompStringSize + byte_expansion );
if (ptr_new == NULL)
{
ERR("Couldn't expand composition string buffer\n");
@ -150,7 +144,7 @@ static void XIMPreEditDoneCallback(XIC ic, XPointer client_data, XPointer call_d
TRACE("PreeditDoneCallback %p\n",ic);
ximInComposeMode = FALSE;
if (dwCompStringSize)
HeapFree(GetProcessHeap(), 0, CompositionString);
free( CompositionString );
dwCompStringSize = 0;
dwCompStringLength = 0;
CompositionString = NULL;
@ -464,17 +458,24 @@ XIC X11DRV_CreateIC(XIM xim, struct x11drv_win_data *data)
XIC xic;
XICCallback destroy = {(XPointer)data, X11DRV_DestroyIC};
XICCallback P_StateNotifyCB, P_StartCB, P_DoneCB, P_DrawCB, P_CaretCB;
LANGID langid = PRIMARYLANGID(LANGIDFROMLCID(GetThreadLocale()));
LCID lcid;
Window win = data->whole_window;
XFontSet fontSet = x11drv_thread_data()->font_set;
TRACE("xim = %p\n", xim);
lcid = NtCurrentTeb()->CurrentLocale;
if (!lcid) NtQueryDefaultLocale( TRUE, &lcid );
/* use complex and slow XIC initialization method only for CJK */
if (langid != LANG_CHINESE &&
langid != LANG_JAPANESE &&
langid != LANG_KOREAN)
switch (PRIMARYLANGID(LANGIDFROMLCID(lcid)))
{
case LANG_CHINESE:
case LANG_JAPANESE:
case LANG_KOREAN:
break;
default:
xic = XCreateIC(xim,
XNInputStyle, XIMPreeditNothing | XIMStatusNothing,
XNClientWindow, win,

View File

@ -774,7 +774,7 @@ static AA_Type aa_type_from_flags( UINT aa_flags )
static UINT get_xft_aa_flags( const LOGFONTW *lf )
{
char *value;
char *value, *p;
UINT ret = 0;
switch (lf->lfQuality)
@ -785,8 +785,8 @@ static UINT get_xft_aa_flags( const LOGFONTW *lf )
default:
if (!(value = XGetDefault( gdi_display, "Xft", "antialias" ))) break;
TRACE( "got antialias '%s'\n", value );
if (tolower(value[0]) == 'f' || tolower(value[0]) == 'n' ||
value[0] == '0' || !_strnicmp( value, "off", -1 ))
for (p = value; *p; p++) if ('A' <= *p && *p <= 'Z') *p += 'a' - 'A'; /* to lower */
if (value[0] == 'f' || value[0] == 'n' || value[0] == '0' || !strcmp( value, "off" ))
{
ret = GGO_BITMAP;
break;