Commit d96e1f13 authored by Patrik Stridvall's avatar Patrik Stridvall Committed by Alexandre Julliard

Moved code to the X11 driver.

parent a49bb266
...@@ -4978,66 +4978,6 @@ HRESULT WINAPI DirectDrawCreate( LPGUID lpGUID, LPDIRECTDRAW *lplpDD, LPUNKNOWN ...@@ -4978,66 +4978,6 @@ HRESULT WINAPI DirectDrawCreate( LPGUID lpGUID, LPDIRECTDRAW *lplpDD, LPUNKNOWN
return DDERR_INVALIDDIRECTDRAWGUID; return DDERR_INVALIDDIRECTDRAWGUID;
} }
#else /* !defined(X_DISPLAY_MISSING) */
#include "windef.h"
#define DD_OK 0
typedef void *LPGUID;
typedef void *LPUNKNOWN;
typedef void *LPDIRECTDRAW;
typedef void *LPDIRECTDRAWCLIPPER;
typedef void *LPDDENUMCALLBACKA;
typedef void *LPDDENUMCALLBACKEXA;
typedef void *LPDDENUMCALLBACKEXW;
typedef void *LPDDENUMCALLBACKW;
HRESULT WINAPI DSoundHelp(DWORD x, DWORD y, DWORD z)
{
return DD_OK;
}
HRESULT WINAPI DirectDrawCreate(
LPGUID lpGUID, LPDIRECTDRAW *lplpDD, LPUNKNOWN pUnkOuter)
{
return DD_OK;
}
HRESULT WINAPI DirectDrawCreateClipper(
DWORD dwFlags, LPDIRECTDRAWCLIPPER *lplpDDClipper, LPUNKNOWN pUnkOuter)
{
return DD_OK;
}
HRESULT WINAPI DirectDrawEnumerateA(
LPDDENUMCALLBACKA lpCallback, LPVOID lpContext)
{
return DD_OK;
}
HRESULT WINAPI DirectDrawEnumerateExA(
LPDDENUMCALLBACKEXA lpCallback, LPVOID lpContext, DWORD dwFlags)
{
return DD_OK;
}
HRESULT WINAPI DirectDrawEnumerateExW(
LPDDENUMCALLBACKEXW lpCallback, LPVOID lpContext, DWORD dwFlags)
{
return DD_OK;
}
HRESULT WINAPI DirectDrawEnumerateW(
LPDDENUMCALLBACKW lpCallback, LPVOID lpContext)
{
return DD_OK;
}
#endif /* !defined(X_DISPLAY_MISSING) */
/******************************************************************************* /*******************************************************************************
* DirectDraw ClassFactory * DirectDraw ClassFactory
* *
...@@ -5163,3 +5103,76 @@ DWORD WINAPI DDRAW_DllCanUnloadNow(void) ...@@ -5163,3 +5103,76 @@ DWORD WINAPI DDRAW_DllCanUnloadNow(void)
FIXME("(void): stub\n"); FIXME("(void): stub\n");
return S_FALSE; return S_FALSE;
} }
#else /* !defined(X_DISPLAY_MISSING) */
#include "windef.h"
#include "winerror.h"
#include "wtypes.h"
#define DD_OK 0
typedef void *LPUNKNOWN;
typedef void *LPDIRECTDRAW;
typedef void *LPDIRECTDRAWCLIPPER;
typedef void *LPDDENUMCALLBACKA;
typedef void *LPDDENUMCALLBACKEXA;
typedef void *LPDDENUMCALLBACKEXW;
typedef void *LPDDENUMCALLBACKW;
HRESULT WINAPI DSoundHelp(DWORD x, DWORD y, DWORD z)
{
return DD_OK;
}
HRESULT WINAPI DirectDrawCreate(
LPGUID lpGUID, LPDIRECTDRAW *lplpDD, LPUNKNOWN pUnkOuter)
{
return DD_OK;
}
HRESULT WINAPI DirectDrawCreateClipper(
DWORD dwFlags, LPDIRECTDRAWCLIPPER *lplpDDClipper, LPUNKNOWN pUnkOuter)
{
return DD_OK;
}
HRESULT WINAPI DirectDrawEnumerateA(
LPDDENUMCALLBACKA lpCallback, LPVOID lpContext)
{
return DD_OK;
}
HRESULT WINAPI DirectDrawEnumerateExA(
LPDDENUMCALLBACKEXA lpCallback, LPVOID lpContext, DWORD dwFlags)
{
return DD_OK;
}
HRESULT WINAPI DirectDrawEnumerateExW(
LPDDENUMCALLBACKEXW lpCallback, LPVOID lpContext, DWORD dwFlags)
{
return DD_OK;
}
HRESULT WINAPI DirectDrawEnumerateW(
LPDDENUMCALLBACKW lpCallback, LPVOID lpContext)
{
return DD_OK;
}
DWORD WINAPI DDRAW_DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
{
return E_NOINTERFACE;
}
DWORD WINAPI DDRAW_DllCanUnloadNow(void)
{
return DD_OK;
}
#endif /* !defined(X_DISPLAY_MISSING) */
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#ifndef __WINE_KEYBOARD_H #ifndef __WINE_KEYBOARD_H
#define __WINE_KEYBOARD_H #define __WINE_KEYBOARD_H
#include "dinput.h"
#include "windef.h" #include "windef.h"
#include "pshpack1.h" #include "pshpack1.h"
...@@ -36,8 +37,10 @@ typedef struct tagKEYBOARD_DRIVER { ...@@ -36,8 +37,10 @@ typedef struct tagKEYBOARD_DRIVER {
INT16 (*pGetKeyNameText)(LONG, LPSTR, INT16); INT16 (*pGetKeyNameText)(LONG, LPSTR, INT16);
INT16 (*pToAscii)(UINT16, UINT16, LPBYTE, LPVOID, UINT16); INT16 (*pToAscii)(UINT16, UINT16, LPBYTE, LPVOID, UINT16);
BOOL (*pGetBeepActive)(void); BOOL (*pGetBeepActive)(void);
void (*pSetBeepActive)(BOOL bActivate); void (*pSetBeepActive)(BOOL);
void (*pBeep)(void); void (*pBeep)(void);
BOOL (*pGetDIState)(DWORD, LPVOID);
BOOL (*pGetDIData)(BYTE *, DWORD, LPDIDEVICEOBJECTDATA, LPDWORD, DWORD);
} KEYBOARD_DRIVER; } KEYBOARD_DRIVER;
extern KEYBOARD_DRIVER *KEYBOARD_Driver; extern KEYBOARD_DRIVER *KEYBOARD_Driver;
......
...@@ -7,6 +7,8 @@ ...@@ -7,6 +7,8 @@
#include "windef.h" #include "windef.h"
#include "wingdi.h" #include "wingdi.h"
#include "dinput.h"
#include "wine/winuser16.h"
#include "wine/wingdi16.h" #include "wine/wingdi16.h"
struct tagBITMAPOBJ; struct tagBITMAPOBJ;
...@@ -108,6 +110,8 @@ extern INT16 TTYDRV_KEYBOARD_ToAscii(UINT16 virtKey, UINT16 scanCode, LPBYTE lpK ...@@ -108,6 +110,8 @@ extern INT16 TTYDRV_KEYBOARD_ToAscii(UINT16 virtKey, UINT16 scanCode, LPBYTE lpK
extern BOOL TTYDRV_KEYBOARD_GetBeepActive(void); extern BOOL TTYDRV_KEYBOARD_GetBeepActive(void);
extern void TTYDRV_KEYBOARD_SetBeepActive(BOOL bActivate); extern void TTYDRV_KEYBOARD_SetBeepActive(BOOL bActivate);
extern void TTYDRV_KEYBOARD_Beep(void); 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);
/* TTY monitor driver */ /* TTY monitor driver */
......
...@@ -14,8 +14,9 @@ ...@@ -14,8 +14,9 @@
#include <X11/Xatom.h> #include <X11/Xatom.h>
#endif /* !defined(X_DISPLAY_MISSING) */ #endif /* !defined(X_DISPLAY_MISSING) */
#include "winbase.h" #include "dinput.h"
#include "gdi.h" #include "gdi.h"
#include "winbase.h"
#include "windef.h" #include "windef.h"
struct tagBITMAPOBJ; struct tagBITMAPOBJ;
...@@ -359,6 +360,8 @@ extern INT16 X11DRV_KEYBOARD_ToAscii(UINT16 virtKey, UINT16 scanCode, LPBYTE lpK ...@@ -359,6 +360,8 @@ extern INT16 X11DRV_KEYBOARD_ToAscii(UINT16 virtKey, UINT16 scanCode, LPBYTE lpK
extern BOOL X11DRV_KEYBOARD_GetBeepActive(void); extern BOOL X11DRV_KEYBOARD_GetBeepActive(void);
extern void X11DRV_KEYBOARD_SetBeepActive(BOOL bActivate); extern void X11DRV_KEYBOARD_SetBeepActive(BOOL bActivate);
extern void X11DRV_KEYBOARD_Beep(void); 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_HandleEvent(struct tagWND *pWnd, XKeyEvent *event); extern void X11DRV_KEYBOARD_HandleEvent(struct tagWND *pWnd, XKeyEvent *event);
......
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
* *
*/ */
#include "config.h"
#ifndef X_DISPLAY_MISSING #ifndef X_DISPLAY_MISSING
#include "ts_xlib.h" #include "ts_xlib.h"
#include "x11drv.h" #include "x11drv.h"
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
* Copyright 1993 Alexandre Julliard * Copyright 1993 Alexandre Julliard
*/ */
#include "config.h"
#ifndef X_DISPLAY_MISSING #ifndef X_DISPLAY_MISSING
#include "x11drv.h" #include "x11drv.h"
#else /* !defined(X_DISPLAY_MISSING) */ #else /* !defined(X_DISPLAY_MISSING) */
......
...@@ -24,14 +24,16 @@ ...@@ -24,14 +24,16 @@
#include <assert.h> #include <assert.h>
#include <sys/signal.h> #include <sys/signal.h>
#include "winuser.h"
#include "winerror.h"
#include "wine/obj_base.h" #include "wine/obj_base.h"
#include "dinput.h"
#include "debug.h" #include "debug.h"
#include "message.h" #include "dinput.h"
#include "display.h" #include "display.h"
#include "keyboard.h"
#include "message.h"
#include "mouse.h" #include "mouse.h"
#include "sysmetrics.h"
#include "winerror.h"
#include "winuser.h"
DEFAULT_DEBUG_CHANNEL(dinput) DEFAULT_DEBUG_CHANNEL(dinput)
...@@ -399,24 +401,7 @@ static HRESULT WINAPI SysKeyboardAImpl_GetDeviceState( ...@@ -399,24 +401,7 @@ static HRESULT WINAPI SysKeyboardAImpl_GetDeviceState(
LPDIRECTINPUTDEVICE2A iface,DWORD len,LPVOID ptr LPDIRECTINPUTDEVICE2A iface,DWORD len,LPVOID ptr
) )
{ {
if (len==256) { return KEYBOARD_Driver->pGetDIState(len, ptr)?DI_OK:E_FAIL;
int keyc,vkey;
memset(ptr,0,256);
for (keyc=min_keycode;keyc<max_keycode;keyc++)
{
/* X keycode to virtual key */
vkey = keyc2vkey[keyc] & 0xFF;
/* The windows scancode is keyc-min_keycode */
if (InputKeyStateTable[vkey]&0x80) {
((LPBYTE)ptr)[keyc-min_keycode]=0x80;
((LPBYTE)ptr)[(keyc-min_keycode)|0x80]=0x80;
}
}
return 0;
}
WARN(dinput,"whoops, SysKeyboardAImpl_GetDeviceState got len %ld?\n",len);
return 0;
} }
static HRESULT WINAPI SysKeyboardAImpl_GetDeviceData( static HRESULT WINAPI SysKeyboardAImpl_GetDeviceData(
...@@ -425,44 +410,12 @@ static HRESULT WINAPI SysKeyboardAImpl_GetDeviceData( ...@@ -425,44 +410,12 @@ static HRESULT WINAPI SysKeyboardAImpl_GetDeviceData(
) )
{ {
ICOM_THIS(SysKeyboardAImpl,iface); ICOM_THIS(SysKeyboardAImpl,iface);
int keyc,n,vkey,xentries;
TRACE(dinput,"(this=%p,%ld,%p,%p(%ld)),0x%08lx)\n",
This,dodsize,dod,entries,entries?*entries:0,flags);
/* FIXME !!! */ TRACE(dinput, "(this=%p,%ld,%p,%p(%ld)),0x%08lx)\n",
This,dodsize,dod,entries,entries?*entries:0,flags);
EVENT_Synchronize( FALSE ); return KEYBOARD_Driver->pGetDIData(
This->keystate, dodsize, dod, entries, flags)?DI_OK:E_FAIL;
if (entries)
xentries = *entries;
else
xentries = 1;
n = 0;
for (keyc=min_keycode;(keyc<max_keycode) && (n<*entries);keyc++)
{
/* X keycode to virtual key */
vkey = keyc2vkey[keyc] & 0xFF;
if (This->keystate[vkey] == (InputKeyStateTable[vkey]&0x80))
continue;
if (dod) {
/* add an entry */
dod[n].dwOfs = keyc-min_keycode; /* scancode */
dod[n].dwData = InputKeyStateTable[vkey]&0x80;
dod[n].dwTimeStamp = 0; /* umm */
dod[n].dwSequence = 0; /* umm */
n++;
}
if (!(flags & DIGDD_PEEK))
This->keystate[vkey] = InputKeyStateTable[vkey]&0x80;
}
if (n) fprintf(stderr,"%d entries\n",n);
*entries = n;
return 0;
} }
static HRESULT WINAPI SysKeyboardAImpl_Acquire(LPDIRECTINPUTDEVICE2A iface) static HRESULT WINAPI SysKeyboardAImpl_Acquire(LPDIRECTINPUTDEVICE2A iface)
......
...@@ -54,7 +54,9 @@ KEYBOARD_DRIVER TTYDRV_KEYBOARD_Driver = ...@@ -54,7 +54,9 @@ KEYBOARD_DRIVER TTYDRV_KEYBOARD_Driver =
TTYDRV_KEYBOARD_ToAscii, TTYDRV_KEYBOARD_ToAscii,
TTYDRV_KEYBOARD_GetBeepActive, TTYDRV_KEYBOARD_GetBeepActive,
TTYDRV_KEYBOARD_SetBeepActive, TTYDRV_KEYBOARD_SetBeepActive,
TTYDRV_KEYBOARD_Beep TTYDRV_KEYBOARD_Beep,
TTYDRV_KEYBOARD_GetDIState,
TTYDRV_KEYBOARD_GetDIData
}; };
MONITOR_DRIVER TTYDRV_MONITOR_Driver = MONITOR_DRIVER TTYDRV_MONITOR_Driver =
......
...@@ -75,7 +75,21 @@ void TTYDRV_KEYBOARD_Beep() ...@@ -75,7 +75,21 @@ void TTYDRV_KEYBOARD_Beep()
{ {
} }
/***********************************************************************
* X11DRV_KEYBOARD_GetDIState
*/
BOOL TTYDRV_KEYBOARD_GetDIState(DWORD len, LPVOID ptr)
{
return TRUE;
}
/***********************************************************************
* TTYDRV_KEYBOARD_GetDIData
*/
BOOL TTYDRV_KEYBOARD_GetDIData(
BYTE *keystate,
DWORD dodsize, LPDIDEVICEOBJECTDATA dod,
LPDWORD entries, DWORD flags)
{
return TRUE;
}
...@@ -58,7 +58,9 @@ KEYBOARD_DRIVER X11DRV_KEYBOARD_Driver = ...@@ -58,7 +58,9 @@ KEYBOARD_DRIVER X11DRV_KEYBOARD_Driver =
X11DRV_KEYBOARD_ToAscii, X11DRV_KEYBOARD_ToAscii,
X11DRV_KEYBOARD_GetBeepActive, X11DRV_KEYBOARD_GetBeepActive,
X11DRV_KEYBOARD_SetBeepActive, X11DRV_KEYBOARD_SetBeepActive,
X11DRV_KEYBOARD_Beep X11DRV_KEYBOARD_Beep,
X11DRV_KEYBOARD_GetDIState,
X11DRV_KEYBOARD_GetDIData
}; };
MONITOR_DRIVER X11DRV_MONITOR_Driver = MONITOR_DRIVER X11DRV_MONITOR_Driver =
......
...@@ -9,11 +9,11 @@ ...@@ -9,11 +9,11 @@
* Copyright 1999 Ove Kven * Copyright 1999 Ove Kven
*/ */
#include <ctype.h>
#include "config.h" #include "config.h"
#ifndef X_DISPLAY_MISSING #ifndef X_DISPLAY_MISSING
#include <ctype.h>
#include <X11/Xatom.h> #include <X11/Xatom.h>
#include <X11/keysym.h> #include <X11/keysym.h>
#include "ts_xlib.h" #include "ts_xlib.h"
...@@ -21,15 +21,19 @@ ...@@ -21,15 +21,19 @@
#include "ts_xutil.h" #include "ts_xutil.h"
#include "wine/winuser16.h" #include "wine/winuser16.h"
#include "dinput.h"
#include "debugtools.h" #include "debugtools.h"
#include "keyboard.h" #include "keyboard.h"
#include "message.h" #include "message.h"
#include "windef.h" #include "windef.h"
#include "x11drv.h"
#include "winnls.h" #include "winnls.h"
#include "x11drv.h"
DECLARE_DEBUG_CHANNEL(key) DECLARE_DEBUG_CHANNEL(key)
DECLARE_DEBUG_CHANNEL(keyboard) DECLARE_DEBUG_CHANNEL(keyboard)
DECLARE_DEBUG_CHANNEL(x11drv)
extern BYTE InputKeyStateTable[256];
extern LPBYTE pKeyStateTable; extern LPBYTE pKeyStateTable;
...@@ -1333,5 +1337,76 @@ void X11DRV_KEYBOARD_Beep() ...@@ -1333,5 +1337,76 @@ void X11DRV_KEYBOARD_Beep()
TSXBell(display, 0); TSXBell(display, 0);
} }
/***********************************************************************
* X11DRV_KEYBOARD_GetDIState
*/
BOOL X11DRV_KEYBOARD_GetDIState(DWORD len, LPVOID ptr)
{
if (len==256) {
int keyc,vkey;
memset(ptr,0,256);
for (keyc=min_keycode;keyc<max_keycode;keyc++)
{
/* X keycode to virtual key */
vkey = keyc2vkey[keyc] & 0xFF;
/* The windows scancode is keyc-min_keycode */
if (InputKeyStateTable[vkey]&0x80) {
((LPBYTE)ptr)[keyc-min_keycode]=0x80;
((LPBYTE)ptr)[(keyc-min_keycode)|0x80]=0x80;
}
}
return TRUE;
}
WARN_(x11drv)("whoops, X11DRV_KEYBOARD_GetState got len %ld?\n", len);
return TRUE;
}
/***********************************************************************
* X11DRV_KEYBOARD_GetDIData
*/
BOOL X11DRV_KEYBOARD_GetDIData(
BYTE *keystate,
DWORD dodsize, LPDIDEVICEOBJECTDATA dod,
LPDWORD entries, DWORD flags)
{
int keyc,n,vkey,xentries;
/* FIXME !!! */
EVENT_Synchronize( FALSE );
if (entries)
xentries = *entries;
else
xentries = 1;
n = 0;
for (keyc=min_keycode;(keyc<max_keycode) && (n<*entries);keyc++)
{
/* X keycode to virtual key */
vkey = keyc2vkey[keyc] & 0xFF;
if (keystate[vkey] == (InputKeyStateTable[vkey]&0x80))
continue;
if (dod) {
/* add an entry */
dod[n].dwOfs = keyc-min_keycode; /* scancode */
dod[n].dwData = InputKeyStateTable[vkey]&0x80;
dod[n].dwTimeStamp = 0; /* umm */
dod[n].dwSequence = 0; /* umm */
n++;
}
if (!(flags & DIGDD_PEEK))
keystate[vkey] = InputKeyStateTable[vkey]&0x80;
}
if (n) fprintf(stderr,"%d entries\n",n);
*entries = n;
return TRUE;
}
#endif /* !defined(X_DISPLAY_MISSING) */ #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