catch and release mouse in windowed mode

Linux specific forum
User avatar
Brujah
Enthusiast
Enthusiast
Posts: 237
Joined: Mon Nov 03, 2003 7:45 pm
Location: Germany
Contact:

catch and release mouse in windowed mode

Post 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 :(
gavindi
User
User
Posts: 41
Joined: Mon Jan 21, 2013 12:57 am

Re: catch and release mouse in windowed mode

Post 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.
Using Ubuntu 14.04 x64, Intel4700HD Graphics, 16GB RAM
Post Reply