OLD | NEW |
---|---|
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 // This file defines utility functions for X11 (Linux only). This code has been | 5 // This file defines utility functions for X11 (Linux only). This code has been |
6 // ported from XCB since we can't use XCB on Ubuntu while its 32-bit support | 6 // ported from XCB since we can't use XCB on Ubuntu while its 32-bit support |
7 // remains woefully incomplete. | 7 // remains woefully incomplete. |
8 | 8 |
9 #include "ui/base/x/x11_util.h" | 9 #include "ui/base/x/x11_util.h" |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... | |
21 #include <X11/extensions/shape.h> | 21 #include <X11/extensions/shape.h> |
22 #include <X11/extensions/XInput2.h> | 22 #include <X11/extensions/XInput2.h> |
23 #include <X11/extensions/Xrandr.h> | 23 #include <X11/extensions/Xrandr.h> |
24 | 24 |
25 #include "base/bind.h" | 25 #include "base/bind.h" |
26 #include "base/command_line.h" | 26 #include "base/command_line.h" |
27 #include "base/logging.h" | 27 #include "base/logging.h" |
28 #include "base/memory/scoped_ptr.h" | 28 #include "base/memory/scoped_ptr.h" |
29 #include "base/memory/singleton.h" | 29 #include "base/memory/singleton.h" |
30 #include "base/message_loop.h" | 30 #include "base/message_loop.h" |
31 #include "base/metrics/histogram.h" | |
31 #include "base/string_number_conversions.h" | 32 #include "base/string_number_conversions.h" |
32 #include "base/string_util.h" | 33 #include "base/string_util.h" |
33 #include "base/stringprintf.h" | 34 #include "base/stringprintf.h" |
34 #include "base/sys_byteorder.h" | 35 #include "base/sys_byteorder.h" |
35 #include "base/threading/thread.h" | 36 #include "base/threading/thread.h" |
36 #include "ui/base/events/event_utils.h" | 37 #include "ui/base/events/event_utils.h" |
37 #include "ui/base/keycodes/keyboard_code_conversion_x.h" | 38 #include "ui/base/keycodes/keyboard_code_conversion_x.h" |
38 #include "ui/base/touch/touch_factory_x11.h" | 39 #include "ui/base/touch/touch_factory_x11.h" |
39 #include "ui/base/x/valuators.h" | 40 #include "ui/base/x/valuators.h" |
40 #include "ui/base/x/x11_util_internal.h" | 41 #include "ui/base/x/x11_util_internal.h" |
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
622 XGetEventData(display, &last_event->xcookie); | 623 XGetEventData(display, &last_event->xcookie); |
623 ++num_coalesed; | 624 ++num_coalesed; |
624 continue; | 625 continue; |
625 } else { | 626 } else { |
626 // This isn't an event we want so free its cookie data. | 627 // This isn't an event we want so free its cookie data. |
627 XFreeEventData(display, &next_event.xcookie); | 628 XFreeEventData(display, &next_event.xcookie); |
628 } | 629 } |
629 } | 630 } |
630 break; | 631 break; |
631 } | 632 } |
633 | |
634 if (num_coalesed > 0) { | |
635 base::TimeDelta delta = ui::EventTimeFromNative(last_event) - | |
636 ui::EventTimeFromNative(const_cast<XEvent*>(xev)); | |
637 if (event_type == XI_Motion) { | |
638 UMA_HISTOGRAM_COUNTS_10000("Event.CoalescedCount.Mouse", num_coalesed); | |
639 UMA_HISTOGRAM_TIMES("Event.CoalescedLatency.Mouse", delta); | |
640 } else { | |
641 #if defined(USE_XI2_MT) | |
642 DCHECK(event_type == XI_TouchUpdate); | |
sadrul
2013/04/05 23:27:09
DCHECK_EQ
varunjain
2013/04/08 14:37:12
Done.
| |
643 #endif | |
644 UMA_HISTOGRAM_COUNTS_10000("Event.CoalescedCount.Touch", num_coalesed); | |
645 UMA_HISTOGRAM_TIMES("Event.CoalescedLatency.Touch", delta); | |
646 } | |
647 } | |
632 return num_coalesed; | 648 return num_coalesed; |
633 } | 649 } |
634 #endif | 650 #endif |
635 | 651 |
636 void HideHostCursor() { | 652 void HideHostCursor() { |
637 CR_DEFINE_STATIC_LOCAL(XScopedCursor, invisible_cursor, | 653 CR_DEFINE_STATIC_LOCAL(XScopedCursor, invisible_cursor, |
638 (CreateInvisibleCursor(), ui::GetXDisplay())); | 654 (CreateInvisibleCursor(), ui::GetXDisplay())); |
639 XDefineCursor(ui::GetXDisplay(), DefaultRootWindow(ui::GetXDisplay()), | 655 XDefineCursor(ui::GetXDisplay(), DefaultRootWindow(ui::GetXDisplay()), |
640 invisible_cursor.get()); | 656 invisible_cursor.get()); |
641 } | 657 } |
(...skipping 1152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1794 << "request_code " << static_cast<int>(error_event.request_code) << ", " | 1810 << "request_code " << static_cast<int>(error_event.request_code) << ", " |
1795 << "minor_code " << static_cast<int>(error_event.minor_code) | 1811 << "minor_code " << static_cast<int>(error_event.minor_code) |
1796 << " (" << request_str << ")"; | 1812 << " (" << request_str << ")"; |
1797 } | 1813 } |
1798 | 1814 |
1799 // ---------------------------------------------------------------------------- | 1815 // ---------------------------------------------------------------------------- |
1800 // End of x11_util_internal.h | 1816 // End of x11_util_internal.h |
1801 | 1817 |
1802 | 1818 |
1803 } // namespace ui | 1819 } // namespace ui |
OLD | NEW |