Skip to content

refactor(ui): consolidate popupmodal#2293

Merged
alandtse merged 1 commit into
community-shaders:devfrom
SkrubbySkrubInAShrub:popup-window-stretching
May 8, 2026
Merged

refactor(ui): consolidate popupmodal#2293
alandtse merged 1 commit into
community-shaders:devfrom
SkrubbySkrubInAShrub:popup-window-stretching

Conversation

@SkrubbySkrubInAShrub
Copy link
Copy Markdown
Collaborator

@SkrubbySkrubInAShrub SkrubbySkrubInAShrub commented May 7, 2026

This PR also fixes a bug where the popupwindows would be stretched for 1 frame. I consolidated all of these into this helper so that the bug won't reappear again and 1 fix fixes them all.

Summary by CodeRabbit

Release Notes

  • Refactor
    • Consolidated modal dialog handling by introducing a reusable centered popup utility that standardizes dialog positioning throughout the application.
    • Replaced duplicate manual modal positioning logic across multiple UI components with the new centralized utility, improving code consistency.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 7, 2026

Review Change Stack
No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 92bd9791-0602-4088-bb91-1bacfb170f12

📥 Commits

Reviewing files that changed from the base of the PR and between 96005a4 and d4a4575.

📒 Files selected for processing (7)
  • src/FeatureIssues.cpp
  • src/Features/HDRDisplay.cpp
  • src/Features/VR/SettingsUI.cpp
  • src/Menu/SettingsTabRenderer.cpp
  • src/Utils/UI.cpp
  • src/Utils/UI.h
  • src/WeatherEditor/Widget.cpp

📝 Walkthrough

Walkthrough

This PR introduces Util::CenteredPopupModal, an RAII utility class that encapsulates ImGui modal popup centering and lifecycle management. The class is then applied across six modal implementations in feature modules and the UI utilities to eliminate duplicated manual centering and BeginPopupModal/EndPopup boilerplate.

Changes

Modal Popup Centering Utility Refactoring

Layer / File(s) Summary
Class Interface
src/Utils/UI.h
New Util::CenteredPopupModal RAII class with constructor, destructor, bool conversion operator, and deleted copy/move operations.
Class Implementation
src/Utils/UI.cpp
Constructor positions and sizes the modal via SetNextWindowPos/SetNextWindowSize before BeginPopupModal; destructor calls EndPopup.
Utility Integration
src/Utils/UI.cpp
Shader cache confirmation and generic confirmation popup call sites switch to CenteredPopupModal.
Feature Modal Refactoring
src/FeatureIssues.cpp, src/Features/HDRDisplay.cpp, src/Features/VR/SettingsUI.cpp, src/Menu/SettingsTabRenderer.cpp, src/WeatherEditor/Widget.cpp
Five modal implementations replace manual BeginPopupModal + manual centering with CenteredPopupModal instantiation.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • alandtse
  • doodlum
  • soda3000

Poem

🐰 A rabbit hops through modals neat,
Where CenteredPopupModal's RAII heart beats,
No more BeginPopupModal dance,
Six call sites caught in refactor's glance!
Centered, poised, and owned with care.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'refactor(ui): consolidate popupmodal' clearly and concisely summarizes the main change: consolidating popup modal handling into a shared helper utility.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 OpenGrep (1.20.0)

OpenGrep fatal error (exit code 2): [00.14][ERROR]: Error: exception Unix_error: No such file or directory stat src/Features/HDRDisplay.cpp
Raised by primitive operation at UTmp.replace_named_pipe_by_regular_file_if_needed in file "libs/commons/UTmp.ml", line 145, characters 8-27
Called from Scan_CLI.replace_target_roots_by_regular_files_where_needed.(fun) in file "src/osemgrep/cli_scan/Scan_CLI.ml", lines 1086-1087, characters 19-65
Called from List_.fast_map in file "libs/commons/List_.ml", line 81, characters 17-20
Called from


Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 7, 2026

No actionable suggestions for changed features.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 7, 2026

✅ A pre-release build is available for this PR:
Download

@alandtse alandtse merged commit 405c1d1 into community-shaders:dev May 8, 2026
12 checks passed
ParticleTroned pushed a commit to ParticleTroned/skyrim-community-shaders that referenced this pull request May 15, 2026
Branch-preserving adaptation: add the centered popup modal helper and apply it to current branch popup sites, while leaving HDRDisplay and the no-op VR SettingsUI path out of scope.
ParticleTroned pushed a commit to ParticleTroned/skyrim-community-shaders that referenced this pull request May 16, 2026
Branch-preserving adaptation: add the centered popup modal helper and apply it to current branch popup sites, while leaving HDRDisplay and the no-op VR SettingsUI path out of scope.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants