ReactOS  0.4.15-dev-1070-ge1a01de
mouse.c File Reference
#include "config.h"
#include "wine/port.h"
#include <stdarg.h>
#include <string.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "wine/winternl.h"
#include "winuser.h"
#include "winerror.h"
#include "winreg.h"
#include "dinput.h"
#include "dinput_private.h"
#include "device_private.h"
#include "wine/debug.h"
#include "wine/unicode.h"
Include dependency graph for mouse.c:

Go to the source code of this file.

Classes

struct  SysMouseImpl
 

Macros

#define WINE_MOUSE_X_AXIS_INSTANCE   0
 
#define WINE_MOUSE_Y_AXIS_INSTANCE   1
 
#define WINE_MOUSE_Z_AXIS_INSTANCE   2
 
#define WINE_MOUSE_BUTTONS_INSTANCE   3
 

Typedefs

typedef struct SysMouseImpl SysMouseImpl
 

Enumerations

enum  WARP_MOUSE { WARP_DEFAULT, WARP_DISABLE, WARP_FORCE_ON }
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (dinput)
 
static SysMouseImplimpl_from_IDirectInputDevice8A (IDirectInputDevice8A *iface)
 
static SysMouseImplimpl_from_IDirectInputDevice8W (IDirectInputDevice8W *iface)
 
static IDirectInputDevice8W * IDirectInputDevice8W_from_impl (SysMouseImpl *This)
 
static int dinput_mouse_hook (LPDIRECTINPUTDEVICE8A iface, WPARAM wparam, LPARAM lparam)
 
static void _dump_mouse_state (const DIMOUSESTATE2 *m_state)
 
static void fill_mouse_dideviceinstanceA (LPDIDEVICEINSTANCEA lpddi, DWORD version)
 
static void fill_mouse_dideviceinstanceW (LPDIDEVICEINSTANCEW lpddi, DWORD version)
 
static HRESULT mousedev_enum_deviceA (DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEA lpddi, DWORD version, int id)
 
static HRESULT mousedev_enum_deviceW (DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEW lpddi, DWORD version, int id)
 
static SysMouseImplalloc_device (REFGUID rguid, IDirectInputImpl *dinput)
 
static HRESULT mousedev_create_device (IDirectInputImpl *dinput, REFGUID rguid, REFIID riid, LPVOID *pdev, int unicode)
 
static void warp_check (SysMouseImpl *This, BOOL force)
 
static HRESULT WINAPI SysMouseWImpl_Acquire (LPDIRECTINPUTDEVICE8W iface)
 
static HRESULT WINAPI SysMouseAImpl_Acquire (LPDIRECTINPUTDEVICE8A iface)
 
static HRESULT WINAPI SysMouseWImpl_Unacquire (LPDIRECTINPUTDEVICE8W iface)
 
static HRESULT WINAPI SysMouseAImpl_Unacquire (LPDIRECTINPUTDEVICE8A iface)
 
static HRESULT WINAPI SysMouseWImpl_GetDeviceState (LPDIRECTINPUTDEVICE8W iface, DWORD len, LPVOID ptr)
 
static HRESULT WINAPI SysMouseAImpl_GetDeviceState (LPDIRECTINPUTDEVICE8A iface, DWORD len, LPVOID ptr)
 
static HRESULT WINAPI SysMouseWImpl_GetDeviceData (LPDIRECTINPUTDEVICE8W iface, DWORD dodsize, LPDIDEVICEOBJECTDATA dod, LPDWORD entries, DWORD flags)
 
static HRESULT WINAPI SysMouseAImpl_GetDeviceData (LPDIRECTINPUTDEVICE8A iface, DWORD dodsize, LPDIDEVICEOBJECTDATA dod, LPDWORD entries, DWORD flags)
 
static HRESULT WINAPI SysMouseWImpl_GetProperty (LPDIRECTINPUTDEVICE8W iface, REFGUID rguid, LPDIPROPHEADER pdiph)
 
static HRESULT WINAPI SysMouseAImpl_GetProperty (LPDIRECTINPUTDEVICE8A iface, REFGUID rguid, LPDIPROPHEADER pdiph)
 
static HRESULT WINAPI SysMouseWImpl_GetCapabilities (LPDIRECTINPUTDEVICE8W iface, LPDIDEVCAPS lpDIDevCaps)
 
static HRESULT WINAPI SysMouseAImpl_GetCapabilities (LPDIRECTINPUTDEVICE8A iface, LPDIDEVCAPS lpDIDevCaps)
 
static HRESULT WINAPI SysMouseWImpl_GetObjectInfo (LPDIRECTINPUTDEVICE8W iface, LPDIDEVICEOBJECTINSTANCEW pdidoi, DWORD dwObj, DWORD dwHow)
 
static HRESULT WINAPI SysMouseAImpl_GetObjectInfo (LPDIRECTINPUTDEVICE8A iface, LPDIDEVICEOBJECTINSTANCEA pdidoi, DWORD dwObj, DWORD dwHow)
 
static HRESULT WINAPI SysMouseAImpl_GetDeviceInfo (LPDIRECTINPUTDEVICE8A iface, LPDIDEVICEINSTANCEA pdidi)
 
static HRESULT WINAPI SysMouseWImpl_GetDeviceInfo (LPDIRECTINPUTDEVICE8W iface, LPDIDEVICEINSTANCEW pdidi)
 
static HRESULT WINAPI SysMouseWImpl_BuildActionMap (LPDIRECTINPUTDEVICE8W iface, LPDIACTIONFORMATW lpdiaf, LPCWSTR lpszUserName, DWORD dwFlags)
 
static HRESULT WINAPI SysMouseAImpl_BuildActionMap (LPDIRECTINPUTDEVICE8A iface, LPDIACTIONFORMATA lpdiaf, LPCSTR lpszUserName, DWORD dwFlags)
 
static HRESULT WINAPI SysMouseWImpl_SetActionMap (LPDIRECTINPUTDEVICE8W iface, LPDIACTIONFORMATW lpdiaf, LPCWSTR lpszUserName, DWORD dwFlags)
 
static HRESULT WINAPI SysMouseAImpl_SetActionMap (LPDIRECTINPUTDEVICE8A iface, LPDIACTIONFORMATA lpdiaf, LPCSTR lpszUserName, DWORD dwFlags)
 

Variables

static const IDirectInputDevice8AVtbl SysMouseAvt
 
static const IDirectInputDevice8WVtbl SysMouseWvt
 
const struct dinput_device mouse_device
 

Macro Definition Documentation

◆ WINE_MOUSE_BUTTONS_INSTANCE

#define WINE_MOUSE_BUTTONS_INSTANCE   3

Definition at line 48 of file mouse.c.

◆ WINE_MOUSE_X_AXIS_INSTANCE

#define WINE_MOUSE_X_AXIS_INSTANCE   0

Definition at line 45 of file mouse.c.

◆ WINE_MOUSE_Y_AXIS_INSTANCE

#define WINE_MOUSE_Y_AXIS_INSTANCE   1

Definition at line 46 of file mouse.c.

◆ WINE_MOUSE_Z_AXIS_INSTANCE

#define WINE_MOUSE_Z_AXIS_INSTANCE   2

Definition at line 47 of file mouse.c.

Typedef Documentation

◆ SysMouseImpl

Definition at line 53 of file mouse.c.

Enumeration Type Documentation

◆ WARP_MOUSE

Enumerator
WARP_DEFAULT 
WARP_DISABLE 
WARP_FORCE_ON 

Definition at line 55 of file mouse.c.

56 {
60 } WARP_MOUSE;
WARP_MOUSE
Definition: mouse.c:55

Function Documentation

◆ _dump_mouse_state()

static void _dump_mouse_state ( const DIMOUSESTATE2 m_state)
static

Definition at line 97 of file mouse.c.

98 {
99  int i;
100 
101  if (!TRACE_ON(dinput)) return;
102 
103  TRACE("(X: %d Y: %d Z: %d", m_state->lX, m_state->lY, m_state->lZ);
104  for (i = 0; i < 5; i++) TRACE(" B%d: %02x", i, m_state->rgbButtons[i]);
105  TRACE(")\n");
106 }
BYTE rgbButtons[8]
Definition: dinput.h:2123
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define TRACE(s)
Definition: solgame.cpp:4
#define TRACE_ON(x)
Definition: compat.h:75

Referenced by dinput_mouse_hook(), and SysMouseWImpl_GetDeviceState().

◆ alloc_device()

static SysMouseImpl* alloc_device ( REFGUID  rguid,
IDirectInputImpl dinput 
)
static

Definition at line 198 of file mouse.c.

199 {
200  SysMouseImpl* newDevice;
201  LPDIDATAFORMAT df = NULL;
202  unsigned i;
203  char buffer[20];
204  HKEY hkey, appkey;
205 
206  newDevice = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(SysMouseImpl));
207  if (!newDevice) return NULL;
208  newDevice->base.IDirectInputDevice8A_iface.lpVtbl = &SysMouseAvt;
209  newDevice->base.IDirectInputDevice8W_iface.lpVtbl = &SysMouseWvt;
210  newDevice->base.ref = 1;
211  newDevice->base.dwCoopLevel = DISCL_NONEXCLUSIVE | DISCL_BACKGROUND;
212  newDevice->base.guid = *rguid;
213  InitializeCriticalSection(&newDevice->base.crit);
214  newDevice->base.crit.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": SysMouseImpl*->base.crit");
215  newDevice->base.dinput = dinput;
216  newDevice->base.event_proc = dinput_mouse_hook;
217 
218  get_app_key(&hkey, &appkey);
219  if (!get_config_key(hkey, appkey, "MouseWarpOverride", buffer, sizeof(buffer)))
220  {
221  if (!_strnicmp(buffer, "disable", -1))
222  newDevice->warp_override = WARP_DISABLE;
223  else if (!_strnicmp(buffer, "force", -1))
224  newDevice->warp_override = WARP_FORCE_ON;
225  }
226  if (appkey) RegCloseKey(appkey);
227  if (hkey) RegCloseKey(hkey);
228 
229  /* Create copy of default data format */
230  if (!(df = HeapAlloc(GetProcessHeap(), 0, c_dfDIMouse2.dwSize))) goto failed;
232  if (!(df->rgodf = HeapAlloc(GetProcessHeap(), 0, df->dwNumObjs * df->dwObjSize))) goto failed;
234 
235  /* Because we don't do any detection yet just modify instance and type */
236  for (i = 0; i < df->dwNumObjs; i++)
237  if (DIDFT_GETTYPE(df->rgodf[i].dwType) & DIDFT_AXIS)
239  else
241 
242  newDevice->base.data_format.wine_df = df;
243  IDirectInput_AddRef(&newDevice->base.dinput->IDirectInput7A_iface);
244 
245  EnterCriticalSection(&dinput->crit);
246  list_add_tail(&dinput->devices_list, &newDevice->base.entry);
247  LeaveCriticalSection(&dinput->crit);
248 
249  return newDevice;
250 
251 failed:
252  if (df) HeapFree(GetProcessHeap(), 0, df->rgodf);
253  HeapFree(GetProcessHeap(), 0, df);
254  HeapFree(GetProcessHeap(), 0, newDevice);
255  return NULL;
256 }
#define IDirectInput_AddRef(p)
Definition: dinput.h:2293
DWORD dwSize
Definition: dinput.h:808
#define DWORD_PTR
Definition: treelist.c:76
#define DIDFT_PSHBUTTON
Definition: dinput.h:754
static const IDirectInputDevice8AVtbl SysMouseAvt
Definition: mouse.c:50
const DIDATAFORMAT c_dfDIMouse2
Definition: data_formats.c:293
DWORD dwNumObjs
Definition: dinput.h:812
struct IDirectInputDeviceImpl base
Definition: mouse.c:64
#define DIDFT_MAKEINSTANCE(n)
Definition: dinput.h:762
DWORD dwObjSize
Definition: dinput.h:809
GLuint buffer
Definition: glext.h:5915
struct list devices_list
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define DISCL_NONEXCLUSIVE
Definition: dinput.h:964
__WINE_SERVER_LIST_INLINE void list_add_tail(struct list *list, struct list *elem)
Definition: list.h:102
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
static int dinput_mouse_hook(LPDIRECTINPUTDEVICE8A iface, WPARAM wparam, LPARAM lparam)
Definition: mouse.c:317
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
Definition: synch.c:751
smooth NULL
Definition: ftsmooth.c:416
WARP_MOUSE warp_override
Definition: mouse.c:78
#define DISCL_BACKGROUND
Definition: dinput.h:966
#define GetProcessHeap()
Definition: compat.h:484
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define _strnicmp(_String1, _String2, _MaxCount)
Definition: compat.h:23
#define DIDFT_AXIS
Definition: dinput.h:753
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
LPDIOBJECTDATAFORMAT rgodf
Definition: dinput.h:813
DWORD get_config_key(HKEY defkey, HKEY appkey, const char *name, char *buffer, DWORD size)
Definition: device.c:313
CRITICAL_SECTION crit
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
BOOL get_app_key(HKEY *defkey, HKEY *appkey)
Definition: device.c:278
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
static const IDirectInputDevice8WVtbl SysMouseWvt
Definition: mouse.c:51
#define DIDFT_GETTYPE(n)
Definition: dinput.h:763
#define HeapFree(x, y, z)
Definition: compat.h:483
#define DIDFT_RELAXIS
Definition: dinput.h:751

Referenced by mousedev_create_device().

◆ dinput_mouse_hook()

static int dinput_mouse_hook ( LPDIRECTINPUTDEVICE8A  iface,
WPARAM  wparam,
LPARAM  lparam 
)
static

Definition at line 317 of file mouse.c.

318 {
321  int wdata = 0, inst_id = -1, ret = 0;
322 
323  TRACE("msg %lx @ (%d %d)\n", wparam, hook->pt.x, hook->pt.y);
324 
325  EnterCriticalSection(&This->base.crit);
326 
327  switch(wparam) {
328  case WM_MOUSEMOVE:
329  {
330  POINT pt, pt1;
331 
332  GetCursorPos(&pt);
333  This->m_state.lX += pt.x = hook->pt.x - pt.x;
334  This->m_state.lY += pt.y = hook->pt.y - pt.y;
335 
336  if (This->base.data_format.user_df->dwFlags & DIDF_ABSAXIS)
337  {
338  pt1.x = This->m_state.lX;
339  pt1.y = This->m_state.lY;
340  } else
341  pt1 = pt;
342 
343  if (pt.x)
344  {
346  wdata = pt1.x;
347  }
348  if (pt.y)
349  {
350  /* Already have X, need to queue it */
351  if (inst_id != -1)
352  queue_event(iface, inst_id,
353  wdata, GetCurrentTime(), This->base.dinput->evsequence);
355  wdata = pt1.y;
356  }
357 
358  if (pt.x || pt.y)
359  {
360  if ((This->warp_override == WARP_FORCE_ON) ||
361  (This->warp_override != WARP_DISABLE && (This->base.dwCoopLevel & DISCL_EXCLUSIVE)))
362  This->need_warp = TRUE;
363  }
364  break;
365  }
366  case WM_MOUSEWHEEL:
368  This->m_state.lZ += wdata = (short)HIWORD(hook->mouseData);
369  /* FarCry crashes if it gets a mouse wheel message */
370  /* FIXME: should probably filter out other messages too */
371  ret = This->clipped;
372  break;
373  case WM_LBUTTONDOWN:
375  This->m_state.rgbButtons[0] = wdata = 0x80;
376  break;
377  case WM_LBUTTONUP:
379  This->m_state.rgbButtons[0] = wdata = 0x00;
380  break;
381  case WM_RBUTTONDOWN:
383  This->m_state.rgbButtons[1] = wdata = 0x80;
384  break;
385  case WM_RBUTTONUP:
387  This->m_state.rgbButtons[1] = wdata = 0x00;
388  break;
389  case WM_MBUTTONDOWN:
391  This->m_state.rgbButtons[2] = wdata = 0x80;
392  break;
393  case WM_MBUTTONUP:
395  This->m_state.rgbButtons[2] = wdata = 0x00;
396  break;
397  case WM_XBUTTONDOWN:
399  This->m_state.rgbButtons[2 + HIWORD(hook->mouseData)] = wdata = 0x80;
400  break;
401  case WM_XBUTTONUP:
403  This->m_state.rgbButtons[2 + HIWORD(hook->mouseData)] = wdata = 0x00;
404  break;
405  }
406 
407 
408  if (inst_id != -1)
409  {
410  _dump_mouse_state(&This->m_state);
411  queue_event(iface, inst_id,
412  wdata, GetCurrentTime(), This->base.dinput->evsequence++);
413  }
414 
415  LeaveCriticalSection(&This->base.crit);
416  return ret;
417 }
#define WM_MBUTTONUP
Definition: winuser.h:1765
static void _dump_mouse_state(const DIMOUSESTATE2 *m_state)
Definition: mouse.c:97
#define DIDF_ABSAXIS
Definition: dinput.h:775
long y
Definition: polytest.cpp:48
#define WM_LBUTTONDOWN
Definition: winuser.h:1758
long x
Definition: polytest.cpp:48
#define DIDFT_PSHBUTTON
Definition: dinput.h:754
#define TRUE
Definition: types.h:120
#define pt(x, y)
Definition: drawing.c:79
#define WM_MOUSEWHEEL
Definition: treelist.c:96
#define DIDFT_MAKEINSTANCE(n)
Definition: dinput.h:762
#define WINE_MOUSE_BUTTONS_INSTANCE
Definition: mouse.c:48
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
BOOL WINAPI GetCursorPos(_Out_ LPPOINT)
Definition: cursoricon.c:2635
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
Definition: typeof.h:94
#define GetCurrentTime
Definition: winbase.h:2062
static UINT WPARAM LPARAM lparam
Definition: combo.c:716
#define WM_RBUTTONDOWN
Definition: winuser.h:1761
Definition: msg.h:42
#define TRACE(s)
Definition: solgame.cpp:4
#define WM_RBUTTONUP
Definition: winuser.h:1762
#define WINE_MOUSE_X_AXIS_INSTANCE
Definition: mouse.c:45
int ret
#define WINE_MOUSE_Y_AXIS_INSTANCE
Definition: mouse.c:46
#define WM_LBUTTONUP
Definition: winuser.h:1759
#define WM_MBUTTONDOWN
Definition: winuser.h:1764
#define WM_MOUSEMOVE
Definition: winuser.h:1757
void queue_event(LPDIRECTINPUTDEVICE8A iface, int inst_id, DWORD data, DWORD time, DWORD seq)
Definition: device.c:1025
#define HIWORD(l)
Definition: typedefs.h:247
#define WINE_MOUSE_Z_AXIS_INSTANCE
Definition: mouse.c:47
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
static SysMouseImpl * impl_from_IDirectInputDevice8A(IDirectInputDevice8A *iface)
Definition: mouse.c:81
#define DISCL_EXCLUSIVE
Definition: dinput.h:963
static UINT WPARAM wparam
Definition: combo.c:716
#define DIDFT_RELAXIS
Definition: dinput.h:751

Referenced by alloc_device().

◆ fill_mouse_dideviceinstanceA()

static void fill_mouse_dideviceinstanceA ( LPDIDEVICEINSTANCEA  lpddi,
DWORD  version 
)
static

Definition at line 108 of file mouse.c.

108  {
109  DWORD dwSize;
110  DIDEVICEINSTANCEA ddi;
111 
112  dwSize = lpddi->dwSize;
113 
114  TRACE("%d %p\n", dwSize, lpddi);
115 
116  memset(lpddi, 0, dwSize);
117  memset(&ddi, 0, sizeof(ddi));
118 
119  ddi.dwSize = dwSize;
120  ddi.guidInstance = GUID_SysMouse;/* DInput's GUID */
121  ddi.guidProduct = GUID_SysMouse;
122  if (version >= 0x0800)
124  else
126  strcpy(ddi.tszInstanceName, "Mouse");
127  strcpy(ddi.tszProductName, "Wine Mouse");
128 
129  memcpy(lpddi, &ddi, (dwSize < sizeof(ddi) ? dwSize : sizeof(ddi)));
130 }
GUID guidInstance
Definition: dinput.h:413
#define DIDEVTYPE_MOUSE
Definition: dinput.h:198
DWORD dwDevType
Definition: dinput.h:415
GUID guidProduct
Definition: dinput.h:414
static const WCHAR version[]
Definition: asmname.c:66
#define DIDEVTYPEMOUSE_TRADITIONAL
Definition: dinput.h:223
#define TRACE(s)
Definition: solgame.cpp:4
unsigned long DWORD
Definition: ntddk_ex.h:95
#define DI8DEVTYPEMOUSE_TRADITIONAL
Definition: dinput.h:251
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
CHAR tszInstanceName[MAX_PATH]
Definition: dinput.h:416
#define DI8DEVTYPE_MOUSE
Definition: dinput.h:210
CHAR tszProductName[MAX_PATH]
Definition: dinput.h:417
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
#define memset(x, y, z)
Definition: compat.h:39
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54

Referenced by mousedev_enum_deviceA(), and SysMouseAImpl_GetDeviceInfo().

◆ fill_mouse_dideviceinstanceW()

static void fill_mouse_dideviceinstanceW ( LPDIDEVICEINSTANCEW  lpddi,
DWORD  version 
)
static

Definition at line 132 of file mouse.c.

132  {
133  DWORD dwSize;
134  DIDEVICEINSTANCEW ddi;
135 
136  dwSize = lpddi->dwSize;
137 
138  TRACE("%d %p\n", dwSize, lpddi);
139 
140  memset(lpddi, 0, dwSize);
141  memset(&ddi, 0, sizeof(ddi));
142 
143  ddi.dwSize = dwSize;
144  ddi.guidInstance = GUID_SysMouse;/* DInput's GUID */
145  ddi.guidProduct = GUID_SysMouse;
146  if (version >= 0x0800)
148  else
150  MultiByteToWideChar(CP_ACP, 0, "Mouse", -1, ddi.tszInstanceName, MAX_PATH);
151  MultiByteToWideChar(CP_ACP, 0, "Wine Mouse", -1, ddi.tszProductName, MAX_PATH);
152 
153  memcpy(lpddi, &ddi, (dwSize < sizeof(ddi) ? dwSize : sizeof(ddi)));
154 }
DWORD dwDevType
Definition: dinput.h:428
#define CP_ACP
Definition: compat.h:109
#define DIDEVTYPE_MOUSE
Definition: dinput.h:198
static const WCHAR version[]
Definition: asmname.c:66
#define DIDEVTYPEMOUSE_TRADITIONAL
Definition: dinput.h:223
#define TRACE(s)
Definition: solgame.cpp:4
#define MAX_PATH
Definition: compat.h:34
unsigned long DWORD
Definition: ntddk_ex.h:95
#define DI8DEVTYPEMOUSE_TRADITIONAL
Definition: dinput.h:251
WCHAR tszProductName[MAX_PATH]
Definition: dinput.h:430
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
WCHAR tszInstanceName[MAX_PATH]
Definition: dinput.h:429
#define DI8DEVTYPE_MOUSE
Definition: dinput.h:210
GUID guidInstance
Definition: dinput.h:426
#define MultiByteToWideChar
Definition: compat.h:110
#define memset(x, y, z)
Definition: compat.h:39
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54
GUID guidProduct
Definition: dinput.h:427

Referenced by mousedev_enum_deviceW(), and SysMouseWImpl_GetDeviceInfo().

◆ IDirectInputDevice8W_from_impl()

static IDirectInputDevice8W* IDirectInputDevice8W_from_impl ( SysMouseImpl This)
inlinestatic

◆ impl_from_IDirectInputDevice8A()

static SysMouseImpl* impl_from_IDirectInputDevice8A ( IDirectInputDevice8A *  iface)
inlinestatic

Definition at line 81 of file mouse.c.

82 {
83  return CONTAINING_RECORD(CONTAINING_RECORD(iface, IDirectInputDeviceImpl, IDirectInputDevice8A_iface), SysMouseImpl, base);
84 }
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560

Referenced by dinput_mouse_hook(), SysMouseAImpl_Acquire(), SysMouseAImpl_BuildActionMap(), SysMouseAImpl_GetCapabilities(), SysMouseAImpl_GetDeviceData(), SysMouseAImpl_GetDeviceInfo(), SysMouseAImpl_GetDeviceState(), SysMouseAImpl_GetObjectInfo(), SysMouseAImpl_GetProperty(), SysMouseAImpl_SetActionMap(), and SysMouseAImpl_Unacquire().

◆ impl_from_IDirectInputDevice8W()

static SysMouseImpl* impl_from_IDirectInputDevice8W ( IDirectInputDevice8W *  iface)
inlinestatic

Definition at line 85 of file mouse.c.

86 {
87  return CONTAINING_RECORD(CONTAINING_RECORD(iface, IDirectInputDeviceImpl, IDirectInputDevice8W_iface), SysMouseImpl, base);
88 }
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560

Referenced by SysMouseWImpl_Acquire(), SysMouseWImpl_GetCapabilities(), SysMouseWImpl_GetDeviceData(), SysMouseWImpl_GetDeviceInfo(), SysMouseWImpl_GetDeviceState(), SysMouseWImpl_GetProperty(), SysMouseWImpl_SetActionMap(), and SysMouseWImpl_Unacquire().

◆ mousedev_create_device()

static HRESULT mousedev_create_device ( IDirectInputImpl dinput,
REFGUID  rguid,
REFIID  riid,
LPVOID pdev,
int  unicode 
)
static

Definition at line 258 of file mouse.c.

259 {
260  TRACE("%p %s %s %p %i\n", dinput, debugstr_guid(rguid), debugstr_guid(riid), pdev, unicode);
261  *pdev = NULL;
262 
263  if (IsEqualGUID(&GUID_SysMouse, rguid)) /* Wine Mouse */
264  {
266 
267  if (riid == NULL)
268  ;/* nothing */
269  else if (IsEqualGUID(&IID_IDirectInputDeviceA, riid) ||
270  IsEqualGUID(&IID_IDirectInputDevice2A, riid) ||
271  IsEqualGUID(&IID_IDirectInputDevice7A, riid) ||
272  IsEqualGUID(&IID_IDirectInputDevice8A, riid))
273  {
274  unicode = 0;
275  }
276  else if (IsEqualGUID(&IID_IDirectInputDeviceW, riid) ||
277  IsEqualGUID(&IID_IDirectInputDevice2W, riid) ||
278  IsEqualGUID(&IID_IDirectInputDevice7W, riid) ||
279  IsEqualGUID(&IID_IDirectInputDevice8W, riid))
280  {
281  unicode = 1;
282  }
283  else
284  {
285  WARN("no interface\n");
286  return DIERR_NOINTERFACE;
287  }
288 
289  This = alloc_device(rguid, dinput);
290  TRACE("Created a Mouse device (%p)\n", This);
291 
292  if (!This) return DIERR_OUTOFMEMORY;
293 
294  if (unicode)
295  *pdev = &This->base.IDirectInputDevice8W_iface;
296  else
297  *pdev = &This->base.IDirectInputDevice8A_iface;
298 
299  return DI_OK;
300  }
301 
302  return DIERR_DEVICENOTREG;
303 }
REFIID riid
Definition: precomp.h:44
#define WARN(fmt,...)
Definition: debug.h:112
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
#define DIERR_OUTOFMEMORY
Definition: dinput.h:155
#define DIERR_DEVICENOTREG
Definition: dinput.h:147
#define DIERR_NOINTERFACE
Definition: dinput.h:153
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
static SysMouseImpl * alloc_device(REFGUID rguid, IDirectInputImpl *dinput)
Definition: mouse.c:198
#define DI_OK
Definition: dinput.h:128

◆ mousedev_enum_deviceA()

static HRESULT mousedev_enum_deviceA ( DWORD  dwDevType,
DWORD  dwFlags,
LPDIDEVICEINSTANCEA  lpddi,
DWORD  version,
int  id 
)
static

Definition at line 156 of file mouse.c.

157 {
158  if (id != 0)
159  return E_FAIL;
160 
162  return S_FALSE;
163 
164  if ((dwDevType == 0) ||
165  ((dwDevType == DIDEVTYPE_MOUSE) && (version < 0x0800)) ||
166  (((dwDevType == DI8DEVCLASS_POINTER) || (dwDevType == DI8DEVTYPE_MOUSE)) && (version >= 0x0800))) {
167  TRACE("Enumerating the mouse device\n");
168 
170 
171  return S_OK;
172  }
173 
174  return S_FALSE;
175 }
static void fill_mouse_dideviceinstanceA(LPDIDEVICEINSTANCEA lpddi, DWORD version)
Definition: mouse.c:108
#define DIEDFL_FORCEFEEDBACK
Definition: dinput.h:192
#define E_FAIL
Definition: ddrawi.h:102
#define DIDEVTYPE_MOUSE
Definition: dinput.h:198
#define S_FALSE
Definition: winerror.h:2357
static const WCHAR version[]
Definition: asmname.c:66
#define DI8DEVCLASS_POINTER
Definition: dinput.h:205
#define TRACE(s)
Definition: solgame.cpp:4
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define S_OK
Definition: intsafe.h:51
#define DI8DEVTYPE_MOUSE
Definition: dinput.h:210

◆ mousedev_enum_deviceW()

static HRESULT mousedev_enum_deviceW ( DWORD  dwDevType,
DWORD  dwFlags,
LPDIDEVICEINSTANCEW  lpddi,
DWORD  version,
int  id 
)
static

Definition at line 177 of file mouse.c.

178 {
179  if (id != 0)
180  return E_FAIL;
181 
183  return S_FALSE;
184 
185  if ((dwDevType == 0) ||
186  ((dwDevType == DIDEVTYPE_MOUSE) && (version < 0x0800)) ||
187  (((dwDevType == DI8DEVCLASS_POINTER) || (dwDevType == DI8DEVTYPE_MOUSE)) && (version >= 0x0800))) {
188  TRACE("Enumerating the mouse device\n");
189 
191 
192  return S_OK;
193  }
194 
195  return S_FALSE;
196 }
#define DIEDFL_FORCEFEEDBACK
Definition: dinput.h:192
#define E_FAIL
Definition: ddrawi.h:102
#define DIDEVTYPE_MOUSE
Definition: dinput.h:198
#define S_FALSE
Definition: winerror.h:2357
static const WCHAR version[]
Definition: asmname.c:66
#define DI8DEVCLASS_POINTER
Definition: dinput.h:205
#define TRACE(s)
Definition: solgame.cpp:4
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define S_OK
Definition: intsafe.h:51
#define DI8DEVTYPE_MOUSE
Definition: dinput.h:210
static void fill_mouse_dideviceinstanceW(LPDIDEVICEINSTANCEW lpddi, DWORD version)
Definition: mouse.c:132

◆ SysMouseAImpl_Acquire()

static HRESULT WINAPI SysMouseAImpl_Acquire ( LPDIRECTINPUTDEVICE8A  iface)
static

Definition at line 504 of file mouse.c.

505 {
508 }
static HRESULT WINAPI SysMouseWImpl_Acquire(LPDIRECTINPUTDEVICE8W iface)
Definition: mouse.c:458
static IDirectInputDevice8W * IDirectInputDevice8W_from_impl(SysMouseImpl *This)
Definition: mouse.c:90
static SysMouseImpl * impl_from_IDirectInputDevice8A(IDirectInputDevice8A *iface)
Definition: mouse.c:81

◆ SysMouseAImpl_BuildActionMap()

static HRESULT WINAPI SysMouseAImpl_BuildActionMap ( LPDIRECTINPUTDEVICE8A  iface,
LPDIACTIONFORMATA  lpdiaf,
LPCSTR  lpszUserName,
DWORD  dwFlags 
)
static

Definition at line 801 of file mouse.c.

805 {
807  DIACTIONFORMATW diafW;
808  HRESULT hr;
809  WCHAR *lpszUserNameW = NULL;
810  int username_size;
811 
812  diafW.rgoAction = HeapAlloc(GetProcessHeap(), 0, sizeof(DIACTIONW)*lpdiaf->dwNumActions);
813  _copy_diactionformatAtoW(&diafW, lpdiaf);
814 
815  if (lpszUserName != NULL)
816  {
817  username_size = MultiByteToWideChar(CP_ACP, 0, lpszUserName, -1, NULL, 0);
818  lpszUserNameW = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR)*username_size);
819  MultiByteToWideChar(CP_ACP, 0, lpszUserName, -1, lpszUserNameW, username_size);
820  }
821 
822  hr = SysMouseWImpl_BuildActionMap(&This->base.IDirectInputDevice8W_iface, &diafW, lpszUserNameW, dwFlags);
823 
824  _copy_diactionformatWtoA(lpdiaf, &diafW);
825  HeapFree(GetProcessHeap(), 0, diafW.rgoAction);
826  HeapFree(GetProcessHeap(), 0, lpszUserNameW);
827 
828  return hr;
829 }
HRESULT hr
Definition: shlfolder.c:183
static HRESULT WINAPI SysMouseWImpl_BuildActionMap(LPDIRECTINPUTDEVICE8W iface, LPDIACTIONFORMATW lpdiaf, LPCWSTR lpszUserName, DWORD dwFlags)
Definition: mouse.c:791
#define CP_ACP
Definition: compat.h:109
DWORD dwNumActions
Definition: dinput.h:1311
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:484
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:79
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
LPDIACTIONW rgoAction
Definition: dinput.h:1330
void _copy_diactionformatAtoW(LPDIACTIONFORMATW to, LPDIACTIONFORMATA from)
Definition: dinput_main.c:339
void _copy_diactionformatWtoA(LPDIACTIONFORMATA to, LPDIACTIONFORMATW from)
Definition: dinput_main.c:366
#define MultiByteToWideChar
Definition: compat.h:110
static SysMouseImpl * impl_from_IDirectInputDevice8A(IDirectInputDevice8A *iface)
Definition: mouse.c:81
#define HeapFree(x, y, z)
Definition: compat.h:483

◆ SysMouseAImpl_GetCapabilities()

static HRESULT WINAPI SysMouseAImpl_GetCapabilities ( LPDIRECTINPUTDEVICE8A  iface,
LPDIDEVCAPS  lpDIDevCaps 
)
static

Definition at line 705 of file mouse.c.

706 {
709 }
static HRESULT WINAPI SysMouseWImpl_GetCapabilities(LPDIRECTINPUTDEVICE8W iface, LPDIDEVCAPS lpDIDevCaps)
Definition: mouse.c:673
static IDirectInputDevice8W * IDirectInputDevice8W_from_impl(SysMouseImpl *This)
Definition: mouse.c:90
static SysMouseImpl * impl_from_IDirectInputDevice8A(IDirectInputDevice8A *iface)
Definition: mouse.c:81

◆ SysMouseAImpl_GetDeviceData()

static HRESULT WINAPI SysMouseAImpl_GetDeviceData ( LPDIRECTINPUTDEVICE8A  iface,
DWORD  dodsize,
LPDIDEVICEOBJECTDATA  dod,
LPDWORD  entries,
DWORD  flags 
)
static

Definition at line 599 of file mouse.c.

601 {
603  return SysMouseWImpl_GetDeviceData(IDirectInputDevice8W_from_impl(This), dodsize, dod, entries, flags);
604 }
static HRESULT WINAPI SysMouseWImpl_GetDeviceData(LPDIRECTINPUTDEVICE8W iface, DWORD dodsize, LPDIDEVICEOBJECTDATA dod, LPDWORD entries, DWORD flags)
Definition: mouse.c:588
GLbitfield flags
Definition: glext.h:7161
static IDirectInputDevice8W * IDirectInputDevice8W_from_impl(SysMouseImpl *This)
Definition: mouse.c:90
static SysMouseImpl * impl_from_IDirectInputDevice8A(IDirectInputDevice8A *iface)
Definition: mouse.c:81

◆ SysMouseAImpl_GetDeviceInfo()

static HRESULT WINAPI SysMouseAImpl_GetDeviceInfo ( LPDIRECTINPUTDEVICE8A  iface,
LPDIDEVICEINSTANCEA  pdidi 
)
static

Definition at line 764 of file mouse.c.

767 {
769  TRACE("(this=%p,%p)\n", This, pdidi);
770 
771  fill_mouse_dideviceinstanceA(pdidi, This->base.dinput->dwVersion);
772 
773  return DI_OK;
774 }
static void fill_mouse_dideviceinstanceA(LPDIDEVICEINSTANCEA lpddi, DWORD version)
Definition: mouse.c:108
#define TRACE(s)
Definition: solgame.cpp:4
#define DI_OK
Definition: dinput.h:128
static SysMouseImpl * impl_from_IDirectInputDevice8A(IDirectInputDevice8A *iface)
Definition: mouse.c:81

◆ SysMouseAImpl_GetDeviceState()

static HRESULT WINAPI SysMouseAImpl_GetDeviceState ( LPDIRECTINPUTDEVICE8A  iface,
DWORD  len,
LPVOID  ptr 
)
static

Definition at line 579 of file mouse.c.

580 {
583 }
static HRESULT WINAPI SysMouseWImpl_GetDeviceState(LPDIRECTINPUTDEVICE8W iface, DWORD len, LPVOID ptr)
Definition: mouse.c:551
static PVOID ptr
Definition: dispmode.c:27
GLenum GLsizei len
Definition: glext.h:6722
static IDirectInputDevice8W * IDirectInputDevice8W_from_impl(SysMouseImpl *This)
Definition: mouse.c:90
static SysMouseImpl * impl_from_IDirectInputDevice8A(IDirectInputDevice8A *iface)
Definition: mouse.c:81

◆ SysMouseAImpl_GetObjectInfo()

static HRESULT WINAPI SysMouseAImpl_GetObjectInfo ( LPDIRECTINPUTDEVICE8A  iface,
LPDIDEVICEOBJECTINSTANCEA  pdidoi,
DWORD  dwObj,
DWORD  dwHow 
)
static

Definition at line 740 of file mouse.c.

742 {
744  HRESULT res;
746  DWORD dwSize = pdidoi->dwSize;
747 
748  didoiW.dwSize = sizeof(didoiW);
750  if (res != DI_OK) return res;
751 
752  memset(pdidoi, 0, pdidoi->dwSize);
753  memcpy(pdidoi, &didoiW, FIELD_OFFSET(DIDEVICEOBJECTINSTANCEW, tszName));
754  pdidoi->dwSize = dwSize;
755  WideCharToMultiByte(CP_ACP, 0, didoiW.tszName, -1, pdidoi->tszName,
756  sizeof(pdidoi->tszName), NULL, NULL);
757 
758  return res;
759 }
#define WideCharToMultiByte
Definition: compat.h:111
#define CP_ACP
Definition: compat.h:109
static HRESULT WINAPI SysMouseWImpl_GetObjectInfo(LPDIRECTINPUTDEVICE8W iface, LPDIDEVICEOBJECTINSTANCEW pdidoi, DWORD dwObj, DWORD dwHow)
Definition: mouse.c:715
WCHAR tszName[MAX_PATH]
Definition: dinput.h:371
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:79
unsigned long DWORD
Definition: ntddk_ex.h:95
CHAR tszName[MAX_PATH]
Definition: dinput.h:352
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
GLuint res
Definition: glext.h:9613
#define DI_OK
Definition: dinput.h:128
static IDirectInputDevice8W * IDirectInputDevice8W_from_impl(SysMouseImpl *This)
Definition: mouse.c:90
#define memset(x, y, z)
Definition: compat.h:39
static SysMouseImpl * impl_from_IDirectInputDevice8A(IDirectInputDevice8A *iface)
Definition: mouse.c:81
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54

◆ SysMouseAImpl_GetProperty()

static HRESULT WINAPI SysMouseAImpl_GetProperty ( LPDIRECTINPUTDEVICE8A  iface,
REFGUID  rguid,
LPDIPROPHEADER  pdiph 
)
static

Definition at line 664 of file mouse.c.

665 {
668 }
static HRESULT WINAPI SysMouseWImpl_GetProperty(LPDIRECTINPUTDEVICE8W iface, REFGUID rguid, LPDIPROPHEADER pdiph)
Definition: mouse.c:609
static IDirectInputDevice8W * IDirectInputDevice8W_from_impl(SysMouseImpl *This)
Definition: mouse.c:90
static SysMouseImpl * impl_from_IDirectInputDevice8A(IDirectInputDevice8A *iface)
Definition: mouse.c:81

◆ SysMouseAImpl_SetActionMap()

static HRESULT WINAPI SysMouseAImpl_SetActionMap ( LPDIRECTINPUTDEVICE8A  iface,
LPDIACTIONFORMATA  lpdiaf,
LPCSTR  lpszUserName,
DWORD  dwFlags 
)
static

Definition at line 842 of file mouse.c.

846 {
848  DIACTIONFORMATW diafW;
849  HRESULT hr;
850  WCHAR *lpszUserNameW = NULL;
851  int username_size;
852 
853  diafW.rgoAction = HeapAlloc(GetProcessHeap(), 0, sizeof(DIACTIONW)*lpdiaf->dwNumActions);
854  _copy_diactionformatAtoW(&diafW, lpdiaf);
855 
856  if (lpszUserName != NULL)
857  {
858  username_size = MultiByteToWideChar(CP_ACP, 0, lpszUserName, -1, NULL, 0);
859  lpszUserNameW = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR)*username_size);
860  MultiByteToWideChar(CP_ACP, 0, lpszUserName, -1, lpszUserNameW, username_size);
861  }
862 
863  hr = SysMouseWImpl_SetActionMap(&This->base.IDirectInputDevice8W_iface, &diafW, lpszUserNameW, dwFlags);
864 
865  lpdiaf->dwCRC = diafW.dwCRC;
866 
867  HeapFree(GetProcessHeap(), 0, diafW.rgoAction);
868  HeapFree(GetProcessHeap(), 0, lpszUserNameW);
869 
870  return hr;
871 }
HRESULT hr
Definition: shlfolder.c:183
#define CP_ACP
Definition: compat.h:109
DWORD dwNumActions
Definition: dinput.h:1311
static HRESULT WINAPI SysMouseWImpl_SetActionMap(LPDIRECTINPUTDEVICE8W iface, LPDIACTIONFORMATW lpdiaf, LPCWSTR lpszUserName, DWORD dwFlags)
Definition: mouse.c:831
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:484
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:79
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
LPDIACTIONW rgoAction
Definition: dinput.h:1330
void _copy_diactionformatAtoW(LPDIACTIONFORMATW to, LPDIACTIONFORMATA from)
Definition: dinput_main.c:339
#define MultiByteToWideChar
Definition: compat.h:110
static SysMouseImpl * impl_from_IDirectInputDevice8A(IDirectInputDevice8A *iface)
Definition: mouse.c:81
#define HeapFree(x, y, z)
Definition: compat.h:483

◆ SysMouseAImpl_Unacquire()

static HRESULT WINAPI SysMouseAImpl_Unacquire ( LPDIRECTINPUTDEVICE8A  iface)
static

Definition at line 539 of file mouse.c.

540 {
543 }
static HRESULT WINAPI SysMouseWImpl_Unacquire(LPDIRECTINPUTDEVICE8W iface)
Definition: mouse.c:513
static IDirectInputDevice8W * IDirectInputDevice8W_from_impl(SysMouseImpl *This)
Definition: mouse.c:90
static SysMouseImpl * impl_from_IDirectInputDevice8A(IDirectInputDevice8A *iface)
Definition: mouse.c:81

◆ SysMouseWImpl_Acquire()

static HRESULT WINAPI SysMouseWImpl_Acquire ( LPDIRECTINPUTDEVICE8W  iface)
static

Definition at line 458 of file mouse.c.

459 {
461  POINT point;
462  HRESULT res;
463 
464  TRACE("(this=%p)\n",This);
465 
466  if ((res = IDirectInputDevice2WImpl_Acquire(iface)) != DI_OK) return res;
467 
468  /* Init the mouse state */
469  GetCursorPos( &point );
470  if (This->base.data_format.user_df->dwFlags & DIDF_ABSAXIS)
471  {
472  This->m_state.lX = point.x;
473  This->m_state.lY = point.y;
474  } else {
475  This->m_state.lX = 0;
476  This->m_state.lY = 0;
477  This->org_coords = point;
478  }
479  This->m_state.lZ = 0;
480  This->m_state.rgbButtons[0] = GetKeyState(VK_LBUTTON) & 0x80;
481  This->m_state.rgbButtons[1] = GetKeyState(VK_RBUTTON) & 0x80;
482  This->m_state.rgbButtons[2] = GetKeyState(VK_MBUTTON) & 0x80;
483 
484  if (This->base.dwCoopLevel & DISCL_EXCLUSIVE)
485  {
486  ShowCursor(FALSE); /* hide cursor */
487  warp_check( This, TRUE );
488  }
489  else if (This->warp_override == WARP_FORCE_ON)
490  {
491  /* Need a window to warp mouse in. */
492  if (!This->base.win) This->base.win = GetDesktopWindow();
493  warp_check( This, TRUE );
494  }
495  else if (This->clipped)
496  {
497  ClipCursor( NULL );
498  This->clipped = FALSE;
499  }
500 
501  return DI_OK;
502 }
#define DIDF_ABSAXIS
Definition: dinput.h:775
BOOL WINAPI ClipCursor(_In_opt_ LPCRECT)
#define VK_LBUTTON
Definition: winuser.h:2165
static void warp_check(SysMouseImpl *This, BOOL force)
Definition: mouse.c:419
#define TRUE
Definition: types.h:120
HRESULT WINAPI IDirectInputDevice2WImpl_Acquire(LPDIRECTINPUTDEVICE8W iface)
Definition: device.c:1076
void ShowCursor(void)
Definition: hardware.c:556
BOOL WINAPI GetCursorPos(_Out_ LPPOINT)
Definition: cursoricon.c:2635
POINTL point
Definition: edittest.c:50
LONG y
Definition: windef.h:330
#define VK_RBUTTON
Definition: winuser.h:2166
#define FALSE
Definition: types.h:117
smooth NULL
Definition: ftsmooth.c:416
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:656
static SysMouseImpl * impl_from_IDirectInputDevice8W(IDirectInputDevice8W *iface)
Definition: mouse.c:85
SHORT WINAPI GetKeyState(_In_ int)
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:79
LONG x
Definition: windef.h:329
GLuint res
Definition: glext.h:9613
#define DI_OK
Definition: dinput.h:128
#define VK_MBUTTON
Definition: winuser.h:2168
#define DISCL_EXCLUSIVE
Definition: dinput.h:963

Referenced by SysMouseAImpl_Acquire().

◆ SysMouseWImpl_BuildActionMap()

static HRESULT WINAPI SysMouseWImpl_BuildActionMap ( LPDIRECTINPUTDEVICE8W  iface,
LPDIACTIONFORMATW  lpdiaf,
LPCWSTR  lpszUserName,
DWORD  dwFlags 
)
static

Definition at line 791 of file mouse.c.

795 {
796  FIXME("(%p)->(%p,%s,%08x): semi-stub !\n", iface, lpdiaf, debugstr_w(lpszUserName), dwFlags);
797 
798  return _build_action_map(iface, lpdiaf, lpszUserName, dwFlags, DIMOUSE_MASK, &c_dfDIMouse2);
799 }
const DIDATAFORMAT c_dfDIMouse2
Definition: data_formats.c:293
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:111
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define DIMOUSE_MASK
HRESULT _build_action_map(LPDIRECTINPUTDEVICE8W iface, LPDIACTIONFORMATW lpdiaf, LPCWSTR lpszUserName, DWORD dwFlags, DWORD devMask, LPCDIDATAFORMAT df)
Definition: device.c:791

Referenced by SysMouseAImpl_BuildActionMap().

◆ SysMouseWImpl_GetCapabilities()

static HRESULT WINAPI SysMouseWImpl_GetCapabilities ( LPDIRECTINPUTDEVICE8W  iface,
LPDIDEVCAPS  lpDIDevCaps 
)
static

Definition at line 673 of file mouse.c.

674 {
676  DIDEVCAPS devcaps;
677 
678  TRACE("(this=%p,%p)\n",This,lpDIDevCaps);
679 
680  if ((lpDIDevCaps->dwSize != sizeof(DIDEVCAPS)) && (lpDIDevCaps->dwSize != sizeof(DIDEVCAPS_DX3))) {
681  WARN("invalid parameter\n");
682  return DIERR_INVALIDPARAM;
683  }
684 
685  devcaps.dwSize = lpDIDevCaps->dwSize;
686  devcaps.dwFlags = DIDC_ATTACHED | DIDC_EMULATED;
687  if (This->base.dinput->dwVersion >= 0x0800)
689  else
691  devcaps.dwAxes = 3;
692  devcaps.dwButtons = 8;
693  devcaps.dwPOVs = 0;
694  devcaps.dwFFSamplePeriod = 0;
695  devcaps.dwFFMinTimeResolution = 0;
696  devcaps.dwFirmwareRevision = 100;
697  devcaps.dwHardwareRevision = 100;
698  devcaps.dwFFDriverVersion = 0;
699 
700  memcpy(lpDIDevCaps, &devcaps, lpDIDevCaps->dwSize);
701 
702  return DI_OK;
703 }
DWORD dwFFMinTimeResolution
Definition: dinput.h:939
#define DIDC_EMULATED
Definition: dinput.h:947
#define WARN(fmt,...)
Definition: debug.h:112
#define DIDC_ATTACHED
Definition: dinput.h:945
DWORD dwDevType
Definition: dinput.h:934
#define DIDEVTYPE_MOUSE
Definition: dinput.h:198
DWORD dwFFSamplePeriod
Definition: dinput.h:938
DWORD dwFlags
Definition: dinput.h:933
DWORD dwAxes
Definition: dinput.h:935
static SysMouseImpl * impl_from_IDirectInputDevice8W(IDirectInputDevice8W *iface)
Definition: mouse.c:85
DWORD dwPOVs
Definition: dinput.h:937
#define DIDEVTYPEMOUSE_TRADITIONAL
Definition: dinput.h:223
DWORD dwHardwareRevision
Definition: dinput.h:941
#define DIERR_INVALIDPARAM
Definition: dinput.h:152
#define TRACE(s)
Definition: solgame.cpp:4
DWORD dwSize
Definition: dinput.h:932
DWORD dwFFDriverVersion
Definition: dinput.h:942
DWORD dwButtons
Definition: dinput.h:936
#define DI8DEVTYPEMOUSE_TRADITIONAL
Definition: dinput.h:251
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define DI8DEVTYPE_MOUSE
Definition: dinput.h:210
#define DI_OK
Definition: dinput.h:128
DWORD dwFirmwareRevision
Definition: dinput.h:940

Referenced by SysMouseAImpl_GetCapabilities().

◆ SysMouseWImpl_GetDeviceData()

static HRESULT WINAPI SysMouseWImpl_GetDeviceData ( LPDIRECTINPUTDEVICE8W  iface,
DWORD  dodsize,
LPDIDEVICEOBJECTDATA  dod,
LPDWORD  entries,
DWORD  flags 
)
static

Definition at line 588 of file mouse.c.

590 {
592  HRESULT res;
593 
594  res = IDirectInputDevice2WImpl_GetDeviceData(iface, dodsize, dod, entries, flags);
595  if (SUCCEEDED(res)) warp_check( This, FALSE );
596  return res;
597 }
static void warp_check(SysMouseImpl *This, BOOL force)
Definition: mouse.c:419
#define FALSE
Definition: types.h:117
static SysMouseImpl * impl_from_IDirectInputDevice8W(IDirectInputDevice8W *iface)
Definition: mouse.c:85
LONG HRESULT
Definition: typedefs.h:79
HRESULT WINAPI IDirectInputDevice2WImpl_GetDeviceData(LPDIRECTINPUTDEVICE8W iface, DWORD dodsize, LPDIDEVICEOBJECTDATA dod, LPDWORD entries, DWORD flags)
Definition: device.c:1629
GLbitfield flags
Definition: glext.h:7161
GLuint res
Definition: glext.h:9613
#define SUCCEEDED(hr)
Definition: intsafe.h:49

Referenced by SysMouseAImpl_GetDeviceData().

◆ SysMouseWImpl_GetDeviceInfo()

static HRESULT WINAPI SysMouseWImpl_GetDeviceInfo ( LPDIRECTINPUTDEVICE8W  iface,
LPDIDEVICEINSTANCEW  pdidi 
)
static

Definition at line 776 of file mouse.c.

777 {
779  TRACE("(this=%p,%p)\n", This, pdidi);
780 
781  if (pdidi->dwSize != sizeof(DIDEVICEINSTANCEW)) {
782  WARN(" dinput3 not supported yet...\n");
783  return DI_OK;
784  }
785 
786  fill_mouse_dideviceinstanceW(pdidi, This->base.dinput->dwVersion);
787 
788  return DI_OK;
789 }
#define WARN(fmt,...)
Definition: debug.h:112
static SysMouseImpl * impl_from_IDirectInputDevice8W(IDirectInputDevice8W *iface)
Definition: mouse.c:85
#define TRACE(s)
Definition: solgame.cpp:4
static void fill_mouse_dideviceinstanceW(LPDIDEVICEINSTANCEW lpddi, DWORD version)
Definition: mouse.c:132
#define DI_OK
Definition: dinput.h:128

◆ SysMouseWImpl_GetDeviceState()

static HRESULT WINAPI SysMouseWImpl_GetDeviceState ( LPDIRECTINPUTDEVICE8W  iface,
DWORD  len,
LPVOID  ptr 
)
static

Definition at line 551 of file mouse.c.

552 {
554  TRACE("(%p)->(%u,%p)\n", This, len, ptr);
555 
556  if(This->base.acquired == 0) return DIERR_NOTACQUIRED;
557 
559 
560  EnterCriticalSection(&This->base.crit);
561  _dump_mouse_state(&This->m_state);
562 
563  /* Copy the current mouse state */
564  fill_DataFormat(ptr, len, &This->m_state, &This->base.data_format);
565 
566  /* Initialize the buffer when in relative mode */
567  if (!(This->base.data_format.user_df->dwFlags & DIDF_ABSAXIS))
568  {
569  This->m_state.lX = 0;
570  This->m_state.lY = 0;
571  This->m_state.lZ = 0;
572  }
573  LeaveCriticalSection(&This->base.crit);
574 
575  warp_check( This, FALSE );
576  return DI_OK;
577 }
void check_dinput_events(void)
Definition: dinput_main.c:1900
static void _dump_mouse_state(const DIMOUSESTATE2 *m_state)
Definition: mouse.c:97
#define DIDF_ABSAXIS
Definition: dinput.h:775
static void warp_check(SysMouseImpl *This, BOOL force)
Definition: mouse.c:419
#define DIERR_NOTACQUIRED
Definition: dinput.h:167
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define FALSE
Definition: types.h:117
static PVOID ptr
Definition: dispmode.c:27
static SysMouseImpl * impl_from_IDirectInputDevice8W(IDirectInputDevice8W *iface)
Definition: mouse.c:85
#define TRACE(s)
Definition: solgame.cpp:4
void fill_DataFormat(void *out, DWORD size, const void *in, const DataFormat *df)
Definition: device.c:326
GLenum GLsizei len
Definition: glext.h:6722
#define DI_OK
Definition: dinput.h:128
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)

Referenced by SysMouseAImpl_GetDeviceState().

◆ SysMouseWImpl_GetObjectInfo()

static HRESULT WINAPI SysMouseWImpl_GetObjectInfo ( LPDIRECTINPUTDEVICE8W  iface,
LPDIDEVICEOBJECTINSTANCEW  pdidoi,
DWORD  dwObj,
DWORD  dwHow 
)
static

Definition at line 715 of file mouse.c.

717 {
718  static const WCHAR x_axisW[] = {'X','-','A','x','i','s',0};
719  static const WCHAR y_axisW[] = {'Y','-','A','x','i','s',0};
720  static const WCHAR wheelW[] = {'W','h','e','e','l',0};
721  static const WCHAR buttonW[] = {'B','u','t','t','o','n',' ','%','d',0};
722  HRESULT res;
723 
724  res = IDirectInputDevice2WImpl_GetObjectInfo(iface, pdidoi, dwObj, dwHow);
725  if (res != DI_OK) return res;
726 
727  if (IsEqualGUID(&pdidoi->guidType, &GUID_XAxis)) strcpyW(pdidoi->tszName, x_axisW);
728  else if (IsEqualGUID(&pdidoi->guidType, &GUID_YAxis)) strcpyW(pdidoi->tszName, y_axisW);
729  else if (IsEqualGUID(&pdidoi->guidType, &GUID_ZAxis)) strcpyW(pdidoi->tszName, wheelW);
730  else if (pdidoi->dwType & DIDFT_BUTTON)
731  wsprintfW(pdidoi->tszName, buttonW, DIDFT_GETINSTANCE(pdidoi->dwType) - 3);
732 
733  if(pdidoi->dwType & DIDFT_AXIS)
734  pdidoi->dwFlags |= DIDOI_ASPECTPOSITION;
735 
736  _dump_OBJECTINSTANCEW(pdidoi);
737  return res;
738 }
int WINAPIV wsprintfW(_Out_ LPWSTR, _In_ _Printf_format_string_ LPCWSTR,...)
static const WCHAR buttonW[]
Definition: htmlelem.c:24
void _dump_OBJECTINSTANCEW(const DIDEVICEOBJECTINSTANCEW *ddoi)
Definition: device.c:191
WCHAR tszName[MAX_PATH]
Definition: dinput.h:371
#define DIDFT_GETINSTANCE(n)
Definition: dinput.h:764
#define DIDFT_BUTTON
Definition: dinput.h:756
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define DIDOI_ASPECTPOSITION
Definition: dinput.h:820
LONG HRESULT
Definition: typedefs.h:79
#define DIDFT_AXIS
Definition: dinput.h:753
WINE_UNICODE_INLINE WCHAR * strcpyW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:219
HRESULT WINAPI IDirectInputDevice2WImpl_GetObjectInfo(LPDIRECTINPUTDEVICE8W iface, LPDIDEVICEOBJECTINSTANCEW pdidoi, DWORD dwObj, DWORD dwHow)
Definition: device.c:1576
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
GLuint res
Definition: glext.h:9613
#define DI_OK
Definition: dinput.h:128

Referenced by SysMouseAImpl_GetObjectInfo().

◆ SysMouseWImpl_GetProperty()

static HRESULT WINAPI SysMouseWImpl_GetProperty ( LPDIRECTINPUTDEVICE8W  iface,
REFGUID  rguid,
LPDIPROPHEADER  pdiph 
)
static

Definition at line 609 of file mouse.c.

610 {
612 
613  TRACE("(%p) %s,%p\n", This, debugstr_guid(rguid), pdiph);
614  _dump_DIPROPHEADER(pdiph);
615 
616  if (IS_DIPROP(rguid)) {
617  switch (LOWORD(rguid)) {
618  case (DWORD_PTR) DIPROP_GRANULARITY: {
619  LPDIPROPDWORD pr = (LPDIPROPDWORD) pdiph;
620 
621  if (
622  ((pdiph->dwHow == DIPH_BYOFFSET) &&
623  ((pdiph->dwObj == DIMOFS_X) ||
624  (pdiph->dwObj == DIMOFS_Y)))
625  ||
626  ((pdiph->dwHow == DIPH_BYID) &&
629  ){
630  /* Set granularity of X/Y Axis to 1. See MSDN on DIPROP_GRANULARITY */
631  pr->dwData = 1;
632  } else {
633  /* We'll just assume that the app asks about the Z axis */
634  pr->dwData = WHEEL_DELTA;
635  }
636 
637  break;
638  }
639 
640  case (DWORD_PTR) DIPROP_RANGE: {
641  LPDIPROPRANGE pr = (LPDIPROPRANGE) pdiph;
642 
643  if ((pdiph->dwHow == DIPH_BYID) &&
646  /* Querying the range of either the X or the Y axis. As I do
647  not know the range, do as if the range were
648  unrestricted...*/
649  pr->lMin = DIPROPRANGE_NOMIN;
650  pr->lMax = DIPROPRANGE_NOMAX;
651  }
652 
653  break;
654  }
655 
656  default:
657  return IDirectInputDevice2WImpl_GetProperty(iface, rguid, pdiph);
658  }
659  }
660 
661  return DI_OK;
662 }
HRESULT WINAPI IDirectInputDevice2WImpl_GetProperty(LPDIRECTINPUTDEVICE8W iface, REFGUID rguid, LPDIPROPHEADER pdiph)
Definition: device.c:1386
#define DIPH_BYID
Definition: dinput.h:837
#define DIPROPRANGE_NOMIN
Definition: dinput.h:855
#define DIDFT_MAKEINSTANCE(n)
Definition: dinput.h:762
#define DIPROP_RANGE
Definition: dinput.h:892
DWORD dwHow
Definition: dinput.h:831
struct DIPROPRANGE * LPDIPROPRANGE
#define WHEEL_DELTA
Definition: treelist.c:99
#define DIPH_BYOFFSET
Definition: dinput.h:836
#define DIMOFS_X
Definition: dinput.h:2126
static SysMouseImpl * impl_from_IDirectInputDevice8W(IDirectInputDevice8W *iface)
Definition: mouse.c:85
#define debugstr_guid
Definition: kernel32.h:35
#define DIPROPRANGE_NOMAX
Definition: dinput.h:856
#define TRACE(s)
Definition: solgame.cpp:4
void _dump_DIPROPHEADER(LPCDIPROPHEADER diph)
Definition: device.c:176
#define DIPROP_GRANULARITY
Definition: dinput.h:891
#define WINE_MOUSE_X_AXIS_INSTANCE
Definition: mouse.c:45
DWORD dwData
Definition: dinput.h:844
#define WINE_MOUSE_Y_AXIS_INSTANCE
Definition: mouse.c:46
uint32_t DWORD_PTR
Definition: typedefs.h:65
DWORD dwObj
Definition: dinput.h:830
#define DIMOFS_Y
Definition: dinput.h:2127
LONG lMin
Definition: dinput.h:850
#define DI_OK
Definition: dinput.h:128
LONG lMax
Definition: dinput.h:851
#define IS_DIPROP(x)
struct DIPROPDWORD * LPDIPROPDWORD
#define LOWORD(l)
Definition: pedump.c:82
#define DIDFT_RELAXIS
Definition: dinput.h:751

Referenced by SysMouseAImpl_GetProperty().

◆ SysMouseWImpl_SetActionMap()

static HRESULT WINAPI SysMouseWImpl_SetActionMap ( LPDIRECTINPUTDEVICE8W  iface,
LPDIACTIONFORMATW  lpdiaf,
LPCWSTR  lpszUserName,
DWORD  dwFlags 
)
static

Definition at line 831 of file mouse.c.

835 {
837  FIXME("(%p)->(%p,%s,%08x): semi-stub !\n", This, lpdiaf, debugstr_w(lpszUserName), dwFlags);
838 
839  return _set_action_map(iface, lpdiaf, lpszUserName, dwFlags, &c_dfDIMouse2);
840 }
HRESULT _set_action_map(LPDIRECTINPUTDEVICE8W iface, LPDIACTIONFORMATW lpdiaf, LPCWSTR lpszUserName, DWORD dwFlags, LPCDIDATAFORMAT df)
Definition: device.c:866
const DIDATAFORMAT c_dfDIMouse2
Definition: data_formats.c:293
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:111
static SysMouseImpl * impl_from_IDirectInputDevice8W(IDirectInputDevice8W *iface)
Definition: mouse.c:85
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175

Referenced by SysMouseAImpl_SetActionMap().

◆ SysMouseWImpl_Unacquire()

static HRESULT WINAPI SysMouseWImpl_Unacquire ( LPDIRECTINPUTDEVICE8W  iface)
static

Definition at line 513 of file mouse.c.

514 {
516  HRESULT res;
517 
518  TRACE("(this=%p)\n",This);
519 
520  if ((res = IDirectInputDevice2WImpl_Unacquire(iface)) != DI_OK) return res;
521 
522  if (This->base.dwCoopLevel & DISCL_EXCLUSIVE)
523  {
524  ClipCursor(NULL);
525  ShowCursor(TRUE); /* show cursor */
526  This->clipped = FALSE;
527  }
528 
529  /* And put the mouse cursor back where it was at acquire time */
530  if (This->base.dwCoopLevel & DISCL_EXCLUSIVE || This->warp_override == WARP_FORCE_ON)
531  {
532  TRACE("warping mouse back to %s\n", wine_dbgstr_point(&This->org_coords));
533  SetCursorPos(This->org_coords.x, This->org_coords.y);
534  }
535 
536  return DI_OK;
537 }
BOOL WINAPI ClipCursor(_In_opt_ LPCRECT)
#define TRUE
Definition: types.h:120
void ShowCursor(void)
Definition: hardware.c:556
#define FALSE
Definition: types.h:117
smooth NULL
Definition: ftsmooth.c:416
static SysMouseImpl * impl_from_IDirectInputDevice8W(IDirectInputDevice8W *iface)
Definition: mouse.c:85
const char * wine_dbgstr_point(const POINT *guid)
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:79
BOOL WINAPI SetCursorPos(_In_ int, _In_ int)
Definition: cursoricon.c:2627
GLuint res
Definition: glext.h:9613
#define DI_OK
Definition: dinput.h:128
HRESULT WINAPI IDirectInputDevice2WImpl_Unacquire(LPDIRECTINPUTDEVICE8W iface)
Definition: device.c:1108
#define DISCL_EXCLUSIVE
Definition: dinput.h:963

Referenced by SysMouseAImpl_Unacquire().

◆ warp_check()

static void warp_check ( SysMouseImpl This,
BOOL  force 
)
static

Definition at line 419 of file mouse.c.

420 {
422  const DWORD interval = This->clipped ? 500 : 10;
423 
424  if (force || (This->need_warp && (now - This->last_warped > interval)))
425  {
426  RECT rect, new_rect;
427  POINT mapped_center;
428 
429  This->last_warped = now;
430  This->need_warp = FALSE;
431  if (!GetClientRect(This->base.win, &rect)) return;
432  MapWindowPoints( This->base.win, 0, (POINT *)&rect, 2 );
433  if (!This->clipped)
434  {
435  mapped_center.x = (rect.left + rect.right) / 2;
436  mapped_center.y = (rect.top + rect.bottom) / 2;
437  TRACE("Warping mouse to %d - %d\n", mapped_center.x, mapped_center.y);
438  SetCursorPos( mapped_center.x, mapped_center.y );
439  }
440  if (This->base.dwCoopLevel & DISCL_EXCLUSIVE)
441  {
442  /* make sure we clip even if the window covers the whole screen */
443  rect.left = max( rect.left, GetSystemMetrics( SM_XVIRTUALSCREEN ) + 1 );
444  rect.top = max( rect.top, GetSystemMetrics( SM_YVIRTUALSCREEN ) + 1 );
445  rect.right = min( rect.right, rect.left + GetSystemMetrics( SM_CXVIRTUALSCREEN ) - 2 );
446  rect.bottom = min( rect.bottom, rect.top + GetSystemMetrics( SM_CYVIRTUALSCREEN ) - 2 );
447  TRACE("Clipping mouse to %s\n", wine_dbgstr_rect( &rect ));
448  ClipCursor( &rect );
449  This->clipped = GetClipCursor( &new_rect ) && EqualRect( &rect, &new_rect );
450  }
451  }
452 }
#define max(a, b)
Definition: svc.c:63
long y
Definition: polytest.cpp:48
#define SM_XVIRTUALSCREEN
Definition: winuser.h:1026
int WINAPI MapWindowPoints(_In_opt_ HWND hWndFrom, _In_opt_ HWND hWndTo, _Inout_updates_(cPoints) LPPOINT lpPoints, _In_ UINT cPoints)
BOOL WINAPI ClipCursor(_In_opt_ LPCRECT)
long x
Definition: polytest.cpp:48
#define SM_CXVIRTUALSCREEN
Definition: winuser.h:1028
& rect
Definition: startmenu.cpp:1413
BOOL WINAPI GetClipCursor(_Out_ LPRECT)
#define GetCurrentTime
Definition: winbase.h:2062
#define FALSE
Definition: types.h:117
time_t now
Definition: finger.c:65
#define SM_CYVIRTUALSCREEN
Definition: winuser.h:1029
#define TRACE(s)
Definition: solgame.cpp:4
const char * wine_dbgstr_rect(const RECT *rect)
BOOL WINAPI SetCursorPos(_In_ int, _In_ int)
Definition: cursoricon.c:2627
int WINAPI GetSystemMetrics(_In_ int)
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SM_YVIRTUALSCREEN
Definition: winuser.h:1027
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
BOOL WINAPI EqualRect(_In_ LPCRECT, _In_ LPCRECT)
#define min(a, b)
Definition: monoChain.cc:55
#define DISCL_EXCLUSIVE
Definition: dinput.h:963

Referenced by SysMouseWImpl_Acquire(), SysMouseWImpl_GetDeviceData(), and SysMouseWImpl_GetDeviceState().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( dinput  )

Variable Documentation

◆ mouse_device

const struct dinput_device mouse_device
Initial value:
= {
"Wine mouse driver",
}
static HRESULT mousedev_create_device(IDirectInputImpl *dinput, REFGUID rguid, REFIID riid, LPVOID *pdev, int unicode)
Definition: mouse.c:258
static HRESULT mousedev_enum_deviceW(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEW lpddi, DWORD version, int id)
Definition: mouse.c:177
static HRESULT mousedev_enum_deviceA(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEA lpddi, DWORD version, int id)
Definition: mouse.c:156

Definition at line 305 of file mouse.c.

◆ SysMouseAvt

static const IDirectInputDevice8AVtbl SysMouseAvt
static

Definition at line 50 of file mouse.c.

Referenced by alloc_device().

◆ SysMouseWvt

static const IDirectInputDevice8WVtbl SysMouseWvt
static

Definition at line 51 of file mouse.c.

Referenced by alloc_device().