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

Unified Diff: aura/desktop_host_linux.cc

Issue 7833016: aura: A few changes to have aura_demo compile and run on linux. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: events Created 9 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « aura/desktop.h ('k') | aura/event.h » ('j') | aura/event.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « aura/desktop.h ('k') | aura/event.h » ('j') | aura/event.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698