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

(1/5) Multiple issues: Prep #180

Merged
merged 7 commits into from
Sep 26, 2019
Merged

(1/5) Multiple issues: Prep #180

merged 7 commits into from
Sep 26, 2019

Conversation

felix-andreas
Copy link
Member

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

(1/5) Split up #177 into different PRs:

This is a prep PR needed for the following PRs:

Changes in this PR:

  • change the unit of display_widget.delta from widget units to monitor/pixel units

    The integer cast

    delta_x = (int)(event.x_root - start_x);
    delta_y = (int)(event.y_root - start_y);

    should be done after dividing by current_ratio. The distance in widgets units is
    always less than the distance in monitor units. So doing the integer cast before dividing by
    current_ratio makes it not possible to arbitrary position the monitors as the rounding of double
    leads to information loss .

    With the expression

    display_widget.delta_x = (int) ((event.x_root - start_x) / current_ratio);
    display_widget.delta_y = (int) ((event.y_root - start_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

  • set holding always to false if the mouse button is released, which solves (The display rectangle is "running away" from my pointer #34, Triple-monitor setup screens not lining up #35.4)

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
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.

No regressions noticed so far. The new event handling could be simplified a little.

src/Widgets/DisplayWidget.vala Outdated Show resolved Hide resolved
src/Widgets/DisplaysOverlay.vala Outdated Show resolved Hide resolved
@danirabbit danirabbit requested a review from jeremypw September 25, 2019 16:57
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.

There are some questions over the way virtual monitor geometries are translated into widget geometries (result in pixel sized gaps on screen) but I think it better to wait until this sequence of PRs is merged before seeing whether this can be improved.

@jeremypw jeremypw merged commit 9bc2ae8 into elementary:master Sep 26, 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.

3 participants