| 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 #include "ui/base/touch/touch_factory.h" | 5 #include "ui/base/touch/touch_factory.h" |
| 6 | 6 |
| 7 #include <X11/cursorfont.h> | 7 #include <X11/cursorfont.h> |
| 8 #include <X11/extensions/XInput.h> | 8 #include <X11/extensions/XInput.h> |
| 9 #include <X11/extensions/XInput2.h> | 9 #include <X11/extensions/XInput2.h> |
| 10 #include <X11/extensions/XIproto.h> | 10 #include <X11/extensions/XIproto.h> |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 #endif | 47 #endif |
| 48 | 48 |
| 49 char nodata[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; | 49 char nodata[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; |
| 50 XColor black; | 50 XColor black; |
| 51 black.red = black.green = black.blue = 0; | 51 black.red = black.green = black.blue = 0; |
| 52 Display* display = ui::GetXDisplay(); | 52 Display* display = ui::GetXDisplay(); |
| 53 Pixmap blank = XCreateBitmapFromData(display, ui::GetX11RootWindow(), | 53 Pixmap blank = XCreateBitmapFromData(display, ui::GetX11RootWindow(), |
| 54 nodata, 8, 8); | 54 nodata, 8, 8); |
| 55 invisible_cursor_ = XCreatePixmapCursor(display, blank, blank, | 55 invisible_cursor_ = XCreatePixmapCursor(display, blank, blank, |
| 56 &black, &black, 0, 0); | 56 &black, &black, 0, 0); |
| 57 XFreePixmap(display, blank); |
| 57 arrow_cursor_ = XCreateFontCursor(display, XC_arrow); | 58 arrow_cursor_ = XCreateFontCursor(display, XC_arrow); |
| 58 | 59 |
| 59 SetCursorVisible(false, false); | 60 SetCursorVisible(false, false); |
| 60 UpdateDeviceList(display); | 61 UpdateDeviceList(display); |
| 61 | 62 |
| 62 // Make sure the list of devices is kept up-to-date by listening for | 63 // Make sure the list of devices is kept up-to-date by listening for |
| 63 // XI_HierarchyChanged event on the root window. | 64 // XI_HierarchyChanged event on the root window. |
| 64 unsigned char mask[XIMaskLen(XI_LASTEVENT)]; | 65 unsigned char mask[XIMaskLen(XI_LASTEVENT)]; |
| 65 memset(mask, 0, sizeof(mask)); | 66 memset(mask, 0, sizeof(mask)); |
| 66 | 67 |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 else if (touch_device_available_) | 415 else if (touch_device_available_) |
| 415 XDefineCursor(display, window, invisible_cursor_); | 416 XDefineCursor(display, window, invisible_cursor_); |
| 416 } | 417 } |
| 417 | 418 |
| 418 bool TouchFactory::IsTouchDevicePresent() { | 419 bool TouchFactory::IsTouchDevicePresent() { |
| 419 touch_present_called_ = true; | 420 touch_present_called_ = true; |
| 420 return (touch_device_available_ && touch_events_allowed_); | 421 return (touch_device_available_ && touch_events_allowed_); |
| 421 } | 422 } |
| 422 | 423 |
| 423 } // namespace ui | 424 } // namespace ui |
| OLD | NEW |