| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <X11/keysym.h> | 5 #include <X11/keysym.h> |
| 6 #include <X11/Xlib.h> | 6 #include <X11/Xlib.h> |
| 7 | 7 |
| 8 // X macro fail. | 8 // X macro fail. |
| 9 #if defined(RootWindow) | 9 #if defined(RootWindow) |
| 10 #undef RootWindow | 10 #undef RootWindow |
| 11 #endif | 11 #endif |
| 12 | 12 |
| 13 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "base/message_pump_aurax11.h" | 14 #include "base/message_pump_aurax11.h" |
| 15 #include "ui/aura/desktop_ui_controls.h" |
| 15 #include "ui/aura/root_window.h" | 16 #include "ui/aura/root_window.h" |
| 16 #include "ui/aura/ui_controls_aura.h" | |
| 17 #include "ui/base/keycodes/keyboard_code_conversion_x.h" | 17 #include "ui/base/keycodes/keyboard_code_conversion_x.h" |
| 18 #include "ui/compositor/dip_util.h" | 18 #include "ui/compositor/dip_util.h" |
| 19 #include "ui/ui_controls/ui_controls_aura.h" | 19 #include "ui/ui_controls/ui_controls.h" |
| 20 | 20 |
| 21 namespace aura { | 21 namespace aura { |
| 22 namespace { | 22 namespace { |
| 23 | 23 |
| 24 // Mask of the buttons currently down. | 24 // Mask of the buttons currently down. |
| 25 unsigned button_down_mask = 0; | 25 unsigned button_down_mask = 0; |
| 26 | 26 |
| 27 // Event waiter executes the specified closure|when a matching event | 27 // Event waiter executes the specified closure|when a matching event |
| 28 // is found. | 28 // is found. |
| 29 // TODO(oshima): Move this to base. | 29 // TODO(oshima): Move this to base. |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 "marker_event", | 70 "marker_event", |
| 71 False); | 71 False); |
| 72 } | 72 } |
| 73 | 73 |
| 74 // Returns true when the event is a marker event. | 74 // Returns true when the event is a marker event. |
| 75 bool Matcher(const base::NativeEvent& event) { | 75 bool Matcher(const base::NativeEvent& event) { |
| 76 return event->xany.type == ClientMessage && | 76 return event->xany.type == ClientMessage && |
| 77 event->xclient.message_type == MarkerEventAtom(); | 77 event->xclient.message_type == MarkerEventAtom(); |
| 78 } | 78 } |
| 79 | 79 |
| 80 class UIControlsX11 : public ui_controls::UIControlsAura { | 80 class UIControlsX11 : public ui_controls::UIControls { |
| 81 public: | 81 public: |
| 82 UIControlsX11(RootWindow* root_window) : root_window_(root_window) { | 82 explicit UIControlsX11(RootWindow* root_window) : root_window_(root_window) { |
| 83 } | 83 } |
| 84 virtual ~UIControlsX11() {} |
| 84 | 85 |
| 85 virtual bool SendKeyPress(gfx::NativeWindow window, | 86 virtual bool SendKeyPress(gfx::NativeWindow window, |
| 86 ui::KeyboardCode key, | 87 ui::KeyboardCode key, |
| 87 bool control, | 88 bool control, |
| 88 bool shift, | 89 bool shift, |
| 89 bool alt, | 90 bool alt, |
| 90 bool command) { | 91 bool command) { |
| 91 DCHECK(!command); // No command key on Aura | 92 DCHECK(!command); // No command key on Aura |
| 92 return SendKeyPressNotifyWhenDone( | 93 return SendKeyPressNotifyWhenDone( |
| 93 window, key, control, shift, alt, command, base::Closure()); | 94 window, key, control, shift, alt, command, base::Closure()); |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 root_window_->PostNativeEvent(xevent); | 230 root_window_->PostNativeEvent(xevent); |
| 230 } | 231 } |
| 231 | 232 |
| 232 RootWindow* root_window_; | 233 RootWindow* root_window_; |
| 233 | 234 |
| 234 DISALLOW_COPY_AND_ASSIGN(UIControlsX11); | 235 DISALLOW_COPY_AND_ASSIGN(UIControlsX11); |
| 235 }; | 236 }; |
| 236 | 237 |
| 237 } // namespace | 238 } // namespace |
| 238 | 239 |
| 239 ui_controls::UIControlsAura* CreateUIControlsAura(RootWindow* root_window) { | 240 ui_controls::UIControls* CreateDesktopUIControls(RootWindow* root_window) { |
| 240 return new UIControlsX11(root_window); | 241 return new UIControlsX11(root_window); |
| 241 } | 242 } |
| 242 | 243 |
| 243 } // namespace aura | 244 } // namespace aura |
| OLD | NEW |