event_transformation_handler.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // Copyright (c) 2013 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 ASH_DISPLAY_EVENT_TRANSFORMATION_HANDLER_H_
  5. #define ASH_DISPLAY_EVENT_TRANSFORMATION_HANDLER_H_
  6. #include "ash/ash_export.h"
  7. #include "base/compiler_specific.h"
  8. #include "ui/events/event_handler.h"
  9. namespace ash {
  10. // An event filter that transforms input event properties in extended desktop
  11. // environment.
  12. class ASH_EXPORT EventTransformationHandler : public ui::EventHandler {
  13. public:
  14. enum TransformationMode {
  15. TRANSFORM_AUTO, // Transform events by the default amount.
  16. // 1. Linear scaling w.r.t. the device scale factor.
  17. // 2. Add 20% more for non-integrated displays.
  18. TRANSFORM_NONE, // No transformation.
  19. };
  20. EventTransformationHandler();
  21. EventTransformationHandler(const EventTransformationHandler&) = delete;
  22. EventTransformationHandler& operator=(const EventTransformationHandler&) =
  23. delete;
  24. ~EventTransformationHandler() override;
  25. void set_transformation_mode(TransformationMode transformation_mode) {
  26. transformation_mode_ = transformation_mode;
  27. }
  28. // Overridden from ui::EventHandler.
  29. void OnScrollEvent(ui::ScrollEvent* event) override;
  30. private:
  31. TransformationMode transformation_mode_;
  32. };
  33. } // namespace ash
  34. #endif // ASH_DISPLAY_EVENT_TRANSFORMATION_HANDLER_H_