[<<] [<] Page 1 of 1 [>] [>>] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Subject:
server background
From: Junior ####@####.#### Date: 14 Dec 2006 18:14:16 +0000 Message-Id: <D7FA5C42C62.00000464ejr@inbox.com> Hi All, How do I change the nanoX background to an image instead of a colour? Thanks, --Jr. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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! > > > | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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: ####@####.#### | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Subject:
Re: [nanogui] server background
From: Roberto ####@####.#### Date: 26 Dec 2006 14:17:16 +0000 Message-Id: <45912EE5.8010908@tnw2000.org> Hi Jr, I tried to put the code I wrote as a client directly into the GsInit.... function. Firstly I thought, I cannot use the Gr functions from the server, but after some investigation I didnt find any reason to do so. So I put it after the GsRedrawScreen function. At this point, I think everything what has to be initialized is initialized so far. /* Force root window screen paint*/ GsRedrawScreen(); /*REM BEGIN:*/ //now everything is done. We begin to create the background. //create pixmap gc, and image GR_WINDOW_ID pixid = GrNewPixmap(wp->width, wp->height, 0); GR_GC_ID gc = GrNewGC(); GR_IMAGE_ID imageid = GrLoadImageFromFile("background.gif", 0); //draw the image to the pixmap GrDrawImageToFit(pixid,gc,0,0,wp->width, wp->height, imageid); //destroy all the stuff not needed any more GrFreeImage(imageid); GrDestroyGC(gc); //set it to the root windows backgound GrSetBackgroundPixmap (GR_ROOT_WINDOW_ID,pixid,0); //redraw it again. GsRedrawScreen(); /*REM END*/ The problem here is that the GrNewPixmap function does not set any owner since there is no clinet which could own it. At first everything looks fine. But when the first client is destroyed and the Server had been compiled with the VERBOSE flag, it will die in GsPrintResources() as DPRINTF("%d(%d),", pp->id, pp->owner->id); is called and our pixmap above has a null pointer in pp->owner. As I could see, owner is only used here for debugging and in GsDestroyClientResources() to determine all pixmaps created by a client which has closed its connection. I modified GsPrintResources() to DPRINTF("%d(%d),", pp->id, /*REM*/(pp->owner?pp->owner->id:0)); and left GsDestroyClientResources() as it is. This looks like its working. But I didnt make much testing about this. I simply tried with several ntetris', nxterms and the nanowm. I didnt notice anything bad, but one should think about it again before using it. Bye Junior wrote: >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: ####@####.#### >> >> > >--------------------------------------------------------------------- >To unsubscribe, e-mail: ####@####.#### >For additional commands, e-mail: ####@####.#### > > > > | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Subject:
Re: [nanogui] server background
From: Junior ####@####.#### Date: 28 Dec 2006 22:19:52 +0000 Message-Id: <8A25CAA0E56.00000498ejr@inbox.com> It seem like using Gd functions such as GdDrawImageFromFile(wp->psd, 0, 0,wp->width, wp->height,"bg.bmp", 0) would be a better choice after Redraw. I have a bit of a distortion around the edges (black pixels) that I haven't determine the source yet, but it's away around the ownership issue. --Jr. > -----Original Message----- > From: ####@####.#### > Sent: Tue, 26 Dec 2006 15:17:09 +0100 > To: ####@####.#### > Subject: Re: [nanogui] server background > > Hi Jr, > > I tried to put the code I wrote as a client directly into the GsInit.... > function. > Firstly I thought, I cannot use the Gr functions from the server, > but after some investigation I didnt find any reason to do so. > So I put it after the GsRedrawScreen function. At this point, I > think everything what has to be initialized is initialized so far. > > /* Force root window screen paint*/ > GsRedrawScreen(); > > /*REM BEGIN:*/ > //now everything is done. We begin to create the background. > > //create pixmap gc, and image > GR_WINDOW_ID pixid = GrNewPixmap(wp->width, wp->height, 0); > GR_GC_ID gc = GrNewGC(); > GR_IMAGE_ID imageid = GrLoadImageFromFile("background.gif", 0); > > //draw the image to the pixmap > GrDrawImageToFit(pixid,gc,0,0,wp->width, wp->height, imageid); > > //destroy all the stuff not needed any more > GrFreeImage(imageid); > GrDestroyGC(gc); > > //set it to the root windows backgound > GrSetBackgroundPixmap (GR_ROOT_WINDOW_ID,pixid,0); > > //redraw it again. > GsRedrawScreen(); > /*REM END*/ > > The problem here is that the GrNewPixmap function does not > set any owner since there is no clinet which could own it. > At first everything looks fine. But when the first client is destroyed > and > the Server had been compiled with the VERBOSE flag, it will die in > GsPrintResources() as DPRINTF("%d(%d),", pp->id, pp->owner->id); > is called and our pixmap above has a null pointer in pp->owner. > > As I could see, owner is only used here for debugging and in > GsDestroyClientResources() to determine all pixmaps created by a client > which has closed its connection. I modified GsPrintResources() to > > DPRINTF("%d(%d),", pp->id, /*REM*/(pp->owner?pp->owner->id:0)); > > and left GsDestroyClientResources() as it is. > This looks like its working. But I didnt make much testing about this. > I simply tried with several ntetris', nxterms and the nanowm. I didnt > notice anything bad, but one should think about it again before using it. > > Bye > > > Junior wrote: > > >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: ####@####.#### >>> >>> >> > >--------------------------------------------------------------------- > >To unsubscribe, e-mail: ####@####.#### > >For additional commands, e-mail: ####@####.#### >> >> >> >> > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: ####@####.#### > For additional commands, e-mail: ####@####.#### | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
[<<] [<] Page 1 of 1 [>] [>>] |