LCOV - code coverage report
Current view: top level - widget/gtk - WidgetUtilsGtk.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 15 19 78.9 %
Date: 2017-07-14 16:53:18 Functions: 1 1 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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           4 : int32_t WidgetUtilsGTK::IsTouchDeviceSupportPresent()
      13             : {
      14             : #if GTK_CHECK_VERSION(3,4,0)
      15           4 :     int32_t result = 0;
      16           4 :     GdkDisplay* display = gdk_display_get_default();
      17           4 :     if (!display) {
      18           0 :         return 0;
      19             :     }
      20             : 
      21           4 :     GdkDeviceManager* manager = gdk_display_get_device_manager(display);
      22           4 :     if (!manager) {
      23           0 :         return 0;
      24             :     }
      25             : 
      26             :     GList* devices =
      27           4 :         gdk_device_manager_list_devices(manager, GDK_DEVICE_TYPE_SLAVE);
      28           4 :     GList* list = devices;
      29             : 
      30          44 :     while (devices) {
      31          20 :         GdkDevice* device = static_cast<GdkDevice*>(devices->data);
      32          20 :         if (gdk_device_get_source(device) == GDK_SOURCE_TOUCHSCREEN) {
      33           0 :             result = 1;
      34           0 :             break;
      35             :         }
      36          20 :         devices = devices->next;
      37             :    }
      38             : 
      39           4 :    if (list) {
      40           2 :        g_list_free(list);
      41             :    }
      42             : 
      43           4 :    return result;
      44             : #else
      45             :    return 0;
      46             : #endif
      47             : }
      48             : 
      49             : }  // namespace widget
      50             : 
      51             : } // namespace mozilla

Generated by: LCOV version 1.13