2

Is it possible to send an event to a particular widget (say a button) in Linux (X window system)

I am looking for an equivalent to the following code for Linux (using Xlib)

#include <windows.h>
int main()
{
  HWND WindowHandle;
  HWND ButtonHandle;

  WindowHandle = FindWindow(NULL, "File Download");
  ButtonHandle = FindWindowEx(WindowHandle, 0, "Button", "&Open");
  SendMessage (ButtonHandle, BM_CLICK, 0 , 0);

 return 0;
}

I guess that FindWindow can be simulated by XFetchName, but I have no idea how to find a particular widget's ID by name (FindWindowEx) in the case where I only know the widget "name" (i.e. caption in the case of a button).

Can I do that?

1 Answer 1

0

Maybe, using the XTest extension:

http://www.x.org/releases/X11R7.5/doc/Xext/xtestlib.pdf

However, there is no portable way to determine what is and isn't a widget on the screen, as some GUI toolkits render everything as separate X objects, while others do their own compositing first.

Sign up to request clarification or add additional context in comments.

1 Comment

Hey , thank you for your quick response , However It is not clear how xtest is related to my question . Thanks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.