diff --git a/xwords4/wince/cemain.c b/xwords4/wince/cemain.c index 9560ae8af..481619b03 100755 --- a/xwords4/wince/cemain.c +++ b/xwords4/wince/cemain.c @@ -1227,7 +1227,7 @@ InitInstance(HINSTANCE hInstance, int nCmdShow) } #ifdef _WIN32_WCE - if ( globals->hwndCB ) { + if ( globals->hwndCB && !IS_SMARTPHONE(globals) ) { RECT rc, rcmb; GetWindowRect( hWnd, &rc ); diff --git a/xwords4/wince/cemain.h b/xwords4/wince/cemain.h index 4cadc03b2..8b9f7112f 100755 --- a/xwords4/wince/cemain.h +++ b/xwords4/wince/cemain.h @@ -40,6 +40,8 @@ typedef enum { , WINCE_SMARTPHONE_2003 , WINCE_SMARTPHONE_2005 } XW_WinceVersion; + +# define IS_SMARTPHONE(g) ((g)->winceVersion > _LAST_PPC) #endif enum { CE_BONUS1_COLOR, diff --git a/xwords4/wince/ceutil.c b/xwords4/wince/ceutil.c index 933bfd11f..0f1b64a13 100755 --- a/xwords4/wince/ceutil.c +++ b/xwords4/wince/ceutil.c @@ -249,35 +249,65 @@ ceIsVisible( HWND XP_UNUSED_CE(hwnd) ) } /* ceIsVisible */ #ifdef _WIN32_WCE +static XP_Bool +ceIsFullScreen( CEAppGlobals* globals, HWND hWnd ) +{ + XP_S16 screenHt; + XP_U16 winHt; + RECT rect; + + GetClientRect( hWnd, &rect ); + winHt = rect.bottom - rect.top; /* top should always be 0 */ + + screenHt = GetSystemMetrics( SM_CYSCREEN ); + XP_ASSERT( screenHt >= winHt ); + + screenHt -= winHt; + + if ( !!globals->hwndCB ) { + RECT rect; + GetWindowRect( globals->hwndCB, &rect ); + screenHt -= rect.bottom - rect.top; + } + + XP_ASSERT( screenHt >= 0 ); + return screenHt == 0; +} /* ceIsFullScreen */ + void ceSizeIfFullscreen( CEAppGlobals* globals, HWND hWnd ) { - RECT rect; - XP_U16 cbHeight = 0; - if ( !!globals->hwndCB && hWnd == globals->hWnd ) { - GetWindowRect( globals->hwndCB, &rect ); - cbHeight = rect.bottom - rect.top; + if ( globals->appPrefs.fullScreen != ceIsFullScreen(globals, hWnd) ) { + RECT rect; + XP_U16 cbHeight = 0; + if ( !!globals->hwndCB && hWnd == globals->hWnd ) { + GetWindowRect( globals->hwndCB, &rect ); + cbHeight = rect.bottom - rect.top; + } + + /* I'm leaving the SIP/cmdbar in place until I can figure out how to + get menu events with it hidden -- and also the UI for making sure + users don't get stuck in fullscreen mode not knowing how to reach + menus to get out. Later, add SHFS_SHOWSIPBUTTON and + SHFS_HIDESIPBUTTON to the sets shown and hidden below.*/ + if ( globals->appPrefs.fullScreen ) { + SHFullScreen( hWnd, SHFS_HIDETASKBAR | SHFS_HIDESTARTICON ); + + SetRect( &rect, 0, 0, GetSystemMetrics(SM_CXSCREEN), + GetSystemMetrics(SM_CYSCREEN) ); + + } else { + SHFullScreen( hWnd, SHFS_SHOWTASKBAR | SHFS_SHOWSTARTICON ); + SystemParametersInfo( SPI_GETWORKAREA, 0, &rect, FALSE ); + if ( IS_SMARTPHONE(globals) ) { + cbHeight = 0; + } + } + + rect.bottom -= cbHeight; + MoveWindow( hWnd, rect.left, rect.top, rect.right - rect.left, + rect.bottom - rect.top, TRUE ); } - - /* I'm leaving the SIP/cmdbar in place until I can figure out how to get - menu events with it hidden -- and also the UI for making sure users - don't get stuck in fullscreen mode not knowing how to reach menus to - get out. Later, add SHFS_SHOWSIPBUTTON and SHFS_HIDESIPBUTTON to the - sets shown and hidden below.*/ - if ( globals->appPrefs.fullScreen ) { - SHFullScreen( hWnd, SHFS_SHOWTASKBAR | SHFS_SHOWSTARTICON ); - - SystemParametersInfo( SPI_GETWORKAREA, 0, &rect, FALSE ); - } else { - SHFullScreen( hWnd, SHFS_HIDETASKBAR | SHFS_HIDESTARTICON ); - - SetRect( &rect, 0, 0, GetSystemMetrics(SM_CXSCREEN), - GetSystemMetrics(SM_CYSCREEN) ); - } - - rect.bottom -= cbHeight; - MoveWindow( hWnd, rect.left, rect.top, rect.right - rect.left, - rect.bottom - rect.top, TRUE ); } /* ceSizeIfFullscreen */ static XP_Bool @@ -298,7 +328,7 @@ mkFullscreenWithSoftkeys( CEAppGlobals* globals, HWND hDlg ) mbi.hInstRes = globals->hInst; success = SHCreateMenuBar( &mbi ); if ( !success ) { - XP_LOGF( "SHCreateMenuBar failed" ); + XP_LOGF( "SHCreateMenuBar failed: %ld", GetLastError() ); } return success; } /* mkFullscreenWithSoftkeys */