summaryrefslogtreecommitdiff
path: root/textscreen/txt_desktop.c
diff options
context:
space:
mode:
authorSimon Howard2011-10-23 20:07:40 +0000
committerSimon Howard2011-10-23 20:07:40 +0000
commit379d372c65dee97d13b9a490c7c7a1a466478b7f (patch)
tree5df907dfd14c72fdfc05fc6e4cb2d4b3081db711 /textscreen/txt_desktop.c
parent1ec21c92ed4c3f792e642524c5cd5bc30b6d7457 (diff)
parentcc87c97e4bae07238e9e1af8668944fd7805c133 (diff)
downloadchocolate-doom-379d372c65dee97d13b9a490c7c7a1a466478b7f.tar.gz
chocolate-doom-379d372c65dee97d13b9a490c7c7a1a466478b7f.tar.bz2
chocolate-doom-379d372c65dee97d13b9a490c7c7a1a466478b7f.zip
Merge from trunk.
Subversion-branch: /branches/v2-branch Subversion-revision: 2464
Diffstat (limited to 'textscreen/txt_desktop.c')
-rw-r--r--textscreen/txt_desktop.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/textscreen/txt_desktop.c b/textscreen/txt_desktop.c
index 31c3921e..09589688 100644
--- a/textscreen/txt_desktop.c
+++ b/textscreen/txt_desktop.c
@@ -45,14 +45,29 @@ static unsigned int periodic_callback_period;
void TXT_AddDesktopWindow(txt_window_t *win)
{
+ // Previously-top window loses focus:
+
+ if (num_windows > 0)
+ {
+ TXT_SetWindowFocus(all_windows[num_windows - 1], 0);
+ }
+
all_windows[num_windows] = win;
++num_windows;
+
+ // New window gains focus:
+
+ TXT_SetWindowFocus(win, 1);
}
void TXT_RemoveDesktopWindow(txt_window_t *win)
{
int from, to;
+ // Window must lose focus if it's being removed:
+
+ TXT_SetWindowFocus(win, 0);
+
for (from=0, to=0; from<num_windows; ++from)
{
if (all_windows[from] != win)
@@ -61,8 +76,15 @@ void TXT_RemoveDesktopWindow(txt_window_t *win)
++to;
}
}
-
+
num_windows = to;
+
+ // Top window gains focus:
+
+ if (num_windows > 0)
+ {
+ TXT_SetWindowFocus(all_windows[num_windows - 1], 1);
+ }
}
txt_window_t *TXT_GetActiveWindow(void)
@@ -144,7 +166,7 @@ void TXT_DrawDesktop(void)
for (i=0; i<num_windows; ++i)
{
- TXT_DrawWindow(all_windows[i], i == num_windows - 1);
+ TXT_DrawWindow(all_windows[i]);
}
TXT_UpdateScreen();