From: InHong Han Date: Fri, 25 Jun 2021 02:10:20 +0000 (+0900) Subject: Supports magnifier window X-Git-Tag: submit/tizen/20210803.031958~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=61193bcd4b2e2317ea926a107e8b10589d8d2558;p=platform%2Fcore%2Fuifw%2Flibscl-ui-nui.git Supports magnifier window Change-Id: I4db920e0f5cd80c7d4dc543da1d5bde5ae3cfb57 --- diff --git a/capi/include/cscl-ui-graphics-backend.h b/capi/include/cscl-ui-graphics-backend.h index 5da8688..1270717 100644 --- a/capi/include/cscl-ui-graphics-backend.h +++ b/capi/include/cscl-ui-graphics-backend.h @@ -23,9 +23,9 @@ class CUIGraphicsBackendCallback : public ISCLUIGraphicsBackendCallback { public : void on_draw_text(const SclFontInfo& font_info, const SclColor& color, const char *str, int pos_x, int pos_y, int w, int h, - SCLLabelAlignment align, int padding_x, int padding_y, int inner_width, int inner_height, void* user_data); + SCLLabelAlignment align, int padding_x, int padding_y, int inner_width, int inner_height, SCLWindowType type, void* user_data); - void on_draw_image(const char *image_path, int dest_x, int dest_y, int dest_weight, int dest_height, int src_x, int src_y, int src_width, int src_height, void* user_data); + void on_draw_image(const char *image_path, int dest_x, int dest_y, int dest_weight, int dest_height, int src_x, int src_y, int src_width, int src_height, SCLWindowType type, void* user_data); void on_draw_rectangle(int pos_x, int pos_y, int width, int height, bool fill, int fill_color_r, int fill_color_g, int fill_color_b, int fill_color_a, void* user_data); }; diff --git a/capi/include/cscl-ui-nui.h b/capi/include/cscl-ui-nui.h index 6bdbdd1..dc792b1 100644 --- a/capi/include/cscl-ui-nui.h +++ b/capi/include/cscl-ui-nui.h @@ -39,18 +39,26 @@ typedef enum _LabelAlignment { MAX_LABEL_ALIGNMENT } LabelAlignment; +typedef enum _WindowType { + WINDOW_KEYPAD, + WINDOW_MAGNIFIER, + WINDOW_DIM, + WINDOW_POPUP, +}WindowType; + /* graphics backend */ typedef void (*scl_nui_draw_text_cb)(const char *font_name, short font_size, bool is_italic, bool is_bold, int r, int g, int b, int a, const char *str, int pos_x, int pos_y, int w, int h, - LabelAlignment align, int padding_x, int padding_y, int inner_width, int inner_height, void* user_data); + LabelAlignment align, int padding_x, int padding_y, int inner_width, int inner_height, WindowType type, void* user_data); -typedef void (*scl_nui_draw_image_cb)(const char *image_path, int dest_x, int dest_y, int dest_weight, int dest_height, int src_x, int src_y, int src_width, int src_height, void* user_data); +typedef void (*scl_nui_draw_image_cb)(const char *image_path, int dest_x, int dest_y, int dest_weight, int dest_height, int src_x, int src_y, int src_width, int src_height, WindowType type, void* user_data); typedef void (*scl_nui_draw_rectangle_cb)(int pos_x, int pos_y, int width, int height, bool fill, int fill_color_r, int fill_color_g, int fill_color_b, int fill_color_a, void* user_data); /* window backend */ typedef void (*scl_nui_update_window_cb)(int x, int y, int width, int height, void* user_data); typedef int (*scl_nui_key_click_event_cb)(SclUIEventDesc event_desc); typedef int (*scl_nui_drag_state_changed_cb)(SclUIEventDesc event_desc); +typedef void (*scl_nui_update_window_position_cb)(SCLWindowType type, int pos_x, int pos_y, int rot_x, int rot_y, void* user_data); int scl_nui_init(const char *entry_filepath); int scl_nui_fini(); @@ -70,6 +78,9 @@ int scl_nui_set_update_window_cb(scl_nui_update_window_cb callback, void *user_d int scl_nui_set_key_click_event_cb(scl_nui_key_click_event_cb callback); int scl_nui_set_drag_state_changed_cb(scl_nui_drag_state_changed_cb callback); +int scl_nui_set_update_window_position_cb(scl_nui_update_window_position_cb callback, void *user_data); + +int scl_nui_enable_magnifier(bool enabled); #ifdef __cplusplus } diff --git a/capi/include/cscl-ui-window-backend.h b/capi/include/cscl-ui-window-backend.h index 337e4e9..e534ec5 100644 --- a/capi/include/cscl-ui-window-backend.h +++ b/capi/include/cscl-ui-window-backend.h @@ -23,6 +23,7 @@ class CUIWindowBackendCallback : public ISCLUIWindowBackendCallback { public : void update_window(int x, int y, int width, int height, void* user_data); + void update_window_postion(SCLWindowType type, int pos_x, int pos_y, int rot_x, int rot_y); }; #endif /* __SCL_WINDOW_BACKEND_H__ */ diff --git a/capi/src/cscl-ui-nui.cpp b/capi/src/cscl-ui-nui.cpp index e13631b..1b9601e 100644 --- a/capi/src/cscl-ui-nui.cpp +++ b/capi/src/cscl-ui-nui.cpp @@ -30,7 +30,7 @@ using namespace scl; #endif #define LOG_TAG "CSCLUINUI" -#define USE_ELM_WIN 1 +#define USE_ELM_WIN 0 #ifdef USE_ELM_WIN static Evas_Object *g_win = NULL; @@ -53,8 +53,11 @@ static void *g_update_window_cb_data = NULL; static scl_nui_key_click_event_cb g_key_click_event_cb = NULL; static scl_nui_drag_state_changed_cb g_drag_state_changed_cb = NULL; +static scl_nui_update_window_position_cb g_update_window_position_cb = NULL; +static void *g_update_window_position_cb_data = NULL; + void CUIGraphicsBackendCallback::on_draw_text(const SclFontInfo& font_info, const SclColor& color, const char *str, int pos_x, int pos_y, int w, int h, - SCLLabelAlignment align, int padding_x, int padding_y, int inner_width, int inner_height, void* user_data) + SCLLabelAlignment align, int padding_x, int padding_y, int inner_width, int inner_height, SCLWindowType type, void* user_data) //const char *str, int x, int y, int w, int h, int fontsize, void* user_data) { LOGD("draw text : %p", g_draw_text_cb); @@ -81,15 +84,15 @@ void CUIGraphicsBackendCallback::on_draw_text(const SclFontInfo& font_info, cons g_draw_text_cb(font_info.font_name, font_info.font_size, font_info.is_bold, font_info.is_italic, color.r, color.g, color.b, color.a, str, pos_x, pos_y, w, h, - (LabelAlignment)align, padding_x, padding_y, inner_width, inner_height, user_data); + (LabelAlignment)align, padding_x, padding_y, inner_width, inner_height, (WindowType)type, user_data); } } -void CUIGraphicsBackendCallback::on_draw_image(const char *image_path, int dest_x, int dest_y, int dest_weight, int dest_height, int src_x, int src_y, int src_width, int src_height, void* user_data) +void CUIGraphicsBackendCallback::on_draw_image(const char *image_path, int dest_x, int dest_y, int dest_weight, int dest_height, int src_x, int src_y, int src_width, int src_height, SCLWindowType type, void* user_data) { LOGD("draw image : %p", g_draw_image_cb); if (g_draw_image_cb) { - g_draw_image_cb(image_path, dest_x, dest_y, dest_weight, dest_height, src_x, src_y, src_width, src_height, user_data); + g_draw_image_cb(image_path, dest_x, dest_y, dest_weight, dest_height, src_x, src_y, src_width, src_height, (WindowType)type, user_data); } } @@ -138,6 +141,14 @@ SCLEventReturnType CUIEventCallback::on_event_drag_state_changed(SclUIEventDesc return (SCLEventReturnType)ret; } +void CUIWindowBackendCallback::update_window_postion(SCLWindowType type, int pos_x, int pos_y, int rot_x, int rot_y) +{ + LOGD("update_window_position : %p", g_update_window_position_cb); + if (g_update_window_position_cb) { + g_update_window_position_cb(type, pos_x, pos_y, rot_x, rot_y, g_update_window_cb_data); + } +} + static CUIGraphicsBackendCallback callback; static CUIWindowBackendCallback window_callback; @@ -301,5 +312,25 @@ EXPORT_API int scl_nui_set_drag_state_changed_cb(scl_nui_drag_state_changed_cb c { g_drag_state_changed_cb = callback; + return 0; +} + +EXPORT_API int scl_nui_set_update_window_position_cb(scl_nui_update_window_position_cb callback, void *user_data) +{ + g_update_window_position_cb = callback; + g_update_window_position_cb_data = user_data; + + return 0; +} + +EXPORT_API int scl_nui_enable_magnifier(bool enabled) +{ + if (!g_ui) + return 1; + + LOGD("enabled : %d", enabled); + + g_ui->enable_magnifier(enabled); + return 0; } \ No newline at end of file diff --git a/scl/sclbackendcallback.h b/scl/sclbackendcallback.h index f8c4226..90228df 100644 --- a/scl/sclbackendcallback.h +++ b/scl/sclbackendcallback.h @@ -34,6 +34,8 @@ struct ISCLUIGraphicsBackendCallback { virtual void on_draw_rectangle(int pos_x, int pos_y, int width, int height, bool fill, int fill_color_r, int fill_color_g, int fill_color_b, int fill_color_a, void* user_data) { } virtual void update_window(int x, int w, int width, int height, void* user_data) { } + + virtual void update_window_postion(SCLWindowType type, int pos_x, int pos_y, int rot_x, int rot_y) { } }; #endif //__SCL_BACKENDCALLBACK_H__ diff --git a/scl/sclconfig.h b/scl/sclconfig.h index 2b48208..4f77ea7 100644 --- a/scl/sclconfig.h +++ b/scl/sclconfig.h @@ -473,6 +473,13 @@ typedef enum _SCLDebugMode { DEBUGMODE_AUTOTEST, }SCLDebugMode; +typedef enum _SCLWindowType { + WINDOW_KEYPAD, + WINDOW_MAGNIFIER, + WINDOW_DIM, + WINDOW_POPUP, +}SCLWindowType; + } #endif //__SCL_CONFIG_H__ diff --git a/scl/sclcontroller.cpp b/scl/sclcontroller.cpp index 6e08ae3..eb4b20e 100644 --- a/scl/sclcontroller.cpp +++ b/scl/sclcontroller.cpp @@ -738,7 +738,7 @@ CSCLController::process_button_pressed_event(sclwindow window, sclint x, sclint pos.y += magnifier_configure->padding_y * utils->get_custom_scale_rate_y(); pos.x += coordinate->magnifier_offset_x; pos.y += coordinate->magnifier_offset_y; - windows->move_window(windows->get_magnifier_window(), pos.x, pos.y); + windows->move_window(windows->get_magnifier_window(), pos.x, pos.y, WINDOW_MAGNIFIER); //windows->resize_window(windows->get_magnifier_window(), utils->get_scale_x(scl_magnifier_configure.width), utils->get_scale_y(scl_magnifier_configure.height)); /*If we use transient_for them the ISE will occur some crash. It needs to check X11 */ /*windows->set_parent(windows->get_base_window(), windows->get_magnifier_window());*/ @@ -784,7 +784,10 @@ CSCLController::process_button_pressed_event(sclwindow window, sclint x, sclint } #else if (windows) { - windows->update_window(window, coordinate->x, coordinate->y, coordinate->width, coordinate->height); + if (context && context->get_magnifier_enabled()) + windows->update_window(window, coordinate->x, coordinate->y, coordinate->width, coordinate->height, WINDOW_MAGNIFIER); + else + windows->update_window(window, coordinate->x, coordinate->y, coordinate->width, coordinate->height, WINDOW_KEYPAD); } #endif } @@ -995,7 +998,7 @@ CSCLController::process_button_long_pressed_event(sclwindow window, sclbyte key_ pos.y += magnifier_configure->padding_y * utils->get_custom_scale_rate_y(); pos.x += coordinate->magnifier_offset_x; pos.y += coordinate->magnifier_offset_y; - windows->move_window(windows->get_magnifier_window(), pos.x, pos.y); + windows->move_window(windows->get_magnifier_window(), pos.x, pos.y, WINDOW_MAGNIFIER); windows->update_window(windows->get_magnifier_window()); windows->show_window(windows->get_magnifier_window(), TRUE); } @@ -1230,7 +1233,7 @@ CSCLController::process_button_move_event(sclwindow window, sclint x, sclint y, pos.y += magnifier_configure->padding_y * utils->get_custom_scale_rate_y(); pos.y += coordinate->magnifier_offset_y; if (windows->get_nth_window_in_Z_order_list(SCL_WINDOW_Z_TOP) == windows->get_base_window()) { - windows->move_window(windows->get_magnifier_window(), pos.x, pos.y); + windows->move_window(windows->get_magnifier_window(), pos.x, pos.y, WINDOW_MAGNIFIER); windows->update_window(windows->get_magnifier_window()); } } @@ -1329,7 +1332,7 @@ CSCLController::process_button_move_event(sclwindow window, sclint x, sclint y, zoomwinpos.y += magnifier_configure->padding_y * utils->get_custom_scale_rate_y(); zoomwinpos.x += coordinate->magnifier_offset_x; zoomwinpos.y += coordinate->magnifier_offset_y; - windows->move_window(windows->get_magnifier_window(), zoomwinpos.x, zoomwinpos.y); + windows->move_window(windows->get_magnifier_window(), zoomwinpos.x, zoomwinpos.y, WINDOW_MAGNIFIER); windows->show_window(windows->get_magnifier_window(), 0); } @@ -3217,7 +3220,7 @@ CSCLController::mouse_move(sclwindow window, sclint x, sclint y, scltouchdevice zoomwinpos.x += coordinate->magnifier_offset_x; zoomwinpos.y += coordinate->magnifier_offset_y; - windows->move_window(windows->get_magnifier_window(), zoomwinpos.x, zoomwinpos.y); + windows->move_window(windows->get_magnifier_window(), zoomwinpos.x, zoomwinpos.y, WINDOW_MAGNIFIER); windows->show_window(windows->get_magnifier_window(), 0); } } diff --git a/scl/sclgraphics-nui.cpp b/scl/sclgraphics-nui.cpp index acb7ac4..cfb5062 100644 --- a/scl/sclgraphics-nui.cpp +++ b/scl/sclgraphics-nui.cpp @@ -212,10 +212,9 @@ extern sclint magnifierx, magnifiery; scldrawing CSCLGraphicsImplNui::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) + sclint src_x, sclint src_y, sclint src_width, sclint src_height, sclboolean extrace_image, SCLWindowType type) { SCL_DEBUG(); - scl_assert_return_null(image_path); LOGI("image path(%s), x(%d), y(%d), w(%d), h(%d)", image_path, dest_x, dest_y, dest_width, dest_height); @@ -223,7 +222,7 @@ CSCLGraphicsImplNui::draw_image(sclwindow window, const scldrawctx draw_ctx, scl if (m_backend_callback) { LOGI("call draw image callback"); SCL_DEBUG_ELAPSED_TIME_START(); - m_backend_callback->on_draw_image(image_path, dest_x, dest_y, dest_width, dest_height, src_x, src_y, src_width, src_height, m_backend_callback_data); + m_backend_callback->on_draw_image(image_path, dest_x, dest_y, dest_width, dest_height, src_x, src_y, src_width, src_height, type, m_backend_callback_data); SCL_DEBUG_ELAPSED_TIME_END(); } else { @@ -579,7 +578,7 @@ scldrawing CSCLGraphicsImplNui::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) + sclint inner_width, sclint inner_height, SCLWindowType type) { SCL_DEBUG(); /* @@ -593,7 +592,7 @@ CSCLGraphicsImplNui::draw_text(sclwindow window, const scldrawctx draw_ctx, cons if (m_backend_callback) { LOGI("call draw text callback"); SCL_DEBUG_ELAPSED_TIME_START(); - m_backend_callback->on_draw_text(font_info, color, str, pos_x, pos_y, width, height, align, padding_x, padding_y, inner_width, inner_height, m_backend_callback_data); //draw_text_cb_data); + m_backend_callback->on_draw_text(font_info, color, str, pos_x, pos_y, width, height, align, padding_x, padding_y, inner_width, inner_height, type, m_backend_callback_data); //draw_text_cb_data); SCL_DEBUG_ELAPSED_TIME_END(); } else { @@ -919,8 +918,8 @@ CSCLGraphicsImplNui::draw_rectangle(sclwindow window, const scldrawctx draw_ctx, { SCL_DEBUG(); - LOGI("x(%f), y(%f), w(%f), h(%f)", pos_x, pos_y, width, height); - LOGI("fill(%d), r(%d), g(%d), b(%d), a(%d)", fill, fill_color.r, fill_color.g, fill_color.b, fill_color.a); + LOGE("x(%f), y(%f), w(%f), h(%f)", pos_x, pos_y, width, height); + LOGE("fill(%d), r(%d), g(%d), b(%d), a(%d)", fill, fill_color.r, fill_color.g, fill_color.b, fill_color.a); if (m_backend_callback) { LOGI("call draw rectangle callback"); diff --git a/scl/sclgraphics-nui.h b/scl/sclgraphics-nui.h index faabf40..bf3ee81 100644 --- a/scl/sclgraphics-nui.h +++ b/scl/sclgraphics-nui.h @@ -89,7 +89,7 @@ public : 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); + sclint src_x, sclint src_y, sclint src_width, sclint src_height, sclboolean extrace_image, SCLWindowType type); sclimage load_image(const sclchar* image_path); void unload_image(sclimage image_data); @@ -97,7 +97,7 @@ public : void destroy_font(sclfont font); 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); + SCLLabelAlignment align, sclint padding_x, sclint padding_y, sclint inner_width, sclint inner_height, SCLWindowType type); 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, diff --git a/scl/sclgraphics.h b/scl/sclgraphics.h index 105dbe2..a010a5d 100644 --- a/scl/sclgraphics.h +++ b/scl/sclgraphics.h @@ -66,11 +66,11 @@ private: 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; + sclboolean extrace_image, SCLWindowType type) = 0; 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; + sclint padding_x, sclint padding_y, sclint inner_width, sclint inner_height, SCLWindowType type) = 0; virtual scldrawctx begin_paint(const sclwindow window, const sclboolean force_draw = FALSE) = 0; virtual void end_paint(const sclwindow window, scldrawctx draw_ctx) = 0; virtual sclimage load_image(const sclchar *image_path) = 0; @@ -102,16 +102,16 @@ public : void fini(); 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) { - 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); + 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, SCLWindowType type = WINDOW_KEYPAD) { + 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, type); } 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) { + sclint padding_x = 0, sclint padding_y = 0, sclint inner_width = 0, sclint inner_height = 0, SCLWindowType type = WINDOW_KEYPAD) { 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); + pos_x, pos_y, width, height, align, padding_x, padding_y, inner_width, inner_height, type); } scldrawctx begin_paint(const sclwindow window, const sclboolean force_draw = FALSE) { diff --git a/scl/sclgraphicsbackendcallback.h b/scl/sclgraphicsbackendcallback.h index 93a68f2..1bed3eb 100644 --- a/scl/sclgraphicsbackendcallback.h +++ b/scl/sclgraphicsbackendcallback.h @@ -30,7 +30,7 @@ using namespace scl; struct ISCLUIGraphicsBackendCallback { //virtual void on_draw_text(const char *str, int x, int y, int w, int h, int fontsize, void* user_data) { } virtual void on_draw_text(const SclFontInfo& font_info, const SclColor& color, const char *str, int pos_x, int pos_y, int w, int h, - SCLLabelAlignment align, int padding_x, int padding_y, int inner_width, int inner_height, void* user_data) { } + SCLLabelAlignment align, int padding_x, int padding_y, int inner_width, int inner_height, SCLWindowType type, void* user_data) { } /* const SclFontInfo& font_info, const SclColor& color, @@ -39,7 +39,7 @@ struct ISCLUIGraphicsBackendCallback { sclint inner_width, sclint inner_height) */ - virtual void on_draw_image(const char *image_path, int dest_x, int dest_y, int dest_weight, int dest_height, int src_x, int src_y, int src_width, int src_height, void* user_data) { } + virtual void on_draw_image(const char *image_path, int dest_x, int dest_y, int dest_weight, int dest_height, int src_x, int src_y, int src_width, int src_height, SCLWindowType type, void* user_data) { } virtual void on_draw_rectangle(int pos_x, int pos_y, int width, int height, bool fill, int fill_color_r, int fill_color_g, int fill_color_b, int fill_color_a, void* user_data) { } diff --git a/scl/scluibuilder.cpp b/scl/scluibuilder.cpp index a71528b..aaaa90e 100644 --- a/scl/scluibuilder.cpp +++ b/scl/scluibuilder.cpp @@ -18,6 +18,7 @@ #include #include #include +#include #include "scluibuilder.h" #include "scldebug.h" @@ -32,6 +33,11 @@ #include #include "sclres_manager.h" +#ifdef LOG_TAG +#undef LOG_TAG +#endif +#define LOG_TAG "LIBSCL_UI" + using namespace scl; //extern sclboolean g_key_spacing_off; @@ -156,7 +162,7 @@ CSCLUIBuilder::init(sclwindow parent) * This function will be called by expose event and invalidate rect */ sclboolean -CSCLUIBuilder::show_layout(const sclwindow window, const scl16 x, const scl16 y, const scl16 width, const scl16 height) +CSCLUIBuilder::show_layout(const sclwindow window, const scl16 x, const scl16 y, const scl16 width, const scl16 height, const SCLWindowType type) { SCL_DEBUG(); @@ -174,6 +180,7 @@ CSCLUIBuilder::show_layout(const sclwindow window, const scl16 x, const scl16 y, if (sclres_manager) { default_configure = sclres_manager->get_default_configure(); } + if (events && windows && graphics && cache && context && focus_handler && default_configure) { /* FIXME : The draw_ctx should be acquired from the base window also, if the target window is virtual However, for ease of development, leave the drawctx to be acquired from the target window for now @@ -183,7 +190,7 @@ CSCLUIBuilder::show_layout(const sclwindow window, const scl16 x, const scl16 y, SCLDisplayMode display_mode = context->get_display_mode(); events->set_touch_event_offset(default_configure->touch_offset[display_mode]); - if (window == windows->get_magnifier_window()) { + if (type == WINDOW_MAGNIFIER) { /* For the magnifier window */ ret = show_magnifier(window, draw_ctx); } else if (window == windows->get_dim_window()) { @@ -1117,23 +1124,27 @@ CSCLUIBuilder::show_magnifier(const sclwindow window, scldrawctx draw_ctx) m_utils->get_composed_path(composed_path, IMG_PATH_PREFIX, magnifier_configure->bg_long_key_image_path); m_gwes->m_graphics->draw_image(window, draw_ctx, composed_path, NULL, 0, 0, magnifier_configure->width * utils->get_custom_scale_rate_x(), - magnifier_configure->height * utils->get_custom_scale_rate_y()); + magnifier_configure->height * utils->get_custom_scale_rate_y(), + 0, 0, -1, -1, FALSE, WINDOW_MAGNIFIER); } else { if (shift_index == SCL_SHIFT_STATE_LOCK) { m_utils->get_composed_path(composed_path, IMG_PATH_PREFIX, magnifier_configure->bg_shift_lock_image_path); m_gwes->m_graphics->draw_image(window, draw_ctx, composed_path, NULL, 0, 0, magnifier_configure->width * utils->get_custom_scale_rate_x(), - magnifier_configure->height * utils->get_custom_scale_rate_y()); + magnifier_configure->height * utils->get_custom_scale_rate_y(), + 0, 0, -1, -1, FALSE, WINDOW_MAGNIFIER); } else if (shift_index == SCL_SHIFT_STATE_ON) { m_utils->get_composed_path(composed_path, IMG_PATH_PREFIX, magnifier_configure->bg_shift_image_path); m_gwes->m_graphics->draw_image(window, draw_ctx, composed_path, NULL, 0, 0, magnifier_configure->width * utils->get_custom_scale_rate_x(), - magnifier_configure->height * utils->get_custom_scale_rate_y()); + magnifier_configure->height * utils->get_custom_scale_rate_y(), + 0, 0, -1, -1, FALSE, WINDOW_MAGNIFIER); } else { m_utils->get_composed_path(composed_path, IMG_PATH_PREFIX, magnifier_configure->bg_image_path); m_gwes->m_graphics->draw_image(window, draw_ctx, composed_path, NULL, 0, 0, magnifier_configure->width * utils->get_custom_scale_rate_x(), - magnifier_configure->height * utils->get_custom_scale_rate_y()); + magnifier_configure->height * utils->get_custom_scale_rate_y(), + 0, 0, -1, -1, FALSE, WINDOW_MAGNIFIER); } } @@ -1145,41 +1156,41 @@ CSCLUIBuilder::show_magnifier(const sclwindow window, scldrawctx draw_ctx) switch (loop) { case WND_DECORATOR_TOP_LEFT: m_gwes->m_graphics->draw_image(window, draw_ctx, composed_path, NULL, - 0, 0, decoration_size, decoration_size); + 0, 0, decoration_size, decoration_size, 0, 0, -1, -1, FALSE, WINDOW_MAGNIFIER); break; case WND_DECORATOR_TOP_CENTER: m_gwes->m_graphics->draw_image(window, draw_ctx, composed_path, NULL, decoration_size, 0, - magnifier_configure->width * utils->get_custom_scale_rate_x()- (2 * decoration_size), decoration_size); + magnifier_configure->width * utils->get_custom_scale_rate_x()- (2 * decoration_size), decoration_size, 0, 0, -1, -1, FALSE, WINDOW_MAGNIFIER); break; case WND_DECORATOR_TOP_RIGHT: m_gwes->m_graphics->draw_image(window, draw_ctx, composed_path, NULL, - magnifier_configure->width * utils->get_custom_scale_rate_x() - decoration_size, 0, decoration_size, decoration_size); + magnifier_configure->width * utils->get_custom_scale_rate_x() - decoration_size, 0, decoration_size, decoration_size, 0, 0, -1, -1, FALSE, WINDOW_MAGNIFIER); break; case WND_DECORATOR_MIDDLE_LEFT: m_gwes->m_graphics->draw_image(window, draw_ctx, composed_path, NULL, 0, - decoration_size, decoration_size, magnifier_configure->height * utils->get_custom_scale_rate_y() - (2 * decoration_size)); + decoration_size, decoration_size, magnifier_configure->height * utils->get_custom_scale_rate_y() - (2 * decoration_size), 0, 0, -1, -1, FALSE, WINDOW_MAGNIFIER); break; case WND_DECORATOR_MIDDLE_CENTER: m_gwes->m_graphics->draw_image(window, draw_ctx, composed_path, NULL, 0, 0, - magnifier_configure->width * utils->get_custom_scale_rate_x(), magnifier_configure->height * utils->get_custom_scale_rate_y()); + magnifier_configure->width * utils->get_custom_scale_rate_x(), magnifier_configure->height * utils->get_custom_scale_rate_y(), 0, 0, -1, -1, FALSE, WINDOW_MAGNIFIER); break; case WND_DECORATOR_MIDDLE_RIGHT: m_gwes->m_graphics->draw_image(window, draw_ctx, composed_path, NULL, magnifier_configure->width * utils->get_custom_scale_rate_x() - decoration_size, decoration_size, - decoration_size, magnifier_configure->height * utils->get_custom_scale_rate_y() - (2 * decoration_size)); + decoration_size, magnifier_configure->height * utils->get_custom_scale_rate_y() - (2 * decoration_size), 0, 0, -1, -1, FALSE, WINDOW_MAGNIFIER); break; case WND_DECORATOR_BOTTOM_LEFT: m_gwes->m_graphics->draw_image(window, draw_ctx, composed_path, NULL, 0, - magnifier_configure->height * utils->get_custom_scale_rate_y() - decoration_size, decoration_size, decoration_size); + magnifier_configure->height * utils->get_custom_scale_rate_y() - decoration_size, decoration_size, decoration_size, 0, 0, -1, -1, FALSE, WINDOW_MAGNIFIER); break; case WND_DECORATOR_BOTTOM_CENTER: m_gwes->m_graphics->draw_image(window, draw_ctx, composed_path, NULL, decoration_size, magnifier_configure->height * utils->get_custom_scale_rate_y() - decoration_size, - magnifier_configure->width * utils->get_custom_scale_rate_x() - (2 * decoration_size), decoration_size); + magnifier_configure->width * utils->get_custom_scale_rate_x() - (2 * decoration_size), decoration_size, 0, 0, -1, -1, FALSE, WINDOW_MAGNIFIER); break; case WND_DECORATOR_BOTTOM_RIGHT: m_gwes->m_graphics->draw_image(window, draw_ctx, composed_path, NULL, magnifier_configure->width * utils->get_custom_scale_rate_x() - - decoration_size, magnifier_configure->height * utils->get_custom_scale_rate_y() - decoration_size, decoration_size, decoration_size); + - decoration_size, magnifier_configure->height * utils->get_custom_scale_rate_y() - decoration_size, decoration_size, decoration_size, 0, 0, -1, -1, FALSE, WINDOW_MAGNIFIER); break; } } @@ -1297,7 +1308,8 @@ CSCLUIBuilder::draw_magnifier_label(const sclwindow window, const scldrawctx dra labelproperties->padding_x * utils->get_custom_scale_rate_x(), labelproperties->padding_y * utils->get_custom_scale_rate_y(), labelproperties->inner_width * utils->get_custom_scale_rate_x(), - labelproperties->inner_height * utils->get_custom_scale_rate_y()); + labelproperties->inner_height * utils->get_custom_scale_rate_y(), + WINDOW_MAGNIFIER); } } } diff --git a/scl/scluibuilder.h b/scl/scluibuilder.h index 67f4370..2beff8f 100644 --- a/scl/scluibuilder.h +++ b/scl/scluibuilder.h @@ -48,7 +48,7 @@ public: static CSCLUIBuilder* get_instance(); void init(sclwindow parent); - sclboolean show_layout(const sclwindow window, const scl16 x = 0, const scl16 y = 0, const scl16 width = 0, const scl16 height = 0); + sclboolean show_layout(const sclwindow window, const scl16 x = 0, const scl16 y = 0, const scl16 width = 0, const scl16 height = 0, const SCLWindowType type = WINDOW_KEYPAD); sclboolean draw_button(const sclwindow window, scldrawctx draw_ctx, const scl16 key_index, const SCLButtonState state, const sclboolean force_draw_bg = FALSE); sclboolean show_magnifier(const sclwindow window, scldrawctx draw_ctx); sclboolean show_autopopup(const sclwindow parent, scldrawctx draw_ctx, const scl16 key_index); diff --git a/scl/sclwindowbackendcallback.h b/scl/sclwindowbackendcallback.h index a7b7d10..758729d 100644 --- a/scl/sclwindowbackendcallback.h +++ b/scl/sclwindowbackendcallback.h @@ -25,7 +25,7 @@ using namespace scl; struct ISCLUIWindowBackendCallback { virtual void update_window(int x, int w, int width, int height, void* user_data) { } - + virtual void update_window_postion(SCLWindowType type, int pos_x, int pos_y, int rot_x, int rot_y) { } }; #endif //__SCL_WINDOW_BACKENDCALLBACK_H__ diff --git a/scl/sclwindows-nui.cpp b/scl/sclwindows-nui.cpp index 3f7bcae..9bb2754 100644 --- a/scl/sclwindows-nui.cpp +++ b/scl/sclwindows-nui.cpp @@ -638,14 +638,14 @@ CSCLWindowsImplNui::hide_window(const sclwindow window, sclboolean fForce) */ sclint magnifierx, magnifiery; void -CSCLWindowsImplNui::move_window(const sclwindow window, scl16 x, scl16 y) +CSCLWindowsImplNui::move_window(const sclwindow window, scl16 x, scl16 y, SCLWindowType type) { SCL_DEBUG(); CSCLUtils *utils = CSCLUtils::get_instance(); CSCLContext *context = CSCLContext::get_instance(); CSCLWindows *windows = CSCLWindows::get_instance(); - if (utils && context && windows && window) { + if (utils && context && windows) { SclWindowContext *window_context = windows->get_window_context(window); unsigned short win_width = 0; unsigned short win_height = 0; @@ -717,6 +717,14 @@ CSCLWindowsImplNui::move_window(const sclwindow window, scl16 x, scl16 y) //Evas *evas = evas_object_evas_get(window_object); //evas_render_idle_flush(evas); + if (m_window_backend_callback) { + LOGI("call update_window_position. type(%d), x(%d), y(%d), rotatex(%d), rotatey(%d)", type, x, y, rotatex, rotatey); + m_window_backend_callback->update_window_postion(type, x, y, rotatex, rotatey); + } + else { + LOGW("### No update window position callback ###"); + } + utils->log("WinNui_movewin %p %d %d %d %d (basewin %p mag %p)\n", window, x, y, rotatex, rotatey, @@ -826,7 +834,7 @@ CSCLWindowsImplNui::move_resize_window(const sclwindow window, scl16 x, scl16 y, * Update the window to redraw given area */ void -CSCLWindowsImplNui::update_window(const sclwindow window, scl16 x, scl16 y, scl16 width, scl16 height) +CSCLWindowsImplNui::update_window(const sclwindow window, scl16 x, scl16 y, scl16 width, scl16 height, SCLWindowType type) { SCL_DEBUG(); @@ -839,7 +847,7 @@ CSCLWindowsImplNui::update_window(const sclwindow window, scl16 x, scl16 y, scl1 } CSCLUIBuilder *builder = CSCLUIBuilder::get_instance(); - builder->show_layout(window, x, y, width, height); + builder->show_layout(window, x, y, width, height, type); } /** diff --git a/scl/sclwindows-nui.h b/scl/sclwindows-nui.h index 9b96235..897a717 100644 --- a/scl/sclwindows-nui.h +++ b/scl/sclwindows-nui.h @@ -58,10 +58,10 @@ public : bool destroy_window(sclwindow window); void show_window(const sclwindow window, sclboolean queue); void hide_window(const sclwindow window, sclboolean fForce = FALSE); - void move_window(const sclwindow window, scl16 x, scl16 y); + void move_window(const sclwindow window, scl16 x, scl16 y, SCLWindowType type = WINDOW_KEYPAD); void resize_window(const sclwindow window, scl16 width, scl16 height); void move_resize_window(const sclwindow window, scl16 x, scl16 y, scl16 width, scl16 height); - void update_window(const sclwindow window, scl16 x = 0, scl16 y = 0, scl16 width = 0, scl16 height = 0); + void update_window(const sclwindow window, scl16 x = 0, scl16 y = 0, scl16 width = 0, scl16 height = 0, SCLWindowType type = WINDOW_KEYPAD); void set_window_rotation(const sclwindow window, SCLRotation rotation); void show_message_box(const sclwindow parent, scl8 msgType, sclchar* title, sclchar* msg); sclboolean get_window_rect(const sclwindow window, SclRectangle *rect); diff --git a/scl/sclwindows.cpp b/scl/sclwindows.cpp index 3c7631b..0d60945 100644 --- a/scl/sclwindows.cpp +++ b/scl/sclwindows.cpp @@ -691,7 +691,7 @@ CSCLWindows::find_popup_window_index(sclwindow window) } void -CSCLWindows::move_window(const sclwindow window, scl16 x, scl16 y) +CSCLWindows::move_window(const sclwindow window, scl16 x, scl16 y, SCLWindowType type) { SCL_DEBUG(); @@ -721,7 +721,7 @@ CSCLWindows::move_window(const sclwindow window, scl16 x, scl16 y) if (!is_virtual) { CSCLWindowsImpl* impl = get_scl_windows_impl(); if (impl) { - impl->move_window(window, x, y); + impl->move_window(window, x, y, type); } } } @@ -1035,7 +1035,7 @@ CSCLWindows::get_update_pending() void CSCLWindows::update_window(const sclwindow window, - scl16 x /*= 0*/, scl16 y /*= 0*/, scl16 width /*= 0*/, scl16 height /*= 0*/ ) + scl16 x /*= 0*/, scl16 y /*= 0*/, scl16 width /*= 0*/, scl16 height /*= 0*/, SCLWindowType type) { if (!m_pending_update) { CSCLWindowsImpl* impl = get_scl_windows_impl(); @@ -1045,7 +1045,7 @@ CSCLWindows::update_window(const sclwindow window, CSCLKeyFocusHandler* focus_handler = CSCLKeyFocusHandler::get_instance(); if (impl) { - impl->update_window(window, x, y, width, height); + impl->update_window(window, x, y, width, height, type); /* If we are not updating the whole screen */ if (animator && cache && context && focus_handler && (x != 0 || y != 0 || width != 0 || height != 0)) { diff --git a/scl/sclwindows.h b/scl/sclwindows.h index 579b2dd..5ed8880 100644 --- a/scl/sclwindows.h +++ b/scl/sclwindows.h @@ -89,10 +89,10 @@ public : virtual void show_window(const sclwindow window, sclboolean queue) = 0; virtual void set_window_rotation(const sclwindow window, SCLRotation rotation) = 0; virtual void hide_window(const sclwindow window, sclboolean force = FALSE) = 0; - virtual void move_window(const sclwindow window, scl16 x, scl16 y) = 0; + virtual void move_window(const sclwindow window, scl16 x, scl16 y, SCLWindowType type = WINDOW_KEYPAD) = 0; virtual void move_resize_window(const sclwindow window, scl16 x, scl16 y, scl16 width, scl16 height) = 0; virtual void resize_window(const sclwindow window, scl16 width, scl16 height) = 0; - virtual void update_window(const sclwindow window, scl16 x = 0, scl16 y = 0, scl16 width = 0, scl16 height = 0) = 0; + virtual void update_window(const sclwindow window, scl16 x = 0, scl16 y = 0, scl16 width = 0, scl16 height = 0, SCLWindowType type = WINDOW_KEYPAD) = 0; virtual sclboolean get_window_rect(const sclwindow window, SclRectangle *rect) = 0; virtual void set_keep_above(const sclwindow window, sclboolean keep_above) = 0; @@ -127,10 +127,10 @@ public : void set_window_rotation(const sclwindow window, SCLRotation rotation); - void move_window(const sclwindow window, scl16 x, scl16 y); + void move_window(const sclwindow window, scl16 x, scl16 y, SCLWindowType type = WINDOW_KEYPAD); void resize_window(const sclwindow window, scl16 width, scl16 height); void move_resize_window(const sclwindow window, scl16 x, scl16 y, scl16 width, scl16 height); - void update_window(const sclwindow window, scl16 x = 0, scl16 y = 0, scl16 width = 0, scl16 height = 0); + void update_window(const sclwindow window, scl16 x = 0, scl16 y = 0, scl16 width = 0, scl16 height = 0, SCLWindowType type = WINDOW_KEYPAD); sclboolean get_window_rect(const sclwindow window, SclRectangle *rect); sclwindow get_base_window(); sclboolean is_base_window(sclwindow window);