Chromium Code Reviews| Index: aura/desktop_host_linux.cc |
| diff --git a/aura/desktop_host_linux.cc b/aura/desktop_host_linux.cc |
| index 746be03463b8629373faa18e072925c4a1d9dcad..f31c4e637191abd175c1447cac3053082812adcc 100644 |
| --- a/aura/desktop_host_linux.cc |
| +++ b/aura/desktop_host_linux.cc |
| @@ -5,6 +5,7 @@ |
| #include "aura/desktop_host.h" |
| #include "aura/desktop.h" |
| +#include "aura/event.h" |
| #include "base/message_loop.h" |
| #include "base/message_pump_x.h" |
| @@ -28,6 +29,7 @@ class DesktopHostLinux : public DesktopHost { |
| virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE; |
| virtual void Show() OVERRIDE; |
| virtual gfx::Size GetSize() OVERRIDE; |
| + virtual void SetSize(const gfx::Size& size) OVERRIDE; |
| Desktop* desktop_; |
| @@ -68,13 +70,25 @@ DesktopHostLinux::~DesktopHostLinux() { |
| base::MessagePumpDispatcher::DispatchStatus DesktopHostLinux::Dispatch( |
| XEvent* xev) { |
| - // TODO(sad): Create events and dispatch to the appropriate window. |
| + bool handled = false; |
| switch (xev->type) { |
| case Expose: |
| desktop_->Draw(); |
| + handled = true; |
| break; |
| + case KeyPress: |
| + case KeyRelease: { |
| + KeyEvent keyev(xev); |
| + handled = desktop_->OnKeyEvent(keyev); |
| + } |
|
sky
2011/09/04 16:01:48
break
sadrul
2011/09/04 18:14:13
Doh! Done
|
| + case ButtonPress: |
| + case ButtonRelease: |
| + case MotionNotify: { |
| + MouseEvent mouseev(xev); |
| + handled = desktop_->OnMouseEvent(mouseev); |
| + } |
|
sky
2011/09/04 16:01:48
break
sadrul
2011/09/04 18:14:13
Done.
|
| } |
| - return EVENT_IGNORED; |
| + return handled ? EVENT_PROCESSED : EVENT_IGNORED; |
| } |
| void DesktopHostLinux::SetDesktop(Desktop* desktop) { |
| @@ -92,6 +106,10 @@ gfx::Size DesktopHostLinux::GetSize() { |
| return bounds_.size(); |
| } |
| +void DesktopHostLinux::SetSize(const gfx::Size& size) { |
| + XResizeWindow(xdisplay_, xwindow_, size.width(), size.height()); |
| +} |
| + |
| } // namespace |
| // static |