Skip to content

Commit

Permalink
Rename OnBlur/OnFocus to OnActivate/OnDeactivate.
Browse files Browse the repository at this point in the history
  • Loading branch information
ShawnCZek committed Jun 28, 2024
1 parent 869f0d0 commit e11e96e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions Backends/RmlUi_Platform_Win32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -619,12 +619,12 @@ Rml::Input::KeyIdentifier RmlWin32::ConvertKey(int win32_key_code)

TextInputMethodEditor_Win32::TextInputMethodEditor_Win32() : composing(false), cursor_pos(-1), composition_range_start(0), composition_range_end(0) {}

void TextInputMethodEditor_Win32::OnFocus(Rml::SharedPtr<Rml::TextInputContext> _input_context)
void TextInputMethodEditor_Win32::OnActivate(Rml::SharedPtr<Rml::TextInputContext> _input_context)
{
input_context = _input_context;
}

void TextInputMethodEditor_Win32::OnBlur(Rml::TextInputContext* _input_context)
void TextInputMethodEditor_Win32::OnDeactivate(Rml::TextInputContext* _input_context)
{
if (input_context.lock().get() == _input_context)
input_context.reset();
Expand Down
4 changes: 2 additions & 2 deletions Backends/RmlUi_Platform_Win32.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ class TextInputMethodEditor_Win32 final : public Rml::TextInputHandler, Rml::Non
public:
TextInputMethodEditor_Win32();

void OnFocus(Rml::SharedPtr<Rml::TextInputContext> input_context) override;
void OnBlur(Rml::TextInputContext* input_context) override;
void OnActivate(Rml::SharedPtr<Rml::TextInputContext> input_context) override;
void OnDeactivate(Rml::TextInputContext* input_context) override;

/// Check that a composition is currently active.
/// @return True if we are composing, false otherwise.
Expand Down
8 changes: 4 additions & 4 deletions Include/RmlUi/Core/TextInputHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ class RMLUICORE_API TextInputHandler {
public:
virtual ~TextInputHandler() {}

/// Called when a text input element is focused.
/// Called when a text input element is activated (e.g., focused).
/// @param[in] input_context The input context to be activated.
virtual void OnFocus(SharedPtr<TextInputContext> /*input_context*/) {}
virtual void OnActivate(SharedPtr<TextInputContext> /*input_context*/) {}

/// Called when a text input element loses focus.
/// Called when a text input element is deactivated (e.g., by losing focus).
/// @param[in] input_context The input context to be deactivated.
virtual void OnBlur(TextInputContext* /*input_context*/) {}
virtual void OnDeactivate(TextInputContext* /*input_context*/) {}
};

} // namespace Rml
Expand Down
4 changes: 2 additions & 2 deletions Source/Core/Elements/WidgetTextInput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,7 @@ void WidgetTextInput::ProcessEvent(Event& event)
FormatElement();
ShowCursor(true, false);
if (TextInputHandler* handler = parent->GetContext()->GetTextInputHandler())
handler->OnFocus(text_input_method_context);
handler->OnActivate(text_input_method_context);
}
}
break;
Expand All @@ -669,7 +669,7 @@ void WidgetTextInput::ProcessEvent(Event& event)
if (event.GetTargetElement() == parent)
{
if (TextInputHandler* handler = parent->GetContext()->GetTextInputHandler())
handler->OnBlur(text_input_method_context.get());
handler->OnDeactivate(text_input_method_context.get());
if (ClearSelection())
FormatElement();
ShowCursor(false, false);
Expand Down

0 comments on commit e11e96e

Please sign in to comment.