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

fix: increase borderless resizing inset #202

Merged
merged 2 commits into from
Sep 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .changes/borderless-resizing-inset.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
"tao": patch
---
Increased Borderless window resizing inset.
8 changes: 4 additions & 4 deletions src/platform_impl/linux/event_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ impl<T: 'static> EventLoop<T> {
};
}
WindowRequest::WireUpEvents => {
// resizing `decorations: false` aka borderless
// Resizing `decorations: false` aka borderless
window.add_events(
EventMask::POINTER_MOTION_MASK
| EventMask::BUTTON1_MOTION_MASK
Expand All @@ -329,7 +329,6 @@ impl<T: 'static> EventLoop<T> {
if let Some(window) = window.window() {
let (cx, cy) = event.root();
let edge = hit_test(&window, cx, cy);
// FIXME: calling `window.begin_resize_drag` seems to revert the cursor back to normal style
window.set_cursor(
Cursor::from_name(
&window.display(),
Expand Down Expand Up @@ -358,10 +357,11 @@ impl<T: 'static> EventLoop<T> {
let (cx, cy) = event.root();
let result = hit_test(&window, cx, cy);

// we ignore the `__Unknown` variant so the window receives the click correctly if it is not on the edges.
// Ignore the `__Unknown` variant so the window receives the click correctly if it is not on the edges.
match result {
WindowEdge::__Unknown(_) => (),
_ => {
// FIXME: calling `window.begin_resize_drag` uses the default cursor, it should show a resizing cursor instead
window.begin_resize_drag(result, 1, cx as i32, cy as i32, event.time())
}
}
Expand All @@ -378,7 +378,7 @@ impl<T: 'static> EventLoop<T> {
if let Some(device) = event.device() {
let result = hit_test(&window, cx, cy);

// we ignore the `__Unknown` variant so the window receives the click correctly if it is not on the edges.
// Ignore the `__Unknown` variant so the window receives the click correctly if it is not on the edges.
match result {
WindowEdge::__Unknown(_) => (),
_ => window.begin_resize_drag_for_device(
Expand Down
2 changes: 1 addition & 1 deletion src/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1060,4 +1060,4 @@ impl Default for UserAttentionType {
}

/// A constant used to determine how much inside the window, the resize handler should appear (only used in Linux(gtk) and Windows).
pub const BORDERLESS_RESIZE_INSET: i32 = 3;
pub const BORDERLESS_RESIZE_INSET: i32 = 5;