discomfitor pushed a commit to branch master.

http://git.enlightenment.org/core/enlightenment.git/commit/?id=738622b06800ac32ce301404203e54d5c817e5da

commit 738622b06800ac32ce301404203e54d5c817e5da
Author: Mike Blumenkrantz <zm...@osg.samsung.com>
Date:   Wed Jul 22 17:46:39 2015 -0400

    send wl kbd modifiers only when changes occur
---
 src/bin/e_comp_wl_input.c | 32 ++++++++++++++++++++++----------
 src/bin/e_comp_wl_input.h |  2 +-
 2 files changed, 23 insertions(+), 11 deletions(-)

diff --git a/src/bin/e_comp_wl_input.c b/src/bin/e_comp_wl_input.c
index f596af5..e06c1bc 100644
--- a/src/bin/e_comp_wl_input.c
+++ b/src/bin/e_comp_wl_input.c
@@ -487,21 +487,33 @@ e_comp_wl_input_keyboard_check(struct wl_resource *res)
                                   &_e_keyboard_interface);
 }
 
-EINTERN void
+EINTERN Eina_Bool
 e_comp_wl_input_keyboard_modifiers_serialize(void)
 {
-   e_comp->wl_comp_data->kbd.mod_depressed =
-     xkb_state_serialize_mods(e_comp->wl_comp_data->xkb.state,
+   Eina_Bool changed = EINA_FALSE;
+   xkb_mod_mask_t mod;
+   xkb_layout_index_t grp;
+
+   mod = xkb_state_serialize_mods(e_comp->wl_comp_data->xkb.state,
                               XKB_STATE_DEPRESSED);
-   e_comp->wl_comp_data->kbd.mod_latched =
-     xkb_state_serialize_mods(e_comp->wl_comp_data->xkb.state,
+   changed |= mod != e_comp->wl_comp_data->kbd.mod_depressed;
+   e_comp->wl_comp_data->kbd.mod_depressed = mod;
+
+   mod = xkb_state_serialize_mods(e_comp->wl_comp_data->xkb.state,
                               XKB_STATE_MODS_LATCHED);
-   e_comp->wl_comp_data->kbd.mod_locked =
-     xkb_state_serialize_mods(e_comp->wl_comp_data->xkb.state,
+   changed |= mod != e_comp->wl_comp_data->kbd.mod_latched;
+   e_comp->wl_comp_data->kbd.mod_latched = mod;
+
+   mod = xkb_state_serialize_mods(e_comp->wl_comp_data->xkb.state,
                               XKB_STATE_MODS_LOCKED);
-   e_comp->wl_comp_data->kbd.mod_group =
-     xkb_state_serialize_layout(e_comp->wl_comp_data->xkb.state,
+   changed |= mod != e_comp->wl_comp_data->kbd.mod_locked;
+   e_comp->wl_comp_data->kbd.mod_locked = mod;
+
+   grp = xkb_state_serialize_layout(e_comp->wl_comp_data->xkb.state,
                                 XKB_STATE_LAYOUT_EFFECTIVE);
+   changed |= grp != e_comp->wl_comp_data->kbd.mod_group;
+   e_comp->wl_comp_data->kbd.mod_group = grp;
+   return changed;
 }
 
 EINTERN void
@@ -511,7 +523,7 @@ e_comp_wl_input_keyboard_modifiers_update(void)
    struct wl_resource *res;
    Eina_List *l;
 
-   e_comp_wl_input_keyboard_modifiers_serialize();
+   if (!e_comp_wl_input_keyboard_modifiers_serialize()) return;
 
    if (!e_comp->wl_comp_data->kbd.focused) return;
 
diff --git a/src/bin/e_comp_wl_input.h b/src/bin/e_comp_wl_input.h
index 028510d..8db117e 100644
--- a/src/bin/e_comp_wl_input.h
+++ b/src/bin/e_comp_wl_input.h
@@ -9,7 +9,7 @@ EINTERN Eina_Bool e_comp_wl_input_pointer_check(struct 
wl_resource *res);
 EINTERN Eina_Bool e_comp_wl_input_keyboard_check(struct wl_resource *res);
 EINTERN Eina_Bool e_comp_wl_input_touch_check(struct wl_resource *res);
 
-EINTERN void e_comp_wl_input_keyboard_modifiers_serialize(void);
+EINTERN Eina_Bool e_comp_wl_input_keyboard_modifiers_serialize(void);
 EINTERN void e_comp_wl_input_keyboard_modifiers_update(void);
 EINTERN void e_comp_wl_input_keyboard_state_update(uint32_t keycode, Eina_Bool 
pressed);
 EINTERN void e_comp_wl_input_keyboard_enter_send(E_Client *client);

-- 


Reply via email to