From ffe79665bb1ba320420bb6d313547d1e110b9001 Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Thu, 2 Jan 2014 11:47:15 -0800 Subject: [PATCH] Work around wxGTK issues with time edits Modifying the contents of a text control after IM processing happens in the same cycle of the event loop seems to be seriously broken. Work around this by disabling IM processing for time edits, as it should never be relevant for them anyway. Closes #1679. Closes #1680. --- aegisub/src/timeedit_ctrl.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/aegisub/src/timeedit_ctrl.h b/aegisub/src/timeedit_ctrl.h index fd570f32a..9347c8504 100644 --- a/aegisub/src/timeedit_ctrl.h +++ b/aegisub/src/timeedit_ctrl.h @@ -69,6 +69,14 @@ class TimeEdit : public wxTextCtrl { void OnChar(wxKeyEvent &event); void OnModified(wxCommandEvent &event); +#ifdef __WXGTK__ + // IM processing completely breaks modifying a text ctrl's in response to + // wxEVT_CHAR (changing the value clears it and modifying the insertion + // point does nothing). IM processing should never be relevant here, so + // just disable it. + int GTKIMFilterKeypress(GdkEventKey *) const override { return 0; } +#endif + public: /// Get the current time as an AssTime object AssTime GetTime() const { return time; }