Sending mouse click events to other windows in Linux without moving the mouse

0

I have a Windows application which I want to port it to Linux. In this application, I send mouse click events to other applications. The function which does the job is like this:

void MainWindow::send_mouse_event(HWND hwnd, int x, int y)
{
    int coordinate = x | (y << 16);
    LRESULT res = SendMessage(hwnd, WM_LBUTTONDOWN, 0x00000001, coordinate);
    SendMessage(hwnd, WM_LBUTTONUP, 0x00000000, coordinate);
}

I searched for equivalent code in Linux and I found xdotool. As far as I understood, using xdotool, you have to move the mouse to a point at first, and then click that point. But in Windows, I could send mouse click events virtually to other windows without moving the mouse. So is the story true about Linux? Is it possible to send a click event to other applications without (really) moving the mouse in Linux? I'm using Ubuntu 18.04.

c++
linux
winapi
mouseclick-event
xdotool
asked on Stack Overflow Nov 25, 2018 by s4eed • edited Nov 25, 2018 by s4eed

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0