diff --git a/common/inc/gx_api.h b/common/inc/gx_api.h index 7e3e4e94..23b47a87 100644 --- a/common/inc/gx_api.h +++ b/common/inc/gx_api.h @@ -662,7 +662,7 @@ typedef struct GX_STRING_STRUCT #define GX_TYPE_RICH_TEXT_VIEW 144 #define GX_TYPE_GENERIC_SCROLL_WHEEL 145 -/* A pseudo-type, used by Studio code generator */ +/* A pseudo-type, used by Studio code generator */ #define GX_TYPE_TEMPLATE 200 /* Applications can define their own window types */ @@ -1027,7 +1027,7 @@ typedef GX_UBYTE GX_CHAR_CODE; #if !defined(GX_MOUSE_MAX_RESOLUTION) #define GX_MOUSE_MAX_RESOLUTION 32 #endif -#endif +#endif #if defined(GX_DYNAMIC_BIDI_TEXT_SUPPORT) #define GX_PROMPT_BIDI_RESOLVED_TEXT_INFO GX_BIDI_RESOLVED_TEXT_INFO *gx_prompt_bidi_resolved_text_info; @@ -1099,7 +1099,7 @@ typedef struct GX_VIEW_STRUCT GX_UBYTE gx_glyph_advance; /* Glyph advance */ \ GX_BYTE gx_glyph_leading; /* Pen x-pre-advance */ \ GX_UBYTE gx_glyph_width; \ - GX_UBYTE gx_glyph_height; + GX_UBYTE gx_glyph_height; /* Define the Glyph type. */ typedef struct GX_GLYPH_STRUCT @@ -1111,15 +1111,15 @@ typedef struct GX_GLYPH_STRUCT /* Define the Kerning Glyph type. */ typedef struct GX_KERNING_GLYPH_STRUCT { - GX_GLYPH_MEMBERS_DECLARE - GX_CONST GX_UBYTE *gx_kerning_table; /* Kerning table */ + GX_GLYPH_MEMBERS_DECLARE + GX_CONST GX_UBYTE *gx_kerning_table; /* Kerning table */ } GX_KERNING_GLYPH; #endif /* Define the Compressed Glyph type. */ typedef struct GX_COMPRESSED_GLYPH_STRUCT { - GX_GLYPH_MEMBERS_DECLARE + GX_GLYPH_MEMBERS_DECLARE USHORT gx_glyph_map_size; /* Glyph size */ } GX_COMPRESSED_GLYPH; @@ -1249,7 +1249,7 @@ typedef struct GX_EVENT_STRUCT USHORT gx_event_sender; /* ID of the event sender */ union { - UINT gx_event_timer_id; + UINT gx_event_timer_id; GX_POINT gx_event_pointdata; GX_UBYTE gx_event_uchardata[4]; USHORT gx_event_ushortdata[2]; @@ -1356,7 +1356,7 @@ typedef struct GX_RADIAL_PROGRESS_BAR_INFO_STRUCT GX_VALUE gx_radial_progress_bar_info_selected_brush_width; /* width of upper track. */ GX_RESOURCE_ID gx_radial_progress_bar_info_normal_brush_color; /* resource ID of color for lower track. */ GX_RESOURCE_ID gx_radial_progress_bar_info_selected_brush_color; /* resource ID of color for upper track. */ - + } GX_RADIAL_PROGRESS_BAR_INFO; /* Define radial slider information structure, this structure is used to @@ -5898,6 +5898,9 @@ UINT _gxe_window_wallpaper_set(GX_WINDOW *window, GX_RESOURCE_ID wallpaper_id, G #ifdef GX_MULTITHREAD_SUPPORT +VOID _gx_system_lock(VOID); +VOID _gx_system_unlock(VOID); + #define GX_ENTER_CRITICAL _gx_system_lock(); #define GX_EXIT_CRITICAL _gx_system_unlock(); diff --git a/common/inc/gx_system.h b/common/inc/gx_system.h index 415df31c..bd06af5e 100644 --- a/common/inc/gx_system.h +++ b/common/inc/gx_system.h @@ -133,6 +133,7 @@ UINT _gx_system_string_width_get_ext(GX_CONST GX_FONT *font, GX_CONST VOID _gx_system_thread_entry(ULONG id); VOID _gx_system_timer_expiration(ULONG val); +GX_BOOL _gx_system_timer_is_running(GX_WIDGET *owner, UINT timer_id); UINT _gx_system_timer_start(GX_WIDGET *owner, UINT timer_id, UINT initial_ticks, UINT reschedule_ticks); UINT _gx_system_timer_stop(GX_WIDGET *owner, UINT timer_id); VOID _gx_system_timer_update(ULONG ticks); diff --git a/common/src/gx_canvas_glyphs_draw.c b/common/src/gx_canvas_glyphs_draw.c index eb2077b7..d8680d51 100644 --- a/common/src/gx_canvas_glyphs_draw.c +++ b/common/src/gx_canvas_glyphs_draw.c @@ -378,6 +378,15 @@ UINT index = 0; xstart = (GX_VALUE)(xstart + glyph -> gx_glyph_advance); } } while (string_copy.gx_string_length > 0); + +#ifdef GX_UTF8_SUPPORT +#if defined(GX_THAI_GLYPH_SHAPING_SUPPORT) + if (code_list) + { + _gx_system_memory_free((void*)code_list); + } +#endif +#endif } /**************************************************************************/ diff --git a/common/src/gx_circular_gauge_event_process.c b/common/src/gx_circular_gauge_event_process.c index 78a3eed4..c49f04fc 100644 --- a/common/src/gx_circular_gauge_event_process.c +++ b/common/src/gx_circular_gauge_event_process.c @@ -105,6 +105,10 @@ UINT status = GX_SUCCESS; case GX_EVENT_TIMER: if (event_ptr -> gx_event_payload.gx_event_timer_id == GX_CIRCULAR_GAUGE_TIMER) { + if (gauge->gx_circular_gauge_current_angle == gauge->gx_circular_gauge_target_angle) + { + break; + } /* Calculate current angle. */ gauge -> gx_circular_gauge_animation_step++; diff --git a/common/src/gx_display_driver_24xrgb_rotated_setup.c b/common/src/gx_display_driver_24xrgb_rotated_setup.c index 30e6a375..3e3594bd 100644 --- a/common/src/gx_display_driver_24xrgb_rotated_setup.c +++ b/common/src/gx_display_driver_24xrgb_rotated_setup.c @@ -66,15 +66,15 @@ VOID _gx_display_driver_24xrgb_rotated_setup(GX_DISPLAY *display, VOID *aux_data _gx_display_driver_24xrgb_setup(display, aux_data, toggle_function); #if defined(GX_MOUSE_SUPPORT) - display -> gx_display_mouse_capture = GX_NULL; - display -> gx_display_mouse_restore = GX_NULL; - display -> gx_display_mouse_capture = GX_NULL; - display -> gx_display_mouse_restore = GX_NULL; - display -> gx_display_mouse_draw = GX_NULL; display -> gx_display_driver_drawing_initiate = GX_NULL; display -> gx_display_driver_drawing_complete = GX_NULL; display -> gx_display_mouse_position_set = GX_NULL; display -> gx_display_mouse_enable = GX_NULL; +#if !defined(GX_HARDWARE_MOUSE_SUPPORT) + display->gx_display_mouse_capture = GX_NULL; + display->gx_display_mouse_restore = GX_NULL; + display->gx_display_mouse_draw = GX_NULL; +#endif #endif display -> gx_display_rotation_angle = GX_SCREEN_ROTATION_CW; diff --git a/common/src/gx_display_driver_32argb_rotated_setup.c b/common/src/gx_display_driver_32argb_rotated_setup.c index 738c7ee1..66f88d34 100644 --- a/common/src/gx_display_driver_32argb_rotated_setup.c +++ b/common/src/gx_display_driver_32argb_rotated_setup.c @@ -66,15 +66,15 @@ VOID _gx_display_driver_32argb_rotated_setup(GX_DISPLAY *display, VOID *aux_data _gx_display_driver_32argb_setup(display, aux_data, toggle_function); #if defined(GX_MOUSE_SUPPORT) - display -> gx_display_mouse_capture = GX_NULL; - display -> gx_display_mouse_restore = GX_NULL; - display -> gx_display_mouse_capture = GX_NULL; - display -> gx_display_mouse_restore = GX_NULL; - display -> gx_display_mouse_draw = GX_NULL; display -> gx_display_driver_drawing_initiate = GX_NULL; display -> gx_display_driver_drawing_complete = GX_NULL; display -> gx_display_mouse_position_set = GX_NULL; display -> gx_display_mouse_enable = GX_NULL; +#if !defined(GX_HARDWARE_MOUSE_SUPPORT) + display->gx_display_mouse_capture = GX_NULL; + display->gx_display_mouse_restore = GX_NULL; + display->gx_display_mouse_draw = GX_NULL; +#endif #endif display -> gx_display_rotation_angle = GX_SCREEN_ROTATION_CW; diff --git a/common/src/gx_display_driver_565rgb_rotated_setup.c b/common/src/gx_display_driver_565rgb_rotated_setup.c index 063fb1ad..1134369c 100644 --- a/common/src/gx_display_driver_565rgb_rotated_setup.c +++ b/common/src/gx_display_driver_565rgb_rotated_setup.c @@ -68,15 +68,15 @@ VOID _gx_display_driver_565rgb_rotated_setup(GX_DISPLAY *display, VOID *aux_data /* Default initiate and complete function to null for general condition. */ #if defined(GX_MOUSE_SUPPORT) - display -> gx_display_mouse_capture = GX_NULL; - display -> gx_display_mouse_restore = GX_NULL; - display -> gx_display_mouse_capture = GX_NULL; - display -> gx_display_mouse_restore = GX_NULL; - display -> gx_display_mouse_draw = GX_NULL; display -> gx_display_driver_drawing_initiate = GX_NULL; display -> gx_display_driver_drawing_complete = GX_NULL; display -> gx_display_mouse_position_set = GX_NULL; display -> gx_display_mouse_enable = GX_NULL; +#if !defined(GX_HARDWARE_MOUSE_SUPPORT) + display->gx_display_mouse_capture = GX_NULL; + display->gx_display_mouse_restore = GX_NULL; + display->gx_display_mouse_draw = GX_NULL; +#endif #endif // default to 90 degree rotation angle diff --git a/common/src/gx_display_driver_8bit_palette_rotated_setup.c b/common/src/gx_display_driver_8bit_palette_rotated_setup.c index 9374375a..66ac1dff 100644 --- a/common/src/gx_display_driver_8bit_palette_rotated_setup.c +++ b/common/src/gx_display_driver_8bit_palette_rotated_setup.c @@ -41,7 +41,7 @@ /* */ /* DESCRIPTION */ /* */ -/* 8-bit palettte color format display driver rotated setup routine. */ +/* 8-bit palette color format display driver rotated setup routine. */ /* */ /* INPUT */ /* */ @@ -70,15 +70,15 @@ VOID _gx_display_driver_8bit_palette_rotated_setup(GX_DISPLAY *display, VOID _gx_display_driver_8bit_palette_setup(display, aux_data, toggle_function); #if defined(GX_MOUSE_SUPPORT) - display -> gx_display_mouse_capture = GX_NULL; - display -> gx_display_mouse_restore = GX_NULL; - display -> gx_display_mouse_capture = GX_NULL; - display -> gx_display_mouse_restore = GX_NULL; - display -> gx_display_mouse_draw = GX_NULL; display -> gx_display_driver_drawing_initiate = GX_NULL; display -> gx_display_driver_drawing_complete = GX_NULL; display -> gx_display_mouse_position_set = GX_NULL; display -> gx_display_mouse_enable = GX_NULL; +#if !defined(GX_HARDWARE_MOUSE_SUPPORT) + display->gx_display_mouse_capture = GX_NULL; + display->gx_display_mouse_restore = GX_NULL; + display->gx_display_mouse_draw = GX_NULL; +#endif #endif display -> gx_display_rotation_angle = GX_SCREEN_ROTATION_CW; diff --git a/common/src/gx_multi_line_text_input_backspace.c b/common/src/gx_multi_line_text_input_backspace.c index 91ba6ba7..ba5f6d54 100644 --- a/common/src/gx_multi_line_text_input_backspace.c +++ b/common/src/gx_multi_line_text_input_backspace.c @@ -98,10 +98,9 @@ UINT insert_pos; INT shift; INT last_visible_line; GX_VALUE line_height; -GX_VALUE delete_width; UINT old_text_rows; UINT glyph_len = 1; -GX_STRING string; +GX_CHAR ch; GX_SCROLLBAR *scroll; UINT start_mark = text_input -> gx_multi_line_text_input_start_mark; UINT end_mark = text_input -> gx_multi_line_text_input_end_mark; @@ -127,8 +126,6 @@ UINT end_mark = text_input -> gx_multi_line_text_input_end_m glyph_len = (UINT)GX_ABS((INT)start_mark - (INT)end_mark); text_input -> gx_multi_line_text_input_start_mark = 0; text_input -> gx_multi_line_text_input_end_mark = 0; - - string.gx_string_ptr = &text_input -> gx_multi_line_text_view_text.gx_string_ptr[insert_pos - glyph_len]; } else { @@ -140,21 +137,14 @@ UINT end_mark = text_input -> gx_multi_line_text_input_end_m #endif /* Get the character to be deleted. */ - string.gx_string_ptr = &text_input -> gx_multi_line_text_view_text.gx_string_ptr[insert_pos - glyph_len]; + ch = text_input -> gx_multi_line_text_view_text.gx_string_ptr[insert_pos - glyph_len]; - if (string.gx_string_ptr[0] == GX_KEY_CARRIAGE_RETURN || string.gx_string_ptr[0] == GX_KEY_LINE_FEED) + if (ch == GX_KEY_CARRIAGE_RETURN || ch == GX_KEY_LINE_FEED) { glyph_len = text_input -> gx_multi_line_text_input_new_line_character_size; - - string.gx_string_ptr = &text_input -> gx_multi_line_text_view_text.gx_string_ptr[insert_pos - glyph_len]; } } - string.gx_string_length = glyph_len; - - /* Get the width of the character to be deleted. */ - _gx_system_string_width_get_ext(font, &string, &delete_width); - /* Record old shift value. */ shift = text_input -> gx_multi_line_text_view_text_scroll_shift; diff --git a/common/src/gx_multi_line_text_input_left_arrow.c b/common/src/gx_multi_line_text_input_left_arrow.c index 7e05ce47..56d53b6d 100644 --- a/common/src/gx_multi_line_text_input_left_arrow.c +++ b/common/src/gx_multi_line_text_input_left_arrow.c @@ -82,14 +82,12 @@ UINT _gx_multi_line_text_input_left_arrow(GX_MULTI_LINE_TEXT_INPUT *text_input) { GX_TEXT_INPUT_CURSOR *cursor_ptr = &text_input -> gx_multi_line_text_input_cursor_instance; -GX_VALUE char_width; -GX_STRING string; +GX_CHAR ch; UINT insert_pos; GX_POINT cur_pos; INT shift; GX_RECTANGLE cur_rect; UINT glyph_len = 1; -GX_FONT *font; UINT start_mark = text_input -> gx_multi_line_text_input_start_mark; UINT end_mark = text_input -> gx_multi_line_text_input_end_mark; @@ -136,13 +134,6 @@ UINT end_mark = text_input -> gx_multi_line_text_input_end_mark } else { - _gx_widget_font_get((GX_WIDGET *)text_input, text_input -> gx_multi_line_text_view_font_id, &font); - - if (!font) - { - return GX_FAILURE; - } - insert_pos = text_input -> gx_multi_line_text_input_text_insert_position; if (insert_pos > 0) { @@ -152,18 +143,15 @@ UINT end_mark = text_input -> gx_multi_line_text_input_end_mark _gx_utility_utf8_string_backward_character_length_get(&text_input -> gx_multi_line_text_view_text, (INT)(insert_pos - 1), &glyph_len); #endif - string.gx_string_ptr = &text_input -> gx_multi_line_text_view_text.gx_string_ptr[insert_pos - glyph_len]; + ch = text_input -> gx_multi_line_text_view_text.gx_string_ptr[insert_pos - glyph_len]; - if (string.gx_string_ptr[0] == GX_KEY_CARRIAGE_RETURN || string.gx_string_ptr[0] == GX_KEY_LINE_FEED) + if (ch == GX_KEY_CARRIAGE_RETURN || ch == GX_KEY_LINE_FEED) { glyph_len = text_input -> gx_multi_line_text_input_new_line_character_size; } /* Move the cursor position in the input buffer forward by one character. */ text_input -> gx_multi_line_text_input_text_insert_position -= glyph_len; - string.gx_string_ptr = &text_input -> gx_multi_line_text_view_text.gx_string_ptr[insert_pos - glyph_len]; - string.gx_string_length = glyph_len; - _gx_system_string_width_get_ext(font, &string, &char_width); /* Record scroll shift before recalculate cursor position. */ _gx_text_input_cursor_dirty_rectangle_get(&text_input -> gx_multi_line_text_input_cursor_instance, &cur_rect); diff --git a/common/src/gx_multi_line_text_input_mark_previous.c b/common/src/gx_multi_line_text_input_mark_previous.c index 0e7bd735..d4565917 100644 --- a/common/src/gx_multi_line_text_input_mark_previous.c +++ b/common/src/gx_multi_line_text_input_mark_previous.c @@ -83,7 +83,6 @@ GX_CONST GX_CHAR *string; INT old_shift; GX_RECTANGLE cur_rect; UINT glyph_len = 1; -UINT cursor_line; GX_POINT start_pos; GX_POINT end_pos; UINT start_mark = text_input -> gx_multi_line_text_input_start_mark; @@ -100,9 +99,6 @@ UINT end_mark = text_input -> gx_multi_line_text_input_end_mark if (end_mark > 0) { - cursor_line = (UINT)(text_input -> gx_multi_line_text_input_text_cursor_line - 1); - cursor_line = (UINT)(cursor_line - text_input -> gx_multi_line_text_view_first_cache_line); - #ifdef GX_UTF8_SUPPORT _gx_utility_utf8_string_backward_character_length_get(&text_input -> gx_multi_line_text_view_text, (INT)(end_mark - 1), &glyph_len); diff --git a/common/src/gx_scrollbar_draw.c b/common/src/gx_scrollbar_draw.c index 4507d902..ff7b5aca 100644 --- a/common/src/gx_scrollbar_draw.c +++ b/common/src/gx_scrollbar_draw.c @@ -122,7 +122,6 @@ GX_COLOR fill_color; fill_color, GX_BRUSH_SOLID_FILL); _gx_context_brush_width_set(0); - _gx_canvas_rectangle_draw(&size); } _gx_canvas_rectangle_draw(&size); diff --git a/common/src/gx_system_initialize.c b/common/src/gx_system_initialize.c index 67ad1106..c0c3573e 100644 --- a/common/src/gx_system_initialize.c +++ b/common/src/gx_system_initialize.c @@ -202,6 +202,9 @@ UINT length; _gx_animation_create(&_gx_system_animation_pool[index]); _gx_system_animation_pool[index].gx_animation_next = &_gx_system_animation_pool[index + 1]; } + _gx_animation_create(&_gx_system_animation_pool[index]); + _gx_system_animation_pool[index].gx_animation_next = GX_NULL; + _gx_system_animation_free_list = _gx_system_animation_pool; #endif diff --git a/common/src/gx_system_thread_entry.c b/common/src/gx_system_thread_entry.c index d6cf1f6d..274861c8 100644 --- a/common/src/gx_system_thread_entry.c +++ b/common/src/gx_system_thread_entry.c @@ -153,7 +153,11 @@ GX_WIDGET *widget; } else { - _gx_system_event_dispatch(event_ptr); + if (_gx_system_timer_is_running(event_ptr->gx_event_target, + event_ptr->gx_event_payload.gx_event_timer_id)) + { + _gx_system_event_dispatch(event_ptr); + } } break; diff --git a/common/src/gx_system_timer_start.c b/common/src/gx_system_timer_start.c index aa782286..2f014e86 100644 --- a/common/src/gx_system_timer_start.c +++ b/common/src/gx_system_timer_start.c @@ -27,6 +27,39 @@ #include "gx_api.h" #include "gx_system.h" +static GX_TIMER *_gx_system_timer_find(GX_WIDGET *owner, UINT timer_id) +{ +GX_TIMER *found; + + /* check for already having this timer */ + found = _gx_system_active_timer_list; + + while (found) + { + if (found -> gx_timer_owner == owner && + found -> gx_timer_id == timer_id) + { + return found; + } + + found = found -> gx_timer_next; + } + + return GX_NULL; +} + +GX_BOOL _gx_system_timer_is_running(GX_WIDGET *owner, UINT timer_id) +{ +GX_TIMER *found; + + GX_ENTER_CRITICAL + + found = _gx_system_timer_find(owner, timer_id); + + GX_EXIT_CRITICAL + + return found ? GX_TRUE : GX_FALSE; +} /**************************************************************************/ /* */ @@ -86,21 +119,15 @@ UINT tx_timer_active; GX_ENTER_CRITICAL /* check for already having this timer */ - found = _gx_system_active_timer_list; - - while (found) + found = _gx_system_timer_find(owner, timer_id); + if (found) { - if (found -> gx_timer_id == timer_id && - found -> gx_timer_owner == owner) - { - /* yes, this timer is already running */ - /* reset the existing timer value and return */ - found -> gx_timer_initial_ticks = initial_ticks; - found -> gx_timer_reschedule_ticks = reschedule_ticks; - GX_EXIT_CRITICAL - return GX_SUCCESS; - } - found = found -> gx_timer_next; + /* yes, this timer is already running */ + /* reset the existing timer value and return */ + found -> gx_timer_initial_ticks = initial_ticks; + found -> gx_timer_reschedule_ticks = reschedule_ticks; + GX_EXIT_CRITICAL + return GX_SUCCESS; } /* check for having timer available */ diff --git a/common/src/gx_widget_unlink.c b/common/src/gx_widget_unlink.c index 78f13732..905a9c01 100644 --- a/common/src/gx_widget_unlink.c +++ b/common/src/gx_widget_unlink.c @@ -91,12 +91,8 @@ GX_WIDGET *parent; } else { - sibling = parent -> gx_widget_first_child; + sibling = widget -> gx_widget_previous; - while (sibling -> gx_widget_next != widget) - { - sibling = sibling -> gx_widget_next; - } sibling -> gx_widget_next = widget -> gx_widget_next; if (parent -> gx_widget_last_child == widget) diff --git a/common/src/gx_window_execute.c b/common/src/gx_window_execute.c index 3e8527dd..1bd231be 100644 --- a/common/src/gx_window_execute.c +++ b/common/src/gx_window_execute.c @@ -141,7 +141,11 @@ GX_WIDGET *widget; } else { - return_code = _gx_system_event_dispatch(event_ptr); + if (_gx_system_timer_is_running(event_ptr->gx_event_target, + event_ptr->gx_event_payload.gx_event_timer_id)) + { + return_code = _gx_system_event_dispatch(event_ptr); + } } break;