Present window on activation - #739
Conversation
This ensures that the main window brings to the front if the application is already launched.
Reviewer's guide (collapsed on small PRs)Reviewer's GuideUpdates post-startup activation handling to bring the active main window to the front, while preserving the existing first-start initialization path. Sequence diagram for presenting the window on activationsequenceDiagram
participant Application
participant GTK
participant Window
Application->>Application: onActivate(self)
alt self.started
Application->>GTK: gtk_application_get_active_window(self.app)
GTK-->>Application: window
alt window exists
Application->>Window: gtk_window_present(window)
end
else first activation
Application->>Application: self.started = true
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="src/iptux/Application.cpp" line_range="213-216" />
<code_context>
void Application::onActivate(Application& self) {
if (self.started) {
+ auto window = gtk_application_get_active_window(self.app);
+ if (window) {
+ gtk_window_present(window);
+ }
return;
</code_context>
<issue_to_address>
**issue (bug_risk):** The activation handler presents whichever window GTK currently marks active instead of the application's main window. If a secondary dialog is active, the dialog is raised while the main window remains behind; if the main window is hidden and no window is active, the handler does nothing.
**Triggers:** When an already-running instance is activated while a secondary dialog is focused or the main window is hidden.
**Suggested fix:** Call `self.window->Show()` (or explicitly present and deiconify `self.window->getWindow()`) instead of querying the active window.
```suggestion
self.window->Show();
```
</issue_to_address>Sourcery assessment
Approval pending. 1 finding to address first.
Blocking findings: src/iptux/Application.cpp:216
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| auto window = gtk_application_get_active_window(self.app); | ||
| if (window) { | ||
| gtk_window_present(window); | ||
| } |
There was a problem hiding this comment.
issue (bug_risk): The activation handler presents whichever window GTK currently marks active instead of the application's main window. If a secondary dialog is active, the dialog is raised while the main window remains behind; if the main window is hidden and no window is active, the handler does nothing.
Triggers: When an already-running instance is activated while a secondary dialog is focused or the main window is hidden.
Suggested fix: Call self.window->Show() (or explicitly present and deiconify self.window->getWindow()) instead of querying the active window.
| auto window = gtk_application_get_active_window(self.app); | |
| if (window) { | |
| gtk_window_present(window); | |
| } | |
| self.window->Show(); |
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #739 +/- ##
=======================================
Coverage 52.47% 52.48%
=======================================
Files 71 71
Lines 9004 9007 +3
=======================================
+ Hits 4725 4727 +2
- Misses 4279 4280 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|



This ensures that the main window brings to the front if the application is already launched.
Summary by Sourcery
New Features: