Recent

Author Topic: Mouse pointer moving randomly  (Read 4506 times)

Handoko

  • Hero Member
  • *****
  • Posts: 5158
  • My goal: build my own game engine using Lazarus
Mouse pointer moving randomly
« on: December 15, 2021, 05:03:44 am »
Previously, I said I was having issue with the Lazarus IDE:
https://forum.lazarus.freepascal.org/index.php/topic,57510.msg427773.html#msg427773

After more testings, I now can always reproduce the issue.
  • The computer was newly started so the memory should be fresh.
  • In the video, you can see I was trying to drag the tab "Unit1" but the mouse pointer was moving randomly by itself for about 1 second.
  • The issue only happened once per Lazarus session. It wouldn't happen again until I restart the Lazarus.
  • After that random movement happens, usually I can continue to work normally. But there were times, the Lazarus just quit immediately, if I remember correctly that only happened when I worked with multiple Lazarus instances.
  • Lazarus 2.0.10 GTK2 64-bit, Ubuntu Mate 21.10, Intel G2020 8 GB RAM.
  • The video was captured using Vokoscreen, saved in mkv format.
The installed packages were:

ChmHelpPkg, CodeTools, DateTimeCtrls, DateTimeCtrlsDsgn, DBFLaz, DebuggerInf, EditorMacroScript, ExternHelp, FCL, fpunitide, IDEIntf, indylaz, InstantFPCLaz, jcfidelazarus, LazControlDsgn, LazControls, LazDebuggerFpLldb, LazDebuggerGdbmi, LazOpenGLContext, LazUtils, LCL, LCLBase, leakview, MemDSLaz, OnlinePackageManager, pascalscript, pkg_gifanim, pkg_gifanim_dsgn, Printer4Lazarus, printer4lazide, ProjTemplates, RunTimeTypeInfoControls, SDFLaz, SQLDBLaz, SynEdit, SynEditDsgn, TAChartLazarusPkg, ToDoListLaz, TurboPowerIPro, TurboPowerIProDsgn.
« Last Edit: December 15, 2021, 02:13:28 pm by Handoko »

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9900
  • Debugger - SynEdit - and more
    • wiki
Re: Mouse pointer moving randomly
« Reply #1 on: December 15, 2021, 01:52:20 pm »
So, it looks like it happens when:
- The cursor image is changed
- maybe requiring the mouse button to be down.
- maybe requiring mouse-capture to be active.
- Maybe need the tabs, of a page control
...

Lets see if there are other means to reproduce.

1) Select some text in the source editor, and start dragging it.
- Change the cursor, by pressing/releasing CTRL (drag-copy)
- Or Change the cursor by dragging over the desktop (no-drop-cursor)

2) Hover the cursor behind the end of a line, after an identifier that is "ctrl-clickable as link". (This can be done in a "uses" clause)
- Press and hold the CTRL key.
- Click and hold the left mouse button. (The cursor should still be, the text cursor)
- Move the mouse over the identifier (the cursor changes to the "hand" symbol / link cursor)

Alternatively you can first press the mouse, then ctrl, then move.




Do you have
- a "normal" usb mouse (no special driver)
- a touchpad (e.g. Laptop)
- running in a VM (E.g. virtualbox has several options how to provide a mouse for the guest)

Just asking, in case there is any mouse driver involved.


Quick test on Ubuntu 20 (in virtualbox), X11/Gnome / I believe gdm3
=> not reproduced.



MarkMLl

  • Hero Member
  • *****
  • Posts: 6692
Re: Mouse pointer moving randomly
« Reply #2 on: December 15, 2021, 02:23:17 pm »
So, it looks like it happens when:
- The cursor image is changed
- maybe requiring the mouse button to be down.
- maybe requiring mouse-capture to be active.
- Maybe need the tabs, of a page control
...

That reminds me of something. I've definitely never seen anything like this with Lazarus, but I /do/ see it on occasion with VNC clients running on Linux and driving older MS OSes in Qemu... it only affects the client area, not the management dialog(ue), and has been going on for a /long/ time.

In my case I think it happens when the mouse pointer is moved onto the window, I don't believe this requires a pointer image change and none is visible, no mouse button down, no tabbed apps, no (intentional) mouse capture. After a pause the pointer position goes wild, and arbitrary client-app dialogues start popping up.

I've never found a workaround other than killing the program and restarting, but the impression I get is that the affected program/window thinks it has a stuck button state.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

Handoko

  • Hero Member
  • *****
  • Posts: 5158
  • My goal: build my own game engine using Lazarus
Re: Mouse pointer moving randomly
« Reply #3 on: December 15, 2021, 02:26:18 pm »
I use Logitech B100, the cheap but good cabled usb mouse. It was plug-and-play on my Linux system so I haven't manually installed any mouse driver.

Not frequently, but I remember this issue has been happened since some years ago. I couldn't always reproduce it in the past because now I found that:

The issue will not ever happen if I ever click any of the tab (before dragging the tab).

Start Lazarus > click any tab > do drag-and-drop a tab  ---> everything normal
Start Lazarus > do drag-and-drop a tab ---> random mouse movement happens

Handoko

  • Hero Member
  • *****
  • Posts: 5158
  • My goal: build my own game engine using Lazarus
Re: Mouse pointer moving randomly
« Reply #4 on: December 15, 2021, 03:18:42 pm »
Some more test results:

1. Start Lazarus > press shift/ctrl/alt and release > do drag-n-drop ---> reproducible
2. Start Lazarus > press shift/ctrl/alt and hold > do drag-n-drop --->
not reproducible
3. Start Lazarus > type any word > do drag-n-drop --->
not reproducible
4. Start Lazarus > click the File menu > press Esc > do drag-n-drop ---> reproducible


Note:
The do drag-n-drop means doing a drag and drop on the tabs in the Source Editor. Actually that just doing dragging because the movement make the dropping impossible.

Note for #3:
Type any word here means to type any alphabet or numeric key, not shift nor ctrl nor alt. Typing any word right after Lazarus started will cause the Object Inspector's filter box to get focus.

Note for #4:
Even without restart the Lazarus, I can always reproduce the random mouse movement. This one is the worst because the movement won't stop until I press the Esc key.
« Last Edit: December 15, 2021, 05:44:05 pm by Handoko »

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9900
  • Debugger - SynEdit - and more
    • wiki
Re: Mouse pointer moving randomly
« Reply #5 on: December 15, 2021, 03:37:48 pm »
All the mentioned "drag and drop" refer to dragging source editor tabs?

Just an idea, maybe there is a conflict between the OS doing a mouse capture, and the IDE doing that too.

In components\lazcontrols\extendednotebook.pas
  procedure TExtendedNotebook.MouseDown
find the line:
  MouseCapture := True;
and comment it out. (drag/drop tabs may not work correctly after that / It should start, but it may not always follow the mouse)

Does the mouse still go wild?

---------
Do page controls in (some) gtk have their own drag and drop of headers?

In any case, if it is MouseCapture, then it might be a matter of our MouseCapture not being communicated to the OS. Or Gtk ignoring it, or reacting badly if we try to capture the mouse at that point.


It still leaves the question what pre-conditions are needed? gtk version, desktop manager,.... ?

Handoko

  • Hero Member
  • *****
  • Posts: 5158
  • My goal: build my own game engine using Lazarus
Re: Mouse pointer moving randomly
« Reply #6 on: December 15, 2021, 04:17:05 pm »
Operating System: Ubuntu Mate 20.10 64-bit
GTK version: only GTK2 is installed, no GTK3 (see img1)
Windows Manager: Marco (Adaptive compositor) (see img2)
OpenGL driver: non-NVidia, because using Intel integrated VGA
Lazarus version: Lazarus 2.0.10 FPC 3.2.0 64-linux-gtk2
Hardware type: desktop computer
Mouse: Logitech B100 without using additional mouse driver

In components\lazcontrols\extendednotebook.pas
  procedure TExtendedNotebook.MouseDown
find the line:
  MouseCapture := True;
and comment it out. (drag/drop tabs may not work correctly after that / It should start, but it may not always follow the mouse)

Does the mouse still go wild?

I commented out the line (see img3), rebuilt the Lazarus, but Yes the issue still reproducible.

Do page controls in (some) gtk have their own drag and drop of headers?

Sorry, I couldn't understand.

All the mentioned "drag and drop" refer to dragging source editor tabs?

Yes. Because they are the only drag-able tabs. I tested on the tabs in Object Inspector and Code explorer, nothing happened because they are not drag-able.
« Last Edit: December 15, 2021, 05:40:26 pm by Handoko »

Handoko

  • Hero Member
  • *****
  • Posts: 5158
  • My goal: build my own game engine using Lazarus
Re: Mouse pointer moving randomly
« Reply #7 on: February 01, 2022, 07:23:04 pm »
I want to report that I have upgraded my Lazarus to version 2.2.0 and the issue never happened anymore.

 

TinyPortal © 2005-2018