mirror of
https://github.com/glfw/glfw.git
synced 2025-12-21 14:42:06 +00:00
Compare commits
3 Commits
f24dc3c85c
...
1ae6f2b377
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1ae6f2b377 | ||
|
|
0d2d85d19c | ||
|
|
54ecc8a9f5 |
@ -1778,24 +1778,6 @@ static void keyboardHandleLeave(void* userData,
|
|||||||
if (!window)
|
if (!window)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Handle any key repeats up to this point. We don't poll as this should be infrequent.
|
|
||||||
uint64_t repeats;
|
|
||||||
if (read(_glfw.wl.keyRepeatTimerfd, &repeats, sizeof(repeats)) == 8)
|
|
||||||
{
|
|
||||||
if(_glfw.wl.keyboardFocus)
|
|
||||||
{
|
|
||||||
for (uint64_t i = 0; i < repeats; i++)
|
|
||||||
{
|
|
||||||
_glfwInputKey(_glfw.wl.keyboardFocus,
|
|
||||||
translateKey(_glfw.wl.keyRepeatScancode),
|
|
||||||
_glfw.wl.keyRepeatScancode,
|
|
||||||
GLFW_PRESS,
|
|
||||||
_glfw.wl.xkb.modifiers);
|
|
||||||
inputText(_glfw.wl.keyboardFocus, _glfw.wl.keyRepeatScancode);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
struct itimerspec timer = {0};
|
struct itimerspec timer = {0};
|
||||||
timerfd_settime(_glfw.wl.keyRepeatTimerfd, 0, &timer, NULL);
|
timerfd_settime(_glfw.wl.keyRepeatTimerfd, 0, &timer, NULL);
|
||||||
|
|
||||||
|
|||||||
@ -2339,6 +2339,9 @@ void _glfwRestoreWindowX11(_GLFWwindow* window)
|
|||||||
|
|
||||||
if (_glfwWindowIconifiedX11(window))
|
if (_glfwWindowIconifiedX11(window))
|
||||||
{
|
{
|
||||||
|
// Some window managers do not unmap iconified windows, and XMapWindow is
|
||||||
|
// then no-op. Explicitly unmap the window to make sure it gets restored.
|
||||||
|
XUnmapWindow(_glfw.x11.display, window->x11.handle);
|
||||||
XMapWindow(_glfw.x11.display, window->x11.handle);
|
XMapWindow(_glfw.x11.display, window->x11.handle);
|
||||||
waitForVisibilityNotify(window);
|
waitForVisibilityNotify(window);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -56,6 +56,8 @@ static void error_callback(int error, const char* description)
|
|||||||
|
|
||||||
static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods)
|
static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods)
|
||||||
{
|
{
|
||||||
|
static GLFWwindow *iconified;
|
||||||
|
|
||||||
printf("%0.2f Key %s\n",
|
printf("%0.2f Key %s\n",
|
||||||
glfwGetTime(),
|
glfwGetTime(),
|
||||||
action == GLFW_PRESS ? "pressed" : "released");
|
action == GLFW_PRESS ? "pressed" : "released");
|
||||||
@ -67,12 +69,15 @@ static void key_callback(GLFWwindow* window, int key, int scancode, int action,
|
|||||||
{
|
{
|
||||||
case GLFW_KEY_I:
|
case GLFW_KEY_I:
|
||||||
glfwIconifyWindow(window);
|
glfwIconifyWindow(window);
|
||||||
|
iconified = window;
|
||||||
break;
|
break;
|
||||||
case GLFW_KEY_M:
|
case GLFW_KEY_M:
|
||||||
glfwMaximizeWindow(window);
|
glfwMaximizeWindow(window);
|
||||||
break;
|
break;
|
||||||
case GLFW_KEY_R:
|
case GLFW_KEY_R:
|
||||||
|
if (iconified) window = iconified;
|
||||||
glfwRestoreWindow(window);
|
glfwRestoreWindow(window);
|
||||||
|
iconified = NULL;
|
||||||
break;
|
break;
|
||||||
case GLFW_KEY_ESCAPE:
|
case GLFW_KEY_ESCAPE:
|
||||||
glfwSetWindowShouldClose(window, GLFW_TRUE);
|
glfwSetWindowShouldClose(window, GLFW_TRUE);
|
||||||
@ -253,9 +258,10 @@ int main(int argc, char** argv)
|
|||||||
if (fullscreen)
|
if (fullscreen)
|
||||||
monitor = glfwGetPrimaryMonitor();
|
monitor = glfwGetPrimaryMonitor();
|
||||||
|
|
||||||
window_count = 1;
|
window_count = 2;
|
||||||
windows = calloc(window_count, sizeof(GLFWwindow*));
|
windows = calloc(window_count, sizeof(GLFWwindow*));
|
||||||
windows[0] = create_window(monitor);
|
windows[0] = create_window(monitor);
|
||||||
|
windows[1] = create_window(monitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < window_count; i++)
|
for (i = 0; i < window_count; i++)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user