About mouse controlling in c/c++ [ubuntu] gnome or kde??? probably - linux

Several questions about how to write a mouse controlling module in c/c++
Any comments are much appreciated.
I have a mobilephone which can connect to my ubuntu 11.04 laptop
through wireless network.
I installed a putty for nokia symbian s60 v3.
With putty, I can execute commands such like mplayer in order to play
music when i am in my bed.
The problem is putty cannot controll mouse directly.
I am thinking if I can write a program who receives arrow keys signals
from my putty and move the mouse from my desktop.
Then I can control my laptop when I am doing a presentation through my
mobile-phone.
If anyone knows how to deal with it, please give me some advices.
Where should i get started? which c/c++ header/libs that i have to use.
Any websites or online mannual that i should take a look at.
I am running unity (based on gnome 2.3. right?)
Thanks.
Guannan

This is actually not simple on linux/X window system, but it can be done. Probably one of the following would be your answer:
set up xtest so that you can inject mouse events into the window system
tell the window manager to take input from a "fake mouse" of some sort - maybe you can tell it that a named pipe or even pty is a serial mouse?
make or find a kernel driver giving you another mouse entry under /dev/input to which you can push mouse events from some other program

Related

Xinput doesn't produce any mouse events when cursor is over the Chrome/Opera

I am developing a Linux program on c++ for listening mouse/keyboard activities. I am using the xinput library: "xinput test <device_id>" command to listen to events. When mouse cursor is over the Chrome or Opera(no matter in focus it or not), the xinput doesn't produce any events, so my program is not working. Can it be that Chrome "eats" events and does not send it further?
The keyboard events are work fine thought.
I am trying to get some info of root cause(Why is this happen? What other software have the same effect?), but no results, so any help appriciated.
Tried it on:
Ubuntu 18.04, 20.04.01
Mate, Gnome3
Besides, I have tried with several mouse/touchpad devices, with the same impact and tried to listen all available devices(that are listed in xinput list) - no events produced even on Virtual devices.
UPDATE: I have tried the libevdev library and it worked thought, but It doesn't appropriate to me, because it can't listen the Virtual devices(like XTEST pointer and XTEST keyboard) and uses a lot of cpu.

What is the difference between display server, a window manager, and a compositor. X windows Vs Wayland

I am trying to understand Wayland protocol but can't grasp that a window manager tells display server where each windows are. So is display server a renderer or compositor?
I've been searching for the answer myself for quite some time now as well.
I will try to provide a partial answer.
Reading the official docs it seems to me that, using the wayland protocol, the display server, window manager, and the compositor become one single program.
For example, xorg is a display server, i3 is a window manager, picom is a compositor but sway is all three.

How to use my local mouse to control remote desktop

I want to develop a program on both Windows and Linux that can use the mouse that's being physically plugged into my machine to control the mouse event in the remote desktop which is a Windows OS.
I am a beginner so I would like to know how will this work, what do I need to learn before I get started.
For now, I am imagining that I need to firstly build a connection between my local device and a server and stay connected during the whole session using some kind of protocol. Then I need to connect my mouse to the remote mouse somehow through the driver? (Correct me if I am wrong).
This question is aimed to get some general idea of what components should this program have and what I have to learn before get started.
Thanks!

DIY: Project remove VGA cable by sharing screen over wifi to TV

This is one of my coding projects. I'm fairly new to linux, so I need some pointers and thoughts from you guys, before I get started. I know there exists screen sharing software already, but I want to make my own! (=
Specifically, I want to clone my laptop screen to my TV over WLAN, via a linux box that is connected to a TV through a VGA cable:
Laptop streams it's screen
Linux box reads the stream
Linux box outputs the stream into the TV (through a VGA cable)
First of all, how do I record the screen and send the stream in real time in linux?
Secondly I must write a program that reads the stream being sent. The program must listen to some port, and collect the data being streamed from the laptop. Any thoughts?
Then I must output that data in real time to the TV. Do you how any ideas on how to solve this?
Thanks!
Edit: Regarding programming languages, I'm most comfortable with python.
Sharing your screen can be done via the various flavors of VNC (ie. RealVNC, TightVNC, UltraVNC, etc.). Most of them are Open Source, you might want to:
Stick with the VNC protocol for later compatibility
Take example of how the established solutions does for screen-hooking.
In Linux, the graphics are all processed by Xorg (new version of X Server), which was developed with networking embedded. This explains why you can ssh -X into a machine, execute a graphical interface on it and see it on your remote computer. I recommend you to read about hooks on Xorg to achieve your needs.
You need a client-server topology to achieve your needs. You are not talking about any programming language you forecast to use, though. Some languages may be harder than some to start with. Furthermore, this kind of code is already really well understood under every major programming language. You should try to at least use a framework that simplifies your networking portion of the project.
Sharing a screen on the TV can be done by your video card driver in Linux. Just check on your Desktop Environment (KDE and Gnome offers video configuration panels, for example) or in your video card configuration (nVidia and ATI Linux drivers offers multiple screen support)
It seems to me like you're trying to reinvent the wheel and are not too sure about how to begin. I recommend you to begin simple with one of the already proven VNC software and see how it goes from there. If a feature is missing, you've got the source code of the server and the client, so you can continue development of these projects. Once you've got your setup working, start thinking about replacing a single piece of the puzzle by your own code, and see how it goes.
Do not expect good (full HD, for instance) video quality on your TV without some very capable CPU/GPU and a 802.11n wireless network empty of users and be ready to accept some lag for the codecs to kick in.
You should try to take as small steps as possible. If I were taking up such a project, my first step would be to try to implement a solution using standard unix tools (e.g. netcat or socat for the network part, mplayer or vlc for the playback and maybe ffmpeg for the capture)? Then, replace each component with custom-written ones if needed.

How to simulate Touch event in Linux/Mac/Windows?

I wanna to simulate touch event in Windows / Mac OS X or Linux (OS is not critical).
Under Windows Vista and Windows 7, the Multi-Touch Vista drivers let you use 2 mice to simulate multi-touch gestures. It should degrade nicely to the "normal" touch experience. In my experience, it can be fairly tricky, but it works.
It really kind of depends on what you're working on and what the goal is. If you can separate the response from the action in your application, that will make it a lot easier to test something like this without going through a lot of hassle.
If you wind up needing a touch device, Wikipedia has a nice list of multi-touch devices.
A lot of time passed since this question, however, maybe someone will google for similar question and find that there is another option:
If you have android device, you can use your device as touch screen for windows.
Maybe there are other software to do this, but I used following one:
https://play.google.com/store/apps/details?id=com.tnksoft.winmultitouchfree
This program from some japanese guy coupled with desktop app does the trick.
You can get desktop app from his site http://www.tnksoft.com/ .
Unluckily it is japanese site, but it's not hard to find necessary program there(it has easily recognisible icon)>
Alternatively you can get link once you install android app.

Resources