add changes in ZNODEHEADER and tune the operation names

This commit is contained in:
Vincent Wei
2020-01-20 18:20:30 +08:00
parent 6b2197ea1d
commit 3b1351b128
5 changed files with 74 additions and 53 deletions
+24 -20
View File
@@ -1160,24 +1160,27 @@ typedef struct _ZNODEHEADER {
/** Client id of the znode. */
int cli;
/** The content change age */
/** The znode change age; no use for compositing schema */
unsigned int age;
#ifdef _MGSCHEMA_COMPOSITING
/** The count for changes of content */
unsigned int changes;
/**
* The memory DC for this znode.
* The compositing type for this znode.
* For more information, see \a SetMainWindowCompositing.
*/
HDC mem_dc;
int ct;
/**
* The compositing argument for this znode.
* For more information, see \a SetMainWindowCompositing.
*/
DWORD ct_arg;
/**
* The compositing type for this znode.
* For more information, see \a SetMainWindowCompositing.
* The memory DC for this znode.
*/
int ct;
HDC mem_dc;
#endif
} ZNODEHEADER;
@@ -1400,19 +1403,19 @@ typedef struct _CompositorOps {
* in the surface of the popup menu; but it can update some internal data
* in this operation.
*/
void (*on_show_ppp) (CompositorCtxt* ctxt, int zidx);
void (*on_showing_ppp) (CompositorCtxt* ctxt, int zidx);
/**
* This operation will be called when the system is hidding a popup menu.
* This operation will be called when the system is hiding a popup menu.
* The compositor can play an animation in this operation.
*/
void (*on_hide_ppp) (CompositorCtxt* ctxt, int zidx);
void (*on_hiding_ppp) (CompositorCtxt* ctxt, int zidx);
/**
* This operation will be called when the system is closing a popup menu.
* The compositor can play an animation in this operation.
*/
void (*on_close_menu) (CompositorCtxt* ctxt);
void (*on_closing_menu) (CompositorCtxt* ctxt);
/**
* This operation will be called when the system is showing a window.
@@ -1420,37 +1423,38 @@ typedef struct _CompositorOps {
* the surface of the window, but it can update some internal data
* in this operation.
*/
void (*on_show_win) (CompositorCtxt* ctxt, int zidx);
void (*on_showing_win) (CompositorCtxt* ctxt, int zidx);
/**
* This operation will be called when the system is hidding a window.
* The compositor can play an animation in this operation.
*/
void (*on_hide_win) (CompositorCtxt* ctxt, int zidx);
void (*on_hiding_win) (CompositorCtxt* ctxt, int zidx);
/**
* This operation will be called when the system is moving a window.
* The compositor can play an animation in this operation.
*/
void (*on_move_win) (CompositorCtxt* ctxt, int zidx, const RECT* dst_rc);
void (*on_moving_win) (CompositorCtxt* ctxt, int zidx, const RECT* dst_rc);
/**
* This operation will be called when the system is moveing the z-order
* to top.
*/
void (*on_moving_to_top) (CompositorCtxt* ctxt, int zidx);
/**
* This operation will be called when the system is maximizing a window.
* The compositor can play an animation in this operation.
*/
void (*on_maximize_win) (CompositorCtxt* ctxt, int zidx);
void (*on_maximizing_win) (CompositorCtxt* ctxt, int zidx);
/**
* This operation will be called when the system is manimizing a window.
* The compositor can play an animation in this operation.
*/
void (*on_minimize_win) (CompositorCtxt* ctxt, int zidx);
void (*on_minimizing_win) (CompositorCtxt* ctxt, int zidx);
/**
* This operation will be called when the system is changing the z-order
* of one window z-node.
*/
void (*on_change_zorder) (CompositorCtxt* ctxt, int zidx);
} CompositorOps;
/**
+5 -3
View File
@@ -76,16 +76,18 @@ typedef struct _ZORDERNODE {
RECT rc; /* rect on the screen */
int cli; /* which client? */
unsigned int age; /* change age */
unsigned int age; /* znode age */
#ifdef _MGSCHEMA_COMPOSITING
HDC mem_dc; /* the memory DC for this znode */
DWORD ct_arg; /* the argument for compositing */
unsigned int changes; /* count for changes of content */
int ct; /* the compositing type */
DWORD ct_arg; /* the argument for compositing */
HDC mem_dc; /* the memory DC for this znode */
#endif
RECT dirty_rc; /* dirty rect */
int idx_mask_rect; /* The first position of mask rect. */
int _padding;
int next;
int prev;
+6 -6
View File
@@ -349,14 +349,14 @@ static void refresh (CompositorCtxt* ctxt)
on_dirty_win (ctxt, 0, NULL, 0);
}
static void on_show_ppp (CompositorCtxt* ctxt, int zidx)
static void on_showing_ppp (CompositorCtxt* ctxt, int zidx)
{
const ZNODEHEADER* znode_hdr = ServerGetPopupMenuZNodeHeader (zidx);
if (znode_hdr)
SubtractClipRect (&ctxt->wins_rgn, &znode_hdr->rc);
}
static void on_hide_ppp (CompositorCtxt* ctxt, int zidx)
static void on_hiding_ppp (CompositorCtxt* ctxt, int zidx)
{
const ZNODEHEADER* znode_hdr;
@@ -368,7 +368,7 @@ static void on_hide_ppp (CompositorCtxt* ctxt, int zidx)
}
}
static void on_close_menu (CompositorCtxt* ctxt)
static void on_closing_menu (CompositorCtxt* ctxt)
{
SetClipRgn (&ctxt->wins_rgn, &ctxt->rc_screen);
}
@@ -379,9 +379,9 @@ CompositorOps __mg_fallback_compositor = {
refresh: refresh,
on_dirty_ppp: on_dirty_ppp,
on_dirty_win: on_dirty_win,
on_show_ppp: on_show_ppp,
on_hide_ppp: on_hide_ppp,
on_close_menu: on_close_menu,
on_showing_ppp: on_showing_ppp,
on_hiding_ppp: on_hiding_ppp,
on_closing_menu: on_closing_menu,
};
#endif /* defined(_MGRM_PROCESSES) && defined(_MGSCHEMA_COMPOSITING) */
+7 -10
View File
@@ -1414,11 +1414,10 @@ int __mg_remove_all_znodes_of_client (int cli)
nodes = GET_ZORDERNODE(zi);
if (zi->cli_trackmenu == cli) {
int i;
#ifndef _MGSCHEMA_COMPOSITING
int i;
ZORDERNODE* menu_nodes = GET_MENUNODE(zi);
#endif
/* lock zi for change */
lock_zi_for_change (zi);
@@ -1437,9 +1436,7 @@ int __mg_remove_all_znodes_of_client (int cli)
nodes [0].flags |= ZOF_IF_REFERENCE;
}
#else /* defined _MGSCHEMA_COMPOSITING */
for (i = 0; i < zi->nr_popupmenus; i++) {
DO_COMPSOR_OP_ARGS (on_hide_ppp, i);
}
DO_COMPSOR_OP(on_closing_menu);
#endif /* defined _MGSCHEMA_COMPOSITING */
zi->cli_trackmenu = -1;
@@ -1467,7 +1464,7 @@ int __mg_remove_all_znodes_of_client (int cli)
do_for_all_znodes (nodes + ZNIDX_SCREENLOCK, zi,
_cb_intersect_rc_no_cli, ZT_LAUNCHER);
#else /* defined _MGSCHEMA_COMPOSITING */
DO_COMPSOR_OP_ARGS(on_hide_win, ZNIDX_SCREENLOCK);
DO_COMPSOR_OP_ARGS(on_hiding_win, ZNIDX_SCREENLOCK);
#endif /* defined _MGSCHEMA_COMPOSITING */
}
@@ -1489,7 +1486,7 @@ int __mg_remove_all_znodes_of_client (int cli)
do_for_all_znodes (nodes + ZNIDX_SCREENLOCK, zi,
_cb_intersect_rc_no_cli, ZT_LAUNCHER);
#else /* defined _MGSCHEMA_COMPOSITING */
DO_COMPSOR_OP_ARGS(on_hide_win, ZNIDX_DOCKER);
DO_COMPSOR_OP_ARGS(on_hiding_win, ZNIDX_DOCKER);
#endif /* defined _MGSCHEMA_COMPOSITING */
}
@@ -1531,7 +1528,7 @@ int __mg_remove_all_znodes_of_client (int cli)
nodes [0].flags |= ZOF_IF_REFERENCE;
}
#else /* defined _MGSCHEMA_COMPOSITING */
DO_COMPSOR_OP_ARGS(on_hide_win, slot);
DO_COMPSOR_OP_ARGS(on_hiding_win, slot);
#endif /* defined _MGSCHEMA_COMPOSITING */
}
@@ -1574,7 +1571,7 @@ int __mg_remove_all_znodes_of_client (int cli)
nodes [0].flags |= ZOF_IF_REFERENCE;
}
#else /* defined _MGSCHEMA_COMPOSITING */
DO_COMPSOR_OP_ARGS(on_hide_win, slot);
DO_COMPSOR_OP_ARGS(on_hiding_win, slot);
#endif /* defined _MGSCHEMA_COMPOSITING */
}
@@ -1598,7 +1595,7 @@ int __mg_remove_all_znodes_of_client (int cli)
nodes [0].flags |= ZOF_IF_REFERENCE;
}
#else /* defined _MGSCHEMA_COMPOSITING */
DO_COMPSOR_OP_ARGS(on_hide_win, ZNIDX_LAUNCHER);
DO_COMPSOR_OP_ARGS(on_hiding_win, ZNIDX_LAUNCHER);
#endif /* defined _MGSCHEMA_COMPOSITING */
}
+32 -14
View File
@@ -509,6 +509,7 @@ static BOOL _cb_update_znode (void* context,
return FALSE;
}
#ifndef _MGSCHEMA_COMPOSITING
static BOOL _cb_intersect_rc (void* context,
const ZORDERINFO* zi, ZORDERNODE* node)
{
@@ -522,7 +523,6 @@ static BOOL _cb_intersect_rc (void* context,
return FALSE;
}
#ifndef _MGSCHEMA_COMPOSITING
static BOOL _cb_update_rc (void* context,
const ZORDERINFO* zi, ZORDERNODE* node)
{
@@ -1419,8 +1419,7 @@ static int srvForceCloseMenu (int cli)
win_nodes [0].flags |= ZOF_IF_REFERENCE;
}
#else /* defined _MGSCHEMA_COMPOSITING */
DO_COMPSOR_OP (on_close_menu);
DO_COMPSOR_OP (on_closing_menu);
for (i = 0; i < zi->nr_popupmenus; i++) {
DeleteMemDC (menu_nodes [i].mem_dc);
}
@@ -1466,10 +1465,11 @@ static int srvStartTrackPopupMenu (int cli, const RECT* rc, HWND ptmi,
{
ZORDERINFO* zi = _get_zorder_info(cli);
ZORDERNODE* menu_nodes;
ZORDERNODE* win_nodes;
RECT rc_screen;
#ifdef _MGSCHEMA_COMPOSITING
HDC memdc = HDC_INVALID;
#else
ZORDERNODE* win_nodes;
RECT rc_screen;
#endif
if (zi->cli_trackmenu >= 0 && zi->cli_trackmenu != cli) {
@@ -1510,11 +1510,13 @@ static int srvStartTrackPopupMenu (int cli, const RECT* rc, HWND ptmi,
#endif /* def _MGSCHEMA_COMPOSITING */
menu_nodes = GET_MENUNODE(zi);
win_nodes = menu_nodes + DEF_NR_POPUPMENUS;
/* lock zi for change */
lock_zi_for_change (zi);
#ifndef _MGSCHEMA_COMPOSITING
win_nodes = menu_nodes + DEF_NR_POPUPMENUS;
/* check influenced window zorder nodes */
do_for_all_znodes ((void*)rc, zi, _cb_intersect_rc, ZT_ALL);
@@ -1522,6 +1524,7 @@ static int srvStartTrackPopupMenu (int cli, const RECT* rc, HWND ptmi,
if (DoesIntersect (rc, &rc_screen)) {
win_nodes [0].age ++;
}
#endif /* not defined _MGSCHEMA_COMPOSITING */
menu_nodes [zi->nr_popupmenus].flags = ZOF_TYPE_POPUPMENU;
menu_nodes [zi->nr_popupmenus].rc = *rc;
@@ -1535,6 +1538,10 @@ static int srvStartTrackPopupMenu (int cli, const RECT* rc, HWND ptmi,
zi->cli_trackmenu = cli;
zi->nr_popupmenus ++;
#ifdef _MGSCHEMA_COMPOSITING
DO_COMPSOR_OP_ARGS(on_showing_ppp, zi->nr_popupmenus - 1);
#endif /* defined _MGSCHEMA_COMPOSITING */
/* unlock zi for change */
unlock_zi_for_change (zi);
@@ -1563,7 +1570,7 @@ static int srvEndTrackPopupMenu (int cli, int idx_znode)
lock_zi_for_change (zi);
#ifdef _MGSCHEMA_COMPOSITING
DO_COMPSOR_OP_ARGS (on_hide_ppp, idx_znode);
DO_COMPSOR_OP_ARGS (on_hiding_ppp, idx_znode);
DeleteMemDC (menu_nodes [idx_znode].mem_dc);
#else /* not defined _MGSCHEMA_COMPOSITING */
rc = menu_nodes [idx_znode].rc;
@@ -2054,9 +2061,10 @@ static int AllocZOrderNodeEx (ZORDERINFO* zi, int cli, HWND hwnd, HWND main_win,
nodes [free_slot].hwnd = hwnd;
nodes [free_slot].main_win = main_win;
#ifdef _MGSCHEMA_COMPOSITING
nodes [free_slot].mem_dc = mem_dc;
nodes [free_slot].changes = 0;
nodes [free_slot].ct = validate_compositing_type (ct);
nodes [free_slot].ct_arg = ct_arg;
nodes [free_slot].mem_dc = mem_dc;
#endif
nodes [free_slot].idx_mask_rect = 0;
@@ -2415,7 +2423,7 @@ static int FreeZOrderNodeEx (ZORDERINFO* zi, int idx_znode, HDC* memdc)
}
#else /* defined _MGSCHEMA_COMPOSITING */
if (nodes [idx_znode].flags & ZOF_VISIBLE) {
DO_COMPSOR_OP_ARGS(on_hide_win, idx_znode);
DO_COMPSOR_OP_ARGS(on_hiding_win, idx_znode);
}
#endif /* defined _MGSCHEMA_COMPOSITING */
@@ -2952,8 +2960,11 @@ static int dskMove2Top (int cli, int idx_znode)
*first = idx_znode;
#endif
nodes [idx_znode].age ++;
#ifdef _MGSCHEMA_COMPOSITING
DO_COMPSOR_OP_ARGS(on_moving_to_top, idx_znode);
#endif
nodes [idx_znode].age ++;
/* unlock zi for change */
unlock_zi_for_change (zi);
@@ -2986,7 +2997,6 @@ static int dskShowWindow (int cli, int idx_znode)
#endif
nodes = GET_ZORDERNODE(__mg_zorder_info);
type = nodes [idx_znode].flags & ZOF_TYPE_MASK;
switch (type) {
case ZOF_TYPE_GLOBAL:
@@ -3005,6 +3015,9 @@ static int dskShowWindow (int cli, int idx_znode)
if (first == NULL)
return -1;
if (nodes [idx_znode].flags & ZOF_VISIBLE)
return 0;
/* lock zi for change */
lock_zi_for_change (zi);
@@ -3050,7 +3063,7 @@ static int dskShowWindow (int cli, int idx_znode)
}
#else /* defined _MGSCHEMA_COMPOSITING */
nodes [idx_znode].flags |= ZOF_VISIBLE;
DO_COMPSOR_OP_ARGS(on_show_win, idx_znode);
DO_COMPSOR_OP_ARGS(on_showing_win, idx_znode);
#endif /* defined _MGSCHEMA_COMPOSITING */
/* unlock zi for change ... */
@@ -3109,6 +3122,10 @@ static int dskHideWindow (int cli, int idx_znode)
if (first == NULL)
return -1;
if (!(nodes[idx_znode].flags & ZOF_VISIBLE)) {
return 0;
}
/* lock zi for change */
lock_zi_for_change (zi);
@@ -3150,7 +3167,7 @@ static int dskHideWindow (int cli, int idx_znode)
}
}
#else /* defined _MGSCHEMA_COMPOSITING */
DO_COMPSOR_OP_ARGS(on_hide_win, idx_znode);
DO_COMPSOR_OP_ARGS(on_hiding_win, idx_znode);
#endif /* defined _MGSCHEMA_COMPOSITING */
if (idx_znode && (nodes [idx_znode].flags & ZOF_TF_MAINWIN
@@ -3558,9 +3575,10 @@ static int dskMoveWindow (int cli, int idx_znode, const RECT* rcWin)
#else /* defined _MGSCHEMA_COMPOSITING */
lock_zi_for_change (zi);
DO_COMPSOR_OP_ARGS(on_move_win, idx_znode, rcWin);
DO_COMPSOR_OP_ARGS(on_moving_win, idx_znode, rcWin);
nodes [idx_znode].rc = *rcWin;
nodes [idx_znode].age ++;
unlock_zi_for_change (zi);
#endif /* defined _MGSCHEMA_COMPOSITING */