mirror of
https://github.com/glfw/glfw.git
synced 2025-10-05 06:06:36 +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");
|
getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_WINDOW_TYPE");
|
||||||
_glfw.x11.NET_WM_WINDOW_TYPE_NORMAL =
|
_glfw.x11.NET_WM_WINDOW_TYPE_NORMAL =
|
||||||
getSupportedAtom(supportedAtoms, atomCount, "_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 =
|
_glfw.x11.NET_ACTIVE_WINDOW =
|
||||||
getSupportedAtom(supportedAtoms, atomCount, "_NET_ACTIVE_WINDOW");
|
getSupportedAtom(supportedAtoms, atomCount, "_NET_ACTIVE_WINDOW");
|
||||||
_glfw.x11.NET_FRAME_EXTENTS =
|
_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)
|
if (_glfw.x11.randr.available && !_glfw.x11.randr.monitorBroken)
|
||||||
{
|
{
|
||||||
Atom workarea = XInternAtom(_glfw.x11.display, "_NET_WORKAREA", True);
|
Atom* extents = NULL;
|
||||||
Atom type;
|
|
||||||
int format;
|
|
||||||
unsigned long num;
|
|
||||||
unsigned long bytesLeft;
|
|
||||||
unsigned long *workareaValues;
|
|
||||||
unsigned char *data = NULL;
|
|
||||||
|
|
||||||
if(workarea == None)
|
_glfwGetWindowPropertyX11(_glfw.x11.root, _glfw.x11.NET_WORKAREA, XA_CARDINAL, (unsigned char**) &extents);
|
||||||
return;
|
|
||||||
|
|
||||||
if (XGetWindowProperty(_glfw.x11.display, _glfw.x11.root, workarea, 0,
|
*xpos = extents[0];
|
||||||
4 * 32, False, AnyPropertyType, &type, &format,
|
*ypos = extents[1];
|
||||||
&num, &bytesLeft, &data) != Success) {
|
*width = extents[2];
|
||||||
return;
|
*height = extents[3];
|
||||||
}
|
XFree(extents);
|
||||||
|
|
||||||
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];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -195,6 +195,7 @@ typedef struct _GLFWlibraryX11
|
|||||||
Atom NET_WM_STATE_MAXIMIZED_HORZ;
|
Atom NET_WM_STATE_MAXIMIZED_HORZ;
|
||||||
Atom NET_WM_BYPASS_COMPOSITOR;
|
Atom NET_WM_BYPASS_COMPOSITOR;
|
||||||
Atom NET_WM_FULLSCREEN_MONITORS;
|
Atom NET_WM_FULLSCREEN_MONITORS;
|
||||||
|
Atom NET_WORKAREA;
|
||||||
Atom NET_ACTIVE_WINDOW;
|
Atom NET_ACTIVE_WINDOW;
|
||||||
Atom NET_FRAME_EXTENTS;
|
Atom NET_FRAME_EXTENTS;
|
||||||
Atom NET_REQUEST_FRAME_EXTENTS;
|
Atom NET_REQUEST_FRAME_EXTENTS;
|
||||||
|
Loading…
Reference in New Issue
Block a user