[<<] [<] Page 1 of 1 [>] [>>] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Subject:
GrUnmapWindow()
From: Aveek Adhya ####@####.#### Date: 8 Jun 2006 13:34:03 +0100 Message-Id: <44881B41.3010807@rebaca.com> Hi all, I have a window with some objects (like a rectangle etc) drawn on it. Now I want to hide the main window and after a key press I want to show the same window again on the screen. my prgram is like that .... ...... ......... GrMapWindow(wid); // to make the window visible gc = GrNewGC(); // create a new GC GrFillRect(wid,gc,100,30,60,50); // draw a rectangle on the main window getchar(); // wait for a key press GrUnmapWindow(wid); // unmap the window getchar(); // wait for a key press GrMapWindow(wid); // make the window visible again ....... Although the "GrUnmapWindow(wid)" can hide the window, calling "GrMapWindow(wid)" can't make the window visible again. Any idea where I am doing the mistake ? ..... or it is not at all possible with these APIs ? Thanx ..... Aveek | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Subject:
Re: GrUnmapWindow()
From: "Aaron J. Grier" ####@####.#### Date: 8 Jun 2006 18:52:23 +0100 Message-Id: <20060608175218.GC18581@mordor.unix.fryenet> On Thu, Jun 08, 2006 at 06:12:41PM +0530, Aveek Adhya wrote: > GrMapWindow(wid); // to make the window visible > gc = GrNewGC(); // create a new GC > GrFillRect(wid,gc,100,30,60,50); // draw a rectangle on the main window > getchar(); // wait for a key press > GrUnmapWindow(wid); // unmap the window > getchar(); // wait for a key press > GrMapWindow(wid); // make the window visible again > ....... > > Although the "GrUnmapWindow(wid)" can hide the window, calling > "GrMapWindow(wid)" can't make the window visible again. > Any idea where I am doing the mistake ? ..... or it is not at all > possible with these APIs ? when GrMapWindow(wid) is called, wid will be sent an expose event; it is then up to a handler to redraw the exposed area. are you running a window manager of any sort? -- Aaron J. Grier | Frye Electronics, Tigard, OR | ####@####.#### | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Subject:
Re: [nanogui] Re: GrUnmapWindow()
From: Aveek Adhya ####@####.#### Date: 9 Jun 2006 07:26:34 +0100 Message-Id: <448916A4.7030308@rebaca.com> No , I am not running any sort of window manager. My program is just like this : #include <nano-X.h> #include <mwtypes.h> #include <stdio.h> #define MARGIN 100 main() { GR_WINDOW_ID wid; /* window id */ GR_GC_ID gc; /* graphics context id. defined as 'unsigned int' */ GR_SCREEN_INFO si; /* screen information */ if (GrOpen() < 0) // Open a connection to the graphics driver. { fprintf(stderr, "Cannot open graphics\n"); exit(1); } GrGetScreenInfo(&si); // Fills in the specified GR_SCREEN_INFO structure. printf("Col = %d Rows = %d\n",si.cols,si.rows); wid = GrNewWindow(GR_ROOT_WINDOW_ID, MARGIN, MARGIN, si.cols - MARGIN * 2, si.rows - MARGIN * 2, 4, MWRGB(255,255,0),MWRGB(0,0,255)); GrMapWindow(wid); gc = GrNewGC(); GrLine(wid,gc,10,10,100,100); GrFillRect(wid,gc,100,30,60,50); // GrSetGCForeground(gc, MWRGB(200,5,5)); fprintf(stderr,"Press any key to hideeeeee window ...\n"); { getchar(); } GrUnmapWindow(wid); fprintf(stderr,"Press any key to unhide window ...\n"); { getchar(); } GrMapWindow(wid); // can display the background again, but neither the rectangle nor the line GrFlush(); return 0; } What I have noticed that when "GrMapWindow(wid)" is called for the second time (after screen become blank due to the call of GrUnmapWindow(wid) ), it can display only the background but not the objects (rectangle, line etc). Aaron J. Grier wrote: >On Thu, Jun 08, 2006 at 06:12:41PM +0530, Aveek Adhya wrote: > > > >>GrMapWindow(wid); // to make the window visible >>gc = GrNewGC(); // create a new GC >>GrFillRect(wid,gc,100,30,60,50); // draw a rectangle on the main window >>getchar(); // wait for a key press >>GrUnmapWindow(wid); // unmap the window >>getchar(); // wait for a key press >>GrMapWindow(wid); // make the window visible again >>....... >> >>Although the "GrUnmapWindow(wid)" can hide the window, calling >>"GrMapWindow(wid)" can't make the window visible again. >>Any idea where I am doing the mistake ? ..... or it is not at all >>possible with these APIs ? >> >> > >when GrMapWindow(wid) is called, wid will be sent an expose event; it is >then up to a handler to redraw the exposed area. > >are you running a window manager of any sort? > > > | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Subject:
Re: [nanogui] GrUnmapWindow()
From: "Greg Haerr" ####@####.#### Date: 19 Jun 2006 03:10:21 +0100 Message-Id: <008c01c69344$008170a0$6401a8c0@winXP> : GrMapWindow(wid); // to make the window visible : gc = GrNewGC(); // create a new GC : GrFillRect(wid,gc,100,30,60,50); // draw a rectangle on the main window : getchar(); // wait for a key press : GrUnmapWindow(wid); // unmap the window : getchar(); // wait for a key press : GrMapWindow(wid); // make the window visible again : ....... : : Although the "GrUnmapWindow(wid)" can hide the window, calling : "GrMapWindow(wid)" can't make the window visible again. Your code is entirely incorrect for writing nano-X graphics applications. You must use an "event-driven" model for getting keyboard, mouse, or expose events. You can't use getchar() and similar functions inbetween graphics calls. Look at the *.sh demo applications in src/demo/nanox for details on how to write a nano-X application. Regards, Greg | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
[<<] [<] Page 1 of 1 [>] [>>] |