[mutter] events: Add a quick method to return a spewed event
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] events: Add a quick method to return a spewed event
- Date: Mon, 29 Dec 2014 03:59:55 +0000 (UTC)
commit d393cba39ec66dfea429b4779f1ebf406c43445c
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Sun Dec 28 19:45:59 2014 -0800
events: Add a quick method to return a spewed event
For easy gcc debugging
src/x11/events.c | 54 ++++++++++++++++++++++++++++++++++--------------------
1 files changed, 34 insertions(+), 20 deletions(-)
---
diff --git a/src/x11/events.c b/src/x11/events.c
index fb1d792..618692f 100644
--- a/src/x11/events.c
+++ b/src/x11/events.c
@@ -628,7 +628,7 @@ meta_spew_core_event (MetaDisplay *display,
*extra_p = extra;
}
-G_GNUC_UNUSED static void
+static char *
meta_spew_event (MetaDisplay *display,
XEvent *event)
{
@@ -636,22 +636,9 @@ meta_spew_event (MetaDisplay *display,
const char *name = NULL;
char *extra = NULL;
char *winname;
+ char *ret;
XIEvent *input_event;
- /* filter overnumerous events */
- if (event->type == Expose || event->type == MotionNotify ||
- event->type == NoExpose)
- return;
-
- if (event->type == (display->damage_event_base + XDamageNotify))
- return;
-
- if (event->type == (display->xsync_event_base + XSyncAlarmNotify))
- return;
-
- if (event->type == PropertyNotify && event->xproperty.atom == display->atom__NET_WM_USER_TIME)
- return;
-
input_event = get_input_event (display, event);
if (input_event)
@@ -664,15 +651,42 @@ meta_spew_event (MetaDisplay *display,
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);
+ 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 */
+ if (event->type == Expose || event->type == MotionNotify ||
+ event->type == NoExpose)
+ return;
+
+ if (event->type == (display->damage_event_base + XDamageNotify))
+ return;
+
+ if (event->type == (display->xsync_event_base + XSyncAlarmNotify))
+ return;
+
+ if (event->type == PropertyNotify && event->xproperty.atom == display->atom__NET_WM_USER_TIME)
+ return;
+
+ event_str = meta_spew_event (display, event);
+ g_print ("%s\n", event_str);
+ g_free (event_str);
}
static gboolean
@@ -1653,7 +1667,7 @@ meta_display_handle_xevent (MetaDisplay *display,
XIEvent *input_event;
#if 0
- meta_spew_event (display, event);
+ meta_spew_event_print (display, event);
#endif
#ifdef HAVE_STARTUP_NOTIFICATION
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]