GUI framework, controls, and window management
Kodi's guilib turns skin rules and live application data into interactive screens. It gives each screen a control tree, routes input and GUI messages through that tree, and coordinates focus, layout, resources, updates, and drawing with the application shell. See the user interface shell page for the larger product flow that uses this framework.
GUI screen model
Windows and dialogs
A window is the top-level control tree for a Kodi screen. A dialog is a window shown above the active screen and can be modal when it must receive input before the screen below it. The window manager keeps the registered windows and the active dialog stack, so screen code can request activation or closure without drawing the whole stack itself. CGUIWindow also owns screen state such as the skin file, coordinate space, default focus, animations, and close behavior.
Window definitions describe the screen's visual and interaction rules. The framework resolves the selected skin and its conditions, creates the control tree, and then lets the window update and draw that tree. The same window can keep its resources, load them when needed, or load them again for a later display. If a skin does not provide the window file, loading fails and the window remains available for a later retry; the failed load does not replace the window's registered identity.
Window IDs provide the shared identity used to register, activate, and query windows. The ID space separates normal screens, dialogs, playback views, games, skin-owned windows, and extension-owned windows, so code can refer to a screen without depending on its skin file name. The manager also resolves the virtual start window through the active skin and refuses a normal screen switch while a modal dialog blocks it, unless the switch is forced.
References: xbmc/…/GUIWindow.h• L53-140 xbmc/…/GUIWindow.cpp• L71-174 xbmc/…/GUIWindowManager.cpp• L841-967 xbmc/…/GUIWindowManager.h• L49-81 xbmc/…/WindowIDs.h• L14-25 xbmc/…/WindowIDs.h• L102-168 xbmc/…/WindowIDs.h• L201-215
Control hierarchy
A control is a visual or interactive part of a screen. CGUIControl supplies the shared contract for position, size, visibility, focus, input, messages, animation, resource use, update, and render work. A control group extends that contract with child controls, so a window is a group and groups can contain nested groups or specialized controls.
The hierarchy gives the framework a common way to apply state. A parent can find a child by ID, pass focus into a nested group, process children, and render them in order. Groups maintain an inherited ID lookup for their descendants, which lets targeted messages reach the right visible control. When a subtree is removed, cleared, cloned, or attached to a new parent, that lookup must follow the live tree rather than the old ownership history.
Specialized controls add behavior for buttons, labels, images, lists, sliders, text entry, spin values, visualisations, and other screen features without changing how the window manager treats the tree. List item layouts are also temporary control trees: they can expose nested controls while an item is shown, then release those controls when the item is reset or its memory is freed. Static items provide a related data path for skin-defined entries: they resolve labels, artwork, properties, visibility conditions, and click actions, then refresh the values that depend on current GUI state.
References: xbmc/…/GUIControl.h• L79-110 xbmc/…/GUIControl.h• L164-231 xbmc/…/GUIControlGroup.h• L20-81 xbmc/…/GUIControlGroup.cpp• L491-565 xbmc/…/GUIControlLookup.cpp• L11-115 xbmc/…/GUIStaticItem.cpp• L22-65 xbmc/…/GUIStaticItem.cpp• L82-127 xbmc/…/GUIListItem.cpp• L311-359 xbmc/…/TestGUIListItemLayout.cpp• L127-250
Skin control construction
The control factory is the boundary between a skin's screen description and the runtime control tree. It maps a control type to a control object and reads the shared screen data that controls need, such as position, dimensions, labels, textures, colors, visibility rules, animations, and actions.
CGUIWindow uses this boundary while it loads a window. It creates each top-level control and then recursively creates controls inside groups. This keeps the skin concerned with screen intent while the runtime tree provides focus, input, update, and render behavior. The factory also defines the shared rules for skin geometry, labels, conditional visibility, actions, textures, aspect rules, and motion values, so a malformed skin value can fail without creating an invalid control state.
References: xbmc/…/GUIControlFactory.h• L40-82 xbmc/…/GUIControlFactory.h• L96-129 xbmc/…/GUIControlFactory.cpp• L75-112 xbmc/…/GUIControlFactory.cpp• L222-356 xbmc/…/GUIControlFactory.cpp• L412-456 xbmc/…/GUIControlFactory.cpp• L818-1000 xbmc/…/TestGUIControlFactory.cpp• L672-975
Input and message routing
Action routing
An action is a user intent such as moving focus, selecting an item, going back, or performing a gesture. The window manager first gives the action to the active dialog stack. A topmost modal dialog normally owns the action; if no dialog handles it, the active window receives it. This order prevents a screen behind a modal dialog from reacting to input that belongs to the dialog.
Inside a window, the focused control gets the first chance to handle control-specific behavior. If it does not handle the action, the window walks through its parent controls before applying window-level behavior. This walk is safe when an action rebuilds the control tree: the window stops propagation if the old controls were destroyed. A window only restores focus for a control that cannot accept focus after the window has entered its active lifecycle, so an asynchronously loaded window does not request focus before initialization.
Touch gestures add a short transition boundary during a window switch. While gesture input is inhibited, the manager consumes gesture events instead of allowing the new screen to act on a gesture that began on the old screen. A closing modal dialog also consumes input until its close animation ends. One full-screen information dialog is an explicit exception that can let an unhandled action reach the active window.
A CGUIAction attached to a control or window can also run conditional commands or define a navigation target. The following diagram shows the normal path from input to a screen result.
flowchart TD
Input[User input] --> WM[GUI window manager]
WM --> Gesture{Gesture transition active?}
Gesture -->|Yes| Swallow[Consume gesture]
Gesture -->|No| Dialog{Active modal dialog?}
Dialog -->|Yes| D[Topmost dialog]
Dialog -->|No| W[Active window]
D -->|Handled| Result[Screen state changes]
D -->|Not handled| Boundary[Modal boundary or full-screen exception]
Boundary -->|Blocked| Result
Boundary -->|Falls through| W
W --> Focus[Focused control]
Focus -->|Handled| Result
Focus -->|Not handled| Parent[Parent controls]
Parent -->|Handled| Result
Parent -->|Not handled| WindowAction[Window action handling]
WindowAction -->|Handled| Result
WindowAction -->|Not handled| Global[Application or other global handler]
Global --> Result
Swallow --> Result
References: xbmc/…/GUIWindowManager.cpp• L1205-1272 xbmc/…/GUIWindow.cpp• L330-349 xbmc/…/GUIWindow.cpp• L426-463 xbmc/…/GUIWindow.h• L91-103 xbmc/…/GUIControl.h• L103-110 xbmc/…/GUIAction.h• L18-25
GUI message routing
A GUI message is a structured notification or request that carries a message ID, sender ID, target control ID, numeric parameters, optional text, and optional item data. Messages support state changes and screen coordination that do not fit the meaning of a user action, such as focus changes, label updates, list refreshes, window lifecycle events, and renderer reset notices.
The window manager sends ordinary messages to active modeless dialogs, then to the topmost message-accepting modal dialog, and then to the active window under the modal rules. A broadcast notification reaches active modal dialogs and all windows. Before a click message is sent, the manager checks the target control's core enabled state and blocks a click on a disabled control. Within a control group, a message with no target is offered to all children, while a targeted message is looked up and sent to the matching control. Groups also forward selected refresh and resize messages to their children.
References: xbmc/…/GUIMessage.h• L23-73 xbmc/…/GUIMessageIDs.h• L11-43 xbmc/…/GUIWindowManager.cpp• L174-191 xbmc/…/GUIWindowManager.cpp• L547-639 xbmc/…/GUIControlGroup.cpp• L162-290 xbmc/…/GUIControlLookup.cpp• L17-39
Keyboard input
Keyboard input provides a GUI dialog service for text, password, and filter entry. It selects the normal Kodi keyboard or a platform keyboard according to the platform and user settings, then returns whether the entry was accepted. On supported Android and WASM builds, the input.useapplicationkeyboard setting selects the platform keyboard path instead of Kodi's keyboard dialog.
The service connects typed text to the active screen through GUI messages. Search entry sends updates to the active window, while current-list filtering broadcasts filter updates. Password flows hide input and can verify a repeated entry before returning the accepted value. Empty text is accepted only when the caller allows it, so screens do not need to manage keyboard dialogs themselves.
References: xbmc/…/GUIKeyboardFactory.cpp• L43-73 xbmc/…/GUIKeyboardFactory.cpp• L77-126 xbmc/…/GUIKeyboardFactory.cpp• L151-189 xbmc/…/GUIKeyboardFactory.cpp• L95-110
Focus and navigation
Focus identifies the control that should receive directional input and selection. Groups remember focused children and can restore the last focus, use a default control, or choose the first focusable child when a screen starts. Focus messages move through the hierarchy so each parent can update its own focused-child state.
Navigation is part of the screen contract rather than a separate input system. Controls can map directional actions to another control or let containers choose the next visible item. Visibility and enabled state can remove a control from focus, so the window falls back to a valid default when the current control can no longer receive focus. That recovery applies after window initialization, when the control tree and its initial state are ready.
References: xbmc/…/GUIControlGroup.cpp• L184-237 xbmc/…/GUIControl.h• L169-175 xbmc/…/GUIControl.h• L200-224 xbmc/…/GUIWindow.cpp• L330-349
Layout and screen geometry
Coordinate and transform model
The framework lets a skin describe a screen in a chosen coordinate space instead of tying every control to the physical display size. A window selects the skin resolution and applies scaling and transforms while it processes and renders its controls. This lets the same screen adapt to different display sizes and aspect ratios.
Each control calculates a render region during processing. Visibility, animation, camera use, stereo depth, and parent transforms affect that region and the later draw. The render region also tells the redraw system which part of the screen may need new pixels.
References: xbmc/…/GUIWindow.cpp• L177-192 xbmc/…/GUIWindow.cpp• L330-363 xbmc/…/GUIControl.cpp• L120-182 xbmc/…/GUIControl.cpp• L184-226
Group and container layouts
A group lays out a fixed tree of child controls. A list group adds a scrollable, ordered arrangement with an orientation, item gap, alignment, page control, and focus movement. It keeps the scroll offset inside the content bounds and keeps the focused child visible as focus or page position changes.
List groups use visible child size to calculate their content area. Page navigation uses the number of fully visible item slots after the screen range and transforms are applied, while rendering can still include partially visible items. The focused layout counts at its own size, so a larger selected item does not make page actions move by the wrong amount. The page size is recalculated when the visible range or focused position changes, and the container reports the resulting range to a linked page control.
Panel containers arrange items in rows and columns. Their page size follows the available panel space and the current item layout, while the selected item stays selected when a layout change alters the number of items in each row. The focused item is rendered after other visible items so a selected item can overlap its neighbors without being hidden. Pointer selection, directional movement, page movement, and analog scrolling all use the same row, column, and scroll state.
List containers separate the list's data from its item presentation. An item layout describes how one item appears, while a focused layout describes its selected form. A list provider supplies or refreshes the data, and the container preserves the selected item when it can identify it again. Directory-backed providers can load and sort entries in the background, add artwork and visibility rules, and invalidate the list when library, player, add-on, favourites, or PVR state changes. Each CGUIListItem carries the labels, artwork, flags, properties, selection state, and position that its layouts present. Changes to that item data invalidate both normal and focused presentations.
Static skin items follow the same separation: their current labels and artwork come from GUI information values, while their visibility and click actions remain part of the item definition. The container processes and renders the layouts for visible items, so a skin can change the visual form of a focused item without changing the list's data flow.
The fixed list variant keeps focus near a configured position while the list moves around it. Near the first and last items, its allowed focus range changes according to the selected alignment. Page-control changes move the selected item by the difference between the new and previous page offsets, which preserves the selected item's position at either list boundary.
List containers can move by page, directional input, mouse wheel, analog input, or touch pan. They update a linked page control when the content size or scroll position changes. Directional navigation follows the list orientation, while a skin can still provide explicit navigation actions that must not be replaced.
The control hierarchy remains separate from item data while a list changes. Resetting or freeing an item releases its temporary layouts without removing the list container or its ancestors from their own control lookup. A reset can keep an item's layouts alive so a re-fetched item keeps animation state; the container later releases those layouts when it is destroyed. This allows list contents to refresh without leaving stale descendants in the surrounding screen tree.
References: xbmc/…/GUIControlGroup.h• L33-70 xbmc/…/GUIControlGroupList.h• L20-63 xbmc/…/GUIControlGroupList.cpp• L60-129 xbmc/…/GUIBaseContainer.h• L72-154 xbmc/…/GUIBaseContainer.cpp• L175-244 xbmc/…/GUIBaseContainer.cpp• L1140-1198 xbmc/…/GUIBaseContainer.cpp• L1201-1228 xbmc/…/GUIBaseContainer.cpp• L1367-1407 xbmc/…/GUIListItem.h• L59-190 xbmc/…/GUIListItem.cpp• L88-145 xbmc/…/GUIListItem.cpp• L311-359 xbmc/…/GUIListItemLayout.cpp• L64-97 xbmc/…/DirectoryProvider.cpp• L222-371 xbmc/…/DirectoryProvider.cpp• L447-509 xbmc/…/DirectoryProvider.cpp• L607-679 xbmc/…/TestGUIListItemLayout.cpp• L127-250
Text layout
Text layout turns a changing label into lines that fit a control's space. It measures text with a selected font, applies alignment and wrapping, and supports scrolling, outline, shadow, and reading-order rules. The layout keeps the measured result so controls can use it for both placement and drawing.
Fade labels build on this service for text that cycles through several values. They can scroll long text, fade between values, randomize the order, and mark their region dirty while movement or fading is active. This keeps changing labels visible without making the screen own the timing of each transition.
This layer sits between text-bearing controls and font drawing. It also handles styled text and text that changes from information labels, which lets a screen show current application state without making each control implement line breaking or text measurement.
References: xbmc/…/GUITextLayout.h• L27-35 xbmc/…/GUITextLayout.h• L56-110 xbmc/…/GUITextLayout.h• L128-155 xbmc/…/GUIFadeLabelControl.cpp• L55-166 xbmc/…/GUIFadeLabelControl.cpp• L176-215
GUI information labels
GUI information labels are named values that skins use to show current application, player, and item state. Shared label IDs define the skin-facing vocabulary, while information providers resolve a request against the current item or playback state and return a label, number, or boolean.
The player provider covers playback state, timing, seeking, volume, stream processing, playlist state, and media item details. The music provider adds music tag, album, track, playlist, cover, and party-mode values for music screens. It uses the active item and music playlist state, and returns no value when the requested state does not apply. It also exposes content ranges such as cuts, chapters, scene markers, and bookmarks so skins can place markers on playback controls. Values that do not apply to the current playback state can be empty or false, which prevents a skin from showing stale data.
The video provider exposes media metadata, stream details, playback state, cover art, subtitle state, video versions, extras, and resume state. The system provider adds current device, display, renderer, profile, power, platform, and resource state. The shared label IDs keep these providers aligned with the names used by skin visibility rules, labels, and container conditions.
Game information follows the same provider boundary. List-item labels read game metadata from the item, while RetroPlayer labels read the current game, game client, settings, disc state, rich presence, achievements, and cheat support. RetroPlayer labels that require a current game do not use an unrelated list item as a substitute. Inactive achievement indicators return empty values so skins can hide them instead of showing stale or zero data. The label translation and provider behavior are covered by TestGamesGUIInfo, which protects the contract used by game screens. See the gameplay and RetroPlayer page for the broader game flow.
System values cover time and date, memory and storage, display and renderer state, profiles, locale, power, media presence, and platform capability. Providers return an explicit empty, false, or unavailable value when the related state does not apply, so a skin can hide or replace content instead of showing a stale result.
References: xbmc/…/GUIInfoLabels.h• L12-100 xbmc/…/GUIInfoLabels.h• L248-319 xbmc/…/GUIInfoLabels.h• L342-371 xbmc/…/GUIInfoLabels.h• L383-428 xbmc/…/MusicGUIInfo.cpp• L44-84 xbmc/…/MusicGUIInfo.cpp• L86-137 xbmc/…/MusicGUIInfo.cpp• L472-485 xbmc/…/VideoGUIInfo.cpp• L72-106 xbmc/…/VideoGUIInfo.cpp• L108-149 xbmc/…/VideoGUIInfo.cpp• L657-667 xbmc/…/SystemGUIInfo.cpp• L122-171 xbmc/…/SystemGUIInfo.cpp• L424-714 xbmc/…/GamesGUIInfo.cpp• L81-158 xbmc/…/GamesGUIInfo.cpp• L181-355 xbmc/…/GamesGUIInfo.cpp• L371-434 xbmc/…/TestGamesGUIInfo.cpp• L49-73 xbmc/…/TestGamesGUIInfo.cpp• L99-174 xbmc/…/TestGamesGUIInfo.cpp• L204-286
Visual resources
Textures
The texture system turns skin image names into renderable image data. The texture manager resolves image paths and bundles, shares loaded textures by name, tracks their use, and releases unused resources. A GUI texture adds the screen-facing rules for size, aspect ratio, scaling, diffuse color, animation frames, visibility, and drawing.
Controls use GUI textures rather than handling graphics resources directly. The common texture layer registers creation and quad-drawing callbacks, which lets the active graphics backend supply the actual draw path. The layer can load normal bundled images or request large images on demand, then reports loading and ready-state changes so the GUI can process and redraw the control.
GUI textures calculate the final render rectangle from image aspect rules, split bordered images into draw segments, and use dirty state when allocation, animation, readiness, or geometry changes. Static positions are rounded to pixel boundaries for stable edges, while the skin can request subpixel movement for smoother image motion. The image description also defines skin-facing options such as borders, diffuse overlays, flips, mipmaps, background loading, subpixel positioning, and image filters.
References: xbmc/…/TextureManager.h• L30-56 xbmc/…/TextureManager.h• L100-134 xbmc/…/TextureManager.cpp• L241-345 xbmc/…/TextureManager.cpp• L488-531 xbmc/…/GUITexture.h• L22-116 xbmc/…/GUITexture.cpp• L40-80 xbmc/…/GUITexture.cpp• L148-213 xbmc/…/GUITexture.cpp• L215-280 xbmc/…/GUITexture.cpp• L380-385 xbmc/…/GUITexture.cpp• L451-540 xbmc/…/GUITextureGLES.cpp• L26-39 xbmc/…/GUITextureGLES.cpp• L195-287 xbmc/…/GUIImage.dox• L61-97 xbmc/…/TestGUITexture.cpp• L13-25
Image controls
An image control connects a skin image or information label to the texture service. It keeps a current image and a pending image, so a changed item or label can load without stopping the current picture. Once the pending image is ready, the control switches to it or cross-fades from the old image. It can also use a fallback image when loading fails, apply item-driven image and diffuse filters, and release resources while hidden when dynamic allocation is enabled.
Image changes are staged rather than applied at the instant a caller sets a file name. The latest request replaces an in-flight request, and the request carries whether the texture cache should be used. This keeps fast-changing lists from showing an older request or using a cache policy from a previous image. Changes to alpha, fades, filters, and texture readiness mark the control's render region dirty so the window manager can redraw it.
The texture loader accepts bundled, local, and memory-backed image data. It selects a decoder from the path or MIME type, scales within the requested aspect and device limits, and preserves alpha and orientation information for the GUI texture path.
References: xbmc/…/GUIImage.h• L28-89 xbmc/…/GUIImage.cpp• L63-170 xbmc/…/GUIImage.cpp• L173-249 xbmc/…/GUIImage.cpp• L268-358 xbmc/…/GUIImage.cpp• L379-455 xbmc/…/GUIImage.cpp• L511-518 xbmc/…/Texture.cpp• L99-145 xbmc/…/Texture.cpp• L147-218 xbmc/…/Texture.cpp• L241-345
Fonts and labels
The font manager loads the font set for a skin and provides named fonts to controls. A font carries style, color, shadow, line spacing, and size information, while the text layout layer decides how a string fits in its control. The manager also supports alternate and user-provided fonts when the skin or settings request them.
Font and text work together as one visual service. A label first obtains a font and a laid-out string, then the font shapes the text and draws the result with the requested alignment and effects. Font files are rescaled and reloaded when the display or renderer changes, so labels keep the selected visual scale after a graphics reset.
The font service keeps reusable results for repeated text. Its cache considers the text, colors, alignment, width limit, scrolling mode, transform, and scale, so a cached result is used only when the visual request still matches. Frequently used glyphs are kept in a font atlas, while the active graphics backend supplies the vertex buffers and draw path. This reduces repeated text work without changing the text layout contract used by controls.
Text shaping handles script runs before glyph placement. The font service supports styled glyphs, truncation, justification, tabs, horizontal scrolling, and clipping, while the backend-specific font class uploads the glyph atlas and draws the resulting geometry. The GLES path also shares vertex storage for suitable text runs and restores the GUI shader and clip state after drawing.
References: xbmc/…/GUIFontManager.h• L39-59 xbmc/…/GUIFontManager.h• L65-159 xbmc/…/GUIFontManager.cpp• L90-114 xbmc/…/GUIFontManager.cpp• L138-246 xbmc/…/GUIFontManager.cpp• L249-323 xbmc/…/GUIFont.h• L107-168 xbmc/…/GUITextLayout.h• L56-85 xbmc/…/GUIFontCache.h• L41-175 xbmc/…/GUIFontTTF.cpp• L262-340 xbmc/…/GUIFontTTF.cpp• L365-713 xbmc/…/GUIFontTTFGLES.cpp• L60-147 xbmc/…/GUIFontTTFGLES.cpp• L150-309
Update and rendering lifecycle
Frame processing
The window manager processes the active window and running dialogs before it renders them. Processing updates visibility, focus, animations, list state, transforms, and render regions. Controls report changed regions as dirty regions, which means areas that need a new draw.
The manager can skip a full redraw when no relevant region changed. A control that changes its visual state must therefore mark itself or its region dirty. Dialog state can also make the underlying window dirty after a render, because a dialog may change what the screen below it should show.
References: xbmc/…/GUIWindowManager.cpp• L1281-1320 xbmc/…/GUIWindow.cpp• L330-349 xbmc/…/GUIControl.cpp• L120-175 xbmc/…/GUIWindowManager.cpp• L1487-1518
Window rendering
Rendering draws the active window and then the running dialogs in their render order. The manager can use one back-to-front pass or separate opaque and transparent passes. It also limits work to dirty regions when the display and selected redraw policy allow it.
After drawing, the manager gives windows a post-render step. A window can finish a close animation there, and the manager restores shared graphics state before the next frame. The application thread owns the main process and render calls so screen state and graphics state stay ordered.
References: xbmc/…/GUIWindowManager.cpp• L1342-1402 xbmc/…/GUIWindowManager.cpp• L1422-1484 xbmc/…/GUIWindow.cpp• L351-375 xbmc/…/GUIWindowManager.h• L91-127
Rendering callbacks
A rendering callback is an extension point for content that must draw inside a GUI control but is not a normal skin control. CGUIRenderingControl gives the callback a screen rectangle, calls it during the control's render step, and restores the graphics state around that call.
The callback reports whether its content is dirty, so the control can request another draw when the external content changes. It also has explicit create, render, and stop stages. The control releases the callback's resources when it becomes hidden or when its resources are freed. The visualisation control follows the same boundary for an audio visualisation add-on: it supplies a viewport, passes audio and track state to the add-on, and protects the GUI graphics state around add-on drawing.
References: xbmc/…/IRenderingCallback.h• L11-19 xbmc/…/GUIRenderingControl.h• L15-32 xbmc/…/GUIRenderingControl.cpp• L38-114 xbmc/…/GUIVisualisationControl.cpp• L154-216 xbmc/…/GUIVisualisationControl.cpp• L359-455
Change checklist
When these files or sections are changed, remember to consider these:
- A new control type must keep its skin name, factory mapping, parent-child rules, and focus behavior aligned across the control factory and control hierarchy.
- A control group change must keep ancestor ID lookup correct when a subtree is added, removed, cleared, cloned, or attached to a new parent. Temporary controls created by list item layouts must not remain in that lookup after item reset or resource release.
- A new or changed GUI message must keep its sender, target, parameter, and broadcast meaning aligned between the message producer, window manager, group routing, and receiving control.
- Changes to focus or navigation must preserve the link between default focus, remembered focus, window active state, visibility conditions, and scroll-container selection.
- Changes to list presentation must keep normal and focused item layouts consistent with container size, page size, scroll bounds, and focus movement. Panel row changes must also preserve the selected item.
- Page controls must keep content size, visible page size, selected-item movement, and scroll value notifications in step. Fixed lists must preserve the previous page offset when applying repeated page changes.
- List-provider changes must keep background job state, event invalidation, item visibility, artwork loading, selection recovery, and target actions aligned.
- List-item property changes must keep the shared property name and value meaning aligned between the code that supplies item data and the code that reads it for labels, artwork, conditions, or actions.
- A new GUI information label must keep its shared ID, skin-facing name, provider result type, and source state aligned. Empty or false values must describe inactive media or game state rather than stale state.
- Game label changes must keep GUIInfoLabels.h, string translation,
GamesGUIInfo, current-game state, and game-screen skin conditions aligned. Achievement indicators must keep their inactive empty-value contract. - Image-control changes must keep staged image state, cache use, fallback selection, cross-fade lifetime, and dirty-region marking aligned with texture allocation and list-item updates.
- A callback's dirty state or resource lifetime must remain consistent with dirty-region processing and renderer reset handling.
- Changes to skin coordinate rules must be checked with texture size, font scale, hit regions, and dialog render order because these consumers share the window transform.
- Changes to window IDs, activation, or modal behavior must preserve window history and the action/message boundary that protects the active modal dialog.
- Changes to graphics resource recovery must preserve registration, device-loss save behavior, and resource recreation for every resource type that can be used by GUI rendering.
- Changes to the GUI texture callback boundary must keep backend registration, quad drawing, texture binding, blend state, clip state, and shader selection aligned.
- Changes to texture coordinate or motion rules must keep whole-pixel snapping, subpixel movement, transform updates, and redraw timing aligned.
- Changes to font loading or font caching must keep selected font sets, shaping inputs, display scaling, renderer reset behavior, cache invalidation, and existing renderable font state aligned.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
A skin window cannot be loaded or does not have a valid <window> root. | The window cannot build its control tree for that skin, but its registered identity remains usable for a later retry. | Keep the skin file and its selected resolution valid, then verify window construction through CGUIWindow::LoadXML. |
| A modal dialog does not handle an action. | The action stops at the modal boundary, so the screen below does not react. | Put the intended action in the dialog or explicitly define a safe fall-through case. |
| A focused control rebuilds the window's control tree while handling an action. | The old parent chain is no longer safe to walk, so propagation must stop rather than access freed controls. | Treat the control generation change as a handled boundary and rebuild or restore focus through the normal window lifecycle. |
| A gesture reaches a new window during a window switch. | The new screen can react to input that began on the old screen. | Keep gesture input inhibited until the gesture ends or is aborted. |
| A list's visible children change without validating its scroll offset. | The list can point outside its content or leave the focused child outside the visible page. | Recalculate visible content size and clamp the offset before reporting page state or moving focus. |
| A focused list item is larger than normal items but page size counts only normal slots. | Page actions and page controls can move by the wrong number of items. | Calculate the page from the transformed visible range and both normal and focused layout sizes. |
| A panel layout changes its row length without preserving the selected item. | A resize or skin change can make the user appear to jump to a different item. | Recalculate row and page capacity, then restore selection by item identity. |
| A directory provider receives repeated invalidation while a load job is active. | The list can show old data or start refresh jobs too often. | Keep one active job, queue pending refreshes, and apply the provider's rate limit after completion. |
| A temporary list-item layout is freed without removing its descendants from the live lookup. | A later targeted message can reach a released control or the parent can report stale IDs. | Release layouts through the item and keep the container as the owner of the layout parent. |
| A changing control or callback does not mark a dirty region. | Smart redraw can leave old pixels on screen or delay the visual change. | Mark the control dirty when state or callback content changes. |
| An image request uses the cache policy from an older request. | A changing image can show stale content or skip the requested load behavior. | Apply the cache choice to the pending texture when the request is staged and when it replaces an in-flight request. |
| An image changes rapidly while an older image is fading. | Old transitions can pile up or the control can show a result that is no longer the latest request. | Keep a bounded fade queue and let the latest staged image replace the pending texture. |
| A GUI texture or quad helper is used before the active graphics backend registers its callbacks. | Texture creation or simple quad drawing fails instead of reaching the renderer. | Register the backend creation and draw callbacks during graphics setup, and unregister them only after GUI drawing stops. |
| A texture name or font name cannot be resolved. | An image or label can render with missing content or a fallback instead of the skin's intended appearance. | Keep skin resource names and font sets aligned with the active skin. |
| A GUI information label has no matching provider or uses the wrong item, playback, or game state. | A skin condition or label shows a false value or no value. | Keep the label ID and provider logic aligned with the media, player, video, system, or RetroPlayer state it represents. |
| An achievement label is queried while no achievement data or indicator is active. | A skin can show stale progress or an empty indicator can leave unwanted controls visible. | Return empty values for inactive achievement data and keep all fields of an inactive indicator empty. |
| A visualisation add-on fails to initialize or is used after its control releases resources. | The visualisation area stays blank or external drawing uses a stopped add-on. | Pair add-on start and stop with the control resource lifecycle and restore graphics state around add-on calls. |
| A font cache entry is reused after its text, transform, scale, alignment, or scrolling inputs changed. | Text can draw at the wrong position or with stale glyph geometry. | Include all visual inputs in cache matching and flush caches when the font atlas or renderer state changes. |
Key files
| File | Why to read it |
|---|---|
| xbmc/…/GUIWindowManager.h and xbmc/…/GUIWindowManager.cpp | Main owner of window activation, dialog stacking, action routing, message routing, frame processing, dirty regions, and rendering. |
| xbmc/…/WindowIDs.h | Shared identity space for screens, dialogs, playback windows, games, skin windows, and add-on windows. |
| xbmc/…/GUIWindow.h and xbmc/…/GUIWindow.cpp | Screen lifecycle, skin loading, control-tree construction, focus fallback, action propagation, transforms, close animation, and window rendering. |
| xbmc/…/GUIControl.h and xbmc/…/GUIControl.cpp | Shared control contract for state, input, animation, dirty regions, transforms, resource use, and drawing. |
| xbmc/…/GUIControlGroup.h and xbmc/…/GUIControlGroup.cpp | Parent-child behavior, focus propagation, targeted messages, broadcast messages, child rendering, and subtree ownership. |
| xbmc/…/GUIControlLookup.h and xbmc/…/GUIControlLookup.cpp | Descendant ID lookup and the rules that keep lookup state aligned with live control ownership. |
| xbmc/…/GUIControlGroupList.h and xbmc/…/GUIControlGroupList.cpp | Scrollable list layout, page movement, visible-child bounds, orientation-based navigation, touch and mouse scrolling, and page-control updates. |
| xbmc/…/GUIControlFactory.h and xbmc/…/GUIControlFactory.cpp | Boundary that maps skin control descriptions to runtime controls and shared visual rules. |
| xbmc/…/GUIBaseContainer.h and xbmc/…/GUIBaseContainer.cpp | Shared list behavior for data providers, item layouts, scrolling, visible page size, focus movement, page controls, input, and list rendering. |
| xbmc/…/GUIFixedListContainer.h and xbmc/…/GUIFixedListContainer.cpp | Fixed-focus list behavior at normal positions and list boundaries, including page actions, pointer selection, and page-control movement. |
| xbmc/…/GUIListItem.h, xbmc/…/GUIListItem.cpp, and xbmc/…/GUIListItemLayout.cpp | List-item data, artwork, properties, selection, invalidation, and the temporary layouts that present each item. |
| xbmc/…/DirectoryProvider.cpp | Directory-backed list data, background refresh, event invalidation, artwork loading, visibility, and item actions. |
| xbmc/…/GUISpinControl.h and xbmc/…/GUISpinControl.cpp | Range, text, float, and page controls that connect arrow input and messages to displayed values. |
| xbmc/…/GUIFadeLabelControl.cpp | Scrolling and fading label behavior driven by changing information values. |
xbmc/…/GUIImage.h, xbmc/…/GUIImage.cpp, and xbmc/guilib/GUIImage.dox | Image staging, cache choice, fallback handling, cross-fade behavior, dynamic resources, and skin-facing image options. |
| xbmc/…/TextureManager.cpp, xbmc/…/GUITexture.h, and xbmc/…/GUITexture.cpp | Image lookup, shared texture resources, scaling, animation frames, pixel placement, backend callbacks, and GUI image drawing. |
| xbmc/…/GUITextureGLES.cpp | GLES texture registration, shader state, quad buffering, clipping, blending, and backend drawing. |
| xbmc/…/Texture.cpp | File and memory image loading, aspect-aware sizing, pixel formats, alpha, and orientation. |
| xbmc/…/GUITextLayout.h and xbmc/…/GUIFontManager.h | Text measurement, wrapping, alignment, font loading, font selection, and scaling. |
| xbmc/…/GUIFontCache.h, xbmc/…/GUIFontTTF.cpp, and xbmc/…/GUIFontTTFGLES.cpp | Text result reuse, glyph shaping and caching, atlas updates, and the graphics-backend boundary for font drawing. |
| xbmc/…/GUIInfoLabels.h, xbmc/…/MusicGUIInfo.cpp, xbmc/…/VideoGUIInfo.cpp, and xbmc/…/SystemGUIInfo.cpp | Skin-facing information IDs and providers that turn media, playback, device, display, profile, and system state into values used by labels and conditions. |
| xbmc/…/GamesGUIInfo.cpp and xbmc/…/TestGamesGUIInfo.cpp | Game metadata and RetroPlayer values exposed to skins, plus the contract for current-game, achievement, and item-label behavior. |
| xbmc/…/GUIMessage.h and xbmc/…/GUIMessageIDs.h | Message data shape and the shared vocabulary for screen and control state changes. |
| xbmc/…/IRenderingCallback.h, xbmc/…/GUIRenderingControl.cpp, and xbmc/…/GUIVisualisationControl.cpp | Contracts for embedding external drawing content and audio visualisation add-ons inside GUI controls. |
| xbmc/…/TestGUIControlFactory.cpp, xbmc/…/TestGUITexture.cpp, and xbmc/…/TestGUIListItemLayout.cpp | Guarantees for skin value parsing, texture options and pixel placement, scrollers, layout release, and live control lookup. |