Browse Source

Fix ui redraw issues on windows

luboslenco 1 month ago
parent
commit
fd2f5f4678
4 changed files with 7 additions and 26 deletions
  1. 6 9
      base/sources/iron_ui.c
  2. 0 1
      base/sources/iron_ui.h
  3. 1 15
      base/sources/ts/base.ts
  4. 0 1
      base/sources/ts/iron/iron.ts

+ 6 - 9
base/sources/iron_ui.c

@@ -25,7 +25,6 @@ static bool ui_combo_first = true;
 static ui_handle_t *ui_combo_search_handle = NULL;
 ui_t *ui_instances[UI_MAX_INSTANCES];
 int ui_instances_count;
-bool ui_always_redraw_window = true; // Redraw cached window texture each frame or on changes only
 bool ui_touch_scroll = false; // Pan with finger to scroll
 bool ui_touch_hold = false; // Touch and hold finger for right click
 bool ui_touch_tooltip = false; // Show extra tooltips above finger / on-screen keyboard
@@ -1652,15 +1651,13 @@ void ui_end_window() {
 	current->window_ended = true;
 
 	// Draw window texture
-	if (ui_always_redraw_window || handle->redraws > -4) {
-		draw_begin(NULL, false, 0);
-		draw_set_color(0xffffffff);
-		draw_image(&handle->texture, current->_window_x, current->_window_y);
-		if (handle->redraws <= 0) {
-			handle->redraws--;
-		}
-		draw_end();
+	draw_begin(NULL, false, 0);
+	draw_set_color(0xffffffff);
+	draw_image(&handle->texture, current->_window_x, current->_window_y);
+	if (handle->redraws <= 0) {
+		handle->redraws--;
 	}
+	draw_end();
 }
 
 bool ui_window_dirty(ui_handle_t *handle, int x, int y, int w, int h) {

+ 0 - 1
base/sources/iron_ui.h

@@ -367,7 +367,6 @@ float UI_TOOLTIP_DELAY();
 #define UI_MAX_INSTANCES 8
 extern ui_t *ui_instances[UI_MAX_INSTANCES];
 extern int ui_instances_count;
-extern bool ui_always_redraw_window;
 extern bool ui_touch_scroll;
 extern bool ui_touch_hold;
 extern bool ui_touch_tooltip;

+ 1 - 15
base/sources/ts/base.ts

@@ -447,21 +447,7 @@ function base_update() {
 
 	base_handle_drop_paths();
 
-	///if arm_windows
-	let is_picker: bool = context_is_picker();
-	let decal: bool = context_is_decal();
-	ui_always_redraw_window = //!context_raw.cache_draws ||
-							  ui_menu_show ||
-							  ui_box_show ||
-							  base_is_dragging ||
-							  is_picker ||
-							  decal ||
-							  ui_view2d_show ||
-							  !config_raw.brush_3d ||
-							  context_raw.frame < 3;
-	///end
-
-	if (ui_always_redraw_window && context_raw.ddirty < 0) {
+	if (context_raw.ddirty < 0) {
 		context_raw.ddirty = 0;
 	}
 

+ 0 - 1
base/sources/ts/iron/iron.ts

@@ -685,7 +685,6 @@ declare let ui_nodes_enum_texts: (s: string)=>string[];
 declare let ui_touch_scroll: bool;
 declare let ui_touch_hold : bool;
 declare let ui_touch_tooltip: bool;
-declare let ui_always_redraw_window: bool;
 declare let ui_on_border_hover: any;
 declare let ui_on_text_hover: any;
 declare let ui_on_deselect_text: any;