That's much too complex a topic to be covered in a newgroup
posting (and then it would be off-topic to comp.lang.c++).
You'll have to get a book, probably best is Adrian Nye, "Xlib
Programming Manual for Version 11". You'll have to set a mask
for all events you want to receive for a window (and be pre-
pared to deal with not only KeyPress, KeyRelease, ButtonPress,
ButtonRelease and MotionNotify, but also Expose and ResizeRe-
quest events). Then you basically wait in a loop for XEvents
coming in and react to them. The details can be "interesting".
Question: why not use one of the existing libraries (Qt, Gtk
and a lot more) that wrap Xlib (and often many others) and
are much easier to use and tend to be better documented as
well? It's about 20 years since I've written a program just
using bare Xlib...
Best regards, Jens
--
\ Jens Thoms Toerring ___
j...@toerring.de
\__________________________
http://toerring.de