diff --git a/configure.ac b/configure.ac index 4f4c969..ac236d0 100644 --- a/configure.ac +++ b/configure.ac @@ -4,6 +4,13 @@ AC_INIT([spek], [0.5]) AC_CONFIG_SRCDIR([src/spek.vala]) AC_CONFIG_HEADERS([config.h]) +# Determine the system type. +AC_CANONICAL_HOST +AC_SUBST(host_os) +AC_DEFINE_UNQUOTED(HOST_OS, "$host_os", + [Define the canonical host OS type.] +) + AM_INIT_AUTOMAKE([no-dist-gzip dist-bzip2]) # Enable silent rules is available diff --git a/src/Makefile.am b/src/Makefile.am index 0c29cf2..0872e45 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -9,7 +9,6 @@ spek_SOURCES = \ INCLUDES = \ -include config.h \ - -include sys/utsname.h \ $(SPEK_CFLAGS) \ $(IGE_MAC_CFLAGS) \ -DLOCALEDIR=\""$(localedir)"\" \ @@ -17,8 +16,7 @@ INCLUDES = \ -DPKGLIBDIR=\""$(pkglibdir)"\" VALAFLAGS = \ - --vapidir=$(srcdir)/../vapi - --pkg config --pkg sys \ + --vapidir=$(srcdir)/../vapi --pkg config \ @SPEK_PACKAGES@ spek_LDADD = \ diff --git a/src/spek-spectrogram.vala b/src/spek-spectrogram.vala index 4d98228..e545f85 100644 --- a/src/spek-spectrogram.vala +++ b/src/spek-spectrogram.vala @@ -20,7 +20,6 @@ using Cairo; using Gdk; using Gtk; using Pango; -using Sys; namespace Spek { class Spectrogram : DrawingArea { @@ -41,13 +40,13 @@ namespace Spek { private const int BPAD = 40; private const int GAP = 10; private const int RULER = 10; - private double FONT_SCALE; + private double FONT_SCALE = 1.0; public Spectrogram () { // Pango/Quartz fonts are smaller than on X. - var name = UtsName (); - uname (ref name); - FONT_SCALE = name.sysname == "Darwin" ? 1.5 : 1.0; + if (Config.HOST_OS.down ().has_prefix ("darwin")) { + FONT_SCALE = 1.4; + } // Pre-draw the palette. palette = new ImageSurface (Format.RGB24, RULER, BANDS); diff --git a/vapi/Makefile.am b/vapi/Makefile.am index b1139ef..29cd822 100644 --- a/vapi/Makefile.am +++ b/vapi/Makefile.am @@ -1,6 +1,5 @@ noinst_DATA = \ - config.vapi \ - sys.vapi + config.vapi EXTRA_DIST = \ $(noinst_DATA) diff --git a/vapi/config.vapi b/vapi/config.vapi index 7cc4968..f4ac0ed 100644 --- a/vapi/config.vapi +++ b/vapi/config.vapi @@ -13,4 +13,7 @@ namespace Config { public const string LOCALEDIR; /* /usr/local/share/locale */ public const string PKGDATADIR; /* /usr/local/share/spek */ public const string PKGLIBDIR; /* /usr/local/lib/spek */ + + /* linux*, mingw*, or darwin* */ + public const string HOST_OS; } diff --git a/vapi/sys.vapi b/vapi/sys.vapi deleted file mode 100644 index 7d60547..0000000 --- a/vapi/sys.vapi +++ /dev/null @@ -1,14 +0,0 @@ -[CCode (cheader_filename = "sys/utsname.h")] -namespace Sys { - [CCode (cname = "struct utsname")] - public struct UtsName { - public weak string sysname; - public weak string nodename; - public weak string release; - public weak string version; - public weak string machine; - public weak string domainname; - } - [CCode (cname = "uname")] - public int uname (ref UtsName name); -} \ No newline at end of file