/src/mozilla-central/widget/gtk/WidgetUtilsGtk.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
2 | | /* This Source Code Form is subject to the terms of the Mozilla Public |
3 | | * License, v. 2.0. If a copy of the MPL was not distributed with this |
4 | | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
5 | | |
6 | | #include "WidgetUtilsGtk.h" |
7 | | |
8 | | namespace mozilla { |
9 | | |
10 | | namespace widget { |
11 | | |
12 | | int32_t WidgetUtilsGTK::IsTouchDeviceSupportPresent() |
13 | 0 | { |
14 | 0 | #if GTK_CHECK_VERSION(3,4,0) |
15 | 0 | int32_t result = 0; |
16 | 0 | GdkDisplay* display = gdk_display_get_default(); |
17 | 0 | if (!display) { |
18 | 0 | return 0; |
19 | 0 | } |
20 | 0 | |
21 | 0 | GdkDeviceManager* manager = gdk_display_get_device_manager(display); |
22 | 0 | if (!manager) { |
23 | 0 | return 0; |
24 | 0 | } |
25 | 0 | |
26 | 0 | GList* devices = |
27 | 0 | gdk_device_manager_list_devices(manager, GDK_DEVICE_TYPE_SLAVE); |
28 | 0 | GList* list = devices; |
29 | 0 |
|
30 | 0 | while (devices) { |
31 | 0 | GdkDevice* device = static_cast<GdkDevice*>(devices->data); |
32 | 0 | if (gdk_device_get_source(device) == GDK_SOURCE_TOUCHSCREEN) { |
33 | 0 | result = 1; |
34 | 0 | break; |
35 | 0 | } |
36 | 0 | devices = devices->next; |
37 | 0 | } |
38 | 0 |
|
39 | 0 | if (list) { |
40 | 0 | g_list_free(list); |
41 | 0 | } |
42 | 0 |
|
43 | 0 | return result; |
44 | | #else |
45 | | return 0; |
46 | | #endif |
47 | | } |
48 | | |
49 | | } // namespace widget |
50 | | |
51 | | } // namespace mozilla |