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

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: . 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') | no next file with comments »
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..723e571594a74134379d9d0777759733f05851ed 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,27 @@ 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);
+ break;
+ }
+ case ButtonPress:
+ case ButtonRelease:
+ case MotionNotify: {
+ MouseEvent mouseev(xev);
+ handled = desktop_->OnMouseEvent(mouseev);
+ break;
+ }
}
- return EVENT_IGNORED;
+ return handled ? EVENT_PROCESSED : EVENT_IGNORED;
}
void DesktopHostLinux::SetDesktop(Desktop* desktop) {
@@ -92,6 +108,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') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698