Prevent duplicated drawing of highlight UI 54/130154/2
authorJi-hoon Lee <dalton.lee@samsung.com>
Fri, 19 May 2017 08:30:48 +0000 (17:30 +0900)
committerJi-hoon Lee <dalton.lee@samsung.com>
Fri, 19 May 2017 08:34:46 +0000 (17:34 +0900)
Change-Id: I18aa39d5fea4d22b6b8d6f41f327db18dd99bd07

scl/sclwindows.cpp

index 56ddaf2..30eb555 100644 (file)
@@ -30,6 +30,7 @@
 #include "sclactionstate.h"
 #include "sclres_manager.h"
 #include "sclkeyfocushandler.h"
+#include "sclanimator.h"
 #include <dlog.h>
 
 using namespace scl;
@@ -1002,8 +1003,53 @@ CSCLWindows::update_window(const sclwindow window,
 {
     if (!m_pending_update) {
         CSCLWindowsImpl* impl = get_scl_windows_impl();
+        CSCLAnimator *animator = CSCLAnimator::get_instance();
+        CSCLResourceCache *cache = CSCLResourceCache::get_instance();
+        CSCLContext *context = CSCLContext::get_instance();
+        CSCLKeyFocusHandler* focus_handler = CSCLKeyFocusHandler::get_instance();
+
         if (impl) {
             impl->update_window(window, x, y, width, height);
+
+            /* If we are not updating the whole screen */
+            if (animator && cache && context && focus_handler && (x != 0 || y != 0 || width != 0 || height != 0)) {
+                sclboolean draw_highlight_ui = TRUE;
+                SclAnimationState *state = NULL;
+
+                if (animator) {
+                    sclint id = animator->find_animator_by_type(ANIMATION_TYPE_HIGHLIGHT_UI);
+                    state = animator->get_animation_state(id);
+                }
+                if (state) {
+                    // If currently the highlight UI is being animated, don't update here
+                    if (state->active) {
+                        draw_highlight_ui = FALSE;
+                    }
+                }
+
+                SclWindowContext *window_context = get_window_context(window);
+                if (focus_handler->get_current_focus_window() == window) {
+                    sclint startx = 0;
+                    sclint starty = 0;
+
+                    SclWindowContext *base_window_context = get_window_context(get_base_window());
+                    if (window_context && base_window_context) {
+                        if (window_context->is_virtual) {
+                            startx += (window_context->geometry.x - base_window_context->geometry.x);
+                            starty += (window_context->geometry.y - base_window_context->geometry.y);
+                        }
+                    }
+                    if (draw_highlight_ui && context->get_highlight_ui_enabled()) {
+                        const SclLayoutKeyCoordinate *coordinate = NULL;
+                        scl8 current_key_index = focus_handler->get_current_focus_key();
+                        coordinate = cache->get_cur_layout_key_coordinate(window, current_key_index);
+                        if (coordinate) {
+                            // Update the highlighted area as well
+                            impl->update_window(window, startx + coordinate->x, starty + coordinate->y, coordinate->width, coordinate->height);
+                        }
+                    }
+                }
+            }
         }
     }
 }