aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/dix/getevents.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-10-26 10:58:41 +0200
committermarha <marha@users.sourceforge.net>2011-10-26 10:58:41 +0200
commit4f005bade376d15ee60e90ca45a831aff9725087 (patch)
tree5abdbe5a7c55acf9e30c533414796f629fa9e47c /xorg-server/dix/getevents.c
parent9f986778bd4393c5a9108426969d45aa7f10f334 (diff)
downloadvcxsrv-4f005bade376d15ee60e90ca45a831aff9725087.tar.gz
vcxsrv-4f005bade376d15ee60e90ca45a831aff9725087.tar.bz2
vcxsrv-4f005bade376d15ee60e90ca45a831aff9725087.zip
libX11 libXft mesa mkfontscale pixman xserver git update 26 okt 2011
Diffstat (limited to 'xorg-server/dix/getevents.c')
-rw-r--r--xorg-server/dix/getevents.c42
1 files changed, 28 insertions, 14 deletions
diff --git a/xorg-server/dix/getevents.c b/xorg-server/dix/getevents.c
index 874189f57..4845a106c 100644
--- a/xorg-server/dix/getevents.c
+++ b/xorg-server/dix/getevents.c
@@ -209,7 +209,7 @@ void
CreateClassesChangedEvent(InternalEvent* event,
DeviceIntPtr master,
DeviceIntPtr slave,
- int type)
+ int flags)
{
int i;
DeviceChangedEvent *dce;
@@ -218,13 +218,12 @@ CreateClassesChangedEvent(InternalEvent* event,
dce = &event->changed_event;
memset(dce, 0, sizeof(DeviceChangedEvent));
dce->deviceid = slave->id;
- dce->masterid = master->id;
+ dce->masterid = master ? master->id : 0;
dce->header = ET_Internal;
dce->length = sizeof(DeviceChangedEvent);
dce->type = ET_DeviceChanged;
dce->time = ms;
- dce->flags = type;
- dce->flags |= DEVCHANGE_SLAVE_SWITCH;
+ dce->flags = flags;
dce->sourceid = slave->id;
if (slave->button)
@@ -243,6 +242,7 @@ CreateClassesChangedEvent(InternalEvent* event,
dce->valuators[i].resolution = slave->valuator->axes[i].resolution;
dce->valuators[i].mode = slave->valuator->axes[i].mode;
dce->valuators[i].name = slave->valuator->axes[i].label;
+ dce->valuators[i].scroll = slave->valuator->axes[i].scroll;
}
}
if (slave->key)
@@ -673,7 +673,7 @@ UpdateFromMaster(InternalEvent* events, DeviceIntPtr dev, int type, int *num_eve
if (master && master->last.slave != dev)
{
- CreateClassesChangedEvent(events, master, dev, type);
+ CreateClassesChangedEvent(events, master, dev, type | DEVCHANGE_SLAVE_SWITCH);
if (IsPointerDevice(master))
{
updateSlaveDeviceCoords(master, dev);
@@ -1228,6 +1228,7 @@ fill_pointer_events(InternalEvent *events, DeviceIntPtr pDev, int type,
*
* @param events The pointer to the event list to fill the events
* @param dev The device to generate the events for
+ * @param type The real type of the event
* @param axis The axis number to generate events for
* @param mask State before this event in absolute coords
* @param[in,out] last Last scroll state posted in absolute coords (modified
@@ -1239,6 +1240,7 @@ fill_pointer_events(InternalEvent *events, DeviceIntPtr pDev, int type,
static int
emulate_scroll_button_events(InternalEvent *events,
DeviceIntPtr dev,
+ int type,
int axis,
const ValuatorMask *mask,
ValuatorMask *last,
@@ -1251,6 +1253,7 @@ emulate_scroll_button_events(InternalEvent *events,
int num_events = 0;
double total;
int b;
+ int flags = 0;
if (dev->valuator->axes[axis].scroll.type == SCROLL_TYPE_NONE)
return 0;
@@ -1261,6 +1264,9 @@ emulate_scroll_button_events(InternalEvent *events,
ax = &dev->valuator->axes[axis];
incr = ax->scroll.increment;
+ if (type != ButtonPress && type != ButtonRelease)
+ flags |= POINTER_EMULATED;
+
if (!valuator_mask_isset(last, axis))
valuator_mask_set_double(last, axis, 0);
@@ -1288,14 +1294,20 @@ emulate_scroll_button_events(InternalEvent *events,
*/
if (num_events + 4 < max_events)
{
- nev_tmp = fill_pointer_events(events, dev, ButtonPress, b, ms,
- POINTER_EMULATED, NULL);
- events += nev_tmp;
- num_events += nev_tmp;
- nev_tmp = fill_pointer_events(events, dev, ButtonRelease, b, ms,
- POINTER_EMULATED, NULL);
- events += nev_tmp;
- num_events += nev_tmp;
+ if (type != ButtonRelease)
+ {
+ nev_tmp = fill_pointer_events(events, dev, ButtonPress, b, ms,
+ flags, NULL);
+ events += nev_tmp;
+ num_events += nev_tmp;
+ }
+ if (type != ButtonPress)
+ {
+ nev_tmp = fill_pointer_events(events, dev, ButtonRelease, b, ms,
+ flags, NULL);
+ events += nev_tmp;
+ num_events += nev_tmp;
+ }
}
}
@@ -1340,6 +1352,7 @@ GetPointerEvents(InternalEvent *events, DeviceIntPtr pDev, int type,
ValuatorMask mask;
ValuatorMask scroll;
int i;
+ int realtype = type;
/* refuse events from disabled devices */
if (!pDev->enabled)
@@ -1392,6 +1405,7 @@ GetPointerEvents(InternalEvent *events, DeviceIntPtr pDev, int type,
valuator_mask_set_double(&mask, axis, val);
type = MotionNotify;
buttons = 0;
+ flags |= POINTER_EMULATED;
}
}
@@ -1411,7 +1425,7 @@ GetPointerEvents(InternalEvent *events, DeviceIntPtr pDev, int type,
valuator_mask_set_double(&scroll, i, pDev->last.valuators[i]);
- nev_tmp = emulate_scroll_button_events(events, pDev, i, &scroll,
+ nev_tmp = emulate_scroll_button_events(events, pDev, realtype, i, &scroll,
pDev->last.scroll, ms,
GetMaximumEventsNum() - num_events);
events += nev_tmp;