aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/gargoyle/events.cpp6
-rw-r--r--engines/gargoyle/events.h11
-rw-r--r--engines/gargoyle/glk.cpp23
-rw-r--r--engines/gargoyle/glk.h7
-rw-r--r--engines/gargoyle/window_text_buffer.cpp2
-rw-r--r--engines/gargoyle/window_text_grid.cpp2
-rw-r--r--engines/gargoyle/windows.cpp20
-rw-r--r--engines/gargoyle/windows.h5
8 files changed, 41 insertions, 35 deletions
diff --git a/engines/gargoyle/events.cpp b/engines/gargoyle/events.cpp
index 3373628a1e..a4dadcbaef 100644
--- a/engines/gargoyle/events.cpp
+++ b/engines/gargoyle/events.cpp
@@ -24,11 +24,7 @@
namespace Gargoyle {
-void Events::pollEvents() {
- // TODO
-}
-
-void Events::clearEvent(Event *ev) {
+void Events::getEvent(event_t *event, bool polled) {
// TODO
}
diff --git a/engines/gargoyle/events.h b/engines/gargoyle/events.h
index f49d9ffa1a..6140dc4e30 100644
--- a/engines/gargoyle/events.h
+++ b/engines/gargoyle/events.h
@@ -123,12 +123,13 @@ public:
Events() : _forceClick(false) {}
/**
- * Checks for new events
- */
- void pollEvents();
-
- void clearEvent(Event *ev);
+ * Get any pending event
+ */
+ void getEvent(event_t *event, bool polled);
+ /**
+ * Store an event for retrieval
+ */
void eventStore(EvType type, Window *win, uint32 val1 = 0, uint32 val2 = 0);
};
diff --git a/engines/gargoyle/glk.cpp b/engines/gargoyle/glk.cpp
index f1b24cb25b..736ed3e010 100644
--- a/engines/gargoyle/glk.cpp
+++ b/engines/gargoyle/glk.cpp
@@ -502,20 +502,20 @@ glui32 Glk::glk_fileref_does_file_exist(frefid_t fref) {
void Glk::glk_select(event_t *event) {
if (!_gliFirstEvent) {
- gliInputGuessFocus();
+ _windows->inputGuessFocus();
_gliFirstEvent = true;
}
- gliSelect(event, false);
+ _events->getEvent(event, false);
}
void Glk::glk_select_poll(event_t *event) {
if (!_gliFirstEvent) {
- gliInputGuessFocus();
+ _windows->inputGuessFocus();
_gliFirstEvent = true;
}
- gliSelect(event, true);
+ _events->getEvent(event, true);
}
void Glk::glk_request_timer_events(glui32 millisecs) {
@@ -881,6 +881,8 @@ void Glk::glk_cancel_hyperlink_event(winid_t win) {
}
}
+/*--------------------------------------------------------------------------*/
+
void Glk::glk_current_time(glktimeval_t *time) {
TimeAndDate td;
*time = td;
@@ -934,6 +936,8 @@ glsi32 Glk::glk_date_to_simple_time_local(const glkdate_t *date, glui32 factor)
return ts / factor;
}
+/*--------------------------------------------------------------------------*/
+
/* XXX non-official Glk functions that may or may not exist */
char *garglk_fileref_get_name(frefid_t fref) {
@@ -987,15 +991,4 @@ void Glk::garglk_set_reversevideo_stream(strid_t str, glui32 reverse) {
// TODO
}
-/*--------------------------------------------------------------------------*/
-
-void Glk::gliInputGuessFocus() {
- // TODO
-}
-
-void Glk::gliSelect(event_t *event, bool polled) {
- // TODO
- event->type = evtype_Quit;
-}
-
} // End of namespace Gargoyle
diff --git a/engines/gargoyle/glk.h b/engines/gargoyle/glk.h
index cf06474481..6bfffd6bc6 100644
--- a/engines/gargoyle/glk.h
+++ b/engines/gargoyle/glk.h
@@ -38,13 +38,6 @@ private:
bool _gliFirstEvent;
unsigned char _charTolowerTable[256];
unsigned char _charToupperTable[256];
-private:
- /**
- * Pick first window which might want input. This is called after every keystroke.
- */
- void gliInputGuessFocus();
-
- void gliSelect(event_t *event, bool polled);
public:
/**
* Constructor
diff --git a/engines/gargoyle/window_text_buffer.cpp b/engines/gargoyle/window_text_buffer.cpp
index 2cfaebdc00..26244e3e9c 100644
--- a/engines/gargoyle/window_text_buffer.cpp
+++ b/engines/gargoyle/window_text_buffer.cpp
@@ -716,7 +716,7 @@ void TextBufferWindow::cancelLineEvent(Event *ev) {
if (!ev)
ev = &dummyEv;
- g_vm->_events->clearEvent(ev);
+ ev->clear();
if (!_lineRequest && !_lineRequestUni)
return;
diff --git a/engines/gargoyle/window_text_grid.cpp b/engines/gargoyle/window_text_grid.cpp
index 01c31937c9..4786d02735 100644
--- a/engines/gargoyle/window_text_grid.cpp
+++ b/engines/gargoyle/window_text_grid.cpp
@@ -329,7 +329,7 @@ void TextGridWindow::cancelLineEvent(Event *ev) {
if (!ev)
ev = &dummyEv;
- g_vm->_events->clearEvent(ev);
+ ev->clear();
if (!_lineRequest && !_lineRequestUni)
return;
diff --git a/engines/gargoyle/windows.cpp b/engines/gargoyle/windows.cpp
index 2f2008c626..19f61ba77d 100644
--- a/engines/gargoyle/windows.cpp
+++ b/engines/gargoyle/windows.cpp
@@ -276,6 +276,24 @@ void Windows::rearrange() {
}
}
+void Windows::inputGuessFocus() {
+ Window *altWin = _focusWin;
+
+ do {
+ if (altWin
+ && (altWin->_lineRequest || altWin->_charRequest ||
+ altWin->_lineRequestUni || altWin->_charRequestUni))
+ break;
+ altWin = iterateTreeOrder(altWin);
+ } while (altWin != _focusWin);
+
+ if (_focusWin != altWin) {
+ _focusWin = altWin;
+ _forceRedraw = true;
+ redraw();
+ }
+}
+
void Windows::selectionChanged() {
_claimSelect = false;
_forceRedraw = true;
@@ -440,7 +458,7 @@ void Window::cancelLineEvent(Event *ev) {
if (!ev)
ev = &dummyEv;
- g_vm->_events->clearEvent(ev);
+ ev->clear();
}
void Window::moveCursor(const Common::Point &newPos) {
diff --git a/engines/gargoyle/windows.h b/engines/gargoyle/windows.h
index 2c03c158aa..b0ee311685 100644
--- a/engines/gargoyle/windows.h
+++ b/engines/gargoyle/windows.h
@@ -149,6 +149,11 @@ public:
*/
void setFocus(Window *win) { _focusWin = win; }
+ /**
+ * Pick first window which might want input. This is called after every keystroke.
+ */
+ void inputGuessFocus();
+
void selectionChanged();
void clearClaimSelect() { _claimSelect = false; }