Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(5/5) Multiple Issues: Introduce magnetic edge center #184

Merged
merged 57 commits into from
Oct 23, 2019
Merged

(5/5) Multiple Issues: Introduce magnetic edge center #184

merged 57 commits into from
Oct 23, 2019

Conversation

felix-andreas
Copy link
Member

@felix-andreas felix-andreas commented Aug 27, 2019

(5/5) Split up #177 in different PRs:

Needs to be merged after #183

Changes in this PR:

align-monitors
Can be disabled by pressing Ctrl

This is a prep PR needed for the following PRs:
- snap widgets after mouse button release
- close gaps after mouse button release
- fix intersects after mouse button release
- align display_widget edges/center

Changes in this PR
- change the meaning of display_widget.delta:
 from distance of in widget units to distance in monitor/pixel units

The expression
```vala
delta_x = (int)(event.x_root - start_x);
delta_y = (int)(event.y_root - start_y);
```

led to the loss of information and as the distance in widgets units is
always less than the distance in monitor units. There no 1-to-1 mapping
was possible.

With the expression
```vala
display_widget.delta_x = (int) (diff_x / current_ratio);
display_widget.delta_y = (int) (diff_y / current_ratio);
```
a 1-to-1 mapping between the widget units and monitor units is possible
as the integer cast happens after the float division!

- rename move_display to end_grab as the signal is only emitted when the mouse button is released
- introduce new signal called `move_display` which is emitted when widget is moved
- a more concise widget snapping algorithm
- also fixes some issues when the widgets were
  perfectly aligned
- check intersections after mouse button release:
this makes it possible to place a monitor between to others
- also fix issue: for 3 and more monitors it was possible to create
intersections between monitors
Copy link
Collaborator

@jeremypw jeremypw left a comment

Choose a reason for hiding this comment

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

Corner to corner snapping is not quite accurate:
Screenshot from 2019-09-24 15 50 10

src/Widgets/DisplaysOverlay.vala Outdated Show resolved Hide resolved
src/Widgets/DisplaysOverlay.vala Outdated Show resolved Hide resolved
src/Widgets/DisplaysOverlay.vala Outdated Show resolved Hide resolved
@felix-andreas
Copy link
Member Author

felix-andreas commented Sep 24, 2019

Corner to corner snapping is not quite accurate:

This is intentional as diagonal monitors are not allowed. Maybe I could increase the offset to make it more obvious that it is the intended behavior?

I have also thought about a minimal offset of 1px. But this would make it difficult to move the cursor between displays. So I think it is reasonable to use minimal offset of 50px.

…hub.com:andreasfelix/switchboard-plug-display into 2_of_5_snap_monitors_after_mouse_button_release
….com:andreasfelix/switchboard-plug-display into 3_of_5_close_gaps_after_mouse_button_release
…_5_fix_intersections_after_mouse_button_release
This reverts commit 2ef6b0e.
…_5_fix_intersections_after_mouse_button_release
felix-andreas and others added 25 commits September 25, 2019 20:17
…hub.com:andreasfelix/switchboard-plug-display into 2_of_5_snap_monitors_after_mouse_button_release
….com:andreasfelix/switchboard-plug-display into 3_of_5_close_gaps_after_mouse_button_release
…_5_fix_intersections_after_mouse_button_release
…se_button_release"

This reverts commit 59f7aab, reversing
changes made to 20b9006.
@felix-andreas
Copy link
Member Author

I wanted to ask - as completely rewrote the widget-snapping, gap-detection, intersection-detection and widget-alignment algorithms - if it is okay if I would add myself to the Authored by list at the top of the DisplaysOverlay.vala file?

@danirabbit danirabbit requested a review from jeremypw October 22, 2019 23:41
Copy link
Collaborator

@jeremypw jeremypw left a comment

Choose a reason for hiding this comment

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

Works well. Still occasional 1 pixel gap between display rectangles but I think that can be cleaned up in another PR if it causes an issue.

Currently, you have the most blame for this file so I have no objection to you being one of the authors. Better get OK from original author @tintou though.

@danirabbit danirabbit merged commit 5a5bc6d into elementary:master Oct 23, 2019
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.

4 participants