Subject:
Re: [nanogui] server background
From:
Junior ####@####.####
Date:
21 Dec 2006 18:45:27 +0000
Message-Id: <3043D8EEB70.000003E6ejr@inbox.com>
I've been working in that area, trying to determine why I'm getting a segfault when I create and use wp->bgpixmap.
Unless I misunderstood what this is, wp->bgpixmap in GsInitialize(), I take to be the background image. Correct?
That's default to NULL.
I created a GR_PIXMAP variable populate it (say GR_PIXMAP *bgpm).
However, When I try to create bgpm->id, I get a segault if I do this just before wp initializes and not if I do it at the start of the function.
I'll add a code snip when I get back to working on it.
Thanks,
Jr.
> -----Original Message-----
> From: ####@####.####
> Sent: Wed, 20 Dec 2006 20:52:32 +0100
> To: ####@####.####
> Subject: Re: [nanogui] server background
>
> 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!
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ####@####.####
> For additional commands, e-mail: ####@####.####
____________________________________________________________
ONE-CLICK WEBMAIL ACCESS - Easily monitor & access your email accounts!
Visit http://www.inbox.com/notifier and check it out!