comparison win/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 1cffb66cf7b8
children 4de830d3bf9e
comparison
equal deleted inserted replaced
2354:dfb52d2bddaa 2355:fad0821cb953
11059 newbox->grouphwnd = (HWND)NULL; 11059 newbox->grouphwnd = (HWND)NULL;
11060 newbox->cinfo.pOldProc = SubclassWindow(tmp, _rendwndproc); 11060 newbox->cinfo.pOldProc = SubclassWindow(tmp, _rendwndproc);
11061 newbox->cinfo.fore = newbox->cinfo.back = -1; 11061 newbox->cinfo.fore = newbox->cinfo.back = -1;
11062 SetWindowLongPtr( tmp, GWLP_USERDATA, (LONG_PTR)newbox ); 11062 SetWindowLongPtr( tmp, GWLP_USERDATA, (LONG_PTR)newbox );
11063 return tmp; 11063 return tmp;
11064 }
11065
11066 /*
11067 * Invalidate the render widget triggering an expose event.
11068 * Parameters:
11069 * handle: A handle to a render widget to be redrawn.
11070 */
11071 void API dw_render_redraw(HWND handle)
11072 {
11073 InvalidateRect(handle, NULL, FALSE);
11064 } 11074 }
11065 11075
11066 /* Sets the current foreground drawing color. 11076 /* Sets the current foreground drawing color.
11067 * Parameters: 11077 * Parameters:
11068 * red: red value. 11078 * red: red value.