mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-30 08:34:16 +01:00
Don't subtract command bar height from client rect height on
smartphone. This prevents windows from being too small in non-fullscreen mode. Make ceSizeIfFullscreen work based on state rather than assuming it's toggling.
This commit is contained in:
parent
cae88f5b6c
commit
b7f35d2958
3 changed files with 59 additions and 27 deletions
|
@ -1227,7 +1227,7 @@ InitInstance(HINSTANCE hInstance, int nCmdShow)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _WIN32_WCE
|
#ifdef _WIN32_WCE
|
||||||
if ( globals->hwndCB ) {
|
if ( globals->hwndCB && !IS_SMARTPHONE(globals) ) {
|
||||||
RECT rc, rcmb;
|
RECT rc, rcmb;
|
||||||
|
|
||||||
GetWindowRect( hWnd, &rc );
|
GetWindowRect( hWnd, &rc );
|
||||||
|
|
|
@ -40,6 +40,8 @@ typedef enum {
|
||||||
, WINCE_SMARTPHONE_2003
|
, WINCE_SMARTPHONE_2003
|
||||||
, WINCE_SMARTPHONE_2005
|
, WINCE_SMARTPHONE_2005
|
||||||
} XW_WinceVersion;
|
} XW_WinceVersion;
|
||||||
|
|
||||||
|
# define IS_SMARTPHONE(g) ((g)->winceVersion > _LAST_PPC)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
enum { CE_BONUS1_COLOR,
|
enum { CE_BONUS1_COLOR,
|
||||||
|
|
|
@ -249,35 +249,65 @@ ceIsVisible( HWND XP_UNUSED_CE(hwnd) )
|
||||||
} /* ceIsVisible */
|
} /* ceIsVisible */
|
||||||
|
|
||||||
#ifdef _WIN32_WCE
|
#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
|
void
|
||||||
ceSizeIfFullscreen( CEAppGlobals* globals, HWND hWnd )
|
ceSizeIfFullscreen( CEAppGlobals* globals, HWND hWnd )
|
||||||
{
|
{
|
||||||
RECT rect;
|
if ( globals->appPrefs.fullScreen != ceIsFullScreen(globals, hWnd) ) {
|
||||||
XP_U16 cbHeight = 0;
|
RECT rect;
|
||||||
if ( !!globals->hwndCB && hWnd == globals->hWnd ) {
|
XP_U16 cbHeight = 0;
|
||||||
GetWindowRect( globals->hwndCB, &rect );
|
if ( !!globals->hwndCB && hWnd == globals->hWnd ) {
|
||||||
cbHeight = rect.bottom - rect.top;
|
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 */
|
} /* ceSizeIfFullscreen */
|
||||||
|
|
||||||
static XP_Bool
|
static XP_Bool
|
||||||
|
@ -298,7 +328,7 @@ mkFullscreenWithSoftkeys( CEAppGlobals* globals, HWND hDlg )
|
||||||
mbi.hInstRes = globals->hInst;
|
mbi.hInstRes = globals->hInst;
|
||||||
success = SHCreateMenuBar( &mbi );
|
success = SHCreateMenuBar( &mbi );
|
||||||
if ( !success ) {
|
if ( !success ) {
|
||||||
XP_LOGF( "SHCreateMenuBar failed" );
|
XP_LOGF( "SHCreateMenuBar failed: %ld", GetLastError() );
|
||||||
}
|
}
|
||||||
return success;
|
return success;
|
||||||
} /* mkFullscreenWithSoftkeys */
|
} /* mkFullscreenWithSoftkeys */
|
||||||
|
|
Loading…
Add table
Reference in a new issue