diff options
author | Gary Kramlich <grim@reaperworld.com> | 2019-10-15 03:59:57 +0000 |
---|---|---|
committer | Gary Kramlich <grim@reaperworld.com> | 2019-10-15 03:59:57 +0000 |
commit | 39b76a242c23a5650cf0c4841441c19c7c6be684 (patch) | |
tree | 7ae56f78d0eee60923ee98c2d65c7b015cc1d551 | |
parent | ed08c0df601f4b272a05dac14ea4bc813f72338e (diff) | |
parent | 95b3014aec0635c4ade65279ca6cc1a806375c87 (diff) | |
download | pidgin-39b76a242c23a5650cf0c4841441c19c7c6be684.tar.gz |
Merged in default (pull request #603)
Fix the macos build
Approved-by: Elliott Sales de Andrade
Approved-by: Eion Robb
-rw-r--r-- | finch/meson.build | 9 | ||||
-rw-r--r-- | meson.build | 16 | ||||
-rw-r--r-- | pidgin/gtkconv.c | 2 | ||||
-rw-r--r-- | pidgin/gtkidle.c | 52 |
4 files changed, 50 insertions, 29 deletions
diff --git a/finch/meson.build b/finch/meson.build index 89147387d8..9be24039b2 100644 --- a/finch/meson.build +++ b/finch/meson.build @@ -2,7 +2,9 @@ enable_consoleui = false if get_option('consoleui') libgnt_dep = dependency('gnt3', version : '>= 3.0.0', required : false) if libgnt_dep.found() - libgnt_gir = ['Gnt-3.0'] + if enable_introspection + libgnt_gir = ['Gnt-3.0'] + endif else libgnt_proj = subproject('libgnt', default_options : [ @@ -10,7 +12,10 @@ if get_option('consoleui') ] ) libgnt_dep = libgnt_proj.get_variable('libgnt_dep') - libgnt_gir = libgnt_proj.get_variable('libgnt_gir') + + if enable_introspection + libgnt_gir = libgnt_proj.get_variable('libgnt_gir') + endif endif ####################################################################### diff --git a/meson.build b/meson.build index 72aff721cf..52ac76da70 100644 --- a/meson.build +++ b/meson.build @@ -307,8 +307,8 @@ if get_option('gtkui') talkatu_dep = dependency('talkatu', version: '>=0.1.0', required : false) if talkatu_dep.found() - talkatu_gir = 'Talkatu-0.0' - if get_option('introspection') + if enable_introspection + talkatu_gir = 'Talkatu-0.0' talkatu_include_directories = include_directories( join_paths(talkatu_dep.get_pkgconfig_variable('prefix'), 'share/gir-1.0')) @@ -324,7 +324,9 @@ if get_option('gtkui') ] ) talkatu_dep = talkatu_proj.get_variable('talkatu_dep') - talkatu_gir = talkatu_proj.get_variable('talkatu_gir')[0] + if enable_introspection + talkatu_gir = talkatu_proj.get_variable('talkatu_gir')[0] + endif talkatu_include_directories = [] endif endif # GTK @@ -629,8 +631,8 @@ endif ####################################################################### gplugin_dep = dependency('gplugin', version : '>= 0.28.0', required : false) if gplugin_dep.found() - gplugin_gir = 'GPlugin-0.0' - if get_option('introspection') + if enable_introspection + gplugin_gir = 'GPlugin-0.0' gplugin_include_directories = include_directories( join_paths(gplugin_dep.get_pkgconfig_variable('prefix'), 'share/gir-1.0')) @@ -646,7 +648,9 @@ else ] ) gplugin_dep = gplugin_proj.get_variable('gplugin_dep') - gplugin_gir = gplugin_proj.get_variable('gplugin_gir')[0] + if enable_introspection + gplugin_gir = gplugin_proj.get_variable('gplugin_gir')[0] + endif gplugin_include_directories = [] endif diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index 0a9216461c..21ef2d5b38 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -23,7 +23,7 @@ #include "internal.h" #include "pidgin.h" -#ifndef _WIN32 +#ifdef HAVE_X11 # include <X11/Xlib.h> #endif diff --git a/pidgin/gtkidle.c b/pidgin/gtkidle.c index 8838cf64cc..c47dbe9676 100644 --- a/pidgin/gtkidle.c +++ b/pidgin/gtkidle.c @@ -24,6 +24,16 @@ #include "gtkidle.h" #ifdef HAVE_IOKIT +/* HAVE_UNISTD_H must have a value, see + * https://forums.developer.apple.com/thread/86887 + */ +# ifdef HAVE_UNISTD_H +# undef HAVE_UNISTD_H +# define HAVE_UNISTD_H 1 +# else +# define HAVE_UNISTD_H 0 +# endif + # include <CoreFoundation/CoreFoundation.h> # include <IOKit/IOKitLib.h> #elif defined (_WIN32) @@ -73,27 +83,29 @@ pidgin_get_time_idle(void) { # ifdef HAVE_IOKIT /* Query the IOKit API */ - - static io_service_t macIOsrvc = NULL; - CFTypeRef property; - uint64_t idle_time = 0; /* nanoseconds */ - - if (macIOsrvc == NULL) - { - mach_port_t master; - IOMasterPort(MACH_PORT_NULL, &master); - macIOsrvc = IOServiceGetMatchingService(master, - IOServiceMatching("IOHIDSystem")); + double idleSeconds = -1; + io_iterator_t iter = 0; + if (IOServiceGetMatchingServices(kIOMasterPortDefault, IOServiceMatching("IOHIDSystem"), &iter) == KERN_SUCCESS) { + io_registry_entry_t entry = IOIteratorNext(iter); + if (entry) { + CFMutableDictionaryRef dict = NULL; + kern_return_t status; + status = IORegistryEntryCreateCFProperties(entry, &dict, kCFAllocatorDefault, 0); + if (status == KERN_SUCCESS) { + CFNumberRef obj = CFDictionaryGetValue(dict, CFSTR("HIDIdleTime")); + if (obj) { + int64_t nanoseconds = 0; + if (CFNumberGetValue(obj, kCFNumberSInt64Type, &nanoseconds)) { + idleSeconds = (double) nanoseconds / NSEC_PER_SEC; + } + } + CFRelease(dict); + } + IOObjectRelease(entry); + } + IOObjectRelease(iter); } - - property = IORegistryEntryCreateCFProperty(macIOsrvc, CFSTR("HIDIdleTime"), - kCFAllocatorDefault, 0); - CFNumberGetValue((CFNumberRef)property, - kCFNumberSInt64Type, &idle_time); - CFRelease(property); - - /* convert nanoseconds to seconds */ - return idle_time / 1000000000; + return idleSeconds; # else # ifdef _WIN32 /* Query Windows */ |