diff options
author | Marcus Fritzsch <marcus_fritzsch@mentor.com> | 2017-09-04 14:47:44 +0200 |
---|---|---|
committer | Marcus Fritzsch <marcus_fritzsch@mentor.com> | 2017-09-14 14:04:51 +0200 |
commit | 839032bb4aa57418289d829dd57f66b094ceb700 (patch) | |
tree | 34278303e7060b88fc818dac543d7d409120b558 /AFBClient.h | |
parent | 715231c6093c54797d36c1e01667439d0a8741f3 (diff) |
AFBClient: implement event handler dispatch
* requestSurface will store label if successful.
* onEvent calls AFBClient::Impl::event to dispatch the event.
* stripped down onCall and onEvent implementations.
* event names from onEvent are matched on-the-fly to
AFBClient::EventType.
* requestSurface with a name that is already known will fail
immediately.
* Removal of event handler not supported.
* Removal of surfaces not supported - assume the application
lives only as long as it's surface.
* Add minimal Event_Active event handler to main.
Signed-off-by: Marcus Fritzsch <marcus_fritzsch@mentor.com>
Diffstat (limited to 'AFBClient.h')
-rw-r--r-- | AFBClient.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/AFBClient.h b/AFBClient.h index f42aeea..983c2ad 100644 --- a/AFBClient.h +++ b/AFBClient.h @@ -12,11 +12,15 @@ class AFBClient AFBClient &operator=(const AFBClient &) = delete; public: + typedef std::function<void(char const *label)> handler_fun; + enum EventType { Event_Active = 1, Event_Inactive, + Event_Visible, Event_Invisible, + Event_SyncDraw, Event_FlushDraw, }; @@ -32,8 +36,7 @@ public: int deactivateSurface(const char *label); int endDraw(const char *label); - void set_event_handler(enum EventType et, - std::function<void(char const *label)> f); + void set_event_handler(enum EventType et, handler_fun f); struct Impl; |