ref: 48d2fd26ca4c1de5112103788841751619ebfe9c
parent: ef92ce016e328c1270597f2f1627c72bc3490d64
author: Simon Howard <[email protected]>
date: Fri Jun 2 16:50:51 EDT 2006
Make clicking on "accept" action buttons send enter keypresses to the window. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 554
--- a/textscreen/txt_window.c
+++ b/textscreen/txt_window.c
@@ -73,7 +73,7 @@
// Default actions
TXT_SetWindowAction(win, TXT_HORIZ_LEFT, TXT_NewWindowEscapeAction(win));
- TXT_SetWindowAction(win, TXT_HORIZ_RIGHT, TXT_NewWindowAcceptAction());
+ TXT_SetWindowAction(win, TXT_HORIZ_RIGHT, TXT_NewWindowAcceptAction(win));
return win;
}
--- a/textscreen/txt_window_action.c
+++ b/textscreen/txt_window_action.c
@@ -100,6 +100,13 @@
TXT_CloseWindow(window);
}
+static void WindowAcceptCallback(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(window))
+{
+ TXT_CAST_ARG(txt_window_t, window);
+
+ TXT_WidgetKeyPress(window, KEY_ENTER);
+}
+
txt_window_action_t *TXT_NewWindowEscapeAction(txt_window_t *window)
{
txt_window_action_t *action;
@@ -110,8 +117,13 @@
return action;
}
-txt_window_action_t *TXT_NewWindowAcceptAction(void)
+txt_window_action_t *TXT_NewWindowAcceptAction(txt_window_t *window)
{
- return TXT_NewWindowAction(KEY_ENTER, "Accept");
+ txt_window_action_t *action;
+
+ action = TXT_NewWindowAction(KEY_ENTER, "Accept");
+ TXT_SignalConnect(action, "pressed", WindowAcceptCallback, window);
+
+ return action;
}
--- a/textscreen/txt_window_action.h
+++ b/textscreen/txt_window_action.h
@@ -45,7 +45,7 @@
// Accept button that does nothing
-txt_window_action_t *TXT_NewWindowAcceptAction(void);
+txt_window_action_t *TXT_NewWindowAcceptAction(txt_window_t *window);
#endif /* #ifndef TXT_WINDOW_ACTION_H */