Commit c9713e58 authored by Lionel Ulmer's avatar Lionel Ulmer Committed by Alexandre Julliard

- removed keyboard auto-repeat when DInput acquires it

- removed some (now) obsolete fixme's
parent 8b7c1906
......@@ -30,6 +30,11 @@ VOID WINAPI KEYBOARD_Disable(VOID);
/* Wine internals */
#define WINE_KEYBOARD_CONFIG_AUTO_REPEAT 0x00000001
typedef struct tagKEYBOARD_CONFIG {
BOOL auto_repeat;
} KEYBOARD_CONFIG;
typedef struct tagKEYBOARD_DRIVER {
void (*pInit)(void);
WORD (*pVkKeyScan)(CHAR);
......@@ -41,6 +46,8 @@ typedef struct tagKEYBOARD_DRIVER {
void (*pBeep)(void);
BOOL (*pGetDIState)(DWORD, LPVOID);
BOOL (*pGetDIData)(BYTE *, DWORD, LPDIDEVICEOBJECTDATA, LPDWORD, DWORD);
void (*pGetKeyboardConfig)(KEYBOARD_CONFIG *);
void (*pSetKeyboardConfig)(KEYBOARD_CONFIG *, DWORD);
} KEYBOARD_DRIVER;
extern KEYBOARD_DRIVER *KEYBOARD_Driver;
......
......@@ -20,6 +20,8 @@
#include "wine/winuser16.h"
#include "wine/wingdi16.h"
#include "keyboard.h"
struct tagBITMAPOBJ;
struct tagCLASS;
struct tagDC;
......@@ -164,6 +166,8 @@ extern void TTYDRV_KEYBOARD_SetBeepActive(BOOL bActivate);
extern void TTYDRV_KEYBOARD_Beep(void);
extern BOOL TTYDRV_KEYBOARD_GetDIState(DWORD len, LPVOID ptr);
extern BOOL TTYDRV_KEYBOARD_GetDIData(BYTE *keystate, DWORD dodsize, LPDIDEVICEOBJECTDATA dod, LPDWORD entries, DWORD flags);
extern void TTYDRV_KEYBOARD_GetKeyboardConfig(KEYBOARD_CONFIG *cfg);
extern void TTYDRV_KEYBOARD_SetKeyboardConfig(KEYBOARD_CONFIG *cfg, DWORD mask);
/* TTY monitor driver */
......
......@@ -19,6 +19,8 @@
#include "winbase.h"
#include "windef.h"
#include "keyboard.h"
#include <X11/extensions/XShm.h>
struct tagBITMAPOBJ;
......@@ -396,6 +398,8 @@ extern void X11DRV_KEYBOARD_SetBeepActive(BOOL bActivate);
extern void X11DRV_KEYBOARD_Beep(void);
extern BOOL X11DRV_KEYBOARD_GetDIState(DWORD len, LPVOID ptr);
extern BOOL X11DRV_KEYBOARD_GetDIData(BYTE *keystate, DWORD dodsize, LPDIDEVICEOBJECTDATA dod, LPDWORD entries, DWORD flags);
extern void X11DRV_KEYBOARD_GetKeyboardConfig(KEYBOARD_CONFIG *cfg);
extern void X11DRV_KEYBOARD_SetKeyboardConfig(KEYBOARD_CONFIG *cfg, DWORD mask);
extern void X11DRV_KEYBOARD_HandleEvent(struct tagWND *pWnd, XKeyEvent *event);
......
......@@ -81,6 +81,7 @@ struct SysKeyboardAImpl
GUID guid;
/* SysKeyboardAImpl */
BYTE keystate[256];
KEYBOARD_CONFIG initial_config;
};
#ifdef HAVE_LINUX_22_JOYSTICK_API
......@@ -294,7 +295,7 @@ static HRESULT WINAPI IDirectInputAImpl_CreateDevice(
char xbuf[50];
WINE_StringFromCLSID(rguid,xbuf);
FIXME("(this=%p,%s,%p,%p): stub\n",This,xbuf,pdev,punk);
TRACE("(this=%p,%s,%p,%p)\n",This,xbuf,pdev,punk);
if ((!memcmp(&GUID_SysKeyboard,rguid,sizeof(GUID_SysKeyboard))) || /* Generic Keyboard */
(!memcmp(&DInput_Wine_Keyboard_GUID,rguid,sizeof(GUID_SysKeyboard)))) { /* Wine Keyboard */
SysKeyboardAImpl* newDevice;
......@@ -431,7 +432,7 @@ static HRESULT WINAPI IDirectInputDevice2AImpl_SetCooperativeLevel(
LPDIRECTINPUTDEVICE2A iface,HWND hwnd,DWORD dwflags
) {
ICOM_THIS(IDirectInputDevice2AImpl,iface);
FIXME("(this=%p,0x%08lx,0x%08lx): stub\n",This,(DWORD)hwnd,dwflags);
TRACE("(this=%p,0x%08lx,0x%08lx)\n",This,(DWORD)hwnd,dwflags);
if (TRACE_ON(dinput))
_dump_cooperativelevel(dwflags);
return 0;
......@@ -507,7 +508,7 @@ static HRESULT WINAPI SysKeyboardAImpl_GetDeviceData(
ret=KEYBOARD_Driver->pGetDIData(
This->keystate, dodsize, dod, entries, flags)?DI_OK:E_FAIL;
for (i=0;i<*entries;i++) {
dod[i].dwTimeStamp = time(NULL);
dod[i].dwTimeStamp = GetTickCount();
dod[i].dwSequence = evsequence++;
}
return ret;
......@@ -516,15 +517,28 @@ static HRESULT WINAPI SysKeyboardAImpl_GetDeviceData(
static HRESULT WINAPI SysKeyboardAImpl_Acquire(LPDIRECTINPUTDEVICE2A iface)
{
ICOM_THIS(SysKeyboardAImpl,iface);
TRACE("(this=%p): stub\n",This);
return 0;
KEYBOARD_CONFIG no_auto;
TRACE("(this=%p)\n",This);
/* Save the original config */
KEYBOARD_Driver->pGetKeyboardConfig(&(This->initial_config));
/* Now, remove auto-repeat */
no_auto.auto_repeat = FALSE;
KEYBOARD_Driver->pSetKeyboardConfig(&no_auto, WINE_KEYBOARD_CONFIG_AUTO_REPEAT);
return DI_OK;
}
static HRESULT WINAPI SysKeyboardAImpl_Unacquire(LPDIRECTINPUTDEVICE2A iface)
{
ICOM_THIS(SysKeyboardAImpl,iface);
TRACE("(this=%p): stub\n",This);
return 0;
TRACE("(this=%p)\n",This);
/* Restore the original configuration */
KEYBOARD_Driver->pSetKeyboardConfig(&(This->initial_config), 0xFFFFFFFF);
return DI_OK;
}
static HRESULT WINAPI IDirectInputDevice2AImpl_QueryInterface(
......@@ -760,7 +774,7 @@ static HRESULT WINAPI SysMouseAImpl_SetCooperativeLevel(
{
ICOM_THIS(SysMouseAImpl,iface);
TRACE("(this=%p,0x%08lx,0x%08lx): stub\n",This,(DWORD)hwnd,dwflags);
TRACE("(this=%p,0x%08lx,0x%08lx)\n",This,(DWORD)hwnd,dwflags);
if (TRACE_ON(dinput))
_dump_cooperativelevel(dwflags);
......
......@@ -59,7 +59,9 @@ KEYBOARD_DRIVER TTYDRV_KEYBOARD_Driver =
TTYDRV_KEYBOARD_SetBeepActive,
TTYDRV_KEYBOARD_Beep,
TTYDRV_KEYBOARD_GetDIState,
TTYDRV_KEYBOARD_GetDIData
TTYDRV_KEYBOARD_GetDIData,
TTYDRV_KEYBOARD_GetKeyboardConfig,
TTYDRV_KEYBOARD_SetKeyboardConfig
};
MONITOR_DRIVER TTYDRV_MONITOR_Driver =
......
......@@ -93,3 +93,18 @@ BOOL TTYDRV_KEYBOARD_GetDIData(
{
return TRUE;
}
/***********************************************************************
* TTYDRV_KEYBOARD_GetKeyboardConfig
*/
void TTYDRV_KEYBOARD_GetKeyboardConfig(KEYBOARD_CONFIG *cfg) {
}
/***********************************************************************
* TTYDRV_KEYBOARD_SetKeyboardConfig
*/
extern void TTYDRV_KEYBOARD_SetKeyboardConfig(KEYBOARD_CONFIG *cfg, DWORD mask) {
}
......@@ -63,7 +63,9 @@ KEYBOARD_DRIVER X11DRV_KEYBOARD_Driver =
X11DRV_KEYBOARD_SetBeepActive,
X11DRV_KEYBOARD_Beep,
X11DRV_KEYBOARD_GetDIState,
X11DRV_KEYBOARD_GetDIData
X11DRV_KEYBOARD_GetDIData,
X11DRV_KEYBOARD_GetKeyboardConfig,
X11DRV_KEYBOARD_SetKeyboardConfig
};
MONITOR_DRIVER X11DRV_MONITOR_Driver =
......
......@@ -33,6 +33,7 @@
DECLARE_DEBUG_CHANNEL(key)
DECLARE_DEBUG_CHANNEL(keyboard)
DECLARE_DEBUG_CHANNEL(x11drv)
DECLARE_DEBUG_CHANNEL(dinput)
extern BYTE InputKeyStateTable[256];
......@@ -1480,11 +1481,38 @@ BOOL X11DRV_KEYBOARD_GetDIData(
}
if (n) fprintf(stderr,"%d entries\n",n);
if (n) TRACE_(dinput)("%d entries\n",n);
*entries = n;
return TRUE;
}
/***********************************************************************
* X11DRV_KEYBOARD_GetKeyboardConfig
*/
void X11DRV_KEYBOARD_GetKeyboardConfig(KEYBOARD_CONFIG *cfg) {
XKeyboardState xks;
/* For the moment, only get the auto-repeat mode */
TSXGetKeyboardControl(display, &xks);
cfg->auto_repeat = xks.global_auto_repeat;
}
/***********************************************************************
* X11DRV_KEYBOARD_SetKeyboardConfig
*/
extern void X11DRV_KEYBOARD_SetKeyboardConfig(KEYBOARD_CONFIG *cfg, DWORD mask) {
XKeyboardControl xkc;
unsigned long X_mask = 0;
if (mask & WINE_KEYBOARD_CONFIG_AUTO_REPEAT) {
X_mask |= KBAutoRepeatMode;
xkc.auto_repeat_mode = cfg->auto_repeat;
}
if (X_mask)
TSXChangeKeyboardControl(display, X_mask, &xkc);
}
#endif /* !defined(X_DISPLAY_MISSING) */
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