OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include <stdio.h> | 5 #include <stdio.h> |
6 #include <string> | 6 #include <string> |
7 | 7 |
8 #include "mojo/examples/sample_app/gles2_client_impl.h" | 8 #include "mojo/examples/sample_app/gles2_client_impl.h" |
9 #include "mojo/public/cpp/application/application_connection.h" | 9 #include "mojo/public/cpp/application/application_connection.h" |
10 #include "mojo/public/cpp/application/application_delegate.h" | 10 #include "mojo/public/cpp/application/application_delegate.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 assert(bounds); | 56 assert(bounds); |
57 mojo::SizePtr size(mojo::Size::New()); | 57 mojo::SizePtr size(mojo::Size::New()); |
58 size->width = bounds->width; | 58 size->width = bounds->width; |
59 size->height = bounds->height; | 59 size->height = bounds->height; |
60 gles2_client_->SetSize(*size); | 60 gles2_client_->SetSize(*size); |
61 } | 61 } |
62 | 62 |
63 virtual void OnEvent(mojo::EventPtr event, | 63 virtual void OnEvent(mojo::EventPtr event, |
64 const mojo::Callback<void()>& callback) MOJO_OVERRIDE { | 64 const mojo::Callback<void()>& callback) MOJO_OVERRIDE { |
65 assert(event); | 65 assert(event); |
66 if (event->location) | 66 if (event->location_data && event->location_data->in_view_location) |
67 gles2_client_->HandleInputEvent(*event); | 67 gles2_client_->HandleInputEvent(*event); |
68 callback.Run(); | 68 callback.Run(); |
69 } | 69 } |
70 | 70 |
71 private: | 71 private: |
72 scoped_ptr<GLES2ClientImpl> gles2_client_; | 72 scoped_ptr<GLES2ClientImpl> gles2_client_; |
73 mojo::NativeViewportPtr viewport_; | 73 mojo::NativeViewportPtr viewport_; |
74 | 74 |
75 DISALLOW_COPY_AND_ASSIGN(SampleApp); | 75 DISALLOW_COPY_AND_ASSIGN(SampleApp); |
76 }; | 76 }; |
77 | 77 |
78 } // namespace examples | 78 } // namespace examples |
79 | 79 |
80 namespace mojo { | 80 namespace mojo { |
81 | 81 |
82 // static | 82 // static |
83 ApplicationDelegate* ApplicationDelegate::Create() { | 83 ApplicationDelegate* ApplicationDelegate::Create() { |
84 return new examples::SampleApp(); | 84 return new examples::SampleApp(); |
85 } | 85 } |
86 | 86 |
87 } // namespace mojo | 87 } // namespace mojo |
OLD | NEW |