Fix the drag_state_changed callback is not called on mouse release 51/112851/1
authorJi-hoon Lee <dalton.lee@samsung.com>
Fri, 3 Feb 2017 02:22:36 +0000 (11:22 +0900)
committerJi-hoon Lee <dalton.lee@samsung.com>
Fri, 3 Feb 2017 05:29:13 +0000 (14:29 +0900)
Change-Id: I28c86e7b8d1ebd45dae2f400e3c4d107cdc85669

scl/sclcontroller.cpp

index ea9d472..9834155 100644 (file)
@@ -1761,7 +1761,34 @@ CSCLController::process_button_release_event(sclwindow window, sclint x, sclint
                 state->get_cur_action_state() != ACTION_STATE_BASE_REPEATKEY &&
                 state->get_cur_action_state() != ACTION_STATE_POPUP_LONGKEY &&
                 state->get_cur_action_state() != ACTION_STATE_POPUP_REPEATKEY) {
-            /* An event occured? */
+            if (ret) {
+                SCLShiftState shift_index = context->get_shift_state();
+                if (!scl_check_arrindex(shift_index, SCL_SHIFT_STATE_MAX)) shift_index = SCL_SHIFT_STATE_OFF;
+                if (context->get_caps_lock_mode()) {
+                    shift_index = (shift_index == SCL_SHIFT_STATE_OFF) ? SCL_SHIFT_STATE_ON : SCL_SHIFT_STATE_OFF;
+                }
+
+                SclUIEventDesc key_event_desc;
+                if (targetCoordinate) {
+                    key_event_desc.key_type = targetCoordinate->key_type;
+
+                    key_event_desc.key_value = targetCoordinate->key_value[shift_index][button_context->multitap_index];
+                    key_event_desc.key_event = targetCoordinate->key_event[shift_index][button_context->multitap_index];
+                }
+                key_event_desc.key_modifier = key_modifier;
+
+                key_event_desc.event_type = EVENT_TYPE_RELEASE;
+                key_event_desc.touch_id = touch_id;
+                key_event_desc.mouse_pressed_point = context->get_cur_pressed_point(touch_id);
+                key_event_desc.mouse_current_point = context->get_cur_moving_point(touch_id);
+                key_event_desc.mouse_farthest_point = context->get_farthest_move_point(touch_id);
+
+                key_event_desc.touch_event_order = context->get_multi_touch_event_order(touch_id);
+
+                if (handler->on_event_drag_state_changed(key_event_desc) != SCL_EVENT_PASS_ON) {
+                    fire_event = FALSE;
+                }
+            }
             if (fire_event) {
                 if (targetCoordinate) {
                     SCLShiftState shift_index = context->get_shift_state();
@@ -2597,6 +2624,36 @@ CSCLController::mouse_release(sclwindow window, sclint x, sclint y, scltouchdevi
             }
         } while (!process_finished);
 
+        if (!ret) {
+            SclButtonContext *button_context = cache->get_cur_button_context(pressed_window, pressed_key);
+            const SclLayoutKeyCoordinate *coordinate = cache->get_cur_layout_key_coordinate(pressed_window, pressed_key);
+
+            SCLShiftState shift_index = context->get_shift_state();
+            if (!scl_check_arrindex(shift_index, SCL_SHIFT_STATE_MAX)) shift_index = SCL_SHIFT_STATE_OFF;
+            if (context->get_caps_lock_mode()) {
+                shift_index = (shift_index == SCL_SHIFT_STATE_OFF) ? SCL_SHIFT_STATE_ON : SCL_SHIFT_STATE_OFF;
+            }
+
+            SclUIEventDesc key_event_desc;
+            if (coordinate && button_context) {
+                key_event_desc.key_type = coordinate->key_type;
+
+                key_event_desc.key_value = coordinate->key_value[shift_index][button_context->multitap_index];
+                key_event_desc.key_event = coordinate->key_event[shift_index][button_context->multitap_index];
+            }
+            key_event_desc.key_modifier = context->get_cur_key_modifier(touch_id);;
+
+            key_event_desc.event_type = EVENT_TYPE_RELEASE;
+            key_event_desc.touch_id = touch_id;
+            key_event_desc.mouse_pressed_point = context->get_cur_pressed_point(touch_id);
+            key_event_desc.mouse_current_point = context->get_cur_moving_point(touch_id);
+            key_event_desc.mouse_farthest_point = context->get_farthest_move_point(touch_id);
+
+            key_event_desc.touch_event_order = context->get_multi_touch_event_order(touch_id);
+
+            handler->on_event_drag_state_changed(key_event_desc);
+        }
+
         if (windows->is_base_window(window)) {
             state->set_cur_action_state(ACTION_STATE_BASE_INIT);
         } else {