foxygit / doom Log in
commit 379d372c65dee97d13b9a490c7c7a1a466478b7f
Merge: 1ec21c92 cc87c97e
Author:     Simon Howard <fraggle@gmail.com>
AuthorDate: Sun Oct 23 20:07:40 2011 +0000
Commit:     Simon Howard <fraggle@gmail.com>
CommitDate: Sun Oct 23 20:07:40 2011 +0000

    Merge from trunk.

    Subversion-branch: /branches/v2-branch
    Subversion-revision: 2464

 NEWS                           |   7 ++
 src/setup/txt_joybinput.c      |   4 +-
 src/setup/txt_keyinput.c       |   4 +-
 src/setup/txt_mouseinput.c     |   4 +-
 textscreen/txt_button.c        |   4 +-
 textscreen/txt_checkbox.c      |   4 +-
 textscreen/txt_desktop.c       |  26 +++++-
 textscreen/txt_desktop.h       |   3 +-
 textscreen/txt_dropdown.c      |   4 +-
 textscreen/txt_inputbox.c      | 176 +++++++++++++++++++++--------------------
 textscreen/txt_label.c         |   2 +-
 textscreen/txt_radiobutton.c   |   4 +-
 textscreen/txt_scrollpane.c    |  18 ++++-
 textscreen/txt_sdl.c           |  48 ++++++-----
 textscreen/txt_separator.c     |   2 +-
 textscreen/txt_spinctrl.c      |  48 +++++++----
 textscreen/txt_strut.c         |   2 +-
 textscreen/txt_table.c         | 113 ++++++++++++++++++--------
 textscreen/txt_widget.c        |  32 +++++++-
 textscreen/txt_widget.h        |  10 ++-
 textscreen/txt_window.c        |  28 +++++--
 textscreen/txt_window_action.c |   2 +-
 22 files changed, 358 insertions(+), 187 deletions(-)

diff --cc textscreen/txt_desktop.c
index 31c3921e,2c7caa27..09589688
--- a/textscreen/txt_desktop.c
+++ b/textscreen/txt_desktop.c
@@@ -39,14 -39,21 +39,25 @@@ static txt_window_t *all_windows[MAXWIN
  static int num_windows = 0;
  static int main_loop_running = 0;

 +static TxtIdleCallback periodic_callback = NULL;
 +static void *periodic_callback_data;
 +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)
diff --cc textscreen/txt_scrollpane.c
index dba69d30,4f468ffe..c53f68df
--- a/textscreen/txt_scrollpane.c
+++ b/textscreen/txt_scrollpane.c
@@@ -158,21 -158,9 +158,21 @@@ static void TXT_ScrollPaneSizeCalc(TXT_
      {
          ++scrollpane->widget.w;
      }
 +
 +    if (scrollpane->child != NULL)
 +    {
 +        if (scrollpane->child->w < scrollpane->w)
 +        {
 +            scrollpane->child->w = scrollpane->w;
 +        }
 +        if (scrollpane->child->h < scrollpane->h)
 +        {
 +            scrollpane->child->h = scrollpane->h;
 +        }
 +    }
  }

- static void TXT_ScrollPaneDrawer(TXT_UNCAST_ARG(scrollpane), int selected)
+ static void TXT_ScrollPaneDrawer(TXT_UNCAST_ARG(scrollpane))
  {
      TXT_CAST_ARG(txt_scrollpane_t, scrollpane);
      int x1, y1, x2, y2;
diff --cc textscreen/txt_window.c
index 8cbddb55,d33dd75b..67543735
--- a/textscreen/txt_window.c
+++ b/textscreen/txt_window.c
@@@ -474,24 -485,8 +487,29 @@@ void TXT_SetMouseListener(txt_window_t
      window->mouse_listener_data = user_data;
  }

+ void TXT_SetWindowFocus(txt_window_t *window, int focused)
+ {
+     TXT_SetWidgetFocus(window, focused);
+ }
+
 +txt_window_t *TXT_MessageBox(char *title, char *message, ...)
 +{
 +    txt_window_t *window;
 +    char buf[256];
 +    va_list args;
 +
 +    va_start(args, message);
 +    vsnprintf(buf, sizeof(buf), message, args);
 +    va_end(args);
 +
 +    window = TXT_NewWindow(title);
 +    TXT_AddWidget(window, TXT_NewLabel(buf));
 +
 +    TXT_SetWindowAction(window, TXT_HORIZ_LEFT, NULL);
 +    TXT_SetWindowAction(window, TXT_HORIZ_CENTER,
 +                        TXT_NewWindowEscapeAction(window));
 +    TXT_SetWindowAction(window, TXT_HORIZ_RIGHT, NULL);
 +
 +    return window;
 +}
 +