-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Open
Labels
WindowsWin32 specific (not Cygwin or WSL)Win32 specific (not Cygwin or WSL)bugBug reports and bugfix pull requestsBug reports and bugfix pull requestscannot reproduceBugs that have failed verificationBugs that have failed verification
Description
I have encountered the following issue using LWJGL 3.3.6 (the latest stable version) on Windows 10:
When I create a GLFW window while dragging another window, GLFW thinks the window is focused, even though it's not.
Both glfwGetWindowAttrib
and windowFocusCallback
return the wrong value
2025-08-12.01-40-57.mp4
The code
import static org.lwjgl.glfw.GLFW.*;
public class Test2 {
public static long handle;
public static void main(String[] args) {
try {
Thread.sleep(500);
}catch (Exception e) {}
glfwInit();
glfwDefaultWindowHints();
glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE);
handle = glfwCreateWindow(640, 480, "Test", 0, 0);
glfwSetWindowFocusCallback(handle, Test2::focusCallback);
glfwShowWindow(handle);
while(true) {
glfwPollEvents();
if(glfwWindowShouldClose(handle)) {
break;
}
glfwSetWindowTitle(handle, "Focused: " + isFocused());
try {
Thread.sleep(10);
}catch (Exception e) {}
}
}
public static boolean isFocused() {
return glfwGetWindowAttrib(handle, GLFW_FOCUSED) != 0;
}
public static void focusCallback(long window, boolean focused) {
System.out.println("Focus changed: " + focused);
}
}
Metadata
Metadata
Assignees
Labels
WindowsWin32 specific (not Cygwin or WSL)Win32 specific (not Cygwin or WSL)bugBug reports and bugfix pull requestsBug reports and bugfix pull requestscannot reproduceBugs that have failed verificationBugs that have failed verification