ricochet-im/ricochet — pull request #111 by jan0e (2014-10-07 12:20:52+00:00)
Title: ui: Fix new chat window opens only to the right #85

On Windows a new chat window got opened always right to the main windows even if this position was off screen.

To have a consistent behavior on both single and multi screen systems a list of all available screens is generated. This list is used to calculate the relative position of the chat window on the screen where the main window is located. If the position is off screen the chat window opens left from the main window. Also if the main window is moved below the bottom of the screen any new chat window will be opened above the screen bottom.

Note: this could be problematically on systems with vertically stacked screens.

This code was tested on Xubuntu 14.04 (dual screen) and Windows 8.1 (single screen). Note: I couldn't reproduce the problem on linux, since the window manager would not allow to open a window off the screen. One could decide to not use this code on linux (don't know about mac) but I think a consistent behavior on all OS would be desirable.