ReactOS  0.4.13-dev-464-g6b95727
mouse.c
Go to the documentation of this file.
1 /* DirectInput Mouse device
2  *
3  * Copyright 1998 Marcus Meissner
4  * Copyright 1998,1999 Lionel Ulmer
5  * Copyright 2000-2001 TransGaming Technologies Inc.
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20  */
21 
22 #include "config.h"
23 #include "wine/port.h"
24 
25 #include <stdarg.h>
26 #include <string.h>
27 
28 #include "windef.h"
29 #include "winbase.h"
30 #include "wingdi.h"
31 #include "winuser.h"
32 #include "winerror.h"
33 #include "winreg.h"
34 #include "dinput.h"
35 
36 #include "dinput_private.h"
37 #include "device_private.h"
38 #include "wine/debug.h"
39 #include "wine/unicode.h"
40 
42 
43 /* Wine mouse driver object instances */
44 #define WINE_MOUSE_X_AXIS_INSTANCE 0
45 #define WINE_MOUSE_Y_AXIS_INSTANCE 1
46 #define WINE_MOUSE_Z_AXIS_INSTANCE 2
47 #define WINE_MOUSE_BUTTONS_INSTANCE 3
48 
49 static const IDirectInputDevice8AVtbl SysMouseAvt;
50 static const IDirectInputDevice8WVtbl SysMouseWvt;
51 
52 typedef struct SysMouseImpl SysMouseImpl;
53 
54 typedef enum
55 {
59 } WARP_MOUSE;
60 
62 {
64 
65  /* SysMouseAImpl */
66  /* These are used in case of relative -> absolute transitions */
69  /* warping: whether we need to move mouse back to middle once we
70  * reach window borders (for e.g. shooters, "surface movement" games) */
73 
74  /* This is for mouse reporting. */
76 
78 };
79 
80 static inline SysMouseImpl *impl_from_IDirectInputDevice8A(IDirectInputDevice8A *iface)
81 {
83 }
84 static inline SysMouseImpl *impl_from_IDirectInputDevice8W(IDirectInputDevice8W *iface)
85 {
87 }
88 
89 static inline IDirectInputDevice8W *IDirectInputDevice8W_from_impl(SysMouseImpl *This)
90 {
91  return &This->base.IDirectInputDevice8W_iface;
92 }
93 
95 
96 static void _dump_mouse_state(const DIMOUSESTATE2 *m_state)
97 {
98  int i;
99 
100  if (!TRACE_ON(dinput)) return;
101 
102  TRACE("(X: %d Y: %d Z: %d", m_state->lX, m_state->lY, m_state->lZ);
103  for (i = 0; i < 5; i++) TRACE(" B%d: %02x", i, m_state->rgbButtons[i]);
104  TRACE(")\n");
105 }
106 
108  DWORD dwSize;
109  DIDEVICEINSTANCEA ddi;
110 
111  dwSize = lpddi->dwSize;
112 
113  TRACE("%d %p\n", dwSize, lpddi);
114 
115  memset(lpddi, 0, dwSize);
116  memset(&ddi, 0, sizeof(ddi));
117 
118  ddi.dwSize = dwSize;
119  ddi.guidInstance = GUID_SysMouse;/* DInput's GUID */
120  ddi.guidProduct = GUID_SysMouse;
121  if (version >= 0x0800)
123  else
125  strcpy(ddi.tszInstanceName, "Mouse");
126  strcpy(ddi.tszProductName, "Wine Mouse");
127 
128  memcpy(lpddi, &ddi, (dwSize < sizeof(ddi) ? dwSize : sizeof(ddi)));
129 }
130 
132  DWORD dwSize;
133  DIDEVICEINSTANCEW ddi;
134 
135  dwSize = lpddi->dwSize;
136 
137  TRACE("%d %p\n", dwSize, lpddi);
138 
139  memset(lpddi, 0, dwSize);
140  memset(&ddi, 0, sizeof(ddi));
141 
142  ddi.dwSize = dwSize;
143  ddi.guidInstance = GUID_SysMouse;/* DInput's GUID */
144  ddi.guidProduct = GUID_SysMouse;
145  if (version >= 0x0800)
147  else
149  MultiByteToWideChar(CP_ACP, 0, "Mouse", -1, ddi.tszInstanceName, MAX_PATH);
150  MultiByteToWideChar(CP_ACP, 0, "Wine Mouse", -1, ddi.tszProductName, MAX_PATH);
151 
152  memcpy(lpddi, &ddi, (dwSize < sizeof(ddi) ? dwSize : sizeof(ddi)));
153 }
154 
156 {
157  if (id != 0)
158  return E_FAIL;
159 
160  if ((dwDevType == 0) ||
161  ((dwDevType == DIDEVTYPE_MOUSE) && (version < 0x0800)) ||
162  (((dwDevType == DI8DEVCLASS_POINTER) || (dwDevType == DI8DEVTYPE_MOUSE)) && (version >= 0x0800))) {
163  TRACE("Enumerating the mouse device\n");
164 
166 
167  return S_OK;
168  }
169 
170  return S_FALSE;
171 }
172 
174 {
175  if (id != 0)
176  return E_FAIL;
177 
178  if ((dwDevType == 0) ||
179  ((dwDevType == DIDEVTYPE_MOUSE) && (version < 0x0800)) ||
180  (((dwDevType == DI8DEVCLASS_POINTER) || (dwDevType == DI8DEVTYPE_MOUSE)) && (version >= 0x0800))) {
181  TRACE("Enumerating the mouse device\n");
182 
184 
185  return S_OK;
186  }
187 
188  return S_FALSE;
189 }
190 
192 {
193  SysMouseImpl* newDevice;
194  LPDIDATAFORMAT df = NULL;
195  unsigned i;
196  char buffer[20];
197  HKEY hkey, appkey;
198 
199  newDevice = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(SysMouseImpl));
200  if (!newDevice) return NULL;
201  newDevice->base.IDirectInputDevice8A_iface.lpVtbl = &SysMouseAvt;
202  newDevice->base.IDirectInputDevice8W_iface.lpVtbl = &SysMouseWvt;
203  newDevice->base.ref = 1;
204  newDevice->base.dwCoopLevel = DISCL_NONEXCLUSIVE | DISCL_BACKGROUND;
205  newDevice->base.guid = *rguid;
206  InitializeCriticalSection(&newDevice->base.crit);
207  newDevice->base.crit.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": SysMouseImpl*->base.crit");
208  newDevice->base.dinput = dinput;
209  newDevice->base.event_proc = dinput_mouse_hook;
210 
211  get_app_key(&hkey, &appkey);
212  if (!get_config_key(hkey, appkey, "MouseWarpOverride", buffer, sizeof(buffer)))
213  {
214  if (!strcasecmp(buffer, "disable"))
215  newDevice->warp_override = WARP_DISABLE;
216  else if (!strcasecmp(buffer, "force"))
217  newDevice->warp_override = WARP_FORCE_ON;
218  }
219  if (appkey) RegCloseKey(appkey);
220  if (hkey) RegCloseKey(hkey);
221 
222  /* Create copy of default data format */
223  if (!(df = HeapAlloc(GetProcessHeap(), 0, c_dfDIMouse2.dwSize))) goto failed;
225  if (!(df->rgodf = HeapAlloc(GetProcessHeap(), 0, df->dwNumObjs * df->dwObjSize))) goto failed;
227 
228  /* Because we don't do any detection yet just modify instance and type */
229  for (i = 0; i < df->dwNumObjs; i++)
230  if (DIDFT_GETTYPE(df->rgodf[i].dwType) & DIDFT_AXIS)
232  else
234 
235  newDevice->base.data_format.wine_df = df;
236  IDirectInput_AddRef(&newDevice->base.dinput->IDirectInput7A_iface);
237 
239  list_add_tail(&dinput->devices_list, &newDevice->base.entry);
241 
242  return newDevice;
243 
244 failed:
245  if (df) HeapFree(GetProcessHeap(), 0, df->rgodf);
246  HeapFree(GetProcessHeap(), 0, df);
247  HeapFree(GetProcessHeap(), 0, newDevice);
248  return NULL;
249 }
250 
252 {
253  TRACE("%p %s %s %p %i\n", dinput, debugstr_guid(rguid), debugstr_guid(riid), pdev, unicode);
254  *pdev = NULL;
255 
256  if (IsEqualGUID(&GUID_SysMouse, rguid)) /* Wine Mouse */
257  {
259 
260  if (riid == NULL)
261  ;/* nothing */
262  else if (IsEqualGUID(&IID_IDirectInputDeviceA, riid) ||
263  IsEqualGUID(&IID_IDirectInputDevice2A, riid) ||
264  IsEqualGUID(&IID_IDirectInputDevice7A, riid) ||
265  IsEqualGUID(&IID_IDirectInputDevice8A, riid))
266  {
267  unicode = 0;
268  }
269  else if (IsEqualGUID(&IID_IDirectInputDeviceW, riid) ||
270  IsEqualGUID(&IID_IDirectInputDevice2W, riid) ||
271  IsEqualGUID(&IID_IDirectInputDevice7W, riid) ||
272  IsEqualGUID(&IID_IDirectInputDevice8W, riid))
273  {
274  unicode = 1;
275  }
276  else
277  {
278  WARN("no interface\n");
279  return DIERR_NOINTERFACE;
280  }
281 
282  This = alloc_device(rguid, dinput);
283  TRACE("Created a Mouse device (%p)\n", This);
284 
285  if (!This) return DIERR_OUTOFMEMORY;
286 
287  if (unicode)
288  *pdev = &This->base.IDirectInputDevice8W_iface;
289  else
290  *pdev = &This->base.IDirectInputDevice8A_iface;
291 
292  return DI_OK;
293  }
294 
295  return DIERR_DEVICENOTREG;
296 }
297 
298 const struct dinput_device mouse_device = {
299  "Wine mouse driver",
303 };
304 
305 /******************************************************************************
306  * SysMouseA (DInput Mouse support)
307  */
308 
309 /* low-level mouse hook */
311 {
314  int wdata = 0, inst_id = -1, ret = 0;
315 
316  TRACE("msg %lx @ (%d %d)\n", wparam, hook->pt.x, hook->pt.y);
317 
318  EnterCriticalSection(&This->base.crit);
319 
320  switch(wparam) {
321  case WM_MOUSEMOVE:
322  {
323  POINT pt, pt1;
324 
325  GetCursorPos(&pt);
326  This->m_state.lX += pt.x = hook->pt.x - pt.x;
327  This->m_state.lY += pt.y = hook->pt.y - pt.y;
328 
329  if (This->base.data_format.user_df->dwFlags & DIDF_ABSAXIS)
330  {
331  pt1.x = This->m_state.lX;
332  pt1.y = This->m_state.lY;
333  } else
334  pt1 = pt;
335 
336  if (pt.x)
337  {
339  wdata = pt1.x;
340  }
341  if (pt.y)
342  {
343  /* Already have X, need to queue it */
344  if (inst_id != -1)
345  queue_event(iface, inst_id,
346  wdata, GetCurrentTime(), This->base.dinput->evsequence);
348  wdata = pt1.y;
349  }
350 
351  if (pt.x || pt.y)
352  {
353  if ((This->warp_override == WARP_FORCE_ON) ||
354  (This->warp_override != WARP_DISABLE && (This->base.dwCoopLevel & DISCL_EXCLUSIVE)))
355  This->need_warp = TRUE;
356  }
357  break;
358  }
359  case WM_MOUSEWHEEL:
361  This->m_state.lZ += wdata = (short)HIWORD(hook->mouseData);
362  /* FarCry crashes if it gets a mouse wheel message */
363  /* FIXME: should probably filter out other messages too */
364  ret = This->clipped;
365  break;
366  case WM_LBUTTONDOWN:
368  This->m_state.rgbButtons[0] = wdata = 0x80;
369  break;
370  case WM_LBUTTONUP:
372  This->m_state.rgbButtons[0] = wdata = 0x00;
373  break;
374  case WM_RBUTTONDOWN:
376  This->m_state.rgbButtons[1] = wdata = 0x80;
377  break;
378  case WM_RBUTTONUP:
380  This->m_state.rgbButtons[1] = wdata = 0x00;
381  break;
382  case WM_MBUTTONDOWN:
384  This->m_state.rgbButtons[2] = wdata = 0x80;
385  break;
386  case WM_MBUTTONUP:
388  This->m_state.rgbButtons[2] = wdata = 0x00;
389  break;
390  case WM_XBUTTONDOWN:
392  This->m_state.rgbButtons[2 + HIWORD(hook->mouseData)] = wdata = 0x80;
393  break;
394  case WM_XBUTTONUP:
396  This->m_state.rgbButtons[2 + HIWORD(hook->mouseData)] = wdata = 0x00;
397  break;
398  }
399 
400 
401  if (inst_id != -1)
402  {
403  _dump_mouse_state(&This->m_state);
404  queue_event(iface, inst_id,
405  wdata, GetCurrentTime(), This->base.dinput->evsequence++);
406  }
407 
408  LeaveCriticalSection(&This->base.crit);
409  return ret;
410 }
411 
412 static void warp_check( SysMouseImpl* This, BOOL force )
413 {
415  const DWORD interval = This->clipped ? 500 : 10;
416 
417  if (force || (This->need_warp && (now - This->last_warped > interval)))
418  {
419  RECT rect, new_rect;
420  POINT mapped_center;
421 
422  This->last_warped = now;
423  This->need_warp = FALSE;
424  if (!GetClientRect(This->base.win, &rect)) return;
425  MapWindowPoints( This->base.win, 0, (POINT *)&rect, 2 );
426  if (!This->clipped)
427  {
428  mapped_center.x = (rect.left + rect.right) / 2;
429  mapped_center.y = (rect.top + rect.bottom) / 2;
430  TRACE("Warping mouse to %d - %d\n", mapped_center.x, mapped_center.y);
431  SetCursorPos( mapped_center.x, mapped_center.y );
432  }
433  if (This->base.dwCoopLevel & DISCL_EXCLUSIVE)
434  {
435  /* make sure we clip even if the window covers the whole screen */
436  rect.left = max( rect.left, GetSystemMetrics( SM_XVIRTUALSCREEN ) + 1 );
437  rect.top = max( rect.top, GetSystemMetrics( SM_YVIRTUALSCREEN ) + 1 );
438  rect.right = min( rect.right, rect.left + GetSystemMetrics( SM_CXVIRTUALSCREEN ) - 2 );
439  rect.bottom = min( rect.bottom, rect.top + GetSystemMetrics( SM_CYVIRTUALSCREEN ) - 2 );
440  TRACE("Clipping mouse to %s\n", wine_dbgstr_rect( &rect ));
441  ClipCursor( &rect );
442  This->clipped = GetClipCursor( &new_rect ) && EqualRect( &rect, &new_rect );
443  }
444  }
445 }
446 
447 
448 /******************************************************************************
449  * Acquire : gets exclusive control of the mouse
450  */
452 {
454  POINT point;
455  HRESULT res;
456 
457  TRACE("(this=%p)\n",This);
458 
459  if ((res = IDirectInputDevice2WImpl_Acquire(iface)) != DI_OK) return res;
460 
461  /* Init the mouse state */
462  GetCursorPos( &point );
463  if (This->base.data_format.user_df->dwFlags & DIDF_ABSAXIS)
464  {
465  This->m_state.lX = point.x;
466  This->m_state.lY = point.y;
467  } else {
468  This->m_state.lX = 0;
469  This->m_state.lY = 0;
470  This->org_coords = point;
471  }
472  This->m_state.lZ = 0;
473  This->m_state.rgbButtons[0] = GetKeyState(VK_LBUTTON) & 0x80;
474  This->m_state.rgbButtons[1] = GetKeyState(VK_RBUTTON) & 0x80;
475  This->m_state.rgbButtons[2] = GetKeyState(VK_MBUTTON) & 0x80;
476 
477  if (This->base.dwCoopLevel & DISCL_EXCLUSIVE)
478  {
479  ShowCursor(FALSE); /* hide cursor */
480  warp_check( This, TRUE );
481  }
482  else if (This->warp_override == WARP_FORCE_ON)
483  {
484  /* Need a window to warp mouse in. */
485  if (!This->base.win) This->base.win = GetDesktopWindow();
486  warp_check( This, TRUE );
487  }
488  else if (This->clipped)
489  {
490  ClipCursor( NULL );
491  This->clipped = FALSE;
492  }
493 
494  return DI_OK;
495 }
496 
498 {
501 }
502 
503 /******************************************************************************
504  * Unacquire : frees the mouse
505  */
507 {
509  HRESULT res;
510 
511  TRACE("(this=%p)\n",This);
512 
513  if ((res = IDirectInputDevice2WImpl_Unacquire(iface)) != DI_OK) return res;
514 
515  if (This->base.dwCoopLevel & DISCL_EXCLUSIVE)
516  {
517  ClipCursor(NULL);
518  ShowCursor(TRUE); /* show cursor */
519  This->clipped = FALSE;
520  }
521 
522  /* And put the mouse cursor back where it was at acquire time */
523  if (This->base.dwCoopLevel & DISCL_EXCLUSIVE || This->warp_override == WARP_FORCE_ON)
524  {
525  TRACE("warping mouse back to %s\n", wine_dbgstr_point(&This->org_coords));
526  SetCursorPos(This->org_coords.x, This->org_coords.y);
527  }
528 
529  return DI_OK;
530 }
531 
533 {
536 }
537 
538 /******************************************************************************
539  * GetDeviceState : returns the "state" of the mouse.
540  *
541  * For the moment, only the "standard" return structure (DIMOUSESTATE) is
542  * supported.
543  */
545 {
547  TRACE("(%p)->(%u,%p)\n", This, len, ptr);
548 
549  if(This->base.acquired == 0) return DIERR_NOTACQUIRED;
550 
552 
553  EnterCriticalSection(&This->base.crit);
554  _dump_mouse_state(&This->m_state);
555 
556  /* Copy the current mouse state */
557  fill_DataFormat(ptr, len, &This->m_state, &This->base.data_format);
558 
559  /* Initialize the buffer when in relative mode */
560  if (!(This->base.data_format.user_df->dwFlags & DIDF_ABSAXIS))
561  {
562  This->m_state.lX = 0;
563  This->m_state.lY = 0;
564  This->m_state.lZ = 0;
565  }
566  LeaveCriticalSection(&This->base.crit);
567 
568  warp_check( This, FALSE );
569  return DI_OK;
570 }
571 
573 {
576 }
577 
578 /******************************************************************************
579  * GetDeviceData : gets buffered input data.
580  */
582  DWORD dodsize, LPDIDEVICEOBJECTDATA dod, LPDWORD entries, DWORD flags)
583 {
585  HRESULT res;
586 
587  res = IDirectInputDevice2WImpl_GetDeviceData(iface, dodsize, dod, entries, flags);
588  if (SUCCEEDED(res)) warp_check( This, FALSE );
589  return res;
590 }
591 
593  DWORD dodsize, LPDIDEVICEOBJECTDATA dod, LPDWORD entries, DWORD flags)
594 {
596  return SysMouseWImpl_GetDeviceData(IDirectInputDevice8W_from_impl(This), dodsize, dod, entries, flags);
597 }
598 
599 /******************************************************************************
600  * GetProperty : get input device properties
601  */
603 {
605 
606  TRACE("(%p) %s,%p\n", This, debugstr_guid(rguid), pdiph);
607  _dump_DIPROPHEADER(pdiph);
608 
609  if (IS_DIPROP(rguid)) {
610  switch (LOWORD(rguid)) {
611  case (DWORD_PTR) DIPROP_GRANULARITY: {
612  LPDIPROPDWORD pr = (LPDIPROPDWORD) pdiph;
613 
614  if (
615  ((pdiph->dwHow == DIPH_BYOFFSET) &&
616  ((pdiph->dwObj == DIMOFS_X) ||
617  (pdiph->dwObj == DIMOFS_Y)))
618  ||
619  ((pdiph->dwHow == DIPH_BYID) &&
622  ){
623  /* Set granularity of X/Y Axis to 1. See MSDN on DIPROP_GRANULARITY */
624  pr->dwData = 1;
625  } else {
626  /* We'll just assume that the app asks about the Z axis */
627  pr->dwData = WHEEL_DELTA;
628  }
629 
630  break;
631  }
632 
633  case (DWORD_PTR) DIPROP_RANGE: {
634  LPDIPROPRANGE pr = (LPDIPROPRANGE) pdiph;
635 
636  if ((pdiph->dwHow == DIPH_BYID) &&
639  /* Querying the range of either the X or the Y axis. As I do
640  not know the range, do as if the range were
641  unrestricted...*/
642  pr->lMin = DIPROPRANGE_NOMIN;
643  pr->lMax = DIPROPRANGE_NOMAX;
644  }
645 
646  break;
647  }
648 
649  default:
650  return IDirectInputDevice2WImpl_GetProperty(iface, rguid, pdiph);
651  }
652  }
653 
654  return DI_OK;
655 }
656 
658 {
661 }
662 
663 /******************************************************************************
664  * GetCapabilities : get the device capabilities
665  */
667 {
669  DIDEVCAPS devcaps;
670 
671  TRACE("(this=%p,%p)\n",This,lpDIDevCaps);
672 
673  if ((lpDIDevCaps->dwSize != sizeof(DIDEVCAPS)) && (lpDIDevCaps->dwSize != sizeof(DIDEVCAPS_DX3))) {
674  WARN("invalid parameter\n");
675  return DIERR_INVALIDPARAM;
676  }
677 
678  devcaps.dwSize = lpDIDevCaps->dwSize;
679  devcaps.dwFlags = DIDC_ATTACHED | DIDC_EMULATED;
680  if (This->base.dinput->dwVersion >= 0x0800)
682  else
684  devcaps.dwAxes = 3;
685  devcaps.dwButtons = 8;
686  devcaps.dwPOVs = 0;
687  devcaps.dwFFSamplePeriod = 0;
688  devcaps.dwFFMinTimeResolution = 0;
689  devcaps.dwFirmwareRevision = 100;
690  devcaps.dwHardwareRevision = 100;
691  devcaps.dwFFDriverVersion = 0;
692 
693  memcpy(lpDIDevCaps, &devcaps, lpDIDevCaps->dwSize);
694 
695  return DI_OK;
696 }
697 
699 {
702 }
703 
704 /******************************************************************************
705  * GetObjectInfo : get information about a device object such as a button
706  * or axis
707  */
709  LPDIDEVICEOBJECTINSTANCEW pdidoi, DWORD dwObj, DWORD dwHow)
710 {
711  static const WCHAR x_axisW[] = {'X','-','A','x','i','s',0};
712  static const WCHAR y_axisW[] = {'Y','-','A','x','i','s',0};
713  static const WCHAR wheelW[] = {'W','h','e','e','l',0};
714  static const WCHAR buttonW[] = {'B','u','t','t','o','n',' ','%','d',0};
715  HRESULT res;
716 
717  res = IDirectInputDevice2WImpl_GetObjectInfo(iface, pdidoi, dwObj, dwHow);
718  if (res != DI_OK) return res;
719 
720  if (IsEqualGUID(&pdidoi->guidType, &GUID_XAxis)) strcpyW(pdidoi->tszName, x_axisW);
721  else if (IsEqualGUID(&pdidoi->guidType, &GUID_YAxis)) strcpyW(pdidoi->tszName, y_axisW);
722  else if (IsEqualGUID(&pdidoi->guidType, &GUID_ZAxis)) strcpyW(pdidoi->tszName, wheelW);
723  else if (pdidoi->dwType & DIDFT_BUTTON)
724  wsprintfW(pdidoi->tszName, buttonW, DIDFT_GETINSTANCE(pdidoi->dwType) - 3);
725 
726  _dump_OBJECTINSTANCEW(pdidoi);
727  return res;
728 }
729 
731  LPDIDEVICEOBJECTINSTANCEA pdidoi, DWORD dwObj, DWORD dwHow)
732 {
734  HRESULT res;
736  DWORD dwSize = pdidoi->dwSize;
737 
738  didoiW.dwSize = sizeof(didoiW);
740  if (res != DI_OK) return res;
741 
742  memset(pdidoi, 0, pdidoi->dwSize);
743  memcpy(pdidoi, &didoiW, FIELD_OFFSET(DIDEVICEOBJECTINSTANCEW, tszName));
744  pdidoi->dwSize = dwSize;
745  WideCharToMultiByte(CP_ACP, 0, didoiW.tszName, -1, pdidoi->tszName,
746  sizeof(pdidoi->tszName), NULL, NULL);
747 
748  return res;
749 }
750 
751 /******************************************************************************
752  * GetDeviceInfo : get information about a device's identity
753  */
755  LPDIRECTINPUTDEVICE8A iface,
756  LPDIDEVICEINSTANCEA pdidi)
757 {
759  TRACE("(this=%p,%p)\n", This, pdidi);
760 
761  if (pdidi->dwSize != sizeof(DIDEVICEINSTANCEA)) {
762  WARN(" dinput3 not supported yet...\n");
763  return DI_OK;
764  }
765 
766  fill_mouse_dideviceinstanceA(pdidi, This->base.dinput->dwVersion);
767 
768  return DI_OK;
769 }
770 
772 {
774  TRACE("(this=%p,%p)\n", This, pdidi);
775 
776  if (pdidi->dwSize != sizeof(DIDEVICEINSTANCEW)) {
777  WARN(" dinput3 not supported yet...\n");
778  return DI_OK;
779  }
780 
781  fill_mouse_dideviceinstanceW(pdidi, This->base.dinput->dwVersion);
782 
783  return DI_OK;
784 }
785 
787  LPDIACTIONFORMATW lpdiaf,
788  LPCWSTR lpszUserName,
789  DWORD dwFlags)
790 {
791  FIXME("(%p)->(%p,%s,%08x): semi-stub !\n", iface, lpdiaf, debugstr_w(lpszUserName), dwFlags);
792 
793  return _build_action_map(iface, lpdiaf, lpszUserName, dwFlags, DIMOUSE_MASK, &c_dfDIMouse2);
794 }
795 
797  LPDIACTIONFORMATA lpdiaf,
798  LPCSTR lpszUserName,
799  DWORD dwFlags)
800 {
802  DIACTIONFORMATW diafW;
803  HRESULT hr;
804  WCHAR *lpszUserNameW = NULL;
805  int username_size;
806 
807  diafW.rgoAction = HeapAlloc(GetProcessHeap(), 0, sizeof(DIACTIONW)*lpdiaf->dwNumActions);
808  _copy_diactionformatAtoW(&diafW, lpdiaf);
809 
810  if (lpszUserName != NULL)
811  {
812  username_size = MultiByteToWideChar(CP_ACP, 0, lpszUserName, -1, NULL, 0);
813  lpszUserNameW = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR)*username_size);
814  MultiByteToWideChar(CP_ACP, 0, lpszUserName, -1, lpszUserNameW, username_size);
815  }
816 
817  hr = SysMouseWImpl_BuildActionMap(&This->base.IDirectInputDevice8W_iface, &diafW, lpszUserNameW, dwFlags);
818 
819  _copy_diactionformatWtoA(lpdiaf, &diafW);
820  HeapFree(GetProcessHeap(), 0, diafW.rgoAction);
821  HeapFree(GetProcessHeap(), 0, lpszUserNameW);
822 
823  return hr;
824 }
825 
827  LPDIACTIONFORMATW lpdiaf,
828  LPCWSTR lpszUserName,
829  DWORD dwFlags)
830 {
831  FIXME("(%p)->(%p,%s,%08x): semi-stub !\n", iface, lpdiaf, debugstr_w(lpszUserName), dwFlags);
832 
833  return _set_action_map(iface, lpdiaf, lpszUserName, dwFlags, &c_dfDIMouse2);
834 }
835 
837  LPDIACTIONFORMATA lpdiaf,
838  LPCSTR lpszUserName,
839  DWORD dwFlags)
840 {
842  DIACTIONFORMATW diafW;
843  HRESULT hr;
844  WCHAR *lpszUserNameW = NULL;
845  int username_size;
846 
847  diafW.rgoAction = HeapAlloc(GetProcessHeap(), 0, sizeof(DIACTIONW)*lpdiaf->dwNumActions);
848  _copy_diactionformatAtoW(&diafW, lpdiaf);
849 
850  if (lpszUserName != NULL)
851  {
852  username_size = MultiByteToWideChar(CP_ACP, 0, lpszUserName, -1, NULL, 0);
853  lpszUserNameW = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR)*username_size);
854  MultiByteToWideChar(CP_ACP, 0, lpszUserName, -1, lpszUserNameW, username_size);
855  }
856 
857  hr = SysMouseWImpl_SetActionMap(&This->base.IDirectInputDevice8W_iface, &diafW, lpszUserNameW, dwFlags);
858 
859  HeapFree(GetProcessHeap(), 0, diafW.rgoAction);
860  HeapFree(GetProcessHeap(), 0, lpszUserNameW);
861 
862  return hr;
863 }
864 
865 static const IDirectInputDevice8AVtbl SysMouseAvt =
866 {
899 };
900 
901 static const IDirectInputDevice8WVtbl SysMouseWvt =
902 {
935 };
#define WM_MBUTTONUP
Definition: winuser.h:1759
int WINAPIV wsprintfW(_Out_ LPWSTR, _In_ _Printf_format_string_ LPCWSTR,...)
HRESULT WINAPI IDirectInputDevice2AImpl_SetProperty(LPDIRECTINPUTDEVICE8A iface, REFGUID rguid, LPCDIPROPHEADER pdiph)
Definition: device.c:1442
HRESULT WINAPI IDirectInputDevice8WImpl_GetImageInfo(LPDIRECTINPUTDEVICE8W iface, LPDIDEVICEIMAGEINFOHEADERW lpdiDevImageInfoHeader)
Definition: device.c:1841
HRESULT WINAPI IDirectInputDevice2WImpl_EnumObjects(LPDIRECTINPUTDEVICE8W iface, LPDIENUMDEVICEOBJECTSCALLBACKW lpCallback, LPVOID lpvRef, DWORD dwFlags)
Definition: device.c:1257
HRESULT WINAPI IDirectInputDevice2WImpl_CreateEffect(LPDIRECTINPUTDEVICE8W iface, REFGUID rguid, LPCDIEFFECT lpeff, LPDIRECTINPUTEFFECT *ppdef, LPUNKNOWN pUnkOuter)
Definition: device.c:1628
GUID guidInstance
Definition: dinput.h:413
#define IDirectInput_AddRef(p)
Definition: dinput.h:2240
BOOL need_warp
Definition: mouse.c:71
void check_dinput_events(void)
Definition: dinput_main.c:1870
HRESULT WINAPI IDirectInputDevice2AImpl_Poll(LPDIRECTINPUTDEVICE8A iface)
Definition: device.c:1749
#define max(a, b)
Definition: svc.c:63
#define REFIID
Definition: guiddef.h:113
#define TRUE
Definition: types.h:120
HRESULT WINAPI IDirectInputDevice2AImpl_SendDeviceData(LPDIRECTINPUTDEVICE8A iface, DWORD cbObjectData, LPCDIDEVICEOBJECTDATA rgdod, LPDWORD pdwInOut, DWORD dwFlags)
Definition: device.c:1764
static void _dump_mouse_state(const DIMOUSESTATE2 *m_state)
Definition: mouse.c:96
DWORD dwFFMinTimeResolution
Definition: dinput.h:941
static HRESULT mousedev_create_device(IDirectInputImpl *dinput, REFGUID rguid, REFIID riid, LPVOID *pdev, int unicode)
Definition: mouse.c:251
static HRESULT WINAPI SysMouseWImpl_GetDeviceState(LPDIRECTINPUTDEVICE8W iface, DWORD len, LPVOID ptr)
Definition: mouse.c:544
DWORD dwDevType
Definition: dinput.h:428
#define DIDF_ABSAXIS
Definition: dinput.h:775
HRESULT WINAPI IDirectInputDevice2WImpl_SendForceFeedbackCommand(LPDIRECTINPUTDEVICE8W iface, DWORD dwFlags)
Definition: device.c:1701
long y
Definition: polytest.cpp:48
#define SM_XVIRTUALSCREEN
Definition: winuser.h:1026
#define DIDC_EMULATED
Definition: dinput.h:949
int WINAPI MapWindowPoints(_In_opt_ HWND hWndFrom, _In_opt_ HWND hWndTo, _Inout_updates_(cPoints) LPPOINT lpPoints, _In_ UINT cPoints)
#define WM_LBUTTONDOWN
Definition: winuser.h:1752
DWORD dwSize
Definition: dinput.h:808
#define DWORD_PTR
Definition: treelist.c:76
#define WideCharToMultiByte
Definition: compat.h:101
HRESULT hr
Definition: shlfolder.c:183
Definition: scsiwmi.h:51
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define strcasecmp
Definition: fake.h:9
static HRESULT WINAPI SysMouseAImpl_GetCapabilities(LPDIRECTINPUTDEVICE8A iface, LPDIDEVCAPS lpDIDevCaps)
Definition: mouse.c:698
HRESULT WINAPI IDirectInputDevice2WImpl_GetProperty(LPDIRECTINPUTDEVICE8W iface, REFGUID rguid, LPDIPROPHEADER pdiph)
Definition: device.c:1291
#define DIPH_BYID
Definition: dinput.h:837
BOOL WINAPI ClipCursor(_In_opt_ LPCRECT)
long x
Definition: polytest.cpp:48
#define SM_CXVIRTUALSCREEN
Definition: winuser.h:1028
HRESULT WINAPI IDirectInputDevice2AImpl_EnumObjects(LPDIRECTINPUTDEVICE8A iface, LPDIENUMDEVICEOBJECTSCALLBACKA lpCallback, LPVOID lpvRef, DWORD dwFlags)
Definition: device.c:1227
#define DIDFT_PSHBUTTON
Definition: dinput.h:754
static HRESULT WINAPI SysMouseWImpl_BuildActionMap(LPDIRECTINPUTDEVICE8W iface, LPDIACTIONFORMATW lpdiaf, LPCWSTR lpszUserName, DWORD dwFlags)
Definition: mouse.c:786
static const IDirectInputDevice8AVtbl SysMouseAvt
Definition: mouse.c:49
#define VK_LBUTTON
Definition: winuser.h:2144
static void warp_check(SysMouseImpl *This, BOOL force)
Definition: mouse.c:412
#define DIERR_NOTACQUIRED
Definition: dinput.h:167
#define pt(x, y)
Definition: drawing.c:79
REFIID riid
Definition: precomp.h:44
HRESULT _set_action_map(LPDIRECTINPUTDEVICE8W iface, LPDIACTIONFORMATW lpdiaf, LPCWSTR lpszUserName, DWORD dwFlags, LPCDIDATAFORMAT df)
Definition: device.c:824
const DIDATAFORMAT c_dfDIMouse2
Definition: data_formats.c:293
#define DIPROPRANGE_NOMIN
Definition: dinput.h:855
#define WM_MOUSEWHEEL
Definition: treelist.c:96
#define CP_ACP
Definition: compat.h:99
static HRESULT WINAPI SysMouseAImpl_SetActionMap(LPDIRECTINPUTDEVICE8A iface, LPDIACTIONFORMATA lpdiaf, LPCSTR lpszUserName, DWORD dwFlags)
Definition: mouse.c:836
static HRESULT mousedev_enum_deviceW(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEW lpddi, DWORD version, int id)
Definition: mouse.c:173
DWORD dwNumObjs
Definition: dinput.h:812
HRESULT WINAPI IDirectInputDevice2WImpl_Acquire(LPDIRECTINPUTDEVICE8W iface)
Definition: device.c:983
struct IDirectInputDeviceImpl base
Definition: mouse.c:63
static const WCHAR buttonW[]
Definition: htmlelem.c:24
void _dump_OBJECTINSTANCEW(const DIDEVICEOBJECTINSTANCEW *ddoi)
Definition: device.c:190
#define WARN(fmt,...)
Definition: debug.h:111
static void fill_mouse_dideviceinstanceA(LPDIDEVICEINSTANCEA lpddi, DWORD version)
Definition: mouse.c:107
#define DIDFT_MAKEINSTANCE(n)
Definition: dinput.h:762
IDirectInputDevice8A IDirectInputDevice8A_iface
static HRESULT WINAPI SysMouseWImpl_GetObjectInfo(LPDIRECTINPUTDEVICE8W iface, LPDIDEVICEOBJECTINSTANCEW pdidoi, DWORD dwObj, DWORD dwHow)
Definition: mouse.c:708
BYTE rgbButtons[8]
Definition: dinput.h:2125
#define DIDC_ATTACHED
Definition: dinput.h:947
DWORD dwNumActions
Definition: dinput.h:1313
DWORD dwObjSize
Definition: dinput.h:809
HRESULT WINAPI IDirectInputDevice2AImpl_RunControlPanel(LPDIRECTINPUTDEVICE8A iface, HWND hwndOwner, DWORD dwFlags)
Definition: device.c:1604
GLuint buffer
Definition: glext.h:5915
#define WINE_MOUSE_BUTTONS_INSTANCE
Definition: mouse.c:47
WCHAR tszName[MAX_PATH]
Definition: dinput.h:371
static HRESULT WINAPI SysMouseWImpl_GetDeviceInfo(LPDIRECTINPUTDEVICE8W iface, LPDIDEVICEINSTANCEW pdidi)
Definition: mouse.c:771
void ShowCursor(void)
Definition: hardware.c:556
struct list devices_list
UINT_PTR WPARAM
Definition: windef.h:207
#define DIPROP_RANGE
Definition: dinput.h:892
HRESULT WINAPI IDirectInputDevice2WImpl_Poll(LPDIRECTINPUTDEVICE8W iface)
Definition: device.c:1739
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
HRESULT WINAPI IDirectInputDevice7WImpl_WriteEffectToFile(LPDIRECTINPUTDEVICE8W iface, LPCWSTR lpszFileName, DWORD dwEntries, LPDIFILEEFFECT rgDiFileEft, DWORD dwFlags)
Definition: device.c:1806
DWORD dwHow
Definition: dinput.h:831
BOOL WINAPI GetCursorPos(_Out_ LPPOINT)
Definition: cursoricon.c:2635
#define E_FAIL
Definition: ddrawi.h:102
ULONG WINAPI IDirectInputDevice2WImpl_AddRef(LPDIRECTINPUTDEVICE8W iface)
Definition: device.c:1215
POINT org_coords
Definition: mouse.c:67
POINTL point
Definition: edittest.c:50
& rect
Definition: startmenu.cpp:1413
#define DIDFT_GETINSTANCE(n)
Definition: dinput.h:764
DWORD dwDevType
Definition: dinput.h:936
LONG y
Definition: windef.h:315
#define DISCL_NONEXCLUSIVE
Definition: dinput.h:966
struct DIPROPRANGE * LPDIPROPRANGE
IDirectInputImpl * dinput
__WINE_SERVER_LIST_INLINE void list_add_tail(struct list *list, struct list *elem)
Definition: list.h:102
DIMOUSESTATE2 m_state
Definition: mouse.c:75
#define WHEEL_DELTA
Definition: treelist.c:99
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
Definition: typeof.h:93
BOOL WINAPI GetClipCursor(_Out_ LPRECT)
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 GetCurrentTime
Definition: winbase.h:2049
#define DIDEVTYPE_MOUSE
Definition: dinput.h:198
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
DWORD dwFFSamplePeriod
Definition: dinput.h:940
#define VK_RBUTTON
Definition: winuser.h:2145
unsigned int BOOL
Definition: ntddk_ex.h:94
#define DIDFT_BUTTON
Definition: dinput.h:756
HRESULT WINAPI IDirectInputDevice2WImpl_SendDeviceData(LPDIRECTINPUTDEVICE8W iface, DWORD cbObjectData, LPCDIDEVICEOBJECTDATA rgdod, LPDWORD pdwInOut, DWORD dwFlags)
Definition: device.c:1755
time_t now
Definition: finger.c:65
static UINT WPARAM LPARAM lparam
Definition: combo.c:716
#define debugstr_w
Definition: kernel32.h:32
#define DIPH_BYOFFSET
Definition: dinput.h:836
#define FIXME(fmt,...)
Definition: debug.h:110
DWORD dwDevType
Definition: dinput.h:415
static PVOID ptr
Definition: dispmode.c:27
static int dinput_mouse_hook(LPDIRECTINPUTDEVICE8A iface, WPARAM wparam, LPARAM lparam)
Definition: mouse.c:310
#define S_FALSE
Definition: winerror.h:2357
DWORD dwFlags
Definition: dinput.h:935
GUID guidProduct
Definition: dinput.h:414
static HRESULT WINAPI SysMouseWImpl_SetActionMap(LPDIRECTINPUTDEVICE8W iface, LPDIACTIONFORMATW lpdiaf, LPCWSTR lpszUserName, DWORD dwFlags)
Definition: mouse.c:826
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
Definition: synch.c:697
#define DIMOFS_X
Definition: dinput.h:2128
smooth NULL
Definition: ftsmooth.c:416
static const WCHAR version[]
Definition: asmname.c:64
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:622
DWORD dwAxes
Definition: dinput.h:937
LONG_PTR LPARAM
Definition: windef.h:208
HRESULT WINAPI IDirectInputDevice2AImpl_Escape(LPDIRECTINPUTDEVICE8A iface, LPDIEFFESCAPE lpDIEEsc)
Definition: device.c:1733
static SysMouseImpl * impl_from_IDirectInputDevice8W(IDirectInputDevice8W *iface)
Definition: mouse.c:84
DWORD dwPOVs
Definition: dinput.h:939
BOOL clipped
Definition: mouse.c:68
const char * LPCSTR
Definition: xmlstorage.h:183
static HRESULT WINAPI SysMouseWImpl_GetDeviceData(LPDIRECTINPUTDEVICE8W iface, DWORD dodsize, LPDIDEVICEOBJECTDATA dod, LPDWORD entries, DWORD flags)
Definition: mouse.c:581
#define DIDEVTYPEMOUSE_TRADITIONAL
Definition: dinput.h:223
#define debugstr_guid
Definition: kernel32.h:35
DWORD dwHardwareRevision
Definition: dinput.h:943
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
WARP_MOUSE warp_override
Definition: mouse.c:77
#define SM_CYVIRTUALSCREEN
Definition: winuser.h:1029
HRESULT WINAPI IDirectInputDevice2AImpl_EnumCreatedEffectObjects(LPDIRECTINPUTDEVICE8A iface, LPDIENUMCREATEDEFFECTOBJECTSCALLBACK lpCallback, LPVOID lpvRef, DWORD dwFlags)
Definition: device.c:1720
#define WM_RBUTTONDOWN
Definition: winuser.h:1755
SHORT WINAPI GetKeyState(_In_ int)
static HRESULT WINAPI SysMouseAImpl_GetDeviceInfo(LPDIRECTINPUTDEVICE8A iface, LPDIDEVICEINSTANCEA pdidi)
Definition: mouse.c:754
static HRESULT WINAPI SysMouseWImpl_GetCapabilities(LPDIRECTINPUTDEVICE8W iface, LPDIDEVCAPS lpDIDevCaps)
Definition: mouse.c:666
#define DI8DEVCLASS_POINTER
Definition: dinput.h:205
static HRESULT WINAPI SysMouseAImpl_Acquire(LPDIRECTINPUTDEVICE8A iface)
Definition: mouse.c:497
#define DIPROPRANGE_NOMAX
Definition: dinput.h:856
#define DIERR_INVALIDPARAM
Definition: dinput.h:152
HRESULT WINAPI IDirectInputDevice7AImpl_EnumEffectsInFile(LPDIRECTINPUTDEVICE8A iface, LPCSTR lpszFileName, LPDIENUMEFFECTSINFILECALLBACK pec, LPVOID pvRef, DWORD dwFlags)
Definition: device.c:1773
#define DISCL_BACKGROUND
Definition: dinput.h:968
const char * wine_dbgstr_point(const POINT *guid)
HRESULT WINAPI IDirectInputDevice8AImpl_GetImageInfo(LPDIRECTINPUTDEVICE8A iface, LPDIDEVICEIMAGEINFOHEADERA lpdiDevImageInfoHeader)
Definition: device.c:1833
Definition: msg.h:42
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT WINAPI IDirectInputDevice2WImpl_SetEventNotification(LPDIRECTINPUTDEVICE8W iface, HANDLE event)
Definition: device.c:1119
HRESULT WINAPI IDirectInputDevice2WImpl_RunControlPanel(LPDIRECTINPUTDEVICE8W iface, HWND hwndOwner, DWORD dwFlags)
Definition: device.c:1597
void _dump_DIPROPHEADER(LPCDIPROPHEADER diph)
Definition: device.c:175
#define GetProcessHeap()
Definition: compat.h:395
HRESULT WINAPI IDirectInputDevice7AImpl_WriteEffectToFile(LPDIRECTINPUTDEVICE8A iface, LPCSTR lpszFileName, DWORD dwEntries, LPDIFILEEFFECT rgDiFileEft, DWORD dwFlags)
Definition: device.c:1795
DWORD dwSize
Definition: dinput.h:934
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
HRESULT WINAPI IDirectInputDevice2WImpl_SetDataFormat(LPDIRECTINPUTDEVICE8W iface, LPCDIDATAFORMAT df)
Definition: device.c:1042
#define DIERR_OUTOFMEMORY
Definition: dinput.h:155
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
void fill_DataFormat(void *out, DWORD size, const void *in, const DataFormat *df)
Definition: device.c:325
DWORD dwFFDriverVersion
Definition: dinput.h:944
static HRESULT WINAPI SysMouseAImpl_GetObjectInfo(LPDIRECTINPUTDEVICE8A iface, LPDIDEVICEOBJECTINSTANCEA pdidoi, DWORD dwObj, DWORD dwHow)
Definition: mouse.c:730
HRESULT WINAPI IDirectInputDevice2AImpl_EnumEffects(LPDIRECTINPUTDEVICE8A iface, LPDIENUMEFFECTSCALLBACKA lpCallback, LPVOID lpvRef, DWORD dwFlags)
Definition: device.c:1645
DWORD dwButtons
Definition: dinput.h:938
WINE_DEFAULT_DEBUG_CHANNEL(dinput)
#define MAX_PATH
Definition: compat.h:26
#define WINAPI
Definition: msvc.h:8
HRESULT WINAPI IDirectInputDevice2WImpl_EnumEffects(LPDIRECTINPUTDEVICE8W iface, LPDIENUMEFFECTSCALLBACKW lpCallback, LPVOID lpvRef, DWORD dwFlags)
Definition: device.c:1657
const char * wine_dbgstr_rect(const RECT *rect)
BOOL WINAPI SetCursorPos(_In_ int, _In_ int)
Definition: cursoricon.c:2627
int WINAPI GetSystemMetrics(_In_ int)
#define DIERR_DEVICENOTREG
Definition: dinput.h:147
unsigned long DWORD
Definition: ntddk_ex.h:95
LONG x
Definition: windef.h:314
HRESULT WINAPI IDirectInputDevice2WImpl_Initialize(LPDIRECTINPUTDEVICE8W iface, HINSTANCE hinst, DWORD dwVersion, REFGUID rguid)
Definition: device.c:1610
#define DI8DEVTYPEMOUSE_TRADITIONAL
Definition: dinput.h:251
HRESULT WINAPI IDirectInputDevice2AImpl_SendForceFeedbackCommand(LPDIRECTINPUTDEVICE8A iface, DWORD dwFlags)
Definition: device.c:1707
#define WM_RBUTTONUP
Definition: winuser.h:1756
HRESULT WINAPI IDirectInputDevice2WImpl_GetDeviceData(LPDIRECTINPUTDEVICE8W iface, DWORD dodsize, LPDIDEVICEOBJECTDATA dod, LPDWORD entries, DWORD flags)
Definition: device.c:1534
static HRESULT WINAPI SysMouseAImpl_GetProperty(LPDIRECTINPUTDEVICE8A iface, REFGUID rguid, LPDIPROPHEADER pdiph)
Definition: mouse.c:657
CHAR tszName[MAX_PATH]
Definition: dinput.h:352
GLbitfield flags
Definition: glext.h:7161
HRESULT WINAPI IDirectInputDevice2WImpl_Escape(LPDIRECTINPUTDEVICE8W iface, LPDIEFFESCAPE lpDIEEsc)
Definition: device.c:1727
#define DIPROP_GRANULARITY
Definition: dinput.h:891
HRESULT WINAPI IDirectInputDevice2AImpl_GetEffectInfo(LPDIRECTINPUTDEVICE8A iface, LPDIEFFECTINFOA lpdei, REFGUID rguid)
Definition: device.c:1669
WCHAR tszProductName[MAX_PATH]
Definition: dinput.h:430
#define WINE_MOUSE_X_AXIS_INSTANCE
Definition: mouse.c:44
static HRESULT WINAPI SysMouseWImpl_Unacquire(LPDIRECTINPUTDEVICE8W iface)
Definition: mouse.c:506
int ret
HRESULT WINAPI IDirectInputDevice2WImpl_QueryInterface(LPDIRECTINPUTDEVICE8W iface, REFIID riid, LPVOID *ppobj)
Definition: device.c:1180
ULONG WINAPI IDirectInputDevice2AImpl_Release(LPDIRECTINPUTDEVICE8A iface)
Definition: device.c:1174
#define DIDFT_AXIS
Definition: dinput.h:753
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
static HRESULT mousedev_enum_deviceA(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEA lpddi, DWORD version, int id)
Definition: mouse.c:155
DWORD dwData
Definition: dinput.h:844
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static HRESULT WINAPI SysMouseAImpl_BuildActionMap(LPDIRECTINPUTDEVICE8A iface, LPDIACTIONFORMATA lpdiaf, LPCSTR lpszUserName, DWORD dwFlags)
Definition: mouse.c:796
GLenum GLsizei len
Definition: glext.h:6722
CHAR tszInstanceName[MAX_PATH]
Definition: dinput.h:416
#define WINE_MOUSE_Y_AXIS_INSTANCE
Definition: mouse.c:45
LPDIOBJECTDATAFORMAT rgodf
Definition: dinput.h:813
HRESULT WINAPI IDirectInputDevice2AImpl_QueryInterface(LPDIRECTINPUTDEVICE8A iface, REFIID riid, LPVOID *ppobj)
Definition: device.c:1209
uint32_t DWORD_PTR
Definition: typedefs.h:63
WCHAR tszInstanceName[MAX_PATH]
Definition: dinput.h:429
LPDIACTIONW rgoAction
Definition: dinput.h:1332
static HRESULT WINAPI SysMouseAImpl_Unacquire(LPDIRECTINPUTDEVICE8A iface)
Definition: mouse.c:532
WARP_MOUSE
Definition: mouse.c:54
#define SM_YVIRTUALSCREEN
Definition: winuser.h:1027
HRESULT WINAPI IDirectInputDevice2WImpl_GetEffectInfo(LPDIRECTINPUTDEVICE8W iface, LPDIEFFECTINFOW lpdei, REFGUID rguid)
Definition: device.c:1679
#define DIMOUSE_MASK
DWORD get_config_key(HKEY defkey, HKEY appkey, const char *name, char *buffer, DWORD size)
Definition: device.c:312
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define S_OK
Definition: intsafe.h:59
HRESULT WINAPI IDirectInputDevice2AImpl_SetCooperativeLevel(LPDIRECTINPUTDEVICE8A iface, HWND hwnd, DWORD dwflags)
Definition: device.c:1110
CRITICAL_SECTION crit
WINE_UNICODE_INLINE WCHAR * strcpyW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:219
struct IDirectInputDevice8W * LPDIRECTINPUTDEVICE8W
Definition: dinput.h:106
void _copy_diactionformatAtoW(LPDIACTIONFORMATW to, LPDIACTIONFORMATA from)
Definition: dinput_main.c:323
HRESULT WINAPI IDirectInputDevice2AImpl_GetForceFeedbackState(LPDIRECTINPUTDEVICE8A iface, LPDWORD pdwOut)
Definition: device.c:1695
BOOL WINAPI EqualRect(_In_ LPCRECT, _In_ LPCRECT)
#define DIERR_NOINTERFACE
Definition: dinput.h:153
HRESULT WINAPI IDirectInputDevice2WImpl_SetCooperativeLevel(LPDIRECTINPUTDEVICE8W iface, HWND hwnd, DWORD dwflags)
Definition: device.c:1074
DWORD last_warped
Definition: mouse.c:72
HRESULT WINAPI IDirectInputDevice7WImpl_EnumEffectsInFile(LPDIRECTINPUTDEVICE8W iface, LPCWSTR lpszFileName, LPDIENUMEFFECTSINFILECALLBACK pec, LPVOID pvRef, DWORD dwFlags)
Definition: device.c:1784
static HRESULT WINAPI SysMouseWImpl_Acquire(LPDIRECTINPUTDEVICE8W iface)
Definition: mouse.c:451
static HRESULT WINAPI SysMouseAImpl_GetDeviceData(LPDIRECTINPUTDEVICE8A iface, DWORD dodsize, LPDIDEVICEOBJECTDATA dod, LPDWORD entries, DWORD flags)
Definition: mouse.c:592
ULONG WINAPI IDirectInputDevice2AImpl_AddRef(LPDIRECTINPUTDEVICE8A iface)
Definition: device.c:1221
#define WM_LBUTTONUP
Definition: winuser.h:1753
#define WM_MBUTTONDOWN
Definition: winuser.h:1758
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
HRESULT WINAPI IDirectInputDevice2WImpl_GetObjectInfo(LPDIRECTINPUTDEVICE8W iface, LPDIDEVICEOBJECTINSTANCEW pdidoi, DWORD dwObj, DWORD dwHow)
Definition: device.c:1481
void _copy_diactionformatWtoA(LPDIACTIONFORMATA to, LPDIACTIONFORMATW from)
Definition: dinput_main.c:350
DWORD dwObj
Definition: dinput.h:830
#define min(a, b)
Definition: monoChain.cc:55
#define WM_MOUSEMOVE
Definition: winuser.h:1751
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4021
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
#define DI8DEVTYPE_MOUSE
Definition: dinput.h:210
GUID guidInstance
Definition: dinput.h:426
HRESULT WINAPI IDirectInputDevice2AImpl_SetDataFormat(LPDIRECTINPUTDEVICE8A iface, LPCDIDATAFORMAT df)
Definition: device.c:1063
#define MultiByteToWideChar
Definition: compat.h:100
#define DIMOFS_Y
Definition: dinput.h:2129
BOOL get_app_key(HKEY *defkey, HKEY *appkey)
Definition: device.c:277
HRESULT WINAPI IDirectInputDevice2AImpl_CreateEffect(LPDIRECTINPUTDEVICE8A iface, REFGUID rguid, LPCDIEFFECT lpeff, LPDIRECTINPUTEFFECT *ppdef, LPUNKNOWN pUnkOuter)
Definition: device.c:1638
CHAR tszProductName[MAX_PATH]
Definition: dinput.h:417
void queue_event(LPDIRECTINPUTDEVICE8A iface, int inst_id, DWORD data, DWORD time, DWORD seq)
Definition: device.c:932
HRESULT _build_action_map(LPDIRECTINPUTDEVICE8W iface, LPDIACTIONFORMATW lpdiaf, LPCWSTR lpszUserName, DWORD dwFlags, DWORD devMask, LPCDIDATAFORMAT df)
Definition: device.c:762
static void fill_mouse_dideviceinstanceW(LPDIDEVICEINSTANCEW lpddi, DWORD version)
Definition: mouse.c:131
struct IDirectInputDevice8A * LPDIRECTINPUTDEVICE8A
Definition: dinput.h:105
HRESULT WINAPI IDirectInputDevice2WImpl_EnumCreatedEffectObjects(LPDIRECTINPUTDEVICE8W iface, LPDIENUMCREATEDEFFECTOBJECTSCALLBACK lpCallback, LPVOID lpvRef, DWORD dwFlags)
Definition: device.c:1713
LONG lMin
Definition: dinput.h:850
static SysMouseImpl * alloc_device(REFGUID rguid, IDirectInputImpl *dinput)
Definition: mouse.c:191
GLuint res
Definition: glext.h:9613
#define DI_OK
Definition: dinput.h:128
uint32_t * LPDWORD
Definition: typedefs.h:57
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
IDirectInputDevice8W IDirectInputDevice8W_iface
DWORD dwFirmwareRevision
Definition: dinput.h:942
#define HIWORD(l)
Definition: typedefs.h:246
HRESULT WINAPI IDirectInputDevice2WImpl_Unacquire(LPDIRECTINPUTDEVICE8W iface)
Definition: device.c:1015
static HRESULT WINAPI SysMouseAImpl_GetDeviceState(LPDIRECTINPUTDEVICE8A iface, DWORD len, LPVOID ptr)
Definition: mouse.c:572
static HRESULT WINAPI SysMouseWImpl_GetProperty(LPDIRECTINPUTDEVICE8W iface, REFGUID rguid, LPDIPROPHEADER pdiph)
Definition: mouse.c:602
HRESULT WINAPI IDirectInputDevice2WImpl_SetProperty(LPDIRECTINPUTDEVICE8W iface, REFGUID rguid, LPCDIPROPHEADER pdiph)
Definition: device.c:1355
const struct dinput_device mouse_device
Definition: mouse.c:298
LONG lMax
Definition: dinput.h:851
#define IS_DIPROP(x)
static IDirectInputDevice8W * IDirectInputDevice8W_from_impl(SysMouseImpl *This)
Definition: mouse.c:89
#define WINE_MOUSE_Z_AXIS_INSTANCE
Definition: mouse.c:46
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
static const IDirectInputDevice8WVtbl SysMouseWvt
Definition: mouse.c:50
#define DIDFT_GETTYPE(n)
Definition: dinput.h:763
#define memset(x, y, z)
Definition: compat.h:39
#define VK_MBUTTON
Definition: winuser.h:2147
#define TRACE_ON(x)
Definition: compat.h:65
struct DIPROPDWORD * LPDIPROPDWORD
static SysMouseImpl * impl_from_IDirectInputDevice8A(IDirectInputDevice8A *iface)
Definition: mouse.c:80
#define LOWORD(l)
Definition: pedump.c:82
#define HeapFree(x, y, z)
Definition: compat.h:394
HRESULT WINAPI IDirectInputDevice2AImpl_SetEventNotification(LPDIRECTINPUTDEVICE8A iface, HANDLE event)
Definition: device.c:1131
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54
#define DISCL_EXCLUSIVE
Definition: dinput.h:965
HRESULT WINAPI IDirectInputDevice2WImpl_GetForceFeedbackState(LPDIRECTINPUTDEVICE8W iface, LPDWORD pdwOut)
Definition: device.c:1689
#define SUCCEEDED(hr)
Definition: intsafe.h:57
static UINT WPARAM wparam
Definition: combo.c:716
#define DIDFT_RELAXIS
Definition: dinput.h:751
ULONG WINAPI IDirectInputDevice2WImpl_Release(LPDIRECTINPUTDEVICE8W iface)
Definition: device.c:1138
GUID guidProduct
Definition: dinput.h:427
HRESULT WINAPI IDirectInputDevice2AImpl_Initialize(LPDIRECTINPUTDEVICE8A iface, HINSTANCE hinst, DWORD dwVersion, REFGUID rguid)
Definition: device.c:1617