comparison gtk3/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 314d417e55c4
comparison
equal deleted inserted replaced
2354:dfb52d2bddaa 2355:fad0821cb953
7121 gtk_widget_show(tmp); 7121 gtk_widget_show(tmp);
7122 if(_DWDefaultFont) 7122 if(_DWDefaultFont)
7123 dw_window_set_font(tmp, _DWDefaultFont); 7123 dw_window_set_font(tmp, _DWDefaultFont);
7124 DW_MUTEX_UNLOCK; 7124 DW_MUTEX_UNLOCK;
7125 return tmp; 7125 return tmp;
7126 }
7127
7128 /*
7129 * Invalidate the render widget triggering an expose event.
7130 * Parameters:
7131 * handle: A handle to a render widget to be redrawn.
7132 */
7133 void API dw_render_redraw(HWND handle)
7134 {
7135 int _locked_by_me = FALSE;
7136
7137 DW_MUTEX_LOCK;
7138 if(handle && GTK_IS_WIDGET(handle))
7139 gtk_widget_queue_draw(handle);
7140 DW_MUTEX_UNLOCK;
7126 } 7141 }
7127 7142
7128 /* Returns a GdkRGBA from a DW color */ 7143 /* Returns a GdkRGBA from a DW color */
7129 static GdkRGBA _internal_color(unsigned long value) 7144 static GdkRGBA _internal_color(unsigned long value)
7130 { 7145 {