Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Register
  • Sign in
  • gtk gtk
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 1.6k
    • Issues 1.6k
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 241
    • Merge requests 241
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • GNOMEGNOME
  • gtkgtk
  • Merge requests
  • !4402

gtktext: Make sure input method sees focus in

  • Review changes

  • Download
  • Patches
  • Plain diff
Merged Guido Günther requested to merge guidog/gtk:realize-vs-focus-in into main Jan 19, 2022
  • Overview 4
  • Commits 1
  • Pipelines 3
  • Changes 1

Currently when the widget is realized after the focus in event the input method isn't activated as enable is never sent. The call trace is

  gtk_text_focus_changed ->
    gtk_im_context_focus_in ->
      gtk_im_context_wayland_focus_in

which returns early as self->widget is NULL since it's set up in gtk_text_realize() via gtk_im_context_set_client_widget(). Handle that case by invoking gtk_im_context_focus_in() from gtk_text_realize() too.

A case where the above happens is a GtkSearchEntry in a GtkSearchBar. E.g. in gtk4-demo when starting the demo and then hitting the search button right away.

@carlosg This is what we could do in GText to fix the second half of !4397 (merged).

Alternatives would be moving this to GtkIMContextWayland which looks worse as it would be wayland specific. Also I don't think we can mandate that is-focus change happen after realize (which would make this problem go away entirely)- the revealer case shows those two events can be quite decoupled but I'd be happy to be wrong.

EDIT: GtkTextView would likely need a similar change

Edited Jan 19, 2022 by Guido Günther
Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: realize-vs-focus-in