pidgin/pidgin

Merged in default (pull request #603)

2019-10-15, Gary Kramlich
adbd0a452065
Merged in default (pull request #603)

Fix the macos build

Approved-by: Elliott Sales de Andrade
Approved-by: Eion Robb
--- a/finch/meson.build Tue Oct 15 03:58:49 2019 +0000
+++ b/finch/meson.build Tue Oct 15 03:59:57 2019 +0000
@@ -2,7 +2,9 @@
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 @@
]
)
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
#######################################################################
--- a/meson.build Tue Oct 15 03:58:49 2019 +0000
+++ b/meson.build Tue Oct 15 03:59:57 2019 +0000
@@ -307,8 +307,8 @@
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 @@
]
)
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 @@
#######################################################################
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 @@
]
)
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
--- a/pidgin/gtkconv.c Tue Oct 15 03:58:49 2019 +0000
+++ b/pidgin/gtkconv.c Tue Oct 15 03:59:57 2019 +0000
@@ -23,7 +23,7 @@
#include "internal.h"
#include "pidgin.h"
-#ifndef _WIN32
+#ifdef HAVE_X11
# include <X11/Xlib.h>
#endif
--- a/pidgin/gtkidle.c Tue Oct 15 03:58:49 2019 +0000
+++ b/pidgin/gtkidle.c Tue Oct 15 03:59:57 2019 +0000
@@ -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 @@
{
# 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 */