Skip to content

Commit

Permalink
On X11, we cannot use im.reset() as in Wayland
Browse files Browse the repository at this point in the history
src/textview.py
  • Loading branch information
ShikiOkasaka committed May 5, 2024
1 parent 471111f commit 91dcb5a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/textview.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ class FuriganaView(Gtk.DrawingArea, Gtk.Scrollable):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)

display = Gdk.Display.get_default()
self._is_wayland = 'Wayland' in type(display).__name__

self._init_scrollable()
self._init_immultiontext()

Expand Down Expand Up @@ -629,7 +632,8 @@ def on_value_changed(self, *whatever):
def place_cursor_onscreen(self):
self.scroll_mark_onscreen(self.buffer.get_insert())
# Note GNOME Wayland IM module needs to be reset after changing the text cursor position.
self.im.reset()
if self._is_wayland:
self.im.reset()

def reflow(self, line=-1, redraw=True):
self.width = max(1, self.get_allocated_width() - self.padding.left - self.padding.right)
Expand Down

0 comments on commit 91dcb5a

Please sign in to comment.