From d2be775e378713053ae886fdf8f7cf41ff8e3e2e Mon Sep 17 00:00:00 2001 From: Vincent Wei Date: Wed, 22 Jan 2020 11:48:39 +0800 Subject: [PATCH] implement __compsor_check_znodes --- src/kernel/compsor-manager.c | 61 ++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/src/kernel/compsor-manager.c b/src/kernel/compsor-manager.c index c3d320fb..e1c876f0 100644 --- a/src/kernel/compsor-manager.c +++ b/src/kernel/compsor-manager.c @@ -63,7 +63,11 @@ #include #include "minigui.h" +#include "gdi.h" +#include "window.h" #include "constants.h" +#include "zorder.h" +#include "dc.h" #define MAX_NR_COMPOSITORS 8 #define LEN_COMPOSITOR_NAME 15 @@ -144,6 +148,63 @@ void mg_TerminateCompositor (void) dlclose (dl_handle); } +void __compsor_check_znodes (void) +{ + ZORDERINFO* zi; + ZORDERNODE* nodes; + CompositorCtxt* ctxt; + const CompositorOps* ops = ServerSelectCompositor (NULL, &ctxt); + int i, next; + unsigned int changes_in_dc; + PDC pdc; + + assert (ops); + + zi = (ZORDERINFO*)mgTopmostLayer->zorder_info; + + // travel menu znodes + if (zi->nr_popupmenus > 0) { + nodes = GET_MENUNODE(zi); + for (i = 0; i < zi->nr_popupmenus; i++) { + pdc = dc_HDC2PDC (nodes[i].mem_dc); + assert (pdc->surface->shared_header); + + changes_in_dc = pdc->surface->shared_header->dirty_age; + if (changes_in_dc != nodes[i].changes) { + ops->on_dirty_ppp (ctxt, i); + nodes[i].changes = changes_in_dc; + } + } + } + + // travel win znodes + nodes = GET_ZORDERNODE(zi); + next = 0; + while ( (next = kernel_get_next_znode (zi, next)) > 0) { + if (nodes [next].flags & ZOF_VISIBLE) { + pdc = dc_HDC2PDC (nodes[next].mem_dc); + assert (pdc->surface->shared_header); + + changes_in_dc = pdc->surface->shared_header->dirty_age; + if (changes_in_dc != nodes[next].changes) { + ops->on_dirty_win (ctxt, next); + nodes[next].changes = changes_in_dc; + } + } + } + + // check wallpaper pattern + pdc = dc_HDC2PDC (HDC_SCREEN); + assert (pdc->surface->shared_header); + if (pdc->surface->w > 0 && pdc->surface->h > 0) { + changes_in_dc = pdc->surface->shared_header->dirty_age; + if (changes_in_dc != nodes[0].changes) { + ops->on_dirty_wpp (ctxt); + nodes[0].changes = changes_in_dc; + } + } +} + const CompositorOps* GUIAPI ServerGetCompositorOps (const char* name) { int i;