Changeset 397 for trunk


Ignore:
Timestamp:
Apr 16, 2010, 5:46:39 PM (11 years ago)
Author:
dmik
Message:

Fixed restoring the fullscreen state when the normal size equals to the fullscreen size.

Location:
trunk/Lucide/gui
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Lucide/gui/lucide.cpp

    r394 r397  
    743743
    744744
    745 void Lucide::toggleMaxviewFullscreen( bool maxview )
     745void Lucide::toggleMaxviewFullscreen( bool maxview, bool atStartup )
    746746{
    747747    enum TriState { NoChange, On, Off };
     
    814814    else if ( maxviewState == On )
    815815    {
    816         WinQueryWindowPos( hWndFrame, &winPos.Swp );
    817         winPos.XRestore  = WinQueryWindowUShort( hWndFrame, QWS_XRESTORE );
    818         winPos.YRestore  = WinQueryWindowUShort( hWndFrame, QWS_YRESTORE );
    819         winPos.CXRestore = WinQueryWindowUShort( hWndFrame, QWS_CXRESTORE );
    820         winPos.CYRestore = WinQueryWindowUShort( hWndFrame, QWS_CYRESTORE );
    821         winPos.XMinimize = WinQueryWindowUShort( hWndFrame, QWS_XMINIMIZE );
    822         winPos.YMinimize = WinQueryWindowUShort( hWndFrame, QWS_YMINIMIZE );
     816        if ( !atStartup )
     817        {
     818            WinQueryWindowPos( hWndFrame, &winPos.Swp );
     819            winPos.XRestore  = WinQueryWindowUShort( hWndFrame, QWS_XRESTORE );
     820            winPos.YRestore  = WinQueryWindowUShort( hWndFrame, QWS_YRESTORE );
     821            winPos.CXRestore = WinQueryWindowUShort( hWndFrame, QWS_CXRESTORE );
     822            winPos.CYRestore = WinQueryWindowUShort( hWndFrame, QWS_CYRESTORE );
     823            winPos.XMinimize = WinQueryWindowUShort( hWndFrame, QWS_XMINIMIZE );
     824            winPos.YMinimize = WinQueryWindowUShort( hWndFrame, QWS_YMINIMIZE );
     825        }
    823826
    824827        WinSetParent( hFrameSysmenu,  HWND_OBJECT, FALSE );
     
    10701073    sy = WinQuerySysValue( HWND_DESKTOP, SV_CYSCREEN );
    10711074
    1072     ULONG SwpOptions = SWP_MOVE | SWP_SIZE | SWP_ACTIVATE;
    1073     if ( !maxview && !fullscreen )
    1074         SwpOptions |= SWP_SHOW;
     1075    ULONG SwpOptions = SWP_MOVE | SWP_SIZE | SWP_ACTIVATE | SWP_SHOW;
     1076    bool atStartup = true;
    10751077
    10761078    ULONG ulWpSize = sizeof( winPos );
    10771079    if ( PrfQueryProfileData( HINI_USERPROFILE, appName, prfFwp, &winPos, &ulWpSize ) )
    10781080    {
    1079 
    10801081        if ( winPos.Swp.fl & SWP_MAXIMIZE ) {
    10811082            SwpOptions |= SWP_MAXIMIZE;
     
    10961097        }
    10971098
    1098         if ( !isMaxview && !isFullscreen ) {
     1099        // Just a note: the FID_CLIENT window is only resized by WinSetWindowPos()
     1100        // on the frame if the size is actually changed *and* the SWP_SHOW flag
     1101        // is present (PM bug?). Therefore, when the saved normal size the same
     1102        // as fullscreen and we should go fullscreen at startup, WinSetWindowPos()
     1103        // issued from toggleMaxviewFullscreen() will not resize FID_CLIENT even
     1104        // though it will contain SWP_SHOW
     1105
     1106        if ( !maxview && !fullscreen ) {
     1107            // only set the normal size if no if fullscreen or presentation is
     1108            // requested, to avoid flicker. We could also avoid flicker by
     1109            // omitting SWP_SHOW but see the note above
    10991110            WinSetWindowPos( hWndFrame, NULLHANDLE,
    11001111                             winPos.Swp.x, winPos.Swp.y, winPos.Swp.cx, winPos.Swp.cy,
    11011112                             SwpOptions );
     1113        } else {
     1114            // if we don't SWP_ACTIVATE now, then the title bar will keep the
     1115            // inactive state after the user switches from fullscreen/presentation
     1116            // (where the title bar is hidden) back to normal view later in this
     1117            // session. Looks like a PM bug too
     1118            WinSetWindowPos( hWndFrame, NULLHANDLE, 0, 0, 0, 0, SWP_ACTIVATE );
    11021119        }
    11031120
     
    11491166        WinSetWindowPos( hWndFrame, NULLHANDLE, swp.x, swp.y, swp.cx, swp.cy,
    11501167                         SwpOptions );
     1168
     1169        // we don't initialize winPos here so reset atStartup to let
     1170        // toggleMaxviewFullscreen() do this
     1171        atStartup = false;
    11511172    }
    11521173
    11531174    if ( fullscreen )
    11541175    {
    1155         toggleFullscreen();
     1176        toggleMaxviewFullscreen( false, atStartup );
    11561177        isMaxview = maxview;
    11571178    }
    11581179    else if ( maxview )
    11591180    {
    1160         toggleMaxview();
     1181        toggleMaxviewFullscreen( true, atStartup );
    11611182    }
    11621183}
  • trunk/Lucide/gui/lucide.h

    r392 r397  
    113113        static void toggleMaxview() { toggleMaxviewFullscreen( true ); }
    114114        static void toggleFullscreen() { toggleMaxviewFullscreen( false ); }
    115         static void toggleMaxviewFullscreen( bool maxview );
     115        static void toggleMaxviewFullscreen( bool maxview, bool atStartup = false );
    116116        static void focusDocview();
    117117        static void focusIndex();
Note: See TracChangeset for help on using the changeset viewer.