From af9427e69f97b430b82f25810b1171dd36872c3a Mon Sep 17 00:00:00 2001 From: "yang.roger" Date: Thu, 18 Jun 2026 15:25:49 +0800 Subject: [PATCH 01/11] Prevent refreshing incorrectly the animated gauge needle after the GX_CIRCULAR_GAUGE_TIMER timer was stopped There may be timer messages in the system message queue after the GX_CIRCULAR_GAUGE_TIMER timer was stopped. The gauge needle maybe displays at error position. --- common/src/gx_circular_gauge_event_process.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/common/src/gx_circular_gauge_event_process.c b/common/src/gx_circular_gauge_event_process.c index 78a3eed41..c49f04fc6 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++; From 3474e0217569e64eb676b2a421be979af2ded287 Mon Sep 17 00:00:00 2001 From: yang-roger Date: Thu, 16 Jul 2026 21:43:32 +0800 Subject: [PATCH 02/11] In gx_display_driver_X_rotated_setup functions, add the preprocessor !defined(GX_HARDWARE_MOUSE_SUPPORT) to the relevant variables. --- common/src/gx_display_driver_24xrgb_rotated_setup.c | 10 +++++----- common/src/gx_display_driver_32argb_rotated_setup.c | 10 +++++----- common/src/gx_display_driver_565rgb_rotated_setup.c | 10 +++++----- .../gx_display_driver_8bit_palette_rotated_setup.c | 12 ++++++------ 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/common/src/gx_display_driver_24xrgb_rotated_setup.c b/common/src/gx_display_driver_24xrgb_rotated_setup.c index 30e6a3759..3e3594bd0 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 738c7ee11..66f88d343 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 063fb1ad4..1134369c3 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 9374375a8..66ac1dff8 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; From 68036d5dfad1de6df007e2ad18c2a82b958d98fe Mon Sep 17 00:00:00 2001 From: yang-roger Date: Sat, 18 Jul 2026 14:28:44 +0800 Subject: [PATCH 03/11] Release the Thai 'code_list' memory if allocated in the function _gx_canvas_compressed_glyphs_draw() --- common/src/gx_canvas_glyphs_draw.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/common/src/gx_canvas_glyphs_draw.c b/common/src/gx_canvas_glyphs_draw.c index eb2077b77..d8680d51c 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 } /**************************************************************************/ From cd926f6253417ad2a875502400c4aa5cb758b0dc Mon Sep 17 00:00:00 2001 From: yang-roger Date: Mon, 20 Jul 2026 10:53:21 +0800 Subject: [PATCH 04/11] Initialize the last animation of system animation pool. --- common/src/gx_system_initialize.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/common/src/gx_system_initialize.c b/common/src/gx_system_initialize.c index 67ad1106e..c0c3573e1 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 From be1685eb5a2b1478f314893cb56d55b6d5cc100c Mon Sep 17 00:00:00 2001 From: yang-roger Date: Wed, 22 Jul 2026 09:28:21 +0800 Subject: [PATCH 05/11] add _gx_system_lock(), _gx_system_unlock() declarement to file gx_api.h --- common/inc/gx_api.h | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/common/inc/gx_api.h b/common/inc/gx_api.h index 7e3e4e94a..23b47a87b 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(); From 3d8326ce717d9ab5caa6466879eec46f14b687ad Mon Sep 17 00:00:00 2001 From: yang-roger Date: Wed, 22 Jul 2026 11:14:44 +0800 Subject: [PATCH 06/11] In the function _gx_widget_unlink, use directly sibling = widget -> gx_widget_previous; --- common/src/gx_widget_unlink.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/common/src/gx_widget_unlink.c b/common/src/gx_widget_unlink.c index 78f137325..905a9c012 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) From 7df555db4361617920636091fd309aabacfb340f Mon Sep 17 00:00:00 2001 From: yang-roger Date: Sun, 26 Jul 2026 13:05:30 +0800 Subject: [PATCH 07/11] remove the redundant background fill code from the _gx_scrollbar_draw() function. --- common/src/gx_scrollbar_draw.c | 1 - 1 file changed, 1 deletion(-) diff --git a/common/src/gx_scrollbar_draw.c b/common/src/gx_scrollbar_draw.c index 4507d9022..ff7b5aca0 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); From d3bfd3be62a7d85c6d20d892a212a2926e06085e Mon Sep 17 00:00:00 2001 From: yang-roger Date: Tue, 4 Aug 2026 10:00:39 +0800 Subject: [PATCH 08/11] remove the redundant code from the _gx_multi_line_text_input_backspace() function. --- common/src/gx_multi_line_text_input_backspace.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/common/src/gx_multi_line_text_input_backspace.c b/common/src/gx_multi_line_text_input_backspace.c index 91ba6ba7a..ba5f6d54e 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; From e00cdc0a0c40fcaa22b6cd0edebcdf8f2f9ca936 Mon Sep 17 00:00:00 2001 From: yang-roger Date: Tue, 4 Aug 2026 10:01:02 +0800 Subject: [PATCH 09/11] remove the redundant code from the _gx_multi_line_text_input_left_arrow() function. --- .../src/gx_multi_line_text_input_left_arrow.c | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) 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 7e05ce479..56d53b6db 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); From d85f45dd4626acabd090ce1121df160ae0389dad Mon Sep 17 00:00:00 2001 From: yang-roger Date: Tue, 4 Aug 2026 12:54:53 +0800 Subject: [PATCH 10/11] remove the redundant code from the _gx_multi_line_text_input_mark_previous() function. --- common/src/gx_multi_line_text_input_mark_previous.c | 4 ---- 1 file changed, 4 deletions(-) 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 0e7bd735e..d4565917d 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); From 4aba5f1a7793a1352fcdb68a010b923e6b54aa3a Mon Sep 17 00:00:00 2001 From: yang-roger Date: Thu, 6 Aug 2026 08:33:51 +0800 Subject: [PATCH 11/11] Only if the timer is running, timer messages can be dispatched to valid target windows. --- common/inc/gx_system.h | 1 + common/src/gx_system_thread_entry.c | 6 +++- common/src/gx_system_timer_start.c | 55 +++++++++++++++++++++-------- common/src/gx_window_execute.c | 6 +++- 4 files changed, 52 insertions(+), 16 deletions(-) diff --git a/common/inc/gx_system.h b/common/inc/gx_system.h index 415df31c0..bd06af5e1 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_system_thread_entry.c b/common/src/gx_system_thread_entry.c index d6cf1f6dd..274861c8b 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 aa7822865..2f014e863 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_window_execute.c b/common/src/gx_window_execute.c index 3e8527dd3..1bd231be4 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;