[mutter] display: Only process keyboard mapping events for the core X keyboard



commit 4cf461fffa521205dd86d961057141db7b946103
Author: Rui Matos <tiagomatos gmail com>
Date:   Thu Apr 26 11:43:52 2012 +0200

    display: Only process keyboard mapping events for the core X keyboard
    
    The X server sends a XkbNewKeyboardNotify event for each keyboard
    device when a new keyboard description is loaded. These days a typical
    computer has several keyboard devices, e.g. xinput on this laptop
    lists 8. Since the work we do on these events is relatively expensive
    and we are only really interested in changes to the virtual core
    keyboard we can skip other devices' events to cut on needless work.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=674859

 src/core/display.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/src/core/display.c b/src/core/display.c
index ee163a1..d6ee04a 100644
--- a/src/core/display.c
+++ b/src/core/display.c
@@ -74,6 +74,9 @@
 #include <string.h>
 #include <unistd.h>
 
+/* This is set in stone and also hard-coded in GDK. */
+#define VIRTUAL_CORE_KEYBOARD_ID 3
+
 #define GRAB_OP_IS_WINDOW_SWITCH(g)                     \
         (g == META_GRAB_OP_KEYBOARD_TABBING_NORMAL  ||  \
          g == META_GRAB_OP_KEYBOARD_TABBING_DOCK    ||  \
@@ -2813,7 +2816,8 @@ event_callback (XEvent   *event,
 	      break;
             case XkbNewKeyboardNotify:
             case XkbMapNotify:
-              meta_display_process_mapping_event (display, event);
+              if (xkb_ev->device == VIRTUAL_CORE_KEYBOARD_ID)
+                meta_display_process_mapping_event (display, event);
               break;
 	    }
 	}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]