GLFW in a Nutshell
  • About GLFW
  • Preparation
    • Project Setup
    • Library Setup
  • Windows
    • Window Basics
    • Properties
    • Actions
    • Creation Hints
    • Attributes
    • (Windowed) Fullscreen
    • Callbacks
    • Icons
  • Contexts
    • Context Basics
    • OpenGL (ES)
    • Vulkan
  • Input
    • Keyboard
    • Mouse
    • Joystick/Gamepad
    • Other
  • Monitors
    • Monitor Basics
    • Video Modes
    • Multiple Monitors
  • Appendix
    • Credits
    • Licensing
    • Glossary
Powered by GitBook
On this page
  • Visibility
  • Closing
  • Iconification
  • Maximization
  • Restoration
  • Input Focus
  • Attention Request

Was this helpful?

  1. Windows

Actions

Controlling GLFW windows

PreviousPropertiesNextCreation Hints

Last updated 5 years ago

Was this helpful?

Visibility

Windowed-mode windows can be hidden with glfwHideWindow(window) and shown with glfwShowWindow(window). It is also possible to retrieve whether a window is visible, using the GLFW_VISIBLE . By default, windows become visible instantly after ; this behavior can be changed using the GLFW_VISIBLE . Showing a window, by default causes it to gain input focus, which may be changed using the GÖFW_FOCUS_ON_SHOW window hint.

Closing

Closing the window from within the program can be done by calling glfwSetWindowShouldClose(window,value), with value being one of GLFW_TRUE or GLFW_FALSE. This flag may also be set by the user clicking the close widget or using a key chord like ALT+F4. Checking whether the close flag has been set can be done with glfwWindowShouldClose(window); this information can be used, for example, to determine whether to run the game loop or exit the application; a closed window doesn't require its . It is possible to to get notified when the close flag is set.

Iconification

Windows can be minimized (aka. iconified) to the taskbar with glfwIconifyWindow(window). This can be reversed by . It is possible to retrieve whether a window is iconified, using the GLFW_ICONIFIED . It is possible to to get notified when a window is iconified or restored.

Maximization

Windowed-mode windows can be maximized with glfwMaximizeWindow(window). This can be reversed by . It is possible to retrieve whether a window is maximized, using the GLFW_MAXIMIZED . Windows can be set to immediately maximize after creation using the GÖFW_MAXIMIZED . It is possible to to get notified when a window is maximized or restored.

Restoration

Iconified or maximized windows may be restored with glfwRestoreWindow(window).

Input Focus

Attention Request

Requesting input focus can be quite disruptive. It often is wiser to send an attention request with glfwRequestWindowAttention(window) instead, to notify the user of an event. An attention request results in the window icon flashing in the taskbar (Windows) or jumping (macOS).

A window can be given input focus and brought to the front with glfwFocusWindow(window). It is also possible to retrieve whether a window has input focus, using the GLFW_FOCUSED . It is possible to to get notified when a window gains or loses input focus.

attribute
creation
creation hint
buffers to be swapped
set up a callback
restoring the window
attribute
set up a callback
restoring the window
attribute
creation hint
set up a callback
attribute
set up a callback