Skip to content

fix: various bugs#260

Merged
iparaskev merged 3 commits intomainfrom
failed_to_screenshare
Feb 25, 2026
Merged

fix: various bugs#260
iparaskev merged 3 commits intomainfrom
failed_to_screenshare

Conversation

@iparaskev
Copy link
Contributor

@iparaskev iparaskev commented Feb 25, 2026

Summary by CodeRabbit

  • Bug Fixes

    • Improved window positioning accuracy and repositioning behavior
    • Enhanced framebuffer cleanup when windows are closed
  • Chores

    • Version bumped to 0.0.64

It seems that there is a case where the overlay window for a monitor
is in the wrong place, but because we have cached the position we don't
reposition it.
@netlify
Copy link

netlify bot commented Feb 25, 2026

Deploy Preview for hoppdocs ready!

Name Link
🔨 Latest commit 14a297c
🔍 Latest deploy log https://app.netlify.com/projects/hoppdocs/deploys/699f65f59cf33f0008741977
😎 Deploy Preview https://deploy-preview-260--hoppdocs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai
Copy link

coderabbitai bot commented Feb 25, 2026

📝 Walkthrough

Walkthrough

The pull request refactors core graphics and window management components. It renames internal fields in GraphicsContext for clarity, extends the Drop trait to properly clean up framebuffer state, restructures window positioning logic to compute positions dynamically rather than storing them, and increments the version number.

Changes

Cohort / File(s) Summary
Core Graphics and Window Management
core/src/graphics/graphics_context.rs, core/src/window_manager.rs
Refactored GraphicsContext internal fields; added Drop implementation to clear framebuffer before window is hidden. Restructured WindowEntry to compute window positions dynamically instead of storing them; updated position comparison logic to use actual vs. expected positions.
Version Update
tauri/src-tauri/tauri.conf.json
Version bumped from 0.0.63 to 0.0.64.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 Fields renamed clean and bright,
Drop clears buffers—what a sight!
Windows reposition without a store,
GPU cleanup forevermore! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'fix: various bugs' is vague and generic, using the non-descriptive term 'various bugs' without conveying what specific bugs or changes are addressed in the changeset. Replace with a more specific title that describes the main changes, such as 'fix: improve window position tracking and graphics context cleanup' to better reflect the actual modifications.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch failed_to_screenshare

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@core/src/window_manager.rs`:
- Around line 209-223: The code currently calls
entry.window.outer_position().unwrap_or_default() which hides errors and yields
(0,0); instead match on entry.window.outer_position(): on Ok(physical_pos)
convert it to logical via .to_logical(monitor.scale_factor()) and compare to
get_window_position_for_monitor(monitor), and on Err(e) log a warning including
entry.monitor_id and the error and skip repositioning; keep the reposition call
using entry.window.set_outer_position(expected_position) when positions differ.
Ensure you reference outer_position, to_logical(monitor.scale_factor()),
get_window_position_for_monitor, entry.monitor_id, and
entry.window.set_outer_position in the change.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a90871a and 14a297c.

📒 Files selected for processing (3)
  • core/src/graphics/graphics_context.rs
  • core/src/window_manager.rs
  • tauri/src-tauri/tauri.conf.json

Comment on lines +209 to +223
// Reposition if the window's actual position doesn't match expected.
let expected_position = get_window_position_for_monitor(monitor);
let actual_position: LogicalPosition<f64> = entry
.window
.outer_position()
.unwrap_or_default()
.to_logical(monitor.scale_factor());
if actual_position != expected_position {
log::info!(
"WindowManager::update: repositioning window for monitor {:?} from {:?} to {:?}",
entry.monitor_id,
entry.position,
new_position
actual_position,
expected_position
);
entry.window.set_outer_position(new_position);
entry.position = new_position;
entry.window.set_outer_position(expected_position);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

rg -n -C3 'outer_position\(\)\s*\.unwrap_or_default\(\)\s*\.to_logical|actual_position\s*!=\s*expected_position' core/src/window_manager.rs

Repository: gethopp/hopp

Length of output: 457


🏁 Script executed:

# Get broader context around lines 209-223
sed -n '200,235p' core/src/window_manager.rs | cat -n

Repository: gethopp/hopp

Length of output: 2157


🏁 Script executed:

# Check get_window_position_for_monitor implementation
rg -n 'fn get_window_position_for_monitor' core/src/window_manager.rs

Repository: gethopp/hopp

Length of output: 144


🏁 Script executed:

# Check if monitor has a position() method
rg -n 'monitor\.position\(\)' core/src/

Repository: gethopp/hopp

Length of output: 445


🏁 Script executed:

# Check what Monitor type is being used and its API
rg -n 'struct Monitor|impl.*Monitor' core/src/window_manager.rs -A 5 | head -50

Repository: gethopp/hopp

Length of output: 38


🏁 Script executed:

# Get the full get_window_position_for_monitor function
sed -n '35,60p' core/src/window_manager.rs | cat -n

Repository: gethopp/hopp

Length of output: 1131


🏁 Script executed:

# Check Monitor type and its position() method return type
rg -n 'position\(\)' core/src/window_manager.rs -B2 -A2

Repository: gethopp/hopp

Length of output: 826


🏁 Script executed:

# Get more context on how monitor.position() is used
sed -n '30,45p' core/src/window_manager.rs | cat -n

Repository: gethopp/hopp

Length of output: 680


🏁 Script executed:

# Check the imports to understand MonitorHandle
head -20 core/src/window_manager.rs | cat -n

Repository: gethopp/hopp

Length of output: 834


Handle outer_position() errors explicitly instead of silently defaulting to (0,0).

The unwrap_or_default() call masks position-query errors and defaults to (0,0), which can trigger unnecessary reposition operations. Explicitly handle the error case rather than silently continuing with a potentially invalid position.

Note: The suggested diff in the original comment has a type error—it uses monitor.position() (which returns PhysicalPosition<i32>) directly instead of converting to LogicalPosition<f64>, causing a mismatch when compared with actual_position. The fix should match actual_position to the same coordinate space (logical) and properly propagate or handle the error case.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@core/src/window_manager.rs` around lines 209 - 223, The code currently calls
entry.window.outer_position().unwrap_or_default() which hides errors and yields
(0,0); instead match on entry.window.outer_position(): on Ok(physical_pos)
convert it to logical via .to_logical(monitor.scale_factor()) and compare to
get_window_position_for_monitor(monitor), and on Err(e) log a warning including
entry.monitor_id and the error and skip repositioning; keep the reposition call
using entry.window.set_outer_position(expected_position) when positions differ.
Ensure you reference outer_position, to_logical(monitor.scale_factor()),
get_window_position_for_monitor, entry.monitor_id, and
entry.window.set_outer_position in the change.

@iparaskev iparaskev merged commit 2059cd6 into main Feb 25, 2026
22 checks passed
@iparaskev iparaskev deleted the failed_to_screenshare branch February 25, 2026 21:49
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.

1 participant