Forum > LCL

Mouse button status outside the form (fullscreen) on Rasbian/arm

<< < (2/4) > >>

Lulu:
Hi, may be this can help you.

xardomain:
Hi Lulu,
that unit does not work for me, if I understood correctly it is for console application (text?) not gui.

KodeZwerg,
Since that raspberry will be dedicated for mouse and keyboard events I just created an app with a form maximized, I can get mouse movement events by using mouse.cursorpos.x and y. This is not available if I specify uses mouse clause btw.

About keypress and mouse buttons event they trigger the form events, having the form maximized they always work.

>Hi xardomain, just want to let you know that you should place your code inside the code viewer.
Hi Joanna, thanks.

>Also you went to wrong place earlier which is why nobody answered.
Do you mean the IRC?

Currently starting to add a Synapse client that will send mouse and keyboard events to the server, another raspberry.



--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TForm1.Timer1Timer(Sender: TObject);var test : longint;begin // Label1.caption := IntToStr(Mouse.CursorPos.x);  // Label2.caption := IntToStr(Mouse.CursorPos.y);  Label1.caption := IntToStr(Mouse.CursorPos.X);  Label2.caption := IntToStr(Mouse.CursorPos.y);  Label3.caption := IntToStr(Form1.Width);  Label4.caption := IntToStr(Form1.height)end; procedure TForm1.FormCreate(Sender: TObject);begin      Form1.Top := 0;      Form1.Left := 0;      // Form1.Width:= 1920;      // Form1.Height:= 1080;      Form1.KeyPreview := True;      Form1.WindowState := wsFullScreenend; procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;  Shift: TShiftState; X, Y: Integer);begin    if Button = mbleft then  begin    CheckBox1.Checked := TRUE  end;  if Button = mbmiddle then  begin    CheckBox2.Checked := TRUE  end;  if Button = mbright then  begin    CheckBox3.Checked := TRUE  endend; procedure TForm1.FormMouseUp(Sender: TObject; Button: TMouseButton;  Shift: TShiftState; X, Y: Integer);begin  if Button = mbleft then  begin    CheckBox1.Checked := FALSE;  end;  if Button = mbmiddle then  begin    CheckBox2.Checked := FALSE;  end;  if Button = mbright then  begin    CheckBox3.Checked := FALSE;  end;end;

VisualLab:

--- Quote from: xardomain on August 18, 2023, 11:04:38 pm ---I would like to setup a second keyboard and a second mouse on the dual headed computer, completely independent from the target but also independent from the primary keyboard and the mouse, they need not to interfere each other.

Connecting two keyboards and two mouses won't work because:
1) I cannot detect events from one particular keyboard or mouse connected
2) They are free to go from one monitor to another, I want them to be restricted to their monitors.

On the dual headed computer I will record macro events from the keyboard and mouse, and will generate the clicks and the keystrokes using a couple of devices (like 2 PI zero W) that will regenerate the events for the target computer using USB gadget keyboard and mouse emulation.

--- End quote ---

The success of this venture probably does not depend on Lazarus or FPC, but on the operating system. The system would have to allow for unambiguous identification of mice and keyboards (i.e. provide their identifiers). In the mouse handling events implemented in LCL controls, there is no information from which mouse (something like ID or similar) the data (coordinates, button IDs) comes from. So the mouse information (device ID or something) would have to be obtained from the system in some other way.

Unfortunately, there is no standard GUI support in Linux - there is the old (and overly complicated) X Window and the still undercooked Wayland, which do not support all GUI functionality, but shift some of the functionality to desktop environment managers (GNOME, KDE, etc.).

So the solution to your problem may exist, but it will require a lot of your own work and custom workarounds.

---

EDIT:

And could you describe (more generally) what kind of software you are developing and what goal you want to achieve? Maybe some alternative ideas for your application would emerge from such a discussion? Such brainstorming of many people can sometimes bring interesting results.

xardomain:
hi VisualLab,
I have a couple of PI2 laying around so the solution is already found.

One Pi2 will be a "dedicated" device, the keyboard and mouse will be connected to it. Its only purpose is to capture mouse and keyboard events.
The form is maximixed (tested with a PI4 at the moment) and correctly detect mouses movements and mouse clicks in headless mode using VNC. Just in case I ordered a HDMI "dummy" plug.

I will have to add some glue for handling keyboard events and send the data through a telnet connection to the dual headed pi.

The dual headed pi will use a "native" keyboard and mouse to use the GUI (let's say left monitor) and keep a VLC maximixed on the right monitor.
On the right monitor VLC will show maximixed the frame grabber with the output of the target computer.

Reading the events from the PI2 will generate mouse and keyboard using a PI zero (hopefully one will be enough for mouse/keyboard, else one for the keyboard and another for the mouse).

Not the easiest solution but doable. The "native" mouse will be free to roam from one monitor to another (maybe is possible to limit its movement to the left monitor) but will not influence the target machine (you need to generate events using the pi zero in gadget mode to transmit commands/events).
Same goes for the "native" keyboard, it could not communicate with the target, unless the program running on the dual headed pi will decide to.

I only need a pi wireless ready adapter, I had one N150 small dongle that I am unable to locate. That was nice not requiring driver setup and such.

Giuseppe

VisualLab:

--- Quote from: xardomain on August 21, 2023, 01:19:52 pm ---Reading the events from the PI2 will generate mouse and keyboard using a PI zero (hopefully one will be enough for mouse/keyboard, else one for the keyboard and another for the mouse).

--- End quote ---

Well, operating systems currently in use were designed for workstations with the assumption that one keyboard, one mouse and one monitor would suffice for one user (except that support for more monitors in the most popular systems has somehow been patched over time). Anyway, from your description it seems that you solved the problem optimally.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version