Move highlight to the button that received 'pressed' event 25/165225/2
authorJi-hoon Lee <dalton.lee@samsung.com>
Wed, 27 Dec 2017 06:42:36 +0000 (15:42 +0900)
committerJi-hoon Lee <dalton.lee@samsung.com>
Wed, 27 Dec 2017 06:46:13 +0000 (15:46 +0900)
Change-Id: I10ebca304bd2a328d8c0db42e72de34abaf2bf98

scl/include/sclkeyfocushandler.h
scl/sclcontroller.cpp
scl/sclkeyfocushandler.cpp

index 457af56..381d99d 100644 (file)
@@ -112,6 +112,8 @@ public:
     sclwindow get_current_focus_window(void);
     void process_navigation(SCLHighlightNavigationDirection direction);
 
+    void set_current_focus(sclwindow window, scl8 index);
+
 private:
     NEXT_CANDIDATE_INFO get_next_candidate_key(SCLHighlightNavigationDirection direction, SclRectangle cur, sclwindow window);
 
index 2c79244..6898a04 100644 (file)
@@ -32,6 +32,7 @@
 #include "sclres_manager.h"
 #include "scleventhandler.h"
 #include "sclanimator.h"
+#include "sclkeyfocushandler.h"
 #include <dlog.h>
 
 //#define DIRECTLY_DRAW_ON_EVENTS
@@ -493,6 +494,23 @@ CSCLController::process_button_pressed_event(sclwindow window, sclint x, sclint
 
             button_context->state = BUTTON_STATE_PRESSED;
 
+            if (context->get_highlight_ui_enabled()) {
+                CSCLKeyFocusHandler* focus_handler = CSCLKeyFocusHandler::get_instance();
+                if (focus_handler) {
+                    sclwindow prev_window = focus_handler->get_current_focus_window();
+                    scl8 prev_key = focus_handler->get_current_focus_key();
+                    const SclLayoutKeyCoordinate *prev_coordinate =
+                        cache->get_cur_layout_key_coordinate(prev_window, prev_key);
+
+                    focus_handler->set_current_focus(window, key_index);
+
+                    if (prev_coordinate) {
+                        windows->update_window(prev_window,
+                            prev_coordinate->x, prev_coordinate->y, prev_coordinate->width, prev_coordinate->height);
+                    }
+                }
+            }
+
             redraw = TRUE;
             ret = TRUE;
 
index c6e842e..2e35f88 100644 (file)
@@ -769,6 +769,13 @@ CSCLKeyFocusHandler::process_navigation(SCLHighlightNavigationDirection directio
     }
 }
 
+void
+CSCLKeyFocusHandler::set_current_focus(sclwindow window, scl8 index)
+{
+    m_focus_window = window;
+    m_focus_key = index;
+}
+
 #ifdef TARGET_EMULATOR
 
 /**