fix: set_primary_window no longer breaks other windows#2641
Merged
hoffstadt merged 1 commit intohoffstadt:masterfrom May 4, 2026
Merged
fix: set_primary_window no longer breaks other windows#2641hoffstadt merged 1 commit intohoffstadt:masterfrom
hoffstadt merged 1 commit intohoffstadt:masterfrom
Conversation
…t supposed to reset (hoffstadt#1691, hoffstadt#1978).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
name: Pull Request
about: Create a pull request to help us improve
title: fix: set_primary_window no longer breaks other windows
assignees: ''
Description:
With this PR,
set_primary_windowno longer modifies windows other than the window passed in and the previous primary window (if it was set). This fixes #1691, effectively changing window position only when the window switches between primary and regular state. No other windows, in particular, popups and modals, are affected (keep in mind that a modal that has a non-empty label still won't center properly - see #2323 which is not fixed yet).The only change
set_primary_windowstill does to every window is re-focusing them - this is necessary to place the primary window to the bottom of Z-order. There are no public functions in ImGui API to control Z order, so re-focusing is the only way to place them atop of the primary window (so that they are not hidden behind). As a result, all windows after this call are always reordered according to their creation order. This matches behavior that existed before this PR.Another change in this PR is that
set_primary_windowkeeps window flags that are not related to positioning it as a primary window, for example,horizontal_scrollbar. This fixes #1978.Also, the 2nd argument of
set_primary_windowis now optional, which allows for a more intuitive call likeset_primary_window(wnd)rather thanset_primary_window(wnd, True)(you know, I always hated to type thatTrue😂).Concerning Areas:
If ImGui ever provides API to conrol windows' Z-order, we'll need to make use of it in place of refocusing every window.