x11_move_loop.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. // Copyright 2014 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef UI_BASE_X_X11_MOVE_LOOP_H_
  5. #define UI_BASE_X_X11_MOVE_LOOP_H_
  6. #include "ui/gfx/native_widget_types.h"
  7. namespace ui {
  8. class X11Cursor;
  9. // Runs a nested run loop and grabs the mouse. This is used to implement
  10. // dragging.
  11. class X11MoveLoop {
  12. public:
  13. virtual ~X11MoveLoop() = default;
  14. // Runs the nested run loop. While the mouse is grabbed, use |cursor| as
  15. // the mouse cursor. Returns true if the move-loop is completed successfully.
  16. // If the pointer-grab fails, or the move-loop is canceled by the user (e.g.
  17. // by pressing escape), then returns false.
  18. virtual bool RunMoveLoop(bool can_grab_pointer,
  19. scoped_refptr<ui::X11Cursor> old_cursor,
  20. scoped_refptr<ui::X11Cursor> new_cursor) = 0;
  21. // Updates the cursor while the move loop is running.
  22. virtual void UpdateCursor(scoped_refptr<ui::X11Cursor> cursor) = 0;
  23. // Ends the move loop that's currently in progress.
  24. virtual void EndMoveLoop() = 0;
  25. };
  26. } // namespace ui
  27. #endif // UI_BASE_X_X11_MOVE_LOOP_H_