From 056329200681048cb61d2ac2f7953d356f141ffe Mon Sep 17 00:00:00 2001 From: kervala Date: Sat, 12 Jun 2010 16:47:50 +0200 Subject: [PATCH] Fixed: #979 Implement getWindowPos for Linux --- .../3d/driver/opengl/driver_opengl_window.cpp | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp index 7bb327de4..fcbf24460 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp @@ -1483,7 +1483,32 @@ void CDriverGL::getWindowPos(uint32 &x, uint32 &y) #elif defined (NL_OS_UNIX) - x = y = 0; + int screen = DefaultScreen(_dpy); + +#if 0 + // Display size is a member of display structure + int display_width = DisplayWidth(_dpy, screen); + int display_height = DisplayHeight(_dpy, screen); +#endif + + int xtmp = 0, ytmp = 0; + unsigned int width = 0, height = 0; + unsigned int border_width = 0; + unsigned int depth = 0; + + // Get geometry information about root window + if (XGetGeometry(_dpy, RootWindow(_dpy, screen), &_win, &xtmp, &ytmp, &width, &height, &border_width, &depth)) + { + display_width = width; + display_height = height; + } + else + { + nlwarning("can't get root window geometry"); + } + + x = xtmp; + y = ytmp; #endif // NL_OS_UNIX }