summaryrefslogtreecommitdiff
path: root/textscreen/txt_desktop.c
diff options
context:
space:
mode:
Diffstat (limited to 'textscreen/txt_desktop.c')
-rw-r--r--textscreen/txt_desktop.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/textscreen/txt_desktop.c b/textscreen/txt_desktop.c
index 09589688..2316145f 100644
--- a/textscreen/txt_desktop.c
+++ b/textscreen/txt_desktop.c
@@ -97,6 +97,58 @@ txt_window_t *TXT_GetActiveWindow(void)
return all_windows[num_windows - 1];
}
+int TXT_RaiseWindow(txt_window_t *window)
+{
+ int i;
+
+ for (i = 0; i < num_windows - 1; ++i)
+ {
+ if (all_windows[i] == window)
+ {
+ all_windows[i] = all_windows[i + 1];
+ all_windows[i + 1] = window;
+
+ if (i == num_windows - 2)
+ {
+ TXT_SetWindowFocus(all_windows[i], 0);
+ TXT_SetWindowFocus(window, 1);
+ }
+
+ return 1;
+ }
+ }
+
+ // Window not in the list, or at the end of the list (top) already.
+
+ return 0;
+}
+
+int TXT_LowerWindow(txt_window_t *window)
+{
+ int i;
+
+ for (i = 0; i < num_windows - 1; ++i)
+ {
+ if (all_windows[i + 1] == window)
+ {
+ all_windows[i + 1] = all_windows[i];
+ all_windows[i] = window;
+
+ if (i == num_windows - 2)
+ {
+ TXT_SetWindowFocus(window, 0);
+ TXT_SetWindowFocus(all_windows[i + 1], 1);
+ }
+
+ return 1;
+ }
+ }
+
+ // Window not in the list, or at the start of the list (bottom) already.
+
+ return 0;
+}
+
static void DrawDesktopBackground(const char *title)
{
int i;