Move window to max available position if remembered position is out of range.

This commit is contained in:
Deve 2015-01-02 13:48:36 +01:00
parent bab97833b7
commit d6c099b50b
2 changed files with 10 additions and 7 deletions

View File

@ -650,7 +650,7 @@ core::position2di IrrDriver::getMouseLocation()
* \return true on success, false on failure
* (always true on Linux at the moment)
*/
bool IrrDriver::moveWindow(const int x, const int y)
bool IrrDriver::moveWindow(int x, int y)
{
#ifdef WIN32
const video::SExposedVideoData& videoData =
@ -678,13 +678,16 @@ bool IrrDriver::moveWindow(const int x, const int y)
int screen_w = DisplayWidth(display, screen);
int screen_h = DisplayHeight(display, screen);
if ((x + UserConfigParams::m_width > screen_w) ||
(y + UserConfigParams::m_height > screen_h))
if (x + UserConfigParams::m_width > screen_w)
{
Log::warn("irr_driver", "Could not set window location\n");
return false;
x = screen_w - UserConfigParams::m_width;
}
if (y + UserConfigParams::m_height > screen_h)
{
y = screen_h - UserConfigParams::m_height;
}
// TODO: Actually handle possible failure
XMoveWindow(display, videoData.OpenGLLinux.X11Window, x, y);
#endif

View File

@ -436,7 +436,7 @@ public:
/** Call this to roll back to the previous resolution if a resolution switch attempt goes bad */
void cancelResChange();
bool moveWindow(const int x, const int y);
bool moveWindow(int x, int y);
void showPointer();
void hidePointer();