[Lazarus] How to mimic MWSnap's "Window Information" feature on X11

Graeme Geldenhuys graemeg.lists at gmail.com
Sun Oct 26 12:36:12 CET 2008


On Thu, Oct 23, 2008 at 11:36 PM, Graeme Geldenhuys
<graemeg.lists at gmail.com> wrote:
> * *This* is the real feature I'm trying to duplicate. As you move the
> mouse, it draws a rectangle around the window area it's giving
> information about.
>  eg: The button in a ComboBox or a Button or Edit on a Form etc.. The
> following link shows what I'm trying to accomplish.
>  http://opensoft.homeip.net/~graemeg/mwsnap_screenshot.png

Just a follow-up.  I managed to implement such a program for X11
without much issue. It was easier than expected. There was also no
need to take a snapshot of the desktop. This is how I did it.

* To query the window/widget under the mouse pointer. I do a recursive
XQueryPointer() call. This could probably be improved with a
XQueryTree() call, but I couldn't figure out how to use the latter.
* Then to draw the highlighting rectangle around that window I used
the same functionality as is done for "rubber banding" when you resize
windows. I created a custom "outline" grahics context, set it's
"._function" call to GXInvert, set SubWindowMode property to
InferiorWindow and then all that remains is to draw directly onto the
"root" desktop window.
* To erase the highlighting rectangle, I simply redraw over the old
rectangle and GXInvert handles the rest.

Thanks to everybody that suggested alternatives etc...

Regards,
  - Graeme -


_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/



More information about the Lazarus mailing list