printf("\n");
}
-static void _xEvlogAnalyzePrint (EvlogOption *eo, char* reply, int* len)
+
+static void _xEvlogAnalyzePrint (Display* dpy, EvlogOption *eo, char* reply, int* len)
{
int fd = -1, cfd = -1;
int total, read_len;
if (xDbgEvlogRuleValidate (&evinfo))
{
- xDbgEvlogFillLog(&evinfo, eo->detail, log, &size);
+ xDbgEvlogFillLog(dpy, &evinfo, eo->detail, log, &size);
printf ("%s", log);
}
static void
-_checkOption(int argc, char** argv)
+_checkOption(Display* dpy, int argc, char** argv)
{
int c;
int opt_str_len = 0;
}
}
- _xEvlogAnalyzePrint(&eo, rule_log, &rule_size);
+ _xEvlogAnalyzePrint(dpy, &eo, rule_log, &rule_size);
}
char **new_argv;
int new_argc, i;
char temp[128];
+ Display *dpy;
+
+ dpy = XOpenDisplay (NULL);
+ if (!dpy)
+ {
+ printf ("failed: open display\n");
+ exit (-1);
+ }
new_argc = argc + 1;
new_argv = (char**)malloc (new_argc * sizeof (char*));
for (i = 0; i < argc; i++)
new_argv[i+1] = argv[i];
- _checkOption(new_argc, new_argv);
+ _checkOption(dpy, new_argc, new_argv);
free (new_argv);
+ XCloseDisplay (dpy);
return 0;
-}
\ No newline at end of file
+}
#include "xdbg_types.h"
#include "xdbg_evlog.h"
#include "bool_exp_rule_checker.h"
+#include <X11/Xlibint.h>
+
+#ifndef XDBG_CLIENT
+#include "resource.h"
+#include "region.h"
+#include "dix.h"
+#endif
static char *evt_type[] = { "Event", "Request", "Reply", "Flush" };
static char *evt_dir[] = { "<====", "---->", "<----", "*****" };
static Bool
-_EvlogGetExtentionEntry (int *return_extensions_size)
+_EvlogGetExtentionEntry (void *dpy, int *return_extensions_size)
{
static int init = 0;
static Bool success = FALSE;
- Display *dpy = NULL;
int i;
if (init)
init = 1;
-#ifdef XDBG_CLIENT
- dpy = XOpenDisplay (NULL);
- if (!dpy)
- {
- XDBG_LOG ("failed: open display\n");
- exit (-1);
- }
-#endif
-
for (i = 0 ; i < sizeof (Evlog_extensions) / sizeof (ExtensionInfo); i++)
{
Evlog_extensions[i].get_base_func (dpy, Evlog_extensions + i);
if(!_SortEvlogExtensions ())
return FALSE;
-#ifdef XDBG_CLIENT
- XCloseDisplay (dpy);
-#endif
-
*return_extensions_size = sizeof(Evlog_extensions);
success = TRUE;
void
-xDbgEvlogFillLog (EvlogInfo *evinfo, Bool on, char *reply, int *len)
+xDbgEvlogFillLog (void *dpy, EvlogInfo *evinfo, Bool on, char *reply, int *len)
{
static CARD32 prev;
static int Extensions_size = 0;
evt_dir[evinfo->type],
evt_type[evinfo->type]);
- if (evinfo->type == REQUEST && _EvlogGetExtentionEntry (&Extensions_size))
+ if (evinfo->type == REQUEST && _EvlogGetExtentionEntry (dpy, &Extensions_size))
{
REPLY ("(");
- reply = xDbgEvlogReqeust (evinfo, on, Extensions_size, reply, len);
+ reply = xDbgEvlogReqeust (dpy, evinfo, on, Extensions_size, reply, len);
REPLY (")");
}
- else if (evinfo->type == EVENT && _EvlogGetExtentionEntry (&Extensions_size))
+ else if (evinfo->type == EVENT && _EvlogGetExtentionEntry (dpy, &Extensions_size))
{
REPLY ("(");
- reply = xDbgEvlogEvent (evinfo, on, Extensions_size, reply, len);
+ reply = xDbgEvlogEvent (dpy, evinfo, on, Extensions_size, reply, len);
REPLY (")");
}
else
+#ifdef XDBG_CLIENT
+Bool get_error_caught;
+
+static int
+_get_error_handle (Display *dpy, XErrorEvent *ev)
+{
+ if (!dpy)
+ return 0;
+
+ get_error_caught = True;
+ return 0;
+}
+#endif
+
+char* xDbgGetAtom(void *dpy, Atom atom, char *reply, int *len)
+{
+#ifdef XDBG_CLIENT
+ Display *d = NULL;
+ XErrorHandler old_handler = NULL;
+
+ RETURN_VAL_IF_FAIL(dpy != NULL, reply);
+
+ get_error_caught = False;
+ d = (Display*)dpy;
+
+ XSync (d, 0);
+ old_handler = XSetErrorHandler (_get_error_handle);
+
+ if(XGetAtomName(d, atom))
+ REPLY("(%s)", XGetAtomName(d, atom));
+ else
+ REPLY("(0x%lx)", atom);
+
+ get_error_caught = False;
+ XSetErrorHandler (old_handler);
+#else
+ if (NameForAtom(atom))
+ REPLY("(%s)", (char*)NameForAtom(atom));
+ else
+ REPLY("(0x%lx)", atom);
+#endif
+
+ return reply;
+}
+
+char* xDbgGetRegion(void* dpy, EvlogInfo *evinfo, XserverRegion region, char *reply, int *len)
+{
+#ifdef XDBG_CLIENT
+ int nrect, i;
+ XRectangle *rects;
+ Display *d = (Display*)dpy;
+ XErrorHandler old_handler = NULL;
+
+ RETURN_VAL_IF_FAIL(dpy != NULL, reply);
+
+ get_error_caught = False;
+ d = (Display*)dpy;
+
+ XSync (d, 0);
+ old_handler = XSetErrorHandler (_get_error_handle);
+
+ rects = XFixesFetchRegion(d, region, &nrect);
+ if (!get_error_caught)
+ {
+ REPLY ("(");
+ for (i = 0; i < nrect; i++)
+ {
+ REPLY ("[%d,%d %dx%d]",
+ rects[i].x,
+ rects[i].y,
+ rects[i].width,
+ rects[i].height);
+ if(i != nrect - 1)
+ REPLY (",");
+ }
+ REPLY (")");
+ }
+ else
+ REPLY ("(0x%lx)", region);
+
+ get_error_caught = False;
+ XSetErrorHandler (old_handler);
+#else
+ extern _X_EXPORT RESTYPE RegionResType;
+ RegionPtr pRegion;
+ BoxPtr rects;
+ int nrect, i;
+
+ int err = dixLookupResourceByType((pointer *) &pRegion, region,
+ RegionResType, (ClientPtr)evinfo->client.pClient,
+ DixReadAccess);
+ if (err != Success)
+ {
+ REPLY ("(0x%lx)", region);
+ return reply;
+ }
+
+ nrect = RegionNumRects(pRegion);
+ rects = RegionRects(pRegion);
+
+ REPLY ("(");
+ for (i = 0; i < nrect; i++)
+ {
+ REPLY ("[%d,%d %dx%d]",
+ rects[i].x1,
+ rects[i].y1,
+ rects[i].x2 - rects[i].x1,
+ rects[i].y2 - rects[i].y1);
+ if(i != nrect - 1)
+ REPLY (",");
+ }
+ REPLY (")");
+#endif
+
+ return reply;
+}
#include "xdbg_evlog_xv.h"
-char* xDbgEvlogGetCmd (char *path);
-Bool xDbgEvlogRuleSet (const int argc, const char **argv, char *reply, int *len);
-Bool xDbgEvlogRuleValidate (EvlogInfo *evinfo);
-void xDbgEvlogFillLog (EvlogInfo *evinfo, Bool on, char *reply, int *len);
+char* xDbgEvlogGetCmd (char *path);
+Bool xDbgEvlogRuleSet (const int argc, const char **argv, char *reply, int *len);
+Bool xDbgEvlogRuleValidate (EvlogInfo *evinfo);
+void xDbgEvlogFillLog (void* dpy, EvlogInfo *evinfo, Bool on, char *reply, int *len);
+
+char* xDbgGetAtom (void* dpy, Atom atom, char *reply, int *len);
+char* xDbgGetRegion (void* dpy, EvlogInfo *evinfo, XserverRegion region, char *reply, int *len);
#endif
#include "xdbg_types.h"
#include "xdbg_evlog_composite.h"
+#include "xdbg_evlog.h"
static char *
-_EvlogRequestComposite(xReq *req, char *reply, int *len)
+_EvlogRequestComposite(void *dpy, EvlogInfo *evinfo, char *reply, int *len)
{
- xReq *stuff = req;
+ xReq *req = evinfo->req.ptr;
- switch (stuff->data)
+ switch (req->data)
{
case X_CompositeRedirectWindow:
{
}
static char *
-_EvlogEventComposite (xEvent *evt, int first_base, char *reply, int *len)
+_EvlogEventComposite (void *dpy, EvlogInfo *evinfo, int first_base, char *reply, int *len)
{
- xEvent *stuff = evt;
+ xEvent *evt = evinfo->evt.ptr;
- switch ((stuff->u.u.type & 0x7F) - first_base)
+ switch ((evt->u.u.type & 0x7F) - first_base)
{
default:
#include "xdbg_types.h"
#include "xdbg_evlog_core.h"
+#include "xdbg_evlog.h"
-char * xDbgEvlogRequestCore (xReq *req, char *reply, int *len)
+char * xDbgEvlogRequestCore (void *dpy, EvlogInfo *evinfo, char *reply, int *len)
{
- xReq *stuff = req;
+ xReq *req = evinfo->req.ptr;
- switch (stuff->reqType)
+ switch (req->reqType)
{
case X_CreateWindow:
{
case X_ChangeProperty:
{
xChangePropertyReq *stuff = (xChangePropertyReq *)req;
- REPLY (": XID(0x%lx) Property(0x%lx) Type(0x%lx)",
- stuff->window,
- stuff->property,
- stuff->type);
+ REPLY (": XID(0x%lx)",
+ stuff->window);
+
+ REPLY (" Property");
+ reply = xDbgGetAtom(dpy, stuff->property, reply, len);
+ REPLY (" Type");
+ reply = xDbgGetAtom(dpy, stuff->type, reply, len);
return reply;
}
case X_DeleteProperty:
{
xDeletePropertyReq *stuff = (xDeletePropertyReq *)req;
- REPLY (": XID(0x%lx) Property(0x%lx)",
- stuff->window,
- stuff->property);
+ REPLY (": XID(0x%lx)",
+ stuff->window);
+
+ REPLY (" Property");
+ reply = xDbgGetAtom(dpy, stuff->property, reply, len);
return reply;
}
case X_SetSelectionOwner:
{
xSetSelectionOwnerReq *stuff = (xSetSelectionOwnerReq *)req;
- REPLY (": XID(0x%lx) Selection(0x%lx)",
- stuff->window,
- stuff->selection);
+ REPLY (": XID(0x%lx)",
+ stuff->window);
+
+ REPLY (" Selection");
+ reply = xDbgGetAtom(dpy, stuff->selection, reply, len);
return reply;
}
case X_ConvertSelection:
{
xConvertSelectionReq *stuff = (xConvertSelectionReq *)req;
- REPLY (": XID(0x%lx) Selection(0x%lx) Target(0x%lx) Property(0x%lx)",
- stuff->requestor,
- stuff->selection,
- stuff->target,
- stuff->property);
+ REPLY (": XID(0x%lx)",
+ stuff->requestor);
+
+ REPLY (" Selection");
+ reply = xDbgGetAtom(dpy, stuff->selection, reply, len);
+ REPLY (" Target");
+ reply = xDbgGetAtom(dpy, stuff->target, reply, len);
+ REPLY (" Property");
+ reply = xDbgGetAtom(dpy, stuff->property, reply, len);
return reply;
}
}
-char * xDbgEvlogEventCore (xEvent *evt, char *reply, int *len)
+char * xDbgEvlogEventCore (void *dpy, EvlogInfo *evinfo, char *reply, int *len)
{
+ xEvent *evt = evinfo->evt.ptr;
+
switch (evt->u.u.type & 0x7F)
{
case KeyPress:
case PropertyNotify:
{
- REPLY (": Window(0x%lx) atom(0x%lx)",
- evt->u.property.window,
- evt->u.property.atom);
+ REPLY (": Window(0x%lx)",
+ evt->u.property.window);
+ REPLY (" Atom");
+ reply = xDbgGetAtom(dpy, evt->u.property.atom, reply, len);
return reply;
}
case SelectionClear:
{
- REPLY (": Window(0x%lx) atom(0x%lx)",
- evt->u.selectionClear.window,
- evt->u.selectionClear.atom);
+ REPLY (": Window(0x%lx)",
+ evt->u.selectionClear.window);
+
+ REPLY (" Atom");
+ reply = xDbgGetAtom(dpy, evt->u.selectionClear.atom, reply, len);
return reply;
}
case SelectionRequest:
{
- REPLY (": Owner(0x%lx) Requestor(0x%lx) Selcection(0x%lx) Target(0x%lx) Property(0x%lx)",
+ REPLY (": Owner(0x%lx) Requestor(0x%lx)",
evt->u.selectionRequest.owner,
- evt->u.selectionRequest.requestor,
- evt->u.selectionRequest.selection,
- evt->u.selectionRequest.target,
- evt->u.selectionRequest.property);
+ evt->u.selectionRequest.requestor);
+
+ REPLY (" selection");
+ reply = xDbgGetAtom(dpy, evt->u.selectionRequest.selection, reply, len);
+ REPLY (" Target");
+ reply = xDbgGetAtom(dpy, evt->u.selectionRequest.target, reply, len);
+ REPLY (" Property");
+ reply = xDbgGetAtom(dpy, evt->u.selectionRequest.property, reply, len);
return reply;
}
case SelectionNotify:
{
- REPLY (": Requestor(0x%lx) Selcection(0x%lx) Target(0x%lx) Property(0x%lx)",
- evt->u.selectionNotify.requestor,
- evt->u.selectionNotify.selection,
- evt->u.selectionNotify.target,
- evt->u.selectionNotify.property);
+ REPLY (": Requestor(0x%lx)",
+ evt->u.selectionNotify.requestor);
+
+ REPLY (" selection");
+ reply = xDbgGetAtom(dpy, evt->u.selectionNotify.selection, reply, len);
+ REPLY (" Target");
+ reply = xDbgGetAtom(dpy, evt->u.selectionNotify.target, reply, len);
+ REPLY (" Property");
+ reply = xDbgGetAtom(dpy, evt->u.selectionNotify.property, reply, len);
return reply;
}
case ClientMessage:
{
- REPLY (": XID(0x%lx) Atom(0x%lx)",
- evt->u.clientMessage.window,
- evt->u.clientMessage.u.b.type);
+ REPLY (": XID(0x%lx)",
+ evt->u.clientMessage.window);
+
+ REPLY (" Type");
+ reply = xDbgGetAtom(dpy, evt->u.clientMessage.u.b.type, reply, len);
return reply;
}
#include "xdbg_types.h"
-char * xDbgEvlogRequestCore (xReq *req, char *reply, int *len);
-char * xDbgEvlogEventCore (xEvent *evt, char *reply, int *len);
+char * xDbgEvlogRequestCore (void *dpy, EvlogInfo *evinfo, char *reply, int *len);
+char * xDbgEvlogEventCore (void *dpy, EvlogInfo *evinfo, char *reply, int *len);
#endif
#include "xdbg_types.h"
#include "xdbg_evlog_damage.h"
+#include "xdbg_evlog.h"
static char *
-_EvlogRequestDamage(xReq *req, char *reply, int *len)
+_EvlogRequestDamage(void *dpy, EvlogInfo *evinfo, char *reply, int *len)
{
- xReq *stuff = req;
+ xReq *req = evinfo->req.ptr;
- switch (stuff->data)
+ switch (req->data)
{
case X_DamageCreate:
{
}
static char*
-_EvlogEventDamage (xEvent *evt, int first_base, char *reply, int *len)
+_EvlogEventDamage (void *dpy, EvlogInfo *evinfo, int first_base, char *reply, int *len)
{
- xEvent *stuff = evt;
+ xEvent *evt = evinfo->evt.ptr;
- switch ((stuff->u.u.type & 0x7F) - first_base)
+ switch ((evt->u.u.type & 0x7F) - first_base)
{
case XDamageNotify:
{
#include "xdbg_types.h"
#include "xdbg_evlog_dri2.h"
+#include "xdbg_evlog.h"
static char *
-_EvlogRequestDri2 (xReq *req, char *reply, int *len)
+_EvlogRequestDri2 (void *dpy, EvlogInfo *evinfo, char *reply, int *len)
{
- xReq *stuff = req;
+ xReq *req = evinfo->req.ptr;
- switch (stuff->data)
+ switch (req->data)
{
case X_DRI2CreateDrawable:
{
case X_DRI2CopyRegion:
{
xDRI2CopyRegionReq *stuff = (xDRI2CopyRegionReq *)req;
- REPLY (": XID(0x%lx) Region(0x%lx) src(0x%lx) dst(0x%lx)",
+ REPLY (": XID(0x%lx) src(0x%lx) dst(0x%lx)",
stuff->drawable,
- stuff->region,
stuff->src,
stuff->dest);
+ REPLY (" Region");
+ reply = xDbgGetRegion(dpy, evinfo, stuff->region, reply, len);
+
return reply;
}
case X_DRI2SwapBuffersWithRegion:
{
xDRI2SwapBuffersWithRegionReq *stuff = (xDRI2SwapBuffersWithRegionReq *)req;
- REPLY (": XID(0x%lx) Region(0x%lx)",
- stuff->drawable,
- stuff->region);
+ REPLY (": XID(0x%lx)",
+ stuff->drawable);
+
+ REPLY (" Region");
+ reply = xDbgGetRegion(dpy, evinfo, stuff->region, reply, len);
return reply;
}
static char *
-_EvlogEventDri2 (xEvent *evt, int first_base, char *reply, int *len)
+_EvlogEventDri2 (void *dpy, EvlogInfo *evinfo, int first_base, char *reply, int *len)
{
- xEvent *stuff = evt;
+ xEvent *evt = evinfo->evt.ptr;
- switch ((stuff->u.u.type & 0x7F) - first_base)
+ switch ((evt->u.u.type & 0x7F) - first_base)
{
case DRI2_BufferSwapComplete:
{
extern ExtensionInfo* Sorted_Evlog_extensions;
char *
-xDbgEvlogEvent (EvlogInfo *evinfo, Bool on, int Extensions_size, char *reply, int *len)
+xDbgEvlogEvent (void *dpy, EvlogInfo *evinfo, Bool on, int Extensions_size, char *reply, int *len)
{
EvlogEvent ev;
xEvent *xEvt = NULL;
if (type < EXTENSION_EVENT_BASE)
{
- return xDbgEvlogEventCore (xEvt, reply, len);
+ return xDbgEvlogEventCore (dpy, evinfo, reply, len);
}
else
{
if (type >= Sorted_Evlog_extensions[i].evt_base &&
type < Sorted_Evlog_extensions[i+1].evt_base)
{
- return Sorted_Evlog_extensions[i].evt_func (xEvt, Sorted_Evlog_extensions[i].evt_base, reply, len);
+ return Sorted_Evlog_extensions[i].evt_func (dpy, evinfo, Sorted_Evlog_extensions[i].evt_base, reply, len);
}
continue;
}
- return Sorted_Evlog_extensions[i].evt_func (xEvt, Sorted_Evlog_extensions[i].evt_base, reply, len);
+ return Sorted_Evlog_extensions[i].evt_func (dpy, evinfo, Sorted_Evlog_extensions[i].evt_base, reply, len);
}
}
#include "xdbg_types.h"
-char * xDbgEvlogEvent (EvlogInfo *evinfo, Bool on, int Extensions_size, char *reply, int *len);
+char * xDbgEvlogEvent (void *dpy, EvlogInfo *evinfo, Bool on, int Extensions_size, char *reply, int *len);
#endif
#include "xdbg_types.h"
#include "xdbg_evlog_gesture.h"
+#include "xdbg_evlog.h"
static char *
-_EvlogRequestGesture(xReq *req, char *reply, int *len)
+_EvlogRequestGesture(void *dpy, EvlogInfo *evinfo, char *reply, int *len)
{
- xReq *stuff = req;
+ xReq *req = evinfo->req.ptr;
- switch (stuff->data)
+ switch (req->data)
{
case X_GestureSelectEvents:
{
}
static char *
-_EvlogEventGesture (xEvent *evt, int first_base, char *reply, int *len)
+_EvlogEventGesture (void *dpy, EvlogInfo *evinfo, int first_base, char *reply, int *len)
{
- xEvent *stuff = evt;
+ xEvent *evt = evinfo->evt.ptr;
- switch ((stuff->u.u.type & 0x7F) - first_base)
+ switch ((evt->u.u.type & 0x7F) - first_base)
{
case GestureNotifyFlick:
{
#include "xdbg_types.h"
#include "xdbg_evlog_randr.h"
+#include "xdbg_evlog.h"
static char *
-_EvlogRequestRandr (xReq *req, char *reply, int *len)
+_EvlogRequestRandr (void *dpy, EvlogInfo *evinfo, char *reply, int *len)
{
- xReq *stuff = req;
+ xReq *req = evinfo->req.ptr;
- switch (stuff->data)
+ switch (req->data)
{
case X_RRGetScreenSizeRange:
{
case X_RRQueryOutputProperty:
{
xRRQueryOutputPropertyReq *stuff = (xRRQueryOutputPropertyReq *)req;
- REPLY (": XID(0x%lx) Property(0x%lx)",
- stuff->output,
- stuff->property);
+ REPLY (": XID(0x%lx)",
+ stuff->output);
+
+ REPLY (" Property");
+ reply = xDbgGetAtom(dpy, stuff->property, reply, len);
return reply;
}
case X_RRConfigureOutputProperty:
{
xRRConfigureOutputPropertyReq *stuff = (xRRConfigureOutputPropertyReq *)req;
- REPLY (": XID(0x%lx) Property(0x%lx)",
- stuff->output,
- stuff->property);
+ REPLY (": XID(0x%lx)",
+ stuff->output);
+
+ REPLY (" Property");
+ reply = xDbgGetAtom(dpy, stuff->property, reply, len);
return reply;
}
case X_RRChangeOutputProperty:
{
xRRChangeOutputPropertyReq *stuff = (xRRChangeOutputPropertyReq *)req;
- REPLY (": XID(0x%lx) Property(0x%lx) Type(0x%lx) Format(%d) nUnits(%ld)",
+ REPLY (": XID(0x%lx) Format(%d) nUnits(%ld)",
stuff->output,
- stuff->property,
- stuff->type,
stuff->format,
stuff->nUnits);
+ REPLY (" Property");
+ reply = xDbgGetAtom(dpy, stuff->property, reply, len);
+ REPLY (" Type");
+ reply = xDbgGetAtom(dpy, stuff->type, reply, len);
+
return reply;
}
case X_RRDeleteOutputProperty:
{
xRRDeleteOutputPropertyReq *stuff = (xRRDeleteOutputPropertyReq *)req;
- REPLY (": XID(0x%lx) Property(0x%lx)",
- stuff->output,
- stuff->property);
+ REPLY (": XID(0x%lx)",
+ stuff->output);
+
+ REPLY (" Property");
+ reply = xDbgGetAtom(dpy, stuff->property, reply, len);
return reply;
}
case X_RRGetOutputProperty:
{
xRRGetOutputPropertyReq *stuff = (xRRGetOutputPropertyReq *)req;
- REPLY (": XID(0x%lx) Property(0x%lx) Type(0x%lx) longOffset(%ld) longLength(%ld)",
+ REPLY (": XID(0x%lx) longOffset(%ld) longLength(%ld)",
stuff->output,
- stuff->property,
- stuff->type,
stuff->longOffset,
stuff->longLength);
+ REPLY (" Property");
+ reply = xDbgGetAtom(dpy, stuff->property, reply, len);
+ REPLY (" Type");
+ reply = xDbgGetAtom(dpy, stuff->type, reply, len);
+
return reply;
}
static char *
-_EvlogEventRandr (xEvent *evt, int first_base, char *reply, int *len)
+_EvlogEventRandr (void *dpy, EvlogInfo *evinfo, int first_base, char *reply, int *len)
{
- xEvent *stuff = evt;
+ xEvent *evt = evinfo->evt.ptr;
- switch ((stuff->u.u.type & 0x7F) - first_base)
+ switch ((evt->u.u.type & 0x7F) - first_base)
{
case RRScreenChangeNotify:
{
case RRNotify:
{
- switch(stuff->u.u.detail)
+ switch(evt->u.u.detail)
{
case RRNotify_CrtcChange:
{
case RRNotify_OutputProperty:
{
xRROutputPropertyNotifyEvent *stuff = (xRROutputPropertyNotifyEvent *) evt;
- REPLY (": XID(0x%lx) Output(0x%lx) Atom(0x%lx)",
+ REPLY (": XID(0x%lx) Output(0x%lx)",
stuff->window,
- stuff->output,
- stuff->atom);
+ stuff->output);
+
+ REPLY (" Atom");
+ reply = xDbgGetAtom(dpy, stuff->atom, reply, len);
return reply;
}
case RRNotify_ProviderProperty:
{
xRRProviderPropertyNotifyEvent *stuff = (xRRProviderPropertyNotifyEvent *) evt;
- REPLY (": XID(0x%lx) Provider(0x%lx) Atom(0x%lx)",
+ REPLY (": XID(0x%lx) Provider(0x%lx)",
stuff->window,
- stuff->provider,
- stuff->atom);
+ stuff->provider);
+
+ REPLY (" Atom");
+ reply = xDbgGetAtom(dpy, stuff->atom, reply, len);
return reply;
}
extern ExtensionInfo Evlog_extensions[];
char *
-xDbgEvlogReqeust (EvlogInfo *evinfo, Bool on, int Extensions_size, char *reply, int *len)
+xDbgEvlogReqeust (void *dpy, EvlogInfo *evinfo, Bool on, int Extensions_size, char *reply, int *len)
{
EvlogRequest req;
xReq *xReq = NULL;
req = evinfo->req;
xReq = req.ptr;
- REPLY ("%s", req.name);
+ REPLY ("%s", evinfo->req.name);
if(!on)
return reply;
if (xReq->reqType < EXTENSION_BASE)
{
- return xDbgEvlogRequestCore (xReq, reply, len);
+ return xDbgEvlogRequestCore (dpy, evinfo, reply, len);
}
else
{
{
if (xReq->reqType == Evlog_extensions[i].opcode)
{
- return Evlog_extensions[i].req_func (xReq, reply, len);
+ return Evlog_extensions[i].req_func (dpy, evinfo, reply, len);
}
}
}
#include "xdbg_types.h"
-char * xDbgEvlogReqeust (EvlogInfo *evinfo, Bool on, int Extensions_size, char *reply, int *len);
+char * xDbgEvlogReqeust (void *dpy, EvlogInfo *evinfo, Bool on, int Extensions_size, char *reply, int *len);
#endif
#include "xdbg_types.h"
#include "xdbg_evlog_xext.h"
+#include "xdbg_evlog.h"
static char *
-_EvlogRequestXextDpms(xReq *req, char *reply, int *len)
+_EvlogRequestXextDpms(void *dpy, EvlogInfo *evinfo, char *reply, int *len)
{
- xReq *stuff = req;
+ xReq *req = evinfo->req.ptr;
- switch (stuff->data)
+ switch (req->data)
{
case X_DPMSSetTimeouts:
{
static char *
-_EvlogRequestXextShm (xReq *req, char *reply, int *len)
+_EvlogRequestXextShm (void *dpy, EvlogInfo *evinfo, char *reply, int *len)
{
- xReq *stuff = req;
+ xReq *req = evinfo->req.ptr;
- switch (stuff->data)
+ switch (req->data)
{
case X_ShmPutImage:
{
}
static char *
-_EvlogRequestXextSync(xReq *req, char *reply, int *len)
+_EvlogRequestXextSync(void *dpy, EvlogInfo *evinfo, char *reply, int *len)
{
- xReq *stuff = req;
+ xReq *req = evinfo->req.ptr;
- switch (stuff->data)
+ switch (req->data)
{
case X_SyncCreateCounter:
{
}
static char *
-_EvlogRequestXextXtestExt1(xReq *req, char *reply, int *len)
+_EvlogRequestXextXtestExt1(void *dpy, EvlogInfo *evinfo, char *reply, int *len)
{
- xReq *stuff = req;
+ xReq *req = evinfo->req.ptr;
- switch (stuff->data)
+ switch (req->data)
{
case X_TestFakeInput:
{
static char *
-_EvlogRequestXextXtest(xReq *req, char *reply, int *len)
+_EvlogRequestXextXtest(void *dpy, EvlogInfo *evinfo, char *reply, int *len)
{
- xReq *stuff = req;
+ xReq *req = evinfo->req.ptr;
- switch (stuff->data)
+ switch (req->data)
{
case X_XTestGetVersion:
{
static char *
-_EvlogEventXextDpms (xEvent *evt, int first_base, char *reply, int *len)
+_EvlogEventXextDpms (void *dpy, EvlogInfo *evinfo, int first_base, char *reply, int *len)
{
- xEvent *stuff = evt;
+ xEvent *evt = evinfo->evt.ptr;
- switch ((stuff->u.u.type & 0x7F) - first_base)
+ switch ((evt->u.u.type & 0x7F) - first_base)
{
default:
static char *
-_EvlogEventXextShm (xEvent *evt, int first_base, char *reply, int *len)
+_EvlogEventXextShm (void *dpy, EvlogInfo *evinfo, int first_base, char *reply, int *len)
{
- xEvent *stuff = evt;
+ xEvent *evt = evinfo->evt.ptr;
- switch ((stuff->u.u.type & 0x7F) - first_base)
+ switch ((evt->u.u.type & 0x7F) - first_base)
{
case ShmCompletion:
{
static char *
-_EvlogEventXextSync (xEvent *evt, int first_base, char *reply, int *len)
+_EvlogEventXextSync (void *dpy, EvlogInfo *evinfo, int first_base, char *reply, int *len)
{
- xEvent *stuff = evt;
+ xEvent *evt = evinfo->evt.ptr;
- switch ((stuff->u.u.type & 0x7F) - first_base)
+ switch ((evt->u.u.type & 0x7F) - first_base)
{
case XSyncCounterNotify:
{
static char *
-_EvlogEventXextXtestExt1 (xEvent *evt, int first_base, char *reply, int *len)
+_EvlogEventXextXtestExt1 (void *dpy, EvlogInfo *evinfo, int first_base, char *reply, int *len)
{
- xEvent *stuff = evt;
+ xEvent *evt = evinfo->evt.ptr;
- switch ((stuff->u.u.type & 0x7F) - first_base)
+ switch ((evt->u.u.type & 0x7F) - first_base)
{
default:
}
static char *
-_EvlogEventXextXtest (xEvent *evt, int first_base, char *reply, int *len)
+_EvlogEventXextXtest (void *dpy, EvlogInfo *evinfo, int first_base, char *reply, int *len)
{
- xEvent *stuff = evt;
+ xEvent *evt = evinfo->evt.ptr;
- switch ((stuff->u.u.type & 0x7F) - first_base)
+ switch ((evt->u.u.type & 0x7F) - first_base)
{
default:
#include "xdbg_types.h"
#include "xdbg_evlog_xinput.h"
+#include "xdbg_evlog.h"
static char *
-_EvlogRequestXinput (xReq *req, char *reply, int *len)
+_EvlogRequestXinput (void *dpy, EvlogInfo *evinfo, char *reply, int *len)
{
- xReq *stuff = req;
+ xReq *req = evinfo->req.ptr;
- switch (stuff->data)
+ switch (req->data)
{
case X_GrabDevice:
{
case X_XIChangeProperty:
{
xXIChangePropertyReq *stuff = (xXIChangePropertyReq *)req;
- REPLY (": devID(%d) mode(%d) format(%d) property(0x%x) type(0x%x) numItems(%d)",
+ REPLY (": devID(%d) mode(%d) format(%d) numItems(%d)",
stuff->deviceid,
stuff->mode,
stuff->format,
- stuff->property,
- stuff->type,
stuff->num_items);
+ REPLY (" Property");
+ reply = xDbgGetAtom(dpy, stuff->property, reply, len);
+ REPLY (" Type");
+ reply = xDbgGetAtom(dpy, stuff->type, reply, len);
+
return reply;
}
case X_XIDeleteProperty:
{
xXIDeletePropertyReq *stuff = (xXIDeletePropertyReq *)req;
- REPLY (": devID(%d) property(0x%x)",
- stuff->deviceid,
- stuff->property);
+ REPLY (": devID(%d)",
+ stuff->deviceid);
+
+ REPLY (" Property");
+ reply = xDbgGetAtom(dpy, stuff->property, reply, len);
return reply;
}
case X_XIGetProperty:
{
xXIGetPropertyReq *stuff = (xXIGetPropertyReq *)req;
- REPLY (": devID(%d) property(0x%x) type(0x%x)",
- stuff->deviceid,
- stuff->property,
- stuff->type);
+ REPLY (": devID(%d)",
+ stuff->deviceid);
+
+ REPLY (" Property");
+ reply = xDbgGetAtom(dpy, stuff->property, reply, len);
+ REPLY (" Type");
+ reply = xDbgGetAtom(dpy, stuff->type, reply, len);
return reply;
}
}
static char *
-_EvlogEventXinput (xEvent *evt, int first_base, char *reply, int *len)
+_EvlogEventXinput (void *dpy, EvlogInfo *evinfo, int first_base, char *reply, int *len)
{
- xEvent *stuff = evt;
+ xEvent *evt = evinfo->evt.ptr;
- switch ((stuff->u.u.type & 0x7F) - first_base)
+ switch ((evt->u.u.type & 0x7F) - first_base)
{
case XI_DeviceValuator:
{
case XI_DevicePropertyNotify:
{
devicePropertyNotify *stuff = (devicePropertyNotify *) evt;
- REPLY (": XID(0x%lx)",
- stuff->atom);
+ REPLY (": deviceid(%d)",
+ stuff->deviceid);
+
+ REPLY (" Atom");
+ reply = xDbgGetAtom(dpy, stuff->atom, reply, len);
return reply;
}
#include "xdbg_types.h"
#include "xdbg_evlog_xv.h"
+#include "xdbg_evlog.h"
static char *
-_EvlogRequestXv(xReq *req, char *reply, int *len)
+_EvlogRequestXv(void *dpy, EvlogInfo *evinfo, char *reply, int *len)
{
- xReq *stuff = req;
+ xReq *req = evinfo->req.ptr;
- switch (stuff->data)
+ switch (req->data)
{
case xv_GrabPort:
{
case xv_SetPortAttribute:
{
xvSetPortAttributeReq *stuff = (xvSetPortAttributeReq *)req;
- REPLY (": XID(0x%lx) Attribute(0x%lx) value(0x%lx)",
+ REPLY (": XID(0x%lx) value(0x%lx)",
stuff->port,
- stuff->attribute,
stuff->value);
+ REPLY (" Attribute");
+ reply = xDbgGetAtom(dpy, stuff->attribute, reply, len);
+
+ return reply;
+ }
+
+ case xv_GetPortAttribute:
+ {
+ xvGetPortAttributeReq *stuff = (xvGetPortAttributeReq *)req;
+ REPLY (": XID(0x%lx)",
+ stuff->port);
+
+ REPLY (" Attribute");
+ reply = xDbgGetAtom(dpy, stuff->attribute, reply, len);
+
return reply;
}
}
static char *
-_EvlogEventXv (xEvent *evt, int first_base, char *reply, int *len)
+_EvlogEventXv (void *dpy, EvlogInfo *evinfo, int first_base, char *reply, int *len)
{
- xEvent *stuff = evt;
+ xEvent *evt = evinfo->evt.ptr;
- switch ((stuff->u.u.type & 0x7F) - first_base)
+ switch ((evt->u.u.type & 0x7F) - first_base)
{
case XvVideoNotify:
{
case XvPortNotify:
{
XvPortNotifyEvent *stuff = (XvPortNotifyEvent *) evt;
- REPLY (": XID(0x%lx) Attribute(%lx) Value(%ld)",
+ REPLY (": XID(0x%lx) Value(%ld)",
stuff->port_id,
- stuff->attribute,
stuff->value);
+ REPLY (" Attribute");
+ reply = xDbgGetAtom(dpy, stuff->attribute, reply, len);
+
return reply;
}
#include <xf86.h>
#include <X11/Xdefs.h> /* for Bool */
+#include <X11/Xlib.h>
+#include <X11/extensions/Xfixes.h>
+
#define XDBG_PATH_MAX 1024
int gid;
int uid;
char command[PATH_MAX+1];
+ void* pClient;
} EvlogClient;
typedef struct _EvlogRequest
int opcode;
int evt_base;
int err_base;
- char* (*req_func) (xReq *req, char *reply, int *len);
- char* (*evt_func) (xEvent *evt, int first_base, char *reply, int *len);
+ char* (*req_func) (void *dpy, EvlogInfo *evinfo, char *reply, int *len);
+ char* (*evt_func) (void *dpy, EvlogInfo *evinfo, int first_base, char *reply, int *len);
};
#endif
char log[1024];
int size = sizeof (log);
- xDbgEvlogFillLog (evinfo, TRUE, log, &size);
+
+
+ xDbgEvlogFillLog (NULL, evinfo, TRUE, log, &size);
if (fd < 0)
ErrorF ("%s", log);
evinfo.client.gid = info->gid;
evinfo.client.uid = info->uid;
strncpy (evinfo.client.command, info->command, strlen (info->command));
+ evinfo.client.pClient = (void*)client;
/* evinfo.req */
if (type == REQUEST)