hermet pushed a commit to branch master. http://git.enlightenment.org/tools/enventor.git/commit/?id=9cc1fb443ecff4aa1122aefe8a6d6003af4627bb
commit 9cc1fb443ecff4aa1122aefe8a6d6003af4627bb Author: Mykyta Biliavskyi <m.biliavs...@samsung.com> Date: Fri Jun 26 13:49:43 2015 +0900 Correct handling ecore key modificators. Summary: Macro EVENT_KEY_MODIFIER_CHECK_OR_RET provide possibility to check, if only one modifier pressed. Reviewers: Hermet Projects: #enventor Differential Revision: https://phab.enlightenment.org/D2759 --- src/bin/main.c | 15 ++++++--------- src/include/common.h | 6 ++++++ 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/bin/main.c b/src/bin/main.c index 9232106..621ac04 100644 --- a/src/bin/main.c +++ b/src/bin/main.c @@ -151,10 +151,8 @@ main_mouse_wheel_cb(void *data, int type EINA_UNUSED, void *ev) app_data *ad = data; Evas_Coord x, y, w, h; - if ((event->modifiers & (ECORE_EVENT_MODIFIER_SHIFT | ECORE_EVENT_MODIFIER_CTRL - | ECORE_EVENT_MODIFIER_ALT | ECORE_EVENT_MODIFIER_WIN)) - != ECORE_EVENT_MODIFIER_CTRL) - return ECORE_CALLBACK_PASS_ON; + if (!EVENT_KEY_MODIFIER_CHECK(CTRL, event->modifiers)) + return ECORE_CALLBACK_PASS_ON; //View Scale Evas_Object *view = enventor_object_live_view_get(ad->enventor); @@ -557,8 +555,8 @@ default_template_insert(app_data *ad) static Eina_Bool alt_func(Ecore_Event_Key *event) { - if (!(event->modifiers & ECORE_EVENT_MODIFIER_ALT)) - return EINA_FALSE; + if (!EVENT_KEY_MODIFIER_CHECK(ALT, event->modifiers)) + return EINA_FALSE; //Full Edit View if (!strcmp(event->key, "Left")) @@ -591,9 +589,8 @@ alt_func(Ecore_Event_Key *event) static Eina_Bool ctrl_func(app_data *ad, Ecore_Event_Key *event) { - if (!(event->modifiers & ECORE_EVENT_MODIFIER_CTRL)) - return EINA_FALSE; - + if (!EVENT_KEY_MODIFIER_CHECK(CTRL, event->modifiers)) + return EINA_FALSE; //Save if (!strcmp(event->key, "s") || !strcmp(event->key, "S")) { diff --git a/src/include/common.h b/src/include/common.h index 81bb8ea..10eddb2 100644 --- a/src/include/common.h +++ b/src/include/common.h @@ -57,6 +57,12 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n" #define ENVENTOR_CONFIG_VERSION 2 +#define EVENT_KEY_MODIFIER_CHECK(NAME, MASK) \ + ((MASK & ECORE_EVENT_MODIFIER_##NAME) && \ + !((0xFF ^ ECORE_EVENT_MODIFIER_##NAME) & (MASK & 0x0F))) + + + #define ENVENTOR_BETA_API_SUPPORT 1 #include <Enventor.h> #include <assert.h> --