You don’t need to do anything: GTK will automatically ask the input method raise the OSK (if one is available) when giving focus to a text entry.
The IMContext.activate_osk() method is only relevant if you’re implementing your own text widget without using GtkText—something we do not recommend.
Ok, I see, thank you. Is there a way to override the standard behaviour, i.e. to have a OSK popup even if physical keyboard is connected (for test/debugging)?
And, can the OSK be prevent on a per-entry base? I am asking because I develop touchscreen software that has Entries that are “fed” by a grid of buttons (like a calculator), so I do not want to pop-up an OSK if I tap into the entry field. Otoh I have some Entries that do not have this “software keyboard”, so there I want the OSK to appear.