mirror of
https://github.com/spice2x/spice2x.github.io.git
synced 2026-08-02 06:40:42 -07:00
overlay: mouse-as-touch needs to check if subscreen window is active (#842)
## Link to GitHub Issue or related Pull Request, if one exists Fixes #840 ## Description of change Currently, for subscreen games, mouse events are still delivered even when the subscreen overlay window is not visible. Change this so that the subscreen overlay must be active and under the mouse cursor for the mouse-to-touch transformation to occur. Applies to both native and wintouchemu. ## Testing Needs to test everything again.. iidx: - [ ] full screen with overlay - [ ] single window with overlay - [ ] two window Test: mouse, poke, api, real touch screen sdvx: - [ ] full screen with overlay - [ ] windowed popn - [x] full screen with overlay - [x] window with overlay - [x] dedicated window gitadora - [x] single window with overlay - [x] dedicated sub window nostalgia - [x] fullscreen - [x] windowed test: poke wintouchemu - [ ] Do all of the above again with wintouchemu
This commit is contained in:
@@ -69,6 +69,7 @@ void overlay::Window::build() {
|
||||
|
||||
// check if active
|
||||
if (!this->active) {
|
||||
this->mouse_hovered = false;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -106,10 +107,18 @@ void overlay::Window::build() {
|
||||
// top spot. suppress that so only an explicit focus request (see below)
|
||||
// decides what comes to the front.
|
||||
const std::string window_id = this->title + "###" + to_string(this);
|
||||
if (ImGui::Begin(
|
||||
const bool build_contents = ImGui::Begin(
|
||||
window_id.c_str(),
|
||||
&this->active,
|
||||
this->flags | ImGuiWindowFlags_NoFocusOnAppearing)) {
|
||||
this->flags | ImGuiWindowFlags_NoFocusOnAppearing);
|
||||
|
||||
// keep the window hovered while its invisible input button is held during a drag
|
||||
this->mouse_hovered =
|
||||
ImGui::IsWindowHovered(
|
||||
ImGuiHoveredFlags_RootAndChildWindows |
|
||||
ImGuiHoveredFlags_AllowWhenBlockedByActiveItem);
|
||||
|
||||
if (build_contents) {
|
||||
|
||||
// window attributes - init_pos / init_size are only honored once
|
||||
// (ImGuiCond_Once), so compute them a single time instead of every frame
|
||||
@@ -154,6 +163,9 @@ void overlay::Window::build() {
|
||||
|
||||
} else {
|
||||
|
||||
// raw content does not have an ImGui window to hover
|
||||
this->mouse_hovered = false;
|
||||
|
||||
// add raw content
|
||||
this->build_content();
|
||||
}
|
||||
@@ -201,3 +213,7 @@ bool overlay::Window::get_active() {
|
||||
// now it depends on us
|
||||
return this->active;
|
||||
}
|
||||
|
||||
bool overlay::Window::is_mouse_hovered() {
|
||||
return this->mouse_hovered;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user