You are not logged in.

#1 2019-06-28 11:14:32

Portal
Member
Registered: 2019-03-11
Posts: 48

where to learn xlib

I really want to learn x11 programming... but I can't seem to find any good resources to learn xlib. https://www.x.org/docs/X11/xlib.pdf is huge, but it is more a documentation than a tutorial, plus it is extremely hard to understand... I've tried searching everywhere
How did you learn xlib? What courses/books do you recommend?

Last edited by Portal (2019-06-28 11:17:10)

Offline

#2 2019-06-28 11:46:18

schard
Member
From: Hannover
Registered: 2016-05-06
Posts: 757
Website

Re: where to learn xlib

Do you want to contribute to X11 or use X11's interface code?
If the former: Read X11's source code.
If the latter: Read the documentation you already found and maybe the source code of e.g. dwm to get an example of how to use it.

Online

#3 2019-06-28 12:20:36

Portal
Member
Registered: 2019-03-11
Posts: 48

Re: where to learn xlib

are there really no easier ways to learn the interface?

Offline

#4 2019-06-28 13:03:02

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 23,465
Website

Re: where to learn xlib

Tinker with window managers.  Start here:
http://incise.org/tinywm.html


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Online

#5 2019-06-28 13:19:52

Portal
Member
Registered: 2019-03-11
Posts: 48

Re: where to learn xlib

thanks that looks really helpful!
but did you guys learn xlib just by reading the documentation? It is flooded with comfusing terminologies...

Offline

#6 2019-06-28 13:23:53

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 23,465
Website

Re: where to learn xlib

Don't just read the docs.  Read and implement, or read while you are using it.  Read and understand the documentation for particular functions or structures as you are seeing them put into use.

So to understand and modify tinywm, there are only a couple pages of the Xorg docs, with a couple functions and structures you'd need to understand.  Then start adding things to tinywm, or start with other small but not quite so minimal wms like dwm.

As for the actual documentation, I'd never read it in a pdf like that.  Use the man pages.  I've also used this site extensively.

Last edited by Trilby (2019-06-28 13:25:33)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Online

#7 2019-06-30 00:51:52

ARaCHnid
Member
Registered: 2018-09-20
Posts: 6

Re: where to learn xlib

You are right, the documentation and recommended books are impossible to read.

Here's a tutorial for X Window System Basics:
https://magcius.github.io/xplain/article/x-basics.html

Here's a tutorial for writing a window manager:
https://jichu4n.com/posts/how-x-window- … one-part-i

In terms of getting started, just google around for tiny "main()" style snippets that show how to create a program that draws simple lines / text, etc, then try to understand the programs as best you can.

Offline

#8 2020-01-06 19:54:56

datdDeeDeeK
Member
Registered: 2020-01-04
Posts: 1

Re: where to learn xlib

I know this reply is months and months after the fact, but I hope it's still helpful.

Here is a nice handy Xlib tutorial and similarly handy XCB tutorial, which I've found useful:
Handy Xlib tutoral
Similarly Handy XCB tutorial

And here's a nice Wikibook: Nice Wikibook

I've come across a PDF copy of the Xlib Programming Manual for X11 on a page hosted in ?Finland? I think. I'm unsure of the legalities,  but on the first page it states that copying the document is not allowed...but of course anything we read online is a copy. So the copy tells me not to make copies? Anyhow, I perused it without saving a copy, and I found it helpful. The book is old, like 1992, but still quite relevant. Here's where you will find it, and a couple of books about OpenGL: index of X11 and OpenGL books

Asking around in StackOverflow will get you leads. First browse questions already asked and answered, tagged  [X11],  to avoid asking redundant questions.

As a programmer from back in the 1980's, returning to the field 35ish years later and  relatively new to X11, GNU/Linux, and other unix-ish OSes, I find much documentation incomprehensible at times, especially that to do with X11, Xlib, and XCB. As I've progressed it's become obvious that the problem for many of us noobs is nothing more than the gatekeeping effect caused by unfamiliar vocabulary. Documentation that's clear and comprehensible to those already familiar with X11, Xlib, and XCB, is nearly opaque to the uninitiated so sometimes it's hard even to know what to ask. There are many illuminating  projects on github.com and lots of fellow noobs with lots of short experiments in their repositories.

GOOD TO KNOW is that Xlib and XCB calls can be intermixed with a little care, so if you rather use XCB but cannot find the info on how to use one or another functions or data structures, you can often use the better documented Xlib equivalents. Or by reading the Xlib documentation you can find insight into how to use the XCB equivalents.

Stack Overflow, as I mentioned, is rife with helpful advice, and they've been friendly and patient with me and my redundant questions.

Offline

Board footer

Powered by FluxBB