Mouse events

Linux specific forum
Joubarbe
Enthusiast
Enthusiast
Posts: 714
Joined: Wed Sep 18, 2013 11:54 am
Location: France

Mouse events

Post by Joubarbe »

Hey,

In Windows, I'm used to have a windowed screen and a loop to check mouse events. I don't use the Mouse library, so I check these events :

#WM_LBUTTONDOWN, #WM_LBUTTONUP, #WM_RBUTTONDOWN, #WM_RBUTTONUP, #WM_MBUTTONDOWN, #WM_MBUTTONUP

And for the mouse wheel : #WM_MOUSEWHEEL, with the following code :

Code: Select all

  Procedure.l MouseWheelDelta()
    Define wz.l
    
    wz = ((EventwParam() >> 16) & $FFFF)
    ProcedureReturn -(wz/100)
  EndProcedure

Code: Select all

    If event = #WM_MOUSEWHEEL
      If MouseWheelDelta() > -100
        scrollUp = 1
      ElseIf MouseWheelDelta() < -100
        scrollDown = 1
      EndIf
    ElseIf scrollUp Or scrollDown
      scrollUp = 0
      scrollDown = 0
    EndIf
Are there any equivalences on Linux for these ?
User avatar
Shardik
Addict
Addict
Posts: 2067
Joined: Thu Apr 21, 2005 2:38 pm
Location: Germany

Re: Mouse events

Post by Shardik »

Have you already taken a look into my cross-platform example code which demonstrates how to detect mouse wheel movement inside a ListIconGadget?
Joubarbe
Enthusiast
Enthusiast
Posts: 714
Joined: Wed Sep 18, 2013 11:54 am
Location: France

Re: Mouse events

Post by Joubarbe »

Hmm, interesting. There's a #GDK_SCROLL_UP here that gives me hope :) Anyway, you use an EventType, do you know if such an event can also be triggered in a Screen, without gadget ?

The wheel is always a pain to work with ; but in fact, the most important stuff here would be to know how to get mouse "pushed" state. Once I get that, I'll get all I need. But PB doesn't have that natively :(
Post Reply