Widget.get_iter_at_location returns a 2-tuple on GTK+ 3.20, so get the actual iterator.

Fixes #8312.
This commit is contained in:
Emmanuel Gil Peyrot 2016-04-02 14:36:33 +01:00
parent b96f70d39c
commit ba7d612fdc
2 changed files with 22 additions and 5 deletions

View File

@ -622,7 +622,10 @@ class ConversationTextview(GObject.GObject):
pointer = w.get_device_position(device)
x = pointer[1]
y = pointer[2]
tags = self.tv.get_iter_at_location(x, y).get_tags()
iter_ = self.tv.get_iter_at_location(x, y)
if isinstance(iter_, tuple):
iter_ = iter_[1]
tags = iter_.get_tags()
tag_table = self.tv.get_buffer().get_tag_table()
xep0184_warning = False
for tag in tags:
@ -644,7 +647,10 @@ class ConversationTextview(GObject.GObject):
pointer = w.get_device_position(device)
x = pointer[1]
y = pointer[2]
tags = self.tv.get_iter_at_location(x, y).get_tags()
iter_ = self.tv.get_iter_at_location(x, y)
if isinstance(iter_, tuple):
iter_ = iter_[1]
tags = iter_.get_tags()
tag_table = self.tv.get_buffer().get_tag_table()
over_line = False
for tag in tags:
@ -695,7 +701,10 @@ class ConversationTextview(GObject.GObject):
pointer = w.get_device_position(device)
x, y = self.tv.window_to_buffer_coords(Gtk.TextWindowType.TEXT,
pointer[1], pointer[2])
tags = self.tv.get_iter_at_location(x, y).get_tags()
iter_ = self.tv.get_iter_at_location(x, y)
if isinstance(iter_, tuple):
iter_ = iter_[1]
tags = iter_.get_tags()
if self.change_cursor:
w.set_cursor(Gdk.Cursor.new(Gdk.CursorType.XTERM))
self.change_cursor = False
@ -864,6 +873,8 @@ class ConversationTextview(GObject.GObject):
x, y = self.tv.window_to_buffer_coords(Gtk.TextWindowType.TEXT,
int(event.x), int(event.y))
iter_ = self.tv.get_iter_at_location(x, y)
if isinstance(iter_, tuple):
iter_ = iter_[1]
tags = iter_.get_tags()
if tags: # we clicked on sth special (it can be status message too)

View File

@ -899,7 +899,10 @@ class HtmlTextView(Gtk.TextView):
pointer = w.get_device_position(device)
x = pointer[1]
y = pointer[2]
tags = self.get_iter_at_location(x, y).get_tags()
iter_ = self.get_iter_at_location(x, y)
if isinstance(iter_, tuple):
iter_ = iter_[1]
tags = iter_.get_tags()
is_over_anchor = False
for tag_ in tags:
if getattr(tag_, 'is_anchor', False):
@ -918,7 +921,10 @@ class HtmlTextView(Gtk.TextView):
pointer = w.get_device_position(device)
x = pointer[1]
y = pointer[2]
tags = widget.get_iter_at_location(x, y).get_tags()
iter_ = widget.get_iter_at_location(x, y)
if isinstance(iter_, tuple):
iter_ = iter_[1]
tags = iter_.get_tags()
anchor_tags = [tag for tag in tags if getattr(tag, 'is_anchor', False)]
if self.tooltip.timeout != 0 or self.tooltip.shown:
# Check if we should hide the line tooltip