GtkIMContext cannot receive gtk_im_context_focus_in() in Wayland and GTK4
To reproduce:
- Launch a GTK4 text application with GtkTextView or GtkEntry in GNOME Wayland.
- Focus on the application with mouse or Alt-Tab.
Expected result: gtk_im_context_focus_in() is called from gtk_text_view_focus_in().
Actual Result: gtk_text_view_focus_in() is not called with the focus changes so gtk_im_context_focus_in() is not called too.
In GTK4, gtk_text_view_focus_in() is not called with focus changes in GNOME Wayland.
In GTK3, gtk/gtkwindow.c:do_focus_change() creates GdkEventFocus with focus changes in GNOME Wayland and gtk_text_view_focus_in_event() is called from gtk_widget_send_focus_change() and gtk_im_context_focus_in() is called too.
I think GTK4's GdkEventFocus is now encapsulated and GtkWindow cannot forward GdkEventFocus to the child widgets and gtk/gtkwindow.c:do_focus_change() was deleted from GTK4.