sdlterm/cython/sdlterm.pyx
changeset 71 cfd3445107b4
parent 69 4e7be77bafff
child 73 85a282b5e4fc
equal deleted inserted replaced
70:db2eab0beb45 71:cfd3445107b4
    15         Py_UNICODE unicode
    15         Py_UNICODE unicode
    16         int mod
    16         int mod
    17 
    17 
    18     cdef struct Event_mouse:
    18     cdef struct Event_mouse:
    19         int x, y
    19         int x, y
       
    20         int relx, rely
    20         int button
    21         int button
    21 
    22 
    22     cdef struct Event:
    23     cdef struct Event:
    23         # enum
    24         # enum
    24         int QUIT
    25         int QUIT
    90         if not self.thisptr.wait_event(self.event, timeout or 0):
    91         if not self.thisptr.wait_event(self.event, timeout or 0):
    91             # timeout
    92             # timeout
    92             return None
    93             return None
    93         event = self.event
    94         event = self.event
    94         if event.type == event.MOUSEMOVE:
    95         if event.type == event.MOUSEMOVE:
    95             return ('mousemove', event.mouse.x, event.mouse.y)
    96             return ('mousemove', 0, event.mouse.x, event.mouse.y, event.mouse.relx, event.mouse.rely)
    96         if event.type == event.MOUSEDOWN:
    97         if event.type == event.MOUSEDOWN:
    97             return ('mousedown', event.mouse.x, event.mouse.y, event.mouse.button)
    98             return ('mousedown', event.mouse.button, event.mouse.x, event.mouse.y)
    98         if event.type == event.MOUSEUP:
    99         if event.type == event.MOUSEUP:
    99             return ('mouseup', event.mouse.x, event.mouse.y, event.mouse.button)
   100             return ('mouseup', event.mouse.button, event.mouse.x, event.mouse.y)
   100         if event.type == event.MOUSEWHEEL:
   101         if event.type == event.MOUSEWHEEL:
   101             return ('mousewheel', event.mouse.x, event.mouse.y, event.mouse.button)
   102             return ('mousewheel', event.mouse.button, event.mouse.x, event.mouse.y)
   102         if event.type == event.KEYPRESS:
   103         if event.type == event.KEYPRESS:
   103             keyname = event.key.keyname
   104             keyname = event.key.keyname
   104             if keyname:
   105             if keyname:
   105                 keyname = keyname.decode()
   106                 keyname = keyname.decode()
   106             else:
   107             else: