Fix #37 (thank you Mehdi)
authormrtout <mrtout@78b8d119-cf0a-0410-b17c-f493084dd1d7>
Fri, 10 Mar 2006 19:25:41 +0000 (19:25 +0000)
committermrtout <mrtout@78b8d119-cf0a-0410-b17c-f493084dd1d7>
Fri, 10 Mar 2006 19:25:41 +0000 (19:25 +0000)
git-svn-id: https://s.snth.net/svn/neverball/trunk@314 78b8d119-cf0a-0410-b17c-f493084dd1d7

ball/st_name.c
ball/st_save.c
share/gui.c
share/gui.h

index b6690e8..fba2d05 100644 (file)
@@ -99,6 +99,8 @@ static int name_action(int i)
     return 1;
 }
 
+static int enter_id;
+
 static int name_enter(void)
 {
     int id, jd;
@@ -118,7 +120,7 @@ static int name_enter(void)
        if ((jd = gui_harray(id)))
        {
            gui_state(jd, _("Cancel"), GUI_SML, NAME_CANCEL, 0);
-           gui_start(jd, _("OK"),     GUI_SML, NAME_OK,     0);
+           enter_id = gui_start(jd, _("OK"),     GUI_SML, NAME_OK,     0);
        }
 
        gui_layout(id, 0, 0);
@@ -140,6 +142,7 @@ static int name_keybd(int c, int d)
     if (d)
        if ((c & 0xFF80) == 0)
        {
+           gui_focus(enter_id);
            c &= 0x7F;
            if (c == '\b' || c == 0x7F)
                return name_action(GUI_BS);
index ea0d0d3..27292a2 100644 (file)
@@ -89,6 +89,8 @@ static int save_action(int i)
     return 1;
 }
 
+static int enter_id;
+
 static int save_enter(void)
 {
     int id, jd;
@@ -108,7 +110,7 @@ static int save_enter(void)
         if ((jd = gui_harray(id)))
         {
             gui_state(jd, _("Cancel"), GUI_SML, SAVE_CANCEL, 0);
-            gui_start(jd, _("Save"),   GUI_SML, SAVE_SAVE,   0);
+            enter_id = gui_start(jd, _("Save"),   GUI_SML, SAVE_SAVE,   0);
         }
         
         gui_layout(id, 0, 0);
@@ -130,6 +132,7 @@ static int save_keybd(int c, int d)
     if (d)
        if ((c & 0xFF80) == 0)
        {
+           gui_focus(enter_id);
            c &= 0x7F;
            if (c == '\b')
                return save_action(GUI_BS);
index 0daeb62..13f4c93 100644 (file)
@@ -1433,6 +1433,11 @@ int gui_point(int id, int x, int y)
         return active = jd;
 }
 
+void gui_focus(int i)
+{
+    active = i;
+}
+
 int gui_click(void)
 {
     return active;
index 09238da..f50cf83 100644 (file)
@@ -91,6 +91,7 @@ int  gui_point(int, int, int);
 int  gui_stick(int, int, int);
 int  gui_click(void);
 void gui_blank(void);
+void gui_focus(int);
 
 int  gui_token(int);
 int  gui_value(int);