mirror of
https://github.com/JetSetIlly/Gopher2600.git
synced 2024-05-20 05:40:49 -04:00
fixed mouse capture on right-mouse click in playmode
broken in 7e1f1f when the playmode overlay was changed to a full size window fix required improvement to the detection of whether the mouse was hovering over a window (eg. prefs window, etc.)
This commit is contained in:
parent
8f2eb8753f
commit
a621b4fd04
|
@ -73,8 +73,8 @@ type manager struct {
|
|||
// proxy value
|
||||
screenPos imgui.Vec2
|
||||
|
||||
// is true if mouse is not over any of the playmode windows
|
||||
playmodeHover bool
|
||||
// is true if mouse over any of the playmode windows
|
||||
playmodeWindowHover bool
|
||||
|
||||
// for convenience the dbgScr window gets it's own field
|
||||
//
|
||||
|
@ -152,13 +152,13 @@ func (wm *manager) draw() {
|
|||
case govern.ModePlay:
|
||||
// reset playmodeHover flag by default. it's only ever true if a window is open (and that
|
||||
// window is being hovered over)
|
||||
wm.playmodeHover = false
|
||||
wm.playmodeWindowHover = false
|
||||
|
||||
// playmode draws the screen and other windows that have been listed
|
||||
// as being safe to draw in playmode
|
||||
for _, w := range wm.playmodeWindows {
|
||||
_ = w.playmodeDraw()
|
||||
wm.playmodeHover = wm.playmodeHover || imgui.IsWindowHoveredV(imgui.HoveredFlagsAnyWindow)
|
||||
wm.playmodeWindowHover = wm.playmodeWindowHover || w.playmodeGeometry().hovered
|
||||
}
|
||||
case govern.ModeDebugger:
|
||||
// see commentary for screenPos in windowManager declaration
|
||||
|
|
|
@ -32,9 +32,11 @@ type window interface {
|
|||
id() string
|
||||
}
|
||||
|
||||
// size and position of the window. is embedded in playmodeWin and debuggerWin
|
||||
// interfaces. for window type that implent interfaces then windowGeom
|
||||
// method calls will need to disambiguate which geometry to use
|
||||
// information about the window, including window geometry
|
||||
//
|
||||
// is embedded in playmodeWin and debuggerWin interfaces. for window type that
|
||||
// implent interfaces then windowGeom method calls will need to disambiguate
|
||||
// which geometry to use
|
||||
type windowGeom struct {
|
||||
position imgui.Vec2
|
||||
size imgui.Vec2
|
||||
|
@ -42,6 +44,9 @@ type windowGeom struct {
|
|||
// whether the window is focused
|
||||
focused bool
|
||||
|
||||
// whether the window is hovered over with the mouse
|
||||
hovered bool
|
||||
|
||||
// whether the window should be raised on the next draw
|
||||
raise bool
|
||||
|
||||
|
@ -54,6 +59,7 @@ func (g *windowGeom) update() {
|
|||
g.position = imgui.WindowPos()
|
||||
g.size = imgui.WindowSize()
|
||||
g.focused = imgui.IsWindowFocused()
|
||||
g.hovered = imgui.IsWindowHovered()
|
||||
}
|
||||
|
||||
type playmodeWindow interface {
|
||||
|
|
|
@ -174,7 +174,7 @@ func (img *SdlImgui) Service() {
|
|||
}
|
||||
} else if img.isPlaymode() {
|
||||
// set mouse capture if mouse is not over a window
|
||||
if !img.wm.playmodeHover {
|
||||
if !img.wm.playmodeWindowHover {
|
||||
img.setCapture(true)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue