add supplementary log massage of each major extension
authorHeebum Kwak <heebum0.kwak@samsung.com>
Mon, 22 Apr 2013 08:47:24 +0000 (17:47 +0900)
committerBoram Park <boram1288.park@samsung.com>
Mon, 17 Jun 2013 08:44:34 +0000 (17:44 +0900)
Change-Id: I25e769035055c0c8d30f8d91ee6af4cd08c535da

31 files changed:
bin/xevlog_analyze/xevlog_analyze.c
common/Makefile.am
common/ds/bool_exp_rule_checker.c
common/xdbg_evlog.c
common/xdbg_evlog.h
common/xdbg_evlog_composite.c [new file with mode: 0644]
common/xdbg_evlog_composite.h [new file with mode: 0644]
common/xdbg_evlog_core.c [new file with mode: 0644]
common/xdbg_evlog_core.h [new file with mode: 0644]
common/xdbg_evlog_damage.c [new file with mode: 0644]
common/xdbg_evlog_damage.h [new file with mode: 0644]
common/xdbg_evlog_dri2.c [new file with mode: 0644]
common/xdbg_evlog_dri2.h [new file with mode: 0644]
common/xdbg_evlog_event.c
common/xdbg_evlog_event.h
common/xdbg_evlog_gesture.c [new file with mode: 0644]
common/xdbg_evlog_gesture.h [new file with mode: 0644]
common/xdbg_evlog_randr.c [new file with mode: 0644]
common/xdbg_evlog_randr.h [new file with mode: 0644]
common/xdbg_evlog_request.c
common/xdbg_evlog_request.h
common/xdbg_evlog_xext.c [new file with mode: 0644]
common/xdbg_evlog_xext.h [new file with mode: 0644]
common/xdbg_evlog_xinput.c [new file with mode: 0644]
common/xdbg_evlog_xinput.h [new file with mode: 0644]
common/xdbg_evlog_xv.c [new file with mode: 0644]
common/xdbg_evlog_xv.h [new file with mode: 0644]
common/xdbg_types.h
configure.ac
module/xdbg_module_evlog.c
packaging/xorg-x11-module-xdbg.spec

index be6da62..6fc99a0 100644 (file)
@@ -114,6 +114,8 @@ static void _xEvlogAnalyzePrint (EvlogOption *eo)
         char log[1024];
         int size = sizeof (log);
 
+        memset (&evinfo, 0, sizeof (EvlogInfo));
+
         total = read_len;
 
         read_len = read (fd, &evinfo.time, sizeof (CARD32));
@@ -142,15 +144,15 @@ static void _xEvlogAnalyzePrint (EvlogOption *eo)
             GOTO_IF_FAIL (read_len == sizeof(EvlogRequest), print_done);
             total += read_len;
 
-            evinfo.req.ptr = malloc (sizeof(xReq));
+            evinfo.req.ptr = malloc (evinfo.req.length * 4);
             GOTO_IF_FAIL (evinfo.req.ptr != NULL, print_done);
 
-            read_len = read (fd, evinfo.req.ptr, sizeof (xReq));
-            GOTO_IF_FAIL (read_len == sizeof(xReq), print_done);
+            read_len = read (fd, evinfo.req.ptr, (evinfo.req.length * 4));
+            GOTO_IF_FAIL (read_len == (evinfo.req.length * 4), print_done);
             total += read_len;
         }
 
-        else if (evinfo.mask & EVLOG_MASK_EVENT)
+        if (evinfo.mask & EVLOG_MASK_EVENT)
         {
             read_len = read (fd, &evinfo.evt, sizeof(EvlogEvent));
             GOTO_IF_FAIL (read_len == sizeof(EvlogEvent), print_done);
@@ -174,7 +176,7 @@ static void _xEvlogAnalyzePrint (EvlogOption *eo)
             evinfo.req.ptr = NULL;
         }
 
-        else if (evinfo.evt.ptr)
+        if (evinfo.evt.ptr)
         {
             free (evinfo.evt.ptr);
             evinfo.evt.ptr = NULL;
@@ -186,7 +188,7 @@ print_done:
     if (evinfo.req.ptr)
         free (evinfo.req.ptr);
 
-    else if (evinfo.evt.ptr)
+    if (evinfo.evt.ptr)
         free (evinfo.evt.ptr);
 
     if (cfd >= 0)
index 92e0701..4168875 100644 (file)
@@ -26,6 +26,15 @@ COMMON_SOURCE =  \
     xdbg_dbus_client.c \
     xdbg_evlog.c \
     xdbg_evlog_request.c \
+    xdbg_evlog_core.c \
+    xdbg_evlog_composite.c \
+    xdbg_evlog_dri2.c \
+    xdbg_evlog_damage.c \
+    xdbg_evlog_gesture.c \
+    xdbg_evlog_xext.c \
+    xdbg_evlog_randr.c \
+    xdbg_evlog_xinput.c \
+    xdbg_evlog_xv.c \
     xdbg_evlog_event.c \
     ds/bintree.c \
     ds/bool_exp_parser.c \
index 563e9a2..a246e6b 100644 (file)
@@ -341,26 +341,26 @@ void rulechecker_print_rule (RULE_CHECKER rc, char * rules_buf)
 const char * rulechecker_print_usage()
 {
     return
-        "###################################################\n"
-        "###    RuleChecker 1.0 for XBerc EvLog filtering.                                \n"
-        "###                 Designed and developed by\n"
-        "###                 Boram Park <boram1288.park@samsung.com>\n"
-        "###################################################\n"
+        "######################################################################\n"
+        "###     RuleChecker 1.0 for XDBG EvLog filtering.                  ###\n"
+        "###                 Designed and developed by                      ###\n"
+        "###                 Boram Park <boram1288.park@samsung.com>        ###\n"
+        "######################################################################\n"
         "\n"
         "-----------------------------------------------------------------\n"
         "How to read evlog messages :\n"
         "      Client(pid: [PID]|       [CMD])   <======     [TYPE]( [MAJOR]:  [MINOR])   =====     XServer\n"
         "\n"
         "   ie)\n"
-        "        Client(pid:00345|        xberc)   <======    Event (       X11:SendEvent)   =====     XServer\n"
-        "             ==> type = event && pid = 345 && cmd = xberc && major = X11 && minor = SendEvent\n"
+        "        Client(pid:00345|        xdbg)   <======    Event (       X11:SendEvent)   =====     XServer\n"
+        "             ==> type = event && pid = 345 && cmd = xdbg && major = X11 && minor = SendEvent\n"
         "        Client(pid:00111|        xeyes)     =====   Request(       SHM:ShmAttach)   ======>   XServer\n"
         "             ==> type = request && pid = 111 && cmd = xeyes && major = SHM && minor = ShmAttach\n"
         "\n"
         "-----------------------------------------------------------------\n"
-        "Usage : xberc evlog_rule add [POLICY] [RULE]\n"
-        "        xberc evlog_rule remove [INDEX]\n"
-        "        xberc evlog_rule help /print\n"
+        "Usage : xdbg evlog_rule add [POLICY] [RULE]\n"
+        "        xdbg evlog_rule remove [INDEX]\n"
+        "        xdbg evlog_rule help /print\n"
         "      [POLICY] : allow / deny \n"
         "      [RULE] : C Language-style boolean expression syntax. [VARIABLE] [COMPAROTOR] [VALUE]\n"
         "      [VARIABLE] : type / major / minor / command / cmd / pid\n"
@@ -368,9 +368,9 @@ const char * rulechecker_print_usage()
         "      [VALUE] : string / number  \n"
         "\n"
         "   ie)\n"
-        "        xberc evlog_rule add allow \"(type=request) && (major == X11 and (minor = SendEvent or minor = ReceiveEvent))\"\n"
-        "        xberc evlog_rule add deny cmd!=ls\n"
-        "        xberc evlog_rule remove 1\n"
+        "        xdbg evlog_rule add allow \"(type=request) && (major == X11 and (minor = SendEvent or minor = ReceiveEvent))\"\n"
+        "        xdbg evlog_rule add deny cmd!=ls\n"
+        "        xdbg evlog_rule remove 1\n"
         "\n";
 }
 
index eaae2d6..70125a8 100644 (file)
@@ -39,6 +39,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include <fcntl.h>
 #include <unistd.h>
 #include <time.h>
+#include <X11/Xlib.h>
 
 #include "xdbg_types.h"
 #include "xdbg_evlog.h"
@@ -225,10 +226,107 @@ xDbgEvlogRuleValidate (EvlogInfo *evinfo)
                                       cmd);
 }
 
+
+ExtensionInfo Evlog_extensions[] = {
+    {xDbgEvlogCompositeGetBase, 0, 0, 0, NULL},
+    {xDbgEvlogDamageGetBase, 0, 0, 0, NULL},
+    {xDbgEvlogDri2GetBase, 0, 0, 0, NULL},
+    {xDbgEvlogGestureGetBase, 0, 0, 0, NULL},
+    {xDbgEvlogRandrGetBase, 0, 0, 0, NULL},
+    {xDbgEvlogXextDpmsGetBase, 0, 0, 0, NULL},
+    {xDbgEvlogXextShmGetBase, 0, 0, 0, NULL},
+    {xDbgEvlogXextSyncGetBase, 0, 0, 0, NULL},
+    {xDbgEvlogXextXtestGetBase, 0, 0, 0, NULL},
+    {xDbgEvlogXextXtestExt1GetBase, 0, 0, 0, NULL},
+    {xDbgEvlogXvGetBase, 0, 0, 0, NULL}
+};
+ExtensionInfo* Sorted_Evlog_extensions;
+
+static void
+_ExtensionsSwap(ExtensionInfo* first, ExtensionInfo* second)
+{
+    ExtensionInfo temp;
+
+    temp = *first ;
+    *first = *second ;
+    *second = temp ;
+}
+
+static Bool
+_SortEvlogExtensions ()
+{
+    int i,j;
+    int swap;
+
+    Sorted_Evlog_extensions = (ExtensionInfo*)malloc(sizeof(Evlog_extensions));
+    RETURN_VAL_IF_FAIL (Sorted_Evlog_extensions != NULL, FALSE);
+
+    memcpy(Sorted_Evlog_extensions, Evlog_extensions, sizeof(Evlog_extensions));
+
+    for (i = 0 ; i < sizeof (Evlog_extensions) / sizeof (ExtensionInfo) - 1 ; i++)
+    {
+        swap = 0;
+        for (j = 1 ; j < sizeof (Evlog_extensions) / sizeof (ExtensionInfo) - i ; j++)
+        {
+            if(Sorted_Evlog_extensions[j-1].evt_base > Sorted_Evlog_extensions[j].evt_base)
+            {
+                _ExtensionsSwap(&Sorted_Evlog_extensions[j-1], &Sorted_Evlog_extensions[j]);
+                swap = 1;
+            }
+        }
+        if (!swap) break;
+    }
+
+    return TRUE;
+}
+
+
+static Bool
+_EvlogGetExtentionEntry (int *return_extensions_size)
+{
+    static int init = 0;
+    static Bool success = FALSE;
+    Display *dpy = NULL;
+    int i;
+
+    if (init)
+        return success;
+
+    init = 1;
+
+#ifdef XDBG_CLIENT
+    dpy = XOpenDisplay (NULL);
+    if (!dpy)
+    {
+        fprintf (stderr, "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;
+
+    return success;
+}
+
+
 void
 xDbgEvlogFillLog (EvlogInfo *evinfo, 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*)));
@@ -242,16 +340,16 @@ xDbgEvlogFillLog (EvlogInfo *evinfo, char *reply, int *len)
                 evt_dir[evinfo->type],
                 evt_type[evinfo->type]);
 
-    if (evinfo->type == REQUEST)
+    if (evinfo->type == REQUEST && _EvlogGetExtentionEntry (&Extensions_size))
     {
         REPLY ("(");
-        reply = xDbgEvlogReqeust (evinfo, reply, len);
+        reply = xDbgEvlogReqeust (evinfo, Extensions_size, reply, len);
         REPLY (")");
     }
-    else if (evinfo->type == EVENT)
+    else if (evinfo->type == EVENT && _EvlogGetExtentionEntry (&Extensions_size))
     {
         REPLY ("(");
-        reply = xDbgEvlogEvent (evinfo, reply, len);
+        reply = xDbgEvlogEvent (evinfo, Extensions_size, reply, len);
         REPLY (")");
     }
     else
@@ -268,3 +366,6 @@ xDbgEvlogFillLog (EvlogInfo *evinfo, char *reply, int *len)
 
     prev = evinfo->time;
 }
+
+
+
index 9dd4388..275e4de 100644 (file)
@@ -36,6 +36,17 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "xdbg_evlog_request.h"
 #include "xdbg_evlog_event.h"
 
+#include "xdbg_evlog_core.h"
+#include "xdbg_evlog_dri2.h"
+#include "xdbg_evlog_composite.h"
+#include "xdbg_evlog_damage.h"
+#include "xdbg_evlog_gesture.h"
+#include "xdbg_evlog_xext.h"
+#include "xdbg_evlog_randr.h"
+#include "xdbg_evlog_xinput.h"
+#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);
diff --git a/common/xdbg_evlog_composite.c b/common/xdbg_evlog_composite.c
new file mode 100644 (file)
index 0000000..d2fc8b1
--- /dev/null
@@ -0,0 +1,166 @@
+/**************************************************************************
+
+xdbg
+
+Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
+
+Contact: Boram Park <boram1288.park@samsung.com>
+         Sangjin LEE <lsj119@samsung.com>
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <string.h>
+#include <strings.h>
+#include <sys/types.h>
+#include <sys/fcntl.h>
+#include <unistd.h>
+#include <stdarg.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+#include <dix.h>
+#define XREGISTRY
+#include <registry.h>
+#include <xace.h>
+#include <xacestr.h>
+#include <X11/Xatom.h>
+#include <X11/Xlib.h>
+#include <windowstr.h>
+#include <X11/extensions/Xcomposite.h>
+#include <X11/extensions/compositeproto.h>
+
+#include "xdbg_types.h"
+#include "xdbg_evlog_composite.h"
+
+static char *
+_EvlogRequestComposite(xReq *req, char *reply, int *len)
+{
+    xReq *stuff = req;
+
+    switch (stuff->data)
+    {
+    case X_CompositeRedirectWindow:
+        {
+            xCompositeRedirectWindowReq *stuff = (xCompositeRedirectWindowReq *)req;
+            REPLY (": XID(0x%lx) Update(%d)",
+                stuff->window,
+                stuff->update);
+
+            return reply;
+        }
+
+    case X_CompositeRedirectSubwindows:
+        {
+            xCompositeRedirectSubwindowsReq *stuff = (xCompositeRedirectSubwindowsReq *)req;
+            REPLY (": XID(0x%lx) Update(%d)",
+                stuff->window,
+                stuff->update);
+
+            return reply;
+        }
+
+    case X_CompositeUnredirectWindow:
+        {
+            xCompositeUnredirectWindowReq *stuff = (xCompositeUnredirectWindowReq *)req;
+            REPLY (": XID(0x%lx) Update(%d)",
+                stuff->window,
+                stuff->update);
+
+            return reply;
+        }
+
+    case X_CompositeUnredirectSubwindows:
+        {
+            xCompositeUnredirectSubwindowsReq *stuff = (xCompositeUnredirectSubwindowsReq *)req;
+            REPLY (": XID(0x%lx) Update(%d)",
+                stuff->window,
+                stuff->update);
+
+            return reply;
+        }
+
+    case X_CompositeNameWindowPixmap:
+        {
+            xCompositeNameWindowPixmapReq *stuff = (xCompositeNameWindowPixmapReq *)req;
+            REPLY (": XID(0x%lx) Pixmap(0x%lx)",
+                stuff->window,
+                stuff->pixmap);
+
+            return reply;
+        }
+
+    default:
+            break;
+    }
+
+    return reply;
+}
+
+static char *
+_EvlogEventComposite (xEvent *evt, int first_base, char *reply, int *len)
+{
+    xEvent *stuff = evt;
+
+    switch ((stuff->u.u.type & 0x7F) - first_base)
+    {
+
+    default:
+            break;
+    }
+
+    return reply;
+}
+
+
+void
+xDbgEvlogCompositeGetBase (void *dpy, 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))
+    {
+        fprintf (stderr, "[UTILX] no Composite extension. \n");
+        return;
+    }
+    extinfo->req_func = _EvlogRequestComposite;
+    extinfo->evt_func = _EvlogEventComposite;
+#else
+    ExtensionEntry *xext = CheckExtension (COMPOSITE_NAME);
+    RETURN_IF_FAIL (xext != NULL);
+
+    extinfo->opcode = xext->base;
+    extinfo->evt_base = xext->eventBase;
+    extinfo->err_base = xext->errorBase;
+    extinfo->req_func = _EvlogRequestComposite;
+    extinfo->evt_func = _EvlogEventComposite;
+#endif
+}
diff --git a/common/xdbg_evlog_composite.h b/common/xdbg_evlog_composite.h
new file mode 100644 (file)
index 0000000..2c8ac51
--- /dev/null
@@ -0,0 +1,39 @@
+/**************************************************************************
+
+xdbg
+
+Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
+
+Contact: Boram Park <boram1288.park@samsung.com>
+         Sangjin LEE <lsj119@samsung.com>
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+#ifndef __XDBG_EVLOG_COMPOSITE_H__
+#define __XDBG_EVLOG_COMPOSITE_H__
+
+#include "xdbg_types.h"
+
+void    xDbgEvlogCompositeGetBase (void *dpy, ExtensionInfo *extinfo);
+
+#endif
diff --git a/common/xdbg_evlog_core.c b/common/xdbg_evlog_core.c
new file mode 100644 (file)
index 0000000..9c779de
--- /dev/null
@@ -0,0 +1,826 @@
+/**************************************************************************
+
+xdbg
+
+Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
+
+Contact: Boram Park <boram1288.park@samsung.com>
+         Sangjin LEE <lsj119@samsung.com>
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <string.h>
+#include <strings.h>
+#include <sys/types.h>
+#include <sys/fcntl.h>
+#include <unistd.h>
+#include <stdarg.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+#include <dix.h>
+#define XREGISTRY
+#include <registry.h>
+#include <xace.h>
+#include <xacestr.h>
+#include <X11/Xatom.h>
+#include <X11/Xlib.h>
+#include <windowstr.h>
+#include <X11/extensions/XI2proto.h>
+
+#include "xdbg_types.h"
+#include "xdbg_evlog_core.h"
+
+char * xDbgEvlogRequestCore (xReq *req, char *reply, int *len)
+{
+    xReq *stuff = req;
+
+    switch (stuff->reqType)
+    {
+    case X_CreateWindow:
+        {
+            xCreateWindowReq *stuff = (xCreateWindowReq *)req;
+
+            REPLY (": Window(0x%lx) Parent(0x%lx) size(%dx%d) boaderWid(%d) coordinate(%d,%d)",
+                stuff->wid,
+                stuff->parent,
+                stuff->width,
+                stuff->height,
+                stuff->borderWidth,
+                stuff->x,
+                stuff->y);
+
+            return reply;
+        }
+
+    case X_ChangeWindowAttributes:
+        {
+            xChangeWindowAttributesReq *stuff = (xChangeWindowAttributesReq *)req;
+            REPLY (": XID(0x%lx)",
+                stuff->window);
+
+            return reply;
+        }
+
+    case X_ChangeSaveSet:
+        {
+            xChangeSaveSetReq *stuff = (xChangeSaveSetReq *)req;
+            REPLY (": XID(0x%lx)",
+                stuff->window);
+
+            return reply;
+        }
+
+    case X_ReparentWindow:
+        {
+            xReparentWindowReq *stuff = (xReparentWindowReq *)req;
+            REPLY (": Window(0x%lx) Parent(0x%lx) coord(%d,%d)",
+                stuff->window,
+                stuff->parent,
+                stuff->x,
+                stuff->y);
+
+            return reply;
+        }
+
+    case X_ConfigureWindow:
+        {
+            xConfigureWindowReq *stuff = (xConfigureWindowReq *)req;
+            REPLY (": XID(0x%lx)",
+                stuff->window);
+
+            return reply;
+        }
+
+    case X_CirculateWindow:
+        {
+            xCirculateWindowReq *stuff = (xCirculateWindowReq *)req;
+            REPLY (": XID(0x%lx)",
+                stuff->window);
+
+            return reply;
+        }
+
+    case X_ChangeProperty:
+        {
+            xChangePropertyReq *stuff = (xChangePropertyReq *)req;
+            REPLY (": XID(0x%lx) Property(0x%lx) Type(0x%lx)",
+                stuff->window,
+                stuff->property,
+                stuff->type);
+
+            return reply;
+        }
+
+    case X_DeleteProperty:
+        {
+            xDeletePropertyReq *stuff = (xDeletePropertyReq *)req;
+            REPLY (": XID(0x%lx) Property(0x%lx)",
+                stuff->window,
+                stuff->property);
+
+            return reply;
+        }
+
+    case X_SetSelectionOwner:
+        {
+            xSetSelectionOwnerReq *stuff = (xSetSelectionOwnerReq *)req;
+            REPLY (": XID(0x%lx) Selection(0x%lx)",
+                stuff->window,
+                stuff->selection);
+
+            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);
+
+            return reply;
+        }
+
+    case X_SendEvent:
+        {
+            xSendEventReq *stuff = (xSendEventReq *)req;
+            REPLY (": XID(0x%lx)",
+                stuff->destination);
+
+            return reply;
+        }
+
+    case X_GrabPointer:
+        {
+            xGrabPointerReq *stuff = (xGrabPointerReq *)req;
+            REPLY (": XID(0x%lx) ConfineTo(0x%lx) Cursor(0x%lx)",
+                stuff->grabWindow,
+                stuff->confineTo,
+                stuff->cursor);
+
+            return reply;
+        }
+
+    case X_GrabButton:
+        {
+            xGrabButtonReq *stuff = (xGrabButtonReq *)req;
+            REPLY (": XID(0x%lx) ConfineTo(0x%lx) Cursor(0x%lx)",
+                stuff->grabWindow,
+                stuff->confineTo,
+                stuff->cursor);
+
+            return reply;
+        }
+
+    case X_UngrabButton:
+        {
+            xUngrabButtonReq *stuff = (xUngrabButtonReq *)req;
+            REPLY (": XID(0x%lx)",
+                stuff->grabWindow);
+
+            return reply;
+        }
+
+    case X_ChangeActivePointerGrab:
+        {
+            xChangeActivePointerGrabReq *stuff = (xChangeActivePointerGrabReq *)req;
+            REPLY (": Cursor(0x%lx)",
+                stuff->cursor);
+
+            return reply;
+        }
+
+    case X_GrabKeyboard:
+        {
+            xGrabKeyboardReq *stuff = (xGrabKeyboardReq *)req;
+            REPLY (": XID(0x%lx)",
+                stuff->grabWindow);
+
+            return reply;
+        }
+
+    case X_GrabKey:
+        {
+            xGrabKeyReq *stuff = (xGrabKeyReq *)req;
+            REPLY (": XID(0x%lx)",
+                stuff->grabWindow);
+
+            return reply;
+        }
+
+    case X_UngrabKey:
+        {
+            xUngrabKeyReq *stuff = (xUngrabKeyReq *)req;
+            REPLY (": XID(0x%lx)",
+                stuff->grabWindow);
+
+            return reply;
+        }
+
+    case X_SetInputFocus:
+        {
+            xSetInputFocusReq *stuff = (xSetInputFocusReq *)req;
+            REPLY (": XID(0x%lx)",
+                stuff->focus);
+
+            return reply;
+        }
+
+    case X_CreatePixmap:
+        {
+            xCreatePixmapReq *stuff = (xCreatePixmapReq *)req;
+            REPLY (": Pixmap(0x%lx) Drawable(0x%lx) size(%dx%d)",
+                stuff->pid,
+                stuff->drawable,
+                stuff->width,
+                stuff->height);
+
+            return reply;
+        }
+
+    case X_ClearArea:
+        {
+            xClearAreaReq *stuff = (xClearAreaReq *)req;
+            REPLY (": XID(0x%lx) area(%d,%d %dx%d)",
+                stuff->window,
+                stuff->x,
+                stuff->y,
+                stuff->width,
+                stuff->height);
+
+        \r   return reply;
+        }
+
+    case X_CopyArea:
+        {
+            xCopyAreaReq *stuff = (xCopyAreaReq *)req;
+            REPLY (": srcXID(0x%lx) dstXID(0x%lx) gc(0x%lx) size(%dx%d) src(%d,%d) dst(%d,%d)",
+                stuff->srcDrawable,
+                stuff->dstDrawable,
+                stuff->gc,
+                stuff->width,
+                stuff->height,
+                stuff->srcX,
+                stuff->srcY,
+                stuff->dstX,
+                stuff->dstY);
+
+            return reply;
+        }
+
+    case X_CopyPlane:
+        {
+            xCopyPlaneReq *stuff = (xCopyPlaneReq *)req;
+            REPLY (": srcXID(0x%lx) dstXID(0x%lx) gc(0x%lx) size(%dx%d) src(%d,%d) dst(%d,%d)",
+                stuff->srcDrawable,
+                stuff->dstDrawable,
+                stuff->gc,
+                stuff->width,
+                stuff->height,
+                stuff->srcX,
+                stuff->srcY,
+                stuff->dstX,
+                stuff->dstY);
+
+            return reply;
+        }
+
+    case X_PolyPoint:
+        {
+            xPolyPointReq *stuff = (xPolyPointReq *)req;
+            REPLY (": XID(0x%lx) gc(0x%lx)",
+                stuff->drawable,
+                stuff->gc);
+
+            return reply;
+        }
+
+    case X_PolyLine:
+        {
+            xPolyLineReq *stuff = (xPolyLineReq *)req;
+            REPLY (": XID(0x%lx gc(0x%lx)",
+                stuff->drawable,
+                stuff->gc);
+
+            return reply;
+        }
+
+    case X_PolySegment:
+        {
+            xPolySegmentReq *stuff = (xPolySegmentReq *)req;
+            REPLY (": XID(0x%lx) gc(0x%lx)",
+                stuff->drawable,
+                stuff->gc);
+
+            return reply;
+        }
+
+    case X_PolyRectangle:
+        {
+            xPolyRectangleReq *stuff = (xPolyRectangleReq *)req;
+            REPLY (": XID(0x%lx) gc(0x%lx)",
+                stuff->drawable,
+                stuff->gc);
+
+            return reply;
+        }
+
+    case X_PolyArc:
+        {
+            xPolyArcReq *stuff = (xPolyArcReq *)req;
+            REPLY (": XID(0x%lx) gc(0x%lx)",
+                stuff->drawable,
+                stuff->gc);
+
+            return reply;
+        }
+
+    case X_FillPoly:
+        {
+            xFillPolyReq *stuff = (xFillPolyReq *)req;
+            REPLY (": XID(0x%lx) gc(0x%lx)",
+                stuff->drawable,
+                stuff->gc);
+
+            return reply;
+        }
+
+    case X_PolyFillRectangle:
+        {
+            xPolyFillRectangleReq *stuff = (xPolyFillRectangleReq *)req;
+            REPLY (": XID(0x%lx) gc(0x%lx)",
+                stuff->drawable,
+                stuff->gc);
+
+            return reply;
+        }
+
+    case X_PolyFillArc:
+        {
+            xPolyFillArcReq *stuff = (xPolyFillArcReq *)req;
+            REPLY (": XID(0x%lx) gc(0x%lx)",
+                stuff->drawable,
+                stuff->gc);
+
+            return reply;
+        }
+
+    case X_PutImage:
+        {
+            xPutImageReq *stuff = (xPutImageReq *)req;
+            REPLY (": XID(0x%lx) gc(0x%lx) size(%dx%d) dst(%d,%d)",
+                stuff->drawable,
+                stuff->gc,
+                stuff->width,
+                stuff->height,
+                stuff->dstX,
+                stuff->dstY);
+            return reply;
+        }
+
+    case X_GetImage:
+        {
+            xGetImageReq *stuff = (xGetImageReq *)req;
+            REPLY (": XID(0x%lx) size(%dx%d) dst(%d,%d)",
+                stuff->drawable,
+                stuff->width,
+                stuff->height,
+                stuff->x,
+                stuff->y);
+
+            return reply;
+        }
+
+    case X_PolyText8:
+        {
+            xPolyText8Req *stuff = (xPolyText8Req *)req;
+            REPLY (": XID(0x%lx) gc(0x%lx) coord(%d,%d)",
+                stuff->drawable,
+                stuff->gc,
+                stuff->x,
+                stuff->y);
+
+            return reply;
+        }
+
+    case X_PolyText16:
+        {
+            xPolyText16Req *stuff = (xPolyText16Req *)req;
+            REPLY (": XID(0x%lx) gc(0x%lx) coord(%d,%d)",
+                stuff->drawable,
+                stuff->gc,
+                stuff->x,
+                stuff->y);
+
+            return reply;
+        }
+
+    case X_ImageText8:
+        {
+            xImageText8Req *stuff = (xImageText8Req *)req;
+            REPLY (": XID(0x%lx) gc(0x%lx) coord(%d,%d)",
+                stuff->drawable,
+                stuff->gc,
+                stuff->x,
+                stuff->y);
+
+            return reply;
+        }
+
+    case X_ImageText16:
+        {
+            xImageText16Req *stuff = (xImageText16Req *)req;
+            REPLY (": XID(0x%lx) gc(0x%lx) coord(%d,%d)",
+                stuff->drawable,
+                stuff->gc,
+                stuff->x,
+                stuff->y);
+
+            return reply;
+        }
+
+    case X_ChangeKeyboardMapping:
+        {
+            xChangeKeyboardMappingReq *stuff = (xChangeKeyboardMappingReq *)req;
+            REPLY (": Key(%d) FstKey(%d) KeySyms(%d)",
+                stuff->firstKeyCode,
+                stuff->keyCodes,
+                stuff->keySymsPerKeyCode);
+
+            return reply;
+        }
+
+    case X_GetKeyboardMapping:
+        {
+            xGetKeyboardMappingReq *stuff = (xGetKeyboardMappingReq *)req;
+            REPLY (": FstKey(%d) Count(%d)",
+                stuff->firstKeyCode,
+                stuff->count);
+
+            return reply;
+        }
+
+    case X_ChangePointerControl:
+        {
+            xChangePointerControlReq *stuff = (xChangePointerControlReq *)req;
+            REPLY (": accelNum(%d) accelDenum(%d) threshold(%d)",
+                stuff->accelNum,
+                stuff->accelDenum,
+                stuff->threshold);
+
+            return reply;
+        }
+
+    case X_SetPointerMapping:
+        {
+            xSetPointerMappingReq *stuff = (xSetPointerMappingReq *)req;
+            REPLY (": Elts(%d)",
+                stuff->nElts);
+
+            return reply;
+        }
+
+    case X_SetModifierMapping:
+        {
+            xSetModifierMappingReq *stuff =(xSetModifierMappingReq *)req;
+            REPLY (": NumkeyPerModifier(%d)",
+                stuff->numKeyPerModifier);
+
+            return reply;
+        }
+
+    case X_DestroyWindow:
+    case X_DestroySubwindows:
+    case X_MapWindow:
+    case X_MapSubwindows:
+    case X_UnmapWindow:
+    case X_UnmapSubwindows:
+    case X_GetGeometry:
+    case X_QueryTree:
+    case X_UngrabPointer:
+    case X_UngrabKeyboard:
+    case X_FreePixmap:
+    case X_KillClient:
+        {
+            xResourceReq *stuff = (xResourceReq *)req;
+            REPLY (": XID(0x%lx)",
+                stuff->id);
+
+            return reply;
+        }
+
+    default:
+            break;
+    }
+
+    return reply;
+}
+
+
+char * xDbgEvlogEventCore (xEvent *evt, char *reply, int *len)
+{
+    switch (evt->u.u.type & 0x7F)
+    {
+    case KeyPress:
+    case KeyRelease:
+    case ButtonPress:
+    case ButtonRelease:
+    case MotionNotify:
+        {
+               REPLY (": Root(0x%lx %d,%d) Event(0x%lx %d,%d) Child(0x%lx)",
+                evt->u.keyButtonPointer.root,
+                evt->u.keyButtonPointer.rootX,
+                evt->u.keyButtonPointer.rootY,
+                evt->u.keyButtonPointer.event,
+                evt->u.keyButtonPointer.eventX,
+                evt->u.keyButtonPointer.eventY,
+                evt->u.keyButtonPointer.child);
+
+            return reply;
+               }
+
+    case EnterNotify:
+    case LeaveNotify:
+        {
+            REPLY (": Root(0x%lx %d,%d) Event(0x%lx %d,%d) Child(0x%lx)",
+                evt->u.enterLeave.root,
+                evt->u.enterLeave.rootX,
+                evt->u.enterLeave.rootY,
+                evt->u.enterLeave.event,
+                evt->u.enterLeave.eventX,
+                evt->u.enterLeave.eventY,
+                evt->u.enterLeave.child);
+
+            return reply;
+               }
+
+    case FocusIn:
+    case FocusOut:
+    case KeymapNotify:
+        {
+            REPLY (": XID(0x%lx)",
+                evt->u.focus.window);
+
+            return reply;
+               }
+
+    case Expose:
+        {
+            REPLY (": XID(0x%lx) size(%dx%d) coord(%d,%d)",
+                evt->u.expose.window,
+                evt->u.expose.width,
+                evt->u.expose.height,
+                evt->u.expose.x,
+                evt->u.expose.y);
+
+            return reply;
+               }
+
+    case GraphicsExpose:
+        {
+            REPLY (": XID(0x%lx) size(%dx%d) coord(%d,%d)",
+                evt->u.graphicsExposure.drawable,
+                evt->u.graphicsExposure.width,
+                evt->u.graphicsExposure.height,
+                evt->u.graphicsExposure.x,
+                evt->u.graphicsExposure.y);
+
+            return reply;
+               }
+
+    case NoExpose:
+        {
+            REPLY (": XID(0x%lx)",
+                evt->u.noExposure.drawable);
+
+            return reply;
+               }
+
+
+    case VisibilityNotify:
+        {
+            REPLY (": XID(0x%lx)",
+                evt->u.visibility.window);
+
+            return reply;
+               }
+
+    case CreateNotify:
+        {
+            REPLY (": Window(0x%lx) Parent(0x%lx) size(%dx%d) coord(%d,%d) borderWidth(%d)",
+                evt->u.createNotify.window,
+                evt->u.createNotify.parent,
+                evt->u.createNotify.width,
+                evt->u.createNotify.height,
+                evt->u.createNotify.x,
+                evt->u.createNotify.y,
+                evt->u.createNotify.borderWidth);
+
+            return reply;
+               }
+
+    case DestroyNotify:
+        {
+            REPLY (": Window(0x%lx) Event(0x%lx)",
+                evt->u.destroyNotify.window,
+                evt->u.destroyNotify.event);
+
+            return reply;
+               }
+
+    case UnmapNotify:
+        {
+            REPLY (": Window(0x%lx) Event(0x%lx)",
+                evt->u.unmapNotify.window,
+                evt->u.unmapNotify.event);
+
+            return reply;
+               }
+
+    case MapNotify:
+        {
+            REPLY (": Window(0x%lx) Event(0x%lx)",
+                evt->u.mapNotify.window,
+                evt->u.mapNotify.event);
+
+            return reply;
+               }
+
+    case MapRequest:
+        {
+               REPLY (": Window(0x%lx) Parent(0x%lx)",
+                evt->u.mapRequest.window,
+                evt->u.mapRequest.parent);
+
+            return reply;
+               }
+
+    case ReparentNotify:
+        {
+               REPLY (": Window(0x%lx) Event(0x%lx) parent(0x%lx) coord(%d,%d)",
+                evt->u.reparent.window,
+                evt->u.reparent.event,
+                evt->u.reparent.parent,
+                evt->u.reparent.x,
+                evt->u.reparent.y);
+
+            return reply;
+               }
+
+    case ConfigureNotify:
+        {
+               REPLY (": Window(0x%lx) Event(0x%lx) aboveSibling(0x%lx) size(%dx%d) coord(%d,%d) borderWidth(%d)",
+                evt->u.configureNotify.window,
+                evt->u.configureNotify.event,
+                evt->u.configureNotify.aboveSibling,
+                evt->u.configureNotify.width,
+                evt->u.configureNotify.height,
+                evt->u.configureNotify.x,
+                evt->u.configureNotify.y,
+                evt->u.configureNotify.borderWidth);
+
+            return reply;
+               }
+
+    case ConfigureRequest:
+        {
+               REPLY (": Window(0x%lx) Parent(0x%lx) Sibling(0x%lx) size(%dx%d) coord(%d,%d) borderWidth(%d)",
+                evt->u.configureRequest.window,
+                evt->u.configureRequest.parent,
+                evt->u.configureRequest.sibling,
+                evt->u.configureRequest.width,
+                evt->u.configureRequest.height,
+                evt->u.configureRequest.x,
+                evt->u.configureRequest.y,
+                evt->u.configureRequest.borderWidth);
+
+            return reply;
+               }
+
+    case GravityNotify:
+        {
+               REPLY (": Window(0x%lx) Event(0x%lx) coord(%d,%d)",
+                evt->u.gravity.window,
+                evt->u.gravity.event,
+                evt->u.gravity.x,
+                evt->u.gravity.y);
+
+            return reply;
+               }
+
+    case ResizeRequest:
+        {
+               REPLY (": Window(0x%lx) size(%dx%d)",
+                evt->u.resizeRequest.window,
+                evt->u.resizeRequest.width,
+                evt->u.resizeRequest.height);
+
+            return reply;
+               }
+
+    case CirculateNotify:
+    case CirculateRequest:
+        {
+               REPLY (": Window(0x%lx) Event(0x%lx) parent(0x%lx)",
+                evt->u.circulate.window,
+                evt->u.circulate.event,
+                evt->u.circulate.parent);
+
+            return reply;
+               }
+
+    case PropertyNotify:
+        {
+               REPLY (": Window(0x%lx) atom(0x%lx)",
+                evt->u.property.window,
+                evt->u.property.atom);
+
+            return reply;
+               }
+
+    case SelectionClear:
+        {
+               REPLY (": Window(0x%lx) atom(0x%lx)",
+                evt->u.selectionClear.window,
+                evt->u.selectionClear.atom);
+
+            return reply;
+               }
+
+    case SelectionRequest:
+        {
+               REPLY (": Owner(0x%lx) Requestor(0x%lx) Selcection(0x%lx) Target(0x%lx) Property(0x%lx)",
+                evt->u.selectionRequest.owner,
+                evt->u.selectionRequest.requestor,
+                evt->u.selectionRequest.selection,
+                evt->u.selectionRequest.target,
+                evt->u.selectionRequest.property);
+
+            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);
+
+            return reply;
+               }
+
+    case ColormapNotify:
+        {
+               REPLY (": XID(0x%lx) Colormap(0x%lx)",
+                evt->u.colormap.window,
+                evt->u.colormap.colormap);
+
+            return reply;
+               }
+
+    case ClientMessage:
+        {
+               REPLY (": XID(0x%lx) Atom(0x%lx)",
+                evt->u.clientMessage.window,
+                evt->u.clientMessage.u.b.type);
+
+            return reply;
+               }
+
+    case MappingNotify:
+    case GenericEvent:
+    default:
+            break;
+    }
+
+    return reply;
+}
diff --git a/common/xdbg_evlog_core.h b/common/xdbg_evlog_core.h
new file mode 100644 (file)
index 0000000..68bf6bd
--- /dev/null
@@ -0,0 +1,40 @@
+/**************************************************************************
+
+xdbg
+
+Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
+
+Contact: Boram Park <boram1288.park@samsung.com>
+         Sangjin LEE <lsj119@samsung.com>
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+#ifndef __XDBG_EVLOG_CORE_H__
+#define __XDBG_EVLOG_CORE_H__
+
+#include "xdbg_types.h"
+
+char * xDbgEvlogRequestCore (xReq *req, char *reply, int *len);
+char * xDbgEvlogEventCore (xEvent *evt, char *reply, int *len);
+
+#endif
diff --git a/common/xdbg_evlog_damage.c b/common/xdbg_evlog_damage.c
new file mode 100644 (file)
index 0000000..1c879e5
--- /dev/null
@@ -0,0 +1,154 @@
+/**************************************************************************
+
+xdbg
+
+Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
+
+Contact: Boram Park <boram1288.park@samsung.com>
+         Sangjin LEE <lsj119@samsung.com>
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <string.h>
+#include <strings.h>
+#include <sys/types.h>
+#include <sys/fcntl.h>
+#include <unistd.h>
+#include <stdarg.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+#include <dix.h>
+#define XREGISTRY
+#include <registry.h>
+#include <xace.h>
+#include <xacestr.h>
+#include <X11/Xatom.h>
+#include <X11/Xlib.h>
+#include <windowstr.h>
+#include <X11/extensions/Xdamage.h>
+#include <X11/extensions/damageproto.h>
+
+
+#include "xdbg_types.h"
+#include "xdbg_evlog_damage.h"
+
+static char *
+_EvlogRequestDamage(xReq *req, char *reply, int *len)
+{
+    xReq *stuff = req;
+
+    switch (stuff->data)
+    {
+    case X_DamageCreate:
+        {
+            xDamageCreateReq *stuff = (xDamageCreateReq *)req;
+            REPLY (": XID(0x%lx) Drawable(0x%lx) level(%d)",
+                stuff->damage,
+                stuff->drawable,
+                stuff->level);
+
+            return reply;
+        }
+
+    case X_DamageDestroy:
+        {
+            xDamageDestroyReq *stuff = (xDamageDestroyReq *)req;
+            REPLY (": XID(0x%lx)",
+                stuff->damage);
+
+            return reply;
+        }
+
+    default:
+            break;
+    }
+
+    return reply;
+}
+
+static char*
+_EvlogEventDamage (xEvent *evt, int first_base, char *reply, int *len)
+{
+    xEvent *stuff = evt;
+
+    switch ((stuff->u.u.type & 0x7F) - first_base)
+    {
+    case XDamageNotify:
+        {
+            xDamageNotifyEvent *stuff = (xDamageNotifyEvent*)evt;
+            REPLY (": XID(0x%lx) Damage(0x%lx) area(%d,%d %dx%d) geo(%d,%d %dx%d)",
+                stuff->drawable,
+                stuff->damage,
+                stuff->area.x,
+                stuff->area.y,
+                stuff->area.width,
+                stuff->area.height,
+                stuff->geometry.x,
+                stuff->geometry.y,
+                stuff->geometry.width,
+                stuff->geometry.height);
+
+            return reply;
+        }
+
+    default:
+            break;
+    }
+
+    return reply;
+}
+
+void
+xDbgEvlogDamageGetBase (void *dpy, 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))
+    {
+        fprintf (stderr, "[UTILX] no Damage extension. \n");
+        return;
+    }
+
+    extinfo->req_func = _EvlogRequestDamage;
+    extinfo->evt_func = _EvlogEventDamage;
+#else
+    ExtensionEntry *xext = CheckExtension (DAMAGE_NAME);
+    RETURN_IF_FAIL (xext != NULL);
+
+    extinfo->opcode = xext->base;
+    extinfo->evt_base = xext->eventBase;
+    extinfo->err_base = xext->errorBase;
+    extinfo->req_func = _EvlogRequestDamage;
+    extinfo->evt_func = _EvlogEventDamage;
+#endif
+}
diff --git a/common/xdbg_evlog_damage.h b/common/xdbg_evlog_damage.h
new file mode 100644 (file)
index 0000000..e1ca315
--- /dev/null
@@ -0,0 +1,39 @@
+/**************************************************************************
+
+xdbg
+
+Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
+
+Contact: Boram Park <boram1288.park@samsung.com>
+         Sangjin LEE <lsj119@samsung.com>
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+#ifndef __XDBG_EVLOG_DAMAGE_H__
+#define __XDBG_EVLOG_DAMAGE_H__
+
+#include "xdbg_types.h"
+
+void     xDbgEvlogDamageGetBase (void *dpy, ExtensionInfo *extinfo);
+
+#endif
diff --git a/common/xdbg_evlog_dri2.c b/common/xdbg_evlog_dri2.c
new file mode 100644 (file)
index 0000000..69a4dfa
--- /dev/null
@@ -0,0 +1,228 @@
+/**************************************************************************
+
+xdbg
+
+Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
+
+Contact: Boram Park <boram1288.park@samsung.com>
+         Sangjin LEE <lsj119@samsung.com>
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <string.h>
+#include <strings.h>
+#include <sys/types.h>
+#include <sys/fcntl.h>
+#include <unistd.h>
+#include <stdarg.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+#include <dix.h>
+#define XREGISTRY
+#include <registry.h>
+#include <xace.h>
+#include <xacestr.h>
+#include <X11/Xatom.h>
+#include <X11/Xlib.h>
+#include <windowstr.h>
+#include <dri2/dri2.h>
+#include <X11/extensions/dri2proto.h>
+
+
+#include "xdbg_types.h"
+#include "xdbg_evlog_dri2.h"
+
+static char *
+_EvlogRequestDri2 (xReq *req, char *reply, int *len)
+{
+    xReq *stuff = req;
+
+    switch (stuff->data)
+    {
+    case X_DRI2CreateDrawable:
+        {
+            xDRI2CreateDrawableReq *stuff = (xDRI2CreateDrawableReq *)req;
+            REPLY (": XID(0x%lx)",
+                stuff->drawable);
+
+            return reply;
+        }
+
+    case X_DRI2DestroyDrawable:
+        {
+            xDRI2DestroyDrawableReq *stuff = (xDRI2DestroyDrawableReq *)req;
+            REPLY (": XID(0x%lx)",
+                stuff->drawable);
+
+            return reply;
+        }
+
+    case X_DRI2GetBuffers:
+        {
+            xDRI2GetBuffersReq *stuff = (xDRI2GetBuffersReq *)req;
+            REPLY (": XID(0x%lx) Count(%ld)",
+                stuff->drawable,
+                stuff->count);
+
+            return reply;
+        }
+
+    case X_DRI2CopyRegion:
+        {
+            xDRI2CopyRegionReq *stuff = (xDRI2CopyRegionReq *)req;
+            REPLY (": XID(0x%lx) Region(0x%lx) src(0x%lx) dst(0x%lx)",
+                stuff->drawable,
+                stuff->region,
+                stuff->src,
+                stuff->dest);
+
+            return reply;
+        }
+
+    case X_DRI2GetBuffersWithFormat:
+        {
+            xDRI2GetBuffersReq *stuff = (xDRI2GetBuffersReq *)req;
+            REPLY (": XID(0x%lx) count(%ld)",
+                stuff->drawable,
+                stuff->count);
+
+            return reply;
+        }
+
+
+    case X_DRI2SwapBuffers:
+        {
+            xDRI2SwapBuffersReq *stuff = (xDRI2SwapBuffersReq *)req;
+            REPLY (": XID(0x%lx) msc(0x%lx/0x%lx) divisor(0x%lx/0x%lx) remainder(0x%lx/0x%lx)",
+                stuff->drawable,
+                stuff->target_msc_hi,
+                stuff->target_msc_lo,
+                stuff->divisor_hi,
+                stuff->divisor_lo,
+                stuff->remainder_hi,
+                stuff->remainder_lo);
+
+            return reply;
+        }
+
+    case X_DRI2SwapInterval:
+        {
+            xDRI2SwapIntervalReq *stuff = (xDRI2SwapIntervalReq *)req;
+            REPLY (": XID(0x%lx) Interval(%ld)",
+                stuff->drawable,
+                stuff->interval);
+
+            return reply;
+        }
+
+    case X_DRI2SwapBuffersWithRegion:
+        {
+            xDRI2SwapBuffersWithRegionReq *stuff = (xDRI2SwapBuffersWithRegionReq *)req;
+            REPLY (": XID(0x%lx) Region(0x%lx)",
+                stuff->drawable,
+                stuff->region);
+
+            return reply;
+        }
+
+    default:
+            break;
+    }
+
+    return reply;
+}
+
+
+static char *
+_EvlogEventDri2 (xEvent *evt, int first_base, char *reply, int *len)
+{
+    xEvent *stuff = evt;
+
+    switch ((stuff->u.u.type & 0x7F) - first_base)
+    {
+    case DRI2_BufferSwapComplete:
+        {
+            xDRI2BufferSwapComplete *stuff = (xDRI2BufferSwapComplete *) evt;
+            REPLY (": XID(0x%lx) ust(0x%lx/0x%lx) msc(0x%lx/0x%lx) sbc(0x%lx/0x%lx)",
+                stuff->drawable,
+                stuff->ust_hi,
+                stuff->ust_lo,
+                stuff->msc_hi,
+                stuff->msc_lo,
+                stuff->sbc_hi,
+                stuff->sbc_lo);
+
+            return reply;
+        }
+
+    case DRI2_InvalidateBuffers:
+        {
+            xDRI2InvalidateBuffers *stuff = (xDRI2InvalidateBuffers *) evt;
+            REPLY (": XID(0x%lx)",
+                stuff->drawable);
+
+            return reply;
+        }
+
+    default:
+            break;
+    }
+
+    return reply;
+}
+
+
+
+void
+xDbgEvlogDri2GetBase (void *dpy, 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))
+    {
+        fprintf (stderr, "[UTILX] no DRI2 extension. \n");
+        return;
+    }
+    extinfo->req_func = _EvlogRequestDri2;
+    extinfo->evt_func = _EvlogEventDri2;
+#else
+    ExtensionEntry *xext = CheckExtension (DRI2_NAME);
+    RETURN_IF_FAIL (xext != NULL);
+
+    extinfo->opcode = xext->base;
+    extinfo->evt_base = xext->eventBase;
+    extinfo->err_base = xext->errorBase;
+    extinfo->req_func = _EvlogRequestDri2;
+    extinfo->evt_func = _EvlogEventDri2;
+#endif
+}
diff --git a/common/xdbg_evlog_dri2.h b/common/xdbg_evlog_dri2.h
new file mode 100644 (file)
index 0000000..b7c01aa
--- /dev/null
@@ -0,0 +1,39 @@
+/**************************************************************************
+
+xdbg
+
+Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
+
+Contact: Boram Park <boram1288.park@samsung.com>
+         Sangjin LEE <lsj119@samsung.com>
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+#ifndef __XDBG_EVLOG_DRI2_H__
+#define __XDBG_EVLOG_DRI2_H__
+
+#include "xdbg_types.h"
+
+void    xDbgEvlogDri2GetBase (void *dpy, ExtensionInfo *extinfo);
+
+#endif
index cbe87f2..11944bf 100644 (file)
@@ -49,111 +49,68 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include <xace.h>
 #include <xacestr.h>
 #include <X11/Xatom.h>
-#include <X11/extensions/damageproto.h>
-#include <X11/extensions/damagewire.h>
-#include <X11/extensions/XI2proto.h>
 #include <X11/Xlib.h>
 #include <windowstr.h>
-#include <X11/extensions/Xdamage.h>
 
 #include "xdbg_types.h"
+#include "xdbg_evlog.h"
 #include "xdbg_evlog_event.h"
 
 
 #define UNKNOWN_EVENT "<unknown>"
 
-#ifdef XDBG_CLIENT
-static int damage_base;
-static int damage_err_base;
-#else
-static ExtensionEntry *damage;
-#endif
-
-static Bool
-_EvlogEventGetExtentionEntry ()
-{
-#ifdef XDBG_CLIENT
-
-    static int init = 0;
-    static Bool success = FALSE;
-    Display *dpy;
-
-    if (init)
-        return success;
-
-    init = 1;
-
-    dpy = XOpenDisplay (NULL);
-    if (!dpy)
-    {
-        fprintf (stderr, "failed: open display\n");
-        exit (-1);
-    }
-
-    if (!XDamageQueryExtension(dpy, &damage_base, &damage_err_base))
-    {
-        fprintf (stderr, "[UTILX] no X Damage extension. \n");
-        return False;
-    }
-    success = TRUE;
-    XCloseDisplay (dpy);
-    return success;
-
-#else
-
-    static int init = 0;
-    static Bool success = FALSE;
-
-    if (init)
-        return success;
-
-    init = 1;
-    damage = CheckExtension (DAMAGE_NAME);
-    RETURN_VAL_IF_FAIL (damage != NULL, FALSE);
-
-    success = TRUE;
-
-    return success;
-
-#endif
-}
-
+extern ExtensionInfo* Sorted_Evlog_extensions;
 
 char *
-xDbgEvlogEvent (EvlogInfo *evinfo, char *reply, int *len)
+xDbgEvlogEvent (EvlogInfo *evinfo, int Extensions_size, char *reply, int *len)
 {
     EvlogEvent   ev;
     xEvent *xEvt = NULL;
+    int type;
 
     RETURN_VAL_IF_FAIL (evinfo != NULL, reply);
     RETURN_VAL_IF_FAIL (evinfo->type == EVENT, reply);
 
     ev = evinfo->evt;
     xEvt = ev.ptr;
-
-    if (!_EvlogEventGetExtentionEntry ())
-        return reply;
+    type = xEvt->u.u.type;
 
     REPLY ("%s", ev.name);
 
-#ifdef XDBG_CLIENT
-    if (xEvt->u.u.type == damage_base + XDamageNotify)
-#else
-    if (xEvt->u.u.type == damage->eventBase + XDamageNotify)
-#endif
+    if (type > 0x7F)
+        REPLY ("(U)");
+    else
+        REPLY ("(S)");
+
+    type &= 0x7F;
+
+    if (type < EXTENSION_EVENT_BASE)
     {
-        xDamageNotifyEvent *damage_e = (xDamageNotifyEvent*)xEvt;
-        REPLY (": XID(%lx) area(%d,%d %dx%d) geo(%d,%d %dx%d)",
-            damage_e->drawable,
-            damage_e->area.x,
-            damage_e->area.y,
-            damage_e->area.width,
-            damage_e->area.height,
-            damage_e->geometry.x,
-            damage_e->geometry.y,
-            damage_e->geometry.width,
-            damage_e->geometry.height);
-        return reply;
+        return xDbgEvlogEventCore (xEvt, reply, len);
     }
+    else
+    {
+        int i;
+
+        for (i = 0 ; i < Extensions_size / sizeof (ExtensionInfo); i++)
+        {
+            if (Sorted_Evlog_extensions[i].evt_base == 0)
+                continue;
+
+            if (i != Extensions_size / sizeof (ExtensionInfo) - 1)
+            {
+                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);
+                }
+                continue;
+            }
+
+            return Sorted_Evlog_extensions[i].evt_func (xEvt, Sorted_Evlog_extensions[i].evt_base, reply, len);
+        }
+
+    }
+
     return reply;
 }
index 67dbccb..4c42c01 100644 (file)
@@ -34,6 +34,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 #include "xdbg_types.h"
 
-char *  xDbgEvlogEvent (EvlogInfo *evinfo, char *reply, int *len);
+char *  xDbgEvlogEvent (EvlogInfo *evinfo, int Extensions_size, char *reply, int *len);
 
 #endif
diff --git a/common/xdbg_evlog_gesture.c b/common/xdbg_evlog_gesture.c
new file mode 100644 (file)
index 0000000..b26c11d
--- /dev/null
@@ -0,0 +1,245 @@
+/**************************************************************************
+
+xdbg
+
+Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
+
+Contact: Boram Park <boram1288.park@samsung.com>
+         Sangjin LEE <lsj119@samsung.com>
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <string.h>
+#include <strings.h>
+#include <sys/types.h>
+#include <sys/fcntl.h>
+#include <unistd.h>
+#include <stdarg.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+#include <dix.h>
+#define XREGISTRY
+#include <registry.h>
+#include <xace.h>
+#include <xacestr.h>
+#include <X11/Xatom.h>
+#include <X11/Xlib.h>
+#include <windowstr.h>
+#include <X11/extensions/gesture.h>
+#include <X11/extensions/gestureproto.h>
+
+
+#include "xdbg_types.h"
+#include "xdbg_evlog_gesture.h"
+
+static char *
+_EvlogRequestGesture(xReq *req, char *reply, int *len)
+{
+    xReq *stuff = req;
+
+    switch (stuff->data)
+    {
+    case X_GestureSelectEvents:
+        {
+            xGestureSelectEventsReq *stuff = (xGestureSelectEventsReq *)req;
+            REPLY (": XID(0x%lx)",
+                stuff->window);
+
+            return reply;
+        }
+
+    case X_GestureGetSelectedEvents:
+        {
+            xGestureGetSelectedEventsReq *stuff = (xGestureGetSelectedEventsReq *)req;
+            REPLY (": XID(0x%lx)",
+                stuff->window);
+
+            return reply;
+        }
+
+    case X_GestureGrabEvent:
+        {
+            xGestureGrabEventReq *stuff = (xGestureGrabEventReq *)req;
+            REPLY (": XID(0x%lx) EventType(0x%lx), Num_finger(%d)",
+                stuff->window,
+                stuff->eventType,
+                stuff->num_finger);
+
+            return reply;
+        }
+
+    case X_GestureUngrabEvent:
+        {
+            xGestureUngrabEventReq *stuff = (xGestureUngrabEventReq *)req;
+            REPLY (": XID(0x%lx) EventType(0x%lx), Num_finger(%d)",
+                stuff->window,
+                stuff->eventType,
+                stuff->num_finger);
+
+            return reply;
+        }
+
+    default:
+            break;
+    }
+
+    return reply;
+}
+
+static char *
+_EvlogEventGesture (xEvent *evt, int first_base, char *reply, int *len)
+{
+    xEvent *stuff = evt;
+
+    switch ((stuff->u.u.type & 0x7F) - first_base)
+    {
+    case GestureNotifyFlick:
+        {
+            xGestureNotifyFlickEvent *stuff = (xGestureNotifyFlickEvent *) evt;
+            REPLY (": XID(0x%lx) Direction(%d) Distance(%d) Duration(%ldms) Angle(0x%lx)",
+                stuff->window,
+                stuff->direction,
+                stuff->distance,
+                stuff->duration,
+                stuff->angle);
+
+            return reply;
+        }
+
+    case GestureNotifyPan:
+        {
+            xGestureNotifyPanEvent *stuff = (xGestureNotifyPanEvent *) evt;
+            REPLY (": XID(0x%lx) Direction(%d) Distance(%d) Duration(%ldms) coord(%d,%d)",
+                stuff->window,
+                stuff->direction,
+                stuff->distance,
+                stuff->duration,
+                stuff->dx,
+                stuff->dy);
+
+            return reply;
+        }
+
+    case GestureNotifyPinchRotation:
+        {
+            xGestureNotifyPinchRotationEvent *stuff = (xGestureNotifyPinchRotationEvent *) evt;
+            REPLY (": XID(0x%lx) Distance(%d) Coord(%d,%d) Zoom(0x%lx) Angle(0x%lx)",
+                stuff->window,
+                stuff->distance,
+                stuff->cx,
+                stuff->cy,
+                stuff->zoom,
+                stuff->angle);
+
+            return reply;
+        }
+
+    case GestureNotifyTap:
+        {
+            xGestureNotifyTapEvent *stuff = (xGestureNotifyTapEvent *) evt;
+            REPLY (": XID(0x%lx) Coord(%d,%d) tapRepeat(%d) Interval(%ldms)",
+                stuff->window,
+                stuff->cx,
+                stuff->cy,
+                stuff->tap_repeat,
+                stuff->interval);
+
+            return reply;
+        }
+
+    case GestureNotifyTapNHold:
+        {
+            xGestureNotifyTapNHoldEvent *stuff = (xGestureNotifyTapNHoldEvent *) evt;
+            REPLY (": XID(0x%lx) Coord(%d,%d) Interval(%ldms) Holdtime(%ldms)",
+                stuff->window,
+                stuff->cx,
+                stuff->cy,
+                stuff->interval,
+                stuff->holdtime);
+
+            return reply;
+        }
+
+    case GestureNotifyHold:
+        {
+            xGestureNotifyHoldEvent *stuff = (xGestureNotifyHoldEvent *) evt;
+            REPLY (": XID(0x%lx) Coord(%d,%d) Holdtime(%ldms)",
+                stuff->window,
+                stuff->cx,
+                stuff->cy,
+                stuff->holdtime);
+
+            return reply;
+        }
+
+    case GestureNotifyGroup:
+        {
+            xGestureNotifyGroupEvent *stuff = (xGestureNotifyGroupEvent *) evt;
+            REPLY (": XID(0x%lx) groupID(%d) groupNum(%d)",
+                stuff->window,
+                stuff->groupid,
+                stuff->num_group);
+
+            return reply;
+        }
+
+    default:
+            break;
+    }
+
+    return reply;
+}
+
+
+void
+xDbgEvlogGestureGetBase (void *dpy, ExtensionInfo *extinfo)
+{
+#ifdef XDBG_CLIENT
+    Display *d = (Display*)dpy;
+
+    RETURN_IF_FAIL (d != NULL);
+
+    if (!XQueryExtension(d, GESTURE_EXT_NAME, &extinfo->opcode, &extinfo->evt_base, &extinfo->err_base))
+    {
+        fprintf (stderr, "[UTILX] 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);
+
+    extinfo->opcode = xext->base;
+    extinfo->evt_base = xext->eventBase;
+    extinfo->err_base = xext->errorBase;
+    extinfo->req_func = _EvlogRequestGesture;
+    extinfo->evt_func = _EvlogEventGesture;
+#endif
+}
diff --git a/common/xdbg_evlog_gesture.h b/common/xdbg_evlog_gesture.h
new file mode 100644 (file)
index 0000000..0090872
--- /dev/null
@@ -0,0 +1,39 @@
+/**************************************************************************
+
+xdbg
+
+Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
+
+Contact: Boram Park <boram1288.park@samsung.com>
+         Sangjin LEE <lsj119@samsung.com>
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+#ifndef __XDBG_EVLOG_GESTURE_H__
+#define __XDBG_EVLOG_GESTURE_H__
+
+#include "xdbg_types.h"
+
+void    xDbgEvlogGestureGetBase (void *dpy, ExtensionInfo *extinfo);
+
+#endif
diff --git a/common/xdbg_evlog_randr.c b/common/xdbg_evlog_randr.c
new file mode 100644 (file)
index 0000000..84ec58f
--- /dev/null
@@ -0,0 +1,346 @@
+/**************************************************************************
+
+xdbg
+
+Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
+
+Contact: Boram Park <boram1288.park@samsung.com>
+         Sangjin LEE <lsj119@samsung.com>
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <string.h>
+#include <strings.h>
+#include <sys/types.h>
+#include <sys/fcntl.h>
+#include <unistd.h>
+#include <stdarg.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+#include <dix.h>
+#define XREGISTRY
+#include <registry.h>
+#include <xace.h>
+#include <xacestr.h>
+#include <X11/Xatom.h>
+#include <X11/Xlib.h>
+#include <windowstr.h>
+
+#include <X11/extensions/Xrandr.h>
+#include <X11/extensions/randrproto.h>
+
+
+#include "xdbg_types.h"
+#include "xdbg_evlog_randr.h"
+
+static char *
+_EvlogRequestRandr (xReq *req, char *reply, int *len)
+{
+    xReq *stuff = req;
+
+    switch (stuff->data)
+    {
+    case X_RRGetScreenSizeRange:
+        {
+            xRRGetScreenSizeRangeReq *stuff = (xRRGetScreenSizeRangeReq *)req;
+            REPLY (": XID(0x%lx)",
+                stuff->window);
+
+            return reply;
+        }
+
+    case X_RRSetScreenSize:
+        {
+            xRRSetScreenSizeReq *stuff = (xRRSetScreenSizeReq *)req;
+            REPLY (": XID(0x%lx) size(%dx%d) milliSize(%ldx%ld)",
+                stuff->window,
+                stuff->width,
+                stuff->height,
+                stuff->widthInMillimeters,
+                stuff->heightInMillimeters);
+
+            return reply;
+        }
+
+    case X_RRGetScreenResources:
+        {
+            xRRGetScreenResourcesReq *stuff = (xRRGetScreenResourcesReq *)req;
+            REPLY (": XID(0x%lx)",
+                stuff->window);
+
+            return reply;
+        }
+
+    case X_RRGetOutputInfo:
+        {
+            xRRGetOutputInfoReq *stuff = (xRRGetOutputInfoReq *)req;
+            REPLY (": XID(0x%lx)",
+                stuff->output);
+
+            return reply;
+        }
+
+    case X_RRListOutputProperties:
+        {
+            xRRListOutputPropertiesReq *stuff = (xRRListOutputPropertiesReq *)req;
+            REPLY (": XID(0x%lx)",
+                stuff->output);
+
+            return reply;
+        }
+
+    case X_RRQueryOutputProperty:
+        {
+            xRRQueryOutputPropertyReq *stuff = (xRRQueryOutputPropertyReq *)req;
+            REPLY (": XID(0x%lx) Property(0x%lx)",
+                stuff->output,
+                stuff->property);
+
+            return reply;
+        }
+
+    case X_RRConfigureOutputProperty:
+        {
+            xRRConfigureOutputPropertyReq *stuff = (xRRConfigureOutputPropertyReq *)req;
+            REPLY (": XID(0x%lx) Property(0x%lx)",
+                stuff->output,
+                stuff->property);
+
+            return reply;
+        }
+
+    case X_RRChangeOutputProperty:
+        {
+            xRRChangeOutputPropertyReq *stuff = (xRRChangeOutputPropertyReq *)req;
+            REPLY (": XID(0x%lx) Property(0x%lx) Type(0x%lx) Format(%d) nUnits(%ld)",
+                stuff->output,
+                stuff->property,
+                stuff->type,
+                stuff->format,
+                stuff->nUnits);
+
+            return reply;
+        }
+
+    case X_RRDeleteOutputProperty:
+        {
+            xRRDeleteOutputPropertyReq *stuff = (xRRDeleteOutputPropertyReq *)req;
+            REPLY (": XID(0x%lx) Property(0x%lx)",
+                stuff->output,
+                stuff->property);
+
+            return reply;
+        }
+
+    case X_RRGetOutputProperty:
+        {
+            xRRGetOutputPropertyReq *stuff = (xRRGetOutputPropertyReq *)req;
+            REPLY (": XID(0x%lx) Property(0x%lx) Type(0x%lx) longOffset(%ld) longLength(%ld)",
+                stuff->output,
+                stuff->property,
+                stuff->type,
+                stuff->longOffset,
+                stuff->longLength);
+
+            return reply;
+        }
+
+    case X_RRGetCrtcInfo:
+        {
+            xRRGetCrtcInfoReq *stuff = (xRRGetCrtcInfoReq *)req;
+            REPLY (": XID(0x%lx)",
+                stuff->crtc);
+
+            return reply;
+        }
+
+    case X_RRSetCrtcConfig:
+        {
+            xRRSetCrtcConfigReq *stuff = (xRRSetCrtcConfigReq *)req;
+            REPLY (": XID(0x%lx) Coordinate(%d,%d) Rotation(%d)",
+                stuff->crtc,
+                stuff->x,
+                stuff->y,
+                stuff->rotation);
+
+            return reply;
+        }
+
+    case X_RRGetScreenResourcesCurrent:
+        {
+            xRRGetScreenResourcesCurrentReq *stuff = (xRRGetScreenResourcesCurrentReq *)req;
+            REPLY (": XID(0x%lx)",
+                stuff->window);
+
+            return reply;
+        }
+
+    default:
+            break;
+    }
+
+    return reply;
+}
+
+
+static char *
+_EvlogEventRandr (xEvent *evt, int first_base, char *reply, int *len)
+{
+    xEvent *stuff = evt;
+
+    switch ((stuff->u.u.type & 0x7F) - first_base)
+    {
+    case RRScreenChangeNotify:
+        {
+            xRRScreenChangeNotifyEvent *stuff = (xRRScreenChangeNotifyEvent *) evt;
+            REPLY (": Root(0x%lx) Window(0x%lx) sizeID(%d) subPixel(%d) Pixel(%d,%d) Milli(%d,%d)",
+                stuff->root,
+                stuff->window,
+                stuff->sizeID,
+                stuff->subpixelOrder,
+                stuff->widthInPixels,
+                stuff->heightInPixels,
+                stuff->widthInMillimeters,
+                stuff->heightInMillimeters);
+
+            return reply;
+        }
+
+    case RRNotify:
+        {
+            switch(stuff->u.u.detail)
+            {
+            case RRNotify_CrtcChange:
+                {
+                    xRRCrtcChangeNotifyEvent *stuff = (xRRCrtcChangeNotifyEvent *) evt;
+                    REPLY (": XID(0x%lx) Crtc(0x%lx) Mode(0x%lx) size(%udx%ud) coord(%d,%d)",
+                        stuff->window,
+                        stuff->crtc,
+                        stuff->mode,
+                        stuff->width,
+                        stuff->height,
+                        stuff->x,
+                        stuff->y);
+
+                    return reply;
+                }
+
+            case RRNotify_OutputChange:
+                {
+                    xRROutputChangeNotifyEvent *stuff = (xRROutputChangeNotifyEvent *) evt;
+                    REPLY (": XID(0x%lx) Output(0x%lx) Crtc(0x%lx) Mode(0x%lx)",
+                        stuff->window,
+                        stuff->output,
+                        stuff->crtc,
+                        stuff->mode);
+
+                    return reply;
+                }
+
+            case RRNotify_OutputProperty:
+                {
+                    xRROutputPropertyNotifyEvent *stuff = (xRROutputPropertyNotifyEvent *) evt;
+                    REPLY (": XID(0x%lx) Output(0x%lx) Atom(0x%lx)",
+                        stuff->window,
+                        stuff->output,
+                        stuff->atom);
+
+                    return reply;
+                }
+
+            case RRNotify_ProviderChange:
+                {
+                    xRRProviderChangeNotifyEvent *stuff = (xRRProviderChangeNotifyEvent *) evt;
+                    REPLY (": XID(0x%lx) Provider(0x%lx)",
+                        stuff->window,
+                        stuff->provider);
+
+                    return reply;
+                }
+
+            case RRNotify_ProviderProperty:
+                {
+                    xRRProviderPropertyNotifyEvent *stuff = (xRRProviderPropertyNotifyEvent *) evt;
+                    REPLY (": XID(0x%lx) Provider(0x%lx) Atom(0x%lx)",
+                        stuff->window,
+                        stuff->provider,
+                        stuff->atom);
+
+                    return reply;
+                }
+
+            case RRNotify_ResourceChange:
+                {
+                    xRRResourceChangeNotifyEvent *stuff = (xRRResourceChangeNotifyEvent *) evt;
+                    REPLY (": XID(0x%lx)",
+                        stuff->window);
+
+                    return reply;
+                }
+
+            default:
+                    break;
+            }
+        }
+
+    default:
+            break;
+    }
+
+    return reply;
+}
+
+
+void
+xDbgEvlogRandrGetBase (void *dpy, 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))
+    {
+        fprintf (stderr, "[UTILX] no Randr extension. \n");
+        return;
+    }
+    extinfo->req_func = _EvlogRequestRandr;
+    extinfo->evt_func = _EvlogEventRandr;
+#else
+    ExtensionEntry *xext = CheckExtension (RANDR_NAME);
+    RETURN_IF_FAIL (xext != NULL);
+
+    extinfo->opcode = xext->base;
+    extinfo->evt_base = xext->eventBase;
+    extinfo->err_base = xext->errorBase;
+    extinfo->req_func = _EvlogRequestRandr;
+    extinfo->evt_func = _EvlogEventRandr;
+#endif
+}
diff --git a/common/xdbg_evlog_randr.h b/common/xdbg_evlog_randr.h
new file mode 100644 (file)
index 0000000..d491c09
--- /dev/null
@@ -0,0 +1,39 @@
+/**************************************************************************
+
+xdbg
+
+Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
+
+Contact: Boram Park <boram1288.park@samsung.com>
+         Sangjin LEE <lsj119@samsung.com>
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+#ifndef __XDBG_EVLOG_RANDR_H__
+#define __XDBG_EVLOG_RANDR_H__
+
+#include "xdbg_types.h"
+
+void    xDbgEvlogRandrGetBase (void *dpy, ExtensionInfo *extinfo);
+
+#endif
index 3a4797d..2b29d75 100644 (file)
@@ -49,130 +49,20 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include <xace.h>
 #include <xacestr.h>
 #include <X11/Xatom.h>
-#include <X11/extensions/XI2proto.h>
 #include <X11/Xlib.h>
 #include <windowstr.h>
 #include <sys/shm.h>
-#include <X11/extensions/XShm.h>
 
 #include "xdbg_types.h"
+#include "xdbg_evlog.h"
 #include "xdbg_evlog_request.h"
 
 #define UNKNOWN_EVENT "<unknown>"
 
-#ifdef XDBG_CLIENT
-static int base;
-#else
-static ExtensionEntry *xext;
-#endif
-
-static Bool
-_EvlogRequestGetExtentionEntry ()
-{
-#ifdef XDBG_CLIENT
-
-    static int init = 0;
-    static Bool success = FALSE;
-    Display *dpy;
-
-    if (init)
-        return success;
-
-    init = 1;
-
-    dpy = XOpenDisplay (NULL);
-    if (!dpy)
-    {
-        fprintf (stderr, "failed: open display\n");
-        exit (-1);
-    }
-
-    if (!XShmQueryExtension (dpy))
-    {
-        fprintf (stderr, "[UTILX] no XShm extension. !!\n");
-        return False;
-    }
-    printf("debug request\n");
-    base = XShmGetEventBase(dpy);
-    success = TRUE;
-    XCloseDisplay (dpy);
-    return success;
-
-#else
-
-    static int init = 0;
-    static Bool success = FALSE;
-
-    if (init)
-        return success;
-
-    init = 1;
-    xext = CheckExtension (SHMNAME);
-    RETURN_VAL_IF_FAIL (xext != NULL, FALSE);
-
-    success = TRUE;
-
-    return success;
-
-#endif
-}
-
-static char *
-_EvlogRequestCore (xReq *req, char *reply, int *len)
-{
-    xReq *stuff = req;
-
-    switch (stuff->reqType)
-    {
-    case X_PutImage:
-        {
-            xPutImageReq *stuff = (xPutImageReq *)req;
-            REPLY (": XID(%lx) size(%dx%d) dst(%d,%d)",
-                stuff->drawable,
-                stuff->width,
-                stuff->height,
-                stuff->dstX,
-                stuff->dstY);
-            return reply;
-        }
-    default:
-            break;
-    }
-
-    return reply;
-}
-
-static char *
-_EvlogRequestShm (xReq *req, char *reply, int *len)
-{
-    xReq *stuff = req;
-
-    switch (stuff->data)
-    {
-    case X_ShmPutImage:
-        {
-            xShmPutImageReq *stuff = (xShmPutImageReq *)req;
-            REPLY (": XID(%lx) size(%dx%d) src(%d,%d %dx%d) dst(%d,%d)",
-                stuff->drawable,
-                stuff->totalWidth,
-                stuff->totalHeight,
-                stuff->srcX,
-                stuff->srcY,
-                stuff->srcWidth,
-                stuff->srcHeight,
-                stuff->dstX,
-                stuff->dstY);
-            return reply;
-        }
-    default:
-            break;
-    }
-
-    return reply;
-}
+extern ExtensionInfo Evlog_extensions[];
 
 char *
-xDbgEvlogReqeust (EvlogInfo *evinfo, char *reply, int *len)
+xDbgEvlogReqeust (EvlogInfo *evinfo, int Extensions_size, char *reply, int *len)
 {
     EvlogRequest req;
     xReq *xReq = NULL;
@@ -183,26 +73,22 @@ xDbgEvlogReqeust (EvlogInfo *evinfo, char *reply, int *len)
     req = evinfo->req;
     xReq = req.ptr;
 
-    if (!_EvlogRequestGetExtentionEntry ())
-        return reply;
-
     REPLY ("%s", req.name);
 
     if (xReq->reqType < EXTENSION_BASE)
     {
-        return _EvlogRequestCore (xReq, reply, len);
+        return xDbgEvlogRequestCore (xReq, reply, len);
     }
     else
     {
+        int i;
 
-#ifdef XDBG_CLIENT
-        if (xReq->reqType == base)
-#else
-        if (xReq->reqType == xext->base)
-#endif
-
+        for (i = 0 ; i < Extensions_size / sizeof (ExtensionInfo); i++)
         {
-            return _EvlogRequestShm (xReq, reply, len);
+            if (xReq->reqType == Evlog_extensions[i].opcode)
+            {
+                return Evlog_extensions[i].req_func (xReq, reply, len);
+            }
         }
     }
 
index ef75ca6..89e033c 100644 (file)
@@ -34,6 +34,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 #include "xdbg_types.h"
 
-char * xDbgEvlogReqeust (EvlogInfo *evinfo, char *reply, int *len);
+char *  xDbgEvlogReqeust (EvlogInfo *evinfo, int Extensions_size, char *reply, int *len);
 
 #endif
diff --git a/common/xdbg_evlog_xext.c b/common/xdbg_evlog_xext.c
new file mode 100644 (file)
index 0000000..a95660e
--- /dev/null
@@ -0,0 +1,572 @@
+/**************************************************************************
+
+xdbg
+
+Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
+
+Contact: Boram Park <boram1288.park@samsung.com>
+         Sangjin LEE <lsj119@samsung.com>
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <string.h>
+#include <strings.h>
+#include <sys/types.h>
+#include <sys/fcntl.h>
+#include <unistd.h>
+#include <stdarg.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+#include <dix.h>
+#define XREGISTRY
+#include <registry.h>
+#include <xace.h>
+#include <xacestr.h>
+#include <X11/Xatom.h>
+#include <X11/Xlib.h>
+#include <windowstr.h>
+
+#include <X11/extensions/XShm.h>
+#include <X11/extensions/dpms.h>
+#include <X11/extensions/sync.h>
+#include <X11/extensions/xtestext1.h>
+#include <X11/extensions/XTest.h>
+#include <X11/Xlibint.h>
+
+#include <X11/extensions/dpmsproto.h>
+#include <X11/extensions/shmproto.h>
+#include <X11/extensions/syncproto.h>
+#include <X11/extensions/xtestext1proto.h>
+#include <X11/extensions/xtestproto.h>
+
+#include "xdbg_types.h"
+#include "xdbg_evlog_xext.h"
+
+static char *
+_EvlogRequestXextDpms(xReq *req, char *reply, int *len)
+{
+    xReq *stuff = req;
+
+    switch (stuff->data)
+    {
+    case X_DPMSSetTimeouts:
+        {
+            xDPMSSetTimeoutsReq *stuff = (xDPMSSetTimeoutsReq *)req;
+            REPLY (": Standby(%d) Suspend(%d) off(%d)",
+                stuff->standby,
+                stuff->suspend,
+                stuff->off);
+
+            return reply;
+        }
+
+    case X_DPMSForceLevel:
+        {
+            xDPMSForceLevelReq *stuff = (xDPMSForceLevelReq *)req;
+            REPLY (": Level(%d)",
+                stuff->level);
+
+            return reply;
+        }
+
+    default:
+            break;
+    }
+
+    return reply;
+}
+
+
+static char *
+_EvlogRequestXextShm (xReq *req, char *reply, int *len)
+{
+    xReq *stuff = req;
+
+    switch (stuff->data)
+    {
+    case X_ShmPutImage:
+        {
+            xShmPutImageReq *stuff = (xShmPutImageReq *)req;
+            REPLY (": XID(0x%lx) size(%dx%d) src(%d,%d %dx%d) dst(%d,%d)",
+                stuff->drawable,
+                stuff->totalWidth,
+                stuff->totalHeight,
+                stuff->srcX,
+                stuff->srcY,
+                stuff->srcWidth,
+                stuff->srcHeight,
+                stuff->dstX,
+                stuff->dstY);
+
+            return reply;
+        }
+
+    case X_ShmGetImage:
+        {
+            xShmGetImageReq *stuff = (xShmGetImageReq *)req;
+            REPLY (": XID(0x%lx) size(%dx%d) coord(%d,%d)",
+                stuff->drawable,
+                stuff->width,
+                stuff->height,
+                stuff->x,
+                stuff->y);
+
+            return reply;
+        }
+
+    case X_ShmCreatePixmap:
+        {
+            xShmCreatePixmapReq *stuff = (xShmCreatePixmapReq *)req;
+            REPLY (": Pixmap(0x%lx) Drawable(0x%lx) size(%dx%d)",
+                stuff->pid,
+                stuff->drawable,
+                stuff->width,
+                stuff->height);
+
+            return reply;
+        }
+
+    default:
+            break;
+    }
+
+    return reply;
+}
+
+static char *
+_EvlogRequestXextSync(xReq *req, char *reply, int *len)
+{
+    xReq *stuff = req;
+
+    switch (stuff->data)
+    {
+    case X_SyncCreateCounter:
+        {
+            xSyncCreateCounterReq *stuff = (xSyncCreateCounterReq *)req;
+            REPLY (": XID(0x%lx) initValue(%ld/%ld)",
+                stuff->cid,
+                stuff->initial_value_hi,
+                stuff->initial_value_lo);
+
+            return reply;
+        }
+
+    case X_SyncSetCounter:
+        {
+            xSyncSetCounterReq *stuff = (xSyncSetCounterReq *)req;
+            REPLY (": XID(0x%lx) Value(%ld/%ld)",
+                stuff->cid,
+                stuff->value_hi,
+                stuff->value_lo);
+
+            return reply;
+        }
+
+    case X_SyncChangeCounter:
+        {
+            xSyncChangeCounterReq *stuff = (xSyncChangeCounterReq *)req;
+            REPLY (": XID(0x%lx) Value(%ld/%ld)",
+                stuff->cid,
+                stuff->value_hi,
+                stuff->value_lo);
+
+            return reply;
+        }
+
+    case X_SyncQueryCounter:
+        {
+            xSyncQueryCounterReq *stuff = (xSyncQueryCounterReq *)req;
+            REPLY (": XID(0x%lx)",
+                stuff->counter);
+
+            return reply;
+        }
+
+    case X_SyncDestroyCounter:
+        {
+            xSyncDestroyCounterReq *stuff = (xSyncDestroyCounterReq *)req;
+            REPLY (": XID(0x%lx)",
+                stuff->counter);
+
+            return reply;
+        }
+
+    default:
+            break;
+    }
+
+    return reply;
+}
+
+static char *
+_EvlogRequestXextXtestExt1(xReq *req, char *reply, int *len)
+{
+    xReq *stuff = req;
+
+    switch (stuff->data)
+    {
+    case X_TestFakeInput:
+        {
+            xTestFakeInputReq *stuff = (xTestFakeInputReq *)req;
+            REPLY (": XID(0x%lx)",
+                stuff->ack);
+
+            return reply;
+        }
+
+    case X_TestGetInput:
+        {
+            xTestGetInputReq *stuff = (xTestGetInputReq *)req;
+            REPLY (": XID(0x%lx)",
+                stuff->mode);
+
+            return reply;
+        }
+
+    default:
+            break;
+    }
+
+    return reply;
+}
+
+
+static char *
+_EvlogRequestXextXtest(xReq *req, char *reply, int *len)
+{
+    xReq *stuff = req;
+
+    switch (stuff->data)
+    {
+    case X_XTestGetVersion:
+        {
+            xXTestGetVersionReq *stuff = (xXTestGetVersionReq *)req;
+            REPLY (": MajorVersion(%d) MinorVersion(%d)",
+                stuff->majorVersion,
+                stuff->minorVersion);
+
+            return reply;
+        }
+
+    case X_XTestCompareCursor:
+        {
+            xXTestCompareCursorReq *stuff = (xXTestCompareCursorReq *)req;
+            REPLY (": XID(0x%lx) Cursor(0x%lx)",
+                stuff->window,
+                stuff->cursor);
+
+            return reply;
+        }
+
+    case X_XTestFakeInput:
+        {
+            xXTestFakeInputReq *stuff = (xXTestFakeInputReq *)req;
+            REPLY (": XID(0x%lx) coord(%d,%d)",
+                stuff->root,
+                stuff->rootX,
+                stuff->rootY);
+
+            return reply;
+        }
+
+    case X_XTestGrabControl:
+        {
+            xXTestGrabControlReq *stuff = (xXTestGrabControlReq *)req;
+            REPLY (": Impervious(%s)" ,
+                (stuff->impervious)? "TRUE" : "FALSE");
+
+            return reply;
+        }
+
+    default:
+            break;
+    }
+
+    return reply;
+}
+
+
+static char *
+_EvlogEventXextDpms (xEvent *evt, int first_base, char *reply, int *len)
+{
+    xEvent *stuff = evt;
+
+    switch ((stuff->u.u.type & 0x7F) - first_base)
+    {
+
+    default:
+            break;
+    }
+
+    return reply;
+}
+
+
+static char *
+_EvlogEventXextShm (xEvent *evt, int first_base, char *reply, int *len)
+{
+    xEvent *stuff = evt;
+
+    switch ((stuff->u.u.type & 0x7F) - first_base)
+    {
+    case ShmCompletion:
+        {
+            xShmCompletionEvent *stuff = (xShmCompletionEvent *) evt;
+            REPLY (": XID(0x%lx)",
+                stuff->drawable);
+
+            return reply;
+        }
+
+    default:
+            break;
+    }
+
+    return reply;
+}
+
+
+static char *
+_EvlogEventXextSync (xEvent *evt, int first_base, char *reply, int *len)
+{
+    xEvent *stuff = evt;
+
+    switch ((stuff->u.u.type & 0x7F) - first_base)
+    {
+    case XSyncCounterNotify:
+        {
+            xSyncCounterNotifyEvent *stuff = (xSyncCounterNotifyEvent *) evt;
+            REPLY (": XID(0x%lx) WaitValue(0x%lx/0x%lx) CounterValue(0x%lx/0x%lx)",
+                stuff->counter,
+                stuff->wait_value_hi,
+                stuff->wait_value_lo,
+                stuff->counter_value_hi,
+                stuff->counter_value_lo);
+
+            return reply;
+        }
+
+    case XSyncAlarmNotify:
+        {
+            xSyncAlarmNotifyEvent *stuff = (xSyncAlarmNotifyEvent *) evt;
+            REPLY (": XID(0x%lx) CounterValue(0x%lx/0x%lx) AlarmValue(0x%lx/0x%lx)",
+                stuff->alarm,
+                stuff->counter_value_hi,
+                stuff->counter_value_lo,
+                stuff->alarm_value_hi,
+                stuff->alarm_value_lo);
+
+            return reply;
+        }
+
+    default:
+            break;
+    }
+
+    return reply;
+}
+
+
+static char *
+_EvlogEventXextXtestExt1 (xEvent *evt, int first_base, char *reply, int *len)
+{
+    xEvent *stuff = evt;
+
+    switch ((stuff->u.u.type & 0x7F) - first_base)
+    {
+
+    default:
+            break;
+    }
+
+    return reply;
+}
+
+static char *
+_EvlogEventXextXtest (xEvent *evt, int first_base, char *reply, int *len)
+{
+    xEvent *stuff = evt;
+
+    switch ((stuff->u.u.type & 0x7F) - first_base)
+    {
+
+    default:
+            break;
+    }
+
+    return reply;
+}
+
+void
+xDbgEvlogXextDpmsGetBase (void *dpy, 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))
+    {
+        fprintf (stderr, "[UTILX] no Xext_DPMS extension. \n");
+        return;
+    }
+    extinfo->req_func = _EvlogRequestXextDpms;
+    extinfo->evt_func = _EvlogEventXextDpms;
+#else
+    ExtensionEntry *xext = CheckExtension (DPMSExtensionName);
+    RETURN_IF_FAIL (xext != NULL);
+
+    extinfo->opcode = xext->base;
+    extinfo->evt_base = xext->eventBase;
+    extinfo->err_base = xext->errorBase;
+    extinfo->req_func = _EvlogRequestXextDpms;
+    extinfo->evt_func = _EvlogEventXextDpms;
+#endif
+}
+
+
+void
+xDbgEvlogXextShmGetBase (void *dpy, 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))
+    {
+        fprintf (stderr, "[UTILX] no XShm extension. \n");
+        return;
+    }
+    extinfo->req_func = _EvlogRequestXextShm;
+    extinfo->evt_func = _EvlogEventXextShm;
+#else
+    ExtensionEntry *xext = CheckExtension (SHMNAME);
+    RETURN_IF_FAIL (xext != NULL);
+
+    extinfo->opcode = xext->base;
+    extinfo->evt_base = xext->eventBase;
+    extinfo->err_base = xext->errorBase;
+    extinfo->req_func = _EvlogRequestXextShm;
+    extinfo->evt_func = _EvlogEventXextShm;
+#endif
+}
+
+
+void
+xDbgEvlogXextSyncGetBase (void *dpy, 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))
+    {
+        fprintf (stderr, "[UTILX] no Sync extension. \n");
+        return;
+    }
+
+    extinfo->req_func = _EvlogRequestXextSync;
+    extinfo->evt_func = _EvlogEventXextSync;
+#else
+    ExtensionEntry *xext = CheckExtension (SYNC_NAME);
+    RETURN_IF_FAIL (xext != NULL);
+
+    extinfo->opcode = xext->base;
+    extinfo->evt_base = xext->eventBase;
+    extinfo->err_base = xext->errorBase;
+    extinfo->req_func = _EvlogRequestXextSync;
+    extinfo->evt_func = _EvlogEventXextSync;
+#endif
+
+}
+
+
+void
+xDbgEvlogXextXtestExt1GetBase (void *dpy, 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))
+    {
+        fprintf (stderr, "[UTILX] no XTestExt1 extension. \n");
+        return;
+    }
+    extinfo->req_func = _EvlogRequestXextXtestExt1;
+    extinfo->evt_func = _EvlogEventXextXtestExt1;
+#else
+    ExtensionEntry *xext = CheckExtension (XTestEXTENSION_NAME);
+    RETURN_IF_FAIL (xext != NULL);
+
+    extinfo->opcode = xext->base;
+    extinfo->evt_base = xext->eventBase;
+    extinfo->err_base = xext->errorBase;
+    extinfo->req_func = _EvlogRequestXextXtestExt1;
+    extinfo->evt_func = _EvlogEventXextXtestExt1;
+#endif
+
+}
+
+
+void
+xDbgEvlogXextXtestGetBase (void *dpy, 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))
+    {
+        fprintf (stderr, "[UTILX] no Xext_Xtest extension. \n");
+        return;
+    }
+    extinfo->req_func = _EvlogRequestXextXtest;
+    extinfo->evt_func = _EvlogEventXextXtest;
+#else
+    ExtensionEntry *xext = CheckExtension (XTestExtensionName);
+    RETURN_IF_FAIL (xext != NULL);
+
+    extinfo->opcode = xext->base;
+    extinfo->evt_base = xext->eventBase;
+    extinfo->err_base = xext->errorBase;
+    extinfo->req_func = _EvlogRequestXextXtest;
+    extinfo->evt_func = _EvlogEventXextXtest;
+#endif
+
+}
diff --git a/common/xdbg_evlog_xext.h b/common/xdbg_evlog_xext.h
new file mode 100644 (file)
index 0000000..c0c1a09
--- /dev/null
@@ -0,0 +1,43 @@
+/**************************************************************************
+
+xdbg
+
+Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
+
+Contact: Boram Park <boram1288.park@samsung.com>
+         Sangjin LEE <lsj119@samsung.com>
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+#ifndef __XDBG_EVLOG_XEXT_H__
+#define __XDBG_EVLOG_XEXT_H__
+
+#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);
+
+#endif
diff --git a/common/xdbg_evlog_xinput.c b/common/xdbg_evlog_xinput.c
new file mode 100644 (file)
index 0000000..7fc5479
--- /dev/null
@@ -0,0 +1,665 @@
+/**************************************************************************
+
+xdbg
+
+Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
+
+Contact: Boram Park <boram1288.park@samsung.com>
+         Sangjin LEE <lsj119@samsung.com>
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <string.h>
+#include <strings.h>
+#include <sys/types.h>
+#include <sys/fcntl.h>
+#include <unistd.h>
+#include <stdarg.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+#include <dix.h>
+#define XREGISTRY
+#include <registry.h>
+#include <xace.h>
+#include <xacestr.h>
+#include <X11/Xatom.h>
+#include <X11/Xlib.h>
+#include <windowstr.h>
+
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XInput.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XIproto.h>
+#include <X11/extensions/XI2proto.h>
+
+#include "xdbg_types.h"
+#include "xdbg_evlog_xinput.h"
+
+static char *
+_EvlogRequestXinput (xReq *req, char *reply, int *len)
+{
+    xReq *stuff = req;
+
+    switch (stuff->data)
+    {
+    case X_GrabDevice:
+        {
+            xGrabDeviceReq *stuff = (xGrabDeviceReq *)req;
+            REPLY (": XID(0x%lx) Time(0x%lx) evtCnt(%d) thisMode(%d) otherMode(%d) devID(%d)",
+                stuff->grabWindow,
+                stuff->time,
+                stuff->event_count,
+                stuff->this_device_mode,
+                stuff->other_devices_mode,
+                stuff->deviceid);
+
+            return reply;
+        }
+
+    case X_UngrabDevice:
+        {
+            xUngrabDeviceReq *stuff = (xUngrabDeviceReq *)req;
+            REPLY (": Time(0x%lx) devID(%d)",
+                stuff->time,
+                stuff->deviceid);
+
+            return reply;
+        }
+
+    case X_GrabDeviceKey:
+        {
+            xGrabDeviceKeyReq *stuff = (xGrabDeviceKeyReq *)req;
+            REPLY (": XID(0x%lx) evtCnt(%d) modifiers(%d) modDev(%d) grabDev(%d) key(%d)",
+                stuff->grabWindow,
+                stuff->event_count,
+                stuff->modifiers,
+                stuff->modifier_device,
+                stuff->grabbed_device,
+                stuff->key);
+
+            return reply;
+        }
+
+    case X_UngrabDeviceKey:
+        {
+            xUngrabDeviceKeyReq *stuff = (xUngrabDeviceKeyReq *)req;
+            REPLY (": XID(0x%lx) modifiers(%d) modDev(%d) key(%d) grabDev(%d)",
+                stuff->grabWindow,
+                stuff->modifiers,
+                stuff->modifier_device,
+                stuff->key,
+                stuff->grabbed_device);
+
+            return reply;
+        }
+
+    case X_GrabDeviceButton:
+        {
+            xGrabDeviceButtonReq *stuff = (xGrabDeviceButtonReq *)req;
+            REPLY (": XID(0x%lx) evtCnt(%d) modifiers(%d) modDev(%d) grabDev(%d) button(%d)",
+                stuff->grabWindow,
+                stuff->event_count,
+                stuff->modifiers,
+                stuff->modifier_device,
+                stuff->grabbed_device,
+                stuff->button);
+
+            return reply;
+        }
+
+    case X_UngrabDeviceButton:
+        {
+            xUngrabDeviceButtonReq *stuff = (xUngrabDeviceButtonReq *)req;
+            REPLY (": XID(0x%lx) modifiers(%d) modDev(%d) grabDev(%d) button(%d)",
+                stuff->grabWindow,
+                stuff->modifiers,
+                stuff->modifier_device,
+                stuff->grabbed_device,
+                stuff->button);
+
+            return reply;
+        }
+
+    case X_AllowDeviceEvents:
+        {
+            xAllowDeviceEventsReq *stuff = (xAllowDeviceEventsReq *)req;
+            REPLY (": Time(0x%lx) devID(%d) mode(%d)",
+                stuff->time,
+                stuff->deviceid,
+                stuff->mode);
+
+            return reply;
+        }
+
+    case X_GetDeviceFocus:
+        {
+            xGetDeviceFocusReq *stuff = (xGetDeviceFocusReq *)req;
+            REPLY (": devID(%d)",
+                stuff->deviceid);
+
+            return reply;
+        }
+
+    case X_SetDeviceFocus:
+        {
+            xSetDeviceFocusReq *stuff = (xSetDeviceFocusReq *)req;
+            REPLY (": XID(0x%lx) Time(0x%lx) revertTo(%d) devID(%d)",
+                stuff->focus,
+                stuff->time,
+                stuff->revertTo,
+                stuff->device);
+
+            return reply;
+        }
+
+    case X_XIQueryPointer:
+        {
+            xXIQueryPointerReq *stuff = (xXIQueryPointerReq *)req;
+            REPLY (": XID(0x%x) devID(%d)",
+                stuff->win,
+                stuff->deviceid);
+
+            return reply;
+        }
+
+    case X_XIWarpPointer:
+        {
+            xXIWarpPointerReq *stuff = (xXIWarpPointerReq *)req;
+            REPLY (": srcWIN(0x%x) dstWin(0x%x) src(%d,%d %dx%d) dst(%d,%d) devID(%d)",
+                stuff->src_win,
+                stuff->dst_win,
+                stuff->src_x,
+                stuff->src_y,
+                stuff->src_width,
+                stuff->src_height,
+                stuff->dst_x,
+                stuff->dst_y,
+                stuff->deviceid);
+
+            return reply;
+        }
+
+    case X_XIChangeCursor:
+        {
+            xXIChangeCursorReq *stuff = (xXIChangeCursorReq *)req;
+            REPLY (": XID(0x%x) Cursor(0x%x) devID(%d)",
+                stuff->win,
+                stuff->cursor,
+                stuff->deviceid);
+
+            return reply;
+        }
+
+    case X_XIChangeHierarchy:
+        {
+            xXIChangeHierarchyReq *stuff = (xXIChangeHierarchyReq *)req;
+            REPLY (": numChange(%d)",
+                stuff->num_changes);
+
+            return reply;
+        }
+
+    case X_XISetClientPointer:
+        {
+            xXISetClientPointerReq *stuff = (xXISetClientPointerReq *)req;
+            REPLY (": XID(0x%x) devID(%d)",
+                stuff->win,
+                stuff->deviceid);
+
+            return reply;
+        }
+
+    case X_XIGetClientPointer:
+        {
+            xXIGetClientPointerReq *stuff = (xXIGetClientPointerReq *)req;
+            REPLY (": XID(0x%x)",
+                stuff->win);
+
+            return reply;
+        }
+
+    case X_XISelectEvents:
+        {
+            xXISelectEventsReq *stuff = (xXISelectEventsReq *)req;
+            REPLY (": XID(0x%x)",
+                stuff->win);
+
+            return reply;
+        }
+
+    case X_XIQueryVersion:
+        {
+            xXIQueryVersionReq *stuff = (xXIQueryVersionReq *)req;
+            REPLY (": majorVesion(%d) minorVesion(%d)",
+                stuff->major_version,
+                stuff->minor_version);
+
+            return reply;
+        }
+
+    case X_XIQueryDevice:
+        {
+            xXIQueryDeviceReq *stuff = (xXIQueryDeviceReq *)req;
+            REPLY (": devID(%d)",
+                stuff->deviceid);
+
+            return reply;
+        }
+
+    case X_XISetFocus:
+        {
+            xXISetFocusReq *stuff = (xXISetFocusReq *)req;
+            REPLY (": XID(0x%x) Time(0x%x) devID(%d)",
+                stuff->focus,
+                stuff->time,
+                stuff->deviceid);
+
+            return reply;
+        }
+
+    case X_XIGetFocus:
+        {
+            xXIGetFocusReq *stuff = (xXIGetFocusReq *)req;
+            REPLY (": devID(%d)",
+                stuff->deviceid);
+
+            return reply;
+        }
+
+    case X_XIGrabDevice:
+        {
+            xXIGrabDeviceReq *stuff = (xXIGrabDeviceReq *)req;
+            REPLY (": XID(0x%x) Time(0x%x) Cursor(0x%x) grabMode(%d) pairDevMode(%d) devID(%d)",
+                stuff->grab_window,
+                stuff->time,
+                stuff->cursor,
+                stuff->grab_mode,
+                stuff->paired_device_mode,
+                stuff->deviceid);
+
+            return reply;
+        }
+
+    case X_XIUngrabDevice:
+        {
+            xXIUngrabDeviceReq *stuff = (xXIUngrabDeviceReq *)req;
+            REPLY (": Time(0x%x) devID(%d)",
+                stuff->time,
+                stuff->deviceid);
+
+            return reply;
+        }
+
+    case X_XIAllowEvents:
+        {
+            xXIAllowEventsReq *stuff = (xXIAllowEventsReq *)req;
+            REPLY (": Time(0x%x) devID(%d) mode(%d)",
+                stuff->time,
+                stuff->deviceid,
+                stuff->mode);
+
+            return reply;
+        }
+
+    case X_XIPassiveGrabDevice:
+        {
+            xXIPassiveGrabDeviceReq *stuff = (xXIPassiveGrabDeviceReq *)req;
+            REPLY (": XID(0x%x) Time(0x%x) Cursor(0x%x) detail(0x%x) grabType(%d) grabMode(%d) pairDevMode(%d)",
+                stuff->grab_window,
+                stuff->time,
+                stuff->cursor,
+                stuff->detail,
+                stuff->grab_type,
+                stuff->grab_mode,
+                stuff->paired_device_mode);
+
+            return reply;
+        }
+
+    case X_XIPassiveUngrabDevice:
+        {
+            xXIPassiveUngrabDeviceReq *stuff = (xXIPassiveUngrabDeviceReq *)req;
+            REPLY (": XID(0x%x) detail(0x%x) grabType(%d) devID(%d)",
+                stuff->grab_window,
+                stuff->detail,
+                stuff->grab_type,
+                stuff->deviceid);
+
+            return reply;
+        }
+
+    case X_XIListProperties:
+        {
+            xXIListPropertiesReq *stuff = (xXIListPropertiesReq *)req;
+            REPLY (": devID(%d)",
+                stuff->deviceid);
+
+            return reply;
+        }
+
+    case X_XIChangeProperty:
+        {
+            xXIChangePropertyReq *stuff = (xXIChangePropertyReq *)req;
+            REPLY (": devID(%d) mode(%d) format(%d) property(0x%x) type(0x%x) numItems(%d)",
+                stuff->deviceid,
+                stuff->mode,
+                stuff->format,
+                stuff->property,
+                stuff->type,
+                stuff->num_items);
+
+            return reply;
+        }
+
+    case X_XIDeleteProperty:
+        {
+            xXIDeletePropertyReq *stuff = (xXIDeletePropertyReq *)req;
+            REPLY (": devID(%d) property(0x%x)",
+                stuff->deviceid,
+                stuff->property);
+
+            return reply;
+        }
+
+    case X_XIGetProperty:
+        {
+            xXIGetPropertyReq *stuff = (xXIGetPropertyReq *)req;
+            REPLY (": devID(%d) property(0x%x) type(0x%x)",
+                stuff->deviceid,
+                stuff->property,
+                stuff->type);
+
+            return reply;
+        }
+
+    case X_XIGetSelectedEvents:
+        {
+            xXIGetSelectedEventsReq *stuff = (xXIGetSelectedEventsReq *)req;
+            REPLY (": XID(0x%x)",
+                stuff->win);
+
+            return reply;
+        }
+
+    default:
+            break;
+    }
+
+    return reply;
+}
+
+static char *
+_EvlogEventXinput (xEvent *evt, int first_base, char *reply, int *len)
+{
+    xEvent *stuff = evt;
+
+    switch ((stuff->u.u.type & 0x7F) - first_base)
+    {
+    case XI_DeviceValuator:
+        {
+            deviceValuator *stuff = (deviceValuator *) evt;
+            REPLY (": numValuator(%d) fstnumValuator(%d)",
+                stuff->num_valuators,
+                stuff->first_valuator);
+
+            return reply;
+        }
+
+    case XI_DeviceKeyPress:
+        {
+            XDeviceKeyPressedEvent *stuff = (XDeviceKeyPressedEvent *) evt;
+            REPLY (": XID(0x%lx) Window(0x%lx %d,%d) Root(0x%lx %d,%d) subWindow(0x%lx)",
+                stuff->deviceid,
+                stuff->window,
+                stuff->x,
+                stuff->y,
+                stuff->root,
+                stuff->x_root,
+                stuff->y_root,
+                stuff->subwindow);
+
+            return reply;
+        }
+
+    case XI_DeviceKeyRelease:
+        {
+            XDeviceKeyReleasedEvent *stuff = (XDeviceKeyReleasedEvent *) evt;
+            REPLY (": XID(0x%lx) Window(0x%lx %d,%d) Root(0x%lx %d,%d) subWindow(0x%lx)",
+                stuff->deviceid,
+                stuff->window,
+                stuff->x,
+                stuff->y,
+                stuff->root,
+                stuff->x_root,
+                stuff->y_root,
+                stuff->subwindow);
+
+            return reply;
+        }
+
+    case XI_DeviceButtonPress:
+        {
+            XDeviceButtonPressedEvent *stuff = (XDeviceButtonPressedEvent *) evt;
+            REPLY (": XID(0x%lx) Window(0x%lx %d,%d) Root(0x%lx %d,%d) subWindow(0x%lx)",
+                stuff->deviceid,
+                stuff->window,
+                stuff->x,
+                stuff->y,
+                stuff->root,
+                stuff->x_root,
+                stuff->y_root,
+                stuff->subwindow);
+
+            return reply;
+        }
+
+    case XI_DeviceButtonRelease:
+        {
+            XDeviceButtonReleasedEvent *stuff = (XDeviceButtonReleasedEvent *) evt;
+            REPLY (": XID(0x%lx) Window(0x%lx %d,%d) Root(0x%lx %d,%d) subWindow(0x%lx)",
+                stuff->deviceid,
+                stuff->window,
+                stuff->x,
+                stuff->y,
+                stuff->root,
+                stuff->x_root,
+                stuff->y_root,
+                stuff->subwindow);
+
+            return reply;
+        }
+
+    case XI_DeviceMotionNotify:
+        {
+            XDeviceMotionEvent *stuff = (XDeviceMotionEvent *) evt;
+            REPLY (": XID(0x%lx) Window(0x%lx %d,%d) Root(0x%lx %d,%d) subWindow(0x%lx)",
+                stuff->deviceid,
+                stuff->window,
+                stuff->x,
+                stuff->y,
+                stuff->root,
+                stuff->x_root,
+                stuff->y_root,
+                stuff->subwindow);
+
+            return reply;
+        }
+
+    case XI_DeviceFocusIn:
+        {
+            XDeviceFocusInEvent *stuff = (XDeviceFocusInEvent *) evt;
+            REPLY (": XID(0x%lx) Window(0x%lx)",
+                stuff->deviceid,
+                stuff->window);
+
+            return reply;
+        }
+
+    case XI_DeviceFocusOut:
+        {
+            XDeviceFocusOutEvent *stuff = (XDeviceFocusOutEvent *) evt;
+            REPLY (": XID(0x%lx) Window(0x%lx)",
+                stuff->deviceid,
+                stuff->window);
+
+            return reply;
+        }
+
+    case XI_ProximityIn:
+        {
+            XProximityInEvent *stuff = (XProximityInEvent *) evt;
+            REPLY (": XID(0x%lx) Window(0x%lx %d,%d) Root(0x%lx %d,%d) subWindow(0x%lx)",
+                stuff->deviceid,
+                stuff->window,
+                stuff->x,
+                stuff->y,
+                stuff->root,
+                stuff->x_root,
+                stuff->y_root,
+                stuff->subwindow);
+
+            return reply;
+        }
+
+    case XI_ProximityOut:
+        {
+            XProximityOutEvent *stuff = (XProximityOutEvent *) evt;
+            REPLY (": XID(0x%lx) Window(0x%lx %d,%d) Root(0x%lx %d,%d) subWindow(0x%lx)",
+                stuff->deviceid,
+                stuff->window,
+                stuff->x,
+                stuff->y,
+                stuff->root,
+                stuff->x_root,
+                stuff->y_root,
+                stuff->subwindow);
+
+            return reply;
+        }
+
+    case XI_DeviceStateNotify:
+        {
+            XDeviceStateNotifyEvent *stuff = (XDeviceStateNotifyEvent *) evt;
+            REPLY (": XID(0x%lx) Window(0x%lx)",
+                stuff->deviceid,
+                stuff->window);
+
+            return reply;
+        }
+
+    case XI_DeviceMappingNotify:
+        {
+            XDeviceMappingEvent *stuff = (XDeviceMappingEvent *) evt;
+            REPLY (": XID(0x%lx) Window(0x%lx)",
+                stuff->deviceid,
+                stuff->window);
+
+            return reply;
+        }
+
+    case XI_ChangeDeviceNotify:
+        {
+            XChangeDeviceNotifyEvent *stuff = (XChangeDeviceNotifyEvent *) evt;
+            REPLY (": XID(0x%lx) Window(0x%lx)",
+                stuff->deviceid,
+                stuff->window);
+
+            return reply;
+        }
+
+    case XI_DeviceKeystateNotify:
+        {
+            deviceKeyStateNotify *stuff = (deviceKeyStateNotify *) evt;
+            REPLY (": deviceid(%d)",
+                stuff->deviceid);
+
+            return reply;
+        }
+
+    case XI_DeviceButtonstateNotify:
+        {
+            deviceButtonStateNotify *stuff = (deviceButtonStateNotify *) evt;
+            REPLY (": deviceid(%d)",
+                stuff->deviceid);
+
+            return reply;
+        }
+
+    case XI_DevicePresenceNotify:
+        {
+            devicePresenceNotify *stuff = (devicePresenceNotify *) evt;
+            REPLY (": deviceid(%d)",
+                stuff->deviceid);
+
+            return reply;
+        }
+
+    case XI_DevicePropertyNotify:
+        {
+            devicePropertyNotify *stuff = (devicePropertyNotify *) evt;
+            REPLY (": XID(0x%lx)",
+                stuff->atom);
+
+            return reply;
+        }
+
+    default:
+            break;
+    }
+
+    return reply;
+}
+
+void
+xDbgEvlogXinputGetBase (void *dpy, 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))
+    {
+        fprintf (stderr, "[UTILX] no Xinput extension. \n");
+        return;
+    }
+    extinfo->req_func = _EvlogRequestXinput;
+    extinfo->evt_func = _EvlogEventXinput;
+#else
+    ExtensionEntry *xext = CheckExtension (INAME);
+    RETURN_IF_FAIL (xext != NULL);
+
+    extinfo->opcode = xext->base;
+    extinfo->evt_base = xext->eventBase;
+    extinfo->err_base = xext->errorBase;
+    extinfo->req_func = _EvlogRequestXinput;
+    extinfo->evt_func = _EvlogEventXinput;
+#endif
+}
diff --git a/common/xdbg_evlog_xinput.h b/common/xdbg_evlog_xinput.h
new file mode 100644 (file)
index 0000000..b7ed651
--- /dev/null
@@ -0,0 +1,39 @@
+/**************************************************************************
+
+xdbg
+
+Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
+
+Contact: Boram Park <boram1288.park@samsung.com>
+         Sangjin LEE <lsj119@samsung.com>
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+#ifndef __XDBG_EVLOG_XINPUT_H__
+#define __XDBG_EVLOG_XINPUT_H__
+
+#include "xdbg_types.h"
+
+void    xDbgEvlogXinputGetBase (void *dpy, ExtensionInfo *extinfo);
+
+#endif
diff --git a/common/xdbg_evlog_xv.c b/common/xdbg_evlog_xv.c
new file mode 100644 (file)
index 0000000..e807030
--- /dev/null
@@ -0,0 +1,258 @@
+/**************************************************************************
+
+xdbg
+
+Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
+
+Contact: Boram Park <boram1288.park@samsung.com>
+         Sangjin LEE <lsj119@samsung.com>
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <string.h>
+#include <strings.h>
+#include <sys/types.h>
+#include <sys/fcntl.h>
+#include <unistd.h>
+#include <stdarg.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+#include <dix.h>
+#define XREGISTRY
+#include <registry.h>
+#include <xace.h>
+#include <xacestr.h>
+#include <X11/Xatom.h>
+#include <X11/Xlib.h>
+#include <windowstr.h>
+
+#include <X11/extensions/Xvlib.h>
+#include <X11/extensions/Xv.h>
+#include <X11/extensions/Xvproto.h>
+
+#include "xdbg_types.h"
+#include "xdbg_evlog_xv.h"
+
+static char *
+_EvlogRequestXv(xReq *req, char *reply, int *len)
+{
+    xReq *stuff = req;
+
+    switch (stuff->data)
+    {
+    case xv_GrabPort:
+        {
+            xvGrabPortReq *stuff = (xvGrabPortReq *)req;
+            REPLY (": XID(0x%lx)",
+                stuff->port);
+
+            return reply;
+        }
+
+    case xv_UngrabPort:
+        {
+            xvUngrabPortReq *stuff = (xvUngrabPortReq *)req;
+            REPLY (": XID(0x%lx)",
+                stuff->port);
+
+            return reply;
+        }
+
+    case xv_GetStill:
+        {
+            xvGetStillReq *stuff = (xvGetStillReq *)req;
+            REPLY (": XID(0x%lx) Drawable(0x%lx) GC(0x%lx) Vid(%d,%d) Drw(%d,%d)",
+                stuff->port,
+                stuff->drawable,
+                stuff->gc,
+                stuff->vid_x,
+                stuff->vid_y,
+                stuff->drw_x,
+                stuff->drw_y);
+
+            return reply;
+        }
+
+    case xv_StopVideo:
+        {
+            xvStopVideoReq *stuff = (xvStopVideoReq *)req;
+            REPLY (": XID(0x%lx) Drawable(0x%lx)",
+                stuff->port,
+                stuff->drawable);
+
+            return reply;
+        }
+
+    case xv_SelectVideoNotify:
+        {
+            xvSelectVideoNotifyReq *stuff = (xvSelectVideoNotifyReq *)req;
+            REPLY (": XID(0x%lx) On/Off(%d)",
+                stuff->drawable,
+                stuff->onoff);
+
+            return reply;
+        }
+
+    case xv_SelectPortNotify:
+        {
+            xvSelectPortNotifyReq *stuff = (xvSelectPortNotifyReq *)req;
+            REPLY (": XID(0x%lx) On/Off(%d)",
+                stuff->port,
+                stuff->onoff);
+
+            return reply;
+        }
+
+    case xv_QueryBestSize:
+        {
+            xvQueryBestSizeReq *stuff = (xvQueryBestSizeReq *)req;
+            REPLY (": XID(0x%lx) VidSize(%dx%d) DrwSize(%dx%d)",
+                stuff->port,
+                stuff->vid_w,
+                stuff->vid_h,
+                stuff->drw_w,
+                stuff->drw_h);
+
+            return reply;
+        }
+
+    case xv_SetPortAttribute:
+        {
+            xvSetPortAttributeReq *stuff = (xvSetPortAttributeReq *)req;
+            REPLY (": XID(0x%lx) Attribute(0x%lx) value(0x%lx)",
+                stuff->port,
+                stuff->attribute,
+                stuff->value);
+
+            return reply;
+        }
+
+    case xv_PutImage:
+        {
+            xvPutImageReq *stuff = (xvPutImageReq *)req;
+            REPLY (": XID(0x%lx) Drawable(0x%lx) GC(0x%lx) ID(0x%lx) src(%d,%d) drw(%d,%d)",
+                stuff->port,
+                stuff->drawable,
+                stuff->gc,
+                stuff->id,
+                stuff->src_x,
+                stuff->src_y,
+                stuff->drw_x,
+                stuff->drw_y);
+
+            return reply;
+        }
+
+    case xv_ShmPutImage:
+        {
+            xvShmPutImageReq *stuff = (xvShmPutImageReq *)req;
+            REPLY (": XID(0x%lx) Drawable(0x%lx) GC(0x%lx) ID(0x%lx) src(%d,%d) drw(%d,%d)",
+                stuff->port,
+                stuff->drawable,
+                stuff->gc,
+                stuff->id,
+                stuff->src_x,
+                stuff->src_y,
+                stuff->drw_x,
+                stuff->drw_y);
+
+            return reply;
+        }
+
+    default:
+            break;
+    }
+
+    return reply;
+}
+
+static char *
+_EvlogEventXv (xEvent *evt, int first_base, char *reply, int *len)
+{
+    xEvent *stuff = evt;
+
+    switch ((stuff->u.u.type & 0x7F) - first_base)
+    {
+    case XvVideoNotify:
+        {
+            XvVideoNotifyEvent *stuff = (XvVideoNotifyEvent *) evt;
+            REPLY (": XID(0x%lx) reason(%ld) portID(0x%lx)",
+                stuff->drawable,
+                stuff->reason,
+                stuff->port_id);
+
+            return reply;
+        }
+
+    case XvPortNotify:
+        {
+            XvPortNotifyEvent *stuff = (XvPortNotifyEvent *) evt;
+            REPLY (": XID(0x%lx) Attribute(%lx) Value(%ld)",
+                stuff->port_id,
+                stuff->attribute,
+                stuff->value);
+
+            return reply;
+        }
+
+    default:
+            break;
+    }
+
+    return reply;
+}
+
+void
+xDbgEvlogXvGetBase (void *dpy, 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))
+    {
+        fprintf (stderr, "[UTILX] no Xv extension. \n");
+        return;
+    }
+    extinfo->req_func = _EvlogRequestXv;
+    extinfo->evt_func = _EvlogEventXv;
+#else
+    ExtensionEntry *xext = CheckExtension (XvName);
+    RETURN_IF_FAIL (xext != NULL);
+
+    extinfo->opcode = xext->base;
+    extinfo->evt_base = xext->eventBase;
+    extinfo->err_base = xext->errorBase;
+    extinfo->req_func = _EvlogRequestXv;
+    extinfo->evt_func = _EvlogEventXv;
+
+#endif
+}
diff --git a/common/xdbg_evlog_xv.h b/common/xdbg_evlog_xv.h
new file mode 100644 (file)
index 0000000..5ea8ee3
--- /dev/null
@@ -0,0 +1,39 @@
+/**************************************************************************
+
+xdbg
+
+Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
+
+Contact: Boram Park <boram1288.park@samsung.com>
+         Sangjin LEE <lsj119@samsung.com>
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+#ifndef __XDBG_EVLOG_XV_H__
+#define __XDBG_EVLOG_XV_H__
+
+#include "xdbg_types.h"
+
+void   xDbgEvlogXvGetBase (void *dpy, ExtensionInfo *extinfo);
+
+#endif
index c8fe9c0..784b7ef 100644 (file)
@@ -113,4 +113,17 @@ typedef struct _EvlogInfo
     CARD32       time;
 } EvlogInfo;
 
+
+typedef struct _ExtensionInfo ExtensionInfo;
+
+struct _ExtensionInfo
+{
+    void  (*get_base_func) (void *dpy, ExtensionInfo *extinfo);
+    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);
+};
+
 #endif
index 086585a..aee7bea 100644 (file)
@@ -49,7 +49,8 @@ AC_ARG_WITH(xorg-module-dir,
                            [moduledir="$libdir/xorg/modules"])
 
 # Checks for pkg-config packages
-PKG_CHECK_MODULES(XDBG, xorg-server x11 xdamage xext dbus-1 bigreqsproto compositeproto damageproto dmxproto dri2proto fixesproto fontsproto gestureproto inputproto kbproto randrproto recordproto renderproto resourceproto scrnsaverproto videoproto xcmiscproto xextproto xf86bigfontproto xf86dgaproto xf86driproto xf86vidmodeproto xineramaproto xproto libdrm)
+PKG_CHECK_MODULES(XDBG, xorg-server x11 xdamage xext dbus-1 bigreqsproto compositeproto damageproto dmxproto dri2proto fixesproto fontsproto gestureproto inputproto kbproto randrproto recordproto renderproto resourceproto scrnsaverproto videoproto xcmiscproto xextproto xf86bigfontproto xf86dgaproto xf86driproto xf86vidmodeproto xineramaproto xproto libdrm xcomposite libdri2 xgesture xtst xrandr xi xv)
+
 AC_SUBST([XDBG_CFLAGS])
 AC_SUBST([XDBG_LIBS])
 
index c1c96a2..ba9aba0 100644 (file)
@@ -80,85 +80,74 @@ static void evtRecord (int fd, EvlogInfo *evinfo)
     int write_len = 0;
 
     XDBG_RETURN_IF_FAIL (fd >= 0)
+    XDBG_RETURN_IF_FAIL (evinfo != NULL);
 
-    if (evinfo)
-    {
-        evinfo->mask = 0;
-
-        write_len = sizeof (int) +
-                    sizeof (EvlogType) +
-                    sizeof (int) +
-                    sizeof (CARD32);
+    write_len = sizeof (int) +
+                sizeof (EvlogType) +
+                sizeof (int) +
+                sizeof (CARD32);
 
-        evinfo->mask |= EVLOG_MASK_CLIENT;
+    if (evinfo->mask & EVLOG_MASK_CLIENT)
         write_len += sizeof (EvlogClient);
 
-        if (evinfo->type == REQUEST)
-        {
-            evinfo->mask |= EVLOG_MASK_REQUEST;
-            write_len += sizeof (EvlogRequest) + sizeof (xReq);
-        }
-        else if (evinfo->type == EVENT)
-        {
-            evinfo->mask |= EVLOG_MASK_EVENT;
-            write_len += sizeof (EvlogEvent) + sizeof (xEvent);
-        }
-    }
+    if (evinfo->mask & EVLOG_MASK_REQUEST)
+        write_len += (sizeof (EvlogRequest) + (evinfo->req.length * 4));
+
+    if (evinfo->mask & EVLOG_MASK_EVENT)
+        write_len += (sizeof (EvlogEvent) + sizeof (xEvent));
 
-    if (write (xev_trace_record_fd, &write_len, sizeof(int)) == -1)
+    if (write (fd, &write_len, sizeof(int)) == -1)
     {
         XDBG_ERROR (MXDBG, "failed: write write_len\n");
         return;
     }
-
-    if (evinfo)
+    if (write (fd, &evinfo->time, sizeof(CARD32)) == -1)
     {
-        if (write (xev_trace_record_fd, &evinfo->time, sizeof(CARD32)) == -1)
+        XDBG_ERROR (MXDBG, "failed: write msec\n");
+        return;
+    }
+    if (write (fd, &evinfo->type, sizeof(EvlogType)) == -1)
+    {
+        XDBG_ERROR (MXDBG, "failed: write type\n");
+        return;
+    }
+    if (write (fd, &evinfo->mask, sizeof(int)) == -1)
+    {
+        XDBG_ERROR (MXDBG, "failed: write mask\n");
+        return;
+    }
+
+    if (evinfo->mask & EVLOG_MASK_CLIENT)
+        if (write (fd, &evinfo->client, sizeof (EvlogClient)) == -1)
         {
-            XDBG_ERROR (MXDBG, "failed: write msec\n");
+            XDBG_ERROR (MXDBG, "failed: write client\n");
             return;
         }
-        if (write (xev_trace_record_fd, &evinfo->type, sizeof(EvlogType)) == -1)
+
+    if (evinfo->mask & EVLOG_MASK_REQUEST)
+    {
+        if (write (fd, &evinfo->req, sizeof (EvlogRequest)) == -1)
         {
-            XDBG_ERROR (MXDBG, "failed: write type\n");
+            XDBG_ERROR (MXDBG, "failed: write request\n");
             return;
         }
-        if (write (xev_trace_record_fd, &evinfo->mask, sizeof(int)) == -1)
+        if (write (fd, evinfo->req.ptr, (evinfo->req.length * 4)) == -1)
         {
-            XDBG_ERROR (MXDBG, "failed: write mask\n");
+            XDBG_ERROR (MXDBG, "failed: write request\n");
             return;
         }
-        if (write (xev_trace_record_fd, &evinfo->client, sizeof (EvlogClient)) == -1)
+    }
+    if (evinfo->mask & EVLOG_MASK_EVENT)
+    {
+        if (write (fd, &evinfo->evt, sizeof (EvlogEvent)) == -1)
         {
-            XDBG_ERROR (MXDBG, "failed: write client\n");
+            XDBG_ERROR (MXDBG, "failed: write event\n");
             return;
         }
-
-        if (evinfo->type == REQUEST)
-        {
-            if (write (xev_trace_record_fd, &evinfo->req, sizeof (EvlogRequest)) == -1)
-            {
-                XDBG_ERROR (MXDBG, "failed: write request\n");
-                return;
-            }
-            if (write (xev_trace_record_fd, evinfo->req.ptr, sizeof (xReq)) == -1)
-            {
-                XDBG_ERROR (MXDBG, "failed: write request\n");
-                return;
-            }
-        }
-        else if (evinfo->type == EVENT)
+        if (write (fd, evinfo->evt.ptr, sizeof (xEvent)) == -1)
         {
-            if (write (xev_trace_record_fd, &evinfo->evt, sizeof (EvlogEvent)) == -1)
-            {
-                XDBG_ERROR (MXDBG, "failed: write event\n");
-                return;
-            }
-            if (write (xev_trace_record_fd, evinfo->evt.ptr, sizeof (xEvent)) == -1)
-            {
-                XDBG_ERROR (MXDBG, "failed: write event\n");
-                return;
-            }
+            XDBG_ERROR (MXDBG, "failed: write event\n");
+            return;
         }
     }
 }
@@ -465,9 +454,7 @@ xDbgModuleEvlogInstallHooks (XDbgModule *pMod)
 {
     int ret = TRUE;
 
-    ret &= AddCallback (&EventCallback, _traceEvent, NULL);
     ret &= AddCallback (&FlushCallback, _traceFlush, NULL);
-    ret &= AddCallback (&ReplyCallback, _traceAReply, NULL);
     ret &= XaceRegisterCallback (XACE_PROPERTY_ACCESS, _traceProperty, NULL);
     ret &= XaceRegisterCallback (XACE_RESOURCE_ACCESS, _traceResource, NULL);
 
@@ -494,9 +481,7 @@ xDbgModuleEvlogInstallHooks (XDbgModule *pMod)
 void
 xDbgModuleEvlogUninstallHooks (XDbgModule *pMod)
 {
-    DeleteCallback (&EventCallback, _traceEvent, NULL);
     DeleteCallback (&FlushCallback, _traceFlush, NULL);
-    DeleteCallback (&ReplyCallback, _traceAReply, NULL);
     XaceDeleteCallback (XACE_PROPERTY_ACCESS, _traceProperty, NULL);
     XaceDeleteCallback (XACE_RESOURCE_ACCESS, _traceResource, NULL);
 }
@@ -544,7 +529,8 @@ xDbgModuleEvlogPrintEvents (XDbgModule *pMod, Bool on, const char * client_name,
             }
         }
 
-
+        ret &= AddCallback (&EventCallback, _traceEvent, NULL);
+        ret &= AddCallback (&ReplyCallback, _traceAReply, NULL);
         ret &= XaceRegisterCallback (XACE_CORE_DISPATCH, _traceACoreEvents, NULL);
         ret &= XaceRegisterCallback (XACE_EXT_DISPATCH, _traceAExtEvents, NULL);
 
@@ -556,6 +542,8 @@ xDbgModuleEvlogPrintEvents (XDbgModule *pMod, Bool on, const char * client_name,
     }
     else
     {
+        DeleteCallback (&EventCallback, _traceEvent, NULL);
+        DeleteCallback (&ReplyCallback, _traceAReply, NULL);
         XaceDeleteCallback (XACE_CORE_DISPATCH, _traceACoreEvents, NULL);
         XaceDeleteCallback (XACE_EXT_DISPATCH, _traceAExtEvents, NULL);
     }
index b0a72f2..7497364 100644 (file)
@@ -12,15 +12,19 @@ BuildRequires:  pkgconfig(xdamage)
 BuildRequires:  pkgconfig(xorg-macros)
 BuildRequires:  pkgconfig(dbus-1)
 BuildRequires:  pkgconfig(bigreqsproto)
+BuildRequires:  pkgconfig(xcomposite)
 BuildRequires:  pkgconfig(compositeproto)
 BuildRequires:  pkgconfig(damageproto)
 BuildRequires:  pkgconfig(dmxproto)
+BuildRequires:  pkgconfig(libdri2)
 BuildRequires:  pkgconfig(dri2proto)
 BuildRequires:  pkgconfig(fixesproto)
 BuildRequires:  pkgconfig(fontsproto)
+BuildRequires:  pkgconfig(xgesture)
 BuildRequires:  pkgconfig(gestureproto)
 BuildRequires:  pkgconfig(inputproto)
 BuildRequires:  pkgconfig(kbproto)
+BuildRequires:  pkgconfig(xrandr)
 BuildRequires:  pkgconfig(randrproto)
 BuildRequires:  pkgconfig(recordproto)
 BuildRequires:  pkgconfig(renderproto)
@@ -36,7 +40,9 @@ BuildRequires:  pkgconfig(xf86vidmodeproto)
 BuildRequires:  pkgconfig(xineramaproto)
 BuildRequires:  pkgconfig(xproto)
 BuildRequires:  pkgconfig(libdrm)
-
+BuildRequires:  pkgconfig(xtst)
+BuildRequires:  pkgconfig(xi)
+BuildRequires:  pkgconfig(xv)
 
 %description
 This package provides the runtime debug library and module for debug of inside X server.