mirror of
https://github.com/glfw/glfw.git
synced 2025-10-05 06:06:36 +00:00
Update attention request on X11 and update example
The macro ```_NET_WM_STATE_ADD``` is passed to ```xev.xclient.data.l[0]```, instead of a constant `1`. The example ```simple.c``` was update to make a attention request every 10 seconds.
This commit is contained in:
parent
301a84c4f5
commit
aaebcc5141
@ -79,6 +79,7 @@ int main(void)
|
|||||||
GLFWwindow* window;
|
GLFWwindow* window;
|
||||||
GLuint vertex_buffer, vertex_shader, fragment_shader, program;
|
GLuint vertex_buffer, vertex_shader, fragment_shader, program;
|
||||||
GLint mvp_location, vpos_location, vcol_location;
|
GLint mvp_location, vpos_location, vcol_location;
|
||||||
|
double start;
|
||||||
|
|
||||||
glfwSetErrorCallback(error_callback);
|
glfwSetErrorCallback(error_callback);
|
||||||
|
|
||||||
@ -131,12 +132,18 @@ int main(void)
|
|||||||
glVertexAttribPointer(vcol_location, 3, GL_FLOAT, GL_FALSE,
|
glVertexAttribPointer(vcol_location, 3, GL_FLOAT, GL_FALSE,
|
||||||
sizeof(vertices[0]), (void*) (sizeof(float) * 2));
|
sizeof(vertices[0]), (void*) (sizeof(float) * 2));
|
||||||
|
|
||||||
|
start = glfwGetTime();
|
||||||
while (!glfwWindowShouldClose(window))
|
while (!glfwWindowShouldClose(window))
|
||||||
{
|
{
|
||||||
float ratio;
|
float ratio;
|
||||||
int width, height;
|
int width, height;
|
||||||
mat4x4 m, p, mvp;
|
mat4x4 m, p, mvp;
|
||||||
|
|
||||||
|
if (glfwGetTime() - start > 10.0) {
|
||||||
|
glfwRequestWindowAttention(window);
|
||||||
|
start = glfwGetTime();
|
||||||
|
}
|
||||||
|
|
||||||
glfwGetFramebufferSize(window, &width, &height);
|
glfwGetFramebufferSize(window, &width, &height);
|
||||||
ratio = width / (float) height;
|
ratio = width / (float) height;
|
||||||
|
|
||||||
|
@ -172,6 +172,11 @@ void _glfwPlatformShowWindow(_GLFWwindow* window)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void _glfwPlatformRequestWindowAttention(_GLFWwindow* window)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
void _glfwPlatformUnhideWindow(_GLFWwindow* window)
|
void _glfwPlatformUnhideWindow(_GLFWwindow* window)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -2084,7 +2084,7 @@ void _glfwPlatformRequestWindowAttention(_GLFWwindow* window)
|
|||||||
xev.xclient.window = window->x11.handle;
|
xev.xclient.window = window->x11.handle;
|
||||||
xev.xclient.message_type = wm_state;
|
xev.xclient.message_type = wm_state;
|
||||||
xev.xclient.format = 32;
|
xev.xclient.format = 32;
|
||||||
xev.xclient.data.l[0] = 1; /* _NET_WM_STATE_ADD */
|
xev.xclient.data.l[0] = _NET_WM_STATE_ADD;
|
||||||
xev.xclient.data.l[1] = wm_attention;
|
xev.xclient.data.l[1] = wm_attention;
|
||||||
|
|
||||||
XSendEvent(_glfw.x11.display, DefaultRootWindow(_glfw.x11.display), False, SubstructureRedirectMask | SubstructureNotifyMask, &xev);
|
XSendEvent(_glfw.x11.display, DefaultRootWindow(_glfw.x11.display), False, SubstructureRedirectMask | SubstructureNotifyMask, &xev);
|
||||||
|
Loading…
Reference in New Issue
Block a user