Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In case of multiple contexts I need the ActivateKeyboard of the system interface to provide the context parameter #477

Closed
huiseliming opened this issue Jun 19, 2023 · 2 comments
Labels
support Usage questions

Comments

@huiseliming
Copy link

Can context be provided in this function
virtual void Rml::SystemInterface::ActivateKeyboard(Rml::Vector2f caret_position, float line_height) override;
like
virtual void Rml::SystemInterface::ActivateKeyboard(Rml::Context* context, Rml::Vector2f caret_position, float line_height) override;

I need to get context to implement unreal ITextInputMethodContext to use IME

In the following two functions I am missing context
bool FRmlTextInputMethodContext::GetTextBounds(const uint32 BeginIndex, const uint32 Length, FVector2D& Position, FVector2D& Size)
{
if (RmlWidget.IsValid())
{
CUnrealRmlSystemInterface* SystemInterface = static_cast<CUnrealRmlSystemInterface*>(Rml::GetSystemInterface());
if (SystemInterface)
{
//// Let the IME editor follow the cursor
//Position = FVector2D(CachedGeometry.AbsolutePosition.X + ImGuiContext->PlatformImeLastPos.x,
// CachedGeometry.AbsolutePosition.Y + ImGuiContext->PlatformImeLastPos.y + 20);
}
}
return false;
}

void FRmlTextInputMethodContext::EndComposition()
{
if (bIsComposing)
{
bIsComposing = false;

	if (RmlWidget.IsValid())
	{
		CUnrealRmlSystemInterface* SystemInterface = static_cast<CUnrealRmlSystemInterface*>(Rml::GetSystemInterface());
		if (SystemInterface)
		{
			auto CharArray = CompositionString.GetCharArray();
			for (int i = 0; i < CharArray.Num(); i++)
			{
				CharArray[i];
				SystemInterface->pro();
			}
			CompositionString.Empty();
			CompositionBeginIndex = 0;
			CompositionLength = 0;
			SelectionRangeBeginIndex = 0;
			SelectionRangeLength = 0;
		}
	}
}

}

@mikke89 mikke89 added the support Usage questions label Jun 21, 2023
@mikke89
Copy link
Owner

mikke89 commented Jun 21, 2023

We don't provide the context here in this function, we don't necessarily assume that a keyboard is tied to a context. You will have to find another way to keep track of it.

@mikke89
Copy link
Owner

mikke89 commented Jul 10, 2023

Let's continue this discussion in #489.

@mikke89 mikke89 closed this as completed Jul 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
support Usage questions
Projects
None yet
Development

No branches or pull requests

2 participants