Mercurial > dwindows
diff 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 |
line wrap: on
line diff
--- a/gtk/dw.c Mon Mar 08 19:24:21 2021 +0000 +++ b/gtk/dw.c Mon Mar 08 19:53:55 2021 +0000 @@ -8274,6 +8274,21 @@ return tmp; } +/* + * Invalidate the render widget triggering an expose event. + * Parameters: + * handle: A handle to a render widget to be redrawn. + */ +void API dw_render_redraw(HWND handle) +{ + int _locked_by_me = FALSE; + + DW_MUTEX_LOCK; + if(handle && GTK_IS_WIDGET(handle)) + gtk_widget_queue_draw(handle); + DW_MUTEX_UNLOCK; +} + /* Returns a GdkColor from a DW color */ static GdkColor _internal_color(unsigned long value) {