Recent

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

edvard

  • Full Member
  • ***
  • Posts: 165
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.

Debian 'Testing' 64-bit | Xfce 4.12 | FreePascal 3.0 + Lazarus 1.6.2, GTK2+ and Qt

Eugene Loza

  • Hero Member
  • *****
  • Posts: 566
    • My "almost daily" development blog
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...
Lazarus 1.9 + FPC 3.1.1 Debian Jessie 64 bit.

My Free and Open Source games in Lazarus/FreePascal/CastleGameEngine:
https://decoherence.itch.io/
(and some ancient games in Turbo Pascal too)
Sources are here: https://github.com/eugeneloza?tab=repositories

arneolav

  • Full Member
  • ***
  • Posts: 128
    • 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 win64 , Lazarus 2.0.8
Delphi/DevExpress

Cyrax

  • Hero Member
  • *****
  • Posts: 816
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