comparison gtk/dw.c @ 2355:fad0821cb953

Add new function dw_render_redraw() which will trigger expose event on render widgets. This is to help optimize drawing on GTK4 and GTK3 with Wayland. To make existing code function on GTK4 and GTK3 with Wayland, drawing outside of a callback will mark widgets dirty and dw_flush() will trigger draw/expose callbacks on them. This may result in double drawing the widgets. dw_render_redraw() will allow you to just trigger the draw event without actually attempting to draw, allowing one draw pass in the expose callback. Only tested on Windows, may require fixes on other platforms.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Mon, 08 Mar 2021 19:53:55 +0000
parents 123e22827a82
children 0286ac44d347
comparison
equal deleted inserted replaced
2354:dfb52d2bddaa 2355:fad0821cb953
8270 gtk_widget_show(tmp); 8270 gtk_widget_show(tmp);
8271 if(_DWDefaultFont) 8271 if(_DWDefaultFont)
8272 dw_window_set_font(tmp, _DWDefaultFont); 8272 dw_window_set_font(tmp, _DWDefaultFont);
8273 DW_MUTEX_UNLOCK; 8273 DW_MUTEX_UNLOCK;
8274 return tmp; 8274 return tmp;
8275 }
8276
8277 /*
8278 * Invalidate the render widget triggering an expose event.
8279 * Parameters:
8280 * handle: A handle to a render widget to be redrawn.
8281 */
8282 void API dw_render_redraw(HWND handle)
8283 {
8284 int _locked_by_me = FALSE;
8285
8286 DW_MUTEX_LOCK;
8287 if(handle && GTK_IS_WIDGET(handle))
8288 gtk_widget_queue_draw(handle);
8289 DW_MUTEX_UNLOCK;
8275 } 8290 }
8276 8291
8277 /* Returns a GdkColor from a DW color */ 8292 /* Returns a GdkColor from a DW color */
8278 static GdkColor _internal_color(unsigned long value) 8293 static GdkColor _internal_color(unsigned long value)
8279 { 8294 {