fix conditional compilation errors and tune

This commit is contained in:
Vincent Wei
2020-02-19 22:12:54 +08:00
parent d24788134f
commit ab1dbb767a
6 changed files with 41 additions and 17 deletions

View File

@@ -79,7 +79,7 @@
/* 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 one for fixed znodes
#define DEF_NR_GLOBALS 15 // reserve slots for fixed znodes
#define DEF_NR_SCREENLOCKS 8
#define DEF_NR_DOCKERS 8
#define DEF_NR_TOPMOSTS 16

View File

@@ -182,26 +182,36 @@ static int dskAddNewMainWindow (PMAINWIN pWin)
}
/* Since 5.0.0: handle window style if failed to allocate znode
for fixed ones */
for special main window */
if (pWin->dwExStyle & WS_EX_WINTYPE_MASK) {
ZORDERNODE* nodes = GET_ZORDERNODE(__mg_zorder_info);
pWin->dwExStyle &= ~WS_EX_WINTYPE_MASK;
switch (nodes [pWin->idx_znode].flags & ZOF_TYPE_MASK) {
case ZOF_TYPE_TOOLTIP:
pWin->dwExStyle |= WS_EX_WINTYPE_TOOLTIP;
break;
case ZOF_TYPE_GLOBAL:
pWin->dwExStyle |= WS_EX_WINTYPE_GLOBAL;
break;
case ZOF_TYPE_SCREENLOCK:
pWin->dwExStyle |= WS_EX_WINTYPE_SCREENLOCK;
break;
case ZOF_TYPE_DOCKER:
pWin->dwExStyle |= WS_EX_WINTYPE_DOCKER;
break;
case ZOF_TYPE_LAUNCHER:
pWin->dwExStyle |= WS_EX_WINTYPE_LAUNCHER;
break;
case ZOF_TYPE_TOPMOST:
pWin->dwExStyle |= WS_EX_WINTYPE_HIGHER;
pWin->dwExStyle |= WS_EX_TOPMOST;
break;
case ZOF_TYPE_NORMAL:
pWin->dwExStyle |= WS_EX_WINTYPE_NORMAL;
break;
case ZOF_TYPE_LAUNCHER:
pWin->dwExStyle |= WS_EX_WINTYPE_LAUNCHER;
break;
default:
assert(0);
break;
}
}
@@ -1871,7 +1881,7 @@ static int dskDesktopCommand (HMENU hDesktopMenu, int id)
else if (id == IDM_CLOSEALLWIN) {
PMAINWIN pWin;
for (level = 0; level < NR_ZORDER_LEVELS; level < 0) {
for (level = 0; level < NR_ZORDER_LEVELS; level++) {
slot = __mg_zorder_info->first_in_levels[level];
for (; slot > 0; slot = nodes[slot].next) {
pWin = (PMAINWIN)(nodes[slot].hwnd);

View File

@@ -2026,20 +2026,30 @@ static int dskAddNewMainWindow (PMAINWIN pWin, const COMPOSITINGINFO* ct_info)
pWin->dwExStyle &= ~WS_EX_WINTYPE_MASK;
switch (nodes [pWin->idx_znode].flags & ZOF_TYPE_MASK) {
case ZOF_TYPE_TOOLTIP:
pWin->dwExStyle |= WS_EX_WINTYPE_TOOLTIP;
break;
case ZOF_TYPE_GLOBAL:
pWin->dwExStyle |= WS_EX_WINTYPE_GLOBAL;
break;
case ZOF_TYPE_SCREENLOCK:
pWin->dwExStyle |= WS_EX_WINTYPE_SCREENLOCK;
break;
case ZOF_TYPE_DOCKER:
pWin->dwExStyle |= WS_EX_WINTYPE_DOCKER;
break;
case ZOF_TYPE_LAUNCHER:
pWin->dwExStyle |= WS_EX_WINTYPE_LAUNCHER;
break;
case ZOF_TYPE_TOPMOST:
pWin->dwExStyle |= WS_EX_WINTYPE_HIGHER;
pWin->dwExStyle |= WS_EX_TOPMOST;
break;
case ZOF_TYPE_NORMAL:
pWin->dwExStyle |= WS_EX_WINTYPE_NORMAL;
break;
case ZOF_TYPE_LAUNCHER:
pWin->dwExStyle |= WS_EX_WINTYPE_LAUNCHER;
break;
default:
assert(0);
break;
}
}

View File

@@ -2165,7 +2165,7 @@ static int AllocZOrderNodeEx (ZORDERINFO* zi, int cli, HWND hwnd, HWND main_win,
if (zi->first_launcher > 0 &&
nodes [zi->first_launcher].cli != cli) {
flags &= ~ZOF_TYPE_MASK;
flags |= ZOF_TYPE_TOPMOST;
flags |= ZOF_TYPE_NORMAL;
}
break;
@@ -2263,10 +2263,8 @@ static int AllocZOrderNodeEx (ZORDERINFO* zi, int cli, HWND hwnd, HWND main_win,
/* lock zi for change */
lock_zi_for_change (zi);
/* the slot must be larger than zero */
if (free_slot == -1) {
/* Since 5.0.0: tune code to avoid potential errors */
/* Since 5.0.0: tune code to avoid potential errors */
{
int len_bmp_specials = LEN_USAGE_BMP_SPECIAL(zi);
if (IS_TYPE_SPECIAL (type)) {
@@ -2295,7 +2293,7 @@ static int AllocZOrderNodeEx (ZORDERINFO* zi, int cli, HWND hwnd, HWND main_win,
if (-1 == free_slot) {
/* unlock zorderinfo for change. */
unlock_zi_for_change (zi);
_ERR_PRINTF ("Cann't find unused slot. \n");
_WRN_PRINTF ("cannot allocate slot for new znode\n");
return -1;
}
@@ -2325,7 +2323,7 @@ static int AllocZOrderNodeEx (ZORDERINFO* zi, int cli, HWND hwnd, HWND main_win,
if (flags & ZOF_TW_TROUNDCNS || flags & ZOF_TW_BROUNDCNS) {
RECT cli_rect;
SetRect(&cli_rect, 0, 0, RECTW(nodes[free_slot].rc),
SetRect (&cli_rect, 0, 0, RECTW(nodes[free_slot].rc),
RECTH(nodes[free_slot].rc));
alloc_mask_rects_for_round_corners (__mg_zorder_info,
&nodes[free_slot], flags, &cli_rect);

View File

@@ -90,7 +90,12 @@ static BOOL do_alloc_layer (MG_Layer* layer, const char* name,
ZORDERINFO* zi;
ZORDERNODE* znodes;
void* maskrect_usage_bmp;
int size_usage_bmp = SIZE_USAGE_BMP (SHAREDRES_NR_GLOBALS,
int size_usage_bmp;
nr_topmosts = (nr_topmosts + 7) & ~0x07;
nr_normals = (nr_normals + 7) & ~0x07;
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);

View File

@@ -284,6 +284,7 @@ BOOL GUIAPI ServerStartup (int nr_globals,
if (def_nr_normals <= 0) def_nr_normals = DEF_NR_NORMALS;
nr_globals = (nr_globals + 7) & ~0x07;
nr_globals -= NR_FIXED_ZNODES;
def_nr_topmosts = (def_nr_topmosts + 7) & ~0x07;
def_nr_normals = (def_nr_normals + 7) & ~0x07;