mirror of
https://github.com/X11Libre/xserver.git
synced 2026-09-29 21:46:40 +00:00
Abstract valuator masks through a set of APIs.
This commit introduces an abstraction API for handling masked valuators. The
intent is that drivers just allocate a mask, set the data and pass the mask
to the server. The actual storage type of the mask is hidden from the
drivers.
The new calls for drivers are:
valuator_mask_new() /* to allocate a valuator mask */
valuator_mask_zero() /* to reset a mask to zero */
valuator_mask_set() /* to set a valuator value */
The new interface to the server is
xf86PostMotionEventM()
xf86PostButtonEventM()
xf86PostKeyboardEventM()
xf86PostProximityEventM()
all taking a mask instead of the valuator array.
The ValuatorMask is currently defined for MAX_VALUATORS fixed size due to
memory allocation restrictions in SIGIO handlers.
For easier review, a lot of the code still uses separate valuator arrays.
This will be fixed in a later patch.
This patch was initially written by Chase Douglas.
Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
This commit is contained in:
parent
fc48a8f9f5
commit
675f4a8525
15 changed files with 493 additions and 186 deletions
|
|
@ -42,6 +42,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include <ctype.h>
|
||||
#include "mi.h"
|
||||
#include "mipointer.h"
|
||||
#include "inpututils.h"
|
||||
#define EXTENSION_EVENT_BASE 64
|
||||
|
||||
DevPrivateKeyRec xkbDevicePrivateKeyRec;
|
||||
|
|
@ -1354,7 +1355,7 @@ xkbStateNotify sn;
|
|||
* First one on drinking island wins!
|
||||
*/
|
||||
static void
|
||||
InjectPointerKeyEvents(DeviceIntPtr dev, int type, int button, int flags, int num_valuators, int *valuators)
|
||||
InjectPointerKeyEvents(DeviceIntPtr dev, int type, int button, int flags, ValuatorMask *mask)
|
||||
{
|
||||
ScreenPtr pScreen;
|
||||
EventListPtr events;
|
||||
|
|
@ -1376,8 +1377,7 @@ InjectPointerKeyEvents(DeviceIntPtr dev, int type, int button, int flags, int nu
|
|||
OsBlockSignals();
|
||||
pScreen = miPointerGetScreen(ptr);
|
||||
saveWait = miPointerSetWaitForUpdate(pScreen, FALSE);
|
||||
nevents = GetPointerEvents(events, ptr, type, button, flags, 0,
|
||||
num_valuators, valuators);
|
||||
nevents = GetPointerEvents(events, ptr, type, button, flags, mask);
|
||||
if (IsMaster(dev) && (lastSlave && lastSlave != ptr))
|
||||
UpdateFromMaster(&events[nevents], lastSlave, DEVCHANGE_POINTER_EVENT, &nevents);
|
||||
miPointerSetWaitForUpdate(pScreen, saveWait);
|
||||
|
|
@ -1393,6 +1393,7 @@ InjectPointerKeyEvents(DeviceIntPtr dev, int type, int button, int flags, int nu
|
|||
static void
|
||||
XkbFakePointerMotion(DeviceIntPtr dev, unsigned flags,int x,int y)
|
||||
{
|
||||
ValuatorMask mask;
|
||||
int gpe_flags = 0;
|
||||
|
||||
/* ignore attached SDs */
|
||||
|
|
@ -1404,7 +1405,9 @@ XkbFakePointerMotion(DeviceIntPtr dev, unsigned flags,int x,int y)
|
|||
else
|
||||
gpe_flags = POINTER_RELATIVE;
|
||||
|
||||
InjectPointerKeyEvents(dev, MotionNotify, 0, gpe_flags, 2, (int[]){x, y});
|
||||
valuator_mask_set_range(&mask, 0, 2, (int[]){x, y});
|
||||
|
||||
InjectPointerKeyEvents(dev, MotionNotify, 0, gpe_flags, &mask);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -1434,5 +1437,5 @@ XkbFakeDeviceButton(DeviceIntPtr dev,Bool press,int button)
|
|||
return;
|
||||
|
||||
InjectPointerKeyEvents(dev, press ? ButtonPress : ButtonRelease,
|
||||
button, 0, 0, NULL);
|
||||
button, 0, NULL);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue