You are not logged in.
I know this sounds impossible/insane, but I want to see how it's done.
I want to see how to open a socket to X, send data over the wire open the display, initialize and open a window, paint text in it, get events, and so on, without using Xlib or any other helper libraries.
Or is this just too stupid to want to do?
-dav7
Last edited by dav7 (2008-10-18 07:10:05)
Windows was made for looking at success from a distance through a wall of oversimplicity. Linux removes the wall, so you can just walk up to success and make it your own.
--
Reinventing the wheel is fun. You get to redefine pi.
Offline
You are in deep waters, my friend
Try here for starters:
http://tronche.com/gui/x/
I've an ebook regarding programming x somewhere; if I find it
I'll let you know.
Deej
Offline
It's not too bad, but it does take some boilerplate. It could be more elegant, but I don't know why raw X programming has a reputation for being extremely painful. Here's a little example from Simple Examples of Driving X11 From Common Lisp Using CLX. It opens a window, draws some text, responds to exposure events by redrawing the contents, and closes on a mouse-click event.
(defun hello-world (width height &optional (host ""))
(let* ((display (xlib:open-display host))
(screen (first (xlib:display-roots display)))
(black (xlib:screen-black-pixel screen))
(white (xlib:screen-white-pixel screen))
(root-window (xlib:screen-root screen))
(grackon (xlib:create-gcontext
:drawable root-window
:foreground white
:background black))
(my-window (xlib:create-window
:parent root-window
:x 0
:y 0
:width width
:height height
:background black
:event-mask (xlib:make-event-mask :exposure
:button-press))))
(describe (xlib:gcontext-font grackon))
(xlib:map-window my-window)
(xlib:event-case (display :force-output-p t
:discard-p t)
(:exposure (count)
(when (zerop count)
(xlib:draw-glyphs
my-window
grackon
20 50
"Hello World!"))
nil)
(:button-press () t))
(xlib:destroy-window my-window)
(xlib:close-display display)))
EDIT: Although writing window managers is still baffling to me. It would help if there were a clear tutorial that explained just what a WM has to do to do its job. Reading source code leaves one wondering just what is necessary and what is optional.
Last edited by pauldonnelly (2008-10-17 20:49:40)
Offline
deej: That looks like an Xlib manual...?
pauldonnely: Ah. That Lisp example is actually an Xlib-based example. Xlib is built on an architecture of binary calls and socket manipulation, and it's the binary area I want to get into; I want to go below Xlib, and see if it really is possible to make an application in less than 40KB because of all the handling you have to do yourself
Also, about windowmanagers, they either implement all or part of the ICCCM, NETWM and EMWH standards or they don't. If they do, they're more awesome than the others (and they have better interoperability)
-dav7
Last edited by dav7 (2008-10-18 06:47:52)
Windows was made for looking at success from a distance through a wall of oversimplicity. Linux removes the wall, so you can just walk up to success and make it your own.
--
Reinventing the wheel is fun. You get to redefine pi.
Offline
I think it's just stupid
Use xcb -- the X protocol c bindings. They are much more barebones than xlib, and also asynchronous, as opposed to the synchronous Xlib.
Offline
Interesting. I recently heard about XCB; they might just work out in the future. However, XCB is not everywhere (yet) so isn't admittedly as portable.
-dav7
Last edited by dav7 (2008-10-18 11:45:46)
Windows was made for looking at success from a distance through a wall of oversimplicity. Linux removes the wall, so you can just walk up to success and make it your own.
--
Reinventing the wheel is fun. You get to redefine pi.
Offline
pauldonnely: Ah. That Lisp example is actually an Xlib-based example. Xlib is built on an architecture of binary calls and socket manipulation, and it's the binary area I want to get into; I want to go below Xlib, and see if it really is possible to make an application in less than 40KB because of all the handling you have to do yourself
I totally missed where you said you didn't want to use xlib, and thought you were asking about writing code with xlib rather than a GUI toolkit—which most people consider to be plenty insane.
Offline
Heh, I already plan to do that (and am working on such a program at the moment)
The end goal of this is to get enough knowledge about how X works to not only go below Xlib to the socket level but also do it in assembly language. Which I don't really know so well at the moment.
-dav7
Windows was made for looking at success from a distance through a wall of oversimplicity. Linux removes the wall, so you can just walk up to success and make it your own.
--
Reinventing the wheel is fun. You get to redefine pi.
Offline
Heh, I already plan to do that
(and am working on such a program at the moment)
The end goal of this is to get enough knowledge about how X works to not only go below Xlib to the socket level but also do it in assembly language. Which I don't really know so well at the moment.
-dav7
Sounds like... fun? As long as you realize the badness of this idea for any practical purpose.
Offline