lib/volay/widget/system_tray.rb in volay-1.0.0 vs lib/volay/widget/system_tray.rb in volay-1.0.1
- old
+ new
@@ -57,11 +57,11 @@
#
# @param [Gtk::Window] window Window
#
def get_position(window)
_e, screen, rectangle, orientation = @app.get_object('status_icon')
- .geometry
+ .geometry
window.set_screen(screen)
monitor_num = screen.get_monitor_at_point(rectangle.x, rectangle.y)
monitor = screen.get_monitor_geometry(monitor_num)
window_width, window_height = window.size
@@ -73,19 +73,19 @@
# left panel
posx = rectangle.x + rectangle.width
posy = rectangle.y
end
else
- if (rectangle.y + rectangle.height + window_height <=
- monitor.y + monitor.height)
+ total = rectangle.y + rectangle.height + window_height
+ if total <= monitor.y + monitor.height
posy = rectangle.y + rectangle.height
else
posy = rectangle.y - window_height
- if (rectangle.x + window_width <= monitor.x + monitor.width)
- posx = rectangle.x
- else
- posx = monitor.x + monitor.width - window_width
- end
+ posx = if rectangle.x + window_width <= monitor.x + monitor.width
+ rectangle.x
+ else
+ monitor.x + monitor.width - window_width
+ end
end
end
[posx, posy]
end