mirror of
https://github.com/VincentWei/MiniGUI.git
synced 2026-09-24 00:54:18 +08:00
tune DEF_NR_TOOLTIPS and DEF_NR_MASKRECTS
This commit is contained in:
@@ -78,8 +78,8 @@
|
||||
|
||||
/* the numbers of znodes in different levels - should be mulitples of 8 */
|
||||
#define DEF_NR_POPUPMENUS 16
|
||||
#define DEF_NR_TOOLTIPS 8
|
||||
#define DEF_NR_GLOBALS 15 // reserve slots for fixed znodes
|
||||
#define DEF_NR_TOOLTIPS 16
|
||||
#define DEF_NR_GLOBALS 15 // reserve one slot for fixed znode
|
||||
#define DEF_NR_SCREENLOCKS 8
|
||||
#define DEF_NR_DOCKERS 8
|
||||
#define DEF_NR_TOPMOSTS 16
|
||||
@@ -102,7 +102,11 @@ enum {
|
||||
#define ZNIDX_DESKTOP 0
|
||||
|
||||
/* The heap size for mask rectangles */
|
||||
#define DEF_NR_MASKRECT 1024
|
||||
#ifdef _MGRM_PROCESSES
|
||||
# define DEF_NR_MASKRECTS 4096
|
||||
#else
|
||||
# define DEF_NR_MASKRECTS 1024
|
||||
#endif
|
||||
|
||||
#if IS_COMPOSITING_SCHEMA
|
||||
/* max number of shared surfaces */
|
||||
|
||||
@@ -527,7 +527,10 @@ int __mg_free_hook_wins (int cli);
|
||||
/************************* Initialization/Termination ************************/
|
||||
void __mg_init_local_sys_text (void);
|
||||
|
||||
/* the zorder information of the server */
|
||||
/* the zorder information for the default layer */
|
||||
extern ZORDERINFO* __mg_def_zorder_info;
|
||||
|
||||
/* the zorder information for the current layer */
|
||||
extern ZORDERINFO* __mg_zorder_info;
|
||||
|
||||
#ifdef _MGRM_STANDALONE
|
||||
|
||||
@@ -171,7 +171,7 @@ void __mg_check_dirty_znode (int cli);
|
||||
static inline void __mg_check_dirty_znode (int cli) {}
|
||||
#endif
|
||||
|
||||
BOOL __mg_move_client_to_layer (MG_Client* client, MG_Layer* layer);
|
||||
BOOL __mg_move_client_to_layer (MG_Client* client, MG_Layer* layer, BOOL copy_special);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
+14
-13
@@ -87,7 +87,7 @@ typedef struct _ZORDERNODE {
|
||||
int nr_dirty_rcs; /* the number of dirty rects */
|
||||
const RECT* dirty_rcs; /* the pointer to the dirty rectangles */
|
||||
#else /* defined _MGSCHEMA_COMPOSITING */
|
||||
unsigned int age; /* znode age */
|
||||
DWORD age; /* znode age */
|
||||
RECT dirty_rc; /* dirty rectangle */
|
||||
#endif /* not defined _MGSCHEMA_COMPOSITING */
|
||||
|
||||
@@ -156,12 +156,13 @@ typedef struct _ZORDERINFO {
|
||||
typedef ZORDERINFO* PZORDERINFO;
|
||||
|
||||
#define MAX_NR_SPECIAL_ZNODES(zi) \
|
||||
(zi->max_nr_tooltips + zi->max_nr_globals + \
|
||||
(zi->max_nr_globals + \
|
||||
zi->max_nr_screenlocks + zi->max_nr_dockers + \
|
||||
zi->max_nr_launchers + NR_FIXED_ZNODES)
|
||||
|
||||
#define MAX_NR_GENERAL_ZNODES(zi) \
|
||||
(zi->max_nr_topmosts + zi->max_nr_normals)
|
||||
(zi->max_nr_tooltips + zi->max_nr_topmosts + \
|
||||
zi->max_nr_normals)
|
||||
|
||||
#define MAX_NR_ZNODES(zi) \
|
||||
MAX_NR_SPECIAL_ZNODES(zi) + MAX_NR_GENERAL_ZNODES(zi)
|
||||
@@ -178,7 +179,7 @@ typedef ZORDERINFO* PZORDERINFO;
|
||||
(ZORDERNODE*)((char*)((zi)+1)+ (zi)->size_usage_bmp)
|
||||
|
||||
#define GET_MASKRECT_USAGEBMP(zi) \
|
||||
((char *)((zi) + 1) + (zi)->size_usage_bmp + \
|
||||
((unsigned char *)((zi) + 1) + (zi)->size_usage_bmp + \
|
||||
sizeof (ZORDERNODE) * (MAX_NR_ZNODES_WITH_PPP(zi)))
|
||||
|
||||
#define GET_MASKRECT(zi) \
|
||||
@@ -187,25 +188,25 @@ typedef ZORDERINFO* PZORDERINFO;
|
||||
|
||||
/* round to multiple of 8 to aoivd alignment issue */
|
||||
#define SIZE_MASKRECT_USAGE_BMP \
|
||||
ROUND_TO_MULTIPLE((DEF_NR_MASKRECT >> 3), 8)
|
||||
ROUND_TO_MULTIPLE((DEF_NR_MASKRECTS >> 3), 8)
|
||||
|
||||
#define NR_SPECIAL_ZNODES(zi) \
|
||||
(zi->nr_tooltips + zi->nr_globals + \
|
||||
(zi->nr_globals + \
|
||||
zi->nr_screenlocks + zi->nr_dockers + \
|
||||
zi->nr_launchers + NR_FIXED_ZNODES)
|
||||
|
||||
#define NR_GENERAL_ZNODES(zi) \
|
||||
(zi->nr_topmosts + zi->nr_normals)
|
||||
(zi->nr_tooltips + zi->nr_topmosts + zi->nr_normals)
|
||||
|
||||
#define NR_ZNODES(zi) \
|
||||
NR_SPECIAL_ZNODES(zi) + NR_GENERAL_ZNODES(zi)
|
||||
|
||||
/* Since 5.0.0: more levels */
|
||||
#define SIZE_USAGE_BMP_GENERAL(max_nr_t, max_nr_n) \
|
||||
((7 + (max_nr_t) + (max_nr_n)) >> 3)
|
||||
((7 + DEF_NR_TOOLTIPS + (max_nr_t) + (max_nr_n)) >> 3)
|
||||
|
||||
#define SIZE_USAGE_BMP_SPECIAL(max_nr_g) \
|
||||
((7 + DEF_NR_TOOLTIPS + max_nr_g + \
|
||||
((7 + max_nr_g + \
|
||||
DEF_NR_SCREENLOCKS + DEF_NR_DOCKERS + \
|
||||
DEF_NR_LAUNCHERS + NR_FIXED_ZNODES) >> 3)
|
||||
|
||||
@@ -234,12 +235,12 @@ typedef ZORDERINFO* PZORDERINFO;
|
||||
MG_UNLIKELY ((idx) > MAX_NR_ZNODES(zi))
|
||||
|
||||
#define IS_TYPE_GENERAL(type) \
|
||||
(type == ZOF_TYPE_HIGHER || \
|
||||
(type == ZOF_TYPE_TOOLTIP || \
|
||||
type == ZOF_TYPE_HIGHER || \
|
||||
type == ZOF_TYPE_NORMAL)
|
||||
|
||||
#define IS_TYPE_SPECIAL(type) \
|
||||
(type == ZOF_TYPE_TOOLTIP || \
|
||||
type == ZOF_TYPE_GLOBAL || \
|
||||
(type == ZOF_TYPE_GLOBAL || \
|
||||
type == ZOF_TYPE_SCREENLOCK || \
|
||||
type == ZOF_TYPE_DOCKER || \
|
||||
type == ZOF_TYPE_LAUNCHER)
|
||||
@@ -250,7 +251,7 @@ typedef ZORDERINFO* PZORDERINFO;
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
int __kernel_alloc_z_order_info (int nr_topmosts, int nr_normals);
|
||||
int __kernel_alloc_z_order_info (int nr_topmosts, int nr_normals, BOOL with_maskrc_heap);
|
||||
void __kernel_free_z_order_info (ZORDERINFO* zi);
|
||||
int __kernel_get_window_region (HWND pWin, CLIPRGN* region);
|
||||
int __kernel_get_next_znode (const ZORDERINFO* zi, int from);
|
||||
|
||||
+99
-27
@@ -1648,6 +1648,15 @@ int __mg_prepare_layer_for_compositing (MG_Layer* layer)
|
||||
int slot, nr_shown = 0;
|
||||
|
||||
nodes = GET_ZORDERNODE(zi);
|
||||
|
||||
slot = zi->first_tooltip;
|
||||
for (; slot > 0; slot = nodes [slot].next) {
|
||||
if (nodes [slot].flags & ZOF_VISIBLE) {
|
||||
DO_COMPSOR_OP_ARGS (on_showing_win, layer, slot);
|
||||
nr_shown++;
|
||||
}
|
||||
}
|
||||
|
||||
slot = zi->first_topmost;
|
||||
for (; slot > 0; slot = nodes [slot].next) {
|
||||
if (nodes [slot].flags & ZOF_VISIBLE) {
|
||||
@@ -1674,6 +1683,15 @@ int __mg_end_up_layer_for_compositing (MG_Layer* layer)
|
||||
int slot, nr_hidden = 0;
|
||||
|
||||
nodes = GET_ZORDERNODE(zi);
|
||||
|
||||
slot = zi->first_tooltip;
|
||||
for (; slot > 0; slot = nodes [slot].next) {
|
||||
if (nodes [slot].flags & ZOF_VISIBLE) {
|
||||
DO_COMPSOR_OP_ARGS (on_hiding_win, layer, slot);
|
||||
nr_hidden++;
|
||||
}
|
||||
}
|
||||
|
||||
slot = zi->first_topmost;
|
||||
for (; slot > 0; slot = nodes [slot].next) {
|
||||
if (nodes [slot].flags & ZOF_VISIBLE) {
|
||||
@@ -1713,14 +1731,24 @@ int __mg_do_change_topmost_layer (void)
|
||||
|
||||
__mg_zorder_info = mgTopmostLayer->zorder_info;
|
||||
|
||||
/* copy globals to new layer */
|
||||
/* copy special znodes to new layer */
|
||||
lock_zi_for_change (__mg_zorder_info);
|
||||
|
||||
__mg_zorder_info->nr_globals = old_zorder_info->nr_globals;
|
||||
__mg_zorder_info->first_global = old_zorder_info->first_global;
|
||||
__mg_zorder_info->nr_screenlocks = old_zorder_info->nr_screenlocks;
|
||||
__mg_zorder_info->first_screenlock = old_zorder_info->first_screenlock;
|
||||
__mg_zorder_info->nr_dockers = old_zorder_info->nr_dockers;
|
||||
__mg_zorder_info->first_docker = old_zorder_info->first_docker;
|
||||
__mg_zorder_info->nr_launchers = old_zorder_info->nr_launchers;
|
||||
__mg_zorder_info->first_launcher = old_zorder_info->first_launcher;
|
||||
|
||||
if (old_zorder_info->active_win < __mg_zorder_info->nr_globals) {
|
||||
if (old_zorder_info->active_win <= MAX_NR_SPECIAL_ZNODES (__mg_zorder_info)) {
|
||||
__mg_zorder_info->active_win = old_zorder_info->active_win;
|
||||
}
|
||||
else {
|
||||
__mg_zorder_info->active_win = 0;
|
||||
}
|
||||
|
||||
new_use_bmp = (unsigned char*)__mg_zorder_info + sizeof (ZORDERINFO);
|
||||
new_nodes = GET_ZORDERNODE(__mg_zorder_info);
|
||||
@@ -1729,29 +1757,29 @@ int __mg_do_change_topmost_layer (void)
|
||||
sizeof(ZORDERNODE) * MAX_NR_SPECIAL_ZNODES (old_zorder_info));
|
||||
|
||||
#ifndef _MGSCHEMA_COMPOSITING
|
||||
for (i = old_zorder_info->max_nr_tooltips;
|
||||
i <= MAX_NR_SPECIAL_ZNODES (old_zorder_info); i++) {
|
||||
for (i = 0; i <= MAX_NR_SPECIAL_ZNODES (old_zorder_info); i++) {
|
||||
new_nodes [i].age = old_nodes [i].age + 1;
|
||||
}
|
||||
new_nodes [0].age = old_nodes [0].age + 1;
|
||||
#endif /* not defined _MGSCHEMA_COMPOSITING */
|
||||
|
||||
unlock_zi_for_change (__mg_zorder_info);
|
||||
|
||||
/* Since 5.0.0: check clients which created special znodes */
|
||||
/* Since 5.0.0: notifiy clients which created special znodes */
|
||||
{
|
||||
int slot;
|
||||
int cli_moving[4] = { 0 }, nr_clients = 0, i;
|
||||
int cli_moving[3] = { 0 }, nr_clients = 0, i;
|
||||
MG_Layer* dst_layer = mgTopmostLayer;
|
||||
MSG msg = { HWND_DESKTOP,
|
||||
MSG_LAYERCHANGED, (WPARAM)dst_layer,
|
||||
(LPARAM)dst_layer->zorder_shmid, __mg_tick_counter };
|
||||
|
||||
/* Since 5.0.6: tooltips are not speciel znodes
|
||||
slot = old_zorder_info->first_tooltip;
|
||||
if (old_nodes[slot].cli > 0) {
|
||||
cli_moving[0] = old_nodes[slot].cli;
|
||||
nr_clients++;
|
||||
}
|
||||
*/
|
||||
|
||||
slot = old_zorder_info->first_screenlock;
|
||||
if (old_nodes[slot].cli > 0) {
|
||||
@@ -1794,7 +1822,7 @@ int __mg_do_change_topmost_layer (void)
|
||||
|
||||
for (i = 0; i < nr_clients; i++) {
|
||||
__mg_move_client_to_layer (mgClients + cli_moving[i],
|
||||
mgTopmostLayer);
|
||||
mgTopmostLayer, FALSE);
|
||||
|
||||
__mg_send2client (&msg, mgClients + cli_moving[i]);
|
||||
}
|
||||
@@ -2545,17 +2573,56 @@ static int dskSetWindowMask (HWND pWin, const WINMASKINFO* mask_info)
|
||||
}
|
||||
|
||||
/* Since 5.0.0 */
|
||||
BOOL __mg_move_client_to_layer (MG_Client* client, MG_Layer* dst_layer)
|
||||
BOOL __mg_move_client_to_layer (MG_Client* client, MG_Layer* dst_layer,
|
||||
BOOL copy_special)
|
||||
{
|
||||
ZORDERINFO *src_zi, *dst_zi;
|
||||
ZORDERNODE *src_nodes;
|
||||
ZORDERNODE *src_nodes, *dst_nodes;
|
||||
int cli = client - mgClients;
|
||||
int next, from = 0;
|
||||
int slot, next, from = 0;
|
||||
int nr_moving = 0, nr_free;
|
||||
|
||||
src_zi = (ZORDERINFO*)client->layer->zorder_info;
|
||||
src_nodes = GET_ZORDERNODE(src_zi);
|
||||
|
||||
dst_zi = (ZORDERINFO*)dst_layer->zorder_info;
|
||||
dst_nodes = GET_ZORDERNODE(dst_zi);
|
||||
|
||||
if (copy_special) {
|
||||
if (src_zi->first_screenlock > 0 &&
|
||||
src_nodes [src_zi->first_screenlock].cli == cli) {
|
||||
slot = src_zi->first_screenlock;
|
||||
for (; slot > 0; slot = src_nodes [slot].next) {
|
||||
memcpy (dst_nodes + slot, src_nodes + slot, sizeof(ZORDERNODE));
|
||||
}
|
||||
|
||||
dst_zi->first_screenlock = src_zi->first_screenlock;
|
||||
dst_zi->nr_screenlocks = src_zi->nr_screenlocks;
|
||||
}
|
||||
|
||||
if (src_zi->first_docker > 0 &&
|
||||
src_nodes [src_zi->first_docker].cli == cli) {
|
||||
slot = src_zi->first_docker;
|
||||
for (; slot > 0; slot = src_nodes [slot].next) {
|
||||
memcpy (dst_nodes + slot, src_nodes + slot, sizeof(ZORDERNODE));
|
||||
}
|
||||
|
||||
dst_zi->first_docker = src_zi->first_docker;
|
||||
dst_zi->nr_dockers = src_zi->nr_dockers;
|
||||
}
|
||||
|
||||
if (src_zi->first_launcher > 0 &&
|
||||
src_nodes [src_zi->first_launcher].cli == cli) {
|
||||
slot = src_zi->first_launcher;
|
||||
for (; slot > 0; slot = src_nodes [slot].next) {
|
||||
memcpy (dst_nodes + slot, src_nodes + slot, sizeof(ZORDERNODE));
|
||||
}
|
||||
|
||||
dst_zi->first_launcher = src_zi->first_launcher;
|
||||
dst_zi->nr_launchers = src_zi->nr_launchers;
|
||||
}
|
||||
}
|
||||
|
||||
/* number of general znodes of the client */
|
||||
do {
|
||||
if ((next = __kernel_get_next_znode (src_zi, from)) <= 0)
|
||||
@@ -2563,7 +2630,7 @@ BOOL __mg_move_client_to_layer (MG_Client* client, MG_Layer* dst_layer)
|
||||
|
||||
if (src_nodes [next].cli == cli) {
|
||||
DWORD type = src_nodes [next].flags & ZOF_TYPE_MASK;
|
||||
if (IS_TYPE_GENERAL (type)) { // do not count special znodes
|
||||
if (IS_TYPE_GENERAL (type)) { // do not handle special znodes
|
||||
nr_moving++;
|
||||
}
|
||||
}
|
||||
@@ -2572,7 +2639,6 @@ BOOL __mg_move_client_to_layer (MG_Client* client, MG_Layer* dst_layer)
|
||||
} while (1);
|
||||
|
||||
/* check free slots */
|
||||
dst_zi = (ZORDERINFO*)dst_layer->zorder_info;
|
||||
nr_free = MAX_NR_GENERAL_ZNODES (dst_zi);
|
||||
nr_free -= NR_GENERAL_ZNODES(dst_zi);
|
||||
if (nr_free < nr_moving) {
|
||||
@@ -2581,27 +2647,33 @@ BOOL __mg_move_client_to_layer (MG_Client* client, MG_Layer* dst_layer)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* nr znodes of the client */
|
||||
/* move general znodes of the client */
|
||||
do {
|
||||
if ((next = __kernel_get_next_znode (src_zi, from)) <= 0)
|
||||
break;
|
||||
|
||||
if (src_nodes [next].cli == cli) {
|
||||
AllocZOrderNodeEx (dst_zi, cli,
|
||||
src_nodes [next].hwnd,
|
||||
src_nodes [next].main_win,
|
||||
src_nodes [next].flags,
|
||||
&src_nodes [next].rc,
|
||||
src_nodes [next].caption,
|
||||
DWORD type = src_nodes [next].flags & ZOF_TYPE_MASK;
|
||||
if (IS_TYPE_GENERAL (type)) {
|
||||
AllocZOrderNodeEx (dst_zi, cli,
|
||||
src_nodes [next].hwnd,
|
||||
src_nodes [next].main_win,
|
||||
src_nodes [next].flags,
|
||||
&src_nodes [next].rc,
|
||||
src_nodes [next].caption,
|
||||
#ifdef _MGSCHEMA_COMPOSITING
|
||||
src_nodes [next].mem_dc,
|
||||
src_nodes [next].ct,
|
||||
src_nodes [next].ct_arg
|
||||
src_nodes [next].mem_dc,
|
||||
src_nodes [next].ct,
|
||||
src_nodes [next].ct_arg,
|
||||
#else
|
||||
HDC_INVALID, CT_OPAQUE, 0
|
||||
HDC_INVALID, CT_OPAQUE, 0,
|
||||
#endif
|
||||
);
|
||||
FreeZOrderNodeEx (src_zi, next, NULL);
|
||||
src_nodes [next].idx_mask_rect,
|
||||
src_nodes [next].priv_data
|
||||
);
|
||||
|
||||
FreeZOrderNodeEx (src_zi, next, NULL, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
from = next;
|
||||
@@ -4627,7 +4699,7 @@ BOOL GUIAPI ServerGetWinZNodeRegion (MG_Layer* layer, int idx_znode,
|
||||
|
||||
nr_mask_rects = 0;
|
||||
nodes = GET_ZORDERNODE(zi);
|
||||
firstmaskrect = GET_MASKRECT(zi);
|
||||
firstmaskrect = GET_MASKRECT(__mg_def_zorder_info);
|
||||
idx = nodes [idx_znode].idx_mask_rect;
|
||||
|
||||
while (idx) {
|
||||
|
||||
@@ -113,7 +113,8 @@ BOOL mg_InitDesktop (void)
|
||||
/*
|
||||
* Init ZOrderInfo here.
|
||||
*/
|
||||
ret = __kernel_alloc_z_order_info (DEF_NR_TOPMOSTS, DEF_NR_NORMALS);
|
||||
ret = __kernel_alloc_z_order_info (DEF_NR_TOPMOSTS, DEF_NR_NORMALS,
|
||||
TRUE);
|
||||
if (ret < 0) {
|
||||
_WRN_PRINTF ("KERNEL>Desktop: Can not initialize ZOrderInfo!\n");
|
||||
return FALSE;
|
||||
|
||||
@@ -112,7 +112,8 @@ BOOL mg_InitDesktop (void)
|
||||
/*
|
||||
* Init ZOrderInfo here.
|
||||
*/
|
||||
ret = __kernel_alloc_z_order_info (DEF_NR_TOPMOSTS, DEF_NR_NORMALS);
|
||||
ret = __kernel_alloc_z_order_info (DEF_NR_TOPMOSTS, DEF_NR_NORMALS,
|
||||
TRUE);
|
||||
if (ret < 0) {
|
||||
_WRN_PRINTF ("KERNEL>Desktop: Can not initialize ZOrderInfo!\n");
|
||||
return FALSE;
|
||||
|
||||
+35
-30
@@ -55,6 +55,7 @@
|
||||
# include "../sysres/license/c_files/00_minigui.dat.c"
|
||||
#endif
|
||||
|
||||
ZORDERINFO* __mg_def_zorder_info;
|
||||
ZORDERINFO* __mg_zorder_info;
|
||||
|
||||
/* pointer to desktop window */
|
||||
@@ -162,7 +163,7 @@ static BOOL subtract_rgn_by_node (PCLIPRGN region, const ZORDERINFO* zi,
|
||||
int idx, x, y;
|
||||
RECT tmprc={0};
|
||||
|
||||
firstmaskrect = GET_MASKRECT(zi);
|
||||
firstmaskrect = GET_MASKRECT(__mg_def_zorder_info);
|
||||
idx = node->idx_mask_rect;
|
||||
/* clip all mask rect */
|
||||
while(idx) {
|
||||
@@ -212,7 +213,7 @@ static int get_znode_mask_bound (int cli, int idx_znode, RECT* rc_bound)
|
||||
|
||||
SetRect (rc_bound, 0, 0, 0, 0);
|
||||
|
||||
firstmaskrect = GET_MASKRECT (zi);
|
||||
firstmaskrect = GET_MASKRECT(__mg_def_zorder_info);
|
||||
idx = node->idx_mask_rect;
|
||||
while (idx) {
|
||||
maskrect = firstmaskrect + idx;
|
||||
@@ -248,7 +249,7 @@ static int pt_in_maskrect (const ZORDERINFO* zi,
|
||||
cx = x - nodes->rc.left;
|
||||
cy = y - nodes->rc.top;
|
||||
|
||||
firstmaskrect = GET_MASKRECT(zi);
|
||||
firstmaskrect = GET_MASKRECT(__mg_def_zorder_info);
|
||||
while(idx != 0) {
|
||||
maskrect = firstmaskrect + idx;
|
||||
SetRect (&tmprc, maskrect->left, maskrect->top,
|
||||
@@ -306,11 +307,11 @@ static void clean_znode_maskrect (ZORDERINFO* zi, ZORDERNODE* nodes,
|
||||
int idx, tmp;
|
||||
MASKRECT *first;
|
||||
|
||||
first = GET_MASKRECT(zi);
|
||||
first = GET_MASKRECT(__mg_def_zorder_info);
|
||||
idx = nodes [idx_znode].idx_mask_rect;
|
||||
|
||||
while (idx) {
|
||||
__mg_slot_clear_use((unsigned char*)GET_MASKRECT_USAGEBMP(zi), idx);
|
||||
__mg_slot_clear_use(GET_MASKRECT_USAGEBMP(__mg_def_zorder_info), idx);
|
||||
(first+idx)->prev = 0;
|
||||
tmp = (first+idx)->next;
|
||||
(first+idx)->next = 0;
|
||||
@@ -556,7 +557,7 @@ static BOOL _cb_exclude_rc (void* context,
|
||||
|
||||
if (node->idx_mask_rect != 0) {
|
||||
int idx = node->idx_mask_rect;
|
||||
MASKRECT *first = GET_MASKRECT(zi);
|
||||
MASKRECT *first = GET_MASKRECT(__mg_def_zorder_info);
|
||||
int x, y;
|
||||
RECT rc;
|
||||
|
||||
@@ -1990,20 +1991,20 @@ static int alloc_mask_rects_for_round_corners (ZORDERINFO* zi,
|
||||
|
||||
/* if have enough mask rect */
|
||||
if (rc_idx >
|
||||
__mg_get_nr_idle_slots ((unsigned char*)GET_MASKRECT_USAGEBMP(zi),
|
||||
zi->size_maskrect_usage_bmp)) {
|
||||
__mg_get_nr_idle_slots (GET_MASKRECT_USAGEBMP(__mg_def_zorder_info),
|
||||
__mg_def_zorder_info->size_maskrect_usage_bmp)) {
|
||||
free (roundrc);
|
||||
return -1;
|
||||
}
|
||||
|
||||
firstmaskrect = GET_MASKRECT(zi);
|
||||
firstmaskrect = GET_MASKRECT(__mg_def_zorder_info);
|
||||
|
||||
/* allocate space*/
|
||||
idx = 0;
|
||||
for (i = 0; i < rc_idx; i++) {
|
||||
free_slot = __mg_lookfor_unused_slot (
|
||||
(unsigned char*)GET_MASKRECT_USAGEBMP(zi),
|
||||
zi->size_maskrect_usage_bmp, 1);
|
||||
GET_MASKRECT_USAGEBMP(__mg_def_zorder_info),
|
||||
__mg_def_zorder_info->size_maskrect_usage_bmp, 1);
|
||||
if (free_slot == -1) {
|
||||
_WRN_PRINTF ("KERNEL: __mg_lookfor_unused_slot failed\n");
|
||||
return -1;
|
||||
@@ -2057,7 +2058,7 @@ static inline int validate_compositing_type (DWORD flags, int type)
|
||||
|
||||
static int AllocZOrderNodeEx (ZORDERINFO* zi, int cli, HWND hwnd, HWND main_win,
|
||||
DWORD flags, const RECT *rc, const char *caption,
|
||||
HDC mem_dc, int ct, DWORD ct_arg)
|
||||
HDC mem_dc, int ct, DWORD ct_arg, int idx_mask_rect, void* priv_data)
|
||||
{
|
||||
DWORD type = flags & ZOF_TYPE_MASK;
|
||||
int *first = NULL, *nr_nodes = NULL;
|
||||
@@ -2069,6 +2070,7 @@ static int AllocZOrderNodeEx (ZORDERINFO* zi, int cli, HWND hwnd, HWND main_win,
|
||||
/* Since 5.0.0: check special znode type first for MiniGUI-Processes */
|
||||
#ifdef _MGRM_PROCESSES
|
||||
switch (type) {
|
||||
/* Since 5.0.6: tooltips are not special znodes
|
||||
case ZOF_TYPE_TOOLTIP:
|
||||
if (zi->first_tooltip > 0 &&
|
||||
nodes [zi->first_tooltip].cli != cli) {
|
||||
@@ -2076,6 +2078,7 @@ static int AllocZOrderNodeEx (ZORDERINFO* zi, int cli, HWND hwnd, HWND main_win,
|
||||
flags |= ZOF_TYPE_HIGHER;
|
||||
}
|
||||
break;
|
||||
*/
|
||||
|
||||
case ZOF_TYPE_GLOBAL:
|
||||
if (cli != 0) {
|
||||
@@ -2236,11 +2239,11 @@ static int AllocZOrderNodeEx (ZORDERINFO* zi, int cli, HWND hwnd, HWND main_win,
|
||||
nodes [free_slot].dirty_rc.right = 0;
|
||||
nodes [free_slot].dirty_rc.bottom = 0;
|
||||
#endif
|
||||
nodes [free_slot].idx_mask_rect = 0;
|
||||
nodes [free_slot].priv_data = NULL;
|
||||
nodes [free_slot].idx_mask_rect = idx_mask_rect;
|
||||
nodes [free_slot].priv_data = priv_data;
|
||||
|
||||
#ifndef _MGSCHEMA_COMPOSITING
|
||||
if (flags & ZOF_TW_TROUNDCNS || flags & ZOF_TW_BROUNDCNS) {
|
||||
if (idx_mask_rect == 0 && (flags & ZOF_TW_TROUNDCNS || flags & ZOF_TW_BROUNDCNS)) {
|
||||
RECT cli_rect;
|
||||
|
||||
SetRect (&cli_rect, 0, 0, RECTW(nodes[free_slot].rc),
|
||||
@@ -2341,10 +2344,10 @@ static inline int AllocZOrderNode (int cli, HWND hwnd, HWND main_win,
|
||||
HDC mem_dc, int ct, DWORD ct_arg)
|
||||
{
|
||||
return AllocZOrderNodeEx (get_zorder_info(cli), cli, hwnd, main_win,
|
||||
flags, rc, caption, mem_dc, ct, ct_arg);
|
||||
flags, rc, caption, mem_dc, ct, ct_arg, 0, NULL);
|
||||
}
|
||||
|
||||
static int FreeZOrderNodeEx (ZORDERINFO* zi, int idx_znode, HDC* memdc)
|
||||
static int FreeZOrderNodeEx (ZORDERINFO* zi, int idx_znode, HDC* memdc, BOOL clean_maskrc)
|
||||
{
|
||||
DWORD flags, type;
|
||||
RECT rc;
|
||||
@@ -2395,7 +2398,7 @@ static int FreeZOrderNodeEx (ZORDERINFO* zi, int idx_znode, HDC* memdc)
|
||||
}
|
||||
|
||||
/* Free round corners mask rect. */
|
||||
if (flags & ZOF_TW_TROUNDCNS || flags & ZOF_TW_BROUNDCNS) {
|
||||
if (clean_maskrc && nodes[idx_znode].idx_mask_rect) {
|
||||
clean_znode_maskrect (zi, nodes, idx_znode);
|
||||
}
|
||||
|
||||
@@ -2487,7 +2490,7 @@ static int FreeZOrderNodeEx (ZORDERINFO* zi, int idx_znode, HDC* memdc)
|
||||
|
||||
static inline int FreeZOrderNode (int cli, int idx_znode, HDC* memdc)
|
||||
{
|
||||
return FreeZOrderNodeEx (get_zorder_info(cli), idx_znode, memdc);
|
||||
return FreeZOrderNodeEx (get_zorder_info(cli), idx_znode, memdc, TRUE);
|
||||
}
|
||||
|
||||
static DWORD get_znode_flags_from_style (PMAINWIN pWin)
|
||||
@@ -2596,7 +2599,7 @@ static int AllocZOrderMaskRect (int cli, int idx_znode,
|
||||
lock_zi_for_change (zi);
|
||||
|
||||
nodes = GET_ZORDERNODE(zi);
|
||||
firstmaskrect = GET_MASKRECT(zi);
|
||||
firstmaskrect = GET_MASKRECT(__mg_def_zorder_info);
|
||||
|
||||
/*get mask rect number*/
|
||||
idx = nodes[idx_znode].idx_mask_rect;
|
||||
@@ -2609,8 +2612,8 @@ static int AllocZOrderMaskRect (int cli, int idx_znode,
|
||||
if (nr_rc > old_num) {
|
||||
/* check the number of mask rect if enough */
|
||||
int idle =
|
||||
__mg_get_nr_idle_slots ((unsigned char*)GET_MASKRECT_USAGEBMP(zi),
|
||||
zi->size_maskrect_usage_bmp);
|
||||
__mg_get_nr_idle_slots (GET_MASKRECT_USAGEBMP(__mg_def_zorder_info),
|
||||
__mg_def_zorder_info->size_maskrect_usage_bmp);
|
||||
if (idle < nr_rc - old_num) {
|
||||
unlock_zi_for_change (zi);
|
||||
return -1;
|
||||
@@ -2620,8 +2623,8 @@ static int AllocZOrderMaskRect (int cli, int idx_znode,
|
||||
idx = nodes[idx_znode].idx_mask_rect;
|
||||
for (i = 0; i < nr_rc - old_num; i++) {
|
||||
free_slot = __mg_lookfor_unused_slot (
|
||||
(unsigned char*)GET_MASKRECT_USAGEBMP(zi),
|
||||
zi->size_maskrect_usage_bmp, 1);
|
||||
GET_MASKRECT_USAGEBMP(__mg_def_zorder_info),
|
||||
__mg_def_zorder_info->size_maskrect_usage_bmp, 1);
|
||||
if (free_slot == -1) {
|
||||
unlock_zi_for_change (zi);
|
||||
return -1;
|
||||
@@ -2641,7 +2644,7 @@ static int AllocZOrderMaskRect (int cli, int idx_znode,
|
||||
else {
|
||||
for(i =0; i < old_num-nr_rc; i++) {
|
||||
idx = nodes[idx_znode].idx_mask_rect;
|
||||
__mg_slot_clear_use((unsigned char*)GET_MASKRECT_USAGEBMP(zi), idx);
|
||||
__mg_slot_clear_use(GET_MASKRECT_USAGEBMP(__mg_def_zorder_info), idx);
|
||||
idx = ((MASKRECT *)(firstmaskrect+idx))->next;
|
||||
}
|
||||
}
|
||||
@@ -3198,10 +3201,10 @@ static int dskMoveWindow (int cli, int idx_znode, HDC memdc, const RECT* rcWin)
|
||||
if (nodes[idx_znode].idx_mask_rect != 0) {
|
||||
|
||||
idx = nodes[idx_znode].idx_mask_rect;
|
||||
firstmaskrect = GET_MASKRECT(zi);
|
||||
firstmaskrect = GET_MASKRECT(__mg_def_zorder_info);
|
||||
|
||||
while (idx) {
|
||||
__mg_slot_clear_use((unsigned char*)GET_MASKRECT_USAGEBMP(zi),
|
||||
__mg_slot_clear_use(GET_MASKRECT_USAGEBMP(__mg_def_zorder_info),
|
||||
idx);
|
||||
idx = ((MASKRECT *)(firstmaskrect+idx))->next;
|
||||
}
|
||||
@@ -3313,7 +3316,7 @@ static int dskMoveWindow (int cli, int idx_znode, HDC memdc, const RECT* rcWin)
|
||||
SelectClipRect (HDC_SCREEN_SYS, rcWin);
|
||||
}
|
||||
else {
|
||||
firstmaskrect = GET_MASKRECT(zi);
|
||||
firstmaskrect = GET_MASKRECT(__mg_def_zorder_info);
|
||||
idx = nodes [idx_znode].idx_mask_rect;
|
||||
|
||||
while (idx) {
|
||||
@@ -3405,7 +3408,7 @@ static int dskMoveWindow (int cli, int idx_znode, HDC memdc, const RECT* rcWin)
|
||||
else {
|
||||
RECT rc;
|
||||
GetWindowRect(nodes [slot].hwnd, &rc);
|
||||
firstmaskrect = GET_MASKRECT(zi);
|
||||
firstmaskrect = GET_MASKRECT(__mg_def_zorder_info);
|
||||
idx = nodes [slot].idx_mask_rect;
|
||||
while (idx) {
|
||||
maskrect = firstmaskrect + idx;
|
||||
@@ -3979,7 +3982,7 @@ int __kernel_get_window_region (HWND pWin, CLIPRGN* region)
|
||||
|
||||
nr_mask_rects = 0;
|
||||
nodes = GET_ZORDERNODE(zi);
|
||||
maskrect = GET_MASKRECT(zi);
|
||||
maskrect = GET_MASKRECT(__mg_def_zorder_info);
|
||||
idx = nodes[idx_znode].idx_mask_rect;
|
||||
while (idx) {
|
||||
rc.left = maskrect->left;
|
||||
@@ -4375,12 +4378,14 @@ static int dskCalculateDefaultPosition (int cli, CALCPOSINFO* info)
|
||||
#ifdef _MGRM_PROCESSES
|
||||
/* check the special types */
|
||||
switch (zt_type) {
|
||||
/* Since 5.0.6: tooltips are not special znodes
|
||||
case ZOF_TYPE_TOOLTIP:
|
||||
if (zi->first_tooltip > 0 &&
|
||||
nodes [zi->first_tooltip].cli != cli) {
|
||||
zt_type = ZOF_TYPE_HIGHER;
|
||||
}
|
||||
break;
|
||||
*/
|
||||
|
||||
case ZOF_TYPE_GLOBAL:
|
||||
if (cli != 0) {
|
||||
|
||||
+7
-132
@@ -100,7 +100,7 @@ inline static key_t get_layer_shm_key (void)
|
||||
}
|
||||
#endif /* defined _MGRM_PROCESSES */
|
||||
|
||||
int __kernel_alloc_z_order_info (int nr_topmosts, int nr_normals)
|
||||
int __kernel_alloc_z_order_info (int nr_topmosts, int nr_normals, BOOL with_maskrc_heap)
|
||||
{
|
||||
#ifdef _MGRM_PROCESSES
|
||||
int size_usage_bmp = SIZE_USAGE_BMP (SHAREDRES_NR_GLOBALS,
|
||||
@@ -125,8 +125,8 @@ int __kernel_alloc_z_order_info (int nr_topmosts, int nr_normals)
|
||||
nr_normals + /* for the normal windows */
|
||||
DEF_NR_LAUNCHERS + /* for the launcher ones */
|
||||
NR_FIXED_ZNODES) + /* for the fixed znodes */
|
||||
SIZE_MASKRECT_USAGE_BMP +
|
||||
sizeof (MASKRECT) * DEF_NR_MASKRECT,
|
||||
with_maskrc_heap ? (SIZE_MASKRECT_USAGE_BMP +
|
||||
sizeof (MASKRECT) * DEF_NR_MASKRECTS) : 0,
|
||||
SHM_PARAM | IPC_CREAT | IPC_EXCL);
|
||||
|
||||
return zorder_shmid;
|
||||
@@ -150,7 +150,7 @@ int __kernel_alloc_z_order_info (int nr_topmosts, int nr_normals)
|
||||
DEF_NR_LAUNCHERS + /* for the launcher ones */
|
||||
NR_FIXED_ZNODES) + /* for the fixed znodes */
|
||||
SIZE_MASKRECT_USAGE_BMP +
|
||||
sizeof (MASKRECT) * DEF_NR_MASKRECT);
|
||||
sizeof (MASKRECT) * DEF_NR_MASKRECTS);
|
||||
|
||||
if (!__mg_zorder_info) {
|
||||
_MG_PRINTF ("KERNEL>ZOrder: calloc zorderinfo failure. \n");
|
||||
@@ -214,6 +214,8 @@ int __kernel_alloc_z_order_info (int nr_topmosts, int nr_normals)
|
||||
__mg_slot_set_use ((unsigned char*)(__mg_zorder_info + 1), 0);
|
||||
__mg_slot_set_use ((unsigned char*)(maskrect_usage_bmp), 0);
|
||||
|
||||
__mg_def_zorder_info = __mg_zorder_info;
|
||||
|
||||
#if 0 /* deprecated code */
|
||||
/* Since 5.0.0; allocate znodes for other fixed main windows */
|
||||
{
|
||||
@@ -270,134 +272,7 @@ void __kernel_free_z_order_info (ZORDERINFO* zi)
|
||||
#endif
|
||||
free (zi);
|
||||
__mg_zorder_info = NULL;
|
||||
__mg_def_zorder_info = NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if 0 /* deprecated code */
|
||||
#if IS_SHAREDFB_SCHEMA_PROCS
|
||||
|
||||
int __kernel_alloc_z_order_info (int nr_topmosts, int nr_normals)
|
||||
{
|
||||
key_t shm_key;
|
||||
int zorder_shmid;
|
||||
|
||||
if ((shm_key = get_layer_shm_key ()) == -1) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
zorder_shmid = shmget (shm_key,
|
||||
sizeof (ZORDERINFO) + SIZE_USAGE_BMP +
|
||||
sizeof (ZORDERNODE) *
|
||||
(DEF_NR_POPUPMENUS + /* for the popup menus */
|
||||
SHAREDRES_NR_GLOBALS + /* for the global windows */
|
||||
nr_topmosts + /* for the topmost windows */
|
||||
nr_normals)+ /* for the normal windows */
|
||||
SIZE_MASKRECT_USAGE_BMP +
|
||||
sizeof (MASKRECT) * DEF_NR_MASKRECT,
|
||||
SHM_PARAM | IPC_CREAT | IPC_EXCL);
|
||||
|
||||
return zorder_shmid;
|
||||
}
|
||||
|
||||
#else /* not IS_SHAREDFB_SCHEMA_PROCS */
|
||||
|
||||
ZORDERINFO* __kernel_alloc_z_order_info (int nr_topmosts, int nr_normals)
|
||||
{
|
||||
ZORDERINFO* zi;
|
||||
ZORDERNODE* znodes;
|
||||
void* maskrect_usage_bmp;
|
||||
|
||||
zi = (PZORDERINFO) calloc (1,
|
||||
sizeof (ZORDERINFO) + SIZE_USAGE_BMP +
|
||||
sizeof (ZORDERNODE) *
|
||||
(DEF_NR_POPUPMENUS + /* for the popup menus */
|
||||
SHAREDRES_NR_GLOBALS + /* for global window: 0 */
|
||||
nr_topmosts + /* for the topmost windows */
|
||||
nr_normals)+ /* for the normal windows */
|
||||
SIZE_MASKRECT_USAGE_BMP +
|
||||
sizeof (MASKRECT) * DEF_NR_MASKRECT);
|
||||
|
||||
if (!zi) {
|
||||
_WRN_PRINTF ("KERNEL>ZOrder: calloc zorderinfo failure. \n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
zi->size_usage_bmp = SIZE_USAGE_BMP;
|
||||
zi->size_maskrect_usage_bmp = SIZE_MASKRECT_USAGE_BMP;
|
||||
|
||||
zi->max_nr_popupmenus = DEF_NR_POPUPMENUS;
|
||||
zi->max_nr_globals = 0;
|
||||
zi->max_nr_topmosts = nr_topmosts;
|
||||
zi->max_nr_normals = nr_normals;
|
||||
|
||||
zi->nr_popupmenus = 0;
|
||||
zi->nr_globals = 0;
|
||||
zi->nr_topmosts = 0;
|
||||
zi->nr_normals = 0;
|
||||
|
||||
zi->first_global = 0;
|
||||
zi->first_topmost = 0;
|
||||
zi->first_normal = 0;
|
||||
|
||||
zi->active_win = 0;
|
||||
|
||||
zi->cli_trackmenu = -1;
|
||||
zi->ptmi_in_cli = (HWND)-1;
|
||||
|
||||
/* Set zorder node usage map. */
|
||||
memset (zi + 1, 0xFF, SIZE_USAGE_BMP);
|
||||
|
||||
/* Set zorder mask rect usage map. */
|
||||
maskrect_usage_bmp = GET_MASKRECT_USAGEBMP(zi);
|
||||
memset (maskrect_usage_bmp, 0xFF,
|
||||
zi->size_maskrect_usage_bmp);
|
||||
|
||||
/* init z-order node for desktop */
|
||||
znodes = GET_ZORDERNODE(zi);
|
||||
|
||||
znodes [0].flags = ZOF_TYPE_DESKTOP | ZOF_VISIBLE;
|
||||
znodes [0].rc = g_rcScr;
|
||||
znodes [0].age = 0;
|
||||
znodes [0].cli = 0;
|
||||
znodes [0].hwnd = HWND_DESKTOP;
|
||||
znodes [0].next = 0;
|
||||
znodes [0].prev = 0;
|
||||
znodes [0].idx_mask_rect = 0;
|
||||
|
||||
__mg_slot_set_use ((unsigned char*)(zi + 1), 0);
|
||||
__mg_slot_set_use ((unsigned char*)(maskrect_usage_bmp), 0);
|
||||
|
||||
#ifdef _MGRM_THREADS
|
||||
#ifndef __NOUNIX__
|
||||
pthread_rwlock_init(&zi->rwlock, NULL);
|
||||
#else
|
||||
pthread_mutex_init(&zi->rwlock, NULL);
|
||||
#endif
|
||||
#endif /* _MGRM_THREADS */
|
||||
|
||||
return zi;
|
||||
}
|
||||
|
||||
#endif /* not IS_SHAREDFB_SCHEMA_PROCS */
|
||||
|
||||
void __kernel_free_z_order_info (ZORDERINFO* zi)
|
||||
{
|
||||
#if IS_SHAREDFB_SCHEMA_PROCS
|
||||
if (shmdt (zi) < 0)
|
||||
perror ("Detaches shared zorder nodes");
|
||||
#else /* not IS_SHAREDFB_SCHEMA_PROCS */
|
||||
|
||||
#ifdef _MGRM_THREADS
|
||||
#ifndef __NOUNIX__
|
||||
pthread_rwlock_destroy(&zi->rwlock);
|
||||
#else
|
||||
pthread_mutex_destroy(&zi->rwlock);
|
||||
#endif
|
||||
#endif /* _MGRM_THREADS */
|
||||
|
||||
free (zi);
|
||||
#endif /* not IS_SHAREDFB_SCHEMA_PROCS */
|
||||
}
|
||||
|
||||
#endif /* deprecated code */
|
||||
|
||||
|
||||
+32
-22
@@ -85,7 +85,7 @@ static int sg_nr_layers = 0;
|
||||
static unsigned char sem_usage [(MAX_NR_LAYERS + 7)/8];
|
||||
|
||||
static BOOL do_alloc_layer (MG_Layer* layer, const char* name,
|
||||
int nr_topmosts, int nr_normals)
|
||||
int nr_topmosts, int nr_normals, BOOL with_maskrc_heap)
|
||||
{
|
||||
ZORDERINFO* zi;
|
||||
ZORDERNODE* znodes;
|
||||
@@ -98,7 +98,8 @@ static BOOL do_alloc_layer (MG_Layer* layer, const char* name,
|
||||
size_usage_bmp = SIZE_USAGE_BMP (SHAREDRES_NR_GLOBALS,
|
||||
nr_topmosts, nr_normals);
|
||||
|
||||
layer->zorder_shmid = __kernel_alloc_z_order_info (nr_topmosts, nr_normals);
|
||||
layer->zorder_shmid = __kernel_alloc_z_order_info (nr_topmosts,
|
||||
nr_normals, with_maskrc_heap);
|
||||
|
||||
if (layer->zorder_shmid == -1)
|
||||
return FALSE;
|
||||
@@ -111,18 +112,17 @@ static BOOL do_alloc_layer (MG_Layer* layer, const char* name,
|
||||
if (shmctl (layer->zorder_shmid, IPC_RMID, NULL) < 0)
|
||||
return FALSE;
|
||||
|
||||
#if 0
|
||||
zi = __kernel_alloc_z_order_info (nr_topmosts, nr_normals);
|
||||
if (zi == NULL)
|
||||
return FALSE;
|
||||
#endif
|
||||
|
||||
strcpy (layer->name, name);
|
||||
|
||||
layer->zorder_info = zi;
|
||||
|
||||
zi->size_usage_bmp = size_usage_bmp;
|
||||
zi->size_maskrect_usage_bmp = SIZE_MASKRECT_USAGE_BMP;
|
||||
if (with_maskrc_heap) {
|
||||
zi->size_maskrect_usage_bmp = SIZE_MASKRECT_USAGE_BMP;
|
||||
}
|
||||
else {
|
||||
zi->size_maskrect_usage_bmp = 0;
|
||||
}
|
||||
|
||||
_DBG_PRINTF("size_zi:%lu, size_znode:%lu,"
|
||||
" size_usage_bmp:%d, size_maskrect_usage_bmp:%d\n",
|
||||
@@ -189,10 +189,15 @@ static BOOL do_alloc_layer (MG_Layer* layer, const char* name,
|
||||
}
|
||||
#endif /* deprectated code */
|
||||
|
||||
/* init usage bitmap. */
|
||||
memset (zi + 1, 0xFF, size_usage_bmp);
|
||||
/* get a unused mask rect slot. */
|
||||
maskrect_usage_bmp = GET_MASKRECT_USAGEBMP(zi);
|
||||
memset (maskrect_usage_bmp, 0xFF, zi->size_maskrect_usage_bmp);
|
||||
__mg_slot_set_use ((unsigned char*)(zi + 1), 0);
|
||||
|
||||
if (with_maskrc_heap) {
|
||||
maskrect_usage_bmp = GET_MASKRECT_USAGEBMP(zi);
|
||||
memset (maskrect_usage_bmp, 0xFF, zi->size_maskrect_usage_bmp);
|
||||
__mg_slot_set_use ((unsigned char*)(maskrect_usage_bmp), 0);
|
||||
}
|
||||
|
||||
/* init z-order node for desktop */
|
||||
znodes = GET_ZORDERNODE(zi);
|
||||
@@ -213,9 +218,6 @@ static BOOL do_alloc_layer (MG_Layer* layer, const char* name,
|
||||
znodes [0].idx_mask_rect = 0;
|
||||
znodes [0].priv_data = NULL;
|
||||
|
||||
__mg_slot_set_use ((unsigned char*)(zi + 1), 0);
|
||||
__mg_slot_set_use ((unsigned char*)(maskrect_usage_bmp), 0);
|
||||
|
||||
#if 0 /* deprecated code */
|
||||
/* Since 5.0.0; allocate znodes for other fixed main windows */
|
||||
{
|
||||
@@ -427,13 +429,15 @@ int __mg_init_layers ()
|
||||
|
||||
/* allocate the first layer for the default layer. */
|
||||
if (!do_alloc_layer (mgLayers, NAME_DEF_LAYER,
|
||||
SHAREDRES_DEF_NR_TOPMOSTS, SHAREDRES_DEF_NR_NORMALS)) {
|
||||
SHAREDRES_DEF_NR_TOPMOSTS, SHAREDRES_DEF_NR_NORMALS,
|
||||
TRUE)) {
|
||||
|
||||
free (mgLayers);
|
||||
mgLayers = NULL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
__mg_def_zorder_info = mgLayers->zorder_info;
|
||||
__mg_zorder_info = mgLayers->zorder_info;
|
||||
|
||||
return semid;
|
||||
@@ -456,6 +460,7 @@ void __mg_cleanup_layers (void)
|
||||
mgLayers = NULL;
|
||||
mgTopmostLayer = NULL;
|
||||
__mg_zorder_info = NULL;
|
||||
__mg_def_zorder_info = NULL;
|
||||
}
|
||||
|
||||
/* allocate a layer slot from the layer pool for the new layer */
|
||||
@@ -471,7 +476,7 @@ static MG_Layer* alloc_layer (const char* layer_name,
|
||||
if (!(new_layer = calloc (1, sizeof (MG_Layer))))
|
||||
return NULL;
|
||||
|
||||
if (!do_alloc_layer (new_layer, layer_name, nr_topmosts, nr_normals)) {
|
||||
if (!do_alloc_layer (new_layer, layer_name, nr_topmosts, nr_normals, FALSE)) {
|
||||
free (new_layer);
|
||||
return NULL;
|
||||
}
|
||||
@@ -556,10 +561,15 @@ static void do_client_join_layer (int cli,
|
||||
{
|
||||
MG_Layer* layer = (MG_Layer*)(joined_info->layer);
|
||||
MG_Client* new_client = mgClients + cli;
|
||||
MG_Layer* def_layer = __mg_find_layer_by_name (NAME_DEF_LAYER);
|
||||
|
||||
assert (def_layer);
|
||||
joined_info->def_zi_shmid = def_layer->zorder_shmid;
|
||||
|
||||
if (new_client->layer == layer) { /* duplicated calling of JoinLayer */
|
||||
|
||||
joined_info->cli_id = cli;
|
||||
joined_info->zo_shmid = layer->zorder_shmid;
|
||||
joined_info->zi_shmid = layer->zorder_shmid;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -582,7 +592,7 @@ static void do_client_join_layer (int cli,
|
||||
layer->cli_head = new_client;
|
||||
|
||||
joined_info->cli_id = cli;
|
||||
joined_info->zo_shmid = layer->zorder_shmid;
|
||||
joined_info->zi_shmid = layer->zorder_shmid;
|
||||
}
|
||||
|
||||
/* Join a client to a layer, the server side of JoinLayer */
|
||||
@@ -647,7 +657,7 @@ BOOL GUIAPI ServerSetTopmostLayer (MG_Layer* layer)
|
||||
DO_COMPSOR_OP_ARGS (on_layer_op, LCO_TOPMOST_CHANGED, mgTopmostLayer, NULL);
|
||||
|
||||
#ifndef _MGSCHEMA_COMPOSITING
|
||||
if (old_topmost && old_topmost->cli_head)
|
||||
if (old_topmost && old_topmost->cli_head) {
|
||||
SendMessage (HWND_DESKTOP, MSG_PAINT, 0, 0);
|
||||
}
|
||||
#endif
|
||||
@@ -680,7 +690,7 @@ MG_Layer* GUIAPI ServerCreateLayer (const char* layer_name,
|
||||
max_nr_topmosts = (max_nr_topmosts + 7) & ~0x07;
|
||||
max_nr_normals = (max_nr_normals + 7) & ~0x07;
|
||||
|
||||
if (!do_alloc_layer (new_layer, layer_name, max_nr_topmosts, max_nr_normals)) {
|
||||
if (!do_alloc_layer (new_layer, layer_name, max_nr_topmosts, max_nr_normals, 0)) {
|
||||
free (new_layer);
|
||||
return NULL;
|
||||
}
|
||||
@@ -1128,7 +1138,7 @@ BOOL GUIAPI ServerMoveClientToLayer (int cli, MG_Layer* dst_layer)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (__mg_move_client_to_layer (client, dst_layer)) {
|
||||
if (__mg_move_client_to_layer (client, dst_layer, TRUE)) {
|
||||
MSG msg = { HWND_DESKTOP,
|
||||
MSG_LAYERCHANGED, (WPARAM)dst_layer,
|
||||
(LPARAM)dst_layer->zorder_shmid, __mg_tick_counter };
|
||||
|
||||
@@ -334,7 +334,7 @@ static int move_to_layer (int cli, int clifd, void* buff, size_t len)
|
||||
if (!__mg_is_valid_layer (dst_layer))
|
||||
goto ret;
|
||||
|
||||
if (__mg_move_client_to_layer (mgClients + cli, dst_layer)) {
|
||||
if (__mg_move_client_to_layer (mgClients + cli, dst_layer, TRUE)) {
|
||||
moved_info.layer = dst_layer;
|
||||
moved_info.zo_shmid = dst_layer->zorder_shmid;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user