summaryrefslogtreecommitdiff
path: root/record
diff options
context:
space:
mode:
authorChris Dekter <cdekter@gmail.com>2010-02-11 16:34:09 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2010-02-22 12:04:28 +1000
commit122fc0e7a0712df4ec2bd9ca6773f90bcd2095cf (patch)
treebdc79853a12460f5261d2df21b4469601d8cfc25 /record
parent4e8bf12b13690afa6d9fee0e339d3819ef16fb3f (diff)
Re-enable RECORD extension.
RECORD was disabled during the switch to internal events. This patch modifies the record callback to work with internal events instead of xEvents. The InternalEvents are converted to core/Xi events as needed. Since record is a loadable extension, the EventTo* calls must be externed. Signed-off-by: Chris Dekter <cdekter@gmail.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'record')
-rw-r--r--record/record.c123
1 files changed, 70 insertions, 53 deletions
diff --git a/record/record.c b/record/record.c
index 242544f5d..1a10c9edc 100644
--- a/record/record.c
+++ b/record/record.c
@@ -42,6 +42,8 @@ and Jim Haggerty of Metheus.
#include "set.h"
#include "swaprep.h"
#include "inputstr.h"
+#include "eventconvert.h"
+
#include <stdio.h>
#include <assert.h>
@@ -139,7 +141,8 @@ static int RecordDeleteContext(
XID /*id*/
);
-
+void RecordExtensionInit(void);
+
/***************************************************************************/
/* client private stuff */
@@ -727,6 +730,59 @@ RecordADeliveredEventOrError(CallbackListPtr *pcbl, pointer nulldata, pointer ca
} /* RecordADeliveredEventOrError */
+static void
+RecordSendProtocolEvents(RecordClientsAndProtocolPtr pRCAP,
+ RecordContextPtr pContext,
+ xEvent* pev, int count)
+{
+ int ev; /* event index */
+
+ for (ev = 0; ev < count; ev++, pev++)
+ {
+ if (RecordIsMemberOfSet(pRCAP->pDeviceEventSet,
+ pev->u.u.type & 0177))
+ {
+ xEvent swappedEvent;
+ xEvent *pEvToRecord = pev;
+#ifdef PANORAMIX
+ xEvent shiftedEvent;
+
+ if (!noPanoramiXExtension &&
+ (pev->u.u.type == MotionNotify ||
+ pev->u.u.type == ButtonPress ||
+ pev->u.u.type == ButtonRelease ||
+ pev->u.u.type == KeyPress ||
+ pev->u.u.type == KeyRelease)) {
+ int scr = XineramaGetCursorScreen(inputInfo.pointer);
+ memcpy(&shiftedEvent, pev, sizeof(xEvent));
+ shiftedEvent.u.keyButtonPointer.rootX +=
+ panoramiXdataPtr[scr].x -
+ panoramiXdataPtr[0].x;
+ shiftedEvent.u.keyButtonPointer.rootY +=
+ panoramiXdataPtr[scr].y -
+ panoramiXdataPtr[0].y;
+ pEvToRecord = &shiftedEvent;
+ }
+#endif /* PANORAMIX */
+
+ if (pContext->pRecordingClient->swapped)
+ {
+ (*EventSwapVector[pEvToRecord->u.u.type & 0177])
+ (pEvToRecord, &swappedEvent);
+ pEvToRecord = &swappedEvent;
+ }
+
+ RecordAProtocolElement(pContext, NULL,
+ XRecordFromServer, pEvToRecord, SIZEOF(xEvent), 0);
+ /* make sure device events get flushed in the absence
+ * of other client activity
+ */
+ SetCriticalOutputPending();
+ }
+ } /* end for each event */
+
+} /* RecordADeviceEvent */
+
/* RecordADeviceEvent
*
* Arguments:
@@ -756,55 +812,24 @@ RecordADeviceEvent(CallbackListPtr *pcbl, pointer nulldata, pointer calldata)
{
if (pRCAP->pDeviceEventSet)
{
- int ev; /* event index */
- xEvent *pev = pei->events;
- for (ev = 0; ev < pei->count; ev++, pev++)
- {
- if (RecordIsMemberOfSet(pRCAP->pDeviceEventSet,
- pev->u.u.type & 0177))
- {
- xEvent swappedEvent;
- xEvent *pEvToRecord = pev;
-#ifdef PANORAMIX
- xEvent shiftedEvent;
-
- if (!noPanoramiXExtension &&
- (pev->u.u.type == MotionNotify ||
- pev->u.u.type == ButtonPress ||
- pev->u.u.type == ButtonRelease ||
- pev->u.u.type == KeyPress ||
- pev->u.u.type == KeyRelease)) {
- int scr = XineramaGetCursorScreen(inputInfo.pointer);
- memcpy(&shiftedEvent, pev, sizeof(xEvent));
- shiftedEvent.u.keyButtonPointer.rootX +=
- panoramiXdataPtr[scr].x -
- panoramiXdataPtr[0].x;
- shiftedEvent.u.keyButtonPointer.rootY +=
- panoramiXdataPtr[scr].y -
- panoramiXdataPtr[0].y;
- pEvToRecord = &shiftedEvent;
- }
-#endif /* PANORAMIX */
+ int count;
+ xEvent *xi_events = NULL;
- if (pContext->pRecordingClient->swapped)
- {
- (*EventSwapVector[pEvToRecord->u.u.type & 0177])
- (pEvToRecord, &swappedEvent);
- pEvToRecord = &swappedEvent;
- }
+ /* TODO check return values */
+ if (IsMaster(pei->device))
+ {
+ xEvent xE;
+ EventToCore(pei->event, &xE);
+ RecordSendProtocolEvents(pRCAP, pContext, &xE, 1);
+ }
- RecordAProtocolElement(pContext, NULL,
- XRecordFromServer, pEvToRecord, SIZEOF(xEvent), 0);
- /* make sure device events get flushed in the absence
- * of other client activity
- */
- SetCriticalOutputPending();
- }
- } /* end for each event */
+ EventToXI(pei->event, &xi_events, &count);
+ RecordSendProtocolEvents(pRCAP, pContext, xi_events, count);
+ xfree(xi_events);
} /* end this RCAP selects device events */
} /* end for each RCAP on this context */
} /* end for each enabled context */
-} /* RecordADeviceEvent */
+}
/* RecordFlushAllContexts
@@ -2866,13 +2891,6 @@ RecordCloseDown(ExtensionEntry *extEntry)
void
RecordExtensionInit(void)
{
- /* FIXME Record is currently broken. Dont initialize it so that clients
- * that require it can bail out correctly rather than waiting for stuff
- * that'll never happen */
- ErrorF("record: RECORD extension enabled at configure time.\n");
- ErrorF("record: This extension is known to be broken, disabling extension now..\n");
- ErrorF("record: http://bugs.freedesktop.org/show_bug.cgi?id=20500\n");
-#if 0
ExtensionEntry *extentry;
RTContext = CreateNewResourceType(RecordDeleteContext, "RecordContext");
@@ -2895,6 +2913,5 @@ RecordExtensionInit(void)
}
RecordErrorBase = extentry->errorBase;
-#endif
} /* RecordExtensionInit */