Hi,
$WINDOWID might be what you're looking for.
Note that whatever you do, it'll probably be an ugly hack
that just happens to work with your favorite terminal at a
hardcoded font size. E.g. how would your X app figure out
the terminal's font size?
Also, keep in mind that there are terminals that have multiple
tabs and your one might not be the visible one (e.g.
gnome-terminal -- also beware that it's known in
gnome-terminal that if you drag-n-drop a tab to another
gnome-terminal window then $WINDOWID becomes incorrect because
it can't be updated); there are terminals with split screen
feature (e.g. gnome terminator) and then how do you figure out
the offset; etc...