mirror of
https://github.com/X11Libre/xserver.git
synced 2026-10-08 23:12:27 +00:00
Import recent changes from CYGWIN branch
This commit is contained in:
parent
db65fce04d
commit
9d4823adc8
14 changed files with 329 additions and 31 deletions
|
|
@ -65,21 +65,39 @@ int
|
|||
winMouseProc (DeviceIntPtr pDeviceInt, int iState)
|
||||
{
|
||||
int lngMouseButtons, i;
|
||||
int lngWheelEvents = 2;
|
||||
CARD8 *map;
|
||||
DevicePtr pDevice = (DevicePtr) pDeviceInt;
|
||||
|
||||
switch (iState)
|
||||
{
|
||||
case DEVICE_INIT:
|
||||
/* Get number of mouse buttons */
|
||||
lngMouseButtons = GetSystemMetrics(SM_CMOUSEBUTTONS);
|
||||
ErrorF ("%d mouse buttons found\n", lngMouseButtons);
|
||||
map = malloc(sizeof(CARD8) * (lngMouseButtons + 1 + 2));
|
||||
|
||||
for (i=1; i <= lngMouseButtons + 2; i++)
|
||||
|
||||
/* Mapping of windows events to X events:
|
||||
* LEFT:1 MIDDLE:2 RIGHT:3
|
||||
* SCROLL_UP:4 SCROLL_DOWN:5
|
||||
* XBUTTON 1:6 XBUTTON 2:7 ...
|
||||
*
|
||||
* To map scroll wheel correctly we need at least the 3 normal buttons
|
||||
*/
|
||||
if (lngMouseButtons < 3)
|
||||
lngMouseButtons = 3;
|
||||
winMsg(X_PROBED, "%d mouse buttons found\n", lngMouseButtons);
|
||||
|
||||
/* allocate memory:
|
||||
* number of buttons + 2x mouse wheel event + 1 extra (offset for map)
|
||||
*/
|
||||
map = malloc(sizeof(CARD8) * (lngMouseButtons + lngWheelEvents + 1));
|
||||
|
||||
/* initalize button map */
|
||||
map[0] = 0;
|
||||
for (i=1; i <= lngMouseButtons + lngWheelEvents; i++)
|
||||
map[i] = i;
|
||||
InitPointerDeviceStruct (pDevice,
|
||||
map,
|
||||
lngMouseButtons + 2, /* Buttons 4 and 5 are mouse wheel events */
|
||||
lngMouseButtons + lngWheelEvents,
|
||||
miPointerGetMotionEvents,
|
||||
winMouseCtrl,
|
||||
miPointerGetMotionBufferSize ());
|
||||
|
|
|
|||
Loading…
Reference in a new issue