Subject:
Re: [nanogui] server background
From:
Junior ####@####.####
Date:
24 Dec 2006 21:15:52 +0000
Message-Id: <5749AC7AE86.00000257ejr@inbox.com>
I've used the below code to create a GR_PIXMAP *bgpm, so as to use in the root window structure (wp->bgpixmap)
/-- code snip
bgpm->x = 0;
bgpm->y = 0;
bgpm->width = psd->xvirtres;
bgpm->height = psd->yvirtres;
bgpm->psd = psd;
GrDrawImageFromFile(bgpm->id, bggc, 0, 0,psd->xvirtres, psd->yvirtres,"background.bmp", 0);
bgpm->owner = NULL;
bgpm->next = NULL;
end snip --/
Although I didn't get any segfault from this code nothing happens until I do the following:
/-- snip
// psd->FillRect(psd, 0, 0, psd->xvirtres-1, psd->yvirtres-1,
// GdFindColor(psd, wp->background));
GrDrawImageFromFile(GR_ROOT_WINDOW_ID, bggc, 0, 0,psd->xvirtres, psd->yvirtres,"/Images/background.bmp", 0);
-- end snip --/
If I do the above without a GR_PIXMAP*, the background pixmap will appear for a brief second as GsRedrawScreen() is
called erases it.
Now, with GR_PIXMAP* GsRedrawScreen() does not erase it but strangely enough killing one of two clients also kills the server.
That is, if I have nano-X server and two clients (nanowm, app-x), killing app-x kills nano-X also.
I also find it strange that GsWpDrawBackgroundPixmap(wp, bgpm, 0, 0, psd->xvirtres, psd->yvirtres) does not do what I'm trying to accomplish.
If anyone have any ideas, I'll like to hear them. I know I must be missing something but what it is I'm trying to find out.
Thanks,
--Jr.
> -----Original Message-----
> From: ####@####.####
> Sent: Thu, 21 Dec 2006 10:45:18 -0800
> To: ####@####.####
> Subject: Re: [nanogui] server background
>
> 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!
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ####@####.####
> For additional commands, e-mail: ####@####.####