is there a (Xlib, XCB)-way to simulate a mouse click in a minimized window (in this case chromium)? I am trying to automate some stuff and it works fine if the window is somewhere on the screen (see code below). However, as soon as I (sometimes accidently) minimize it, the window doesn't seem to register the XEvents anymore (e. g. buttons on websites aren't pressed, tabs not refreshed...). There are unfortunately no error messages.
Thanks in advance!
.
.
.
XButtonEvent button1EventForSpecificWindow(Display *display, Window rootWindow, Window destWindow, int x,int y, int root_x,int root_y,bool press = true)
{
XButtonEvent click;
// test send event to window
click.display = display;
click.root = rootWindow;
click.time = CurrentTime;
click.same_screen = True;
click.button = Button1; // Button 4 mouswheel up!
click.state = 0;
click.x = x;
click.y = y;
click.x_root = root_x;
click.y_root = root_y;
click.window = destWindow;
if (press)
click.type = ButtonPress;
else
click.type = ButtonRelease;
return click;
}
.
.
.
XButtonEvent click1;
XButtonEvent click2;
memset(&click1, 0, sizeof(click1));
memset(&click2, 0, sizeof(click2));
click1 = button1EventForSpecificWindow(display,rootWindow,window_return,dest_x_return,dest_y_return,929,442,true);
click2 = button1EventForSpecificWindow(display,rootWindow,window_return,dest_x_return,dest_y_return,929,442,false);
XSendEvent(click1.display, click1.window, True, ButtonPressMask, (XEvent *)&click1);
XSendEvent(click2.display, click2.window, True, ButtonReleaseMask, (XEvent *)&click2);
XFlush(display);
.
.
.