Merge remote-tracking branch 'whot/next'
This commit is contained in:
commit
fb84be47db
|
@ -667,6 +667,7 @@ eventToRawEvent(RawDeviceEvent *ev, xEvent **xi)
|
||||||
raw->length = bytes_to_int32(len - sizeof(xEvent));
|
raw->length = bytes_to_int32(len - sizeof(xEvent));
|
||||||
raw->detail = ev->detail.button;
|
raw->detail = ev->detail.button;
|
||||||
raw->deviceid = ev->deviceid;
|
raw->deviceid = ev->deviceid;
|
||||||
|
raw->sourceid = ev->sourceid;
|
||||||
raw->valuators_len = vallen;
|
raw->valuators_len = vallen;
|
||||||
raw->flags = ev->flags;
|
raw->flags = ev->flags;
|
||||||
|
|
||||||
|
|
25
dix/events.c
25
dix/events.c
|
@ -524,13 +524,6 @@ SyntheticMotion(DeviceIntPtr dev, int x, int y) {
|
||||||
#ifdef PANORAMIX
|
#ifdef PANORAMIX
|
||||||
static void PostNewCursor(DeviceIntPtr pDev);
|
static void PostNewCursor(DeviceIntPtr pDev);
|
||||||
|
|
||||||
static Bool
|
|
||||||
pointOnScreen(ScreenPtr pScreen, int x, int y)
|
|
||||||
{
|
|
||||||
return x >= pScreen->x && x < pScreen->x + pScreen->width &&
|
|
||||||
y >= pScreen->y && y < pScreen->y + pScreen->height;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Bool
|
static Bool
|
||||||
XineramaSetCursorPosition(
|
XineramaSetCursorPosition(
|
||||||
DeviceIntPtr pDev,
|
DeviceIntPtr pDev,
|
||||||
|
@ -550,13 +543,13 @@ XineramaSetCursorPosition(
|
||||||
x += screenInfo.screens[0]->x;
|
x += screenInfo.screens[0]->x;
|
||||||
y += screenInfo.screens[0]->y;
|
y += screenInfo.screens[0]->y;
|
||||||
|
|
||||||
if(!pointOnScreen(pScreen, x, y))
|
if(!point_on_screen(pScreen, x, y))
|
||||||
{
|
{
|
||||||
FOR_NSCREENS(i)
|
FOR_NSCREENS(i)
|
||||||
{
|
{
|
||||||
if(i == pScreen->myNum)
|
if(i == pScreen->myNum)
|
||||||
continue;
|
continue;
|
||||||
if(pointOnScreen(screenInfo.screens[i], x, y))
|
if(point_on_screen(screenInfo.screens[i], x, y))
|
||||||
{
|
{
|
||||||
pScreen = screenInfo.screens[i];
|
pScreen = screenInfo.screens[i];
|
||||||
break;
|
break;
|
||||||
|
@ -3360,7 +3353,11 @@ WindowHasNewCursor(WindowPtr pWin)
|
||||||
void
|
void
|
||||||
NewCurrentScreen(DeviceIntPtr pDev, ScreenPtr newScreen, int x, int y)
|
NewCurrentScreen(DeviceIntPtr pDev, ScreenPtr newScreen, int x, int y)
|
||||||
{
|
{
|
||||||
SpritePtr pSprite = pDev->spriteInfo->sprite;
|
DeviceIntPtr ptr;
|
||||||
|
SpritePtr pSprite;
|
||||||
|
|
||||||
|
ptr = IsFloating(pDev) ? pDev : GetXTestDevice(GetMaster(pDev, MASTER_POINTER));
|
||||||
|
pSprite = ptr->spriteInfo->sprite;
|
||||||
|
|
||||||
pSprite->hotPhys.x = x;
|
pSprite->hotPhys.x = x;
|
||||||
pSprite->hotPhys.y = y;
|
pSprite->hotPhys.y = y;
|
||||||
|
@ -3372,15 +3369,15 @@ NewCurrentScreen(DeviceIntPtr pDev, ScreenPtr newScreen, int x, int y)
|
||||||
pSprite->screen = newScreen;
|
pSprite->screen = newScreen;
|
||||||
/* Make sure we tell the DDX to update its copy of the screen */
|
/* Make sure we tell the DDX to update its copy of the screen */
|
||||||
if(pSprite->confineWin)
|
if(pSprite->confineWin)
|
||||||
XineramaConfineCursorToWindow(pDev,
|
XineramaConfineCursorToWindow(ptr,
|
||||||
pSprite->confineWin, TRUE);
|
pSprite->confineWin, TRUE);
|
||||||
else
|
else
|
||||||
XineramaConfineCursorToWindow(pDev, screenInfo.screens[0]->root, TRUE);
|
XineramaConfineCursorToWindow(ptr, screenInfo.screens[0]->root, TRUE);
|
||||||
/* if the pointer wasn't confined, the DDX won't get
|
/* if the pointer wasn't confined, the DDX won't get
|
||||||
told of the pointer warp so we reposition it here */
|
told of the pointer warp so we reposition it here */
|
||||||
if(!syncEvents.playingEvents)
|
if(!syncEvents.playingEvents)
|
||||||
(*pSprite->screen->SetCursorPosition)(
|
(*pSprite->screen->SetCursorPosition)(
|
||||||
pDev,
|
ptr,
|
||||||
pSprite->screen,
|
pSprite->screen,
|
||||||
pSprite->hotPhys.x + screenInfo.screens[0]->x -
|
pSprite->hotPhys.x + screenInfo.screens[0]->x -
|
||||||
pSprite->screen->x,
|
pSprite->screen->x,
|
||||||
|
@ -3390,7 +3387,7 @@ NewCurrentScreen(DeviceIntPtr pDev, ScreenPtr newScreen, int x, int y)
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
if (newScreen != pSprite->hotPhys.pScreen)
|
if (newScreen != pSprite->hotPhys.pScreen)
|
||||||
ConfineCursorToWindow(pDev, newScreen->root, TRUE, FALSE);
|
ConfineCursorToWindow(ptr, newScreen->root, TRUE, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PANORAMIX
|
#ifdef PANORAMIX
|
||||||
|
|
168
dix/getevents.c
168
dix/getevents.c
|
@ -693,7 +693,7 @@ UpdateFromMaster(InternalEvent* events, DeviceIntPtr dev, int type, int *num_eve
|
||||||
* @param mask Valuator data for this event.
|
* @param mask Valuator data for this event.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
moveAbsolute(DeviceIntPtr dev, ValuatorMask *mask)
|
clipAbsolute(DeviceIntPtr dev, ValuatorMask *mask)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -713,7 +713,7 @@ moveAbsolute(DeviceIntPtr dev, ValuatorMask *mask)
|
||||||
* Move the device's pointer by the values given in @valuators.
|
* Move the device's pointer by the values given in @valuators.
|
||||||
*
|
*
|
||||||
* @param dev The device whose pointer is to be moved.
|
* @param dev The device whose pointer is to be moved.
|
||||||
* @param mask Valuator data for this event.
|
* @param[in,out] mask Valuator data for this event, modified in-place.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
moveRelative(DeviceIntPtr dev, ValuatorMask *mask)
|
moveRelative(DeviceIntPtr dev, ValuatorMask *mask)
|
||||||
|
@ -752,6 +752,37 @@ accelPointer(DeviceIntPtr dev, ValuatorMask* valuators, CARD32 ms)
|
||||||
dev->valuator->accelScheme.AccelSchemeProc(dev, valuators, ms);
|
dev->valuator->accelScheme.AccelSchemeProc(dev, valuators, ms);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Scale from absolute screen coordinates to absolute coordinates in the
|
||||||
|
* device's coordinate range.
|
||||||
|
*
|
||||||
|
* @param dev The device to scale for.
|
||||||
|
* @param[in, out] mask The mask in sceen coordinates, modified in place to
|
||||||
|
* contain device coordinate range.
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
scale_from_screen(DeviceIntPtr dev, ValuatorMask *mask)
|
||||||
|
{
|
||||||
|
double scaled;
|
||||||
|
ScreenPtr scr = miPointerGetScreen(dev);
|
||||||
|
|
||||||
|
if (valuator_mask_isset(mask, 0))
|
||||||
|
{
|
||||||
|
scaled = rescaleValuatorAxis(valuator_mask_get_double(mask, 0),
|
||||||
|
NULL, dev->valuator->axes + 0,
|
||||||
|
scr->width);
|
||||||
|
valuator_mask_set_double(mask, 0, scaled);
|
||||||
|
}
|
||||||
|
if (valuator_mask_isset(mask, 1))
|
||||||
|
{
|
||||||
|
scaled = rescaleValuatorAxis(valuator_mask_get_double(mask, 1),
|
||||||
|
NULL, dev->valuator->axes + 1,
|
||||||
|
scr->height);
|
||||||
|
valuator_mask_set_double(mask, 1, scaled);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If we have HW cursors, this actually moves the visible sprite. If not, we
|
* If we have HW cursors, this actually moves the visible sprite. If not, we
|
||||||
* just do all the screen crossing, etc.
|
* just do all the screen crossing, etc.
|
||||||
|
@ -760,25 +791,26 @@ accelPointer(DeviceIntPtr dev, ValuatorMask* valuators, CARD32 ms)
|
||||||
* miPointerSetPosition() and then scale back into device coordinates (if
|
* miPointerSetPosition() and then scale back into device coordinates (if
|
||||||
* needed). miPSP will change x/y if the screen was crossed.
|
* needed). miPSP will change x/y if the screen was crossed.
|
||||||
*
|
*
|
||||||
* The coordinates provided are always absolute. The parameter mode whether
|
* The coordinates provided are always absolute. The parameter mode
|
||||||
* it was relative or absolute movement that landed us at those coordinates.
|
* specifies whether it was relative or absolute movement that landed us at
|
||||||
|
* those coordinates.
|
||||||
*
|
*
|
||||||
* @param dev The device to be moved.
|
* @param dev The device to be moved.
|
||||||
* @param mode Movement mode (Absolute or Relative)
|
* @param mode Movement mode (Absolute or Relative)
|
||||||
* @param scr Screen the device's sprite is currently on.
|
|
||||||
* @param mask Mask of axis values for this event
|
* @param mask Mask of axis values for this event
|
||||||
* @param screenx Screen x coordinate the sprite is on after the update.
|
* @param screenx Screen x coordinate the sprite is on after the update.
|
||||||
* @param screeny Screen y coordinate the sprite is on after the update.
|
* @param screeny Screen y coordinate the sprite is on after the update.
|
||||||
*/
|
*/
|
||||||
static void
|
static ScreenPtr
|
||||||
positionSprite(DeviceIntPtr dev, int mode, ScreenPtr scr, ValuatorMask *mask,
|
positionSprite(DeviceIntPtr dev, int mode, ValuatorMask *mask,
|
||||||
double *screenx, double *screeny)
|
double *screenx, double *screeny)
|
||||||
{
|
{
|
||||||
int isx, isy; /* screen {x, y}, in int */
|
|
||||||
double x, y;
|
double x, y;
|
||||||
|
double tmpx, tmpy;
|
||||||
|
ScreenPtr scr = miPointerGetScreen(dev);
|
||||||
|
|
||||||
if (!dev->valuator || dev->valuator->numAxes < 2)
|
if (!dev->valuator || dev->valuator->numAxes < 2)
|
||||||
return;
|
return scr;
|
||||||
|
|
||||||
if (valuator_mask_isset(mask, 0))
|
if (valuator_mask_isset(mask, 0))
|
||||||
x = valuator_mask_get_double(mask, 0);
|
x = valuator_mask_get_double(mask, 0);
|
||||||
|
@ -795,38 +827,30 @@ positionSprite(DeviceIntPtr dev, int mode, ScreenPtr scr, ValuatorMask *mask,
|
||||||
*screeny = rescaleValuatorAxis(y, dev->valuator->axes + 1, NULL,
|
*screeny = rescaleValuatorAxis(y, dev->valuator->axes + 1, NULL,
|
||||||
scr->height);
|
scr->height);
|
||||||
|
|
||||||
|
tmpx = *screenx;
|
||||||
|
tmpy = *screeny;
|
||||||
/* miPointerSetPosition takes care of crossing screens for us, as well as
|
/* miPointerSetPosition takes care of crossing screens for us, as well as
|
||||||
* clipping to the current screen. In the event we actually change screen,
|
* clipping to the current screen. */
|
||||||
* we just drop the float component on the floor, then convert from
|
scr = miPointerSetPosition(dev, mode, screenx, screeny);
|
||||||
* screenx back into device co-ordinates. */
|
|
||||||
isx = trunc(*screenx);
|
/* If we were constrained, rescale x/y from the screen coordinates so
|
||||||
isy = trunc(*screeny);
|
* the device valuators reflect the correct position. For screen
|
||||||
miPointerSetPosition(dev, mode, &isx, &isy);
|
* crossing this doesn't matter much, the coords would be 0 or max.
|
||||||
scr = miPointerGetScreen(dev);
|
*/
|
||||||
if (isx != trunc(*screenx))
|
if (tmpx != *screenx)
|
||||||
{
|
|
||||||
*screenx -= trunc(*screenx) - isx;
|
|
||||||
x = rescaleValuatorAxis(*screenx, NULL, dev->valuator->axes + 0,
|
x = rescaleValuatorAxis(*screenx, NULL, dev->valuator->axes + 0,
|
||||||
scr->width);
|
scr->width);
|
||||||
}
|
if (tmpy != *screeny)
|
||||||
if (isy != trunc(*screeny))
|
|
||||||
{
|
|
||||||
*screeny -= trunc(*screeny) - isy;
|
|
||||||
y = rescaleValuatorAxis(*screeny, NULL, dev->valuator->axes + 1,
|
y = rescaleValuatorAxis(*screeny, NULL, dev->valuator->axes + 1,
|
||||||
scr->height);
|
scr->height);
|
||||||
}
|
|
||||||
|
|
||||||
/* Update the MD's co-ordinates, which are always in screen space. */
|
|
||||||
if (!IsMaster(dev) || !IsFloating(dev)) {
|
|
||||||
DeviceIntPtr master = GetMaster(dev, MASTER_POINTER);
|
|
||||||
master->last.valuators[0] = *screenx;
|
|
||||||
master->last.valuators[1] = *screeny;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (valuator_mask_isset(mask, 0))
|
if (valuator_mask_isset(mask, 0))
|
||||||
valuator_mask_set_double(mask, 0, x);
|
valuator_mask_set_double(mask, 0, x);
|
||||||
if (valuator_mask_isset(mask, 1))
|
if (valuator_mask_isset(mask, 1))
|
||||||
valuator_mask_set_double(mask, 1, y);
|
valuator_mask_set_double(mask, 1, y);
|
||||||
|
|
||||||
|
return scr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -859,6 +883,15 @@ queueEventList(DeviceIntPtr device, InternalEvent *events, int nevents)
|
||||||
mieqEnqueue(device, &events[i]);
|
mieqEnqueue(device, &events[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
event_set_root_coordinates(DeviceEvent* event, double x, double y)
|
||||||
|
{
|
||||||
|
event->root_x = trunc(x);
|
||||||
|
event->root_y = trunc(y);
|
||||||
|
event->root_x_frac = x - trunc(x);
|
||||||
|
event->root_y_frac = y - trunc(y);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate internal events representing this keyboard event and enqueue
|
* Generate internal events representing this keyboard event and enqueue
|
||||||
* them on the event queue.
|
* them on the event queue.
|
||||||
|
@ -910,6 +943,11 @@ GetKeyboardEvents(InternalEvent *events, DeviceIntPtr pDev, int type,
|
||||||
(key_code < 8 || key_code > 255))
|
(key_code < 8 || key_code > 255))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
if (mask_in && valuator_mask_size(mask_in) > 1) {
|
||||||
|
ErrorF("[dix] the server does not handle valuator masks with "
|
||||||
|
"keyboard events. This is a bug. You may fix it.\n");
|
||||||
|
}
|
||||||
|
|
||||||
num_events = 1;
|
num_events = 1;
|
||||||
|
|
||||||
events = UpdateFromMaster(events, pDev, DEVCHANGE_KEYBOARD_EVENT, &num_events);
|
events = UpdateFromMaster(events, pDev, DEVCHANGE_KEYBOARD_EVENT, &num_events);
|
||||||
|
@ -956,6 +994,13 @@ GetKeyboardEvents(InternalEvent *events, DeviceIntPtr pDev, int type,
|
||||||
|
|
||||||
set_valuators(pDev, event, &mask);
|
set_valuators(pDev, event, &mask);
|
||||||
|
|
||||||
|
if (!IsFloating(pDev)) {
|
||||||
|
DeviceIntPtr master = GetMaster(pDev, MASTER_POINTER);
|
||||||
|
event_set_root_coordinates(event,
|
||||||
|
master->last.valuators[0],
|
||||||
|
master->last.valuators[1]);
|
||||||
|
}
|
||||||
|
|
||||||
return num_events;
|
return num_events;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -999,6 +1044,14 @@ transform(struct pixman_f_transform *m, double *x, double *y)
|
||||||
*y = p.v[1];
|
*y = p.v[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Apply the device's transformation matrix to the valuator mask and replace
|
||||||
|
* the scaled values in mask. This transformation only applies to valuators
|
||||||
|
* 0 and 1, others will be untouched.
|
||||||
|
*
|
||||||
|
* @param dev The device the valuators came from
|
||||||
|
* @param[in,out] mask The valuator mask.
|
||||||
|
*/
|
||||||
static void
|
static void
|
||||||
transformAbsolute(DeviceIntPtr dev, ValuatorMask *mask)
|
transformAbsolute(DeviceIntPtr dev, ValuatorMask *mask)
|
||||||
{
|
{
|
||||||
|
@ -1063,12 +1116,16 @@ fill_pointer_events(InternalEvent *events, DeviceIntPtr pDev, int type,
|
||||||
DeviceEvent *event;
|
DeviceEvent *event;
|
||||||
RawDeviceEvent *raw;
|
RawDeviceEvent *raw;
|
||||||
double screenx = 0.0, screeny = 0.0;
|
double screenx = 0.0, screeny = 0.0;
|
||||||
ScreenPtr scr = miPointerGetScreen(pDev);
|
|
||||||
ValuatorMask mask;
|
ValuatorMask mask;
|
||||||
|
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case MotionNotify:
|
case MotionNotify:
|
||||||
|
if (!pDev->valuator)
|
||||||
|
{
|
||||||
|
ErrorF("[dix] motion events from device %d without valuators\n", pDev->id);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
if (!mask_in || valuator_mask_num_valuators(mask_in) <= 0)
|
if (!mask_in || valuator_mask_num_valuators(mask_in) <= 0)
|
||||||
return 0;
|
return 0;
|
||||||
break;
|
break;
|
||||||
|
@ -1076,6 +1133,11 @@ fill_pointer_events(InternalEvent *events, DeviceIntPtr pDev, int type,
|
||||||
case ButtonRelease:
|
case ButtonRelease:
|
||||||
if (!pDev->button || !buttons)
|
if (!pDev->button || !buttons)
|
||||||
return 0;
|
return 0;
|
||||||
|
if (mask_in && valuator_mask_size(mask_in) > 0 && !pDev->valuator)
|
||||||
|
{
|
||||||
|
ErrorF("[dix] button event with valuator from device %d without valuators\n", pDev->id);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1096,27 +1158,10 @@ fill_pointer_events(InternalEvent *events, DeviceIntPtr pDev, int type,
|
||||||
if (flags & POINTER_ABSOLUTE)
|
if (flags & POINTER_ABSOLUTE)
|
||||||
{
|
{
|
||||||
if (flags & POINTER_SCREEN) /* valuators are in screen coords */
|
if (flags & POINTER_SCREEN) /* valuators are in screen coords */
|
||||||
{
|
scale_from_screen(pDev, &mask);
|
||||||
double scaled;
|
|
||||||
|
|
||||||
if (valuator_mask_isset(&mask, 0))
|
|
||||||
{
|
|
||||||
scaled = rescaleValuatorAxis(valuator_mask_get_double(&mask, 0),
|
|
||||||
NULL, pDev->valuator->axes + 0,
|
|
||||||
scr->width);
|
|
||||||
valuator_mask_set_double(&mask, 0, scaled);
|
|
||||||
}
|
|
||||||
if (valuator_mask_isset(&mask, 1))
|
|
||||||
{
|
|
||||||
scaled = rescaleValuatorAxis(valuator_mask_get_double(&mask, 1),
|
|
||||||
NULL, pDev->valuator->axes + 1,
|
|
||||||
scr->height);
|
|
||||||
valuator_mask_set_double(&mask, 1, scaled);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
transformAbsolute(pDev, &mask);
|
transformAbsolute(pDev, &mask);
|
||||||
moveAbsolute(pDev, &mask);
|
clipAbsolute(pDev, &mask);
|
||||||
} else {
|
} else {
|
||||||
if (flags & POINTER_ACCELERATE)
|
if (flags & POINTER_ACCELERATE)
|
||||||
accelPointer(pDev, &mask, ms);
|
accelPointer(pDev, &mask, ms);
|
||||||
|
@ -1126,7 +1171,7 @@ fill_pointer_events(InternalEvent *events, DeviceIntPtr pDev, int type,
|
||||||
if ((flags & POINTER_NORAW) == 0)
|
if ((flags & POINTER_NORAW) == 0)
|
||||||
set_raw_valuators(raw, &mask, raw->valuators.data);
|
set_raw_valuators(raw, &mask, raw->valuators.data);
|
||||||
|
|
||||||
positionSprite(pDev, (flags & POINTER_ABSOLUTE) ? Absolute : Relative, scr,
|
positionSprite(pDev, (flags & POINTER_ABSOLUTE) ? Absolute : Relative,
|
||||||
&mask, &screenx, &screeny);
|
&mask, &screenx, &screeny);
|
||||||
updateHistory(pDev, &mask, ms);
|
updateHistory(pDev, &mask, ms);
|
||||||
|
|
||||||
|
@ -1138,6 +1183,13 @@ fill_pointer_events(InternalEvent *events, DeviceIntPtr pDev, int type,
|
||||||
pDev->last.valuators[i] = valuator_mask_get_double(&mask, i);
|
pDev->last.valuators[i] = valuator_mask_get_double(&mask, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Update the MD's co-ordinates, which are always in screen space. */
|
||||||
|
if (!IsMaster(pDev) || !IsFloating(pDev)) {
|
||||||
|
DeviceIntPtr master = GetMaster(pDev, MASTER_POINTER);
|
||||||
|
master->last.valuators[0] = screenx;
|
||||||
|
master->last.valuators[1] = screeny;
|
||||||
|
}
|
||||||
|
|
||||||
event = &events->device_event;
|
event = &events->device_event;
|
||||||
init_device_event(event, pDev, ms);
|
init_device_event(event, pDev, ms);
|
||||||
|
|
||||||
|
@ -1158,10 +1210,7 @@ fill_pointer_events(InternalEvent *events, DeviceIntPtr pDev, int type,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* root_x and root_y must be in screen co-ordinates */
|
/* root_x and root_y must be in screen co-ordinates */
|
||||||
event->root_x = trunc(screenx);
|
event_set_root_coordinates(event, screenx, screeny);
|
||||||
event->root_y = trunc(screeny);
|
|
||||||
event->root_x_frac = screenx - trunc(screenx);
|
|
||||||
event->root_y_frac = screeny - trunc(screeny);
|
|
||||||
|
|
||||||
if (flags & POINTER_EMULATED) {
|
if (flags & POINTER_EMULATED) {
|
||||||
raw->flags = XIPointerEmulated;
|
raw->flags = XIPointerEmulated;
|
||||||
|
@ -1312,21 +1361,22 @@ GetPointerEvents(InternalEvent *events, DeviceIntPtr pDev, int type,
|
||||||
double val, adj;
|
double val, adj;
|
||||||
int axis;
|
int axis;
|
||||||
|
|
||||||
|
/* Up is negative on valuators, down positive */
|
||||||
switch (buttons) {
|
switch (buttons) {
|
||||||
case 4:
|
case 4:
|
||||||
adj = 1.0;
|
adj = -1.0;
|
||||||
axis = v_scroll_axis;
|
axis = v_scroll_axis;
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
adj = -1.0;
|
adj = 1.0;
|
||||||
axis = v_scroll_axis;
|
axis = v_scroll_axis;
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
adj = 1.0;
|
adj = -1.0;
|
||||||
axis = h_scroll_axis;
|
axis = h_scroll_axis;
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
adj = -1.0;
|
adj = 1.0;
|
||||||
axis = h_scroll_axis;
|
axis = h_scroll_axis;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
#include "xkbstr.h"
|
#include "xkbstr.h"
|
||||||
#include "inpututils.h"
|
#include "inpututils.h"
|
||||||
#include "eventstr.h"
|
#include "eventstr.h"
|
||||||
|
#include "scrnintstr.h"
|
||||||
|
|
||||||
/* Check if a button map change is okay with the device.
|
/* Check if a button map change is okay with the device.
|
||||||
* Returns -1 for BadValue, as it collides with MappingBusy. */
|
* Returns -1 for BadValue, as it collides with MappingBusy. */
|
||||||
|
@ -619,6 +620,13 @@ void init_device_event(DeviceEvent *event, DeviceIntPtr dev, Time ms)
|
||||||
event->sourceid = dev->id;
|
event->sourceid = dev->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Bool
|
||||||
|
point_on_screen(ScreenPtr pScreen, int x, int y)
|
||||||
|
{
|
||||||
|
return x >= pScreen->x && x < pScreen->x + pScreen->width &&
|
||||||
|
y >= pScreen->y && y < pScreen->y + pScreen->height;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete the element with the key from the list, freeing all memory
|
* Delete the element with the key from the list, freeing all memory
|
||||||
* associated with the element..
|
* associated with the element..
|
||||||
|
|
|
@ -608,4 +608,6 @@ extern _X_EXPORT const char* input_option_get_value(const InputOption *opt);
|
||||||
extern _X_EXPORT void input_option_set_key(InputOption *opt, const char* key);
|
extern _X_EXPORT void input_option_set_key(InputOption *opt, const char* key);
|
||||||
extern _X_EXPORT void input_option_set_value(InputOption *opt, const char* value);
|
extern _X_EXPORT void input_option_set_value(InputOption *opt, const char* value);
|
||||||
|
|
||||||
|
extern _X_HIDDEN Bool point_on_screen(ScreenPtr pScreen, int x, int y);
|
||||||
|
|
||||||
#endif /* INPUT_H */
|
#endif /* INPUT_H */
|
||||||
|
|
|
@ -569,35 +569,37 @@ miPointerMoveNoEvent (DeviceIntPtr pDev, ScreenPtr pScreen,
|
||||||
*
|
*
|
||||||
* @param pDev The device to move
|
* @param pDev The device to move
|
||||||
* @param mode Movement mode (Absolute or Relative)
|
* @param mode Movement mode (Absolute or Relative)
|
||||||
* @param[in,out] x The x coordinate in screen coordinates (in regards to total
|
* @param[in,out] screenx The x coordinate in screen coordinates
|
||||||
* desktop size)
|
* @param[in,out] screeny The y coordinate in screen coordinates
|
||||||
* @param[in,out] y The y coordinate in screen coordinates (in regards to total
|
|
||||||
* desktop size)
|
|
||||||
*/
|
*/
|
||||||
void
|
ScreenPtr
|
||||||
miPointerSetPosition(DeviceIntPtr pDev, int mode, int *x, int *y)
|
miPointerSetPosition(DeviceIntPtr pDev, int mode, double *screenx, double *screeny)
|
||||||
{
|
{
|
||||||
miPointerScreenPtr pScreenPriv;
|
miPointerScreenPtr pScreenPriv;
|
||||||
ScreenPtr pScreen;
|
ScreenPtr pScreen;
|
||||||
ScreenPtr newScreen;
|
ScreenPtr newScreen;
|
||||||
|
int x, y;
|
||||||
|
|
||||||
miPointerPtr pPointer;
|
miPointerPtr pPointer;
|
||||||
|
|
||||||
if (!pDev || !pDev->coreEvents)
|
if (!pDev || !pDev->coreEvents)
|
||||||
return;
|
return NULL;
|
||||||
|
|
||||||
pPointer = MIPOINTER(pDev);
|
pPointer = MIPOINTER(pDev);
|
||||||
pScreen = pPointer->pScreen;
|
pScreen = pPointer->pScreen;
|
||||||
if (!pScreen)
|
if (!pScreen)
|
||||||
return; /* called before ready */
|
return NULL; /* called before ready */
|
||||||
|
|
||||||
if (*x < 0 || *x >= pScreen->width || *y < 0 || *y >= pScreen->height)
|
x = trunc(*screenx);
|
||||||
|
y = trunc(*screeny);
|
||||||
|
|
||||||
|
if (x < 0 || x >= pScreen->width || y < 0 || y >= pScreen->height)
|
||||||
{
|
{
|
||||||
pScreenPriv = GetScreenPrivate (pScreen);
|
pScreenPriv = GetScreenPrivate (pScreen);
|
||||||
if (!pPointer->confined)
|
if (!pPointer->confined)
|
||||||
{
|
{
|
||||||
newScreen = pScreen;
|
newScreen = pScreen;
|
||||||
(*pScreenPriv->screenFuncs->CursorOffScreen) (&newScreen, x, y);
|
(*pScreenPriv->screenFuncs->CursorOffScreen) (&newScreen, &x, &y);
|
||||||
if (newScreen != pScreen)
|
if (newScreen != pScreen)
|
||||||
{
|
{
|
||||||
pScreen = newScreen;
|
pScreen = newScreen;
|
||||||
|
@ -610,23 +612,32 @@ miPointerSetPosition(DeviceIntPtr pDev, int mode, int *x, int *y)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Constrain the sprite to the current limits. */
|
/* Constrain the sprite to the current limits. */
|
||||||
if (*x < pPointer->limits.x1)
|
if (x < pPointer->limits.x1)
|
||||||
*x = pPointer->limits.x1;
|
x = pPointer->limits.x1;
|
||||||
if (*x >= pPointer->limits.x2)
|
if (x >= pPointer->limits.x2)
|
||||||
*x = pPointer->limits.x2 - 1;
|
x = pPointer->limits.x2 - 1;
|
||||||
if (*y < pPointer->limits.y1)
|
if (y < pPointer->limits.y1)
|
||||||
*y = pPointer->limits.y1;
|
y = pPointer->limits.y1;
|
||||||
if (*y >= pPointer->limits.y2)
|
if (y >= pPointer->limits.y2)
|
||||||
*y = pPointer->limits.y2 - 1;
|
y = pPointer->limits.y2 - 1;
|
||||||
|
|
||||||
if (pScreen->ConstrainCursorHarder)
|
if (pScreen->ConstrainCursorHarder)
|
||||||
pScreen->ConstrainCursorHarder(pDev, pScreen, mode, x, y);
|
pScreen->ConstrainCursorHarder(pDev, pScreen, mode, &x, &y);
|
||||||
|
|
||||||
if (pPointer->x == *x && pPointer->y == *y &&
|
if (pPointer->x != x || pPointer->y != y ||
|
||||||
pPointer->pScreen == pScreen)
|
pPointer->pScreen != pScreen)
|
||||||
return;
|
miPointerMoveNoEvent(pDev, pScreen, x, y);
|
||||||
|
|
||||||
miPointerMoveNoEvent(pDev, pScreen, *x, *y);
|
/* In the event we actually change screen or we get confined, we just
|
||||||
|
* drop the float component on the floor
|
||||||
|
* FIXME: only drop remainder for ConstrainCursorHarder, not for screen
|
||||||
|
* crossings */
|
||||||
|
if (x != trunc(*screenx))
|
||||||
|
*screenx = x;
|
||||||
|
if (y != trunc(*screeny))
|
||||||
|
*screeny = y;
|
||||||
|
|
||||||
|
return pScreen;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -131,11 +131,11 @@ extern _X_EXPORT void miPointerGetPosition(
|
||||||
|
|
||||||
/* Moves the cursor to the specified position. May clip the co-ordinates:
|
/* Moves the cursor to the specified position. May clip the co-ordinates:
|
||||||
* x and y are modified in-place. */
|
* x and y are modified in-place. */
|
||||||
extern _X_EXPORT void miPointerSetPosition(
|
extern _X_EXPORT ScreenPtr miPointerSetPosition(
|
||||||
DeviceIntPtr pDev,
|
DeviceIntPtr pDev,
|
||||||
int mode,
|
int mode,
|
||||||
int *x,
|
double *x,
|
||||||
int *y);
|
double *y);
|
||||||
|
|
||||||
extern _X_EXPORT void miPointerUpdateSprite(
|
extern _X_EXPORT void miPointerUpdateSprite(
|
||||||
DeviceIntPtr pDev);
|
DeviceIntPtr pDev);
|
||||||
|
|
Loading…
Reference in New Issue