write a xlib textbox application without widgets - X

This is a discussion on write a xlib textbox application without widgets - X ; 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 ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: write a xlib textbox application without widgets

  1. write a xlib textbox application without widgets

    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

  2. Re: write a xlib textbox application without widgets

    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/do...eginner-7.html

    http://www.xmission.com/~georgeps/do...utorial-5.html

    http://www.xmission.com/~georgeps/do.../WM_TUTORIAL-3

    Have fun :-)


    George

+ Reply to Thread