mirror of
https://github.com/alexkay/spek.git
synced 2025-04-22 03:10:29 +03:00
Use uname to detect the platform
This commit is contained in:
parent
2eea265d97
commit
32619c5ced
@ -9,6 +9,7 @@ spek_SOURCES = \
|
||||
|
||||
INCLUDES = \
|
||||
-include config.h \
|
||||
-include sys/utsname.h \
|
||||
$(SPEK_CFLAGS) \
|
||||
$(IGE_MAC_CFLAGS) \
|
||||
-DLOCALEDIR=\""$(localedir)"\" \
|
||||
@ -16,7 +17,7 @@ INCLUDES = \
|
||||
-DPKGLIBDIR=\""$(pkglibdir)"\"
|
||||
|
||||
VALAFLAGS = \
|
||||
--vapidir=$(srcdir)/../vapi --pkg config \
|
||||
--vapidir=$(srcdir)/../vapi --pkg config --pkg sys \
|
||||
$(IGE_MAC_VALA) \
|
||||
@SPEK_PACKAGES@
|
||||
|
||||
|
@ -20,6 +20,7 @@ using Cairo;
|
||||
using Gdk;
|
||||
using Gtk;
|
||||
using Pango;
|
||||
using Sys;
|
||||
|
||||
namespace Spek {
|
||||
class Spectrogram : DrawingArea {
|
||||
@ -40,14 +41,14 @@ namespace Spek {
|
||||
private const int BPAD = 40;
|
||||
private const int GAP = 10;
|
||||
private const int RULER = 10;
|
||||
private const double FONT_SCALE =
|
||||
#if MAC_INTEGRATION
|
||||
1.5; // Pango/Quartz fonts are smaller than on X.
|
||||
#else
|
||||
1.0;
|
||||
#endif
|
||||
private double FONT_SCALE;
|
||||
|
||||
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;
|
||||
|
||||
// Pre-draw the palette.
|
||||
palette = new ImageSurface (Format.RGB24, RULER, BANDS);
|
||||
for (int y = 0; y < BANDS; y++) {
|
||||
|
@ -1,5 +1,6 @@
|
||||
noinst_DATA = \
|
||||
config.vapi
|
||||
config.vapi \
|
||||
sys.vapi
|
||||
|
||||
EXTRA_DIST = \
|
||||
$(noinst_DATA)
|
||||
|
14
vapi/sys.vapi
Normal file
14
vapi/sys.vapi
Normal file
@ -0,0 +1,14 @@
|
||||
[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);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user