adjust to a reasonable position for a main window with style WS_EX_AUTOPOSITION

This commit is contained in:
Vincent Wei
2020-03-01 18:38:52 +08:00
parent 48c2ad5388
commit 8f01d078d9
3 changed files with 21 additions and 3 deletions

View File

@@ -4641,9 +4641,9 @@ MG_EXPORT SRVEVTHOOK GUIAPI SetServerEventHook (SRVEVTHOOK SrvEvtHook);
* \brief The position of the main window will be determined by system.
*
* If a main window has this extend style when creating it, MiniGUI will
* determine the position of the main window. If the width or the height of
* the window specified in MAINWINCREATE structure is zero, MiniGUI will
* also determine a default size for the main window.
* determine the position in the screen for the main window. If the width
* or the height of the window specified in MAINWINCREATE structure is zero,
* MiniGUI will also determine a default size for the main window.
*
* Under the compositing schema, the compositor is responsible to calculate
* the position and the size for a main window.

View File

@@ -601,6 +601,15 @@ static void calc_mainwin_pos (CompositorCtxt* ctxt, MG_Layer* layer,
info->rc = znode_hdr->rc;
OffsetRect (&info->rc,
DEF_OVERLAPPED_OFFSET_X, DEF_OVERLAPPED_OFFSET_Y);
/* adjust to a reasonable postion */
if (info->rc.top > (g_rcScr.bottom * 3 / 4)) {
OffsetRect (&info->rc, 0, -info->rc.top);
}
if (info->rc.left > (g_rcScr.right * 3 / 4)) {
OffsetRect (&info->rc, -info->rc.left, 0);
}
}
}
}

View File

@@ -4413,6 +4413,15 @@ static int dskCalculateDefaultPosition (int cli, CALCPOSINFO* info)
info->rc = nodes[first].rc;
OffsetRect (&info->rc,
DEF_OVERLAPPED_OFFSET_X, DEF_OVERLAPPED_OFFSET_Y);
/* adjust to a reasonable postion */
if (info->rc.top > (g_rcScr.bottom * 3 / 4)) {
OffsetRect (&info->rc, 0, -info->rc.top);
}
if (info->rc.left > (g_rcScr.right * 3 / 4)) {
OffsetRect (&info->rc, -info->rc.left, 0);
}
}
}
#endif /* defined _MGSCHEMA_COMPOSITING */