| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/desktop_host.h" | 5 #include "ui/aura/desktop_host.h" |
| 6 | 6 |
| 7 #include <X11/cursorfont.h> | 7 #include <X11/cursorfont.h> |
| 8 #include <X11/Xlib.h> | 8 #include <X11/Xlib.h> |
| 9 | 9 |
| 10 // Get rid of a macro from Xlib.h that conflicts with Aura's RootWindow class. | 10 // Get rid of a macro from Xlib.h that conflicts with Aura's RootWindow class. |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 | 353 |
| 354 // Clears XCursorCache. | 354 // Clears XCursorCache. |
| 355 ui::GetXCursor(ui::kCursorClearXCursorCache); | 355 ui::GetXCursor(ui::kCursorClearXCursorCache); |
| 356 | 356 |
| 357 MessageLoopForUI::current()->RemoveDestructionObserver(this); | 357 MessageLoopForUI::current()->RemoveDestructionObserver(this); |
| 358 base::MessagePumpX::SetDefaultDispatcher(NULL); | 358 base::MessagePumpX::SetDefaultDispatcher(NULL); |
| 359 } | 359 } |
| 360 | 360 |
| 361 base::MessagePumpDispatcher::DispatchStatus DesktopHostLinux::Dispatch( | 361 base::MessagePumpDispatcher::DispatchStatus DesktopHostLinux::Dispatch( |
| 362 XEvent* xev) { | 362 XEvent* xev) { |
| 363 DLOG(WARNING) << "DispatchEvent:" << xev->type; | |
| 364 | |
| 365 bool handled = false; | 363 bool handled = false; |
| 366 | 364 |
| 367 CheckXEventForConsistency(xev); | 365 CheckXEventForConsistency(xev); |
| 368 | 366 |
| 369 switch (xev->type) { | 367 switch (xev->type) { |
| 370 case Expose: | 368 case Expose: |
| 371 desktop_->Draw(); | 369 desktop_->Draw(); |
| 372 handled = true; | 370 handled = true; |
| 373 break; | 371 break; |
| 374 case KeyPress: { | 372 case KeyPress: { |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 583 xevent.xmotion.time = CurrentTime; | 581 xevent.xmotion.time = CurrentTime; |
| 584 | 582 |
| 585 gfx::Point point(xevent.xmotion.x, xevent.xmotion.y); | 583 gfx::Point point(xevent.xmotion.x, xevent.xmotion.y); |
| 586 desktop_->ConvertPointToNativeScreen(&point); | 584 desktop_->ConvertPointToNativeScreen(&point); |
| 587 xevent.xmotion.x_root = point.x(); | 585 xevent.xmotion.x_root = point.x(); |
| 588 xevent.xmotion.y_root = point.y(); | 586 xevent.xmotion.y_root = point.y(); |
| 589 } | 587 } |
| 590 default: | 588 default: |
| 591 break; | 589 break; |
| 592 } | 590 } |
| 593 Status status = XSendEvent(xdisplay_, xwindow_, False, 0, &xevent); | 591 XSendEvent(xdisplay_, xwindow_, False, 0, &xevent); |
| 594 DLOG(WARNING) << "PostEvent:" << xevent.type << ", status=" << status; | |
| 595 } | 592 } |
| 596 | 593 |
| 597 void DesktopHostLinux::WillDestroyCurrentMessageLoop() { | 594 void DesktopHostLinux::WillDestroyCurrentMessageLoop() { |
| 598 desktop_->DeleteInstance(); | 595 desktop_->DeleteInstance(); |
| 599 } | 596 } |
| 600 | 597 |
| 601 bool DesktopHostLinux::IsWindowManagerPresent() { | 598 bool DesktopHostLinux::IsWindowManagerPresent() { |
| 602 // Per ICCCM 2.8, "Manager Selections", window managers should take ownership | 599 // Per ICCCM 2.8, "Manager Selections", window managers should take ownership |
| 603 // of WM_Sn selections (where n is a screen number). | 600 // of WM_Sn selections (where n is a screen number). |
| 604 ::Atom wm_s0_atom = XInternAtom(xdisplay_, "WM_S0", False); | 601 ::Atom wm_s0_atom = XInternAtom(xdisplay_, "WM_S0", False); |
| 605 return XGetSelectionOwner(xdisplay_, wm_s0_atom) != None; | 602 return XGetSelectionOwner(xdisplay_, wm_s0_atom) != None; |
| 606 } | 603 } |
| 607 | 604 |
| 608 } // namespace | 605 } // namespace |
| 609 | 606 |
| 610 // static | 607 // static |
| 611 DesktopHost* DesktopHost::Create(const gfx::Rect& bounds) { | 608 DesktopHost* DesktopHost::Create(const gfx::Rect& bounds) { |
| 612 return new DesktopHostLinux(bounds); | 609 return new DesktopHostLinux(bounds); |
| 613 } | 610 } |
| 614 | 611 |
| 615 // static | 612 // static |
| 616 gfx::Size DesktopHost::GetNativeScreenSize() { | 613 gfx::Size DesktopHost::GetNativeScreenSize() { |
| 617 ::Display* xdisplay = base::MessagePumpX::GetDefaultXDisplay(); | 614 ::Display* xdisplay = base::MessagePumpX::GetDefaultXDisplay(); |
| 618 return gfx::Size(DisplayWidth(xdisplay, 0), DisplayHeight(xdisplay, 0)); | 615 return gfx::Size(DisplayWidth(xdisplay, 0), DisplayHeight(xdisplay, 0)); |
| 619 } | 616 } |
| 620 | 617 |
| 621 } // namespace aura | 618 } // namespace aura |
| OLD | NEW |