f



Hello world?

Can someone please post an X Windows version of "Hello World" and an
Makefile to compile it. Also is there a free book online or tutorial
to teach me X Windows Programming?

Zach
0
Zach
1/20/2009 12:26:50 AM
comp.windows.x.motif 641 articles. 0 followers. Post Follow

9 Replies
320 Views

Similar Articles

[PageSpeed] 46

Zach <netrek@gmail.com> writes:

>Can someone please post an X Windows version of "Hello World" and an
>Makefile to compile it. Also is there a free book online or tutorial
>to teach me X Windows Programming?

The OpenMotif distribution comes with a number of demo programs, one of
which is a hello World type program.  Additionally, there are two books
out there on Motif programming which are freely available.  These are
the Motif Programmer's Guide and the Motif Programming Reference.  These
are not strictly X Windows Programming guides, but they will cover a
good deal of the necessary X Windows Programming necessary for Motif
programming.  If you are like some Motif is the toolkit of X Windows,
and thus, if you want to learn to program X Windows, you should lear
Motif.  On the other hand, some people would rather you learn something
like GTK, and reading something like the Motif Programmer's Guide
probably will not help you.


-- 
Aaron W. Hsu <arcfide@sacrideo.us> | <http://www.sacrideo.us>
"Government is the great fiction, through which everybody endeavors to
live at the expense of everybody else." -- Frederic Bastiat
+++++++++++++++ ((lambda (x) (x x)) (lambda (x) (x x))) ++++++++++++++
0
Aaron
1/20/2009 3:08:04 AM
On Jan 19, 10:08 pm, Aaron W. Hsu <arcf...@sacrideo.us> wrote:
> Zach <net...@gmail.com> writes:
> >Can someone please post an X Windows version of "Hello World" and an
> >Makefile to compile it. Also is there a free book online or tutorial
> >to teach me X Windows Programming?
>
> The OpenMotif distribution comes with a number of demo programs, one of
> which is a hello World type program.  Additionally, there are two books
> out there on Motif programming which are freely available.  These are
> the Motif Programmer's Guide and the Motif Programming Reference.  These
> are not strictly X Windows Programming guides, but they will cover a
> good deal of the necessary X Windows Programming necessary for Motif
> programming.  If you are like some Motif is the toolkit of X Windows,
> and thus, if you want to learn to program X Windows, you should lear
> Motif.  On the other hand, some people would rather you learn something
> like GTK, and reading something like the Motif Programmer's Guide
> probably will not help you.

Hi Aaron,

I see. I don't have Open Motif. Can you please post the source code to
the Hello World program here. Thank you.

Zach
0
Zach
1/20/2009 9:13:26 PM
Zach <netrek@gmail.com> writes:

>I see. I don't have Open Motif. Can you please post the source code to
>the Hello World program here. Thank you.

The example code will not help you if you do not have Open Motif.  You
need Motif of some sort in order to run and test the code.  It is better
to download the source code from <http://www.opengroup.org/openmotif/>. 
You can usually install a version of Motif through your UNIX
distribution as well, or Linux if you are so inclined.

However, keep in mind that you do not have to use Motif you do not wish
to do so.  Instead, you can use anything else you want.  Check out some
of the simple applications in the X Windows distribution for other
examples.
-- 
Aaron W. Hsu <arcfide@sacrideo.us> | <http://www.sacrideo.us>
"Government is the great fiction, through which everybody endeavors to
live at the expense of everybody else." -- Frederic Bastiat
+++++++++++++++ ((lambda (x) (x x)) (lambda (x) (x x))) ++++++++++++++
0
Aaron
1/20/2009 11:30:40 PM
On Jan 20, 6:30 pm, Aaron W. Hsu <arcf...@sacrideo.us> wrote:
>
> The example code will not help you if you do not have Open Motif.  You
> need Motif of some sort in order to run and test the code.  It is better
> to download the source code from <http://www.opengroup.org/openmotif/>.
> You can usually install a version of Motif through your UNIX
> distribution as well, or Linux if you are so inclined.

Hi Aaron,

I looked at your website, pretty cool you generated it from Scheme. I
am trying to learn ANSI Common Lisp.

Can I install Open Motif as a  non-root user in my $HOME somehow?

> However, keep in mind that you do not have to use Motif you do not wish
> to do so.  Instead, you can use anything else you want.  Check out some
> of the simple applications in the X Windows distribution for other
> examples.

Oh what else is there besides Motif and GTK? I think at a lower layer
is Xlib, do you know of a free book or online tutorial on Xlib
programming?

Zach
0
Zach
1/21/2009 1:08:25 AM
On 2009-01-21, Zach <netrek@gmail.com> wrote:
>
> Oh what else is there besides Motif and GTK? I think at a lower layer
> is Xlib, do you know of a free book or online tutorial on Xlib
> programming?

Indeed you don't have to use motif, although you posted into a motif
newsgroup so you got motif answers :) Try comp.windows.x next time if
you're not interested specifically in motif.

The X window system has at the lower level the X server communicating
with X clients through the X11 protocol. While you could directly open a
socket and talk X11 to the server that would be madness, so there's Xlib
to help you out, giving you access to C functions that more or less
(less really) map onto X11 protocol requests.

There's also a lower-level library nowadays called xcb which maps
directly onto the underlying X11 protocol, on top of which Xlib is
implemented.

If you don't need a toolkit such as GTK, motif, Qt, or whatever, then
try programming directly in Xlib or xcb. Here's a rather nicely written
but very simple Xlib tutorial: http://tronche.com/gui/x/xlib-tutorial/
And here's a more detailed one that I quite like:
http://users.actcom.co.il/~choo/lupg/tutorials/xlib-programming/xlib-programming.html

Have fun :)

-- 
John Tsiombikas (Nuclear / Mindlapse)
http://nuclear.sdf-eu.org/
0
John
1/21/2009 8:39:26 AM
On Jan 21, 3:39 am, John Tsiombikas <nucl...@siggraph.org> wrote:
>
> Indeed you don't have to use motif, although you posted into a motif
> newsgroup so you got motif answers :) Try comp.windows.x next time if
> you're not interested specifically in motif.
>
> The X window system has at the lower level the X server communicating
> with X clients through the X11 protocol. While you could directly open a
> socket and talk X11 to the server that would be madness, so there's Xlib
> to help you out, giving you access to C functions that more or less
> (less really) map onto X11 protocol requests.
>
> There's also a lower-level library nowadays called xcb which maps
> directly onto the underlying X11 protocol, on top of which Xlib is
> implemented.
>
> If you don't need a toolkit such as GTK, motif, Qt, or whatever, then
> try programming directly in Xlib or xcb. Here's a rather nicely written
> but very simple Xlib tutorial:http://tronche.com/gui/x/xlib-tutorial/
> And here's a more detailed one that I quite like:
> http://users.actcom.co.il/~choo/lupg/tutorials/xlib-programming/xlib-...
>
> Have fun :)

Thank you John. I also found the Pointers Explained article on your
website very helpful :-)

So the layer is:

X11 protocol -> xcb -> Xlib -> Motif/GTK/Qt/ etc...

Zach
0
Zach
1/21/2009 9:41:02 AM
On Jan 20, 6:30 pm, Aaron W. Hsu <arcf...@sacrideo.us> wrote:
>
> The example code will not help you if you do not have Open Motif.  You
> need Motif of some sort in order to run and test the code.  It is better
> to download the source code from <http://www.opengroup.org/openmotif/>.
> You can usually install a version of Motif through your UNIX
> distribution as well, or Linux if you are so inclined.

I just installed Lestiff2 and there are no example programs with it :-
(

I installed (Debian) lesstif2 and lesstif2-dev:

 Contains C header files and development shared libraries libraries
for
 LessTif. LessTif, made by the Hungry Programmers, is a free (LGPL-ed)
 version of OSF/Motif; it aims ultimately at binary compatibility with
Motif
 2.1.

 Contains runtime shared libraries for LessTif, the Hungry
Programmers'
 version of OSF/Motif 2.1.

 Contains static libraries and header files for libXm and libMrm.

Here are the files I have:

/.
/usr
/usr/lib
/usr/lib/libXm.so.2.0.1
/usr/lib/libMrm.so.2.0.1
/usr/share
/usr/share/doc
/usr/share/doc/lesstif2
/usr/share/doc/lesstif2/copyright
/usr/share/doc/lesstif2/changelog.gz
/usr/share/doc/lesstif2/changelog.Debian.gz
/usr/lib/libXm.so.2
/usr/lib/libMrm.so.2
/usr/share/doc/lesstif2/ReleaseNotes.txt.gz
debian:~# dpkg -L lesstif2-dev
/.
/usr
/usr/lib
/usr/lib/libMrm.a
/usr/lib/libXm.a
/usr/include
/usr/include/Xm
/usr/include/Xm/Xm.h
/usr/include/Xm/ArrowB.h
/usr/include/Xm/ArrowBG.h
/usr/include/Xm/AtomMgr.h
/usr/include/Xm/BaseClassP.h
/usr/include/Xm/BulletinB.h
/usr/include/Xm/BulletinBP.h
/usr/include/Xm/CacheP.h
/usr/include/Xm/CascadeB.h
/usr/include/Xm/CascadeBG.h
/usr/include/Xm/CascadeBGP.h
/usr/include/Xm/CascadeBP.h
/usr/include/Xm/Command.h
/usr/include/Xm/CommandP.h
/usr/include/Xm/CutPaste.h
/usr/include/Xm/CutPasteP.h
/usr/include/Xm/DesktopP.h
/usr/include/Xm/DialogS.h
/usr/include/Xm/DialogSEP.h
/usr/include/Xm/DialogSP.h
/usr/include/Xm/Display.h
/usr/include/Xm/DragC.h
/usr/include/Xm/DragCP.h
/usr/include/Xm/DragDrop.h
/usr/include/Xm/DragIcon.h
/usr/include/Xm/DragIconP.h
/usr/include/Xm/DragOverS.h
/usr/include/Xm/DragOverSP.h
/usr/include/Xm/DrawingA.h
/usr/include/Xm/DrawnB.h
/usr/include/Xm/DrawnBP.h
/usr/include/Xm/DropSMgr.h
/usr/include/Xm/DropSMgrP.h
/usr/include/Xm/DropTrans.h
/usr/include/Xm/DropTransP.h
/usr/include/Xm/ExtObjectP.h
/usr/include/Xm/FileSB.h
/usr/include/Xm/Form.h
/usr/include/Xm/FormP.h
/usr/include/Xm/Frame.h
/usr/include/Xm/FrameP.h
/usr/include/Xm/Label.h
/usr/include/Xm/LabelG.h
/usr/include/Xm/List.h
/usr/include/Xm/MainW.h
/usr/include/Xm/MainWP.h
/usr/include/Xm/MenuShell.h
/usr/include/Xm/MenuUtilP.h
/usr/include/Xm/MessageB.h
/usr/include/Xm/MessageBP.h
/usr/include/Xm/ManagerP.h
/usr/include/Xm/MwmUtil.h
/usr/include/Xm/PanedW.h
/usr/include/Xm/Protocols.h
/usr/include/Xm/ProtocolsP.h
/usr/include/Xm/PushB.h
/usr/include/Xm/PushBG.h
/usr/include/Xm/PushBGP.h
/usr/include/Xm/PushBP.h
/usr/include/Xm/RCUtilsP.h
/usr/include/Xm/RepType.h
/usr/include/Xm/RowColumn.h
/usr/include/Xm/RowColumnP.h
/usr/include/Xm/SashP.h
/usr/include/Xm/Scale.h
/usr/include/Xm/Screen.h
/usr/include/Xm/ScreenP.h
/usr/include/Xm/ScrollBar.h
/usr/include/Xm/ScrollBarP.h
/usr/include/Xm/ScrolledW.h
/usr/include/Xm/SelectioB.h
/usr/include/Xm/SelectioBP.h
/usr/include/Xm/SeparatoG.h
/usr/include/Xm/SeparatoGP.h
/usr/include/Xm/Separator.h
/usr/include/Xm/SeparatorP.h
/usr/include/Xm/ShellEP.h
/usr/include/Xm/TearOffBP.h
/usr/include/Xm/TearOffP.h
/usr/include/Xm/Text.h
/usr/include/Xm/TextF.h
/usr/include/Xm/TextFP.h
/usr/include/Xm/TextFSelP.h
/usr/include/Xm/TextInP.h
/usr/include/Xm/TextOutP.h
/usr/include/Xm/TextP.h
/usr/include/Xm/TextSelP.h
/usr/include/Xm/TextStrSoP.h
/usr/include/Xm/ToggleB.h
/usr/include/Xm/ToggleBG.h
/usr/include/Xm/VaSimpleP.h
/usr/include/Xm/VendorS.h
/usr/include/Xm/VendorSP.h
/usr/include/Xm/VirtKeys.h
/usr/include/Xm/VirtKeysP.h
/usr/include/Xm/WorldP.h
/usr/include/Xm/XmosP.h
/usr/include/Xm/AccTextT.h
/usr/include/Xm/ActivatableT.h
/usr/include/Xm/ArrowBGP.h
/usr/include/Xm/ArrowBP.h
/usr/include/Xm/CareVisualT.h
/usr/include/Xm/ColorObjP.h
/usr/include/Xm/ComboBox.h
/usr/include/Xm/ComboBoxP.h
/usr/include/Xm/Container.h
/usr/include/Xm/ContainerP.h
/usr/include/Xm/ContainerT.h
/usr/include/Xm/ContItemT.h
/usr/include/Xm/DialogSavvyT.h
/usr/include/Xm/DisplayP.h
/usr/include/Xm/DrawP.h
/usr/include/Xm/DrawingAP.h
/usr/include/Xm/FileSBP.h
/usr/include/Xm/Gadget.h
/usr/include/Xm/GadgetP.h
/usr/include/Xm/GrabShell.h
/usr/include/Xm/GrabShellP.h
/usr/include/Xm/IconG.h
/usr/include/Xm/IconGP.h
/usr/include/Xm/IconH.h
/usr/include/Xm/JoinSideT.h
/usr/include/Xm/LabelP.h
/usr/include/Xm/LabelGP.h
/usr/include/Xm/LayoutT.h
/usr/include/Xm/ListP.h
/usr/include/Xm/Manager.h
/usr/include/Xm/MenuShellP.h
/usr/include/Xm/MenuT.h
/usr/include/Xm/NavigatorT.h
/usr/include/Xm/Notebook.h
/usr/include/Xm/NotebookP.h
/usr/include/Xm/PanedWP.h
/usr/include/Xm/Primitive.h
/usr/include/Xm/PrimitiveP.h
/usr/include/Xm/ScaleP.h
/usr/include/Xm/ScrolledWP.h
/usr/include/Xm/ScrollFrameT.h
/usr/include/Xm/SpecRenderT.h
/usr/include/Xm/SpinB.h
/usr/include/Xm/SpinBP.h
/usr/include/Xm/TakesDefT.h
/usr/include/Xm/ToggleBGP.h
/usr/include/Xm/ToggleBP.h
/usr/include/Xm/TraitP.h
/usr/include/Xm/Transfer.h
/usr/include/Xm/TransferP.h
/usr/include/Xm/TransferT.h
/usr/include/Xm/TxtPropCv.h
/usr/include/Xm/XmP.h
/usr/include/Xm/XpmP.h
/usr/include/Xm/XmIm.h
/usr/include/Xm/VendorSEP.h
/usr/include/Xm/Print.h
/usr/include/Xm/PrintSP.h
/usr/include/Xm/SSpinB.h
/usr/include/Xm/SSpinBP.h
/usr/include/Xm/TransltnsP.h
/usr/include/Xm/XmAll.h
/usr/include/Xm/XmStrDefs.h
/usr/include/Mrm
/usr/include/Mrm/MrmAppl.h
/usr/include/Mrm/MrmDecls.h
/usr/include/Mrm/MrmPrivate.h
/usr/include/Mrm/MrmPublic.h
/usr/include/uil
/usr/include/uil/Uil.h
/usr/include/uil/UilDBDef.h
/usr/include/uil/UilDef.h
/usr/include/uil/UilSymDef.h
/usr/include/uil/UilSymGl.h
/usr/include/uil/XmAppl.uil
/usr/share
/usr/share/doc
/usr/share/doc/lesstif2-dev
/usr/share/doc/lesstif2-dev/copyright
/usr/share/doc/lesstif2-dev/changelog.gz
/usr/share/doc/lesstif2-dev/changelog.Debian.gz
/usr/lib/libMrm.so
/usr/lib/libXm.so
/usr/share/doc/lesstif2-dev/ReleaseNotes.txt.gz

Zach
0
Zach
1/21/2009 11:06:10 AM
Zach <netrek@gmail.com> writes:

>On Jan 20, 6:30 pm, Aaron W. Hsu <arcf...@sacrideo.us> wrote:
>>
>> The example code will not help you if you do not have Open Motif.  You
>> need Motif of some sort in order to run and test the code.  It is better
>> to download the source code from <http://www.opengroup.org/openmotif/>.
>> You can usually install a version of Motif through your UNIX
>> distribution as well, or Linux if you are so inclined.

>I looked at your website, pretty cool you generated it from Scheme. I
>am trying to learn ANSI Common Lisp.

The website is actually designed by hand, and the Gopher server is
written in Scheme.

>Can I install Open Motif as a  non-root user in my $HOME somehow?

Technically, yes, but it is a pain.  I think you mentioned somewhere
else that you were using Debian?  There should be an installation of
OpenMotif available, you can just use that.

>> However, keep in mind that you do not have to use Motif you do not wish
>> to do so.  Instead, you can use anything else you want.  Check out some
>> of the simple applications in the X Windows distribution for other
>> examples.

>Oh what else is there besides Motif and GTK? I think at a lower layer
>is Xlib, do you know of a free book or online tutorial on Xlib
>programming?

I think you have already received an answer to this questoin, but from
my understanding, there is the X Server -> Xlib -> Xt -> Motif.  There
are guides available for all of them if you want to do some searching.


-- 
Aaron W. Hsu <arcfide@sacrideo.us> | <http://www.sacrideo.us>
"Government is the great fiction, through which everybody endeavors to
live at the expense of everybody else." -- Frederic Bastiat
+++++++++++++++ ((lambda (x) (x x)) (lambda (x) (x x))) ++++++++++++++
0
Aaron
1/21/2009 1:55:30 PM
Zach <netrek@gmail.com> writes:

>On Jan 20, 6:30 pm, Aaron W. Hsu <arcf...@sacrideo.us> wrote:
>>
>> The example code will not help you if you do not have Open Motif.  You
>> need Motif of some sort in order to run and test the code.  It is better
>> to download the source code from <http://www.opengroup.org/openmotif/>.
>> You can usually install a version of Motif through your UNIX
>> distribution as well, or Linux if you are so inclined.

>I just installed Lestiff2 and there are no example programs with it :-
>(

You'd be best off trying to grab the Motif example programs and then use
them with Lesstif if you like.  I guess Lesstif does not package such
programs.
-- 
Aaron W. Hsu <arcfide@sacrideo.us> | <http://www.sacrideo.us>
"Government is the great fiction, through which everybody endeavors to
live at the expense of everybody else." -- Frederic Bastiat
+++++++++++++++ ((lambda (x) (x x)) (lambda (x) (x x))) ++++++++++++++
0
Aaron
1/21/2009 1:56:46 PM
Reply: