macOS and Windows: IME Window causes GtkPopover to Lose Focus
Hi, one of the Gaphor users noticed that our Popover text entry wasn't working with IME in macOS and Windows with GTK 4.10.x or 4.12.0.
I am able to reproduce this issue using this minimum example:
import gi
gi.require_version("Gtk", "4.0")
from gi.repository import Gtk, GLib
class EntryWindow(Gtk.ApplicationWindow):
def __init__(self, **kargs):
super().__init__(**kargs, title="Entry Demo")
self.set_size_request(200, 100)
header = Gtk.HeaderBar()
self.set_titlebar(header)
vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=6)
vbox.props.margin_start = 24
vbox.props.margin_end = 24
vbox.props.margin_top = 24
vbox.props.margin_bottom = 24
self.set_child(vbox)
button = Gtk.Button.new_with_label("Click Me")
button.connect("clicked", self.on_click_me_clicked)
vbox.append(button)
self.entry = Gtk.Entry()
self.entry.set_text("Hello World")
self.popover = Gtk.Popover.new()
self.popover.set_child(self.entry)
vbox.append(self.popover)
def on_click_me_clicked(self, button):
self.popover.set_visible(True)
def on_activate(app):
win = EntryWindow(application=app)
win.present()
app = Gtk.Application(application_id="com.example.App")
app.connect("activate", on_activate)
app.run(None)
I have the Japanese IME enabled with Hiragana selected. When I go to type in the Popover, as soon as the IME Window opens, it appears that the GtkPopover loses focus and none of the keystrokes appear in the GtkEntry. It works fine with no Popover if I put the Entry directly on the Window.