Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 4, 2026

native_window_set_bounds built the Rectangle with height/width swapped, causing incorrect geometry updates.

  • Geometry fix: Construct Rectangle with {x, y, width, height} before calling SetBounds.

Example:

// Before: width/height reversed
Rectangle rect = {bounds.x, bounds.y, bounds.height, bounds.width};

// After: correct ordering
Rectangle rect = {bounds.x, bounds.y, bounds.width, bounds.height};
win->SetBounds(rect);
Original prompt

This section details on the original issue you should resolve

<issue_title>width/height swapped in native_window_set_bounds</issue_title>
<issue_description>Thank you for developing and sharing this project.

As you may already have noticed, in src/capi/window_c.cpp line 215,
it appears that the width and height are passed in the wrong order when constructing the Rectangle.

// Window geometry operations
FFI_PLUGIN_EXPORT
void native_window_set_bounds(native_window_t window, native_rectangle_t bounds) {
  if (!window)
    return;
  auto* win = static_cast<nativeapi::Window*>(window);
  Rectangle rect = {bounds.x, bounds.y, bounds.height, bounds.width}; // should be {x, y, width, height}
  win->SetBounds(rect);
}

I wasn't sure if opening a PR directly would be appropriate, so I'm leaving this issue instead.
Thanks, and have a great day.
</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Fix width and height order in native_window_set_bounds Correct bounds construction in native_window_set_bounds Jan 4, 2026
Copilot AI requested a review from lijy91 January 4, 2026 03:05
@lijy91 lijy91 marked this pull request as ready for review January 4, 2026 03:05
Copilot AI review requested due to automatic review settings January 4, 2026 03:05
@lijy91 lijy91 merged commit 50bedbb into main Jan 4, 2026
10 of 11 checks passed
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a critical bug in native_window_set_bounds where the width and height parameters were swapped when constructing the Rectangle object, causing incorrect window geometry updates.

  • Corrected Rectangle initialization to use the proper order: {x, y, width, height} instead of {x, y, height, width}

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

width/height swapped in native_window_set_bounds

2 participants