code: def handle_button(self, event, event_type):
          
          # 0 for left
          # 1 for right
          # 2 for middle/center
          # 3 for side
          mouse_button_number = self._get_mouse_button_number(event)
  
          # Identify buttons 3,4,5
          if event_type in (25, 26):
              event_type = event_type + (mouse_button_number * 0.1)
  
          # Add buttons to events
          event_type_string, event_code, value, scan = self.codes[event_type]
          if event_type_string == "Key":
              scan_event, key_event = self.emulate_press(
                  event_code, scan, value, self.timeval)
              self.events.append(scan_event)
              self.events.append(key_event)
  
          # doubleclick/n-click of button
          click_state = self._get_click_state(event)
  
          repeat = self.emulate_repeat(click_state, self.timeval)
          self.events.append(repeat)
docs: Convert the button information from quartz into evdev format.