Fix getCurrentScreenMode() when no window has been created yet

core4
nimetu 3 years ago
parent b184192bc2
commit 4fa80a0aec

@ -2485,13 +2485,19 @@ bool CDriverGL::getCurrentScreenMode(GfxMode &mode)
Window child; Window child;
// get window position so we can compare monitors (or mouse position if window not visible yet) // get window position so we can compare monitors (or mouse position if window not visible yet)
bool useMouseForPosition = true;
if (_win != EmptyWindow)
{
XWindowAttributes xwa; XWindowAttributes xwa;
XGetWindowAttributes(_dpy, _win, &xwa); XGetWindowAttributes(_dpy, _win, &xwa);
if (xwa.map_state != IsUnmapped) if (xwa.map_state != IsUnmapped)
{ {
XTranslateCoordinates(_dpy, _win, xwa.root, xwa.x, xwa.y, &x, &y, &child); XTranslateCoordinates(_dpy, _win, xwa.root, xwa.x, xwa.y, &x, &y, &child);
useMouseForPosition = false;
} }
else }
if (useMouseForPosition)
{ {
sint rx, ry, wx, wy; sint rx, ry, wx, wy;
uint mask; uint mask;

Loading…
Cancel
Save