blob: b210c04fba7c09953fdfc77f38610de00870f138 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef ASH_TOUCH_TOUCH_TRANSFORMER_CONTROLLER_H_
#define ASH_TOUCH_TOUCH_TRANSFORMER_CONTROLLER_H_
#include "ash/ash_export.h"
#include "ash/display/display_controller.h"
#include "ui/gfx/transform.h"
namespace ui {
struct TouchscreenDevice;
} // namespace ui
namespace ash {
// TouchTransformerController listens to display configuration change
// and updates the touch transformation for touch displays.
class ASH_EXPORT TouchTransformerController
: public DisplayController::Observer {
public:
TouchTransformerController();
virtual ~TouchTransformerController();
// Updates the TouchTransformer for touch device and pushes the new
// TouchTransformer into device manager.
void UpdateTouchTransformer() const;
// DisplayController::Observer:
virtual void OnDisplaysInitialized() override;
virtual void OnDisplayConfigurationChanged() override;
private:
FRIEND_TEST_ALL_PREFIXES(TouchTransformerControllerTest,
TouchTransformerMirrorModeLetterboxing);
FRIEND_TEST_ALL_PREFIXES(TouchTransformerControllerTest,
TouchTransformerMirrorModePillarboxing);
FRIEND_TEST_ALL_PREFIXES(TouchTransformerControllerTest,
TouchTransformerExtendedMode);
FRIEND_TEST_ALL_PREFIXES(TouchTransformerControllerTest,
TouchRadiusScale);
// Returns a transform that will be used to change an event's location from
// the touchscreen's coordinate system into the display's coordinate system.
// The transform is also responsible for properly scaling the display if the
// display support panel fitting.
//
// On X11 events are reported in framebuffer coordinate space, so the
// |framebuffer_size| is used for scaling.
// On Ozone events are reported in the touchscreen's resolution, so
// |touchscreen| is used to determine the size and scale the event.
gfx::Transform GetTouchTransform(
const DisplayInfo& display,
const ui::TouchscreenDevice& touchscreen,
const gfx::Size& framebuffer_size) const;
// Returns the scaling factor for the touch radius such that it scales the
// radius from |touch_device|'s coordiante system to the |touch_display|'s
// coordinate system.
double GetTouchResolutionScale(
const DisplayInfo& touch_display,
const ui::TouchscreenDevice& touch_device) const;
DISALLOW_COPY_AND_ASSIGN(TouchTransformerController);
};
} // namespace ash
#endif // ASH_TOUCH_TOUCH_TRANSFORMER_CONTROLLER_H_
|