Subject: FVWM: Intercepting X11 events: from where and how

From: Nicholas Paul Johnson <[email-masked]>
Date: Mon, 10 May 2004 04:31:12 -0400 (EDT)

Hello all,

Say I wanted to intercept all X11 events, using an LD_PRELOAD method.  
Assume that _everything_ is dynamically linked.

If I redefine XSendEvent(), should I preload this into the window manager,
or into the X server itself?  If XSendEvent() is not the function I should
intercept, then what should I intercept?

I guess these questions boil down to two questions:
	Who generates XEvents -- the window manager, the X server, or both?
and,
	When generating XEvents, does the source use XSendEvent()?

Thanks a lot,
- -- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  Nicholas Paul Johnson
  o nickjohnson \at\ virginia \dot\ edu
  o 3ebf10a7 subkeys.pgp.net
  o http://manjac.ath.cx/nick
  o "When all you've got is a hammer,
    everything looks like a nail.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

--
Visit the official FVWM web page at <URL: http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to [email-masked].
To report problems, send mail to [email-masked].

---

From: Scott Smedley <[email-masked]>
Date: Mon, 10 May 2004 23:46:41 +1000

> Assume that _everything_ is dynamically linked.

A very strange thing to do.

> intercept, then what should I intercept?

A very strange question.

> 	Who generates XEvents -- the window manager, the X server, or both?

both. Applications can also generate X events.

> 	When generating XEvents, does the source use XSendEvent()?

XSendEvent is an Xlib function, so C programs would use this
interface. Other non-C GUI toolkits would use a similar interface.

What exactly are you trying to do?

Perhaps you might be interested in the 'xscope' program (not to
be confused the the Mac xscope program) which lists/logs X events.
Very powerful when combined with 'Xnest' - a favorite development
combination of mine.

Or maybe the 'xev' utility?

Curiouser & curiouser ...

SCoTT. :)

---

From: Thomas Adam <[email-masked]>
Date: Mon, 10 May 2004 13:52:17 +0100 (BST)

> 	Who generates XEvents -- the window manager, the X server, or both?

Both, it is just that usually the application in question deals with how
they're dealt with.

> 	When generating XEvents, does the source use XSendEvent()?

Yes.

-- Thomas Adam

=====
"The Linux Weekend Mechanic" -- http://linuxgazette.net
"TAG Editor"                 -- http://linuxgazette.net

"<shrug> We'll just save up your sins, Thomas, and punish 
you for all of them at once when you get better. The 
experience will probably kill you. :)"

 -- Benjamin A. Okopnik (Linux Gazette Technical Editor)

____________________________________________________________
Yahoo! Messenger - Communicate instantly..."Ping" 
your friends today! Download Messenger Now 
http://uk.messenger.yahoo.com/download/index.html
--
Visit the official FVWM web page at <URL: http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to [email-masked].
To report problems, send mail to [email-masked].

---

From: Scott Smedley <[email-masked]>
Date: Tue, 11 May 2004 13:07:20 +1000

: > > 	When generating XEvents, does the source use XSendEvent()?
: > 
: > XSendEvent is an Xlib function, so C programs would use this
: > interface. Other non-C GUI toolkits would use a similar interface.
: > 
: I would imagine that non-C GUI toolkits would be written in C; tk is 
: written in C for example.  Do you disagree?

Sorry - I didn't explain myself properly. I meant other GUI toolkits
that aren't written in C would use a similar interface. For example,
FvwmTabs uses the CPAN X11::Protocol module which "talks" with the
X server directly - no C, all Perl.

Tk is most definitely written in C.

: I had never thought of this method of intercepting events; it looks like a
: good idea.  The code I've found
: (http://www.mit.edu/afs/athena/system/x11r4/src/contrib/clients/xscope/)  
: looks almost painfully old (written in K&R C; x11r4 in the uri).

Grab the CVS version:

$ cvs -d :pserver:[email-masked]:/local/src/CVS login
(Logging in to [email-masked])
CVS password: [hit return here]
$ cvs -d :pserver:[email-masked]:/local/src/CVS co xscope

: This xscope tip is really helpful.  Thanks.

Glad I could help.

SCoTT. :)