Changeset 486


Ignore:
Timestamp:
Oct 22, 2023, 7:39:15 PM (22 months ago)
Author:
ataylor
Message:

Make sure help window doesn't open off-screen (e.g. on another virtual desktop)

Location:
trunk/NewView
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/NewView/MainForm.pas

    r468 r486  
    38123812  if hTopWindow <> NULLHANDLE then
    38133813  begin
    3814     // found an existing help window, find it's location
    3815     if WinQueryWindowPos(
    3816          hTopWindow,
    3817          TopHelpWindowPos ) then
     3814
     3815    // we will offset new window by height of title bar + border
     3816    Offset := Screen.SystemMetrics( smCyTitleBar )
     3817              + Screen.SystemMetrics( smCySizeBorder );
     3818
     3819    // found an existing help window, find its position...
     3820    if WinQueryWindowPos( hTopWindow,TopHelpWindowPos ) then
    38183821    begin
    3819       if ( TopHelpWindowPos.FL and ( SWP_MINIMIZE or SWP_MINIMIZE ) ) > 0 then
     3822      // [ALT 2023-10-22] ...but only if it's fully on the screen
     3823      if ( TopHelpWindowPos.X >= 0 ) and
     3824         ( TopHelpWindowPos.X + TopHelpWindowPos.CX + Offset <= Screen.Width ) and
     3825         ( TopHelpWindowPos.Y >= 0 ) and
     3826         ( TopHelpWindowPos.Y + TopHelpWindowPos.CY + Offset <= Screen.Height )
     3827      then
    38203828      Begin
    3821         // window is maximized or minimised, so get the restore position from window USHORTs
    3822         TopHelpWindowPos.x := WinQueryWindowUShort( hTopWindow, QWS_XRESTORE );
    3823         TopHelpWindowPos.Y := WinQueryWindowUShort( hTopWindow, QWS_YRESTORE );
     3829        if ( TopHelpWindowPos.FL and ( SWP_MINIMIZE or SWP_MINIMIZE ) ) > 0 then
     3830        Begin
     3831          // window is maximized or minimised, so get the restore position from window USHORTs
     3832          TopHelpWindowPos.x := WinQueryWindowUShort( hTopWindow, QWS_XRESTORE );
     3833          TopHelpWindowPos.Y := WinQueryWindowUShort( hTopWindow, QWS_YRESTORE );
     3834        end;
     3835
     3836        Left := TopHelpWindowPos.x;
     3837        Bottom := TopHelpWindowPos.y;
    38243838      end;
    38253839
    3826       // offset new window by height of title bar + border
    3827       Offset := Screen.SystemMetrics( smCyTitleBar )
    3828                 + Screen.SystemMetrics( smCySizeBorder );
    3829       Left := TopHelpWindowPos.x + Offset;
    3830       Bottom := TopHelpWindowPos.y - Offset;
     3840      // got the reference position, now apply the offset
     3841      Left := Left + Offset;
     3842      Bottom := Bottom - Offset;
    38313843
    38323844      // I guess I am leaving width/height out for compatibility...?
     
    41034115    WinSetOwner( Frame.Handle,
    41044116                 CmdLineParameters.getOwnerWindow );
    4105 
     4117{
     4118    // ALT 20230523 try to handle system modal owner
     4119    if WinQuerySysModelWindow( HWND_DESKTOP ) = CmdLineParameters.getOwnerWindow then
     4120    begin
     4121      WinSetWindowBits( FindTopFormWindow( MAIN_WINDOW_CLASS_NAME ),
     4122                        QWL_STYLE, WS_TOPMOST, WS_TOPMOST );
     4123    end;
     4124}
    41064125  end;
    41074126
     
    45574576    exit;
    45584577
    4559   tmpMatchIndex := -1; 
     4578  tmpMatchIndex := -1;
    45604579  tmpSearchText := trim(IndexSearchEdit.Text);
    45614580
  • trunk/NewView/VersionUnit.pas

    r473 r486  
    1717
    1818const
    19   Version =        'V2.19.8'; // $SS_REQUIRE_NEW_VERSION$
    20   BldLevelVersion = '2.19.8'; // Embedded for IBM BLDLEVEL tool
     19  Version =        'V2.19.8a'; // $SS_REQUIRE_NEW_VERSION$
     20  BldLevelVersion = '2.19.8a'; // Embedded for IBM BLDLEVEL tool
    2121  CopyrightMsg = 'Copyright 2005 Aaron Lawrence; 2006-2019 Ronald Brill';
    2222  LicenseMsg   = 'Licensed under the GNU Public License';
Note: See TracChangeset for help on using the changeset viewer.