Page 1 of 1

catch and release mouse in windowed mode

Posted: Fri Apr 01, 2011 5:23 pm
by Brujah
We would like to free the mouse when its outside the playing window. And catch it again when its back over the window.

In WIndows it works like this:

Code: Select all

Procedure Fenster(typ=0)

  Shared released, windowsfenster

  If windowsfenster Or typ
    If WindowEvent()=#PB_Event_CloseWindow
      End
    EndIf
    If Not typ
      x=WindowMouseX(0)
      y=WindowMouseY(0)
      If x<1 Or x>638 Or y<1 Or y>478
        If released=0
          released=1
          ReleaseMouse(1)
        EndIf
      Else
        If released=1
          released=0
          ReleaseMouse(0)
          MouseLocate(x, y)
        EndIf
      EndIf
    EndIf
  EndIf


EndProcedure
But how do we achieve this in Linux?
WindowMouseX and Y do not contain the real coordinates it seems :(

Re: catch and release mouse in windowed mode

Posted: Tue Feb 19, 2013 8:59 am
by gavindi
I'd be keen to learn how to do this also so I'm giving this a bump in case someone now knows.