Mouse remains "stuck" in window mode - please help

Archives Forums/MacOS X Discussion/Mouse remains "stuck" in window mode - please help

Ravl(Posted 2013) [#1]
Hello guys,

Initially I posted that I lost the focus of my window on MacOS when switching from fullscreen to windowmode. I was not able to find a solution here so I made some tests.

I observed that after I switch to window mode, my MouseX() and MouseY() remains "stuck". I can move my cursor on screen with no problems.

Also if I am clicking and keep the mouse button clicked the Mouse coordonates will update, but as soon I release the mouse button the X and Y will remain again stuck. I have to click outside the game window and then again in the game window to receive the full control. also this is happening ONLY ONCE. after that I can switch to fullscreen and windowmode with no other problems.

here it's my code:
				If (MouseX() >= 589 + TGlobals.videoX And MouseX() <= 619 + TGlobals.videoX)
				If (MouseY() >= 496 + TGlobals.videoY And MouseY() <= 524 + TGlobals.videoY)
				
					If TGlobals.mySettings.settingsFullscreen = 0						
						TGlobals.mySettings.settingsFullscreen = 1
					ElseIf TGlobals.mySettings.settingsFullscreen = 1						
						TGlobals.mySettings.settingsFullscreen = 0
					End If
					
					If TGlobals.mySettings.settingsFullscreen = 1
					        EndGraphics()
						Graphics TGlobals.desktopVideoX, TGlobals.desktopVideoY, 32
						
						TGlobals.videoX = TGlobals.desktopVideoX / 2 - 640
						TGlobals.videoY = TGlobals.desktopVideoY / 2 - 384						
						
					Else
						
						EndGraphics()
						
						TGlobals.videoX = 0
						TGlobals.videoY = 0

						Graphics 1280, 768, 0
						
						'check now if the desktop res is not good enough
						If TGlobals.desktopVideoY <= 800
							menuState = "warning"
						End If						
						
					End If				
				
					
					FlushMouse()
					Return
				End If				
				End If



GfK(Posted 2013) [#2]
Had this one myself.

Apparently (and I haven't tried), this only happens when running your program from the IDE.

Before I found that out, I'd already discovered a work-around. At the start of your game, do the following:
Graphics 1,1,0

This will open a tiny window, thus starting your app in Windowed mode - and this is the key point. After that, just go into fullscreen mode or whatever as normal, and all should be well.

[edit] Just saw your other thread - my game sailed through BFG's QA with the above fix.

Last edited 2013


Ravl(Posted 2013) [#3]
Hi Gfk,

just discovered (again) this thread: http://www.blitzbasic.com/Community/posts.php?topic=99166

I done your trick and send them the new build.

Thank you man,