From 21df8f0a2f61c9503be90157a8b0500178d2798a Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Mon, 6 Aug 2012 10:21:41 +0000 Subject: [PATCH] add an amazing hack which, when a vmware player window is opened, disables keyboard remapping until the window is closed. this is stupid, but seems to be the only way to keep it from breaking keymaps on some setups ticket #1057 SVN revision: 74919 --- src/bin/e_bindings.c | 14 +++++++++++++- src/bin/e_bindings.h | 1 + src/bin/e_border.c | 10 ++++++++-- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/src/bin/e_bindings.c b/src/bin/e_bindings.c index 12b5cde23..d05f89892 100644 --- a/src/bin/e_bindings.c +++ b/src/bin/e_bindings.c @@ -24,6 +24,7 @@ static Eina_List *edge_bindings = NULL; static Eina_List *signal_bindings = NULL; static Eina_List *wheel_bindings = NULL; static Eina_List *acpi_bindings = NULL; +static int _e_bindings_mapping_change_enabled = 1; typedef struct _E_Binding_Edge_Data E_Binding_Edge_Data; @@ -1077,12 +1078,23 @@ e_bindings_acpi_event_handle(E_Binding_Context ctxt, E_Object *obj, E_Event_Acpi return act; } +EAPI void +e_bindings_mapping_change_enable(Eina_Bool enable) +{ + if (enable) + _e_bindings_mapping_change_enabled++; + else + _e_bindings_mapping_change_enabled--; + if (_e_bindings_mapping_change_enabled < 0) + _e_bindings_mapping_change_enabled = 0; +} + /* local subsystem functions */ static Eina_Bool _e_bindings_mapping_change_event_cb(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__) { Ecore_X_Event_Mapping_Change *ev = event; - fprintf(stderr, "MAPPING CHANGE: type: %d || keycode: %d || num: %d\n", ev->type, ev->keycode, ev->num); + if (!_e_bindings_mapping_change_enabled) return ECORE_CALLBACK_RENEW; e_managers_keys_ungrab(); e_border_button_bindings_ungrab_all(); e_border_button_bindings_grab_all(); diff --git a/src/bin/e_bindings.h b/src/bin/e_bindings.h index 0ff3f0da9..5825ec2b4 100644 --- a/src/bin/e_bindings.h +++ b/src/bin/e_bindings.h @@ -149,6 +149,7 @@ EAPI void e_bindings_acpi_add(E_Binding_Context ctxt, int type, int status, cons EAPI void e_bindings_acpi_del(E_Binding_Context ctxt, int type, int status, const char *action, const char *params); EAPI E_Action *e_bindings_acpi_find(E_Binding_Context ctxt, E_Object *obj, E_Event_Acpi *ev, E_Binding_Acpi **bind_ret); EAPI E_Action *e_bindings_acpi_event_handle(E_Binding_Context ctxt, E_Object *obj, E_Event_Acpi *ev); +EAPI void e_bindings_mapping_change_enable(Eina_Bool enable); #endif #endif diff --git a/src/bin/e_border.c b/src/bin/e_border.c index 1e722cc13..41e45bd2e 100644 --- a/src/bin/e_border.c +++ b/src/bin/e_border.c @@ -4574,7 +4574,11 @@ _e_border_free(E_Border *bd) if (bd->client.icccm.name) eina_stringshare_del(bd->client.icccm.name); if (bd->client.icccm.class) - eina_stringshare_del(bd->client.icccm.class); + { + if (!strcmp(bd->client.icccm.class, "Vmplayer")) + e_bindings_mapping_change_enable(EINA_FALSE); + eina_stringshare_del(bd->client.icccm.class); + } if (bd->client.icccm.title) eina_stringshare_del(bd->client.icccm.title); if (bd->client.icccm.icon_name) @@ -6650,11 +6654,13 @@ _e_border_eval0(E_Border *bd) const char *pname, *pclass; char *nname, *nclass; - ecore_x_icccm_name_class_get(bd->client.win, &nname, &nclass); + ecore_x_icccm_name_class_get(bd->client.win, &nname, &nclass); pname = bd->client.icccm.name; pclass = bd->client.icccm.class; bd->client.icccm.name = eina_stringshare_add(nname); bd->client.icccm.class = eina_stringshare_add(nclass); + if (bd->client.icccm.class && (!strcmp(bd->client.icccm.class, "Vmplayer"))) + e_bindings_mapping_change_enable(EINA_FALSE); if (nname) free(nname); if (nclass) free(nclass);