Mercurial > dwindows
comparison gtk4/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 | e5d4c86a0c93 |
children | 6f4f7882363c |
comparison
equal
deleted
inserted
replaced
2354:dfb52d2bddaa | 2355:fad0821cb953 |
---|---|
6383 if(_DWDefaultFont) | 6383 if(_DWDefaultFont) |
6384 dw_window_set_font(tmp, _DWDefaultFont); | 6384 dw_window_set_font(tmp, _DWDefaultFont); |
6385 DW_FUNCTION_RETURN_THIS(tmp); | 6385 DW_FUNCTION_RETURN_THIS(tmp); |
6386 } | 6386 } |
6387 | 6387 |
6388 /* | |
6389 * Invalidate the render widget triggering an expose event. | |
6390 * Parameters: | |
6391 * handle: A handle to a render widget to be redrawn. | |
6392 */ | |
6393 void API dw_render_redraw(HWND handle) | |
6394 DW_FUNCTION_DEFINITION(dw_render_redraw, void, HWND handle) | |
6395 DW_FUNCTION_ADD_PARAM1(handle) | |
6396 DW_FUNCTION_NO_RETURN(dw_render_redraw) | |
6397 DW_FUNCTION_RESTORE_PARAM1(handle, HWND) | |
6398 { | |
6399 if(handle && GTK_IS_WIDGET(handle)) | |
6400 gtk_widget_queue_draw(handle); | |
6401 } | |
6402 | |
6388 /* Returns a GdkRGBA from a DW color */ | 6403 /* Returns a GdkRGBA from a DW color */ |
6389 static GdkRGBA _dw_internal_color(unsigned long value) | 6404 static GdkRGBA _dw_internal_color(unsigned long value) |
6390 { | 6405 { |
6391 if(DW_RGB_COLOR & value) | 6406 if(DW_RGB_COLOR & value) |
6392 { | 6407 { |