nanogui: server background
Subject:
Re: [nanogui] server background
From:
Roberto ####@####.####
Date:
20 Dec 2006 19:52:50 +0000
Message-Id: <45899480.6020203@tnw2000.org>
Hi Jr,
in this case I would try to hack it in the GsInitialize function in
srvmain.c.
I think this is the position where the root window is created. It should
also
be possible to do it the same way than in the example I wrote. You
should try
to find out what functions are called by the Gr.... routines and use
them in GsInitialize.
But ts a good idea to show a picture instead of a blank screen. What
about the running cat
of the microwindows webpage?
cheers
Junior wrote:
>Hi Roberto,
>Thanks. This will work but I'm trying to do it in the server. That is, when the server starts, it will use a specific background instead of a color. I'm trying to hack the server code to do it. In this way, instead of a blank display if he client fails, I'll show a background.
>
>--Jr.
>
>
>
>
>>-----Original Message-----
>>From: ####@####.####
>>Sent: Sun, 17 Dec 2006 16:24:07 +0100
>>To: ####@####.####
>>Subject: Re: [nanogui] server background
>>
>>Hi Jr,
>>
>>I played a little with your problem. You may create a pixmap and use
>>GrSetBackgroundPixmap to map it to the GR_ROOT_WINDOW_ID.
>>
>>You may try this code:
>>
>>#include <microwin/nano-X.h>
>>
>>int main(int argc, char** argv)
>>{
>> GR_SCREEN_INFO si;
>> GR_GC_ID gc;
>>
>> if (GrOpen() < 0)
>> return -1;
>>
>> //get screen info and gc
>> GrGetScreenInfo(&si);
>> gc = GrNewGC();
>>
>>
>> //create pixmap and image
>> GR_WINDOW_ID pid = GrNewPixmap(si.cols,si.rows,0);
>> GR_IMAGE_ID imageid = GrLoadImageFromFile("background.gif", 0);
>>
>> //draw the image to the pixmap
>> GrDrawImageToFit(pid,gc,0,0,si.cols, si.rows, imageid);
>>
>> //destreoy all the stuff not needed any more
>> GrFreeImage(imageid);
>> GrDestroyGC(gc);
>>
>> //set it to the root windows backgound
>> GrSetBackgroundPixmap (GR_ROOT_WINDOW_ID,pid,0);
>> GrClearWindow(GR_ROOT_WINDOW_ID,GR_TRUE);
>>
>> //select close event
>> GR_EVENT event; /* current event */
>>
>> GrSelectEvents(GR_ROOT_WINDOW_ID, GR_EVENT_MASK_CLOSE_REQ);
>>
>> //wait until server shuts down
>> while(1)
>> {
>> GrCheckNextEvent(&event);
>> if(event.type == GR_EVENT_TYPE_CLOSE_REQ)
>> break;
>> }
>>
>> GrClose();
>>
>>}
>>
>>Junior wrote:
>>
>>
>>
>>>Hi All,
>>>How do I change the nanoX background to an image instead of a colour?
>>>
>>>Thanks,
>>>--Jr.
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: ####@####.####
>>>For additional commands, e-mail: ####@####.####
>>>
>>>
>>>
>>>
>>>
>>>
>
>____________________________________________________________
>KEEP SPYWARE OFF YOUR COMPUTER - Protect your computer with Spyware Terminator!
>Visit http://www.spywareterminator.com/install and find out more!
>
>
>