void sf_restoreareaandfree( ulong *s);
#define SF_NOTIMP (-9999)
-zword sf_read_key( int timeout, int cursor, int allowed);
+zword sf_read_key( int timeout, bool cursor, bool allowed, bool text);
int sf_user_fdialog( bool exist, const char *def, const char *filt, const char *title, char **res);
extern int (*sf_osdialog)( bool ex, const char *def, const char *filt, const char *tit, char **res,
STATIC zword yesnoover( int xc, int yc);
STATIC zword Zentry( int x, int y);
-STATIC zword inputkey()
+STATIC zword inputkey(bool text)
{
- zword c = sf_read_key(0,0,1);
+ zword c = sf_read_key(0, false, true, text);
if (c == ZC_SINGLE_CLICK)
{
switch (mouse_button)
for (;;)
{
if (pushed) { c = pushed; pushed = 0;}
- else c = inputkey();
+ else c = inputkey(false);
if (c == ZC_SINGLE_CLICK) c = checkmouse(0);
if (c == VK_INS) c = Zentry(0,-1);
if (c == ZC_ARROW_LEFT) goleft();
addbutton(xc+SPC,yc+SPC,BUTTW,HTEXT,"No",Zcanc);
for (;;)
{
- c = inputkey();
+ c = inputkey(false);
if (c == 'n' || c == 'N') c = ZC_ESCAPE;
if (c == 'y' || c == 'Y') c = ZC_RETURN;
if (c == ZC_SINGLE_CLICK) c = checkmouse(nsav);
showfilename(pos);
for (;;)
{
- c = inputkey();
+ c = inputkey(true);
if (c == ZC_SINGLE_CLICK)
{
pushed = c;
{
sf_fillrect(0,0,0,10000,10000);
os_draw_picture(1,1,1);
- os_read_key(0,0);
+ sf_read_key(0, false, false, false);
}
}
}
while (*hit)
os_display_char((*hit++));
- os_read_key(0,1);
+ sf_read_key(0, true, false, false);
}
sf_cleanup_all();
}
}
-zword sf_read_key( int timeout, int cursor, int allowed)
+zword sf_read_key( int timeout, bool cursor, bool allowed, bool text)
{
SDL_Event event;
zword inch = 0;
if (timeout) mytimeout = sf_ticks() + m_timerinterval*timeout;
// InputTimer timer(timeout);
// FrotzWnd::Input input;
- while (true)
- {
- // Get the next input
- while (SDL_PollEvent(&event))
- {
-//if (event.type == SDL_QUIT) printf("got SDL_QUIT\n");
- if ((inch = goodzkey(&event,allowed)))
- break;
- }
- if (inch) break;
- if ((timeout) && (sf_ticks() >= mytimeout))
- {
- inch = ZC_TIME_OUT;
- break;
- }
- sf_checksound();
- sf_sleep(10);
- }
+ if (text)
+ SDL_StartTextInput();
+ while (true) {
+ // Get the next input
+ while (SDL_PollEvent(&event)) {
+// if (event.type == SDL_QUIT) printf("got SDL_QUIT\n");
+ if ((inch = goodzkey(&event,allowed)))
+ break;
+ }
+ if (inch) break;
+ if ((timeout) && (sf_ticks() >= mytimeout)) {
+ inch = ZC_TIME_OUT;
+ break;
+ }
+ sf_checksound();
+ sf_sleep(10);
+ }
+ if (text)
+ SDL_StopTextInput();
if (cursor)
sf_drawcursor(false);
*/
zchar os_read_key(int timeout, int cursor)
{
- return sf_read_key(timeout,cursor,0);
+ return sf_read_key(timeout, cursor, false, true);
}
// sf_flushdisplay();
// Wait for a key press
- os_read_key(0,1);
+ sf_read_key(0, true, false, false);
// Remove the [More] prompt
sf_fillrect(ts->back,x,y,ts->cx-x,h);
// sf_drawcursor(false);