Set window focus

afalkenhahn wrote on Sunday, February 16, 2014:


is it possible to programmatically activate a GLFW window? Suppose I have four different GLFW windows and now I’d like to make one of them the active window… is that possible somehow? I can listen to focus changes but I don’t seem to be able to set focus programmatically. Maybe we’d need something like glfwSetWindowFocus()…

xdread wrote on Thursday, March 06, 2014:

I think you can use glfw3native and then one of these functions to obtain a window handle to set focus:

Just define two macros like described in this document before including the header file:

EDIT: It is worth mentioning that this is platform specific, so you need to make the platform independence yourself in this case.

divxdede wrote on Friday, January 02, 2015:

It would be nice to have a glfwFocusWindow like we have with glfwIconifyWindow
I can’t use native since i use a wrapper that don’t expose it to me…

Window focusing has been added and will be included in 3.2.