From 309f50f444906c12e1ed47d3ae238dfa00ace4f9 Mon Sep 17 00:00:00 2001 From: Chooooooo Date: Fri, 27 Sep 2024 02:39:54 +0900 Subject: [PATCH] fix: update code formatting --- .changes/improve-wayland-display.md | 8 +------- .changes/wayland-dragging-header.md | 5 +++++ .changes/wayland-resize-window.md | 5 +++++ .changes/wayland-titlebar.md | 5 +++++ src/platform_impl/linux/event_loop.rs | 2 +- src/platform_impl/linux/util.rs | 1 + src/platform_impl/linux/window.rs | 19 +++++++++++++------ 7 files changed, 31 insertions(+), 14 deletions(-) create mode 100644 .changes/wayland-dragging-header.md create mode 100644 .changes/wayland-resize-window.md create mode 100644 .changes/wayland-titlebar.md diff --git a/.changes/improve-wayland-display.md b/.changes/improve-wayland-display.md index 4d504711c7..cf6eb7c08e 100644 --- a/.changes/improve-wayland-display.md +++ b/.changes/improve-wayland-display.md @@ -2,10 +2,4 @@ "tao": patch --- -Changed the event handling for maximizing to process events sequentially to avoid "Error 71(Protocol error): dispatching to Wayland display". - -Added buttons for maximize and minimize in the Wayland title bar. - -Fixed an issue where the window was not resizing when dragging the window borders. - -Fixed an issue where the window was not moving when dragging the header bar area. +On Linux Wayland, changed the event handling for maximizing to process events sequentially to avoid "Error 71(Protocol error): dispatching to Wayland display". diff --git a/.changes/wayland-dragging-header.md b/.changes/wayland-dragging-header.md new file mode 100644 index 0000000000..348acafa37 --- /dev/null +++ b/.changes/wayland-dragging-header.md @@ -0,0 +1,5 @@ +--- +"tao": patch +--- + +On Linux Wayland, fixed an issue where the window was not moving when dragging the header bar area. \ No newline at end of file diff --git a/.changes/wayland-resize-window.md b/.changes/wayland-resize-window.md new file mode 100644 index 0000000000..0f749e8f13 --- /dev/null +++ b/.changes/wayland-resize-window.md @@ -0,0 +1,5 @@ +--- +"tao": patch +--- + +On Linux Wayland, fixed an issue where the window was not resizing when dragging the window borders. \ No newline at end of file diff --git a/.changes/wayland-titlebar.md b/.changes/wayland-titlebar.md new file mode 100644 index 0000000000..21b56871b7 --- /dev/null +++ b/.changes/wayland-titlebar.md @@ -0,0 +1,5 @@ +--- +"tao": patch +--- + +On Linux Wayland, added buttons for maximize and minimize in the title bar. diff --git a/src/platform_impl/linux/event_loop.rs b/src/platform_impl/linux/event_loop.rs index 983c38658b..60401e40ca 100644 --- a/src/platform_impl/linux/event_loop.rs +++ b/src/platform_impl/linux/event_loop.rs @@ -469,7 +469,7 @@ impl EventLoop { }); window.connect_button_press_event(move |window, event| { const LMB: u32 = 1; - if (is_wayland && window.is_decorated()) + if (is_wayland || !window.is_decorated()) && window.is_resizable() && !window.is_maximized() && event.button() == LMB diff --git a/src/platform_impl/linux/util.rs b/src/platform_impl/linux/util.rs index 222833b96d..af6699d9d8 100644 --- a/src/platform_impl/linux/util.rs +++ b/src/platform_impl/linux/util.rs @@ -100,6 +100,7 @@ impl WindowMaximizeProcess { self.step += 1; glib::ControlFlow::Continue } else { + //It should still revert to the previous resizable state. self.step = 2; glib::ControlFlow::Continue } diff --git a/src/platform_impl/linux/window.rs b/src/platform_impl/linux/window.rs index af66a38a28..05bd945604 100644 --- a/src/platform_impl/linux/window.rs +++ b/src/platform_impl/linux/window.rs @@ -109,12 +109,19 @@ impl Window { window.set_default_size(1, 1); window.resize(width, height); - let maximize_process = - util::WindowMaximizeProcess::new(window.clone(), attributes.maximized, attributes.resizable); - glib::idle_add_local_full(glib::Priority::HIGH_IDLE, move || { - let mut maximize_process = maximize_process.borrow_mut(); - maximize_process.next_step() - }); + if attributes.maximized { + let maximize_process = util::WindowMaximizeProcess::new( + window.clone(), + attributes.maximized, + attributes.resizable, + ); + glib::idle_add_local_full(glib::Priority::HIGH_IDLE, move || { + let mut maximize_process = maximize_process.borrow_mut(); + maximize_process.next_step() + }); + } else { + window.set_resizable(attributes.resizable); + } window.set_deletable(attributes.closable);