Skip to content

Window style layout

Finalspace edited this page May 29, 2026 · 2 revisions

Table of Contents

Reading/Setting the style

Decoration (Border, Titlebar)

By default, a window is decorated. This means that it has a border, a title bar, and can be moved by the user.

If you enable window decorations, your window will have a border and a title bar always.

Use fplIsWindowDecorated() to determine if the window has decoration enabled or not.

Use fplSetWindowDecorated() to enable/disable the window decoration.

Example:

// Enable window decoration
(true);

// Disable window decoration
(false);

// Toggle window decoration
(!());

Note: You can overwrite the default decoration behavior by changing the value in

fplWindowSettings::isDecorated from the

fplSettings::window field at startup.

Floating (Always on top)

By default, a window is not in floating mode. This means when another window gets focus, your window loses its focus.

If you set your window to floating instead, your window will always be on top of others.

Use fplIsWindowFloating() to determine if the window is floating or not.

Use fplSetWindowFloating() to enable/disable the window floating.

Example:

// Enable window floating
(true);

// Disable window floating
(false);

// Toggle window floating
(!());

Note: You can overwrite the default floating behavior by changing the value in

fplWindowSettings::isFloating from the

fplSettings::window field at startup.

Resizeable

By default, a window is resizeable. This means you can resize your window however you like.

Use fplIsWindowResizable() to determine if the window is resizable or not.

Use fplSetWindowResizeable() to enable/disable the window resizing.

Example:

// Enable resizing of the window
(true);

// Disable resizing of the window
(false);

// Toggle window resizing mode
(!());

Note: You can overwrite the default resizable behavior by changing the value in

fplWindowSettings::isResizable from the

fplSettings::window field at startup.

Getting/Changing the size/position

Window position

By default, a window uses either the default position from the platform or a fixed location of 0x0 screen units.

Use fplSetWindowPosition() to change the position of the window Use fplGetWindowPosition() to retrieve the current absolute window position from the top-left corner

Example:

// Retrieve absolute window position
 curPos;
if ((&curPos)) {
    // Do something with the window position
}

// Change window absolute position to 0x0
(0, 0);

Window size

By default, a window is created using either the default size of the platform or a fixed size of 400x400 screen units.

Use fplSetWindowSize() to change the size of the area of the window.

Use fplGetWindowSize() to get the size of the area of the window.

Example:

// Retrieve window inner/client size
 curSize;
if ((&curSize)) {
    // Do something with the client size
}

// Change window size to fit 800x600 screen units inside the client area
(800, 600);

Note: You can overwrite the default window size by changing the value in

fplWindowSettings::windowSize from the

fplSettings::window field at startup.

Changing the window size changes the total size of the window - when decorations are enabled.

Fullscreen size

By default, the window is created in non-fullscreen mode, using fplWindowSettings::windowSize from the fplSettings::window or the default window size. See Window size for more details.

Use fplSetWindowFullscreenSize() to enable/disable fullscreen for the window with a given size and a color depth with support of switching the screen-resolution if needed.

Use fplSetWindowFullscreenRect() to enable/disable fullscreen for the window with a given size and a position without changing the screen-resolution.

Use fplIsWindowFullscreen() to determine if the window is in fullscreen mode or not.

Enable fullscreen example:

// Enable fullscreen on the nearest desktop
();

// or

// Enable fullscreen on the nearest desktop
(true, 0, 0, 0);

// Enable 1080p fullscreen on the nearest desktop
(true, 1920, 1080, 0);

// Switch to 1080p screen resolution with a refresh rate of 60 Hz on the nearest desktop
(true, 1920, 1080, 60);

// Enable a 4k stretched resolution on two 1080p monitor left-right configuration
(true, 0, 0, 3840, 1080);

Disable fullscreen example:

// Disable fullscreen size
(false, 0, 0, 0);

// or

// Disable fullscreen rect
(false, 0, 0, 0, 0);

// or

// Disable fullscreen
();

Query fullscreen state:

if (()) {
    // Do something on fullscreen mode
}

// Toggle fullscreen
(!fplIsWindowFullScreen(), 0, 0, 0);

Note: Set

fplWindowSettings::isFullscreen to true to enable fullscreen at startup.

You can overwrite the fullscreen window size by changing the value in

fplWindowSettings::fullscreenSize from the

fplSettings::window field at startup.

You can overwrite the fullscreen refresh rate by changing the value in

fplWindowSettings::fullscreenRefreshRate from the

fplSettings::window field at startup.

If width or height in the

fplWindowSettings.fullscreenSize field is zero, the current desktop rectangle is used from the nearest display.

Changing the window cursor

By default, the window has cursors enabled. Use fplSetWindowCursorEnabled to show/hide the cursor.

Example:

// Enable the cursor
(true);

// Disable the cursor
(false);

Get/Set the window title

By default, the window has an unnamed title. Use fplSetWindowTitle to set a window title on runtime.

Example:

// Set window title
("My awesome application");

// Get the window title
char titleBuffer[];
(titleBuffer, (titleBuffer));

Note: You can overwrite the window title by changing the value in

fplWindowSettings::title from the

fplSettings::window field at startup.

Get/Set the window state

By default, the window has a normal default state.

Example:

// Iconify the window
();

// Maximize the window
();

// Reset to the normal when not normal
 curState = ();
if (curState != ) {
    ();
}

Note: When the window is in fullscreen mode,

fplWindowState_Fullscreen is returned from

fplGetWindowState() always.

Warning: The window state

fplWindowState_Fullscreen can never be set.

Reading/Writing the clipboard

FPL can read and write the system clipboard text.

Both functions return a boolean indicating success.

// Write text into the clipboard
("Copied from FPL");

// Read text from the clipboard
char clipboard[256];
if ((clipboard, (clipboard))) {
    ("Clipboard: %s\n", clipboard);
}

Note: fplGetClipboardText() returns false when the clipboard does not contain any text.

Querying displays/monitors

FPL can enumerate the connected displays and query their properties through the fplDisplayInfo and fplDisplayMode structures.

Enumerating displays

Use fplGetDisplayCount() to get the number of active displays, and fplGetDisplays() to fill an array of fplDisplayInfo structures.

 displays[8];
size_t displayCount = (displays, (displays));
for (size_t i = 0; i < displayCount; ++i) {
    ("Display '%s' %dx%d%s\n",
        displays[i].id,
        displays[i].physicalSize.width, displays[i].physicalSize.height,
        displays[i].isPrimary ? " (primary)" : "");
}

Querying a specific display

FPL provides several functions to retrieve a single display info:

 info;

// Get the display the window currently lives on
if ((&info)) {
    ("Window is on display '%s'\n", info.);
}

Querying display modes

Use fplGetDisplayModes() to retrieve the supported fplDisplayMode entries (size, color depth, refresh rate) for a display id.

 primary;
if ((&primary)) {
     modes[64];
    size_t modeCount = (primary., modes, (modes));
    for (size_t i = 0; i < modeCount; ++i) {
        ("%dx%d @ %d Hz, %d bpp\n",
            modes[i].width, modes[i].height,
            modes[i].refreshRate, modes[i].colorBits);
    }
}

Notes

Note: Use

fplSetDefaultWindowSettings() to initialize a

fplWindowSettings to a default state.

Final Platform Layer

Pages

Topics

Data Structures

Clone this wiki locally