mirror of
https://github.com/kunkundi/crossdesk.git
synced 2026-07-29 11:18:40 +08:00
fix: block remote mouse input over control bar
This commit is contained in:
@@ -508,7 +508,10 @@ export component StreamWindow inherits Window {
|
|||||||
&& (event.kind == PointerEventKind.up
|
&& (event.kind == PointerEventKind.up
|
||||||
|| event.kind == PointerEventKind.cancel) {
|
|| event.kind == PointerEventKind.cancel) {
|
||||||
root.end-control-drag();
|
root.end-control-drag();
|
||||||
} else if !root.control-dragging {
|
// The control bar overlays the remote video. Events in
|
||||||
|
// its full rectangle (including gaps between buttons)
|
||||||
|
// are local UI input and must never reach the peer.
|
||||||
|
} else if !root.control-dragging && !over-control {
|
||||||
root.pointer-input(event.button, event.kind, self.mouse-x, self.mouse-y);
|
root.pointer-input(event.button, event.kind, self.mouse-x, self.mouse-y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ std::filesystem::path FindRepoRoot() {
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string ReadFile(const std::filesystem::path &path) {
|
std::string ReadFile(const std::filesystem::path& path) {
|
||||||
std::ifstream file(path, std::ios::binary);
|
std::ifstream file(path, std::ios::binary);
|
||||||
if (!file) {
|
if (!file) {
|
||||||
return {};
|
return {};
|
||||||
@@ -28,8 +28,8 @@ std::string ReadFile(const std::filesystem::path &path) {
|
|||||||
return stream.str();
|
return stream.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ExpectContains(const char *name, const std::string &value,
|
bool ExpectContains(const char* name, const std::string& value,
|
||||||
const std::string &expected) {
|
const std::string& expected) {
|
||||||
if (value.find(expected) != std::string::npos) {
|
if (value.find(expected) != std::string::npos) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -37,8 +37,8 @@ bool ExpectContains(const char *name, const std::string &value,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ExpectNotContains(const char *name, const std::string &value,
|
bool ExpectNotContains(const char* name, const std::string& value,
|
||||||
const std::string &unexpected) {
|
const std::string& unexpected) {
|
||||||
if (value.find(unexpected) == std::string::npos) {
|
if (value.find(unexpected) == std::string::npos) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -46,8 +46,8 @@ bool ExpectNotContains(const char *name, const std::string &value,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ExpectContainsAtLeast(const char *name, const std::string &value,
|
bool ExpectContainsAtLeast(const char* name, const std::string& value,
|
||||||
const std::string &expected, size_t min_count) {
|
const std::string& expected, size_t min_count) {
|
||||||
size_t count = 0;
|
size_t count = 0;
|
||||||
size_t pos = 0;
|
size_t pos = 0;
|
||||||
while ((pos = value.find(expected, pos)) != std::string::npos) {
|
while ((pos = value.find(expected, pos)) != std::string::npos) {
|
||||||
@@ -62,7 +62,7 @@ bool ExpectContainsAtLeast(const char *name, const std::string &value,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
const std::filesystem::path repo_root = FindRepoRoot();
|
const std::filesystem::path repo_root = FindRepoRoot();
|
||||||
@@ -84,14 +84,16 @@ int main() {
|
|||||||
"root.shortcut-menu-open = false;");
|
"root.shortcut-menu-open = false;");
|
||||||
ok &= ExpectContains("stream_window.slint", stream,
|
ok &= ExpectContains("stream_window.slint", stream,
|
||||||
"if root.display-menu-open: Rectangle");
|
"if root.display-menu-open: Rectangle");
|
||||||
ok &= ExpectContains("stream_window.slint", stream,
|
ok &=
|
||||||
"display-touch.has-hover");
|
ExpectContains("stream_window.slint", stream, "display-touch.has-hover");
|
||||||
ok &= ExpectContains("stream_window.slint", stream,
|
ok &= ExpectContains("stream_window.slint", stream,
|
||||||
"root.switch-display(index)");
|
"root.switch-display(index)");
|
||||||
ok &= ExpectContains("stream_window.slint", stream,
|
ok &= ExpectContains("stream_window.slint", stream,
|
||||||
"if root.shortcut-menu-open: Rectangle");
|
"if root.shortcut-menu-open: Rectangle");
|
||||||
|
ok &=
|
||||||
|
ExpectContains("stream_window.slint", stream, "shortcut-touch.has-hover");
|
||||||
ok &= ExpectContains("stream_window.slint", stream,
|
ok &= ExpectContains("stream_window.slint", stream,
|
||||||
"shortcut-touch.has-hover");
|
"} else if !root.control-dragging && !over-control {");
|
||||||
|
|
||||||
ok &= ExpectContains("common.slint", common,
|
ok &= ExpectContains("common.slint", common,
|
||||||
"if touch.has-hover && root.tooltip != \"\": Rectangle");
|
"if touch.has-hover && root.tooltip != \"\": Rectangle");
|
||||||
@@ -100,32 +102,38 @@ int main() {
|
|||||||
"tooltip: StreamStrings.select-display");
|
"tooltip: StreamStrings.select-display");
|
||||||
ok &= ExpectContains("stream_window.slint", stream,
|
ok &= ExpectContains("stream_window.slint", stream,
|
||||||
"tooltip: StreamStrings.send-shortcut");
|
"tooltip: StreamStrings.send-shortcut");
|
||||||
ok &= ExpectContains("stream_window.slint", stream,
|
ok &=
|
||||||
"root.mouse-control-enabled ? StreamStrings.release-mouse : StreamStrings.control-mouse");
|
ExpectContains("stream_window.slint", stream,
|
||||||
ok &= ExpectContains("stream_window.slint", stream,
|
"root.mouse-control-enabled ? StreamStrings.release-mouse "
|
||||||
"root.audio-enabled ? StreamStrings.mute : StreamStrings.audio");
|
": StreamStrings.control-mouse");
|
||||||
|
ok &= ExpectContains(
|
||||||
|
"stream_window.slint", stream,
|
||||||
|
"root.audio-enabled ? StreamStrings.mute : StreamStrings.audio");
|
||||||
ok &= ExpectContains("stream_window.slint", stream,
|
ok &= ExpectContains("stream_window.slint", stream,
|
||||||
"tooltip: StreamStrings.select-file");
|
"tooltip: StreamStrings.select-file");
|
||||||
ok &= ExpectContains("stream_window.slint", stream,
|
ok &= ExpectContains("stream_window.slint", stream,
|
||||||
"root.stats-visible ? StreamStrings.hide-stats : StreamStrings.show-stats");
|
"root.stats-visible ? StreamStrings.hide-stats : "
|
||||||
ok &= ExpectContains("stream_window.slint", stream,
|
"StreamStrings.show-stats");
|
||||||
"root.fullscreen-enabled ? StreamStrings.exit-fullscreen : StreamStrings.fullscreen");
|
ok &=
|
||||||
|
ExpectContains("stream_window.slint", stream,
|
||||||
|
"root.fullscreen-enabled ? StreamStrings.exit-fullscreen "
|
||||||
|
": StreamStrings.fullscreen");
|
||||||
ok &= ExpectContains("stream_window.slint", stream,
|
ok &= ExpectContains("stream_window.slint", stream,
|
||||||
"tooltip: StreamStrings.disconnect");
|
"tooltip: StreamStrings.disconnect");
|
||||||
ok &= ExpectContains("stream_window.slint", stream,
|
ok &= ExpectContains("stream_window.slint", stream,
|
||||||
"root.control-expanded ? StreamStrings.collapse-control : StreamStrings.expand-control");
|
"root.control-expanded ? StreamStrings.collapse-control "
|
||||||
|
": StreamStrings.expand-control");
|
||||||
|
|
||||||
ok &= ExpectContains("gui_application.cpp", application,
|
ok &=
|
||||||
"set_select_display(");
|
ExpectContains("gui_application.cpp", application, "set_select_display(");
|
||||||
ok &= ExpectContains("gui_application.cpp", application,
|
ok &= ExpectContains("gui_application.cpp", application, "set_show_stats(");
|
||||||
"set_show_stats(");
|
ok &=
|
||||||
ok &= ExpectContains("gui_application.cpp", application,
|
ExpectContains("gui_application.cpp", application, "set_expand_control(");
|
||||||
"set_expand_control(");
|
|
||||||
ok &= ExpectContains("gui_application.cpp", application,
|
ok &= ExpectContains("gui_application.cpp", application,
|
||||||
"set_collapse_control(");
|
"set_collapse_control(");
|
||||||
ok &= ExpectContains("gui_application.cpp", application,
|
ok &= ExpectContains("gui_application.cpp", application,
|
||||||
"(*ui_->stream)->global<ui::StreamStrings>()");
|
"(*ui_->stream)->global<ui::StreamStrings>()");
|
||||||
ok &= ExpectNotContains("gui_application.cpp", application,
|
ok &=
|
||||||
"#include <imgui");
|
ExpectNotContains("gui_application.cpp", application, "#include <imgui");
|
||||||
return ok ? 0 : 1;
|
return ok ? 0 : 1;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user