events: Add a quick method to return a spewed event
For easy gcc debugging
This commit is contained in:
parent
578f593d56
commit
d393cba39e
@ -628,7 +628,7 @@ meta_spew_core_event (MetaDisplay *display,
|
|||||||
*extra_p = extra;
|
*extra_p = extra;
|
||||||
}
|
}
|
||||||
|
|
||||||
G_GNUC_UNUSED static void
|
static char *
|
||||||
meta_spew_event (MetaDisplay *display,
|
meta_spew_event (MetaDisplay *display,
|
||||||
XEvent *event)
|
XEvent *event)
|
||||||
{
|
{
|
||||||
@ -636,8 +636,40 @@ meta_spew_event (MetaDisplay *display,
|
|||||||
const char *name = NULL;
|
const char *name = NULL;
|
||||||
char *extra = NULL;
|
char *extra = NULL;
|
||||||
char *winname;
|
char *winname;
|
||||||
|
char *ret;
|
||||||
XIEvent *input_event;
|
XIEvent *input_event;
|
||||||
|
|
||||||
|
input_event = get_input_event (display, event);
|
||||||
|
|
||||||
|
if (input_event)
|
||||||
|
meta_spew_xi2_event (display, input_event, &name, &extra);
|
||||||
|
else
|
||||||
|
meta_spew_core_event (display, event, &name, &extra);
|
||||||
|
|
||||||
|
if (event->xany.window == screen->xroot)
|
||||||
|
winname = g_strdup_printf ("root %d", screen->number);
|
||||||
|
else
|
||||||
|
winname = g_strdup_printf ("0x%lx", event->xany.window);
|
||||||
|
|
||||||
|
ret = g_strdup_printf ("%s on %s%s %s %sserial %lu", name, winname,
|
||||||
|
extra ? ":" : "", extra ? extra : "",
|
||||||
|
event->xany.send_event ? "SEND " : "",
|
||||||
|
event->xany.serial);
|
||||||
|
|
||||||
|
g_free (winname);
|
||||||
|
|
||||||
|
if (extra)
|
||||||
|
g_free (extra);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
G_GNUC_UNUSED static void
|
||||||
|
meta_spew_event_print (MetaDisplay *display,
|
||||||
|
XEvent *event)
|
||||||
|
{
|
||||||
|
char *event_str;
|
||||||
|
|
||||||
/* filter overnumerous events */
|
/* filter overnumerous events */
|
||||||
if (event->type == Expose || event->type == MotionNotify ||
|
if (event->type == Expose || event->type == MotionNotify ||
|
||||||
event->type == NoExpose)
|
event->type == NoExpose)
|
||||||
@ -652,27 +684,9 @@ meta_spew_event (MetaDisplay *display,
|
|||||||
if (event->type == PropertyNotify && event->xproperty.atom == display->atom__NET_WM_USER_TIME)
|
if (event->type == PropertyNotify && event->xproperty.atom == display->atom__NET_WM_USER_TIME)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
input_event = get_input_event (display, event);
|
event_str = meta_spew_event (display, event);
|
||||||
|
g_print ("%s\n", event_str);
|
||||||
if (input_event)
|
g_free (event_str);
|
||||||
meta_spew_xi2_event (display, input_event, &name, &extra);
|
|
||||||
else
|
|
||||||
meta_spew_core_event (display, event, &name, &extra);
|
|
||||||
|
|
||||||
if (event->xany.window == screen->xroot)
|
|
||||||
winname = g_strdup_printf ("root %d", screen->number);
|
|
||||||
else
|
|
||||||
winname = g_strdup_printf ("0x%lx", event->xany.window);
|
|
||||||
|
|
||||||
g_print ("%s on %s%s %s %sserial %lu\n", name, winname,
|
|
||||||
extra ? ":" : "", extra ? extra : "",
|
|
||||||
event->xany.send_event ? "SEND " : "",
|
|
||||||
event->xany.serial);
|
|
||||||
|
|
||||||
g_free (winname);
|
|
||||||
|
|
||||||
if (extra)
|
|
||||||
g_free (extra);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
@ -1653,7 +1667,7 @@ meta_display_handle_xevent (MetaDisplay *display,
|
|||||||
XIEvent *input_event;
|
XIEvent *input_event;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
meta_spew_event (display, event);
|
meta_spew_event_print (display, event);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_STARTUP_NOTIFICATION
|
#ifdef HAVE_STARTUP_NOTIFICATION
|
||||||
|
Loading…
Reference in New Issue
Block a user