| 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 "ui/aura/window_tree_host_x11.h" | 5 #include "ui/aura/window_tree_host_x11.h" |
| 6 | 6 |
| 7 #include <strings.h> | 7 #include <strings.h> |
| 8 #include <X11/cursorfont.h> | 8 #include <X11/cursorfont.h> |
| 9 #include <X11/extensions/XInput2.h> | 9 #include <X11/extensions/XInput2.h> |
| 10 #include <X11/extensions/Xrandr.h> | 10 #include <X11/extensions/Xrandr.h> |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 xev->type == LeaveNotify || | 239 xev->type == LeaveNotify || |
| 240 xev->type == KeyPress || | 240 xev->type == KeyPress || |
| 241 xev->type == KeyRelease || | 241 xev->type == KeyRelease || |
| 242 xev->type == ButtonPress || | 242 xev->type == ButtonPress || |
| 243 xev->type == ButtonRelease || | 243 xev->type == ButtonRelease || |
| 244 xev->type == MotionNotify) { | 244 xev->type == MotionNotify) { |
| 245 switch (ui::EventTypeFromNative(xev)) { | 245 switch (ui::EventTypeFromNative(xev)) { |
| 246 case ui::ET_KEY_PRESSED: | 246 case ui::ET_KEY_PRESSED: |
| 247 case ui::ET_KEY_RELEASED: { | 247 case ui::ET_KEY_RELEASED: { |
| 248 ui::KeyEvent keydown_event(xev); | 248 ui::KeyEvent keydown_event(xev); |
| 249 SendEventToProcessor(&keydown_event); | 249 SendEventToSink(&keydown_event); |
| 250 break; | 250 break; |
| 251 } | 251 } |
| 252 case ui::ET_MOUSE_MOVED: | 252 case ui::ET_MOUSE_MOVED: |
| 253 case ui::ET_MOUSE_DRAGGED: | 253 case ui::ET_MOUSE_DRAGGED: |
| 254 case ui::ET_MOUSE_ENTERED: | 254 case ui::ET_MOUSE_ENTERED: |
| 255 case ui::ET_MOUSE_EXITED: | 255 case ui::ET_MOUSE_EXITED: |
| 256 case ui::ET_MOUSE_PRESSED: | 256 case ui::ET_MOUSE_PRESSED: |
| 257 case ui::ET_MOUSE_RELEASED: { | 257 case ui::ET_MOUSE_RELEASED: { |
| 258 ui::MouseEvent mouse_event(xev); | 258 ui::MouseEvent mouse_event(xev); |
| 259 if (xev->type == EnterNotify) { | 259 if (xev->type == EnterNotify) { |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 528 } | 528 } |
| 529 case ui::ET_MOUSEWHEEL: { | 529 case ui::ET_MOUSEWHEEL: { |
| 530 ui::MouseWheelEvent mouseev(xev); | 530 ui::MouseWheelEvent mouseev(xev); |
| 531 TranslateAndDispatchLocatedEvent(&mouseev); | 531 TranslateAndDispatchLocatedEvent(&mouseev); |
| 532 break; | 532 break; |
| 533 } | 533 } |
| 534 case ui::ET_SCROLL_FLING_START: | 534 case ui::ET_SCROLL_FLING_START: |
| 535 case ui::ET_SCROLL_FLING_CANCEL: | 535 case ui::ET_SCROLL_FLING_CANCEL: |
| 536 case ui::ET_SCROLL: { | 536 case ui::ET_SCROLL: { |
| 537 ui::ScrollEvent scrollev(xev); | 537 ui::ScrollEvent scrollev(xev); |
| 538 SendEventToProcessor(&scrollev); | 538 SendEventToSink(&scrollev); |
| 539 break; | 539 break; |
| 540 } | 540 } |
| 541 case ui::ET_KEY_PRESSED: | 541 case ui::ET_KEY_PRESSED: |
| 542 case ui::ET_KEY_RELEASED: { | 542 case ui::ET_KEY_RELEASED: { |
| 543 ui::KeyEvent key_event(xev); | 543 ui::KeyEvent key_event(xev); |
| 544 SendEventToProcessor(&key_event); | 544 SendEventToSink(&key_event); |
| 545 break; | 545 break; |
| 546 } | 546 } |
| 547 case ui::ET_UMA_DATA: | 547 case ui::ET_UMA_DATA: |
| 548 break; | 548 break; |
| 549 case ui::ET_UNKNOWN: | 549 case ui::ET_UNKNOWN: |
| 550 break; | 550 break; |
| 551 default: | 551 default: |
| 552 NOTREACHED(); | 552 NOTREACHED(); |
| 553 } | 553 } |
| 554 | 554 |
| 555 // If we coalesced an event we need to free its cookie. | 555 // If we coalesced an event we need to free its cookie. |
| 556 if (num_coalesced > 0) | 556 if (num_coalesced > 0) |
| 557 XFreeEventData(xev->xgeneric.display, &last_event.xcookie); | 557 XFreeEventData(xev->xgeneric.display, &last_event.xcookie); |
| 558 } | 558 } |
| 559 | 559 |
| 560 void WindowTreeHostX11::SetCursorInternal(gfx::NativeCursor cursor) { | 560 void WindowTreeHostX11::SetCursorInternal(gfx::NativeCursor cursor) { |
| 561 XDefineCursor(xdisplay_, xwindow_, cursor.platform()); | 561 XDefineCursor(xdisplay_, xwindow_, cursor.platform()); |
| 562 } | 562 } |
| 563 | 563 |
| 564 void WindowTreeHostX11::OnConfigureNotify() {} | 564 void WindowTreeHostX11::OnConfigureNotify() {} |
| 565 | 565 |
| 566 void WindowTreeHostX11::TranslateAndDispatchLocatedEvent( | 566 void WindowTreeHostX11::TranslateAndDispatchLocatedEvent( |
| 567 ui::LocatedEvent* event) { | 567 ui::LocatedEvent* event) { |
| 568 SendEventToProcessor(event); | 568 SendEventToSink(event); |
| 569 } | 569 } |
| 570 | 570 |
| 571 // static | 571 // static |
| 572 WindowTreeHost* WindowTreeHost::Create(const gfx::Rect& bounds_in_pixels) { | 572 WindowTreeHost* WindowTreeHost::Create(const gfx::Rect& bounds_in_pixels) { |
| 573 return new WindowTreeHostX11(bounds_in_pixels); | 573 return new WindowTreeHostX11(bounds_in_pixels); |
| 574 } | 574 } |
| 575 | 575 |
| 576 } // namespace aura | 576 } // namespace aura |
| OLD | NEW |