From c9b1d2d59d6cc1c7f1aca7a91d7fad379fd6696b Mon Sep 17 00:00:00 2001 From: "yanjie.hu" Date: Wed, 3 Apr 2013 17:41:35 +0800 Subject: [PATCH] if caps_mode is on, ignore handle_shift_on event Change-Id: I0c13d2e1ce3bce180b53ebebb098c1da88e33f59 --- scl/scleventhandler.cpp | 52 +++++++++++++++++++++++-------------------------- 1 file changed, 24 insertions(+), 28 deletions(-) diff --git a/scl/scleventhandler.cpp b/scl/scleventhandler.cpp index 5ab65af..a74cdc4 100644 --- a/scl/scleventhandler.cpp +++ b/scl/scleventhandler.cpp @@ -89,38 +89,34 @@ static void handle_shift_button_click_event(SclUIEventDesc ui_event_desc) static void handle_shift_state_on_button_click_event(SclUIEventDesc ui_event_desc) { CSCLUIImpl *uiimpl = CSCLUIImpl::get_instance(); + if (uiimpl->get_caps_mode()) { + return; + } + CSCLContext *context = CSCLContext::get_instance(); - if (uiimpl && context) { - sclboolean turn_shift_off = TRUE; - if (uiimpl->get_caps_mode()) { - turn_shift_off = FALSE; - } else { - if (ui_event_desc.key_type == KEY_TYPE_CONTROL) { - if (ui_event_desc.key_event == MVK_Shift_L || ui_event_desc.key_event == MVK_Caps_Lock) { - turn_shift_off = FALSE; - } - if (ui_event_desc.key_type == KEY_TYPE_MODECHANGE) { - turn_shift_off = FALSE; - } - } - } - /* If we are in ON_PRESSED or ON_KEY_ENTERED mode of shift multi touch state, do not turn it off now */ - if (context->get_shift_multi_touch_enabled() && turn_shift_off) { - CSCLContext *context = CSCLContext::get_instance(); - if (context) { - if (context->get_shift_multi_touch_state() == SCL_SHIFT_MULTITOUCH_ON_PRESSED) { - context->set_shift_multi_touch_state(SCL_SHIFT_MULTITOUCH_ON_KEY_ENTERED); - turn_shift_off = FALSE; - } else if (context->get_shift_multi_touch_state() == SCL_SHIFT_MULTITOUCH_ON_KEY_ENTERED) { - turn_shift_off = FALSE; - } + sclboolean turn_shift_off = TRUE; + if (ui_event_desc.key_event == MVK_Shift_L || ui_event_desc.key_event == MVK_Caps_Lock) { + turn_shift_off = FALSE; + } + if (ui_event_desc.key_type == KEY_TYPE_MODECHANGE) { + turn_shift_off = FALSE; + } + /* If we are in ON_PRESSED or ON_KEY_ENTERED mode of shift multi touch state, do not turn it off now */ + if (context->get_shift_multi_touch_enabled() && turn_shift_off) { + CSCLContext *context = CSCLContext::get_instance(); + if (context) { + if (context->get_shift_multi_touch_state() == SCL_SHIFT_MULTITOUCH_ON_PRESSED) { + context->set_shift_multi_touch_state(SCL_SHIFT_MULTITOUCH_ON_KEY_ENTERED); + turn_shift_off = FALSE; + } else if (context->get_shift_multi_touch_state() == SCL_SHIFT_MULTITOUCH_ON_KEY_ENTERED) { + turn_shift_off = FALSE; } } - if (turn_shift_off) { - if (uiimpl->get_shift_state() == SCL_SHIFT_STATE_ON) { - uiimpl->set_shift_state(SCL_SHIFT_STATE_OFF); - } + } + if (turn_shift_off) { + if (uiimpl->get_shift_state() == SCL_SHIFT_STATE_ON) { + uiimpl->set_shift_state(SCL_SHIFT_STATE_OFF); } } } -- 2.7.4