mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2026-05-06 05:48:02 +02:00
Make sure buttons 1-3 are mouse buttons and wheel events are 4-5 Document
code Replace ErrorF with appropriate winMsg use a symbolic name for the
wheel event offset
This commit is contained in:
parent
5162b87e9f
commit
902b64bbf5
2 changed files with 31 additions and 5 deletions
|
|
@ -1,3 +1,11 @@
|
|||
2004-10-02 Alexander Gottwald <ago at freedesktop dot org>
|
||||
|
||||
* winmouse.c (winMouseProc):
|
||||
Make sure buttons 1-3 are mouse buttons and wheel events are 4-5
|
||||
Document code
|
||||
Replace ErrorF with appropriate winMsg
|
||||
use a symbolic name for the wheel event offset
|
||||
|
||||
2004-10-01 Alexander Gottwald <ago at freedesktop dot org>
|
||||
|
||||
* wincreatewnd.c (winCreateBoundingWindowWindowed):
|
||||
|
|
|
|||
|
|
@ -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…
Add table
Reference in a new issue