Decorations in fullscreen modes

How do window decorations affect fullscreen modes?

In fullscreen modes, window decorations are typically irrelevant because the window is either resized to match the screen resolution (exclusive fullscreen) or displayed borderless on top of other windows (fullscreen desktop).

SDL2 provides two fullscreen modes:

  1. Exclusive Fullscreen (SDL_WINDOW_FULLSCREEN): The window occupies the entire screen resolution, and all decorations are removed.
  2. Fullscreen Desktop (SDL_WINDOW_FULLSCREEN_DESKTOP): The window behaves as a borderless window but matches the desktop resolution.

Example of switching between fullscreen modes:

#include <SDL.h>

int main() {
  SDL_Init(SDL_INIT_VIDEO);

  SDL_Window* Window{SDL_CreateWindow(
    "Fullscreen Demo",
    SDL_WINDOWPOS_CENTERED,
    SDL_WINDOWPOS_CENTERED,
    800, 600,
    SDL_WINDOW_SHOWN 
  )};

  SDL_SetWindowFullscreen(
    Window, SDL_WINDOW_FULLSCREEN_DESKTOP); 
  
  // Display fullscreen for 3 seconds
  SDL_Delay(3000);
  
  // Restore windowed mode
  SDL_SetWindowFullscreen(Window, 0); 
  SDL_Delay(3000);

  SDL_DestroyWindow(Window);
  SDL_Quit();
}
Displays fullscreen desktop mode, then returns to windowed mode.

In fullscreen desktop mode, decorations are completely absent, and the window is effectively borderless. Exclusive fullscreen mode always removes decorations because it takes complete control of the display.

Window Decorations and Borders

An introduction to managing SDL2 window decorations, borders, and client areas.

Questions & Answers

Answers are generated by AI models and may not have been reviewed. Be mindful when running any code on your device.

Why use a borderless window?
Why would you want a borderless window in an application?
Can SDL customize border colors?
Can I change the color of the border or title bar in SDL2?
Borderless and SDL_GetWindowBordersSize()
How does SDL_GetWindowBordersSize() behave on borderless windows?
Uses of window decoration sizes
What are some practical uses for knowing the size of window decorations?
Resizable borderless windows in SDL2
Can I create a borderless window that still has a resizable frame?
Can I remove only the title bar?
Can I remove only the title bar but keep the borders?
Customizing window decorations
How can I customize window decorations in SDL2?
Or Ask your Own Question
Purchase the course to ask your own questions