1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-31 22:00:03 -04:00

Fix dragging of custom_window_frame example on Windows (#4656)

* Related #4592 
* Closes #4647 

Fix dragging of custom_window_frame on Windows (re-edited)
This commit is contained in:
rustbasic
2024-06-19 23:19:41 +09:00
committed by GitHub
parent 52a8e11764
commit d9c5fb04ae
5 changed files with 5 additions and 27 deletions

View File

@@ -1284,18 +1284,10 @@ pub fn process_viewport_commands(
info: &mut ViewportInfo,
commands: impl IntoIterator<Item = ViewportCommand>,
window: &Window,
is_viewport_focused: bool,
actions_requested: &mut HashSet<ActionRequested>,
) {
for command in commands {
process_viewport_command(
egui_ctx,
window,
command,
info,
is_viewport_focused,
actions_requested,
);
process_viewport_command(egui_ctx, window, command, info, actions_requested);
}
}
@@ -1304,7 +1296,6 @@ fn process_viewport_command(
window: &Window,
command: ViewportCommand,
info: &mut ViewportInfo,
is_viewport_focused: bool,
actions_requested: &mut HashSet<ActionRequested>,
) {
crate::profile_function!();
@@ -1323,12 +1314,8 @@ fn process_viewport_command(
// Need to be handled elsewhere
}
ViewportCommand::StartDrag => {
// If `is_viewport_focused` is not checked on x11 the input will be permanently taken until the app is killed!
// TODO(emilk): check that the left mouse-button was pressed down recently,
// or we will have bugs on Windows.
// See https://github.com/emilk/egui/pull/1108
if is_viewport_focused {
// If `.has_focus()` is not checked on x11 the input will be permanently taken until the app is killed!
if window.has_focus() {
if let Err(err) = window.drag_window() {
log::warn!("{command:?}: {err}");
}