Skip to content

Commit 894285b

Browse files
authored
[WRAPPER][BOX32] Minor fix and improvement to XGetICValues (#3306)
1 parent 663ae1a commit 894285b

File tree

6 files changed

+9
-15
lines changed

6 files changed

+9
-15
lines changed

src/wrapped32/generated/functions_list.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -713,7 +713,6 @@
713713
#() pFEiu -> pFEiu
714714
#() pEEip -> pEEip
715715
#() pFEiV -> pFEiV
716-
#() pFELV -> pFELV
717716
#() pEEpi -> pEEpi
718717
#() pFEpi -> pFEpi
719718
#() pFEpu -> pFEpu
@@ -3046,10 +3045,9 @@ wrappedlibx11:
30463045
- XLookupKeysym
30473046
- pFiV:
30483047
- XVaCreateNestedList
3049-
- pFLV:
3050-
- XGetICValues
30513048
- pFpV:
30523049
- XCreateIC
3050+
- XGetICValues
30533051
- XGetIMValues
30543052
- XSetICValues
30553053
- XSetIMValues

src/wrapped32/generated/wrappedlibx11types32.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ typedef int32_t (*iFpL_t)(void*, uintptr_t);
2525
typedef int32_t (*iFXp_t)(void*, void*);
2626
typedef uintptr_t (*LFpi_t)(void*, int32_t);
2727
typedef void* (*pFiV_t)(int32_t, ...);
28-
typedef void* (*pFLV_t)(uintptr_t, ...);
2928
typedef void* (*pFpV_t)(void*, ...);
3029
typedef void* (*pFXi_t)(void*, int32_t);
3130
typedef void* (*pFXL_t)(void*, uintptr_t);
@@ -119,8 +118,8 @@ typedef uintptr_t (*LFXLiiuuuiupLp_t)(void*, uintptr_t, int32_t, int32_t, uint32
119118
GO(XPutBackEvent, iFXp_t) \
120119
GO(XLookupKeysym, LFpi_t) \
121120
GO(XVaCreateNestedList, pFiV_t) \
122-
GO(XGetICValues, pFLV_t) \
123121
GO(XCreateIC, pFpV_t) \
122+
GO(XGetICValues, pFpV_t) \
124123
GO(XGetIMValues, pFpV_t) \
125124
GO(XSetICValues, pFpV_t) \
126125
GO(XSetIMValues, pFpV_t) \

src/wrapped32/generated/wrapper32.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -807,7 +807,6 @@ typedef void* (*pFEii_t)(x64emu_t*, int32_t, int32_t);
807807
typedef void* (*pFEiu_t)(x64emu_t*, int32_t, uint32_t);
808808
typedef void* (*pEEip_t)(x64emu_t*, int32_t, void*);
809809
typedef void* (*pFEiV_t)(x64emu_t*, int32_t, void*);
810-
typedef void* (*pFELV_t)(x64emu_t*, uintptr_t, void*);
811810
typedef void* (*pEEpi_t)(x64emu_t*, void*, int32_t);
812811
typedef void* (*pFEpi_t)(x64emu_t*, void*, int32_t);
813812
typedef void* (*pFEpu_t)(x64emu_t*, void*, uint32_t);
@@ -2990,7 +2989,6 @@ void pFEii_32(x64emu_t *emu, uintptr_t fcn) { pFEii_t fn = (pFEii_t)fcn; R_EAX =
29902989
void pFEiu_32(x64emu_t *emu, uintptr_t fcn) { pFEiu_t fn = (pFEiu_t)fcn; R_EAX = to_ptrv(fn(emu, from_ptri(int32_t, R_ESP + 4), from_ptri(uint32_t, R_ESP + 8))); }
29912990
void pEEip_32(x64emu_t *emu, uintptr_t fcn) { pEEip_t fn = (pEEip_t)fcn; errno = emu->libc_err; R_EAX = to_ptrv(fn(emu, from_ptri(int32_t, R_ESP + 4), from_ptriv(R_ESP + 8))); emu->libc_err = errno; }
29922991
void pFEiV_32(x64emu_t *emu, uintptr_t fcn) { pFEiV_t fn = (pFEiV_t)fcn; R_EAX = to_ptrv(fn(emu, from_ptri(int32_t, R_ESP + 4), from_ptrv(R_ESP + 8))); }
2993-
void pFELV_32(x64emu_t *emu, uintptr_t fcn) { pFELV_t fn = (pFELV_t)fcn; R_EAX = to_ptrv(fn(emu, from_ulong(from_ptri(ulong_t, R_ESP + 4)), from_ptrv(R_ESP + 8))); }
29942992
void pEEpi_32(x64emu_t *emu, uintptr_t fcn) { pEEpi_t fn = (pEEpi_t)fcn; errno = emu->libc_err; R_EAX = to_ptrv(fn(emu, from_ptriv(R_ESP + 4), from_ptri(int32_t, R_ESP + 8))); emu->libc_err = errno; }
29952993
void pFEpi_32(x64emu_t *emu, uintptr_t fcn) { pFEpi_t fn = (pFEpi_t)fcn; R_EAX = to_ptrv(fn(emu, from_ptriv(R_ESP + 4), from_ptri(int32_t, R_ESP + 8))); }
29962994
void pFEpu_32(x64emu_t *emu, uintptr_t fcn) { pFEpu_t fn = (pFEpu_t)fcn; R_EAX = to_ptrv(fn(emu, from_ptriv(R_ESP + 4), from_ptri(uint32_t, R_ESP + 8))); }

src/wrapped32/generated/wrapper32.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -754,7 +754,6 @@ void pFEii_32(x64emu_t *emu, uintptr_t fnc);
754754
void pFEiu_32(x64emu_t *emu, uintptr_t fnc);
755755
void pEEip_32(x64emu_t *emu, uintptr_t fnc);
756756
void pFEiV_32(x64emu_t *emu, uintptr_t fnc);
757-
void pFELV_32(x64emu_t *emu, uintptr_t fnc);
758757
void pEEpi_32(x64emu_t *emu, uintptr_t fnc);
759758
void pFEpi_32(x64emu_t *emu, uintptr_t fnc);
760759
void pFEpu_32(x64emu_t *emu, uintptr_t fnc);

src/wrapped32/wrappedlibx11.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2745,20 +2745,20 @@ EXPORT int my32__XReply(x64emu_t* emu, void* dpy, void* rep, int extra, int disc
27452745
return ret;
27462746
}
27472747

2748-
EXPORT void* my32_XGetICValues(x64emu_t* emu, size_t ic, ptr_t* V)
2748+
EXPORT void* my32_XGetICValues(x64emu_t* emu, void* ic, ptr_t* V)
27492749
{
27502750
void* ret = NULL;
27512751
while(!ret && *V) {
27522752
char* name = from_ptrv(V[0]);
27532753
void* val = from_ptrv(V[1]);
27542754
V+=2;
27552755
if(!strcmp(name, "filterEvents")) {
2756-
long fevent;
2756+
unsigned long fevent;
27572757
ret = my->XGetICValues(ic, name, &fevent, NULL);
2758-
if(!ret)
2759-
*(long_t*)val = to_long(fevent);
2760-
} else
2761-
{
2758+
// I got a value of 0xFFFF00000003, but this seems to be a valid
2759+
// value of KeyPressMask | KeyReleaseMask, so just silently truncate
2760+
if(!ret) *(ulong_t*)val = to_ulong_silent(fevent);
2761+
} else {
27622762
printf_log_prefix(2, LOG_INFO, "Warning, unknown XGetICValues of %s\n", name);
27632763
ret = my->XGetICValues(ic, name, val, NULL);
27642764
}

src/wrapped32/wrappedlibx11_private.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ GO(XGetGeometry, iFXLbL_pppppp)
384384
GO(_XGetHostname, iFpi)
385385
GO(XGetIconName, iFXLbp_)
386386
GO(XGetIconSizes, iFXLbp_p)
387-
GOM(XGetICValues, pFELV) // use varargs...
387+
GOM(XGetICValues, pFEpV) // use varargs...
388388
GOM(XGetImage, pFEXLiiuuLi) // return an XImage with callbacks that needs wrapping
389389
GOM(XGetIMValues, pFEpV)
390390
GO(XGetInputFocus, iFXBL_p)

0 commit comments

Comments
 (0)