GLFW Window Focus Fix - #8530
Conversation
|
Ideally this should be a windowResized event in coreEvents, &ofBaseApp::windowFocusChanged... however I think for complexity it's easier for the moment to just add it as a ofEvent windowFocusChanged where opt in is: easy |
|
Added ofEvent windowFocusChanged; to ofEvents |
2a5fdee to
9768350
Compare
|
@ofTheo is ofEvent good idea for now vs change core events virtual function etc... I think this is good to merge |
|
Thanks @danoli3 I'm not using this anymore in my day to day use. I removed some code that counted frames since state change and others simplifications. but there is api change there so near zero change of being pulled to OF main :/ Other two niceties there is ofWindowSettings is only one object for all kinds of windows (I think it is best) and also we can choose to span one same window to multiple monitors (poor's man Nvidia Mosaic) but I think it is very useful to span 4 outputs in one single window, as I do often. |
|
I'm going to put this in for now as Focus / pause event quite useful in general for apps for power usage |
ofxGLFWWindow Focus
bWindowFocusedmember toofAppGLFWWindowfocus_cbstatic callback (matchesGLFWfocusfun), registered withglfwSetWindowFocusCallbackalongside the other window callbacks insetup()glfwGetWindowAttrib(windowP, GLFW_FOCUSED)rightafter registration, since a window isn't guaranteed to start focused
close()for symmetry with the other teardown callsisWindowActive()now returnsbWindowFocusedinstead of the stubofAppGLFWWindow::isWindowActive()
was hardcoded toreturn true`, so window now can be detected if active or not active... useful for backgrounding apps running machines, so you can now actively pause or sleep draw or update