[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Problems with overlapping windows
From: |
Jiri Fogl |
Subject: |
Problems with overlapping windows |
Date: |
Mon, 16 Mar 2009 18:18:08 +0100 |
User-agent: |
KMail/1.9.10 |
Hi, I'd like to ask if there are some circumstances I should be aware of when
creating overlapping windows.
I'm building an application on top of ncurses and I still have problems with
overlapping windows - sometimes it works as one would expect (I'll call it "A
scenario"), sometimes it does not ("B scenario").
I create windows by newwin() along with new_panel(). Generally I have one huge
window filling all the screen and a popup window.
In "B scenario": If fullscreen window is created, popup window doesn't show up
then. newwin() as well as new_panel() for popup window return a pointer (not
NULL), but attempt for i.e panel_top() ends up in segmentation fault.
After commenting out creation of the fullscreen window, the popup window
appears
and behaves as expected.
In "A scenario" popup window works on top of the fullscreen window.
I said "sometimes" above. That means my application alternates between A and B
scenarios "by its own decision". At first I had B situation, after some
structure wiping I got it working, and now after some other minor adjustments
in code I'm back in B. That means I affected something important without
knowing it is important, and I would like to learn what it is. Can you help me
to find the catch please?
Here is a snippet of my C++ code:
TnmWindow wStatus(2, 0, LINES - 2, 0, true),
wMain(LINES - 2, 0, 0, 0, true), // fullscreen window
wAbout(20, 60, 5, 5, true); // popup window
where TnmWindow is my own class to represent individual window. This class is
defined like this:
class TnmWindow {
WINDOW *wnd;
PANEL *pan;
bool initialized;
public:
TnmWindow(int lines, int cols, int begin_y, int begin_x, bool drawFrame =
false, bool visible = true);
TnmWindow(int lines, int cols, bool drawFrame = false, bool visible = true);
void show();
void hide();
};
TnmWindow::TnmWindow(int lines, int cols, int begin_y, int begin_x, bool
drawFrame, bool visible) {
if (!initialized) {
if ((wnd = newwin(lines, cols, begin_y, begin_x)) == NULL)
return;
if (drawFrame)
box(wnd, 0, 0);
pan = new_panel(wnd);
set_panel_userptr(pan, this);
if (!visible)
hide_panel(pan);
else {
update_panels();
doupdate();
}
initialized = true;
}
}
void TnmWindow::show() {
if (!initialized || (pan == NULL))
return;
if (panel_hidden(pan))
show_panel(pan);
else
top_panel(pan);
update_panels();
doupdate();
}
void TnmWindow::hide() {
if (!initialized || (pan == NULL))
return;
if (!panel_hidden(pan))
hide_panel(pan);
}
- Problems with overlapping windows,
Jiri Fogl <=