wayland: avoid 0 width/height anchor rectangle
authorOlivier Fourdan <ofourdan@redhat.com>
Thu, 12 Jan 2017 17:08:32 +0000 (18:08 +0100)
committerOlivier Fourdan <ofourdan@redhat.com>
Mon, 16 Jan 2017 12:55:36 +0000 (13:55 +0100)
commit9a5ffcd1b5d5bbbf5c440c7a441e1901c1cae766
tree8587c43cabf8a4e771b67db9a5e86a9703f20243
parentafd19e9433e566a85b154b686bd941b6f1dd091b
wayland: avoid 0 width/height anchor rectangle

Passing a rectangle with zero width or height to xdg_shell-v6
set_anchor_rect() will cause a protocol error and terminate the client,
as with gedit when pressing the Win key.

Reason for this is because the rectangle used to set the anchor comes
from gtk_text_layout_get_iter_location() which uses the pango layout
width/height, which can be empty if there is not character at the given
location.

Make sure we don't use 0 as width or height as an anchor rectangle to
avoid the protocol error, and compensate the logical position of the
given rectangle if the size is changed, so that the actual position
remains as expected by the client.

https://bugzilla.gnome.org/show_bug.cgi?id=777176
gdk/wayland/gdkwindow-wayland.c