Recent

Author Topic: 32-bit GTK2 - borderless form is jumpy when moving by mouse  (Read 4369 times)

edvard

  • Full Member
  • ***
  • Posts: 172
32-bit GTK2 - borderless form is jumpy when moving by mouse
« on: February 26, 2015, 08:19:44 am »
I have a borderless form that is movable by mouse-grabbing a panel.
Relevant code here:

Code: [Select]
var
  MPos: Tpoint;

{ If mouse clicks on the top bar, grab the mouse position... }
procedure TForm1.Panel1MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  MPos.X := X;
  MPos.Y := Y;
end;

{ ... and if mouse moves while clicked on the top, change the co-ords of the
  Window to follow mouse. This way we can move the window without a title bar. }
procedure TForm1.Panel1MouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
begin
  if ssLeft in Shift then
    SetBounds(Left + (X - MPos.X), Top + (Y - MPos.Y), Width, Height);
end;

In Windows, Qt 32 and 64 bit, and 64 bit GTK2, the window move smoothly as you drag it.  In 32-bit GTK2 specifically, moving the window with the mouse causes the window to jump around the desktop spasmodically, sometimes ending up off the screen with just a corner showing.
Any ideas?
All children left unattended will be given a mocha and a puppy.

Arch (though I may go back to Debian)| FreePascal 3.2.2 + Lazarus 2.2.4, GTK2+ and Qt.  Mostly Qt...

Eugene Loza

  • Hero Member
  • *****
  • Posts: 663
    • My games in Pascal
Re: 32-bit GTK2 - borderless form is jumpy when moving by mouse
« Reply #1 on: February 26, 2015, 09:51:18 am »
Confirm. Had the same issue while looking for solution for not-resizable forms...
My FOSS games in FreePascal&CastleGameEngine: https://decoherence.itch.io/ (Sources: https://gitlab.com/EugeneLoza)

arneolav

  • Full Member
  • ***
  • Posts: 195
    • ElTranslador
Re: 32-bit GTK2 - borderless form is jumpy when moving by mouse
« Reply #2 on: April 11, 2020, 05:11:32 pm »
Same for dynamic form and unknown number of panels.

var dy : Integer;

 Procedure CreateDynamicPanels;
 begin
   DynamicPanel[dy]        := TPanel.Create(Self);
   with  DynamicPanel[dy] do
   begin
     BevelOuter:=bvNone;
     Name   := 'DynamicPanels' + IntToStr(dy);   // give name to panels
     Caption:= '';
     OnMouseDown := @Form.PanelsMouseDown;
     OnMouseMove := @Form.Panel1MouseMove;
     Parent := Self;
   end;
 end;
Win XP, Win7, Win 10, Win 11, win64 , Lazarus 3.0RC1
Delphi/DevExpress

Cyrax

  • Hero Member
  • *****
  • Posts: 836
Re: 32-bit GTK2 - borderless form is jumpy when moving by mouse
« Reply #3 on: April 11, 2020, 11:04:14 pm »
Same for dynamic form and unknown number of panels.

var dy : Integer;

 Procedure CreateDynamicPanels;
 begin
   DynamicPanel[dy]        := TPanel.Create(Self);
   with  DynamicPanel[dy] do
   begin
     BevelOuter:=bvNone;
     Name   := 'DynamicPanels' + IntToStr(dy);   // give name to panels
     Caption:= '';
     OnMouseDown := @Form.PanelsMouseDown;
     OnMouseMove := @Form.Panel1MouseMove;
     Parent := Self;
   end;
 end;

Please try development version of Lazarus or apply attached patch from this bug report on your version of Lazarus : https://bugs.freepascal.org/view.php?id=36469

 

TinyPortal © 2005-2018