Re: write a xlib textbox application without widgets
- From: George Peter Staplin <georgepsSPAMMENOT@xxxxxxxxxxxx>
- Date: Sat, 16 Feb 2008 20:12:59 +0000 (UTC)
michele wrote:
hi all
i need to understand the basic lines on how to write a simple textbox
with xlib without using widgets...
the argument is so difficult (i have tried to read x11 documentation
yet) that i decide to ask to you before:
is there an example code that show me how to start?
naturally i'm not a complete xlib newbie, so don't worry about
explanations....
with regards
There are several ways to solve this problem. You can use the core and
standard X11 functions, or Xft, or even Freetype directly.
Here's a fairly simple way:
1. measure the text with XTextWidth()
2. use XCreateWindow to create a window or subwindow with padding for
around the text.
3. create a Pixmap with XCreatePixmap() that is the size of the window.
4. use XFillRectangle to draw a background for the Pixmap.
5. XDrawText(), or XDrawString, or XDrawImageString on the Pixmap.
6. Use XCopyArea to copy the Pixmap to the Window.
7. call XMapWindow
8. call XFlush
9. save the Pixmap and copy the Pixmap to the Window whenever you
receive an Expose event.
You can also get more sophisticated, and use Xdbe/DBE to provide
double-buffering.
I have a few tutorials here about working with Xlib:
http://www.xmission.com/~georgeps/documentation/tutorials/Xlib_Beginner-7.html
http://www.xmission.com/~georgeps/documentation/tutorials/Xlib_JPEG_Tutorial-5.html
http://www.xmission.com/~georgeps/documentation/tutorials/WM_TUTORIAL-3
Have fun :-)
George
.
- References:
- write a xlib textbox application without widgets
- From: michele
- write a xlib textbox application without widgets
- Prev by Date: write a xlib textbox application without widgets
- Next by Date: Problem with X11 window size resource.
- Previous by thread: write a xlib textbox application without widgets
- Next by thread: Problem with X11 window size resource.
- Index(es):
Relevant Pages
|