Menu

#2149 Can't use window mode IME on GTK using Wayland

Bug
closed-fixed
johnsonj
GTK (11) IME (11)
5
2020-04-27
2019-12-23
Zufu Liu
No

Create a separated bug from [bugs:#2135], the error:
Gdk-Message: 22:51:24.266: Window 0x28661e0 is a temporary window without parent, application will not be able to position it on screen.
screenshot (ibus-Fedora31.webm) is available at https://sourceforge.net/p/scintilla/bugs/2135/#f1a2

Wayland is the default display server in Fedora 25+, possible Ubuntu 20.04+.
The login screen on Fedora/Ubuntu has options for Wayland and X11.

https://fedoraproject.org/wiki/Changes/WaylandByDefault
https://discourse.ubuntu.com/t/wayland-for-19-10/10983

Related

Bugs: #2135

Discussion

  • Neil Hodgson

    Neil Hodgson - 2019-12-23

    Confirmed that on Fedora 30 with "Japanese (Kana Kanji)" and SciTE set to ime.interaction=0 this problem occurs with Wayland but does not occur with X.

    Its possible that this problem is limited to some IMEs as the window is likely being created and its attributes set by that code. Scintilla does set itself as the client window with

    gtk_im_context_set_client_window(im_context, WindowFromWidget(widget));
    
     
  • Zufu Liu

    Zufu Liu - 2019-12-27

    The error "Gdk-Message: 19:55:46.617: Window 0x2094240 is a temporary window without parent, application will not be able to position it on screen." is caused by gtk_widget_show(PWidget(wPreedit)); in PreeditChangedWindowedThis().
    after the error PreeditChanged() is called again with empty string.

     
  • Zufu Liu

    Zufu Liu - 2019-12-27

    After replacing wPreedit = gtk_window_new(GTK_WINDOW_POPUP); with wPreedit = gtk_window_new(GTK_WINDOW_TOPLEVEL);, the GDK error is gone, but still can't type character: with Chinese Pinyin, type a, in PreeditChangedWindowedThis(), pes.str is 阿; then PreeditChanged() called again, pes.str is empty.

    Edit: it's then followed by PreeditEnd() (after adding preedit_end signal).

     

    Last edit: Zufu Liu 2019-12-27
    • Neil Hodgson

      Neil Hodgson - 2019-12-28

      A potential direction is gtk_window_set_transient_for which was used for autocompletion and calltips with [8cb0c9].

       

      Related

      Commit: [8cb0c9]

  • Zufu Liu

    Zufu Liu - 2019-12-28

    Add gtk_window_set_transient_for() in RealizeThis() works.
    There is related issue on GTK https://gitlab.gnome.org/GNOME/gtk/issues/1934

     
  • Zufu Liu

    Zufu Liu - 2019-12-28

    Updated patch (redundant casts in CreateCallTipWindow is removed). it still has bugs:
    IME candidate window for Chinese Pinyin sometimes is not shown; for Japanese Kana Kanji, it sometimes at wrong position/direction.

     

    Last edit: Zufu Liu 2019-12-28
    • Zufu Liu

      Zufu Liu - 2020-01-01

      The bug can be reproduced as following:
      Change IME in native mode (i.e. not English keyboard/mode or direct input mode), then start SciTE; candidate window only shows (at expected position) when typing second word, after first word is committed (e.g. by press Enter).
      It works fine when keyboard/IME is English mode or direct input mode before start SciTE.

       
      • Zufu Liu

        Zufu Liu - 2020-01-01

        An interesting find: candidate window is shown at right position after FocusOutThis() been called. e.g. start SciTE, click somewhere outside editor window, then click in editor window and start typing. but direct call FocusOutThis() doesn't make it work.

         
        • Neil Hodgson

          Neil Hodgson - 2020-01-01

          Calling FocusOutThis won't do the focus-in processing. Maybe just toggle the IME focus:

                      gtk_im_context_focus_out(im_context);
                      gtk_im_context_focus_in(im_context);
          
           
  • Zufu Liu

    Zufu Liu - 2020-01-04

    Comment out SetCandidateWindowPos() in FocusInThis() would make it works better, except for Chinese Pinyin and Japanese Mozc:
    the IME candidate window is under caret line but in wrong direction on typing first letter as in screenshot (on Ubuntu using Mozc type to), the popover points down on typing 't', then filliped on typing 'o'.

    This behavior for first letter is very similar to IME on macOS and Windows, looks something is missing or wrong.

     
    • Zufu Liu

      Zufu Liu - 2020-01-06

      This bug not occurred in the bait demo on [feature-requests:#1331], the IME candidate window is at expected position and direction on typing first letter.

       

      Related

      Feature Requests: #1331

      • Zufu Liu

        Zufu Liu - 2020-01-07

        This bug seems only occurred in the VMs, it not occurred in dual boot Ubuntu 18.04.

        However there is a warning on Ubuntu 18.04 (both VM and dual boot, GTK 3.22.30) for gtk_window_set_transient_for() in RealizeThis():

        (SciTE:2197): Gdk-WARNING **: 17:05:02.768: Couldn't map window 0x5556dd3f07e0 as subsurface because its parent is not mapped.
        

        move gtk_window_set_transient_for() to the end of MapThis() still has this warning. This warning doesn't affect using IMEs.

         
  • Zufu Liu

    Zufu Liu - 2020-01-07

    Updated patch:

    1. Moved gtk_window_set_transient_for() into FocusInThis(), no warnings so far.
    2. SetCandidateWindowPos() for macOS in FocusInThis() is called only once, as commented in PreeditStartThis().
     
  • Neil Hodgson

    Neil Hodgson - 2020-04-27
    • status: open --> closed-fixed
     
  • Neil Hodgson

    Neil Hodgson - 2020-04-27

    Committed change that just sets the preedit window as transient for main as [b99cb7]. This is sufficient to avoid the warning and show the IME window.

    The per-platform position tweaks were not committed at this time.

     

    Related

    Commit: [b99cb7]


Log in to post a comment.

MongoDB Logo MongoDB