Example #1
0
 def _on_button_press_event(self, widget, event):
     """
     Save the pointer position.
     """
     if event.button == 1 and event.window == self.get_window():
         self.enable_drag_protection(True)
         sequence = InputSequence()
         sequence.init_from_button_event(event)
         self.handle_press(sequence, move_on_background=True)
         if self.is_moving():
             self.reset_drag_protection()  # force threshold
     return False
Example #2
0
    def _on_motion_notify_event(self, widget, event):
        """
        Move the window if the pointer has moved more than the DND threshold.
        """
        sequence = InputSequence()
        sequence.init_from_motion_event(event)
        self.handle_motion(sequence, fallback=True)
        self.set_drag_cursor_at((event.x, event.y))

        # start dwelling if nothing else is going on
        point = (event.x, event.y)
        hit = self.hit_test_move_resize(point)
        if hit is None:
            if (
                not self.is_drag_initiated()
                and not self._is_dwelling()
                and not self._no_more_dwelling
                and not config.is_hover_click_active()
            ):
                self._start_dwelling()
        else:
            self._stop_dwelling()  # allow resizing in peace

        return False