This lab will introduce you to the Xwindows environment. With Xwindows, a program can interact with the user in a graphical environment. Programming with Xwindows is a bit different from the programming you are probably used to, since it presents an interface to the user, and user interaction generates events. Use the Xwindow.h and Xwindow.cc files with your programs. These files are available on the Qubit server, under the /home/cscmcw/csc4110 directory:
-rw-r--r--
1 mweeks staff 1312 Mar 10 16:52 Xhello.cc
-rw-r--r-- 1
mweeks staff 1481 Mar 10 16:50 Xhello_iPAQ.cc
-rw-r--r-- 1
mweeks staff 12700 Mar 10 16:51 Xwindow.cc
-rw-r--r-- 1
mweeks staff 5027 Mar 10 16:51 Xwindow.h
-rw-r--r-- 1
mweeks staff 9984 Mar 10 16:49 Xwindow.o
-rw-r--r-- 1
mweeks staff 7626 Mar 10 16:51 Xwindow_demo.cc
-rw-r--r-- 1
mweeks staff 5255 Mar 10 16:51 Xwindow_demo2.cc
-rw-r--r-- 1
mweeks staff 12719 Mar 10 16:50 Xwindow_iPAQ.cc
-rw-r--r-- 1
mweeks staff 5269 Mar 10 16:50 Xwindow_iPAQ.h
Under Linux on the PC, compile the library file using:
g++ Xwindow.cc -c
Once this is done, you can compile your program with:
g++ YourProgram.cc -L/usr/X11R6/lib -lX11 Xwindow.o -o
YourProgram
Of course, you only have to compile the library code once. To run your
program,
type "./YourProgram" at the command prompt. Note that the "./" is used
to
specify that you want to run the file called "YourProgram" found in the
current directory.
Your task is to demonstrate some basic Xwindows calls:
When your code works, port it to the iPAQ. The main difference is
that you need to use the Skiff cross-compiler, which should be in the
Linux PCs in the Lab. I will
supply special files "Xwindow_iPAQ.h" and "Xwindow_iPAQ.cc" to use.
Actually, the
default screen size is changed; everything else should be the same.
Make sure you
use the right ".h" file. To compile, use the following commands.
For the library file:
/skiff/local/bin/arm-linux-g++ Xwindow_iPAQ.cc -c
/skiff/local/bin/arm-linux-g++ YourProgram.cc
-L/skiff/local/arm-linux/lib/X11 -lX11 Xwindow_iPAQ.o -o
YourProgram_iPAQ
If this does not work, make sure that the cross-compiler is where it is
supposed to be. Note that appending "_iPAQ"
to your program's name is not a requirement, but it will help you
remember which file is which.
Next, download the code to the iPAQ. You can do this with the wireless
card, or by sync'ing the iPAQ
to the host machine. If your choose to use the wireless card, an easy
way to use it is to
put the file under your public_html directory. On the iPAQ, you would
type "wget http://yamacraw.cs.gsu.edu/~youraccount/YourProgram_iPAQ".
Then "chmod 777 YourProgram_iPAQ" to change the file's permissions.
Finally, you can run it with "./YourProgram_iPAQ" from the iPAQ's
command prompt.
Write-up what you did IN YOUR OWN WORDS. Do not simply re-word the
directions,
but explain what is going on. Avoid listing steps. Use outside sources
as appropriate, and be certain to cite your sources.
Turn in one report per person.
Make sure everyone is present for the lab.