Writing a window manager for X (.org)
发表于 : 2011-11-27 19:46
> Hi, newsgroup!
>
> The problem: I want to write a window manager - just for
> "exercise" - and I cannot find a documentation on the
> net somehow describing, where i should start.
The O'Reilly "Xlib Programming Manual" is a very good book (but get it's
companion the "Xlib Reverence), and covers all topics (with source code)
up to and including a simple example window manager.
The one "problem" with the book is that examples tend to be complete and
correct, but rather verbose. The "hello, world" program is 7 pages long
(you can do it in nearly 7 lines, at a push), but is very complete and is
really more than a "hello, world" program.
> It's not hard to get some sources (1000s of windowmanagers
> on Linux) of course, I just don't have a single clue, where
> to ->start.
They may be worth looking at later, but only once you know what's going on.
If you want to get in to "complete" window manager design, eg one that
obeys requests from various windows, you might like to have a glance at
teh ICCCM. Be warned, though, this document assumes pretty in-depth
knowledge.
> 2 questions for example:
> - How do I "register" my app as windowmanager at X ?
You select SubstructureRedirectMask on the root window. This allows the
window manager to intercept requests to move/resize windows etc.
> - What interfaces/callbacks do I have to provide ?
> - How do X-Server and WM communicate ?
Via the X protocol...? More specifically, mostly they don't, the
windowmanager intercepts communication. Communication is done via hints
and properties.
> You already see it: My knowledge about X still is ...
> quite "basic". (Please laugh _now_, I like it the tough way !
> To be finally more explicit: I _really_ don't need answers
> to my questions, they're just examples. I'm just asking,
> if someone knows, where to start reading.
How much have you written in Xlib?
-Ed
--
(You can't go wrong with psycho-rats.) (er258)(@)(eng.cam)(.ac.uk)
/d{def}def/f{/Times findfont s scalefont setfont}d/s{10}d/r{roll}d f 5/m
{moveto}d -1 r 230 350 m 0 1 179{1 index show 88 rotate 4 mul 0 rmoveto}
for /s 15 d f pop 240 420 m 0 1 3 { 4 2 1 r sub -1 r show } for showpage
>
> The problem: I want to write a window manager - just for
> "exercise" - and I cannot find a documentation on the
> net somehow describing, where i should start.
The O'Reilly "Xlib Programming Manual" is a very good book (but get it's
companion the "Xlib Reverence), and covers all topics (with source code)
up to and including a simple example window manager.
The one "problem" with the book is that examples tend to be complete and
correct, but rather verbose. The "hello, world" program is 7 pages long
(you can do it in nearly 7 lines, at a push), but is very complete and is
really more than a "hello, world" program.
> It's not hard to get some sources (1000s of windowmanagers
> on Linux) of course, I just don't have a single clue, where
> to ->start.
They may be worth looking at later, but only once you know what's going on.
If you want to get in to "complete" window manager design, eg one that
obeys requests from various windows, you might like to have a glance at
teh ICCCM. Be warned, though, this document assumes pretty in-depth
knowledge.
> 2 questions for example:
> - How do I "register" my app as windowmanager at X ?
You select SubstructureRedirectMask on the root window. This allows the
window manager to intercept requests to move/resize windows etc.
> - What interfaces/callbacks do I have to provide ?
> - How do X-Server and WM communicate ?
Via the X protocol...? More specifically, mostly they don't, the
windowmanager intercepts communication. Communication is done via hints
and properties.
> You already see it: My knowledge about X still is ...
> quite "basic". (Please laugh _now_, I like it the tough way !

> To be finally more explicit: I _really_ don't need answers
> to my questions, they're just examples. I'm just asking,
> if someone knows, where to start reading.
How much have you written in Xlib?
-Ed
--
(You can't go wrong with psycho-rats.) (er258)(@)(eng.cam)(.ac.uk)
/d{def}def/f{/Times findfont s scalefont setfont}d/s{10}d/r{roll}d f 5/m
{moveto}d -1 r 230 350 m 0 1 179{1 index show 88 rotate 4 mul 0 rmoveto}
for /s 15 d f pop 240 420 m 0 1 3 { 4 2 1 r sub -1 r show } for showpage
代码: 全选
A web site has pointers to the documentation of ICCCM which defineds
the responsibilities and requirements for X Window System window managers.
http://www.rahul.net/kenton/index.shtml