Add atspi accessibility support 96/159696/8
authorPaweł Stawicki <p.stawicki@partner.samsung.com>
Fri, 10 Nov 2017 17:15:57 +0000 (18:15 +0100)
committerJihoon Kim <jihoon48.kim@samsung.com>
Wed, 29 Nov 2017 01:56:58 +0000 (01:56 +0000)
Change-Id: If2b22c05fdbd4a9cdbc4fb52eb6aebfae9a66eb0

scl/gwes/efl/sclevents-efl.cpp
scl/gwes/efl/sclgraphics-efl.cpp
scl/gwes/efl/sclgraphics-efl.h
scl/include/sclgraphics.h
scl/include/scluibuilder.h
scl/scluibuilder.cpp

index 42e859c..cf1fd9c 100644 (file)
@@ -1174,8 +1174,8 @@ CSCLEventsImplEfl::generate_mouse_event(SCLMouseEvent type, scl16 x, scl16 y)
                         //window_context = windows->get_window_context(windows->get_base_window(), FALSE);
                         window_context = windows->get_window_context(windows->get_base_window());
                         if (window_context) {
-                            evt.root.x = x + window_context->geometry.x;
-                            evt.root.y = y + window_context->geometry.y;
+                            evt.x = evt.root.x = x + window_context->geometry.x;
+                            evt.y = evt.root.y = y + window_context->geometry.y;
                             evt.multi.device = loop;
                             mouse_press(NULL, 0, &evt);
                         }
@@ -1202,8 +1202,8 @@ CSCLEventsImplEfl::generate_mouse_event(SCLMouseEvent type, scl16 x, scl16 y)
                         //window_context = windows->get_window_context(windows->get_base_window(), FALSE);
                         window_context = windows->get_window_context(windows->get_base_window());
                         if (window_context) {
-                            evt.root.x = x + window_context->geometry.x;
-                            evt.root.y = y + window_context->geometry.y;
+                            evt.x = evt.root.x = x + window_context->geometry.x;
+                            evt.y = evt.root.y = y + window_context->geometry.y;
                             evt.multi.device = loop;
                             mouse_release(NULL, 0, &evt);
                         }
@@ -1229,8 +1229,8 @@ CSCLEventsImplEfl::generate_mouse_event(SCLMouseEvent type, scl16 x, scl16 y)
                         //window_context = windows->get_window_context(windows->get_base_window(), FALSE);
                         window_context = windows->get_window_context(windows->get_base_window());
                         if (window_context) {
-                            evt.root.x = x + window_context->geometry.x;
-                            evt.root.y = y + window_context->geometry.y;
+                            evt.x = evt.root.x = x + window_context->geometry.x;
+                            evt.y = evt.root.y = y + window_context->geometry.y;
                             evt.multi.device = loop;
                             mouse_move(NULL, 0, &evt);
                         }
index ef43971..6491242 100644 (file)
@@ -29,6 +29,7 @@
 #include <Elementary.h>
 //#include <list>
 #include <vector>
+#include <dlog.h>
 
 //#define EXTRACT_PARTIMAGE
 
@@ -192,8 +193,83 @@ SclNinePatchInfo get_nine_patch_info_from_png_file(Evas_Object *image_data, scli
     return ret;
 }
 
+/**
+ * Returns Evas_Object representing window
+ */
+static Evas_Object *get_evas_window_object(sclwindow window)
+{
+    SclWindowContext *window_context = NULL;
+    CSCLWindows *windows = CSCLWindows::get_instance();
+
+    if (!window || !windows)
+        return NULL;
+
+    Evas_Object *window_object = (Evas_Object*)window;
+
+    window_context = windows->get_window_context(window);
+
+    if (window_context && window_context->is_virtual) {
+        window_object = static_cast<Evas_Object*>(windows->get_base_window());
+    }
+
+    return window_object;
+}
+
+/**
+ * Callback called on accessibility action
+ */
+static Eina_Bool access_action(void *data, Evas_Object *obj, Elm_Access_Action_Info *action_info) {
+    CSCLWindows *windows = CSCLWindows::get_instance();
+    CSCLEvents* events = CSCLEvents::get_instance();
+
+    if (!windows || !events || !obj)
+        return EINA_FALSE;
+
+    Evas_Coord ex, ey, ew, eh;
+    evas_object_geometry_get(obj, &ex, &ey, &ew, &eh);
+    scl16 x = ex + ew / 2;
+    scl16 y = ey + eh / 2;
+
+    LOGD("access_action callback x: %d, y: %d", x, y);
+
+    SclWindowContext *window_context = windows->get_window_context(windows->get_base_window());;
+    if (window_context) {
+        x -= window_context->geometry.x;
+        y -= window_context->geometry.y;
+    }
+
+    //simulate button press
+    events->generate_mouse_event(SCL_MOUSE_EVENT_PRESS, x, y);
+    events->generate_mouse_event(SCL_MOUSE_EVENT_RELEASE, x, y);
+    return EINA_TRUE;
+}
+
+/**
+ * Register drawing as atspi object
+ */
+void CSCLGraphicsImplEfl::register_atspi_object(sclwindow window, scldrawing drawing, const sclchar* name)
+{
+    SCL_DEBUG();
+
+    Evas_Object *window_object = get_evas_window_object(window);
+    Evas_Object *drawing_object = static_cast<Evas_Object*>(drawing);
+
+    if (!drawing_object || !window_object)
+        return;
+
+    Evas_Object * access_object = elm_access_object_register(drawing_object, window_object);
+    if (!access_object)
+        return;
+
+    if (name)
+        elm_atspi_accessible_name_set(access_object, name);
+
+    elm_atspi_accessible_role_set(access_object, ELM_ATSPI_ROLE_PUSH_BUTTON);
+    elm_access_action_cb_set(access_object, ELM_ACCESS_ACTION_ACTIVATE, access_action, name);
+}
+
 extern sclint magnifierx, magnifiery;
-void
+scldrawing
 CSCLGraphicsImplEfl::draw_image(sclwindow window, const scldrawctx draw_ctx, sclchar* image_path, SclImageCachedInfo *cachedinfo,
                                 sclint dest_x, sclint dest_y, sclint dest_width, sclint dest_height,
                                 sclint src_x, sclint src_y, sclint src_width, sclint src_height, sclboolean extrace_image)
@@ -439,6 +515,7 @@ CSCLGraphicsImplEfl::draw_image(sclwindow window, const scldrawctx draw_ctx, scl
                         } else {
                             evas_object_layer_set(image_object, window_layer + 1);
                         }
+                        return image_object;
                     } else {
                         delete object;
                         object = NULL;
@@ -486,6 +563,7 @@ CSCLGraphicsImplEfl::draw_image(sclwindow window, const scldrawctx draw_ctx, scl
 #endif
         }
     }
+    return NULL;
 }
 
 sclimage
@@ -540,7 +618,7 @@ CSCLGraphicsImplEfl::destroy_font(sclfont font)
 /**
  * Draws the given text on cairo-surface
  */
-void
+scldrawing
 CSCLGraphicsImplEfl::draw_text(sclwindow window, const scldrawctx draw_ctx, const SclFontInfo& font_info, const SclColor& color,
                                const sclchar *str, SclTextCachedInfo *cachedinfo, sclint pos_x, sclint pos_y, sclint width, sclint height,
                                SCLLabelAlignment align, sclint padding_x, sclint padding_y,
@@ -798,6 +876,7 @@ CSCLGraphicsImplEfl::draw_text(sclwindow window, const scldrawctx draw_ctx, cons
                         window_layer = 29010;
                     }
                     evas_object_layer_set(text_object, window_layer + 1);
+                    return text_object;
                 } else {
                     delete object;
                     object = NULL;
@@ -842,12 +921,13 @@ CSCLGraphicsImplEfl::draw_text(sclwindow window, const scldrawctx draw_ctx, cons
 #endif
         }
     }
+    return NULL;
 }
 
 /**
  * Draws a rectangle on cairo-surface
  */
-void
+scldrawing
 CSCLGraphicsImplEfl::draw_rectangle(sclwindow window, const scldrawctx draw_ctx, scldouble pos_x, scldouble pos_y,
                                     scldouble width, scldouble height, const scldouble line_width, const SclColor& line_color, sclboolean fill, const SclColor& fill_color, scldouble radius, sclfloat alpha)
 {
@@ -907,8 +987,10 @@ CSCLGraphicsImplEfl::draw_rectangle(sclwindow window, const scldrawctx draw_ctx,
             } else {
                 evas_object_layer_set(rectobj, window_layer + 1);
             }
+            return rectobj;
         }
     }
+    return NULL;
 }
 
 SclSize
index 264f4a4..8725a08 100644 (file)
@@ -87,7 +87,7 @@ public :
     void init();
     void fini();
 
-    void draw_image(sclwindow window, const scldrawctx draw_ctx, sclchar* image_path, SclImageCachedInfo *cachedinfo,
+    scldrawing draw_image(sclwindow window, const scldrawctx draw_ctx, sclchar* image_path, SclImageCachedInfo *cachedinfo,
                     sclint dest_x, sclint dest_y, sclint dest_width, sclint dest_height,
                     sclint src_x, sclint src_y, sclint src_width, sclint src_height, sclboolean extrace_image);
     sclimage load_image(const sclchar* image_path);
@@ -95,17 +95,20 @@ public :
 
     sclfont create_font(const SclFontInfo& info);
     void destroy_font(sclfont font);
-    void draw_text(sclwindow window, const scldrawctx draw_ctx, const SclFontInfo& font_info, const SclColor& color,
+    scldrawing draw_text(sclwindow window, const scldrawctx draw_ctx, const SclFontInfo& font_info, const SclColor& color,
                    const sclchar *str, SclTextCachedInfo *cachedinfo, sclint pos_x, sclint pos_y, sclint width, sclint height,
                    SCLLabelAlignment align, sclint padding_x, sclint padding_y, sclint inner_width, sclint inner_height);
 
-    void draw_rectangle(sclwindow window, const scldrawctx draw_ctx, scldouble pos_x, scldouble pos_y,
+    scldrawing draw_rectangle(sclwindow window, const scldrawctx draw_ctx, scldouble pos_x, scldouble pos_y,
                         scldouble width, scldouble height, const scldouble line_width, const SclColor& line_color,
                         sclboolean fill, const SclColor& fill_color, scldouble radius, sclfloat alpha);
     scldrawctx begin_paint(const sclwindow window, const sclboolean force_draw = FALSE);
     void end_paint(const sclwindow window, scldrawctx draw_ctx);
     SclSize get_image_size(sclchar* image_path);
     SclSize get_text_size(const SclFontInfo &fontinfo, const sclchar *str);
+
+    void register_atspi_object(sclwindow window, scldrawing drawing, const sclchar* name);
+
 private:
     Evas_Object *m_highlight_ui_object;
 };
index b08bef6..1099dc7 100644 (file)
@@ -52,6 +52,7 @@ typedef struct _SclTextCachedInfo {
     SclSize actual_size;
 }SclTextCachedInfo;
 
+typedef void * scldrawing;
 const SclColor SCLCOLOR_WHITE = {255, 255, 255, 255};
 const SclColor SCLCOLOR_GREY = {128, 128, 128, 255};
 const SclColor SCLCOLOR_BLACK = {0, 0, 0, 255};
@@ -75,12 +76,12 @@ public:
 
     friend class CSCLGraphics;
 private:
-    virtual void draw_image(sclwindow window, const scldrawctx draw_ctx, sclchar* image_path,
+    virtual scldrawing draw_image(sclwindow window, const scldrawctx draw_ctx, sclchar* image_path,
                             SclImageCachedInfo *cachedinfo,
                             sclint dest_x, sclint dest_y, sclint dest_width, sclint dest_height,
                             sclint src_x, sclint src_y, sclint src_width, sclint src_height,
                             sclboolean extrace_image) = 0;
-    virtual void draw_text(sclwindow window, const scldrawctx draw_ctx, const SclFontInfo& font_info, const SclColor& color,
+    virtual scldrawing draw_text(sclwindow window, const scldrawctx draw_ctx, const SclFontInfo& font_info, const SclColor& color,
                            const sclchar *str, SclTextCachedInfo *cachedinfo, sclint pos_x, sclint pos_y,
                            sclint width, sclint height, SCLLabelAlignment align,
                            sclint padding_x, sclint padding_y, sclint inner_width, sclint inner_height) = 0;
@@ -90,11 +91,12 @@ private:
     virtual void unload_image(sclimage image_data) = 0;
     virtual sclfont create_font(const SclFontInfo& info) = 0;
     virtual void destroy_font(sclfont font) = 0;
-    virtual void draw_rectangle(sclwindow window, const scldrawctx draw_ctx, scldouble pos_x, scldouble pos_y,
+    virtual scldrawing draw_rectangle(sclwindow window, const scldrawctx draw_ctx, scldouble pos_x, scldouble pos_y,
                                 scldouble width, scldouble height, const scldouble line_width, const SclColor& line_color,
                                 sclboolean fill, const SclColor& fill_color, scldouble radius, sclfloat alpha) = 0;
     virtual SclSize get_image_size(sclchar* image_path) = 0;
     virtual SclSize get_text_size(const SclFontInfo &fontinfo, const sclchar *str) = 0;
+    virtual void register_atspi_object(sclwindow window, scldrawing drawing, const sclchar* name) = 0;
 };
 
 class CSCLGraphics
@@ -112,16 +114,16 @@ public :
     void init();
     void fini();
 
-    void draw_image(sclwindow window, const scldrawctx draw_ctx, sclchar* image_path, SclImageCachedInfo *cachedinfo, sclint dest_x, sclint dest_y,
+    scldrawing draw_image(sclwindow window, const scldrawctx draw_ctx, sclchar* image_path, SclImageCachedInfo *cachedinfo, sclint dest_x, sclint dest_y,
                     sclint dest_width = -1, sclint dest_height = -1, sclint src_x = 0, sclint src_y = 0, sclint src_width = -1, sclint src_height = -1, sclboolean extrace_image = FALSE) {
-        get_scl_graphics_impl()->draw_image(window, draw_ctx, image_path, cachedinfo, dest_x, dest_y, dest_width, dest_height, src_x, src_y, src_width, src_height, extrace_image);
+        return get_scl_graphics_impl()->draw_image(window, draw_ctx, image_path, cachedinfo, dest_x, dest_y, dest_width, dest_height, src_x, src_y, src_width, src_height, extrace_image);
     }
 
-    void draw_text(sclwindow window, const scldrawctx draw_ctx, const SclFontInfo& font_info, const SclColor& color,
+    scldrawing draw_text(sclwindow window, const scldrawctx draw_ctx, const SclFontInfo& font_info, const SclColor& color,
                    const sclchar *str, SclTextCachedInfo *cachedinfo, sclint pos_x, sclint pos_y, sclint width = 0, sclint height = 0,
                    SCLLabelAlignment align = LABEL_ALIGN_LEFT_TOP,
                    sclint padding_x = 0, sclint padding_y = 0, sclint inner_width = 0, sclint inner_height = 0) {
-        get_scl_graphics_impl()->draw_text(window, draw_ctx, font_info, color, str, cachedinfo,
+        return get_scl_graphics_impl()->draw_text(window, draw_ctx, font_info, color, str, cachedinfo,
             pos_x, pos_y, width, height, align, padding_x, padding_y, inner_width, inner_height);
     }
 
@@ -133,10 +135,10 @@ public :
         return get_scl_graphics_impl()->end_paint(window, draw_ctx);
     }
 
-    void draw_rectangle(sclwindow window, const scldrawctx draw_ctx, scldouble pos_x, scldouble pos_y,
+    scldrawing draw_rectangle(sclwindow window, const scldrawctx draw_ctx, scldouble pos_x, scldouble pos_y,
                         scldouble width, scldouble height, const scldouble line_width, const SclColor& line_color,
                         sclboolean fill, const SclColor& fill_color, scldouble radius = 0, sclfloat alpha = 1.0) {
-        get_scl_graphics_impl()->draw_rectangle(window, draw_ctx, pos_x, pos_y, width, height, line_width, line_color, fill, fill_color, radius, alpha);
+        return get_scl_graphics_impl()->draw_rectangle(window, draw_ctx, pos_x, pos_y, width, height, line_width, line_color, fill, fill_color, radius, alpha);
     }
 
     SclSize get_image_size(sclchar* image_path) {
@@ -146,6 +148,11 @@ public :
     SclSize get_text_size(const SclFontInfo & fontinfo, const sclchar *str) {
         return get_scl_graphics_impl()->get_text_size(fontinfo, str);
     }
+
+    void register_atspi_object(sclwindow window, scldrawing drawing, const sclchar* name) {
+        return get_scl_graphics_impl()->register_atspi_object(window, drawing, name);
+    }
+
 private:
     sclimage load_image(const sclchar *image_path) {
         return get_scl_graphics_impl()->load_image(image_path);
index d0a2bcc..4af8942 100644 (file)
@@ -53,18 +53,20 @@ public:
 
 private:
     sclboolean draw_button_all(const sclwindow window, const scldrawctx draw_ctx, const scl16 x, const scl16 y, const scl16 width, const scl16 height);
-    sclboolean draw_button_bg_by_sw(const sclwindow window, const scldrawctx draw_ctx, const scl16 key_index, const SCLButtonState state);
+    scldrawing draw_button_bg_by_sw(const sclwindow window, const scldrawctx draw_ctx, const scl16 key_index, const SCLButtonState state);
     sclboolean draw_window_bg_by_sw(const sclwindow window, const scldrawctx draw_ctx, const SclSize size,
         const scldouble line_width, const SclColor line_color, const SclColor fill_color);
-    sclboolean draw_button_bg_by_img(const sclwindow window, const scldrawctx draw_ctx, const scl16 key_index,
+    scldrawing draw_button_bg_by_img(const sclwindow window, const scldrawctx draw_ctx, const scl16 key_index,
         SCLButtonState state, SCLShiftState shift);
-    sclboolean draw_button_bg_by_layoutimg(const sclwindow window, const scldrawctx draw_ctx, const scl16 key_index,
+    scldrawing draw_button_bg_by_layoutimg(const sclwindow window, const scldrawctx draw_ctx, const scl16 key_index,
         const SCLButtonState state, const sclboolean shift);
     sclboolean draw_button_label(const sclwindow window, const scldrawctx draw_ctx, const scl16 key_index,
                                  SCLButtonState state, SCLShiftState shift);
 
     sclboolean draw_magnifier_label(const sclwindow window, const scldrawctx draw_ctx, const scl16 label_index, const sclchar* label);
 
+    const sclchar* get_button_text_to_read(const sclwindow window, const scl16 key_index, SCLShiftState shift_index);
+
 protected:
     /* Backend Primitive */
     CSCLGwes *m_gwes;
index daa6367..2a34bc3 100644 (file)
@@ -365,6 +365,35 @@ CSCLUIBuilder::draw_button_all(const sclwindow window, const scldrawctx draw_ctx
 }
 
 /**
+ * Returns text that should be read if accessibility support is enabled
+ */
+const sclchar*
+CSCLUIBuilder::get_button_text_to_read(const sclwindow window, const scl16 key_index, SCLShiftState shift_index)
+{
+    CSCLResourceCache *cache = CSCLResourceCache::get_instance();
+
+    if (!cache)
+        return NULL;
+
+    const SclLayoutKeyCoordinate *coordinate = cache->get_cur_layout_key_coordinate(window, key_index);
+    SclButtonContext * button_context = cache->get_cur_button_context(window, key_index);
+
+    if (coordinate && button_context && coordinate->key_type != KEY_TYPE_NONE) {
+        const sclchar *targetstr = coordinate->hint_string[shift_index][button_context->multitap_index];
+        if (targetstr == NULL) {
+            targetstr = coordinate->label[shift_index][0];
+        }
+        if (targetstr == NULL) {
+            targetstr = coordinate->key_value[shift_index][button_context->multitap_index];
+        }
+
+        return cache->find_substituted_string(targetstr);
+    }
+    return NULL;
+}
+
+
+/**
  * Draws the button of the given key index by type of the button
  * @remark draw_button_all
  */
@@ -407,27 +436,31 @@ CSCLUIBuilder::draw_button(const sclwindow window, scldrawctx draw_ctx, const sc
                 /* check it according to the following check-list */
                 /* check it whether uses SW style button */
                 if (layout && coordinate) {
+                    scldrawing background = NULL;
                     if (layout->use_sw_button) {
                         /* case 1 (uses Software button) */
-                        draw_button_bg_by_sw(window, draw_ctx, key_index, state);
+                        background = draw_button_bg_by_sw(window, draw_ctx, key_index, state);
                     } else {
                         /* check it whether uses an individual images */
                         if (coordinate->bg_image_path[shift_index][state]) {
                             if (strcmp(coordinate->bg_image_path[shift_index][state], SCL_BACKGROUND_IMAGE_STRING) != 0) {
                                 /* case 2 (uses an indivisual image) */
-                                draw_button_bg_by_img(window, draw_ctx, key_index, state, shift_index);
+                                background = draw_button_bg_by_img(window, draw_ctx, key_index, state, shift_index);
                             } else {
                                 /* case 3 (uses the layout background image) */
-                                draw_button_bg_by_layoutimg(window, draw_ctx, key_index, state, shift_index);
+                                background = draw_button_bg_by_layoutimg(window, draw_ctx, key_index, state, shift_index);
                             }
                         } else if (force_draw_bg) {
-                            draw_button_bg_by_layoutimg(window, draw_ctx, key_index, state, shift_index);
+                            background = draw_button_bg_by_layoutimg(window, draw_ctx, key_index, state, shift_index);
                         }
                         /* case 4 (don't draw anything for button's background if image_path is NULL) */
                     }
 
                     /* 2. displaying the label of the button */
                     draw_button_label(window, draw_ctx, key_index, state, shift_index);
+                    /* 3. register button as atspi object */
+                    const sclchar * text = get_button_text_to_read(window, key_index, shift_index);
+                    graphics->register_atspi_object(window, background, text);
                 }
             }
 
@@ -693,7 +726,7 @@ CSCLUIBuilder::draw_window_bg_by_sw(const sclwindow window, const scldrawctx dra
  * Draws a button using software
  * @remark draw_button
  */
-sclboolean
+scldrawing
 CSCLUIBuilder::draw_button_bg_by_sw(const sclwindow window, const scldrawctx draw_ctx, const scl16 key_index, const SCLButtonState state)
 {
     //SCL_DEBUG();
@@ -740,14 +773,14 @@ CSCLUIBuilder::draw_button_bg_by_sw(const sclwindow window, const scldrawctx dra
     //                                 line_curve,
     //                                 bg_alpha);
     ////}
-    return TRUE;
+    return NULL;
 }
 
 /**
  * Draws a button using the set image
  * @remark draw_button
  */
-sclboolean
+scldrawing
 CSCLUIBuilder::draw_button_bg_by_img(const sclwindow window, const scldrawctx draw_ctx, scl16 key_index, SCLButtonState state, SCLShiftState shift)
 {
     SCL_DEBUG();
@@ -760,16 +793,16 @@ CSCLUIBuilder::draw_button_bg_by_img(const sclwindow window, const scldrawctx dr
 
     const SclLayoutKeyCoordinate* coordinate = NULL;
 
-    if (!context || !windows || !graphics || !cache || !sclres_manager) return FALSE;
+    if (!context || !windows || !graphics || !cache || !sclres_manager) return NULL;
 
     coordinate = cache->get_cur_layout_key_coordinate(window, key_index);
 
     PSclModifierDecoration sclres_modifier_decoration = sclres_manager->get_modifier_decoration_table();
     assert(sclres_modifier_decoration != NULL);
-    scl_assert_return_false(window);
-    scl_assert_return_false(draw_ctx);
+    scl_assert_return_null(window);
+    scl_assert_return_null(draw_ctx);
 
-    scl_assert_return_false(state >= BUTTON_STATE_NORMAL && state < SCL_BUTTON_STATE_MAX);
+    scl_assert_return_null(state >= BUTTON_STATE_NORMAL && state < SCL_BUTTON_STATE_MAX);
 
     sclchar composed_path[_POSIX_PATH_MAX] = {0, };
 
@@ -842,7 +875,7 @@ CSCLUIBuilder::draw_button_bg_by_img(const sclwindow window, const scldrawctx dr
                 (sclint)coordinate->height + (sclint)coordinate->add_hit_top + (sclint)coordinate->add_hit_bottom
                 );
         } else {*/
-            graphics->draw_image(
+            return graphics->draw_image(
                 targetwin,
                 draw_ctx,
                 composed_path,
@@ -854,14 +887,14 @@ CSCLUIBuilder::draw_button_bg_by_img(const sclwindow window, const scldrawctx dr
         //}
     }
 
-    return TRUE;
+    return NULL;
 }
 
 /**
  * Draws a button using the set layout image
  * @remark draw_button
  */
-sclboolean
+scldrawing
 CSCLUIBuilder::draw_button_bg_by_layoutimg(const sclwindow window, const scldrawctx draw_ctx, const scl16 key_index, const SCLButtonState state, const sclboolean shift)
 {
     SCL_DEBUG();
@@ -871,17 +904,17 @@ CSCLUIBuilder::draw_button_bg_by_layoutimg(const sclwindow window, const scldraw
     CSCLResourceCache *cache = CSCLResourceCache::get_instance();
     SclResParserManager *sclres_manager = SclResParserManager::get_instance();
 
-    if (!context || !windows || !cache || !sclres_manager) return FALSE;
+    if (!context || !windows || !cache || !sclres_manager) return NULL;
 
     const SclLayout* layout = cache->get_cur_layout(window);
     const SclLayoutKeyCoordinate* coordinate = cache->get_cur_layout_key_coordinate(window, key_index);
     PSclModifierDecoration sclres_modifier_decoration = sclres_manager->get_modifier_decoration_table();
     assert(sclres_modifier_decoration != NULL);
 
-    scl_assert_return_false(window);
-    scl_assert_return_false(draw_ctx);
+    scl_assert_return_null(window);
+    scl_assert_return_null(draw_ctx);
 
-    scl_assert_return_false(state >= BUTTON_STATE_NORMAL && state < SCL_BUTTON_STATE_MAX);
+    scl_assert_return_null(state >= BUTTON_STATE_NORMAL && state < SCL_BUTTON_STATE_MAX);
 
     //SclWindowContext *window_context = windows->get_window_context(window, FALSE);
     SclWindowContext *window_context = windows->get_window_context(window);
@@ -952,7 +985,7 @@ CSCLUIBuilder::draw_button_bg_by_layoutimg(const sclwindow window, const scldraw
                 }
             }
 
-            m_gwes->m_graphics->draw_image(
+            return m_gwes->m_graphics->draw_image(
                 window,
                 draw_ctx,
                 composed_path,
@@ -968,7 +1001,7 @@ CSCLUIBuilder::draw_button_bg_by_layoutimg(const sclwindow window, const scldraw
                 TRUE);
         //}
     }
-    return TRUE;
+    return NULL;
 }
 
 /**