chore: XWindowsScreen: remove duplicate function

This commit is contained in:
Roman Vasiyarov
2025-09-17 17:44:07 +03:00
committed by Nick Bolton
parent 134c8fd1c1
commit 3aef2f4309

View File

@ -894,47 +894,7 @@ Display *XWindowsScreen::openDisplay(const char *displayName)
void XWindowsScreen::saveShape()
{
// get shape of default screen
m_x = 0;
m_y = 0;
m_w = WidthOfScreen(DefaultScreenOfDisplay(m_display));
m_h = HeightOfScreen(DefaultScreenOfDisplay(m_display));
// get center of default screen
m_xCenter = m_x + (m_w >> 1);
m_yCenter = m_y + (m_h >> 1);
// check if xinerama is enabled and there is more than one screen.
// get center of first Xinerama screen. Xinerama appears to have
// a bug when XWarpPointer() is used in combination with
// XGrabPointer(). in that case, the warp is successful but the
// next pointer motion warps the pointer again, apparently to
// constrain it to some unknown region, possibly the region from
// 0,0 to Wm,Hm where Wm (Hm) is the minimum width (height) over
// all physical screens. this warp only seems to happen if the
// pointer wasn't in that region before the XWarpPointer(). the
// second (unexpected) warp causes deskflow to think the pointer
// has been moved when it hasn't. to work around the problem,
// we warp the pointer to the center of the first physical
// screen instead of the logical screen.
m_xinerama = false;
#if HAVE_X11_EXTENSIONS_XINERAMA_H
int eventBase;
int errorBase;
if (XineramaQueryExtension(m_display, &eventBase, &errorBase) && XineramaIsActive(m_display)) {
int numScreens;
XineramaScreenInfo *screens;
screens = XineramaQueryScreens(m_display, &numScreens);
if (screens != nullptr) {
if (numScreens > 1) {
m_xinerama = true;
m_xCenter = screens[0].x_org + (screens[0].width >> 1);
m_yCenter = screens[0].y_org + (screens[0].height >> 1);
}
XFree(screens);
}
}
#endif
setShape(WidthOfScreen(DefaultScreenOfDisplay(m_display)), HeightOfScreen(DefaultScreenOfDisplay(m_display)));
}
void XWindowsScreen::setShape(int32_t width, int32_t height)