2

I am facing this problem: https://unix.stackexchange.com/questions/499383/xdotool-getmouselocation-and-getwindowgeometry-y-location-inconsistency

As an alternative I am thinking of a way on how to get the location of any window application in Gnome/Ubuntu 18 Desktop programmatically preferably using either Java/JNA or C++.

Is there a way to get the Window Position (X, Y) coordinate using either Java or C++, in Ubuntu 18.04.1 LTS Desktop, for any Desktop application e.g. Terminal or GEdit?

Specifically, I want to actually get the window location of either Gnome Terminal or GEdit application from a Java/C++ program.

Artanis Zeratul
  • 963
  • 2
  • 14
  • 40
  • @kai, sorry to have you confused, but I will be getting any arbitrary application's window (x,y) coordinates that is not created by automator (java/c++) program itself. I want to actually get the window location of either Gnome Terminal or GEdit application from a Java/C++ program. – Artanis Zeratul Feb 08 '19 at 02:04
  • can you share the links please? – Artanis Zeratul Feb 08 '19 at 02:54
  • this looks like a nice tutorial on xlib https://tronche.com/gui/x/xlib/ and the gtk reference is quite structured and good https://developer.gnome.org/gtk3/stable/ – kai Feb 08 '19 at 03:13
  • but like i said not necesarily reilable and you may find invisible windows(eg for focus reasons) instead of the one you are looking for.... – kai Feb 08 '19 at 03:16
  • @kai, the tutorial doesn't contain example codes. – Artanis Zeratul Feb 08 '19 at 03:26
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/188086/discussion-between-artanis-zeratul-and-kai). – Artanis Zeratul Feb 08 '19 at 04:03
  • i am there and keep the chat window open ... – kai Feb 08 '19 at 04:09
  • @ArtanisZeratul did you find an answer ? I am interested in similar: getting windows position of Gnome 2.28.2 windows on CentOS 6.8, preferable from Bash or Perl – Axel Bregnsbo Nov 23 '19 at 21:30
  • @AxelBregnsbo, this is from kai... try this --> https://stackoverflow.com/questions/3909713/xlib-xgetwindowattributes-always-returns-1x1
    but it is off by 6 pixels.
    – Artanis Zeratul Nov 24 '19 at 06:54

0 Answers0