Ignore:
Timestamp:
May 23, 2020, 12:45:14 AM (4 years ago)
Author:
chronos
Message:
  • Fixed: Scrolling under HighDPI. ScrollDC needs to be scaled as well.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/highdpi/LocalPlayer/Term.pas

    r251 r252  
    280280    procedure LoadSettings;
    281281    procedure SaveSettings;
    282     procedure OnScroll(var m: TMessage); message WM_VSCROLL;
     282    procedure OnScroll(var Msg: TMessage); message WM_VSCROLL;
    283283    procedure OnEOT(var Msg: TMessage); message WM_EOT;
    284284    procedure SoundPreload(Check: integer);
     
    36203620end;
    36213621
    3622 procedure TMainScreen.OnScroll(var m: TMessage);
    3623 begin
    3624   if sb.Process(m) then begin
     3622procedure TMainScreen.OnScroll(var Msg: TMessage);
     3623begin
     3624  if sb.Process(Msg) then begin
    36253625    PanelPaint;
    36263626    Update;
     
    36303630procedure TMainScreen.OnEOT(var Msg: TMessage);
    36313631begin
    3632   EndTurn
     3632  EndTurn;
    36333633end;
    36343634
     
    36383638  begin
    36393639    MessgExDlg.CancelMovie;
    3640     Server(sBreak, me, 0, nil^)
     3640    Server(sBreak, me, 0, nil^);
    36413641  end
    36423642  else if ClientMode < 0 then
     
    36473647  begin
    36483648    Jump[pTurn] := 0;
    3649     StartRunning := false
     3649    StartRunning := false;
    36503650  end
    36513651  else
    3652     EndTurn
     3652    EndTurn;
    36533653end;
    36543654
     
    41444144end;
    41454145
    4146 {$IFDEF LINUX}
    4147 // Can't do scrolling of DC under Linux, then fallback into BitBlt.
    4148 function ScrollDC(Canvas: TDpiCanvas; dx: longint; dy: longint; const lprcScroll:TRect; const lprcClip:TRect; hrgnUpdate:HRGN; lprcUpdate: PRect):Boolean;
    4149 begin
    4150   Result := DpiBitCanvas(Canvas, lprcScroll.Left + dx, lprcScroll.Top + dy, lprcScroll.Right - lprcScroll.Left, lprcScroll.Bottom - lprcScroll.Top,
    4151     Canvas, lprcScroll.Left, lprcScroll.Top);
    4152 end;
    4153 {$ENDIF}
    4154 
    41554146procedure TMainScreen.MainOffscreenPaint;
    41564147var
     
    41994190    offscreen.Canvas.Font.Assign(UniFont[ftSmall]);
    42004191    rec := Rect(0, 0, MapWidth, MapHeight);
    4201 {$IFDEF WINDOWS}
    4202     ScrollDC(offscreen.Canvas.Handle, (xwd - xw) * (xxt * 2), (ywd - yw) * yyt,
     4192    DpiScrollDC(offscreen.Canvas.Handle, (xwd - xw) * (xxt * 2), (ywd - yw) * yyt,
    42034193      rec, rec, 0, nil);
    4204 {$ENDIF}
    4205 {$IFDEF LINUX}
    4206     ScrollDC(offscreen.Canvas, (xwd - xw) * (xxt * 2), (ywd - yw) * yyt,
    4207       rec, rec, 0, nil);
    4208 {$ENDIF}
    42094194    for DoInvalidate := false to FastScrolling do
    42104195    begin
     
    42124197      begin
    42134198        rec.Bottom := MapHeight - overlap;
    4214 {$IFDEF WINDOWS}
    4215         ScrollDC(Canvas.Handle, (xwd - xw) * (xxt * 2), (ywd - yw) * yyt, rec,
     4199        DpiScrollDC(Canvas.Handle, (xwd - xw) * (xxt * 2), (ywd - yw) * yyt, rec,
    42164200          rec, 0, nil);
    4217 {$ENDIF}
    4218 {$IFDEF LINUX}
    4219         ScrollDC(Canvas, (xwd - xw) * (xxt * 2), (ywd - yw) * yyt,
    4220           rec, rec, 0, nil);
    4221 {$ENDIF}
    42224201        ProcessOptions := prInvalidate;
    42234202      end
     
    50745053          if DpiMouse.CursorPos.x = 0 then
    50755054            dx := -speed // scroll left
    5076           else if DpiMouse.CursorPos.x = DpiScreen.width - 1 then
     5055          else if DpiMouse.CursorPos.x >= DpiScreen.width - 1 then
    50775056            dx := speed; // scroll right
    50785057        if DpiMouse.CursorPos.y = 0 then
    50795058          dy := -speed // scroll up
    5080         else if (DpiMouse.CursorPos.y = DpiScreen.height - 1) and
     5059        else if (DpiMouse.CursorPos.y >= DpiScreen.height - 1) and
    50815060          (DpiMouse.CursorPos.x >= TerrainBtn.Left + TerrainBtn.width) and
    50825061          (DpiMouse.CursorPos.x < xRightPanel + 10 - 8) then
Note: See TracChangeset for help on using the changeset viewer.