Use floor division to order widget for focus
GTK internally use gint to make such computation, so to mimick it correctly we must use a floor division.
This commit is contained in:
1 parent
985de6612e
commit
8c3f22a509
1 file changed
+4
-4
@@ -26,12 +26,12 @@ def find_focused_child(widget):
|
||||
|
||||
def tab_compare(a, b):
|
||||
text_direction = gtk.widget_get_default_direction()
|
||||
y1 = a.allocation.y + a.allocation.height / 2.
|
||||
y2 = b.allocation.y + b.allocation.height / 2.
|
||||
y1 = a.allocation.y + a.allocation.height // 2
|
||||
y2 = b.allocation.y + b.allocation.height // 2
|
||||
|
||||
if y1 == y2:
|
||||
x1 = a.allocation.x + a.allocation.width / 2.
|
||||
x2 = b.allocation.x + b.allocation.width / 2.
|
||||
x1 = a.allocation.x + a.allocation.width // 2
|
||||
x2 = b.allocation.x + b.allocation.width // 2
|
||||
|
||||
if text_direction == gtk.TEXT_DIR_RTL:
|
||||
return (x2 > x1) - (x2 < x1)
|
||||
|
||||
Reference in new issue
Block a user