mirror of https://github.com/buggins/dlangui.git
fix window close handling in console apps
This commit is contained in:
parent
63de7760df
commit
014935fd96
|
@ -149,17 +149,14 @@ class ConsolePlatform : Platform {
|
||||||
_needRedraw = false;
|
_needRedraw = false;
|
||||||
}
|
}
|
||||||
protected bool onInputIdle() {
|
protected bool onInputIdle() {
|
||||||
|
checkClosedWindows();
|
||||||
redraw();
|
redraw();
|
||||||
_console.flush();
|
_console.flush();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
protected Window[] _windowsToClose;
|
||||||
* close window
|
protected void handleCloseWindow(Window w) {
|
||||||
*
|
|
||||||
* Closes window earlier created with createWindow()
|
|
||||||
*/
|
|
||||||
override void closeWindow(Window w) {
|
|
||||||
for (int i = 0; i < _windowList.length; i++) {
|
for (int i = 0; i < _windowList.length; i++) {
|
||||||
if (_windowList[i] is w) {
|
if (_windowList[i] is w) {
|
||||||
for (int j = i; j + 1 < _windowList.length; j++)
|
for (int j = i; j + 1 < _windowList.length; j++)
|
||||||
|
@ -171,6 +168,21 @@ class ConsolePlatform : Platform {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void checkClosedWindows() {
|
||||||
|
for (int i = 0; i < _windowsToClose.length; i++) {
|
||||||
|
handleCloseWindow(_windowsToClose[i]);
|
||||||
|
}
|
||||||
|
_windowsToClose.length = 0;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* close window
|
||||||
|
*
|
||||||
|
* Closes window earlier created with createWindow()
|
||||||
|
*/
|
||||||
|
override void closeWindow(Window w) {
|
||||||
|
_windowsToClose ~= w;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Starts application message loop.
|
* Starts application message loop.
|
||||||
*
|
*
|
||||||
|
@ -268,8 +280,8 @@ class ConsoleDrawBuf : DrawBuf {
|
||||||
RGB(128,0,0),
|
RGB(128,0,0),
|
||||||
RGB(128,0,128),
|
RGB(128,0,128),
|
||||||
RGB(128,128,0),
|
RGB(128,128,0),
|
||||||
RGB(128,128,128),
|
|
||||||
RGB(192,192,192),
|
RGB(192,192,192),
|
||||||
|
RGB(0x7c,0x7c,0x7c), // ligth gray
|
||||||
RGB(0,0,255),
|
RGB(0,0,255),
|
||||||
RGB(0,255,0),
|
RGB(0,255,0),
|
||||||
RGB(0,255,255),
|
RGB(0,255,255),
|
||||||
|
|
Loading…
Reference in New Issue