mirror of
https://github.com/glfw/glfw.git
synced 2025-10-04 13:46:37 +00:00
Use GLFW function to get window property on X11
The function ```XGetWindowProperty``` was replaced with the GLFW function ```_glfwGetWindowPropertyX11``` in the operation to get the work area.
This commit is contained in:
parent
2b7ed3d177
commit
0403eed963
@ -444,6 +444,8 @@ static void detectEWMH(void)
|
||||
getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_WINDOW_TYPE");
|
||||
_glfw.x11.NET_WM_WINDOW_TYPE_NORMAL =
|
||||
getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_WINDOW_TYPE_NORMAL");
|
||||
_glfw.x11.NET_WORKAREA =
|
||||
getSupportedAtom(supportedAtoms, atomCount, "_NET_WORKAREA");
|
||||
_glfw.x11.NET_ACTIVE_WINDOW =
|
||||
getSupportedAtom(supportedAtoms, atomCount, "_NET_ACTIVE_WINDOW");
|
||||
_glfw.x11.NET_FRAME_EXTENTS =
|
||||
|
@ -342,31 +342,15 @@ void _glfwPlatformGetMonitorWorkarea(_GLFWmonitor* monitor, int* xpos, int* ypos
|
||||
{
|
||||
if (_glfw.x11.randr.available && !_glfw.x11.randr.monitorBroken)
|
||||
{
|
||||
Atom workarea = XInternAtom(_glfw.x11.display, "_NET_WORKAREA", True);
|
||||
Atom type;
|
||||
int format;
|
||||
unsigned long num;
|
||||
unsigned long bytesLeft;
|
||||
unsigned long *workareaValues;
|
||||
unsigned char *data = NULL;
|
||||
Atom* extents = NULL;
|
||||
|
||||
if(workarea == None)
|
||||
return;
|
||||
_glfwGetWindowPropertyX11(_glfw.x11.root, _glfw.x11.NET_WORKAREA, XA_CARDINAL, (unsigned char**) &extents);
|
||||
|
||||
if (XGetWindowProperty(_glfw.x11.display, _glfw.x11.root, workarea, 0,
|
||||
4 * 32, False, AnyPropertyType, &type, &format,
|
||||
&num, &bytesLeft, &data) != Success) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(type == None || format == 0 || bytesLeft || num % 4)
|
||||
return;
|
||||
|
||||
workareaValues = (unsigned long*)data;
|
||||
*xpos = workareaValues[0];
|
||||
*ypos = workareaValues[1];
|
||||
*width = workareaValues[2];
|
||||
*height = workareaValues[3];
|
||||
*xpos = extents[0];
|
||||
*ypos = extents[1];
|
||||
*width = extents[2];
|
||||
*height = extents[3];
|
||||
XFree(extents);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -195,6 +195,7 @@ typedef struct _GLFWlibraryX11
|
||||
Atom NET_WM_STATE_MAXIMIZED_HORZ;
|
||||
Atom NET_WM_BYPASS_COMPOSITOR;
|
||||
Atom NET_WM_FULLSCREEN_MONITORS;
|
||||
Atom NET_WORKAREA;
|
||||
Atom NET_ACTIVE_WINDOW;
|
||||
Atom NET_FRAME_EXTENTS;
|
||||
Atom NET_REQUEST_FRAME_EXTENTS;
|
||||
|
Loading…
Reference in New Issue
Block a user