Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Can't directly type Korean  (Read 4657 times)

0 Members and 1 Guest are viewing this topic.

iride

  • Jr. Member
  • **
  • Posts: 88
    • View Profile
    • Email
Can't directly type Korean
« on: February 09, 2018, 06:43:22 am »
Hi,
Whenver I type in Korean,I don't receive TextEntered events right away.
Instead a small popup appears and I must first type the text on that popup window and press enter to receive the events.
This makes it very frustrating to type.
How can I get rid of this??

I'm on windows 10, sfml 2.4.2.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Can't directly type Korean
« Reply #1 on: February 09, 2018, 08:45:58 am »
I'm not sure this is directly related to SFML. Does this happen only with SFML apps? Can you show a minimal code that reproduces the problem?
Laurent Gomila - SFML developer

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10823
    • View Profile
    • development blog
    • Email
Re: Can't directly type Korean
« Reply #2 on: February 09, 2018, 11:30:51 am »
Do you use IME?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

FRex

  • Hero Member
  • *****
  • Posts: 1845
  • Back to C++ gamedev with SFML in May 2023
    • View Profile
    • Email
Re: Can't directly type Korean
« Reply #3 on: February 09, 2018, 11:54:45 am »
This is how many (most?) CJK IMEs work and it's their intended way of working:  https://en.wikipedia.org/wiki/Input_method

If this happens in SFML then it has to be happening in all other apps too unless they forcibly turn IME off somehow, like via: https://msdn.microsoft.com/en-us/library/windows/desktop/dd318171(v=vs.85).aspx

If you don't want the pop ups then there are keyboard layouts you can turn on but I don't know Korean so I don't know if they get rid of the pop up:
Back to C++ gamedev with SFML in May 2023

iride

  • Jr. Member
  • **
  • Posts: 88
    • View Profile
    • Email
Re: Can't directly type Korean
« Reply #4 on: February 09, 2018, 03:28:35 pm »
I'm not sure this is directly related to SFML. Does this happen only with SFML apps? Can you show a minimal code that reproduces the problem?
I think this happens only with SFML apps. It doesn't happen with Google Chrome, MS word, Overwatch, etc.

int main()
{
sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!");

while (window.isOpen())
{
        sf::Event event;
        while (window.pollEvent(event))
        {
                if (event.type == sf::Event::Closed)
                        window.close();
                if (event.type == sf::Event::TextEntered)
                {
                        std::cout << event.text.unicode << "\n";
                }
        }

        window.clear();
        window.display();
}
}
Do you use IME?
Yes, I'm using Microsoft IME for Korean.

This is how many (most?) CJK IMEs work and it's their intended way of working:  https://en.wikipedia.org/wiki/Input_method

If this happens in SFML then it has to be happening in all other apps too unless they forcibly turn IME off somehow, like via: https://msdn.microsoft.com/en-us/library/windows/desktop/dd318171(v=vs.85).aspx

If you don't want the pop ups then there are keyboard layouts you can turn on but I don't know Korean so I don't know if they get rid of the pop up:

I can't type in Korean at all if I call ImmAssociateContext(handle, nullptr)

FRex

  • Hero Member
  • *****
  • Posts: 1845
  • Back to C++ gamedev with SFML in May 2023
    • View Profile
    • Email
Re: Can't directly type Korean
« Reply #5 on: February 09, 2018, 05:13:43 pm »
How do other apps do it then? The only difference I can think of is that they display the text you're inputting with IME inline (but I still think it's not processed right away, like if you type something into http://translate.google.com/ it will only translate after you press enter) where it should be where SFML shows a pop up in the top left corner.
Back to C++ gamedev with SFML in May 2023

iride

  • Jr. Member
  • **
  • Posts: 88
    • View Profile
    • Email
Re: Can't directly type Korean
« Reply #6 on: February 09, 2018, 06:59:48 pm »
Other apps immediate display the Korean alphabets.
Like for example
Typing in notepad:

Typing in SFML app

iride

  • Jr. Member
  • **
  • Posts: 88
    • View Profile
    • Email
Re: Can't directly type Korean
« Reply #7 on: February 09, 2018, 08:12:31 pm »
I think this question might be related:
https://stackoverflow.com/questions/434048/how-do-you-use-ime

From looking at this question, I think it might be impossible to do what I want with SFML.
I looked at SDL and it seems that SDL has what I want.
https://wiki.libsdl.org/Tutorials/TextInput
« Last Edit: February 09, 2018, 08:21:06 pm by iride »

FRex

  • Hero Member
  • *****
  • Posts: 1845
  • Back to C++ gamedev with SFML in May 2023
    • View Profile
    • Email
Re: Can't directly type Korean
« Reply #8 on: February 09, 2018, 09:57:29 pm »
The way I understand it it's not 'direct typing' and it just lets the application see what the user has in the IME during the composition and handle the drawing. The SDL example considers only committed input to be part of the text.

Yes, SFML is not catching these WM_IME_ events right now but if it did these would be some other kind of event, not TextEntered and you'd have to handle it specially in the app itself to show the preview.
« Last Edit: February 09, 2018, 10:03:21 pm by FRex »
Back to C++ gamedev with SFML in May 2023

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10823
    • View Profile
    • development blog
    • Email
Re: Can't directly type Korean
« Reply #9 on: February 09, 2018, 10:47:05 pm »
I recently looked through SDL's code and noticed that someone once must have done some ugly reverse engineering to implement their IME support... I mean look at this. ;D

Not sure if it's really worth investing time into this, but it's certainly not something that will be highly prioritized. Of course every contribution is welcome. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/