Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Side by Side Diff: remoting/client/touch_input_scaler.h

Issue 2903623002: Moving input related classes to the input folder. (Closed)
Patch Set: Hide gesture code from nacl. Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 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
5 #ifndef REMOTING_CLIENT_TOUCH_INPUT_SCALER_H_
6 #define REMOTING_CLIENT_TOUCH_INPUT_SCALER_H_
7
8 #include "base/macros.h"
9 #include "remoting/protocol/input_filter.h"
10 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h"
11
12 namespace remoting {
13
14 namespace protocol {
15 class TouchEvent;
16 } // namespace protocol
17
18 // Scales the touch input coordinates to host coordinates and clamps so
19 // that the values do not go outside the remote desktop.
20 // Also resizes the touch size.
21 class TouchInputScaler : public protocol::InputFilter {
22 public:
23 TouchInputScaler() = default;
24 explicit TouchInputScaler(InputStub* input_stub);
25 ~TouchInputScaler() override;
26
27 // Set input and output desktop sizes.
28 void set_input_size(const webrtc::DesktopSize& size) {
29 input_size_.set(size.width() - 1, size.height() - 1);
30 }
31 void set_output_size(const webrtc::DesktopSize& size) {
32 output_size_.set(size.width() - 1, size.height() - 1);
33 }
34
35 // protocol::InputStub interface.
36 void InjectTouchEvent(const protocol::TouchEvent& event) override;
37
38 private:
39 // Sizes for scaling and clamping coordinates and sizes.
40 // These hold the max-X,Y coordinates and not the actual width and height.
41 webrtc::DesktopSize input_size_;
42 webrtc::DesktopSize output_size_;
43
44 DISALLOW_COPY_AND_ASSIGN(TouchInputScaler);
45 };
46
47 } // namespace remoting
48
49 #endif // REMOTING_CLIENT_TOUCH_INPUT_SCALER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698