Learning to Use X11
There aren't many resources available for X11 programming, in particular not for beginners. Some useful ones are:
Christophe Tronche' X11 Pages: Includes a short tutorial covering essentially the same material that has been covered here. This site is interesting because the entire Xlib reference is available. I strongly recommend browsing it.
Brian Hammond's X11 Pages: Another personal X11 page with a tutorial, containing a little bit more information than Tronche's tutorial but less organized.
XFree86 Version 4.1.0: The official page for the current release of the open-source version of the X Window System. At the bottom of the page one finds the complete set of man pages.
Xlib Programming Manual by Adrian Nye. Volume 1 of the X Window System Series at O'Reilly. The book is wordy (it needs three chapters and almost 80 pages to cover not much more material than the present article), and the presentation is not always noted for its clarity. Nevertheless, it is probably still the standard introduction to X11 programming.
X Window Applications Programming by Eric F. Johnson and Kevin Reichard. One of the few truly introductory books on X11 programming but unfortunately out of print.
Philipp K. Janert has been programming for 15 years, both inside and outside of academia. He prefers C/C++ and UNIX but tries not to be religious about it. He holds a PhD in Theoretical Physics from the University of Washington, Seattle.
email: janert@ieee.org
- « first
- ‹ previous
- 1
- 2
- 3
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Sponsored by AMD
Built-in forensics, incident response, and security with Red Hat Enterprise Linux 6
Every security policy provides guidance and requirements for ensuring adequate protection of information and data, as well as high-level technical and administrative security requirements for a system in a given environment. Traditionally, providing security for a system focuses on the confidentiality of the information on it. However, protecting the data integrity and system and data availability is just as important. For example, when processing United States intelligence information, there are three attributes that require protection: confidentiality, integrity, and availability.
Learn more about catching the bad guy in this free white paper.
Sponsored by DLT Solutions
| Dynamic DNS—an Object Lesson in Problem Solving | May 21, 2013 |
| Using Salt Stack and Vagrant for Drupal Development | May 20, 2013 |
| Making Linux and Android Get Along (It's Not as Hard as It Sounds) | May 16, 2013 |
| Drupal Is a Framework: Why Everyone Needs to Understand This | May 15, 2013 |
| Home, My Backup Data Center | May 13, 2013 |
| Non-Linux FOSS: Seashore | May 10, 2013 |
- Dynamic DNS—an Object Lesson in Problem Solving
- Making Linux and Android Get Along (It's Not as Hard as It Sounds)
- Using Salt Stack and Vagrant for Drupal Development
- New Products
- A Topic for Discussion - Open Source Feature-Richness?
- Drupal Is a Framework: Why Everyone Needs to Understand This
- Validate an E-Mail Address with PHP, the Right Way
- RSS Feeds
- Readers' Choice Awards
- Tech Tip: Really Simple HTTP Server with Python
- DynDNS
2 hours 29 min ago - Reply to comment | Linux Journal
3 hours 1 min ago - All the articles you talked
5 hours 25 min ago - All the articles you talked
5 hours 28 min ago - All the articles you talked
5 hours 29 min ago - myip
9 hours 54 min ago - Keeping track of IP address
11 hours 45 min ago - Roll your own dynamic dns
16 hours 58 min ago - Please correct the URL for Salt Stack's web site
20 hours 10 min ago - Android is Linux -- why no better inter-operation
22 hours 25 min ago
Enter to Win an Adafruit Pi Cobbler Breakout Kit for Raspberry Pi

It's Raspberry Pi month at Linux Journal. Each week in May, Adafruit will be giving away a Pi-related prize to a lucky, randomly drawn LJ reader. Winners will be announced weekly.
Fill out the fields below to enter to win this week's prize-- a Pi Cobbler Breakout Kit for Raspberry Pi.
Congratulations to our winners so far:
- 5-8-13, Pi Starter Pack: Jack Davis
- 5-15-13, Pi Model B 512MB RAM: Patrick Dunn
- 5-21-13, Prototyping Pi Plate Kit: Philip Kirby
- Next winner announced on 5-27-13!
Free Webinar: Hadoop
How to Build an Optimal Hadoop Cluster to Store and Maintain Unlimited Amounts of Data Using Microservers
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Some of key questions to be discussed are:
- What is the “typical” Hadoop cluster and what should be installed on the different machine types?
- Why should you consider the typical workload patterns when making your hardware decisions?
- Are all microservers created equal for Hadoop deployments?
- How do I plan for expansion if I require more compute, memory, storage or networking?



Comments
how to run the program
HERE IS THE SOLUTION
-open terminal and type 'apt-get install libx11-dev'.this should download and install the x11 library.
-open the program and include the library 'X11/Xlib.h'.
-compile the program by typing 'g++ -o output x1.cc -lX11'
-run the program by typing ./output.
hope this helps....XD
Draw a bare window (without Close, Minimize, Maximize buttons)
how to create a window described in the subject? I cannot find out the solution.
thanks and regards
woapxp
x11 man
i m new to x11. i m not getting the point how to set the path be4 running x11 prog. and i m not getting the manual pages after writing the man command on the shell.can anybody help me??
how to link xlib
how to link xlib
A Simple OpenGL Program Using GLUT and C
Running FreeBSD 6.1, I find that example programs shown in "OpenGL Programming Guide, Fifth Edition" (Red Book), can be compiled as follows:
gcc -I /usr/X11R6/include -L /usr/X11R6/lib -o your_program your_program.c -lX11 -lGL -lglut
Red Book examples always use GLUT.
So, just to let you know...
Matt
Re: Learning to Use X11
Hi!
On the web there are some Xlib tutorials like this. They create one or two windows, draw few lines or arcs (some even in color) and some show the typical XLib program main loop like the following:
Display* xDisplay;
XEvent xEvent;
...
xDisplay = XOpenDisplay(NULL);
while(!done) {
XNextEvent(xDisplay, &xEvent);
... // process the event
}
CloseDisplay(xDisplay);
Unfortunately it's the point where the tutorials finish. I hope there will be some continuing of this tutorial.
For example I'm unable to find how to handle linux signals in the main loop. XNextEvent() doesn't return EINTR like libc blocking functions.
Imagine you would like to write trivial clock program for X and you need catch some SIGALRM or other signal every second to refresh the clock as well as catch X events.
How to handle such task without busy waiting?
Thanks
Mity
<mity@srnet.cz>
Re: Learning to Use X11
I just made binary coded decimal clock program as my first xlib program to use events, but I didn't use events to tell the time. I just made a for(;;){ loop with sleep(1); as the first statement (this function is defined in unistd.h for some reason, and the parameter 1 means 1 second). This statement keeps the program from being active all the time. After that I just used the functions in time.h to find the time. I am not sure what other non-xlib events you might want to intercept, but you might be able to do something like this.
Unfortunate Title
What I expected from this article was how to use X, not code an X client. Change the title and you'll have an excellent resource (as how the article employs resources, not how an X user employs resources).
Re: Learning to Use X11
The author must be using Debian because he said the latest version of XFree86 is 4.1.0 not 4.2.0.
Re: Learning to Use X11
Stuff gets dated rather quickly. You're right, XFree86 does, indeed have 4.2.0 released, (and for all I know, they might even be past that now)! But 4.2.0 is new enough that only the latest distros are actually using it. For many vendors, their NEXT release will likely have 4.2.0 code, but 4.1.0 or even some 3.3.6 stuff is STILL pretty common, and not JUST for Debian-based systems, either.
XFreeGC
"We therefore explicitly free the allocated resources"
To be fussy, I guess we should call XFreeGC then also.
Looking forward for the next episode
servers and clients ... sure they are software
Well, clients and servers are still software-only ...
the problem is that some twisted host and server - doh!
And don't think i'm one of those grey-bearded veterans.
The first thing our information science teacher said about servers:
"Servers are software, not hardware" (He said that in german, but most of you prefare a sort of english i guess *g*)
So: no problem reading the x11-manual - at least not by twisting server and client, the rest ... *caught*
Spank me if i'm wrong!
Dear oh dear... "Server" and "Client" were *never* twisted!
If you think of the meaning of the words "server" and "client" it is difficult to get them confused, even when thinking in terms of X, instead of in terms of (say) a file server.
A "server" is something that provides a service. In the case of a file server, it is something that provides access to files over a network. In the case of X, the service provided is that of the drawing to the screen.
A "client" is something that requests the server to perform a task. In the case of the file server, it is requesting that a certain file be sent to it. In the case of X, it is asking the server to draw something to the screen.
Easy!
Re: Learning to Use X11
or a departmental server, connected to a larger number of (relatively dumb) X terminals.
Nope, that's wrong. Each X terminal would be a separate display (actually, separate host:display usually), not multiple screens. The dual- (or more) head example is a valid multi-screen example.
By the way, on Linux boxes at least, you can have multiple X displays running simultaneously (virtualized) by starting X from different virtual consoles (ie using ctrl-alt-F2 to log in, etc), by adding the display number (eg "startx -- :1"), the catch is that GNOME and KDE can't handle multiple instances of themselves on the same computer (you can run GNOME on one display and KDE on the other). Switch displays using ctrl-alt-F7, ctrl-alt-F8, etc.
Re: Learning to Use X11
Multiple instances for one user of the WindowMaker window manager are also not supported.
Re: Learning to Use X11
found the source, but you must do a
#include
rather than
#include
and you must use the following
g++ -I /usr/X11/include/X11 -L /usr/X11/lib -o x1 x1.cc -lX11
to compile on suse linux.
Re: Learning to Use X11
i make a program with C, and then compile it like this :
cc -g -o myprog myprog.c -lX11
but it is error in X11...!!
can anyone help me...? please..!
did i must configure somethink...to make it clear...?
i use suse 8.2, and i just install xdevel-xxx.rpm
Re: Learning to Use X11
it should read #include
Re: Learning to Use X11
Where is the difference between
#include and #include?
Magical whitespace?
Re: Learning to Use X11
I think the HTML of the original poster's comment got "filtered" by PHP nuke.
Re: Learning to Use X11
Yes, sure, but what is the file to #include between the
/ /
then? 8-)
#include or #include
#include <Xlib.h>
or
#include <X11/Xlib.h>
Re: Learning to Use X11
god I think my brain has frozen on monday morning, I found th e source, compiled it and it work!!!!!
doh!!
Re: Learning to Use X11
I'd like to give this a go? but where's the source luke?
Link
The paragraph titles are links, Jar-Jar. Click them with your favourite pointing device.
Me sah
Me sah no sah point divvy-sicer onna dee clikkers link.