Skip to content

Commit

Permalink
Remove IME handling code for Scintilla
Browse files Browse the repository at this point in the history
The code was for wxCocoa, which is a dead implementation of wxWidgets. wxOSX/Cocoa does not need this hack anymore. And the code is causing linking errors due to using private structures in wxCocoa.

Revert fffb138
  • Loading branch information
wangqr committed Mar 8, 2020
1 parent f8bd53c commit 3556c96
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 237 deletions.
212 changes: 0 additions & 212 deletions src/osx/scintilla_ime.mm

This file was deleted.

4 changes: 1 addition & 3 deletions src/subs_edit_box.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
#include "text_selection_controller.h"
#include "timeedit_ctrl.h"
#include "tooltip_manager.h"
#include "utils.h"
#include "validators.h"

#include <libaegisub/character_count.h>
Expand Down Expand Up @@ -455,8 +454,7 @@ void SubsEditBox::UpdateFrameTiming(agi::vfr::Framerate const& fps) {
}

void SubsEditBox::OnKeyDown(wxKeyEvent &event) {
if (!osx::ime::process_key_event(edit_ctrl, event))
hotkey::check("Subtitle Edit Box", c, event);
hotkey::check("Subtitle Edit Box", c, event);
}

void SubsEditBox::OnChange(wxStyledTextEvent &event) {
Expand Down
4 changes: 0 additions & 4 deletions src/subs_edit_ctrl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,6 @@ SubsTextEditCtrl::SubsTextEditCtrl(wxWindow* parent, wxSize wsize, long style, a
, thesaurus(agi::make_unique<Thesaurus>())
, context(context)
{
osx::ime::inject(this);

// Set properties
SetWrapMode(wxSTC_WRAP_WORD);
SetMarginWidth(1,0);
Expand Down Expand Up @@ -209,7 +207,6 @@ void SubsTextEditCtrl::OnLoseFocus(wxFocusEvent &event) {
}

void SubsTextEditCtrl::OnKeyDown(wxKeyEvent &event) {
if (osx::ime::process_key_event(this, event)) return;
event.Skip();

// Workaround for wxSTC eating tabs.
Expand Down Expand Up @@ -335,7 +332,6 @@ void SubsTextEditCtrl::UpdateCallTip() {
}

void SubsTextEditCtrl::SetTextTo(std::string const& text) {
osx::ime::invalidate(this);
SetEvtHandlerEnabled(false);
Freeze();

Expand Down
7 changes: 0 additions & 7 deletions src/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,13 +223,6 @@ int RetinaHelper::GetScaleFactor() const {
return 1;
#endif
}

// OS X implementation in scintilla_ime.mm
namespace osx { namespace ime {
void inject(wxStyledTextCtrl *) { }
void invalidate(wxStyledTextCtrl *) { }
bool process_key_event(wxStyledTextCtrl *, wxKeyEvent&) { return false; }
} }
#endif

wxString FontFace(std::string opt_prefix) {
Expand Down
13 changes: 2 additions & 11 deletions src/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@
#include <wx/bitmap.h>
#include <wx/string.h>

class wxKeyEvent;
class wxMouseEvent;
class wxStyledTextCtrl;
class wxWindow;

wxString PrettySize(int bytes);
Expand Down Expand Up @@ -99,20 +97,13 @@ agi::fs::path SaveFileSelector(wxString const& message, std::string const& optio

wxString LocalizedLanguageName(wxString const& lang);

#ifdef __WXOSX__
namespace osx {
/// Make the given menu the OS X Window menu
void make_windows_menu(wxMenu *wxmenu);
/// Activate a top-level document window other than the given one
bool activate_top_window_other_than(wxFrame *wx);
// Bring all windows to the front, maintaining relative z-order
void bring_to_front();

namespace ime {
/// Inject the IME helper into the given wxSTC
void inject(wxStyledTextCtrl *ctrl);
/// Invalidate any pending text from the IME
void invalidate(wxStyledTextCtrl *ctrl);
/// Give the IME a chance to process a key event and return whether it did
bool process_key_event(wxStyledTextCtrl *ctrl, wxKeyEvent &);
}
}
#endif

0 comments on commit 3556c96

Please sign in to comment.