Changeset 413


Ignore:
Timestamp:
Nov 4, 2021, 4:26:28 PM (2 years ago)
Author:
chronos
Message:
  • Fixed: Mouse window move simulation under Linux was not reliable due to incorrect check for mouse coordinates change.
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/highdpi/Packages/CevoComponents/DrawDlg.pas

    r412 r413  
    128128procedure TDrawDlg.MouseDown(Button: TMouseButton; Shift: TShiftState; X,
    129129  Y: Integer);
     130var
     131  MousePos1: TPoint;
     132  MousePos2: TPoint;
    130133{$IFDEF LINUX}
    131 var
    132134  MousePosNew: TPoint;
    133135  NewFormPos: TPoint;
    134136{$ENDIF}
    135137begin
    136   inherited;
     138  MousePos1 := DpiMouse.CursorPos;
     139  inherited;
     140  MousePos2 := DpiMouse.CursorPos;
    137141  {$IFDEF LINUX}
    138142  // Only if client is not doing own mouse move handling
     
    147151      MousePosNew := DpiMouse.CursorPos;
    148152      // Activate move only if mouse position was not changed during inherited call
    149       if (MousePosNew.X = MoveMousePos.X) and (MousePosNew.Y = MoveMousePos.Y) then begin
     153      if (MousePos1.X = MousePos2.X) and (MousePos1.Y = MousePos2.Y) then begin
    150154        MoveActive := True;
    151155      end;
     
    193197  {$IFDEF LCLGTK2}
    194198  // GTK2 bug workaround https://bugs.freepascal.org/view.php?id=35720
    195   if Visible then LastMouse.WinControl := Self;
     199  if Visible then LastMouse.WinControl := Self.GetNativeForm;
    196200  {$ENDIF}
    197201end;
  • trunk/Packages/CevoComponents/DrawDlg.pas

    r408 r413  
    102102  else
    103103  begin
    104     Pos := Point(Integer(Msg.LParam and $ffff),
    105       Integer((Msg.LParam shr 16) and $ffff));
     104    Pos := Point(ScaleFromNative(Integer(Msg.LParam and $ffff)),
     105      ScaleFromNative(Integer((Msg.LParam shr 16) and $ffff)));
    106106    if Pos.Y >= Top + TitleHeight then
    107107      Msg.Result := HTCLIENT
     
    128128procedure TDrawDlg.MouseDown(Button: TMouseButton; Shift: TShiftState; X,
    129129  Y: Integer);
     130var
     131  MousePos1: TPoint;
     132  MousePos2: TPoint;
    130133{$IFDEF LINUX}
    131 var
    132134  MousePosNew: TPoint;
    133135  NewFormPos: TPoint;
    134136{$ENDIF}
    135137begin
    136   inherited;
     138  MousePos1 := Mouse.CursorPos;
     139  inherited;
     140  MousePos2 := Mouse.CursorPos;
    137141  {$IFDEF LINUX}
    138142  // Only if client is not doing own mouse move handling
     
    147151      MousePosNew := Mouse.CursorPos;
    148152      // Activate move only if mouse position was not changed during inherited call
    149       if (MousePosNew.X = MoveMousePos.X) and (MousePosNew.Y = MoveMousePos.Y) then begin
     153      if (MousePos1.X = MousePos2.X) and (MousePos1.Y = MousePos2.Y) then begin
    150154        MoveActive := True;
    151155      end;
Note: See TracChangeset for help on using the changeset viewer.