[PATCH v2 07/14] Log messages in GetTouchEvents() in a signal safe manner

Chase Douglas chase.douglas at canonical.com
Mon Apr 9 11:17:33 PDT 2012


Signed-off-by: Chase Douglas <chase.douglas at canonical.com>
---
 dix/getevents.c |   14 ++++++++++++--
 dix/touch.c     |   11 +++++++++--
 2 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/dix/getevents.c b/dix/getevents.c
index 3093786..09b8c00 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -1822,8 +1822,18 @@ GetTouchEvents(InternalEvent *events, DeviceIntPtr dev, uint32_t ddx_touchid,
         touchpoint.ti =
             TouchFindByDDXID(dev, ddx_touchid, (type == XI_TouchBegin));
         if (!touchpoint.ti) {
-            ErrorF("[dix] %s: unable to %s touch point %x\n", dev->name,
-                   type == XI_TouchBegin ? "begin" : "find", ddx_touchid);
+            char string[20];
+
+            LogMessageVerbSigSafe(X_NONE, -1, "[dix] ");
+            LogMessageVerbSigSafe(X_NONE, -1, dev->name);
+            LogMessageVerbSigSafe(X_NONE, -1, ": unable to ");
+            LogMessageVerbSigSafe(X_NONE, -1,
+                                  (type == XI_TouchBegin ? "begin " : "find "));
+            LogMessageVerbSigSafe(X_NONE, -1, "touch point ");
+            FormatUInt64(ddx_touchid, string);
+            LogMessageVerbSigSafe(X_NONE, -1, string);
+            LogMessageVerbSigSafe(X_NONE, -1, "\n");
+
             return 0;
         }
         client_id = touchpoint.ti->client_id;
diff --git a/dix/touch.c b/dix/touch.c
index 0829b65..61e6d53 100644
--- a/dix/touch.c
+++ b/dix/touch.c
@@ -161,6 +161,7 @@ TouchBeginDDXTouch(DeviceIntPtr dev, uint32_t ddx_id)
     TouchClassPtr t = dev->touch;
     DDXTouchPointInfoPtr ti = NULL;
     Bool emulate_pointer = (t->mode == XIDirectTouch);
+    char number[20];
 
     if (!t)
         return NULL;
@@ -198,8 +199,14 @@ TouchBeginDDXTouch(DeviceIntPtr dev, uint32_t ddx_id)
     /* If we get here, then we've run out of touches and we need to drop the
      * event (we're inside the SIGIO handler here) schedule a WorkProc to
      * grow the queue for us for next time. */
-    ErrorF("%s: not enough space for touch events (max %d touchpoints). "
-           "Dropping this event.\n", dev->name, dev->last.num_touches);
+    FormatUInt32(dev->last.num_touches, number);
+
+    LogMessageVerbSigSafe(X_NONE, -1, dev->name);
+    LogMessageVerbSigSafe(X_NONE, -1,
+                          ": not enough space for touch events (max ");
+    LogMessageVerbSigSafe(X_NONE, -1, number);
+    LogMessageVerbSigSafe(X_NONE, -1, " touchpoints). Dropping this event.\n");
+
     if (!BitIsOn(resize_waiting, dev->id)) {
         SetBit(resize_waiting, dev->id);
         QueueWorkProc(TouchResizeQueue, serverClient, NULL);
-- 
1.7.9.1



More information about the xorg-devel mailing list