No mouseenter mouseleave events [Linux]
Archives Forums/BlitzMax Bug Reports/No mouseenter mouseleave events [Linux]
| ||
This is in response to a post here http://www.blitzmax.com/Community/posts.php?topic=96561 where mouseenter mouseleave events don't work in linux. Just comment the 2 lines saying "comment this line to test mouseenter/leave bug". You should see a value of 1 for 'inWindow' and 2 added to 'mouseadd' every time the mouse enters the window. Also, a PollSystem was needed just before Flip for the screen to update in linux. MoveMouse seems to be the cause. I have ubuntu 10.4 lucid, with max 1.45. Strict Local ScreenWidth:Int = 240, ScreenHeight:Int = 320 Graphics ScreenWidth*2, ScreenHeight*2 SetVirtualResolution ScreenWidth, ScreenHeight Local myX:Int, myY:Int Local CenterX:Int = ScreenWidth / 2 Local CenterY:Int = ScreenHeight / 2 Local inWindow:Int = False, mouseadd:Int ' bug in linux: mouseadd should add 2 when move mouse into window MoveMouse CenterX, CenterY HideMouse() ' comment this line to test mouseenter/leave bug While Not KeyDown (KEY_ESCAPE) Cls DrawText inWindow+" "+mouseadd+" "+myX+" "+myY,0,0 ' debug text Select WaitEvent() End Select Select EventID() Case EVENT_APPSUSPEND, EVENT_MOUSELEAVE inWindow = False mouseadd:+1 Case EVENT_MOUSEENTER inWindow = True mouseadd:+1 End Select ' If (inWindow) Then myX:+(MouseX() - CenterX) myY:+(MouseY() - CenterY) MoveMouse CenterX, CenterY ' comment this line to test mouseenter/leave bug ' EndIf If myX < 0 Then myX = 0 If myX > ScreenWidth - 1 Then myX = ScreenWidth - 1 If myY < 0 Then myY = 0 If myY > ScreenHeight - 1 Then myY = ScreenHeight - 1 SetColor 0, 255, 0 DrawRect myX - 10, myY - 10, 20, 20 SetColor 255, 255, 255 Plot myX, myY PollSystem() ' needed just before flip in linux to update screen Flip Wend Last edited 2011 Last edited 2011 |
| ||
Thanks for reporting this mark |