Skip to content

Commit

Permalink
[GTK] Don't notify cursor when cursorRect is default-initialized
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=218148

Reviewed by Michael Catanzaro.

For input methods in preedit mode, editor state update functions could
get an IntRect that is default-initialized (with x, y, width and height
all 0), which makes the input method popup at the top left corner
instead of its expected position.

* Source/WebKit/UIProcess/API/glib/InputMethodFilter.cpp:
(WebKit::InputMethodFilter::notifyCursorRect): Modified to check if
cursorRect is default-initialized.

Canonical link: https://commits.webkit.org/278261@main
  • Loading branch information
taoky authored and mcatanzaro committed May 2, 2024
1 parent 7cef0de commit f69bdc3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Source/WebKit/UIProcess/API/glib/InputMethodFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,10 @@ void InputMethodFilter::notifyCursorRect(const IntRect& cursorRect)
if (!isEnabled() || !m_context)
return;

// Don't notify cursor area when cursorRect is default-initialized (location and size are all 0).
if (!cursorRect.x() && !cursorRect.y() && !cursorRect.width() && !cursorRect.height())
return;

// Don't move the window unless the cursor actually moves more than 10
// pixels. This prevents us from making the window flash during minor
// cursor adjustments.
Expand Down

0 comments on commit f69bdc3

Please sign in to comment.