}
-static void _xEvlogAnalyzePrint (Display* dpy, EvlogOption *eo, char* reply, int* len)
+static void _xEvlogAnalyzePrint (EvlogOption *eo, char* reply, int* len)
{
int fd = -1, cfd = -1;
int total, read_len;
int evlog_len;
char fd_name[256];
EvlogInfo evinfo={0,};
+ int i;
if (!strlen(eo->path_name))
{
int size = sizeof (log);
static int init = 0;
+ memset (&evinfo, 0, sizeof (EvlogInfo));
+ total = read_len;
+
if (!init)
{
+ extern ExtensionInfo Evlog_extensions[];
+ extern int Extensions_size;
int new_argc = 3;
char* new_argv[3] = {"add", "allow", "all"};
+ int i;
if(!eo->isRule)
xDbgEvlogRuleSet ((const int) new_argc, (const char**) new_argv, reply, len);
printf("%s\n", reply);
- init = 1;
- }
- memset (&evinfo, 0, sizeof (EvlogInfo));
+ read_len = read (fd, &Extensions_size, sizeof (int));
+ GOTO_IF_FAIL (read_len == sizeof (int), print_done);
+ total += read_len;
- total = read_len;
+ for (i = 0 ; i < Extensions_size ; i++)
+ {
+ read_len = read (fd, &Evlog_extensions[i].opcode, sizeof (int));
+ GOTO_IF_FAIL (read_len == sizeof (int), print_done);
+ total += read_len;
+
+ read_len = read (fd, &Evlog_extensions[i].evt_base, sizeof (int));
+ GOTO_IF_FAIL (read_len == sizeof (int), print_done);
+ total += read_len;
+
+ read_len = read (fd, &Evlog_extensions[i].err_base, sizeof (int));
+ GOTO_IF_FAIL (read_len == sizeof (int), print_done);
+ total += read_len;
+ }
+
+ if (!xDbgEvlogGetExtensionEntry ())
+ {
+ printf ("failed: get extentions\n");
+ goto print_done;
+ }
+
+ init = 1;
+ }
read_len = read (fd, &evinfo.time, sizeof (CARD32));
GOTO_IF_FAIL (read_len == sizeof (CARD32), print_done);
GOTO_IF_FAIL (read_len == sizeof(EvlogEvent), print_done);
total += read_len;
- evinfo.evt.ptr = malloc (sizeof(xEvent));
+ evinfo.evt.ptr = malloc (evinfo.evt.size);
GOTO_IF_FAIL (evinfo.evt.ptr != NULL, print_done);
- read_len = read (fd, evinfo.evt.ptr, sizeof (xEvent));
- GOTO_IF_FAIL (read_len == sizeof(xEvent), print_done);
+ WARNING_IF_FAIL (evinfo.evt.size > 0);
+
+ read_len = read (fd, evinfo.evt.ptr, evinfo.evt.size);
+ GOTO_IF_FAIL (read_len == evinfo.evt.size, print_done);
total += read_len;
}
+
+ if (evinfo.mask & EVLOG_MASK_ATOM)
+ {
+ EvlogAtomTable *table;
+
+ read_len = read (fd, &evinfo.evatom.size, sizeof (int));
+ GOTO_IF_FAIL (read_len == sizeof(int), print_done);
+ total += read_len;
+
+ for (i = 0 ; i < evinfo.evatom.size ; i++)
+ {
+ table = malloc (sizeof(EvlogAtomTable));
+ GOTO_IF_FAIL (table != NULL, print_done);
+
+ if (!evinfo.evatom.init)
+ {
+ xorg_list_init(&evinfo.evatom.list);
+ evinfo.evatom.init = 1;
+ }
+ read_len = read (fd, table, sizeof (EvlogAtomTable));
+ GOTO_IF_FAIL (read_len == sizeof(EvlogAtomTable), print_done);
+ total += read_len;
+
+ xorg_list_add(&table->link, &evinfo.evatom.list);
+ }
+ }
+
+ if (evinfo.mask & EVLOG_MASK_REGION)
+ {
+ EvlogRegionTable *table;
+
+ read_len = read (fd, &evinfo.evregion.size, sizeof (int));
+ GOTO_IF_FAIL (read_len == sizeof(int), print_done);
+ total += read_len;
+
+ for (i = 0 ; i < evinfo.evregion.size ; i++)
+ {
+ table = malloc (sizeof(EvlogRegionTable));
+ GOTO_IF_FAIL (table != NULL, print_done);
+
+ if (!evinfo.evregion.init)
+ {
+ xorg_list_init(&evinfo.evregion.list);
+ evinfo.evregion.init = 1;
+ }
+
+ read_len = read (fd, table, sizeof (EvlogRegionTable));
+ GOTO_IF_FAIL (read_len == sizeof(EvlogRegionTable), print_done);
+ total += read_len;
+
+ xorg_list_add(&table->link, &evinfo.evregion.list);
+ }
+ }
+
GOTO_IF_FAIL (evlog_len == total, print_done);
if (xDbgEvlogRuleValidate (&evinfo))
{
- xDbgEvlogFillLog(dpy, &evinfo, eo->detail, log, &size);
+ xDbgEvlogFillLog(&evinfo, eo->detail, log, &size);
printf ("%s", log);
}
free (evinfo.evt.ptr);
evinfo.evt.ptr = NULL;
}
+
+ xDbgDistroyAtomList(&evinfo);
+ xDbgDistroyRegionList(&evinfo);
}
if (evinfo.evt.ptr)
free (evinfo.evt.ptr);
+ xDbgDistroyAtomList(&evinfo);
+ xDbgDistroyRegionList(&evinfo);
+
if (cfd >= 0)
close (cfd);
static void
-_checkOption(Display* dpy, int argc, char** argv)
+_checkOption(int argc, char** argv)
{
int c;
int opt_str_len = 0;
}
}
- _xEvlogAnalyzePrint(dpy, &eo, rule_log, &rule_size);
+ _xEvlogAnalyzePrint(&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(dpy, new_argc, new_argv);
+ _checkOption(new_argc, new_argv);
free (new_argv);
- XCloseDisplay (dpy);
return 0;
}
{xDbgEvlogXvGetBase, 0, 0, 0, NULL}
};
ExtensionInfo* Sorted_Evlog_extensions;
+int Extensions_size = 0;
static void
_ExtensionsSwap(ExtensionInfo* first, ExtensionInfo* second)
memcpy(Sorted_Evlog_extensions, Evlog_extensions, sizeof(Evlog_extensions));
- for (i = 0 ; i < sizeof (Evlog_extensions) / sizeof (ExtensionInfo) - 1 ; i++)
+ for (i = 0 ; i < Extensions_size - 1 ; i++)
{
swap = 0;
- for (j = 1 ; j < sizeof (Evlog_extensions) / sizeof (ExtensionInfo) - i ; j++)
+ for (j = 1 ; j < Extensions_size - i ; j++)
{
if(Sorted_Evlog_extensions[j-1].evt_base > Sorted_Evlog_extensions[j].evt_base)
{
}
-static Bool
-_EvlogGetExtentionEntry (void *dpy, int *return_extensions_size)
+Bool
+xDbgEvlogGetExtensionEntry ()
{
static int init = 0;
static Bool success = FALSE;
return success;
init = 1;
+ Extensions_size = sizeof(Evlog_extensions) / sizeof (ExtensionInfo);
- for (i = 0 ; i < sizeof (Evlog_extensions) / sizeof (ExtensionInfo); i++)
+ for (i = 0 ; i < Extensions_size ; i++)
{
- Evlog_extensions[i].get_base_func (dpy, Evlog_extensions + i);
+ Evlog_extensions[i].get_base_func (Evlog_extensions + i);
}
if(!_SortEvlogExtensions ())
return FALSE;
- *return_extensions_size = sizeof(Evlog_extensions);
+
success = TRUE;
return success;
void
-xDbgEvlogFillLog (void *dpy, EvlogInfo *evinfo, Bool on, char *reply, int *len)
+xDbgEvlogFillLog (EvlogInfo *evinfo, Bool on, char *reply, int *len)
{
static CARD32 prev;
- static int Extensions_size = 0;
RETURN_IF_FAIL (evinfo->type >= 0 && (sizeof (evt_dir) / sizeof (char*)));
RETURN_IF_FAIL (evinfo->type >= 0 && (sizeof (evt_type) / sizeof (char*)));
evt_dir[evinfo->type],
evt_type[evinfo->type]);
- if (evinfo->type == REQUEST && _EvlogGetExtentionEntry (dpy, &Extensions_size))
+ if (evinfo->type == REQUEST)
{
REPLY ("(");
- reply = xDbgEvlogReqeust (dpy, evinfo, on, Extensions_size, reply, len);
+ reply = xDbgEvlogReqeust (evinfo, on, reply, len);
REPLY (")");
}
- else if (evinfo->type == EVENT && _EvlogGetExtentionEntry (dpy, &Extensions_size))
+ else if (evinfo->type == EVENT)
{
+ evinfo->evt.size = sizeof (xEvent);
REPLY ("(");
- reply = xDbgEvlogEvent (dpy, evinfo, on, Extensions_size, reply, len);
+ reply = xDbgEvlogEvent (evinfo, on, reply, len);
REPLY (")");
}
else
}
-
-#ifdef XDBG_CLIENT
-Bool get_error_caught;
-
-static int
-_get_error_handle (Display *dpy, XErrorEvent *ev)
+void xDbgDistroyAtomList (EvlogInfo *evinfo)
{
- if (!dpy)
- return 0;
+ EvlogAtomTable *cur, *next;
+
+ if (!evinfo->evatom.init)
+ return;
- get_error_caught = True;
- return 0;
+ xorg_list_for_each_entry_safe(cur, next, &evinfo->evatom.list, link)
+ {
+ xorg_list_del(&cur->link);
+ free (cur);
+ cur = NULL;
+ }
+ evinfo->evatom.init = 0;
+ evinfo->evatom.size = 0;
}
-#endif
-char* xDbgGetAtom(void *dpy, Atom atom, char *reply, int *len)
+void xDbgDistroyRegionList (EvlogInfo *evinfo)
{
-#ifdef XDBG_CLIENT
- Display *d = NULL;
- XErrorHandler old_handler = NULL;
+ EvlogRegionTable *cur, *next;
- RETURN_VAL_IF_FAIL(dpy != NULL, reply);
+ if (!evinfo->evregion.init)
+ return;
- get_error_caught = False;
- d = (Display*)dpy;
+ xorg_list_for_each_entry_safe(cur, next, &evinfo->evregion.list, link)
+ {
+ xorg_list_del(&cur->link);
+ free (cur);
+ cur = NULL;
+ }
+ evinfo->evregion.init = 0;
+ evinfo->evregion.size = 0;
+}
- XSync (d, 0);
- old_handler = XSetErrorHandler (_get_error_handle);
+char* xDbgGetAtom(Atom atom, EvlogInfo *evinfo, char *reply, int *len)
+{
+ EvlogAtomTable *table;
+#ifndef XDBG_CLIENT
+ table = malloc (sizeof(EvlogAtomTable));
+ if (!table)
+ return reply;
- if(XGetAtomName(d, atom))
- REPLY("(%s)", XGetAtomName(d, atom));
- else
- REPLY("(0x%lx)", atom);
+ evinfo->mask |= EVLOG_MASK_ATOM;
+ table->xid = atom;
+
+ if (!evinfo->evatom.init)
+ {
+ xorg_list_init(&evinfo->evatom.list);
+ evinfo->evatom.init = 1;
+ }
- get_error_caught = False;
- XSetErrorHandler (old_handler);
-#else
if (NameForAtom(atom))
- REPLY("(%s)", (char*)NameForAtom(atom));
+ snprintf (table->buf, XDBG_BUF_SIZE, "%s", (char*)NameForAtom(atom));
else
- REPLY("(0x%lx)", atom);
+ snprintf (table->buf, XDBG_BUF_SIZE, "0x%lx", atom);
+
+ xorg_list_add(&table->link, &evinfo->evatom.list);
+ evinfo->evatom.size++;
#endif
+ xorg_list_for_each_entry(table, &evinfo->evatom.list, link)
+ if(table->xid == atom)
+ {
+ REPLY ("(%s)", table->buf);
+ break;
+ }
return reply;
}
-char* xDbgGetRegion(void* dpy, EvlogInfo *evinfo, XserverRegion region, char *reply, int *len)
+char* xDbgGetRegion(XserverRegion region, EvlogInfo *evinfo, 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
+ EvlogRegionTable *table;
+#ifndef XDBG_CLIENT
extern _X_EXPORT RESTYPE RegionResType;
RegionPtr pRegion;
BoxPtr rects;
int nrect, i;
-
+ int s;
int err = dixLookupResourceByType((pointer *) &pRegion, region,
RegionResType, (ClientPtr)evinfo->client.pClient,
DixReadAccess);
+
+ evinfo->mask |= EVLOG_MASK_REGION;
+
+ if (!evinfo->evregion.init)
+ {
+ xorg_list_init(&evinfo->evregion.list);
+ evinfo->evregion.init = 1;
+ }
+
if (err != Success)
{
- REPLY ("(0x%lx)", region);
- return reply;
- }
+ table = malloc (sizeof(EvlogAtomTable));
+ if (!table)
+ return reply;
- nrect = RegionNumRects(pRegion);
- rects = RegionRects(pRegion);
+ table->xid = region;
- REPLY ("(");
- for (i = 0; i < nrect; i++)
+ snprintf (table->buf, XDBG_BUF_SIZE, "0x%lx", region);
+ xorg_list_add(&table->link, &evinfo->evregion.list);
+ evinfo->evregion.size++;
+ }
+ else
{
- 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 (",");
+ nrect = RegionNumRects(pRegion);
+ rects = RegionRects(pRegion);
+
+ for (i = 0; i < nrect; i++)
+ {
+ table = malloc (sizeof(EvlogAtomTable));
+ if (!table)
+ return reply;
+
+ table->xid = region;
+
+ s = 0;
+ s += snprintf (table->buf + s, XDBG_BUF_SIZE - s,
+ "[%d,%d %dx%d]",
+ rects[i].x1,
+ rects[i].y1,
+ rects[i].x2 - rects[i].x1,
+ rects[i].y2 - rects[i].y1);
+ xorg_list_add(&table->link, &evinfo->evregion.list);
+ evinfo->evregion.size++;
+ }
}
- REPLY (")");
+
#endif
+ REPLY("(");
+ xorg_list_for_each_entry(table, &evinfo->evregion.list, link)
+ if(table->xid == region)
+ {
+ REPLY ("%s", table->buf);
+ if(table != xorg_list_last_entry(&evinfo->evregion.list, EvlogRegionTable, link))
+ REPLY (", ");
+ }
+ REPLY(")");
return reply;
}
#include "xdbg_evlog_randr.h"
#include "xdbg_evlog_xinput.h"
#include "xdbg_evlog_xv.h"
+#include <list.h>
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);
+Bool xDbgEvlogGetExtensionEntry ();
+void xDbgEvlogFillLog (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);
+void xDbgDistroyAtomList (EvlogInfo *evinfo);
+void xDbgDistroyRegionList (EvlogInfo *evinfo);
+char* xDbgGetAtom (Atom atom, EvlogInfo *evinfo, char *reply, int *len);
+char* xDbgGetRegion (XserverRegion region, EvlogInfo *evinfo, char *reply, int *len);
#endif
#include "xdbg_evlog.h"
static char *
-_EvlogRequestComposite(void *dpy, EvlogInfo *evinfo, char *reply, int *len)
+_EvlogRequestComposite(EvlogInfo *evinfo, char *reply, int *len)
{
xReq *req = evinfo->req.ptr;
}
static char *
-_EvlogEventComposite (void *dpy, EvlogInfo *evinfo, int first_base, char *reply, int *len)
+_EvlogEventComposite (EvlogInfo *evinfo, int first_base, char *reply, int *len)
{
xEvent *evt = evinfo->evt.ptr;
void
-xDbgEvlogCompositeGetBase (void *dpy, ExtensionInfo *extinfo)
+xDbgEvlogCompositeGetBase (ExtensionInfo *extinfo)
{
#ifdef XDBG_CLIENT
- Display *d = (Display*)dpy;
-
- RETURN_IF_FAIL (d != NULL);
RETURN_IF_FAIL (extinfo != NULL);
- if (!XQueryExtension(d, COMPOSITE_NAME, &extinfo->opcode, &extinfo->evt_base, &extinfo->err_base))
- {
- XDBG_LOG ("no Composite extension. \n");
- return;
- }
extinfo->req_func = _EvlogRequestComposite;
extinfo->evt_func = _EvlogEventComposite;
#else
ExtensionEntry *xext = CheckExtension (COMPOSITE_NAME);
RETURN_IF_FAIL (xext != NULL);
+ RETURN_IF_FAIL (extinfo != NULL);
extinfo->opcode = xext->base;
extinfo->evt_base = xext->eventBase;
#include "xdbg_types.h"
-void xDbgEvlogCompositeGetBase (void *dpy, ExtensionInfo *extinfo);
+void xDbgEvlogCompositeGetBase (ExtensionInfo *extinfo);
#endif
#include "xdbg_evlog_core.h"
#include "xdbg_evlog.h"
-char * xDbgEvlogRequestCore (void *dpy, EvlogInfo *evinfo, char *reply, int *len)
+char * xDbgEvlogRequestCore (EvlogInfo *evinfo, char *reply, int *len)
{
xReq *req = evinfo->req.ptr;
stuff->window);
REPLY (" Property");
- reply = xDbgGetAtom(dpy, stuff->property, reply, len);
+ reply = xDbgGetAtom(stuff->property, evinfo, reply, len);
+
REPLY (" Type");
- reply = xDbgGetAtom(dpy, stuff->type, reply, len);
+ reply = xDbgGetAtom(stuff->type, evinfo, reply, len);
return reply;
}
stuff->window);
REPLY (" Property");
- reply = xDbgGetAtom(dpy, stuff->property, reply, len);
+ reply = xDbgGetAtom(stuff->property, evinfo, reply, len);
return reply;
}
stuff->window);
REPLY (" Selection");
- reply = xDbgGetAtom(dpy, stuff->selection, reply, len);
+ reply = xDbgGetAtom(stuff->selection, evinfo, reply, len);
return reply;
}
stuff->requestor);
REPLY (" Selection");
- reply = xDbgGetAtom(dpy, stuff->selection, reply, len);
+ reply = xDbgGetAtom(stuff->selection, evinfo, reply, len);
REPLY (" Target");
- reply = xDbgGetAtom(dpy, stuff->target, reply, len);
+ reply = xDbgGetAtom(stuff->target, evinfo, reply, len);
REPLY (" Property");
- reply = xDbgGetAtom(dpy, stuff->property, reply, len);
+ reply = xDbgGetAtom(stuff->property, evinfo, reply, len);
return reply;
}
}
-char * xDbgEvlogEventCore (void *dpy, EvlogInfo *evinfo, char *reply, int *len)
+char * xDbgEvlogEventCore (EvlogInfo *evinfo, char *reply, int *len)
{
xEvent *evt = evinfo->evt.ptr;
evt->u.property.window);
REPLY (" Atom");
- reply = xDbgGetAtom(dpy, evt->u.property.atom, reply, len);
+ reply = xDbgGetAtom(evt->u.property.atom, evinfo, reply, len);
+
return reply;
}
evt->u.selectionClear.window);
REPLY (" Atom");
- reply = xDbgGetAtom(dpy, evt->u.selectionClear.atom, reply, len);
+ reply = xDbgGetAtom(evt->u.selectionClear.atom, evinfo, reply, len);
return reply;
}
evt->u.selectionRequest.requestor);
REPLY (" selection");
- reply = xDbgGetAtom(dpy, evt->u.selectionRequest.selection, reply, len);
+ reply = xDbgGetAtom(evt->u.selectionRequest.selection, evinfo, reply, len);
REPLY (" Target");
- reply = xDbgGetAtom(dpy, evt->u.selectionRequest.target, reply, len);
+ reply = xDbgGetAtom(evt->u.selectionRequest.target, evinfo, reply, len);
REPLY (" Property");
- reply = xDbgGetAtom(dpy, evt->u.selectionRequest.property, reply, len);
+ reply = xDbgGetAtom(evt->u.selectionRequest.property, evinfo, reply, len);
return reply;
}
evt->u.selectionNotify.requestor);
REPLY (" selection");
- reply = xDbgGetAtom(dpy, evt->u.selectionNotify.selection, reply, len);
+ reply = xDbgGetAtom(evt->u.selectionNotify.selection, evinfo, reply, len);
REPLY (" Target");
- reply = xDbgGetAtom(dpy, evt->u.selectionNotify.target, reply, len);
+ reply = xDbgGetAtom(evt->u.selectionNotify.target, evinfo, reply, len);
REPLY (" Property");
- reply = xDbgGetAtom(dpy, evt->u.selectionNotify.property, reply, len);
+ reply = xDbgGetAtom(evt->u.selectionNotify.property, evinfo, reply, len);
return reply;
}
evt->u.clientMessage.window);
REPLY (" Type");
- reply = xDbgGetAtom(dpy, evt->u.clientMessage.u.b.type, reply, len);
+ reply = xDbgGetAtom(evt->u.clientMessage.u.b.type, evinfo, reply, len);
return reply;
}
#include "xdbg_types.h"
-char * xDbgEvlogRequestCore (void *dpy, EvlogInfo *evinfo, char *reply, int *len);
-char * xDbgEvlogEventCore (void *dpy, EvlogInfo *evinfo, char *reply, int *len);
+char * xDbgEvlogRequestCore (EvlogInfo *evinfo, char *reply, int *len);
+char * xDbgEvlogEventCore (EvlogInfo *evinfo, char *reply, int *len);
#endif
#include "xdbg_evlog.h"
static char *
-_EvlogRequestDamage(void *dpy, EvlogInfo *evinfo, char *reply, int *len)
+_EvlogRequestDamage(EvlogInfo *evinfo, char *reply, int *len)
{
xReq *req = evinfo->req.ptr;
}
static char*
-_EvlogEventDamage (void *dpy, EvlogInfo *evinfo, int first_base, char *reply, int *len)
+_EvlogEventDamage (EvlogInfo *evinfo, int first_base, char *reply, int *len)
{
xEvent *evt = evinfo->evt.ptr;
}
void
-xDbgEvlogDamageGetBase (void *dpy, ExtensionInfo *extinfo)
+xDbgEvlogDamageGetBase (ExtensionInfo *extinfo)
{
#ifdef XDBG_CLIENT
- Display *d = (Display*)dpy;
-
- RETURN_IF_FAIL (d != NULL);
RETURN_IF_FAIL (extinfo != NULL);
- if (!XQueryExtension(d, DAMAGE_NAME, &extinfo->opcode, &extinfo->evt_base, &extinfo->err_base))
- {
- XDBG_LOG ("no Damage extension. \n");
- return;
- }
-
extinfo->req_func = _EvlogRequestDamage;
extinfo->evt_func = _EvlogEventDamage;
#else
ExtensionEntry *xext = CheckExtension (DAMAGE_NAME);
RETURN_IF_FAIL (xext != NULL);
+ RETURN_IF_FAIL (extinfo != NULL);
extinfo->opcode = xext->base;
extinfo->evt_base = xext->eventBase;
#include "xdbg_types.h"
-void xDbgEvlogDamageGetBase (void *dpy, ExtensionInfo *extinfo);
+void xDbgEvlogDamageGetBase (ExtensionInfo *extinfo);
#endif
#include "xdbg_evlog.h"
static char *
-_EvlogRequestDri2 (void *dpy, EvlogInfo *evinfo, char *reply, int *len)
+_EvlogRequestDri2 (EvlogInfo *evinfo, char *reply, int *len)
{
xReq *req = evinfo->req.ptr;
stuff->dest);
REPLY (" Region");
- reply = xDbgGetRegion(dpy, evinfo, stuff->region, reply, len);
+ reply = xDbgGetRegion(stuff->region, evinfo, reply, len);
return reply;
}
stuff->drawable);
REPLY (" Region");
- reply = xDbgGetRegion(dpy, evinfo, stuff->region, reply, len);
+ reply = xDbgGetRegion(stuff->region, evinfo, reply, len);
return reply;
}
static char *
-_EvlogEventDri2 (void *dpy, EvlogInfo *evinfo, int first_base, char *reply, int *len)
+_EvlogEventDri2 (EvlogInfo *evinfo, int first_base, char *reply, int *len)
{
xEvent *evt = evinfo->evt.ptr;
stuff->sbc_hi,
stuff->sbc_lo);
+ evinfo->evt.size = sizeof (xDRI2BufferSwapComplete);
+
return reply;
}
void
-xDbgEvlogDri2GetBase (void *dpy, ExtensionInfo *extinfo)
+xDbgEvlogDri2GetBase (ExtensionInfo *extinfo)
{
#ifdef XDBG_CLIENT
- Display *d = (Display*)dpy;
-
- RETURN_IF_FAIL (d != NULL);
RETURN_IF_FAIL (extinfo != NULL);
- if (!XQueryExtension(d, DRI2_NAME, &extinfo->opcode, &extinfo->evt_base, &extinfo->err_base))
- {
- XDBG_LOG ("no DRI2 extension. \n");
- return;
- }
extinfo->req_func = _EvlogRequestDri2;
extinfo->evt_func = _EvlogEventDri2;
#else
ExtensionEntry *xext = CheckExtension (DRI2_NAME);
RETURN_IF_FAIL (xext != NULL);
+ RETURN_IF_FAIL (extinfo != NULL);
extinfo->opcode = xext->base;
extinfo->evt_base = xext->eventBase;
#include "xdbg_types.h"
-void xDbgEvlogDri2GetBase (void *dpy, ExtensionInfo *extinfo);
+void xDbgEvlogDri2GetBase (ExtensionInfo *extinfo);
#endif
#define UNKNOWN_EVENT "<unknown>"
-extern ExtensionInfo* Sorted_Evlog_extensions;
char *
-xDbgEvlogEvent (void *dpy, EvlogInfo *evinfo, Bool on, int Extensions_size, char *reply, int *len)
+xDbgEvlogEvent (EvlogInfo *evinfo, Bool on, char *reply, int *len)
{
- EvlogEvent ev;
+ extern ExtensionInfo* Sorted_Evlog_extensions;
+ extern int Extensions_size;
+ EvlogEvent ev;
xEvent *xEvt = NULL;
int type;
if (type < EXTENSION_EVENT_BASE)
{
- return xDbgEvlogEventCore (dpy, evinfo, reply, len);
+ return xDbgEvlogEventCore (evinfo, reply, len);
}
else
{
int i;
- for (i = 0 ; i < Extensions_size / sizeof (ExtensionInfo); i++)
+ for (i = 0 ; i < Extensions_size ; i++)
{
if (Sorted_Evlog_extensions[i].evt_base == 0)
continue;
- if (i != Extensions_size / sizeof (ExtensionInfo) - 1)
+ if (i != Extensions_size - 1)
{
if (type >= Sorted_Evlog_extensions[i].evt_base &&
type < Sorted_Evlog_extensions[i+1].evt_base)
{
- return Sorted_Evlog_extensions[i].evt_func (dpy, evinfo, Sorted_Evlog_extensions[i].evt_base, reply, len);
+ return Sorted_Evlog_extensions[i].evt_func (evinfo, Sorted_Evlog_extensions[i].evt_base, reply, len);
}
continue;
}
- return Sorted_Evlog_extensions[i].evt_func (dpy, evinfo, Sorted_Evlog_extensions[i].evt_base, reply, len);
+ return Sorted_Evlog_extensions[i].evt_func (evinfo, Sorted_Evlog_extensions[i].evt_base, reply, len);
}
}
#include "xdbg_types.h"
-char * xDbgEvlogEvent (void *dpy, EvlogInfo *evinfo, Bool on, int Extensions_size, char *reply, int *len);
+char * xDbgEvlogEvent (EvlogInfo *evinfo, Bool on, char *reply, int *len);
#endif
#include "xdbg_evlog.h"
static char *
-_EvlogRequestGesture(void *dpy, EvlogInfo *evinfo, char *reply, int *len)
+_EvlogRequestGesture(EvlogInfo *evinfo, char *reply, int *len)
{
xReq *req = evinfo->req.ptr;
}
static char *
-_EvlogEventGesture (void *dpy, EvlogInfo *evinfo, int first_base, char *reply, int *len)
+_EvlogEventGesture (EvlogInfo *evinfo, int first_base, char *reply, int *len)
{
xEvent *evt = evinfo->evt.ptr;
void
-xDbgEvlogGestureGetBase (void *dpy, ExtensionInfo *extinfo)
+xDbgEvlogGestureGetBase (ExtensionInfo *extinfo)
{
#ifdef XDBG_CLIENT
- Display *d = (Display*)dpy;
+ RETURN_IF_FAIL (extinfo != NULL);
- RETURN_IF_FAIL (d != NULL);
-
- if (!XQueryExtension(d, GESTURE_EXT_NAME, &extinfo->opcode, &extinfo->evt_base, &extinfo->err_base))
- {
- XDBG_LOG ("no Gesture extension. \n");
- return;
- }
extinfo->req_func = _EvlogRequestGesture;
extinfo->evt_func = _EvlogEventGesture;
#else
ExtensionEntry *xext = CheckExtension (GESTURE_EXT_NAME);
RETURN_IF_FAIL (xext != NULL);
+ RETURN_IF_FAIL (extinfo != NULL);
extinfo->opcode = xext->base;
extinfo->evt_base = xext->eventBase;
#include "xdbg_types.h"
-void xDbgEvlogGestureGetBase (void *dpy, ExtensionInfo *extinfo);
+void xDbgEvlogGestureGetBase (ExtensionInfo *extinfo);
#endif
#include "xdbg_evlog.h"
static char *
-_EvlogRequestRandr (void *dpy, EvlogInfo *evinfo, char *reply, int *len)
+_EvlogRequestRandr (EvlogInfo *evinfo, char *reply, int *len)
{
xReq *req = evinfo->req.ptr;
stuff->output);
REPLY (" Property");
- reply = xDbgGetAtom(dpy, stuff->property, reply, len);
+ reply = xDbgGetAtom(stuff->property, evinfo, reply, len);
return reply;
}
stuff->output);
REPLY (" Property");
- reply = xDbgGetAtom(dpy, stuff->property, reply, len);
+ reply = xDbgGetAtom(stuff->property, evinfo, reply, len);
return reply;
}
stuff->nUnits);
REPLY (" Property");
- reply = xDbgGetAtom(dpy, stuff->property, reply, len);
+ reply = xDbgGetAtom(stuff->property, evinfo, reply, len);
REPLY (" Type");
- reply = xDbgGetAtom(dpy, stuff->type, reply, len);
+ reply = xDbgGetAtom(stuff->type, evinfo, reply, len);
return reply;
}
stuff->output);
REPLY (" Property");
- reply = xDbgGetAtom(dpy, stuff->property, reply, len);
+ reply = xDbgGetAtom(stuff->property, evinfo, reply, len);
return reply;
}
stuff->longLength);
REPLY (" Property");
- reply = xDbgGetAtom(dpy, stuff->property, reply, len);
+ reply = xDbgGetAtom(stuff->property, evinfo, reply, len);
REPLY (" Type");
- reply = xDbgGetAtom(dpy, stuff->type, reply, len);
+ reply = xDbgGetAtom(stuff->type, evinfo, reply, len);
return reply;
}
static char *
-_EvlogEventRandr (void *dpy, EvlogInfo *evinfo, int first_base, char *reply, int *len)
+_EvlogEventRandr (EvlogInfo *evinfo, int first_base, char *reply, int *len)
{
xEvent *evt = evinfo->evt.ptr;
stuff->output);
REPLY (" Atom");
- reply = xDbgGetAtom(dpy, stuff->atom, reply, len);
+ reply = xDbgGetAtom(stuff->atom, evinfo, reply, len);
return reply;
}
stuff->provider);
REPLY (" Atom");
- reply = xDbgGetAtom(dpy, stuff->atom, reply, len);
+ reply = xDbgGetAtom(stuff->atom, evinfo, reply, len);
return reply;
}
void
-xDbgEvlogRandrGetBase (void *dpy, ExtensionInfo *extinfo)
+xDbgEvlogRandrGetBase (ExtensionInfo *extinfo)
{
#ifdef XDBG_CLIENT
- Display *d = (Display*)dpy;
-
- RETURN_IF_FAIL (d != NULL);
RETURN_IF_FAIL (extinfo != NULL);
- if (!XQueryExtension(d, RANDR_NAME, &extinfo->opcode, &extinfo->evt_base, &extinfo->err_base))
- {
- XDBG_LOG ("no Randr extension. \n");
- return;
- }
extinfo->req_func = _EvlogRequestRandr;
extinfo->evt_func = _EvlogEventRandr;
#else
ExtensionEntry *xext = CheckExtension (RANDR_NAME);
RETURN_IF_FAIL (xext != NULL);
+ RETURN_IF_FAIL (extinfo != NULL);
extinfo->opcode = xext->base;
extinfo->evt_base = xext->eventBase;
#include "xdbg_types.h"
-void xDbgEvlogRandrGetBase (void *dpy, ExtensionInfo *extinfo);
+void xDbgEvlogRandrGetBase (ExtensionInfo *extinfo);
#endif
#define UNKNOWN_EVENT "<unknown>"
-extern ExtensionInfo Evlog_extensions[];
char *
-xDbgEvlogReqeust (void *dpy, EvlogInfo *evinfo, Bool on, int Extensions_size, char *reply, int *len)
+xDbgEvlogReqeust (EvlogInfo *evinfo, Bool on, char *reply, int *len)
{
+ extern ExtensionInfo Evlog_extensions[];
+ extern int Extensions_size;
EvlogRequest req;
xReq *xReq = NULL;
+
RETURN_VAL_IF_FAIL (evinfo != NULL, reply);
RETURN_VAL_IF_FAIL (evinfo->type == REQUEST, reply);
if (xReq->reqType < EXTENSION_BASE)
{
- return xDbgEvlogRequestCore (dpy, evinfo, reply, len);
+ return xDbgEvlogRequestCore (evinfo, reply, len);
}
else
{
int i;
- for (i = 0 ; i < Extensions_size / sizeof (ExtensionInfo); i++)
+ for (i = 0 ; i < Extensions_size ; i++)
{
if (xReq->reqType == Evlog_extensions[i].opcode)
{
- return Evlog_extensions[i].req_func (dpy, evinfo, reply, len);
+ return Evlog_extensions[i].req_func (evinfo, reply, len);
}
}
}
#include "xdbg_types.h"
-char * xDbgEvlogReqeust (void *dpy, EvlogInfo *evinfo, Bool on, int Extensions_size, char *reply, int *len);
+char * xDbgEvlogReqeust (EvlogInfo *evinfo, Bool on, char *reply, int *len);
#endif
#include "xdbg_evlog.h"
static char *
-_EvlogRequestXextDpms(void *dpy, EvlogInfo *evinfo, char *reply, int *len)
+_EvlogRequestXextDpms(EvlogInfo *evinfo, char *reply, int *len)
{
xReq *req = evinfo->req.ptr;
static char *
-_EvlogRequestXextShm (void *dpy, EvlogInfo *evinfo, char *reply, int *len)
+_EvlogRequestXextShm (EvlogInfo *evinfo, char *reply, int *len)
{
xReq *req = evinfo->req.ptr;
}
static char *
-_EvlogRequestXextSync(void *dpy, EvlogInfo *evinfo, char *reply, int *len)
+_EvlogRequestXextSync(EvlogInfo *evinfo, char *reply, int *len)
{
xReq *req = evinfo->req.ptr;
}
static char *
-_EvlogRequestXextXtestExt1(void *dpy, EvlogInfo *evinfo, char *reply, int *len)
+_EvlogRequestXextXtestExt1(EvlogInfo *evinfo, char *reply, int *len)
{
xReq *req = evinfo->req.ptr;
static char *
-_EvlogRequestXextXtest(void *dpy, EvlogInfo *evinfo, char *reply, int *len)
+_EvlogRequestXextXtest(EvlogInfo *evinfo, char *reply, int *len)
{
xReq *req = evinfo->req.ptr;
static char *
-_EvlogEventXextDpms (void *dpy, EvlogInfo *evinfo, int first_base, char *reply, int *len)
+_EvlogEventXextDpms (EvlogInfo *evinfo, int first_base, char *reply, int *len)
{
xEvent *evt = evinfo->evt.ptr;
static char *
-_EvlogEventXextShm (void *dpy, EvlogInfo *evinfo, int first_base, char *reply, int *len)
+_EvlogEventXextShm (EvlogInfo *evinfo, int first_base, char *reply, int *len)
{
xEvent *evt = evinfo->evt.ptr;
static char *
-_EvlogEventXextSync (void *dpy, EvlogInfo *evinfo, int first_base, char *reply, int *len)
+_EvlogEventXextSync (EvlogInfo *evinfo, int first_base, char *reply, int *len)
{
xEvent *evt = evinfo->evt.ptr;
static char *
-_EvlogEventXextXtestExt1 (void *dpy, EvlogInfo *evinfo, int first_base, char *reply, int *len)
+_EvlogEventXextXtestExt1 (EvlogInfo *evinfo, int first_base, char *reply, int *len)
{
xEvent *evt = evinfo->evt.ptr;
}
static char *
-_EvlogEventXextXtest (void *dpy, EvlogInfo *evinfo, int first_base, char *reply, int *len)
+_EvlogEventXextXtest (EvlogInfo *evinfo, int first_base, char *reply, int *len)
{
xEvent *evt = evinfo->evt.ptr;
}
void
-xDbgEvlogXextDpmsGetBase (void *dpy, ExtensionInfo *extinfo)
+xDbgEvlogXextDpmsGetBase (ExtensionInfo *extinfo)
{
#ifdef XDBG_CLIENT
- Display *d = (Display*)dpy;
-
- RETURN_IF_FAIL (d != NULL);
RETURN_IF_FAIL (extinfo != NULL);
- if (!XQueryExtension(d, DPMSExtensionName, &extinfo->opcode, &extinfo->evt_base, &extinfo->err_base))
- {
- XDBG_LOG ("no Xext_DPMS extension. \n");
- return;
- }
extinfo->req_func = _EvlogRequestXextDpms;
extinfo->evt_func = _EvlogEventXextDpms;
#else
ExtensionEntry *xext = CheckExtension (DPMSExtensionName);
RETURN_IF_FAIL (xext != NULL);
+ RETURN_IF_FAIL (extinfo != NULL);
extinfo->opcode = xext->base;
extinfo->evt_base = xext->eventBase;
void
-xDbgEvlogXextShmGetBase (void *dpy, ExtensionInfo *extinfo)
+xDbgEvlogXextShmGetBase (ExtensionInfo *extinfo)
{
#ifdef XDBG_CLIENT
- Display *d = (Display*)dpy;
-
- RETURN_IF_FAIL (d != NULL);
RETURN_IF_FAIL (extinfo != NULL);
- if (!XQueryExtension(d, SHMNAME, &extinfo->opcode, &extinfo->evt_base, &extinfo->err_base))
- {
- XDBG_LOG ("no XShm extension. \n");
- return;
- }
extinfo->req_func = _EvlogRequestXextShm;
extinfo->evt_func = _EvlogEventXextShm;
#else
ExtensionEntry *xext = CheckExtension (SHMNAME);
RETURN_IF_FAIL (xext != NULL);
+ RETURN_IF_FAIL (extinfo != NULL);
extinfo->opcode = xext->base;
extinfo->evt_base = xext->eventBase;
void
-xDbgEvlogXextSyncGetBase (void *dpy, ExtensionInfo *extinfo)
+xDbgEvlogXextSyncGetBase (ExtensionInfo *extinfo)
{
#ifdef XDBG_CLIENT
- Display *d = (Display*)dpy;
-
- RETURN_IF_FAIL (d != NULL);
RETURN_IF_FAIL (extinfo != NULL);
- if (!XQueryExtension(d, SYNC_NAME, &extinfo->opcode, &extinfo->evt_base, &extinfo->err_base))
- {
- XDBG_LOG ("no Sync extension. \n");
- return;
- }
-
extinfo->req_func = _EvlogRequestXextSync;
extinfo->evt_func = _EvlogEventXextSync;
#else
ExtensionEntry *xext = CheckExtension (SYNC_NAME);
RETURN_IF_FAIL (xext != NULL);
+ RETURN_IF_FAIL (extinfo != NULL);
extinfo->opcode = xext->base;
extinfo->evt_base = xext->eventBase;
void
-xDbgEvlogXextXtestExt1GetBase (void *dpy, ExtensionInfo *extinfo)
+xDbgEvlogXextXtestExt1GetBase (ExtensionInfo *extinfo)
{
#ifdef XDBG_CLIENT
- Display *d = (Display*)dpy;
-
- RETURN_IF_FAIL (d != NULL);
RETURN_IF_FAIL (extinfo != NULL);
- if (!XQueryExtension(d, XTestEXTENSION_NAME, &extinfo->opcode, &extinfo->evt_base, &extinfo->err_base))
- {
- XDBG_LOG ("no XTestExt1 extension. \n");
- return;
- }
extinfo->req_func = _EvlogRequestXextXtestExt1;
extinfo->evt_func = _EvlogEventXextXtestExt1;
#else
ExtensionEntry *xext = CheckExtension (XTestEXTENSION_NAME);
RETURN_IF_FAIL (xext != NULL);
+ RETURN_IF_FAIL (extinfo != NULL);
extinfo->opcode = xext->base;
extinfo->evt_base = xext->eventBase;
void
-xDbgEvlogXextXtestGetBase (void *dpy, ExtensionInfo *extinfo)
+xDbgEvlogXextXtestGetBase (ExtensionInfo *extinfo)
{
#ifdef XDBG_CLIENT
- Display *d = (Display*)dpy;
-
- RETURN_IF_FAIL (d != NULL);
RETURN_IF_FAIL (extinfo != NULL);
- if (!XQueryExtension(d, XTestExtensionName, &extinfo->opcode, &extinfo->evt_base, &extinfo->err_base))
- {
- XDBG_LOG ("no Xext_Xtest extension. \n");
- return;
- }
extinfo->req_func = _EvlogRequestXextXtest;
extinfo->evt_func = _EvlogEventXextXtest;
#else
ExtensionEntry *xext = CheckExtension (XTestExtensionName);
RETURN_IF_FAIL (xext != NULL);
+ RETURN_IF_FAIL (extinfo != NULL);
extinfo->opcode = xext->base;
extinfo->evt_base = xext->eventBase;
#include "xdbg_types.h"
-void xDbgEvlogXextDpmsGetBase (void *dpy, ExtensionInfo *extinfo);
-void xDbgEvlogXextShmGetBase (void *dpy, ExtensionInfo *extinfo);
-void xDbgEvlogXextSyncGetBase (void *dpy, ExtensionInfo *extinfo);
-void xDbgEvlogXextXtestExt1GetBase (void *dpy, ExtensionInfo *extinfo);
-void xDbgEvlogXextXtestGetBase (void *dpy, ExtensionInfo *extinfo);
+void xDbgEvlogXextDpmsGetBase (ExtensionInfo *extinfo);
+void xDbgEvlogXextShmGetBase (ExtensionInfo *extinfo);
+void xDbgEvlogXextSyncGetBase (ExtensionInfo *extinfo);
+void xDbgEvlogXextXtestExt1GetBase (ExtensionInfo *extinfo);
+void xDbgEvlogXextXtestGetBase (ExtensionInfo *extinfo);
#endif
#include "xdbg_evlog.h"
static char *
-_EvlogRequestXinput (void *dpy, EvlogInfo *evinfo, char *reply, int *len)
+_EvlogRequestXinput (EvlogInfo *evinfo, char *reply, int *len)
{
xReq *req = evinfo->req.ptr;
stuff->num_items);
REPLY (" Property");
- reply = xDbgGetAtom(dpy, stuff->property, reply, len);
+ reply = xDbgGetAtom(stuff->property, evinfo, reply, len);
REPLY (" Type");
- reply = xDbgGetAtom(dpy, stuff->type, reply, len);
+ reply = xDbgGetAtom(stuff->type, evinfo, reply, len);
return reply;
}
stuff->deviceid);
REPLY (" Property");
- reply = xDbgGetAtom(dpy, stuff->property, reply, len);
+ reply = xDbgGetAtom(stuff->property, evinfo, reply, len);
return reply;
}
stuff->deviceid);
REPLY (" Property");
- reply = xDbgGetAtom(dpy, stuff->property, reply, len);
+ reply = xDbgGetAtom(stuff->property, evinfo, reply, len);
REPLY (" Type");
- reply = xDbgGetAtom(dpy, stuff->type, reply, len);
+ reply = xDbgGetAtom(stuff->type, evinfo, reply, len);
return reply;
}
}
static char *
-_EvlogEventXinput (void *dpy, EvlogInfo *evinfo, int first_base, char *reply, int *len)
+_EvlogEventXinput (EvlogInfo *evinfo, int first_base, char *reply, int *len)
{
xEvent *evt = evinfo->evt.ptr;
stuff->deviceid);
REPLY (" Atom");
- reply = xDbgGetAtom(dpy, stuff->atom, reply, len);
+ reply = xDbgGetAtom(stuff->atom, evinfo, reply, len);
return reply;
}
}
void
-xDbgEvlogXinputGetBase (void *dpy, ExtensionInfo *extinfo)
+xDbgEvlogXinputGetBase (ExtensionInfo *extinfo)
{
#ifdef XDBG_CLIENT
- Display *d = (Display*)dpy;
-
- RETURN_IF_FAIL (d != NULL);
RETURN_IF_FAIL (extinfo != NULL);
- if (!XQueryExtension(d, INAME, &extinfo->opcode, &extinfo->evt_base, &extinfo->err_base))
- {
- XDBG_LOG ("no Xinput extension. \n");
- return;
- }
extinfo->req_func = _EvlogRequestXinput;
extinfo->evt_func = _EvlogEventXinput;
#else
ExtensionEntry *xext = CheckExtension (INAME);
RETURN_IF_FAIL (xext != NULL);
+ RETURN_IF_FAIL (extinfo != NULL);
extinfo->opcode = xext->base;
extinfo->evt_base = xext->eventBase;
#include "xdbg_types.h"
-void xDbgEvlogXinputGetBase (void *dpy, ExtensionInfo *extinfo);
+void xDbgEvlogXinputGetBase (ExtensionInfo *extinfo);
#endif
#include "xdbg_evlog.h"
static char *
-_EvlogRequestXv(void *dpy, EvlogInfo *evinfo, char *reply, int *len)
+_EvlogRequestXv(EvlogInfo *evinfo, char *reply, int *len)
{
xReq *req = evinfo->req.ptr;
stuff->value);
REPLY (" Attribute");
- reply = xDbgGetAtom(dpy, stuff->attribute, reply, len);
+ reply = xDbgGetAtom(stuff->attribute, evinfo, reply, len);
return reply;
}
stuff->port);
REPLY (" Attribute");
- reply = xDbgGetAtom(dpy, stuff->attribute, reply, len);
+ reply = xDbgGetAtom(stuff->attribute, evinfo, reply, len);
return reply;
}
}
static char *
-_EvlogEventXv (void *dpy, EvlogInfo *evinfo, int first_base, char *reply, int *len)
+_EvlogEventXv (EvlogInfo *evinfo, int first_base, char *reply, int *len)
{
xEvent *evt = evinfo->evt.ptr;
stuff->value);
REPLY (" Attribute");
- reply = xDbgGetAtom(dpy, stuff->attribute, reply, len);
+ reply = xDbgGetAtom(stuff->attribute, evinfo, reply, len);
return reply;
}
}
void
-xDbgEvlogXvGetBase (void *dpy, ExtensionInfo *extinfo)
+xDbgEvlogXvGetBase (ExtensionInfo *extinfo)
{
#ifdef XDBG_CLIENT
- Display *d = (Display*)dpy;
-
- RETURN_IF_FAIL (d != NULL);
RETURN_IF_FAIL (extinfo != NULL);
- if (!XQueryExtension(d, XvName, &extinfo->opcode, &extinfo->evt_base, &extinfo->err_base))
- {
- XDBG_LOG ("no Xv extension. \n");
- return;
- }
extinfo->req_func = _EvlogRequestXv;
extinfo->evt_func = _EvlogEventXv;
#else
ExtensionEntry *xext = CheckExtension (XvName);
RETURN_IF_FAIL (xext != NULL);
+ RETURN_IF_FAIL (extinfo != NULL);
extinfo->opcode = xext->base;
extinfo->evt_base = xext->eventBase;
#include "xdbg_types.h"
-void xDbgEvlogXvGetBase (void *dpy, ExtensionInfo *extinfo);
+void xDbgEvlogXvGetBase (ExtensionInfo *extinfo);
#endif
#include <X11/Xdefs.h> /* for Bool */
#include <X11/Xlib.h>
#include <X11/extensions/Xfixes.h>
+#include <list.h>
#define XDBG_PATH_MAX 1024
+#define XDBG_BUF_SIZE 64
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
#define EVLOG_MASK_CLIENT (1<<0)
#define EVLOG_MASK_REQUEST (1<<1)
#define EVLOG_MASK_EVENT (1<<2)
+#define EVLOG_MASK_ATOM (1<<3)
+#define EVLOG_MASK_REGION (1<<4)
+
+
+typedef struct _EvlogTable
+{
+ CARD32 xid;
+ char buf[XDBG_BUF_SIZE];
+ struct xorg_list link;
+} EvlogAtomTable, EvlogRegionTable;
+
+typedef struct _EvlogList
+{
+ struct xorg_list list;
+ int init;
+ int size;
+} EvlogAtom, EvlogRegion;
typedef struct _EvlogClient
{
typedef struct _EvlogEvent
{
xEvent *ptr;
+ int size;
char name[PATH_MAX+1];
} EvlogEvent;
typedef struct _EvlogInfo
{
- EvlogType type;
+ EvlogType type;
- int mask;
- EvlogClient client;
- EvlogRequest req;
- EvlogEvent evt;
+ int mask;
+ EvlogClient client;
+ EvlogRequest req;
+ EvlogEvent evt;
+ EvlogAtom evatom;
+ EvlogRegion evregion;
- CARD32 time;
+ CARD32 time;
} EvlogInfo;
struct _ExtensionInfo
{
- void (*get_base_func) (void *dpy, ExtensionInfo *extinfo);
+ void (*get_base_func) (ExtensionInfo *extinfo);
int opcode;
int evt_base;
int err_base;
- 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);
+ char* (*req_func) (EvlogInfo *evinfo, char *reply, int *len);
+ char* (*evt_func) (EvlogInfo *evinfo, int first_base, char *reply, int *len);
};
#endif
static int xev_trace_record_fd = -1;
static Atom atom_rotate = None;
static Atom atom_client_pid = None;
+static int init = 0;
static void evtRecord (int fd, EvlogInfo *evinfo)
{
+ extern ExtensionInfo Evlog_extensions[];
+ extern int Extensions_size;
int write_len = 0;
+ int i;
XDBG_RETURN_IF_FAIL (fd >= 0)
XDBG_RETURN_IF_FAIL (evinfo != NULL);
write_len += (sizeof (EvlogRequest) + (evinfo->req.length * 4));
if (evinfo->mask & EVLOG_MASK_EVENT)
- write_len += (sizeof (EvlogEvent) + sizeof (xEvent));
+ write_len += (sizeof (EvlogEvent) + evinfo->evt.size);
+
+ if (evinfo->mask & EVLOG_MASK_ATOM)
+ write_len += (sizeof (int) +
+ (sizeof (EvlogAtomTable) * evinfo->evatom.size));
+
+ if (evinfo->mask & EVLOG_MASK_REGION)
+ write_len += (sizeof (int) +
+ (sizeof (EvlogRegionTable) * evinfo->evregion.size));
+
+ if (!init)
+ write_len += (sizeof (int) +
+ ((sizeof (int) * 3) * Extensions_size));
if (write (fd, &write_len, sizeof(int)) == -1)
{
XDBG_ERROR (MXDBG, "failed: write write_len\n");
return;
}
+
+ if (!init)
+ {
+ if (write (fd, &Extensions_size, sizeof(int)) == -1)
+ {
+ XDBG_ERROR (MXDBG, "failed: write Extensions_size\n");
+ return;
+ }
+
+ for (i = 0 ; i < Extensions_size ; i++)
+ {
+ if (write (fd, &Evlog_extensions[i].opcode, sizeof(int)) == -1)
+ {
+ XDBG_ERROR (MXDBG, "failed: write Evlog_extensions[%d] opcode\n", i);
+ return;
+ }
+ if (write (fd, &Evlog_extensions[i].evt_base, sizeof(int)) == -1)
+ {
+ XDBG_ERROR (MXDBG, "failed: write Evlog_extensions[%d] evt_base\n", i);
+ return;
+ }
+ if (write (fd, &Evlog_extensions[i].err_base, sizeof(int)) == -1)
+ {
+ XDBG_ERROR (MXDBG, "failed: write Evlog_extensions[%d] err_base\n", i);
+ return;
+ }
+ }
+
+ init = 1;
+ }
+
if (write (fd, &evinfo->time, sizeof(CARD32)) == -1)
{
XDBG_ERROR (MXDBG, "failed: write msec\n");
XDBG_ERROR (MXDBG, "failed: write event\n");
return;
}
- if (write (fd, evinfo->evt.ptr, sizeof (xEvent)) == -1)
+
+ XDBG_WARNING_IF_FAIL (evinfo->evt.size > 0);
+ if (write (fd, evinfo->evt.ptr, evinfo->evt.size) == -1)
{
XDBG_ERROR (MXDBG, "failed: write event\n");
return;
}
}
-}
-static void evtPrintF (int fd, EvlogInfo *evinfo)
-{
- char log[1024];
- int size = sizeof (log);
+ if (evinfo->mask & EVLOG_MASK_ATOM)
+ {
+ EvlogAtomTable *table;
+ if (write (fd, &evinfo->evatom.size, sizeof (int)) == -1)
+ {
+ XDBG_ERROR (MXDBG, "failed: write atom size\n");
+ return;
+ }
+ xorg_list_for_each_entry(table, &evinfo->evatom.list, link)
+ if (write (fd, table, sizeof (EvlogAtomTable)) == -1)
+ {
+ XDBG_ERROR (MXDBG, "failed: write atom table\n");
+ return;
+ }
+ }
+ if (evinfo->mask & EVLOG_MASK_REGION)
+ {
+ EvlogRegionTable *table;
- xDbgEvlogFillLog (NULL, evinfo, TRUE, log, &size);
+ if (write (fd, &evinfo->evregion.size, sizeof (int)) == -1)
+ {
+ XDBG_ERROR (MXDBG, "failed: write region size\n");
+ return;
+ }
+ xorg_list_for_each_entry(table, &evinfo->evregion.list, link)
+ if (write (fd, table, sizeof (EvlogRegionTable)) == -1)
+ {
+ XDBG_ERROR (MXDBG, "failed: write region table\n");
+ return;
+ }
+ }
+}
+static void evtPrintF (int fd, EvlogInfo *evinfo, char *log)
+{
if (fd < 0)
ErrorF ("%s", log);
else
static void evtPrint (EvlogType type, ClientPtr client, xEvent *ev)
{
EvlogInfo evinfo = {0,};
+ static int EntryInit = 0;
/* evinfo.type */
evinfo.type = type;
/* evinfo.time */
evinfo.time = GetTimeInMillis ();
+ /* get extension entry */
+ if (!EntryInit && !xDbgEvlogGetExtensionEntry (NULL))
+ return;
+
+ EntryInit = 1;
+
if (!xDbgEvlogRuleValidate (&evinfo))
return;
if (xev_trace_record_fd >= 0)
+ {
+ xDbgEvlogFillLog (&evinfo, TRUE, NULL, NULL);
evtRecord (xev_trace_record_fd, &evinfo);
+ }
else
- evtPrintF (xev_trace_fd, &evinfo);
+ {
+ char log[1024];
+ int size = sizeof (log);
+
+ xDbgEvlogFillLog (&evinfo, TRUE, log, &size);
+ evtPrintF (xev_trace_fd, &evinfo, log);
+ }
+ /* evatom initialize */
+ xDbgDistroyAtomList(&evinfo);
+ xDbgDistroyRegionList(&evinfo);
}
static const char*
xDbgModuleEvlogSetEvlogPath (XDbgModule *pMod, int pid, char *path, char *reply, int *len)
{
char fd_name[XDBG_PATH_MAX];
+ int fd_check = -1;
if (!path || strlen (path) <= 0)
{
snprintf (fd_name, XDBG_PATH_MAX, "%s", path);
}
+ fd_check = open (fd_name, O_RDONLY);
+ if(fd_check < 0)
+ init = 0;
+ else
+ close (fd_check);
+
xev_trace_record_fd = open (fd_name, O_CREAT|O_RDWR|O_APPEND, 0755);
if (xev_trace_record_fd < 0)
{