Skip to content

Commit

Permalink
fix: increase borderless resizing inset (#202)
Browse files Browse the repository at this point in the history
* fix: increase borderless resizing inset

* update some comments
  • Loading branch information
amrbashir authored Sep 1, 2021
1 parent c24593d commit 61e92fd
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
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;

0 comments on commit 61e92fd

Please sign in to comment.