mirror of
https://github.com/glfw/glfw.git
synced 2024-11-26 06:14:35 +00:00
Renamed WM atom struct members for clarity.
This commit is contained in:
parent
ca07a067a8
commit
e820284015
@ -440,22 +440,22 @@ static void detectEWMH(void)
|
|||||||
|
|
||||||
// See which of the atoms we support that are supported by the WM
|
// See which of the atoms we support that are supported by the WM
|
||||||
|
|
||||||
_glfw.x11.wmState =
|
_glfw.x11.NET_WM_STATE =
|
||||||
getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_STATE");
|
getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_STATE");
|
||||||
|
|
||||||
_glfw.x11.wmStateFullscreen =
|
_glfw.x11.NET_WM_STATE_FULLSCREEN =
|
||||||
getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_STATE_FULLSCREEN");
|
getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_STATE_FULLSCREEN");
|
||||||
|
|
||||||
_glfw.x11.wmName =
|
_glfw.x11.NET_WM_NAME =
|
||||||
getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_NAME");
|
getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_NAME");
|
||||||
|
|
||||||
_glfw.x11.wmIconName =
|
_glfw.x11.NET_WM_ICON_NAME =
|
||||||
getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_ICON_NAME");
|
getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_ICON_NAME");
|
||||||
|
|
||||||
_glfw.x11.wmPing =
|
_glfw.x11.NET_WM_PING =
|
||||||
getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_PING");
|
getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_PING");
|
||||||
|
|
||||||
_glfw.x11.wmActiveWindow =
|
_glfw.x11.NET_ACTIVE_WINDOW =
|
||||||
getSupportedAtom(supportedAtoms, atomCount, "_NET_ACTIVE_WINDOW");
|
getSupportedAtom(supportedAtoms, atomCount, "_NET_ACTIVE_WINDOW");
|
||||||
|
|
||||||
XFree(supportedAtoms);
|
XFree(supportedAtoms);
|
||||||
@ -485,7 +485,7 @@ static GLboolean initDisplay(void)
|
|||||||
_glfw.x11.root = RootWindow(_glfw.x11.display, _glfw.x11.screen);
|
_glfw.x11.root = RootWindow(_glfw.x11.display, _glfw.x11.screen);
|
||||||
|
|
||||||
// Find or create the protocol atom for window close notifications
|
// Find or create the protocol atom for window close notifications
|
||||||
_glfw.x11.wmDeleteWindow = XInternAtom(_glfw.x11.display,
|
_glfw.x11.WM_DELETE_WINDOW = XInternAtom(_glfw.x11.display,
|
||||||
"WM_DELETE_WINDOW",
|
"WM_DELETE_WINDOW",
|
||||||
False);
|
False);
|
||||||
|
|
||||||
|
@ -122,13 +122,14 @@ typedef struct _GLFWlibraryX11
|
|||||||
// Invisible cursor for hidden cursor mode
|
// Invisible cursor for hidden cursor mode
|
||||||
Cursor cursor;
|
Cursor cursor;
|
||||||
|
|
||||||
Atom wmDeleteWindow; // WM_DELETE_WINDOW atom
|
// Window manager atoms
|
||||||
Atom wmName; // _NET_WM_NAME atom
|
Atom WM_DELETE_WINDOW;
|
||||||
Atom wmIconName; // _NET_WM_ICON_NAME atom
|
Atom NET_WM_NAME;
|
||||||
Atom wmPing; // _NET_WM_PING atom
|
Atom NET_WM_ICON_NAME;
|
||||||
Atom wmState; // _NET_WM_STATE atom
|
Atom NET_WM_PING;
|
||||||
Atom wmStateFullscreen; // _NET_WM_STATE_FULLSCREEN atom
|
Atom NET_WM_STATE;
|
||||||
Atom wmActiveWindow; // _NET_ACTIVE_WINDOW atom
|
Atom NET_WM_STATE_FULLSCREEN;
|
||||||
|
Atom NET_ACTIVE_WINDOW;
|
||||||
|
|
||||||
// True if window manager supports EWMH
|
// True if window manager supports EWMH
|
||||||
GLboolean hasEWMH;
|
GLboolean hasEWMH;
|
||||||
|
@ -171,14 +171,14 @@ static GLboolean createWindow(_GLFWwindow* window,
|
|||||||
|
|
||||||
// The WM_DELETE_WINDOW ICCCM protocol
|
// The WM_DELETE_WINDOW ICCCM protocol
|
||||||
// Basic window close notification protocol
|
// Basic window close notification protocol
|
||||||
if (_glfw.x11.wmDeleteWindow != None)
|
if (_glfw.x11.WM_DELETE_WINDOW != None)
|
||||||
protocols[count++] = _glfw.x11.wmDeleteWindow;
|
protocols[count++] = _glfw.x11.WM_DELETE_WINDOW;
|
||||||
|
|
||||||
// The _NET_WM_PING EWMH protocol
|
// The _NET_WM_PING EWMH protocol
|
||||||
// Tells the WM to ping the GLFW window and flag the application as
|
// Tells the WM to ping the GLFW window and flag the application as
|
||||||
// unresponsive if the WM doesn't get a reply within a few seconds
|
// unresponsive if the WM doesn't get a reply within a few seconds
|
||||||
if (_glfw.x11.wmPing != None)
|
if (_glfw.x11.NET_WM_PING != None)
|
||||||
protocols[count++] = _glfw.x11.wmPing;
|
protocols[count++] = _glfw.x11.NET_WM_PING;
|
||||||
|
|
||||||
if (count > 0)
|
if (count > 0)
|
||||||
{
|
{
|
||||||
@ -335,10 +335,10 @@ static void enterFullscreenMode(_GLFWwindow* window)
|
|||||||
_glfwSetVideoMode(window->monitor, &window->width, &window->height);
|
_glfwSetVideoMode(window->monitor, &window->width, &window->height);
|
||||||
|
|
||||||
if (_glfw.x11.hasEWMH &&
|
if (_glfw.x11.hasEWMH &&
|
||||||
_glfw.x11.wmState != None &&
|
_glfw.x11.NET_WM_STATE != None &&
|
||||||
_glfw.x11.wmStateFullscreen != None)
|
_glfw.x11.NET_WM_STATE_FULLSCREEN != None)
|
||||||
{
|
{
|
||||||
if (_glfw.x11.wmActiveWindow != None)
|
if (_glfw.x11.NET_ACTIVE_WINDOW != None)
|
||||||
{
|
{
|
||||||
// Ask the window manager to raise and focus the GLFW window
|
// Ask the window manager to raise and focus the GLFW window
|
||||||
// Only focused windows with the _NET_WM_STATE_FULLSCREEN state end
|
// Only focused windows with the _NET_WM_STATE_FULLSCREEN state end
|
||||||
@ -350,7 +350,7 @@ static void enterFullscreenMode(_GLFWwindow* window)
|
|||||||
event.type = ClientMessage;
|
event.type = ClientMessage;
|
||||||
event.xclient.window = window->x11.handle;
|
event.xclient.window = window->x11.handle;
|
||||||
event.xclient.format = 32; // Data is 32-bit longs
|
event.xclient.format = 32; // Data is 32-bit longs
|
||||||
event.xclient.message_type = _glfw.x11.wmActiveWindow;
|
event.xclient.message_type = _glfw.x11.NET_ACTIVE_WINDOW;
|
||||||
event.xclient.data.l[0] = 1; // Sender is a normal application
|
event.xclient.data.l[0] = 1; // Sender is a normal application
|
||||||
event.xclient.data.l[1] = 0; // We don't really know the timestamp
|
event.xclient.data.l[1] = 0; // We don't really know the timestamp
|
||||||
|
|
||||||
@ -371,9 +371,9 @@ static void enterFullscreenMode(_GLFWwindow* window)
|
|||||||
event.type = ClientMessage;
|
event.type = ClientMessage;
|
||||||
event.xclient.window = window->x11.handle;
|
event.xclient.window = window->x11.handle;
|
||||||
event.xclient.format = 32; // Data is 32-bit longs
|
event.xclient.format = 32; // Data is 32-bit longs
|
||||||
event.xclient.message_type = _glfw.x11.wmState;
|
event.xclient.message_type = _glfw.x11.NET_WM_STATE;
|
||||||
event.xclient.data.l[0] = _NET_WM_STATE_ADD;
|
event.xclient.data.l[0] = _NET_WM_STATE_ADD;
|
||||||
event.xclient.data.l[1] = _glfw.x11.wmStateFullscreen;
|
event.xclient.data.l[1] = _glfw.x11.NET_WM_STATE_FULLSCREEN;
|
||||||
event.xclient.data.l[2] = 0; // No secondary property
|
event.xclient.data.l[2] = 0; // No secondary property
|
||||||
event.xclient.data.l[3] = 1; // Sender is a normal application
|
event.xclient.data.l[3] = 1; // Sender is a normal application
|
||||||
|
|
||||||
@ -419,8 +419,8 @@ static void leaveFullscreenMode(_GLFWwindow* window)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (_glfw.x11.hasEWMH &&
|
if (_glfw.x11.hasEWMH &&
|
||||||
_glfw.x11.wmState != None &&
|
_glfw.x11.NET_WM_STATE != None &&
|
||||||
_glfw.x11.wmStateFullscreen != None)
|
_glfw.x11.NET_WM_STATE_FULLSCREEN != None)
|
||||||
{
|
{
|
||||||
// Ask the window manager to make the GLFW window a normal window
|
// Ask the window manager to make the GLFW window a normal window
|
||||||
// Normal windows usually have frames and other decorations
|
// Normal windows usually have frames and other decorations
|
||||||
@ -431,9 +431,9 @@ static void leaveFullscreenMode(_GLFWwindow* window)
|
|||||||
event.type = ClientMessage;
|
event.type = ClientMessage;
|
||||||
event.xclient.window = window->x11.handle;
|
event.xclient.window = window->x11.handle;
|
||||||
event.xclient.format = 32; // Data is 32-bit longs
|
event.xclient.format = 32; // Data is 32-bit longs
|
||||||
event.xclient.message_type = _glfw.x11.wmState;
|
event.xclient.message_type = _glfw.x11.NET_WM_STATE;
|
||||||
event.xclient.data.l[0] = _NET_WM_STATE_REMOVE;
|
event.xclient.data.l[0] = _NET_WM_STATE_REMOVE;
|
||||||
event.xclient.data.l[1] = _glfw.x11.wmStateFullscreen;
|
event.xclient.data.l[1] = _glfw.x11.NET_WM_STATE_FULLSCREEN;
|
||||||
event.xclient.data.l[2] = 0; // No secondary property
|
event.xclient.data.l[2] = 0; // No secondary property
|
||||||
event.xclient.data.l[3] = 1; // Sender is a normal application
|
event.xclient.data.l[3] = 1; // Sender is a normal application
|
||||||
|
|
||||||
@ -635,15 +635,15 @@ static void processEvent(XEvent *event)
|
|||||||
if (window == NULL)
|
if (window == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ((Atom) event->xclient.data.l[0] == _glfw.x11.wmDeleteWindow)
|
if ((Atom) event->xclient.data.l[0] == _glfw.x11.WM_DELETE_WINDOW)
|
||||||
{
|
{
|
||||||
// The window manager was asked to close the window, for example by
|
// The window manager was asked to close the window, for example by
|
||||||
// the user pressing a 'close' window decoration button
|
// the user pressing a 'close' window decoration button
|
||||||
|
|
||||||
_glfwInputWindowCloseRequest(window);
|
_glfwInputWindowCloseRequest(window);
|
||||||
}
|
}
|
||||||
else if (_glfw.x11.wmPing != None &&
|
else if (_glfw.x11.NET_WM_PING != None &&
|
||||||
(Atom) event->xclient.data.l[0] == _glfw.x11.wmPing)
|
(Atom) event->xclient.data.l[0] == _glfw.x11.NET_WM_PING)
|
||||||
{
|
{
|
||||||
// The window manager is pinging the application to ensure it's
|
// The window manager is pinging the application to ensure it's
|
||||||
// still responding to events
|
// still responding to events
|
||||||
@ -884,18 +884,18 @@ void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char* title)
|
|||||||
NULL, NULL, NULL);
|
NULL, NULL, NULL);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (_glfw.x11.wmName != None)
|
if (_glfw.x11.NET_WM_NAME != None)
|
||||||
{
|
{
|
||||||
XChangeProperty(_glfw.x11.display, window->x11.handle,
|
XChangeProperty(_glfw.x11.display, window->x11.handle,
|
||||||
_glfw.x11.wmName, type, 8,
|
_glfw.x11.NET_WM_NAME, type, 8,
|
||||||
PropModeReplace,
|
PropModeReplace,
|
||||||
(unsigned char*) title, strlen(title));
|
(unsigned char*) title, strlen(title));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_glfw.x11.wmIconName != None)
|
if (_glfw.x11.NET_WM_ICON_NAME != None)
|
||||||
{
|
{
|
||||||
XChangeProperty(_glfw.x11.display, window->x11.handle,
|
XChangeProperty(_glfw.x11.display, window->x11.handle,
|
||||||
_glfw.x11.wmIconName, type, 8,
|
_glfw.x11.NET_WM_ICON_NAME, type, 8,
|
||||||
PropModeReplace,
|
PropModeReplace,
|
||||||
(unsigned char*) title, strlen(title));
|
(unsigned char*) title, strlen(title));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user