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

Side by Side Diff: ui/aura/root_window_host_linux.cc

Issue 9773024: This patch implements Chromium's Aura gesture recognizer in terms of utouch-grail and utouch-frame … (Closed) Base URL: https://src.chromium.org/svn/trunk/src/
Patch Set: Created 8 years, 8 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 unified diff | Download patch
« no previous file with comments | « ui/aura/root_window_host_linux.h ('k') | ui/base/ime/ibus_client.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/root_window_host_linux.h" 5 #include "ui/aura/root_window_host_linux.h"
6 6
7 #include <X11/cursorfont.h> 7 #include <X11/cursorfont.h>
8 #include <X11/extensions/XInput2.h> 8 #include <X11/extensions/XInput2.h>
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 if (size_changed) 381 if (size_changed)
382 root_window_->OnHostResized(bounds.size()); 382 root_window_->OnHostResized(bounds.size());
383 handled = true; 383 handled = true;
384 break; 384 break;
385 } 385 }
386 case GenericEvent: { 386 case GenericEvent: {
387 ui::TouchFactory* factory = ui::TouchFactory::GetInstance(); 387 ui::TouchFactory* factory = ui::TouchFactory::GetInstance();
388 if (!factory->ShouldProcessXI2Event(xev)) 388 if (!factory->ShouldProcessXI2Event(xev))
389 break; 389 break;
390 390
391 // Update utouch frame state
392 #if defined(USE_UTOUCH)
393 ui::TouchFactory::GetInstance()->ProcessXI2Event(xev);
394 #endif // USE_UTOUCH
395
391 ui::EventType type = ui::EventTypeFromNative(xev); 396 ui::EventType type = ui::EventTypeFromNative(xev);
392 // If this is a motion event we want to coalesce all pending motion 397 // If this is a motion event we want to coalesce all pending motion
393 // events that are at the top of the queue. 398 // events that are at the top of the queue.
394 XEvent last_event; 399 XEvent last_event;
395 int num_coalesced = 0; 400 int num_coalesced = 0;
396 401
397 switch (type) { 402 switch (type) {
398 case ui::ET_TOUCH_PRESSED: 403 case ui::ET_TOUCH_PRESSED:
399 case ui::ET_TOUCH_RELEASED: 404 case ui::ET_TOUCH_RELEASED:
400 case ui::ET_TOUCH_MOVED: { 405 case ui::ET_TOUCH_MOVED: {
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 root_window_->ConvertPointToNativeScreen(&point); 618 root_window_->ConvertPointToNativeScreen(&point);
614 xevent.xmotion.x_root = point.x(); 619 xevent.xmotion.x_root = point.x();
615 xevent.xmotion.y_root = point.y(); 620 xevent.xmotion.y_root = point.y();
616 } 621 }
617 default: 622 default:
618 break; 623 break;
619 } 624 }
620 XSendEvent(xdisplay_, xwindow_, False, 0, &xevent); 625 XSendEvent(xdisplay_, xwindow_, False, 0, &xevent);
621 } 626 }
622 627
628 aura::NativeHandle RootWindowHostLinux::GetNativeWindow() const {
629 return xwindow_;
630 }
631
623 bool RootWindowHostLinux::IsWindowManagerPresent() { 632 bool RootWindowHostLinux::IsWindowManagerPresent() {
624 // Per ICCCM 2.8, "Manager Selections", window managers should take ownership 633 // Per ICCCM 2.8, "Manager Selections", window managers should take ownership
625 // of WM_Sn selections (where n is a screen number). 634 // of WM_Sn selections (where n is a screen number).
626 ::Atom wm_s0_atom = XInternAtom(xdisplay_, "WM_S0", False); 635 ::Atom wm_s0_atom = XInternAtom(xdisplay_, "WM_S0", False);
627 return XGetSelectionOwner(xdisplay_, wm_s0_atom) != None; 636 return XGetSelectionOwner(xdisplay_, wm_s0_atom) != None;
628 } 637 }
629 638
630 void RootWindowHostLinux::SetCursorInternal(gfx::NativeCursor cursor) { 639 void RootWindowHostLinux::SetCursorInternal(gfx::NativeCursor cursor) {
631 ::Cursor xcursor = 640 ::Cursor xcursor =
632 cursor == kCursorNone ? 641 cursor == kCursorNone ?
633 invisible_cursor_ : 642 invisible_cursor_ :
634 ui::GetXCursor(CursorShapeFromNative(cursor)); 643 ui::GetXCursor(CursorShapeFromNative(cursor));
635 XDefineCursor(xdisplay_, xwindow_, xcursor); 644 XDefineCursor(xdisplay_, xwindow_, xcursor);
636 } 645 }
637 646
638 // static 647 // static
639 RootWindowHost* RootWindowHost::Create(const gfx::Rect& bounds) { 648 RootWindowHost* RootWindowHost::Create(const gfx::Rect& bounds) {
640 return new RootWindowHostLinux(bounds); 649 return new RootWindowHostLinux(bounds);
641 } 650 }
642 651
643 // static 652 // static
644 gfx::Size RootWindowHost::GetNativeScreenSize() { 653 gfx::Size RootWindowHost::GetNativeScreenSize() {
645 ::Display* xdisplay = base::MessagePumpX::GetDefaultXDisplay(); 654 ::Display* xdisplay = base::MessagePumpX::GetDefaultXDisplay();
646 return gfx::Size(DisplayWidth(xdisplay, 0), DisplayHeight(xdisplay, 0)); 655 return gfx::Size(DisplayWidth(xdisplay, 0), DisplayHeight(xdisplay, 0));
647 } 656 }
648 657
649 } // namespace aura 658 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/root_window_host_linux.h ('k') | ui/base/ime/ibus_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698