nanogui: Thread: Mapping, Unmapping, and Repainting Windows


[<<] [<] Page 1 of 1 [>] [>>]
Subject: Mapping, Unmapping, and Repainting Windows
From: Gil Glass ####@####.####
Date: 13 Feb 2006 16:30:34 +0000
Message-Id: <OFAF81D2ED.759B5630-ON85257114.0059F9D8-85257114.005AAE5B@acterna.com>

Hello,

Correct me if I'm wrong, but if I have a window (the root window), whose 
window ID is "parent", that is currently displaying and takes up the 
entire display, and I then perform the following operations:

// Create and open a new window.
windowID = GrNewWindow(parent, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 
GR_COLOR_WHITE, GR_COLOR_WHITE);

// Map (show) the window.
GrMapWindow(windowID);

<draw some stuff>

 // Remove this window.
GrUnmapWindow(windowID);
GrDestroyWindow(windowID);

// Redraw the parent window.
GrMapWindow(parent);

I should get my original, root window back, should I not?  Well I'm not. 
Any idea of what I'm doing wrong?  I'm using Nano-X version 0.91.

Cheers,
Gil Glass
Telecom Field Services
JDSU
Germantown, MD, USA
+1-240-404-2551
Subject: Re: [nanogui] Mapping, Unmapping, and Repainting Windows
From: "Greg Haerr" ####@####.####
Date: 14 Feb 2006 04:57:56 +0000
Message-Id: <039a01c63123$36458560$6401a8c0@winXP>

: Correct me if I'm wrong, but if I have a window (the root window), whose 
: window ID is "parent", that is currently displaying and takes up the 
: entire display, and I then perform the following operations:

Call your parent window "parent", because the root window
is something else (it's always id 1, and always mapped).  I 
presume you're not talking about the real root window.

In the code below, you never mapped your parent window in the
first place, and then mapped it again.  Nano-X keeps
a map count which could get confused if your map/unmap
calls don't match up.

Regards,

Greg


: 
: // Create and open a new window.
: windowID = GrNewWindow(parent, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 
: GR_COLOR_WHITE, GR_COLOR_WHITE);
: 
: // Map (show) the window.
: GrMapWindow(windowID);
: 
: <draw some stuff>
: 
:  // Remove this window.
: GrUnmapWindow(windowID);
: GrDestroyWindow(windowID);
: 
: // Redraw the parent window.
: GrMapWindow(parent);
: 
: I should get my original, root window back, should I not?  Well I'm not. 
: Any idea of what I'm doing wrong?  I'm using Nano-X version 0.91.
: 
: Cheers,
: Gil Glass
: Telecom Field Services
: JDSU
: Germantown, MD, USA
: +1-240-404-2551
Subject: Re: [nanogui] Mapping, Unmapping, and Repainting Windows
From: Gil Glass ####@####.####
Date: 14 Feb 2006 15:18:06 +0000
Message-Id: <OFEDFFB975.BEE7C5EC-ON85257115.00533871-85257115.0053FB8F@acterna.com>

Sorry, I should have included more detail.  Much earlier in the code, the 
following takes place:

    // Open the Nano-X server.

    if ( GrOpen() < 0)
    {
        cerr << "It didn't work." << endl;
        exit(-1);
    }

    width = 240;
    height = 160;

    // Create the new window.
    windowID = GrNewWindow(GR_ROOT_WINDOW_ID, 0, 0, width, height, 0, 
GR_COLOR_WHITE, GR_COLOR_WHITE);

    // Map (show) the window.  (NOT NECESSARY???)
    GrMapWindow(windowID);

<yada, yada yada...>

Then, this windowID, '1' as you point out below, is passed to a function 
as the parameter "parent" which is then used in the code snippet below. 
HOWEVER, you have given me a clue.  It sounds like using the root window 
as a parent for other windows that I wish to map and unmap is bad juju. 
Shall I have another window in between the root and the window that I'm 
trying to map and unmap below?

Thanks!

Gil Glass
Telecom Field Services
JDSU
Germantown, MD, USA
+1-240-404-2551
Please note new e-mail address:  ####@####.####  While the Acterna 
address will continue to work for a while, please begin using the JDSU 
address instead.



"Greg Haerr" ####@####.#### 
02/13/2006 11:57 PM
Please respond to
"Greg Haerr" ####@####.####


To
####@####.#### "Gil Glass" ####@####.####
cc

Subject
Re: [nanogui] Mapping, Unmapping, and Repainting Windows






: Correct me if I'm wrong, but if I have a window (the root window), whose 

: window ID is "parent", that is currently displaying and takes up the 
: entire display, and I then perform the following operations:

Call your parent window "parent", because the root window
is something else (it's always id 1, and always mapped).  I 
presume you're not talking about the real root window.

In the code below, you never mapped your parent window in the
first place, and then mapped it again.  Nano-X keeps
a map count which could get confused if your map/unmap
calls don't match up.

Regards,

Greg


: 
: // Create and open a new window.
: windowID = GrNewWindow(parent, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 
: GR_COLOR_WHITE, GR_COLOR_WHITE);
: 
: // Map (show) the window.
: GrMapWindow(windowID);
: 
: <draw some stuff>
: 
:  // Remove this window.
: GrUnmapWindow(windowID);
: GrDestroyWindow(windowID);
: 
: // Redraw the parent window.
: GrMapWindow(parent);
: 
: I should get my original, root window back, should I not?  Well I'm not. 

: Any idea of what I'm doing wrong?  I'm using Nano-X version 0.91.
: 
: Cheers,
: Gil Glass
: Telecom Field Services
: JDSU
: Germantown, MD, USA
: +1-240-404-2551

Subject: Re: [nanogui] Mapping, Unmapping, and Repainting Windows
From: "Greg Haerr" ####@####.####
Date: 14 Feb 2006 17:48:21 +0000
Message-Id: <0e9501c6318e$d347e860$0300a8c0@RDP>

:     // Create the new window.
:     windowID = GrNewWindow(GR_ROOT_WINDOW_ID, 0, 0, width, height, 0, 
: GR_COLOR_WHITE, GR_COLOR_WHITE);
: 
:     // Map (show) the window.  (NOT NECESSARY???)
:     GrMapWindow(windowID);
: 
: <yada, yada yada...>
: 
: Then, this windowID, '1' as you point out below, is passed to a function 
: as the parameter "parent" which is then used in the code snippet below. 

No.  windowID can't be 1, that's the window id of the root window.
Also, mapping your window is ALWAYS necessary.




: HOWEVER, you have given me a clue.  It sounds like using the root window 
: as a parent for other windows that I wish to map and unmap is bad juju. 

No, that's incorrect.  Your application top-level window
will almost always be a child of the root window.  That's
why the root window is pre-created, to serve as the
"anchor" parent for all user-created windows.


: Shall I have another window in between the root and the window that I'm 
: trying to map and unmap below?

No.

I think you might be getting yourself more confused than is necessary.
The window hierarchy is very simple.  It starts with window #1,
the "root" window, which is created before you get control.  Any
windows created must use an existing window id as the 
parent to get created.  And since only the root window exists, 
you must use GR_ROOT_WINDOW_ID or 1 as the first
param.

The effect of being any "child" window is just that you're x,y is
relative to your parent, rather than screen coords, and you get clipped
to the parent.  

Regards,

Greg
[<<] [<] Page 1 of 1 [>] [>>]


Powered by ezmlm-browse 0.20.