mirror of
https://github.com/VincentWei/MiniGUI.git
synced 2026-09-26 12:27:58 +08:00
support of private data of z-node
This commit is contained in:
@@ -70,7 +70,7 @@
|
||||
struct _CompositorCtxt {
|
||||
RECT rc_screen; // screen rect - avoid duplicated GetScreenRect calls
|
||||
BLOCKHEAP cliprc_heap;// heap for clipping rects
|
||||
CLIPRGN wins_rgn; // visible region for all windows (subtract popupmenus)
|
||||
CLIPRGN wins_rgn; // visible region for all windows (subtract popup menus)
|
||||
CLIPRGN dirty_rgn; // the dirty region
|
||||
CLIPRGN comps_rgn; // the region needed to re-composite
|
||||
CLIPRGN left_rgn; // the left region
|
||||
@@ -167,7 +167,7 @@ static void composite_win_znode (CompositorCtxt* ctxt,
|
||||
RECT rc;
|
||||
const ZNODEHEADER* znode_hdr;
|
||||
|
||||
znode_hdr = ServerGetWinZNodeHeader (NULL, from, TRUE);
|
||||
znode_hdr = ServerGetWinZNodeHeader (NULL, from, NULL, TRUE);
|
||||
if (znode_hdr == NULL)
|
||||
return;
|
||||
|
||||
@@ -242,7 +242,7 @@ static void on_dirty_win (CompositorCtxt* ctxt, int zidx)
|
||||
CLIPRECT *crc;
|
||||
|
||||
if (zidx > 0) {
|
||||
znode_hdr = ServerGetWinZNodeHeader (NULL, zidx, TRUE);
|
||||
znode_hdr = ServerGetWinZNodeHeader (NULL, zidx, NULL, TRUE);
|
||||
if (znode_hdr && znode_hdr->dirty_rcs) {
|
||||
EmptyClipRgn (&ctxt->dirty_rgn);
|
||||
for (i = 0; i < znode_hdr->nr_dirty_rcs; i++) {
|
||||
@@ -259,7 +259,7 @@ static void on_dirty_win (CompositorCtxt* ctxt, int zidx)
|
||||
prev = ServerGetPrevZNode (NULL, zidx, NULL);
|
||||
while (prev > 0) {
|
||||
|
||||
znode_hdr = ServerGetWinZNodeHeader (NULL, prev, FALSE);
|
||||
znode_hdr = ServerGetWinZNodeHeader (NULL, prev, NULL, FALSE);
|
||||
if (znode_hdr->ct == CT_OPAQUE) {
|
||||
SubtractClipRect (&ctxt->dirty_rgn, &znode_hdr->rc);
|
||||
}
|
||||
@@ -326,7 +326,7 @@ static void subtract_opaque_win_znodes_above (CompositorCtxt* ctxt, int from)
|
||||
while (prev > 0) {
|
||||
const ZNODEHEADER* znode_hdr;
|
||||
|
||||
znode_hdr = ServerGetWinZNodeHeader (NULL, prev, FALSE);
|
||||
znode_hdr = ServerGetWinZNodeHeader (NULL, prev, NULL, FALSE);
|
||||
if (znode_hdr && znode_hdr->ct == CT_OPAQUE) {
|
||||
SubtractClipRect (&ctxt->dirty_rgn, &znode_hdr->rc);
|
||||
}
|
||||
@@ -344,7 +344,7 @@ static void subtract_opaque_ppp_znodes (CompositorCtxt* ctxt)
|
||||
for (i = 0; i < nr_ppp; i++) {
|
||||
const ZNODEHEADER* znode_hdr;
|
||||
|
||||
znode_hdr = ServerGetPopupMenuZNodeHeader (i, FALSE);
|
||||
znode_hdr = ServerGetPopupMenuZNodeHeader (i, NULL, FALSE);
|
||||
if (znode_hdr && znode_hdr->ct == CT_OPAQUE) {
|
||||
SubtractClipRect (&ctxt->dirty_rgn, &znode_hdr->rc);
|
||||
}
|
||||
@@ -359,7 +359,7 @@ static void on_dirty_wpp (CompositorCtxt* ctxt)
|
||||
|
||||
_DBG_PRINTF("called\n");
|
||||
|
||||
znode_hdr = ServerGetWinZNodeHeader (NULL, 0, TRUE);
|
||||
znode_hdr = ServerGetWinZNodeHeader (NULL, 0, NULL, TRUE);
|
||||
if (znode_hdr && znode_hdr->dirty_rcs) {
|
||||
int i;
|
||||
|
||||
@@ -438,7 +438,7 @@ static const ZNODEHEADER* rebuild_wins_region (CompositorCtxt* ctxt)
|
||||
|
||||
nr_ppps = ServerGetPopupMenusCount ();
|
||||
for (i = 0; i < nr_ppps; i++) {
|
||||
znode_hdr = ServerGetPopupMenuZNodeHeader (i, FALSE);
|
||||
znode_hdr = ServerGetPopupMenuZNodeHeader (i, NULL, FALSE);
|
||||
if (znode_hdr)
|
||||
SubtractClipRect (&ctxt->wins_rgn, &znode_hdr->rc);
|
||||
}
|
||||
@@ -455,7 +455,7 @@ static void refresh (CompositorCtxt* ctxt)
|
||||
|
||||
static void on_showing_ppp (CompositorCtxt* ctxt, int zidx)
|
||||
{
|
||||
const ZNODEHEADER* znode_hdr = ServerGetPopupMenuZNodeHeader (zidx, FALSE);
|
||||
const ZNODEHEADER* znode_hdr = ServerGetPopupMenuZNodeHeader (zidx, NULL, FALSE);
|
||||
if (znode_hdr)
|
||||
SubtractClipRect (&ctxt->wins_rgn, &znode_hdr->rc);
|
||||
}
|
||||
@@ -465,7 +465,7 @@ static void on_hiding_ppp (CompositorCtxt* ctxt, int zidx)
|
||||
const ZNODEHEADER* znode_hdr;
|
||||
|
||||
rebuild_wins_region (ctxt);
|
||||
znode_hdr = ServerGetPopupMenuZNodeHeader (zidx, FALSE);
|
||||
znode_hdr = ServerGetPopupMenuZNodeHeader (zidx, NULL, FALSE);
|
||||
|
||||
if (znode_hdr) {
|
||||
on_dirty_win (ctxt, 0);
|
||||
|
||||
@@ -119,36 +119,7 @@ static const CompositorOps* load_default_compositor (void)
|
||||
return ex_compsor_get (COMPSOR_NAME_DEFAULT, &__mg_fallback_compositor);
|
||||
}
|
||||
|
||||
BOOL mg_InitCompositor (void)
|
||||
{
|
||||
const char* name = COMPSOR_NAME_FALLBACK;
|
||||
const CompositorOps* ops;
|
||||
CompositorCtxt* ctxt = NULL;
|
||||
|
||||
ops = load_default_compositor ();
|
||||
if (ops && ServerRegisterCompositor (COMPSOR_NAME_DEFAULT, ops)) {
|
||||
name = COMPSOR_NAME_DEFAULT;
|
||||
}
|
||||
|
||||
ServerSelectCompositor (name, &ctxt);
|
||||
return (ctxt != NULL);
|
||||
}
|
||||
|
||||
void mg_TerminateCompositor (void)
|
||||
{
|
||||
CompositorCtxt* ctxt = NULL;
|
||||
|
||||
// Select fallback compositor and terminate the fallback compositor.
|
||||
ServerSelectCompositor (COMPSOR_NAME_FALLBACK, &ctxt);
|
||||
if (ctxt) {
|
||||
__mg_fallback_compositor.terminate (ctxt);
|
||||
}
|
||||
|
||||
if (dl_handle)
|
||||
dlclose (dl_handle);
|
||||
}
|
||||
|
||||
void __mg_compsor_check_znodes (void)
|
||||
void __mg_composite_dirty_znodes (void)
|
||||
{
|
||||
ZORDERINFO* zi;
|
||||
ZORDERNODE* nodes;
|
||||
@@ -180,7 +151,7 @@ void __mg_compsor_check_znodes (void)
|
||||
// travel win znodes
|
||||
nodes = GET_ZORDERNODE(zi);
|
||||
next = 0;
|
||||
while ( (next = __kernel_get_next_znode (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);
|
||||
@@ -205,6 +176,79 @@ void __mg_compsor_check_znodes (void)
|
||||
}
|
||||
}
|
||||
|
||||
static void purge_znodes_private_data_in_layer (const CompositorOps* ops,
|
||||
CompositorCtxt* ctxt, MG_Layer* layer)
|
||||
{
|
||||
ZORDERINFO* zi;
|
||||
ZORDERNODE* nodes;
|
||||
int i, next;
|
||||
|
||||
zi = (ZORDERINFO*)layer->zorder_info;
|
||||
|
||||
// travel popup menu znodes
|
||||
if (zi->nr_popupmenus > 0) {
|
||||
nodes = GET_MENUNODE(zi);
|
||||
for (i = 0; i < zi->nr_popupmenus; i++) {
|
||||
if (nodes[i].priv_data) {
|
||||
ops->purge_ppp_data (ctxt, i, nodes[i].priv_data);
|
||||
nodes[i].priv_data = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// travel window znodes
|
||||
nodes = GET_ZORDERNODE(zi);
|
||||
next = 0;
|
||||
while ((next = __kernel_get_next_znode (zi, next)) > 0) {
|
||||
if (nodes[next].priv_data) {
|
||||
ops->purge_win_data (ctxt, next, nodes[next].priv_data);
|
||||
nodes[next].priv_data = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static inline void purge_all_znodes_private_data (const CompositorOps* ops,
|
||||
CompositorCtxt* ctxt)
|
||||
{
|
||||
MG_Layer* layer;
|
||||
|
||||
layer = mgLayers;
|
||||
while (layer) {
|
||||
purge_znodes_private_data_in_layer (ops, ctxt, layer);
|
||||
layer = layer->next;
|
||||
}
|
||||
}
|
||||
|
||||
BOOL mg_InitCompositor (void)
|
||||
{
|
||||
const char* name = COMPSOR_NAME_FALLBACK;
|
||||
const CompositorOps* ops;
|
||||
CompositorCtxt* ctxt = NULL;
|
||||
|
||||
ops = load_default_compositor ();
|
||||
if (ops && ServerRegisterCompositor (COMPSOR_NAME_DEFAULT, ops)) {
|
||||
name = COMPSOR_NAME_DEFAULT;
|
||||
}
|
||||
|
||||
ServerSelectCompositor (name, &ctxt);
|
||||
return (ctxt != NULL);
|
||||
}
|
||||
|
||||
void mg_TerminateCompositor (void)
|
||||
{
|
||||
CompositorCtxt* ctxt = NULL;
|
||||
|
||||
// Select fallback compositor and terminate the fallback compositor.
|
||||
ServerSelectCompositor (COMPSOR_NAME_FALLBACK, &ctxt);
|
||||
if (ctxt) {
|
||||
purge_all_znodes_private_data (&__mg_fallback_compositor, ctxt);
|
||||
__mg_fallback_compositor.terminate (ctxt);
|
||||
}
|
||||
|
||||
if (dl_handle)
|
||||
dlclose (dl_handle);
|
||||
}
|
||||
|
||||
const CompositorOps* GUIAPI ServerGetCompositorOps (const char* name)
|
||||
{
|
||||
int i;
|
||||
@@ -288,8 +332,10 @@ const CompositorOps* GUIAPI ServerSelectCompositor (const char* name,
|
||||
|
||||
ctxt = ops->initialize (name);
|
||||
if (ctxt) {
|
||||
if (curr_ops)
|
||||
if (curr_ops) {
|
||||
purge_all_znodes_private_data (curr_ops, curr_ctxt);
|
||||
curr_ops->terminate (curr_ctxt);
|
||||
}
|
||||
curr_ops = ops;
|
||||
curr_ctxt = ctxt;
|
||||
curr_ops->refresh (ctxt);
|
||||
|
||||
Reference in New Issue
Block a user