diff --git a/include/window.h b/include/window.h index 2089322e..f5d2d41e 100644 --- a/include/window.h +++ b/include/window.h @@ -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. diff --git a/src/kernel/compsor-fallback.c b/src/kernel/compsor-fallback.c index 5d0a6f30..a96cdb0a 100644 --- a/src/kernel/compsor-fallback.c +++ b/src/kernel/compsor-fallback.c @@ -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); + } } } } diff --git a/src/kernel/desktop.c b/src/kernel/desktop.c index 29e8b493..602d57f1 100644 --- a/src/kernel/desktop.c +++ b/src/kernel/desktop.c @@ -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 */