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

Side by Side Diff: remoting/ios/app/host_view_controller.mm

Issue 2891603002: [CRD iOS] Trackpad Input Mode (Closed)
Patch Set: Fix 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
« no previous file with comments | « remoting/client/ui/trackpad_input_strategy.cc ('k') | remoting/ios/client_gestures.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #if !defined(__has_feature) || !__has_feature(objc_arc) 5 #if !defined(__has_feature) || !__has_feature(objc_arc)
6 #error "This file requires ARC support." 6 #error "This file requires ARC support."
7 #endif 7 #endif
8 8
9 #import "remoting/ios/app/host_view_controller.h" 9 #import "remoting/ios/app/host_view_controller.h"
10 10
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 - (void)viewDidAppear:(BOOL)animated { 75 - (void)viewDidAppear:(BOOL)animated {
76 [super viewDidAppear:animated]; 76 [super viewDidAppear:animated];
77 GLKView* glView = (GLKView*)self.view; 77 GLKView* glView = (GLKView*)self.view;
78 glView.context = [_client.displayHandler GetEAGLContext]; 78 glView.context = [_client.displayHandler GetEAGLContext];
79 [_client.displayHandler onSurfaceCreated:glView]; 79 [_client.displayHandler onSurfaceCreated:glView];
80 80
81 // viewDidLayoutSubviews may be called before viewDidAppear, in which case 81 // viewDidLayoutSubviews may be called before viewDidAppear, in which case
82 // the surface is not ready to handle the transformation matrix. 82 // the surface is not ready to handle the transformation matrix.
83 // Call onSurfaceChanged here to cover that case. 83 // Call onSurfaceChanged here to cover that case.
84 [_client surfaceChanged:self.view.frame]; 84 [_client surfaceChanged:self.view.frame];
85
86 // TODO(yuweih): This should be loaded from and stored into user defaults.
87 _client.gestureInterpreter->SetInputMode(
88 remoting::GestureInterpreter::DIRECT_INPUT_MODE);
85 } 89 }
86 90
87 - (void)viewDidDisappear:(BOOL)animated { 91 - (void)viewDidDisappear:(BOOL)animated {
88 [super viewDidDisappear:animated]; 92 [super viewDidDisappear:animated];
89 [(GLKView*)self.view deleteDrawable]; 93 [(GLKView*)self.view deleteDrawable];
90 } 94 }
91 95
92 - (void)viewWillAppear:(BOOL)animated { 96 - (void)viewWillAppear:(BOOL)animated {
93 [super viewWillAppear:animated]; 97 [super viewWillAppear:animated];
94 98
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 handler:hideKeyboardHandler]]; 207 handler:hideKeyboardHandler]];
204 } else { 208 } else {
205 void (^showKeyboardHandler)(UIAlertAction*) = ^(UIAlertAction*) { 209 void (^showKeyboardHandler)(UIAlertAction*) = ^(UIAlertAction*) {
206 NSLog(@"Will show keyboard."); 210 NSLog(@"Will show keyboard.");
207 [self showKeyboard]; 211 [self showKeyboard];
208 }; 212 };
209 [alert addAction:[UIAlertAction actionWithTitle:@"Show Keyboard" 213 [alert addAction:[UIAlertAction actionWithTitle:@"Show Keyboard"
210 style:UIAlertActionStyleDefault 214 style:UIAlertActionStyleDefault
211 handler:showKeyboardHandler]]; 215 handler:showKeyboardHandler]];
212 } 216 }
217
218 remoting::GestureInterpreter::InputMode currentInputMode =
219 _client.gestureInterpreter->GetInputMode();
220 NSString* switchInputModeTitle =
221 currentInputMode == remoting::GestureInterpreter::DIRECT_INPUT_MODE
222 ? @"Trackpad Mode"
223 : @"Touch Mode";
224 void (^switchInputModeHandler)(UIAlertAction*) = ^(UIAlertAction*) {
225 _client.gestureInterpreter->SetInputMode(
226 currentInputMode == remoting::GestureInterpreter::DIRECT_INPUT_MODE
227 ? remoting::GestureInterpreter::TRACKPAD_INPUT_MODE
228 : remoting::GestureInterpreter::DIRECT_INPUT_MODE);
229 };
230 [alert addAction:[UIAlertAction actionWithTitle:switchInputModeTitle
231 style:UIAlertActionStyleDefault
232 handler:switchInputModeHandler]];
233
213 void (^disconnectHandler)(UIAlertAction*) = ^(UIAlertAction*) { 234 void (^disconnectHandler)(UIAlertAction*) = ^(UIAlertAction*) {
214 [_client disconnectFromHost]; 235 [_client disconnectFromHost];
215 [self dismissViewControllerAnimated:YES completion:nil]; 236 [self dismissViewControllerAnimated:YES completion:nil];
216 }; 237 };
217 [alert addAction:[UIAlertAction actionWithTitle:@"Disconnect" 238 [alert addAction:[UIAlertAction actionWithTitle:@"Disconnect"
218 style:UIAlertActionStyleCancel 239 style:UIAlertActionStyleCancel
219 handler:disconnectHandler]]; 240 handler:disconnectHandler]];
220 241
221 [self presentViewController:alert animated:YES completion:nil]; 242 [self presentViewController:alert animated:YES completion:nil];
222 } 243 }
223 244
224 @end 245 @end
OLDNEW
« no previous file with comments | « remoting/client/ui/trackpad_input_strategy.cc ('k') | remoting/ios/client_gestures.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698