diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-11-17 16:00:18 +0200 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-11-17 16:00:18 +0200 |
commit | 233d1012a762c6b49632b82bd9618003e25fefc5 (patch) | |
tree | 9f9d6de9fc88c9a5013fec146f8dc6bd625eea5a | |
parent | 95366fc1fc01958e2b3c9557b1afa77785ca3b04 (diff) |
Window: Added notifications for window focus gain/loss
-rw-r--r-- | src/ui/util.c | 3 | ||||
-rw-r--r-- | src/ui/window.c | 4 |
2 files changed, 6 insertions, 1 deletions
diff --git a/src/ui/util.c b/src/ui/util.c index 98f0fb18..9ac18881 100644 --- a/src/ui/util.c +++ b/src/ui/util.c | |||
@@ -868,7 +868,8 @@ void updateValueInput_Widget(iWidget *d, const char *title, const char *prompt) | |||
868 | 868 | ||
869 | static iBool messageHandler_(iWidget *msg, const char *cmd) { | 869 | static iBool messageHandler_(iWidget *msg, const char *cmd) { |
870 | /* Almost any command dismisses the sheet. */ | 870 | /* Almost any command dismisses the sheet. */ |
871 | if (!(equal_Command(cmd, "media.updated") || equal_Command(cmd, "document.request.updated"))) { | 871 | if (!(equal_Command(cmd, "media.updated") || equal_Command(cmd, "document.request.updated") || |
872 | startsWith_CStr(cmd, "window."))) { | ||
872 | destroy_Widget(msg); | 873 | destroy_Widget(msg); |
873 | } | 874 | } |
874 | return iFalse; | 875 | return iFalse; |
diff --git a/src/ui/window.c b/src/ui/window.c index 63f19e3f..4418e61f 100644 --- a/src/ui/window.c +++ b/src/ui/window.c | |||
@@ -680,6 +680,10 @@ static iBool handleWindowEvent_Window_(iWindow *d, const SDL_WindowEvent *ev) { | |||
680 | return iTrue; | 680 | return iTrue; |
681 | case SDL_WINDOWEVENT_FOCUS_GAINED: | 681 | case SDL_WINDOWEVENT_FOCUS_GAINED: |
682 | d->focusGainedAt = SDL_GetTicks(); | 682 | d->focusGainedAt = SDL_GetTicks(); |
683 | postCommand_App("window.focus.gained"); | ||
684 | return iFalse; | ||
685 | case SDL_WINDOWEVENT_FOCUS_LOST: | ||
686 | postCommand_App("window.focus.lost"); | ||
683 | return iFalse; | 687 | return iFalse; |
684 | default: | 688 | default: |
685 | break; | 689 | break; |