Skip to content

Apply scaling to virtual monitor reported size#439

Open
flodavid wants to merge 2 commits into
elementary:mainfrom
flodavid:fix-multi-monitor-scaling
Open

Apply scaling to virtual monitor reported size#439
flodavid wants to merge 2 commits into
elementary:mainfrom
flodavid:fix-multi-monitor-scaling

Conversation

@flodavid
Copy link
Copy Markdown

This fixes an issue where you could not apply a layout where a monitor on the left or on top of another monitor has scaling over 100%, because the configuration would contain gaps and the following error would be raised:
image
This is because the screen origin is at its top-left. When scaling is applied, the monitor area is smaller, which creates gaps on its right and bottom sides that were not took into account.

This PR resize the monitor area when scaling is modified, logically and visually, so the monitor can be adjacent. Moreover, the user can now see what the real area of the monitor will be.

I did not found an existing issue reporting this, but it could related to #435.

@lobre
Copy link
Copy Markdown

lobre commented Mar 22, 2026

This is related to #436.

@lobre
Copy link
Copy Markdown

lobre commented Mar 22, 2026

If I understood the problem correctly, this issue is more than just rounding up, as the geometry is not handled with logical coordinates while I believe it should. But I may be wrong.

@flodavid
Copy link
Copy Markdown
Author

flodavid commented Mar 22, 2026

If I understood the problem correctly, this issue is more than just rounding up, as the geometry is not handled with logical coordinates while I believe it should. But I may be wrong.

Yes it is not just rounding up. In added the comment to explain why I added 0.49 before after applying the scaling, but before the conversion to int.
Edit : Rounding replaced for clarity. See #439 (comment)

@flodavid flodavid force-pushed the fix-multi-monitor-scaling branch from b0741f3 to 20e5a00 Compare March 22, 2026 16:25
Comment thread src/Objects/VirtualMonitor.vala Outdated
@flodavid flodavid force-pushed the fix-multi-monitor-scaling branch from 3563477 to af58696 Compare March 28, 2026 23:24
@leolost2605 leolost2605 self-assigned this Apr 21, 2026
Copy link
Copy Markdown
Member

@leolost2605 leolost2605 left a comment

Choose a reason for hiding this comment

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

Hi sorry that a review took so long but this LGTM and I can confirm it fixes the issue. One little comment though :)

Comment thread src/Objects/VirtualMonitor.vala Outdated
@flodavid flodavid force-pushed the fix-multi-monitor-scaling branch from 06bbfa3 to 0677bc3 Compare May 11, 2026 17:31
Copy link
Copy Markdown
Member

@leolost2605 leolost2605 left a comment

Choose a reason for hiding this comment

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

Two more nits and this LGTM :)

Comment thread src/Objects/VirtualMonitor.vala Outdated
Comment thread src/Objects/VirtualMonitor.vala Outdated
* @param dimension The monitor dimension to scale (width or height) by the current `scale` factor
* @return the dimension scaled then rounded up and converted back to int
*/
private int scaled (int dimension) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Method names should usually be imperative and I think in this case it makes sense to say that we are using the current scale so IMO something like apply_current_scale would be more fitting 🤷

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

done

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.

3 participants