summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorPatrick Griffis <tingping@tingping.se>2018-03-05 19:25:08 -0500
committerPatrick Griffis <tingping@tingping.se>2018-03-09 18:23:25 +0000
commite9b9ff9f38abc82c0a5002d5e58a5c226b698f82 (patch)
treea9fa9c40111985faae17348ce47293a048dd6bbb /src
parent9b8a7eaa0147c6a564c1d1401d57cc685461e320 (diff)
Various fixes for mingw
Diffstat (limited to 'src')
-rw-r--r--src/common/dcc.c4
-rw-r--r--src/common/meson.build10
-rw-r--r--src/common/plugin.c4
-rw-r--r--src/common/proto-irc.c8
-rw-r--r--src/common/sysinfo/win32/backend.c2
-rw-r--r--src/fe-gtk/fe-gtk.c4
-rw-r--r--src/fe-gtk/meson.build12
-rw-r--r--src/fe-gtk/notifications/notification-windows.c5
-rw-r--r--src/fe-gtk/plugin-tray.c4
9 files changed, 39 insertions, 14 deletions
diff --git a/src/common/dcc.c b/src/common/dcc.c
index 954e6b91..e26a2916 100644
--- a/src/common/dcc.c
+++ b/src/common/dcc.c
@@ -59,8 +59,8 @@
 #include "hexchatc.h"
 
 /* Setting _FILE_OFFSET_BITS to 64 doesn't change lseek to use off64_t on Windows, so override lseek to the version that does */
-#ifdef WIN32
-#define lseek _lseeki64
+#if defined(WIN32) && (!defined(__MINGW32__) && !defined(__MINGW64__))
+	#define lseek _lseeki64
 #endif
 
 /* interval timer to detect timeouts */
diff --git a/src/common/meson.build b/src/common/meson.build
index ef59ffc3..a0d6ce2b 100644
--- a/src/common/meson.build
+++ b/src/common/meson.build
@@ -24,9 +24,11 @@ common_sources = [
   'util.c'
 ]
 
+common_sysinfo_deps = []
+
 common_deps = [
   libgio_dep,
-]
+] + global_deps
 
 common_includes = [
   config_h_include,
@@ -41,7 +43,10 @@ if host_machine.system() == 'windows'
   common_deps += [
     cc.find_library('ws2_32'), # winsock
     cc.find_library('winmm'), # playsound
+  ]
+  common_sysinfo_deps += [
     cc.find_library('wbemuuid'), # sysinfo
+    cc.find_library('wbemcore'),
   ]
 
   common_sources += 'sysinfo/win32/backend.c'
@@ -98,7 +103,7 @@ endif
 hexchat_common = static_library('hexchatcommon',
   sources: [textevents] + marshal + common_sources,
   include_directories: config_h_include,
-  dependencies: common_deps,
+  dependencies: common_deps + common_sysinfo_deps,
   c_args: common_cflags,
   pic: true
 )
@@ -113,4 +118,5 @@ hexchat_common_dep = declare_dependency(
 hexchat_plugin_dep = declare_dependency(
   include_directories: common_includes,
   compile_args: common_cflags,
+  dependencies: global_deps,
 )
diff --git a/src/common/plugin.c b/src/common/plugin.c
index b49afd96..ea174bed 100644
--- a/src/common/plugin.c
+++ b/src/common/plugin.c
@@ -200,13 +200,15 @@ plugin_list_add (hexchat_context *ctx, char *filename, const char *name,
 	return pl;
 }
 
+#ifndef WIN32
 static void *
 hexchat_dummy (hexchat_plugin *ph)
 {
 	return NULL;
 }
 
-#ifdef WIN32
+#else
+
 static int
 hexchat_read_fd (hexchat_plugin *ph, GIOChannel *source, char *buf, int *len)
 {
diff --git a/src/common/proto-irc.c b/src/common/proto-irc.c
index e055c7e2..9a53ed2e 100644
--- a/src/common/proto-irc.c
+++ b/src/common/proto-irc.c
@@ -1471,7 +1471,13 @@ handle_message_tag_time (const char *time, message_tags_data *tags_data)
 		long long int t;
 
 		/* we ignore the milisecond part */
-		if (sscanf (time, "%lld", &t) != 1)
+		if (
+#if defined(__MINGW64__) || defined(__MINGW32__)
+		__mingw_sscanf
+#else
+		sscanf
+#endif
+		(time, "%lld", &t) != 1)
 			return;
 
 		tags_data->timestamp = (time_t) t;
diff --git a/src/common/sysinfo/win32/backend.c b/src/common/sysinfo/win32/backend.c
index 64e9405a..1d88b139 100644
--- a/src/common/sysinfo/win32/backend.c
+++ b/src/common/sysinfo/win32/backend.c
@@ -174,7 +174,7 @@ static char *query_wmi (QueryWmiType type)
 		goto release_locator;
 	}
 
-	hr = namespace->lpVtbl->QueryInterface (namespace, &IID_IUnknown, &namespaceUnknown);
+	hr = namespace->lpVtbl->QueryInterface (namespace, &IID_IUnknown, (void**)&namespaceUnknown);
 	if (FAILED (hr))
 	{
 		goto release_namespace;
diff --git a/src/fe-gtk/fe-gtk.c b/src/fe-gtk/fe-gtk.c
index ac98da37..9d068a1b 100644
--- a/src/fe-gtk/fe-gtk.c
+++ b/src/fe-gtk/fe-gtk.c
@@ -142,7 +142,7 @@ fe_args (int argc, char *argv[])
 		{
 			if (strstr (error->message, "--help-all") != NULL)
 			{
-				buffer = g_strdup_printf (g_option_context_get_help (context, FALSE, NULL));
+				buffer = g_option_context_get_help (context, FALSE, NULL);
 				gtk_init (&argc, &argv);
 				create_msg_dialog ("Long Help", buffer);
 				g_free (buffer);
@@ -150,7 +150,7 @@ fe_args (int argc, char *argv[])
 			}
 			else if (strstr (error->message, "--help") != NULL || strstr (error->message, "-?") != NULL)
 			{
-				buffer = g_strdup_printf (g_option_context_get_help (context, TRUE, NULL));
+				buffer = g_option_context_get_help (context, TRUE, NULL);
 				gtk_init (&argc, &argv);
 				create_msg_dialog ("Help", buffer);
 				g_free (buffer);
diff --git a/src/fe-gtk/meson.build b/src/fe-gtk/meson.build
index ba5b2779..f11580bb 100644
--- a/src/fe-gtk/meson.build
+++ b/src/fe-gtk/meson.build
@@ -51,6 +51,15 @@ if get_option('with-libnotify')
   hexchat_gtk_sources += 'notifications/notification-libnotify.c'
   hexchat_gtk_deps += dependency('libnotify')
 elif false # TODO HAVE_GTK_MAC
+elif host_machine.system() == 'windows'
+  hexchat_gtk_sources += 'notifications/notification-windows.c'
+
+  # TODO: mingw doesn't have these headers or libs
+  # add_languages('cpp')
+  # shared_module('hcnotifications-winrt',
+  #  sources: 'notifications/notification-winrt.cpp'
+  #)
+
 else
   hexchat_gtk_sources += 'notifications/notification-dummy.c'
 endif
@@ -80,5 +89,6 @@ executable('hexchat',
   dependencies: hexchat_gtk_deps,
   c_args: hexchat_gtk_cflags,
   link_args: hexchat_gtk_ldflags,
-  install: true
+  install: true,
+  gui_app: true,
 )
diff --git a/src/fe-gtk/notifications/notification-windows.c b/src/fe-gtk/notifications/notification-windows.c
index 9033f36a..2fd896c5 100644
--- a/src/fe-gtk/notifications/notification-windows.c
+++ b/src/fe-gtk/notifications/notification-windows.c
@@ -16,12 +16,11 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
-#include <gmodule.h>
-
 #include "hexchat.h"
 #include "plugin.h"
 
-#include <Windows.h>
+#include <gmodule.h>
+#include <windows.h>
 
 void (*winrt_notification_backend_show) (const char *title, const char *text) = NULL;
 int (*winrt_notification_backend_init) (const char **error) = NULL;
diff --git a/src/fe-gtk/plugin-tray.c b/src/fe-gtk/plugin-tray.c
index 55565955..9b8d74fa 100644
--- a/src/fe-gtk/plugin-tray.c
+++ b/src/fe-gtk/plugin-tray.c
@@ -465,6 +465,7 @@ tray_make_item (GtkWidget *menu, char *label, void *callback, void *userdata)
 	return item;
 }
 
+#ifndef WIN32
 static void
 tray_toggle_cb (GtkCheckMenuItem *item, unsigned int *setting)
 {
@@ -476,6 +477,7 @@ blink_item (unsigned int *setting, GtkWidget *menu, char *label)
 {
 	menu_toggle_item (label, menu, tray_toggle_cb, setting, *setting);
 }
+#endif
 
 static void
 tray_menu_destroy (GtkWidget *menu, gpointer userdata)
@@ -586,7 +588,7 @@ tray_menu_cb (GtkWidget *widget, guint button, guint time, gpointer userdata)
 	g_signal_connect (G_OBJECT (menu), "enter-notify-event",
 							G_CALLBACK (tray_menu_enter_cb), NULL);
 
-	tray_menu_timer = g_timeout_add (500, tray_check_hide, menu);
+	tray_menu_timer = g_timeout_add (500, (GSourceFunc)tray_check_hide, menu);
 #endif
 
 	gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL,