mirror of
https://github.com/X11Libre/xserver.git
synced 2026-03-24 10:14:52 +00:00
dix: touch.c mode C99 scoped declaration
Signed-off-by: SuperDuperDeou <87223140+SuperDuperDeou@users.noreply.github.com>
This commit is contained in:
committed by
Enrico Weigelt
parent
3910a9e0b0
commit
fa6ff96f21
59
dix/touch.c
59
dix/touch.c
@@ -88,10 +88,8 @@ TouchResizeQueue(DeviceIntPtr dev)
|
||||
|
||||
tmp = reallocarray(dev->last.touches, size, sizeof(*dev->last.touches));
|
||||
if (tmp) {
|
||||
int j;
|
||||
|
||||
dev->last.touches = tmp;
|
||||
for (j = dev->last.num_touches; j < size; j++)
|
||||
for (int j = dev->last.num_touches; j < size; j++)
|
||||
TouchInitDDXTouchPoint(dev, &dev->last.touches[j]);
|
||||
dev->last.num_touches = size;
|
||||
return TRUE;
|
||||
@@ -111,12 +109,11 @@ DDXTouchPointInfoPtr
|
||||
TouchFindByDDXID(DeviceIntPtr dev, uint32_t ddx_id, Bool create)
|
||||
{
|
||||
DDXTouchPointInfoPtr ti;
|
||||
int i;
|
||||
|
||||
if (!dev->touch)
|
||||
return NULL;
|
||||
|
||||
for (i = 0; i < dev->last.num_touches; i++) {
|
||||
for (int i = 0; i < dev->last.num_touches; i++) {
|
||||
ti = &dev->last.touches[i];
|
||||
if (ti->active && ti->ddx_id == ddx_id)
|
||||
return ti;
|
||||
@@ -139,7 +136,6 @@ DDXTouchPointInfoPtr
|
||||
TouchBeginDDXTouch(DeviceIntPtr dev, uint32_t ddx_id)
|
||||
{
|
||||
static int next_client_id = 1;
|
||||
int i;
|
||||
TouchClassPtr t = dev->touch;
|
||||
DDXTouchPointInfoPtr ti = NULL;
|
||||
Bool emulate_pointer;
|
||||
@@ -155,7 +151,7 @@ TouchBeginDDXTouch(DeviceIntPtr dev, uint32_t ddx_id)
|
||||
return NULL;
|
||||
|
||||
for (;;) {
|
||||
for (i = 0; i < dev->last.num_touches; i++) {
|
||||
for (int i = 0; i < dev->last.num_touches; i++) {
|
||||
/* Only emulate pointer events on the first touch */
|
||||
if (dev->last.touches[i].active)
|
||||
emulate_pointer = FALSE;
|
||||
@@ -238,7 +234,6 @@ void
|
||||
TouchFreeTouchPoint(DeviceIntPtr device, int index)
|
||||
{
|
||||
TouchPointInfoPtr ti;
|
||||
int i;
|
||||
|
||||
if (!device->touch || index >= device->touch->num_touches)
|
||||
return;
|
||||
@@ -247,7 +242,7 @@ TouchFreeTouchPoint(DeviceIntPtr device, int index)
|
||||
if (ti->active)
|
||||
TouchEndTouch(device, ti);
|
||||
|
||||
for (i = 0; i < ti->num_listeners; i++)
|
||||
for (int i = 0; i < ti->num_listeners; i++)
|
||||
TouchRemoveListener(ti, ti->listeners[0].listener);
|
||||
|
||||
valuator_mask_free(&ti->valuators);
|
||||
@@ -270,12 +265,11 @@ TouchFindByClientID(DeviceIntPtr dev, uint32_t client_id)
|
||||
{
|
||||
TouchClassPtr t = dev->touch;
|
||||
TouchPointInfoPtr ti;
|
||||
int i;
|
||||
|
||||
if (!t)
|
||||
return NULL;
|
||||
|
||||
for (i = 0; i < t->num_touches; i++) {
|
||||
for (int i = 0; i < t->num_touches; i++) {
|
||||
ti = &t->touches[i];
|
||||
if (ti->active && ti->client_id == client_id)
|
||||
return ti;
|
||||
@@ -295,7 +289,6 @@ TouchPointInfoPtr
|
||||
TouchBeginTouch(DeviceIntPtr dev, int sourceid, uint32_t touchid,
|
||||
Bool emulate_pointer)
|
||||
{
|
||||
int i;
|
||||
TouchClassPtr t = dev->touch;
|
||||
TouchPointInfoPtr ti;
|
||||
void *tmp;
|
||||
@@ -312,7 +305,7 @@ TouchBeginTouch(DeviceIntPtr dev, int sourceid, uint32_t touchid,
|
||||
return NULL;
|
||||
|
||||
try_find_touch:
|
||||
for (i = 0; i < t->num_touches; i++) {
|
||||
for (int i = 0; i < t->num_touches; i++) {
|
||||
ti = &t->touches[i];
|
||||
if (!ti->active) {
|
||||
ti->active = TRUE;
|
||||
@@ -344,8 +337,6 @@ TouchBeginTouch(DeviceIntPtr dev, int sourceid, uint32_t touchid,
|
||||
void
|
||||
TouchEndTouch(DeviceIntPtr dev, TouchPointInfoPtr ti)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (ti->emulate_pointer) {
|
||||
GrabPtr grab;
|
||||
|
||||
@@ -357,7 +348,7 @@ TouchEndTouch(DeviceIntPtr dev, TouchPointInfoPtr ti)
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < ti->num_listeners; i++)
|
||||
for (int i = 0; i < ti->num_listeners; i++)
|
||||
TouchRemoveListener(ti, ti->listeners[0].listener);
|
||||
|
||||
ti->active = FALSE;
|
||||
@@ -447,14 +438,12 @@ TouchEventHistoryPush(TouchPointInfoPtr ti, const DeviceEvent *ev)
|
||||
void
|
||||
TouchEventHistoryReplay(TouchPointInfoPtr ti, DeviceIntPtr dev, XID resource)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!ti->history)
|
||||
return;
|
||||
|
||||
DeliverDeviceClassesChangedEvent(ti->sourceid, ti->history[0].time);
|
||||
|
||||
for (i = 0; i < ti->history_elements; i++) {
|
||||
for (int i = 0; i < ti->history_elements; i++) {
|
||||
DeviceEvent *ev = &ti->history[i];
|
||||
|
||||
ev->flags |= TOUCH_REPLAYING;
|
||||
@@ -668,10 +657,7 @@ TouchAddListener(TouchPointInfoPtr ti, XID resource, int resource_type,
|
||||
Bool
|
||||
TouchRemoveListener(TouchPointInfoPtr ti, XID resource)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ti->num_listeners; i++) {
|
||||
int j;
|
||||
for (int i = 0; i < ti->num_listeners; i++) {
|
||||
TouchListener *listener = &ti->listeners[i];
|
||||
|
||||
if (listener->listener != resource)
|
||||
@@ -683,7 +669,7 @@ TouchRemoveListener(TouchPointInfoPtr ti, XID resource)
|
||||
ti->num_grabs--;
|
||||
}
|
||||
|
||||
for (j = i; j < ti->num_listeners - 1; j++)
|
||||
for (int j = i; j < ti->num_listeners - 1; j++)
|
||||
ti->listeners[j] = ti->listeners[j + 1];
|
||||
ti->num_listeners--;
|
||||
ti->listeners[ti->num_listeners].listener = 0;
|
||||
@@ -842,7 +828,6 @@ TouchAddActiveGrabListener(DeviceIntPtr dev, TouchPointInfoPtr ti,
|
||||
void
|
||||
TouchSetupListeners(DeviceIntPtr dev, TouchPointInfoPtr ti, InternalEvent *ev)
|
||||
{
|
||||
int i;
|
||||
SpritePtr sprite = &ti->sprite;
|
||||
WindowPtr win;
|
||||
|
||||
@@ -856,14 +841,14 @@ TouchSetupListeners(DeviceIntPtr dev, TouchPointInfoPtr ti, InternalEvent *ev)
|
||||
|
||||
/* First, find all grabbing clients from the root window down
|
||||
* to the deepest child window. */
|
||||
for (i = 0; i < sprite->spriteTraceGood; i++) {
|
||||
for (int i = 0; i < sprite->spriteTraceGood; i++) {
|
||||
win = sprite->spriteTrace[i];
|
||||
TouchAddPassiveGrabListener(dev, ti, win, ev);
|
||||
}
|
||||
|
||||
/* Find the first client with an applicable event selection,
|
||||
* going from deepest child window back up to the root window. */
|
||||
for (i = sprite->spriteTraceGood - 1; i >= 0; i--) {
|
||||
for (int i = sprite->spriteTraceGood - 1; i >= 0; i--) {
|
||||
Bool delivered;
|
||||
|
||||
win = sprite->spriteTrace[i];
|
||||
@@ -909,29 +894,28 @@ void
|
||||
TouchListenerGone(XID resource)
|
||||
{
|
||||
TouchPointInfoPtr ti;
|
||||
DeviceIntPtr dev;
|
||||
InternalEvent *events = InitEventList(GetMaximumEventsNum());
|
||||
int i, j, k, nev;
|
||||
int nev;
|
||||
|
||||
if (!events)
|
||||
FatalError("TouchListenerGone: couldn't allocate events\n");
|
||||
|
||||
for (dev = inputInfo.devices; dev; dev = dev->next) {
|
||||
for (DeviceIntPtr dev = inputInfo.devices; dev; dev = dev->next) {
|
||||
if (!dev->touch)
|
||||
continue;
|
||||
|
||||
for (i = 0; i < dev->touch->num_touches; i++) {
|
||||
for (int i = 0; i < dev->touch->num_touches; i++) {
|
||||
ti = &dev->touch->touches[i];
|
||||
if (!ti->active)
|
||||
continue;
|
||||
|
||||
for (j = 0; j < ti->num_listeners; j++) {
|
||||
for (int j = 0; j < ti->num_listeners; j++) {
|
||||
if (CLIENT_BITS(ti->listeners[j].listener) != resource)
|
||||
continue;
|
||||
|
||||
nev = GetTouchOwnershipEvents(events, dev, ti, XIRejectTouch,
|
||||
ti->listeners[j].listener, 0);
|
||||
for (k = 0; k < nev; k++)
|
||||
for (int k = 0; k < nev; k++)
|
||||
mieqProcessDeviceEvent(dev, events + k, NULL);
|
||||
|
||||
break;
|
||||
@@ -948,7 +932,6 @@ TouchListenerAcceptReject(DeviceIntPtr dev, TouchPointInfoPtr ti, int listener,
|
||||
{
|
||||
InternalEvent *events;
|
||||
int nev;
|
||||
int i;
|
||||
|
||||
BUG_RETURN_VAL(listener < 0, BadMatch);
|
||||
BUG_RETURN_VAL(listener >= ti->num_listeners, BadMatch);
|
||||
@@ -969,7 +952,7 @@ TouchListenerAcceptReject(DeviceIntPtr dev, TouchPointInfoPtr ti, int listener,
|
||||
ti->listeners[0].listener, 0);
|
||||
BUG_WARN_MSG(nev == 0, "Failed to get touch ownership events\n");
|
||||
|
||||
for (i = 0; i < nev; i++)
|
||||
for (int i = 0; i < nev; i++)
|
||||
mieqProcessDeviceEvent(dev, events + i, NULL);
|
||||
|
||||
FreeEventList(events, GetMaximumEventsNum());
|
||||
@@ -1013,19 +996,17 @@ void
|
||||
TouchEndPhysicallyActiveTouches(DeviceIntPtr dev)
|
||||
{
|
||||
InternalEvent *eventlist = InitEventList(GetMaximumEventsNum());
|
||||
int i;
|
||||
|
||||
input_lock();
|
||||
mieqProcessInputEvents();
|
||||
for (i = 0; i < dev->last.num_touches; i++) {
|
||||
for (int i = 0; i < dev->last.num_touches; i++) {
|
||||
DDXTouchPointInfoPtr ddxti = dev->last.touches + i;
|
||||
|
||||
if (ddxti->active) {
|
||||
int j;
|
||||
int nevents = GetTouchEvents(eventlist, dev, ddxti->ddx_id,
|
||||
XI_TouchEnd, 0, NULL);
|
||||
|
||||
for (j = 0; j < nevents; j++)
|
||||
for (int j = 0; j < nevents; j++)
|
||||
mieqProcessDeviceEvent(dev, eventlist + j, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user