Migrated from GTK+ 3.4 to 3.10 and from OS X 10.7 to 10.8.

This commit is contained in:
Pietro Gagliardi 2016-05-28 13:06:16 -04:00
parent ba97455ab3
commit 0d6dac5c5a
8 changed files with 24 additions and 25 deletions

View File

@ -22,6 +22,9 @@ This README is being written.<br>
*Note that today's entry may be updated later today.*
* **28 May 2016**
* As promised, **the minimum system requirements are now OS X 10.8 and GTK+ 3.10 for OS X and Unix, respectively**.
* **26 May 2016**
* Two OS X-specific functions have been added: `uiDarwinMarginAmount()` and `uiDarwinPaddingAmount()`. These return the amount of margins and padding, respectively, to give to a control, and are intended for container implementations. These are suitable for the constant of a NSLayoutConstraint. They both take a pointer parameter that is reserved for future use and should be `NULL`.
@ -50,8 +53,8 @@ This README is being written.<br>
## Runtime Requirements
* Windows: Windows Vista SP2 with Platform Update or newer
* Unix: GTK+ 3.4 or newer
* Mac OS X: OS X 10.7 or newer
* Unix: GTK+ 3.10 or newer
* Mac OS X: OS X 10.8 or newer
## Build Requirements

View File

@ -6,9 +6,9 @@
- provisions for controls that cannot be grown? especiailly for windows
- LC_VERSION_MIN_MACOSX has the 10.11 SDK; see if we can knock it down to 10.7 too; OS version is fine
- LC_VERSION_MIN_MACOSX has the 10.11 SDK; see if we can knock it down to 10.8 too; OS version is fine
- apply the OS version stuff to the test program and examples too
- what about micro versions (10.7.x)? force 10.7.0?
- what about micro versions (10.8.x)? force 10.8.0?
- go through ALL the objective-c objects we create and make sure we are using the proper ownership (alloc/init and new are owned by us, all class method constructors are autoreleased - thanks mikeash)

View File

@ -18,7 +18,7 @@ ifeq ($(TOOLCHAIN),gcc)
# tell the dynamic loader to search in the executable path for shared objects
# note: OS X's linker complains if we say -rpath= instead of -rpath,
# also note that OS X doesn't use $ORIGIN - see http://jorgen.tjer.no/post/2014/05/20/dt-rpath-ld-and-at-rpath-dyld/
# the extra slash is needed on OS X 10.7
# the extra slash is needed on OS X 10.7; have it around just to be correct
ifeq ($(OS),darwin)
LDFLAGS += -Wl,-rpath,@executable_path/
else

View File

@ -49,13 +49,13 @@ LDFLAGS += \
# flags for OS X versioning
CFLAGS += \
-mmacosx-version-min=10.7 \
-DMACOSX_DEPLOYMENT_TARGET=10.7
-mmacosx-version-min=10.8 \
-DMACOSX_DEPLOYMENT_TARGET=10.8
CXXFLAGS += \
-mmacosx-version-min=10.7 \
-DMACOSX_DEPLOYMENT_TARGET=10.7
-mmacosx-version-min=10.8 \
-DMACOSX_DEPLOYMENT_TARGET=10.8
LDFLAGS += \
-mmacosx-version-min=10.7
-mmacosx-version-min=10.8
# flags for building a shared library
LDFLAGS += \

View File

@ -4,7 +4,6 @@
// In the old days you would use a NSMatrix for this; as of OS X 10.8 this was deprecated and now you need just a bunch of NSButtons with the same superview AND same action method.
// This is documented on the NSMatrix page, but the rest of the OS X documentation says to still use NSMatrix.
// NSMatrix has weird quirks anyway...
// TODO this does not work on 10.7
// TODO
// - check that multiple radio buttons on the same parent container work right

View File

@ -1,6 +1,6 @@
// 6 january 2015
#define MAC_OS_X_VERSION_MIN_REQUIRED MAC_OS_X_VERSION_10_7
#define MAC_OS_X_VERSION_MAX_ALLOWED MAC_OS_X_VERSION_10_7
#define MAC_OS_X_VERSION_MIN_REQUIRED MAC_OS_X_VERSION_10_8
#define MAC_OS_X_VERSION_MAX_ALLOWED MAC_OS_X_VERSION_10_8
#import <Cocoa/Cocoa.h>
#import "../ui.h"
#import "../ui_darwin.h"
@ -10,9 +10,6 @@
#error Sorry, libui cannot be compiled with ARC.
#endif
// 10.7 fixups
#define NSEventModifierFlags NSUInteger
#define toNSString(str) [NSString stringWithUTF8String:(str)]
#define fromNSString(str) [(str) UTF8String]

View File

@ -6,7 +6,7 @@
#define windowWindow(w) (GTK_WINDOW(uiControlHandle(uiControl(w))))
static char *filedialog(GtkWindow *parent, GtkFileChooserAction mode, const gchar *stock)
static char *filedialog(GtkWindow *parent, GtkFileChooserAction mode, const gchar *confirm)
{
GtkWidget *fcd;
GtkFileChooser *fc;
@ -14,8 +14,8 @@ static char *filedialog(GtkWindow *parent, GtkFileChooserAction mode, const gcha
char *filename;
fcd = gtk_file_chooser_dialog_new(NULL, parent, mode,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
stock, GTK_RESPONSE_ACCEPT,
"_Cancel", GTK_RESPONSE_CANCEL,
confirm, GTK_RESPONSE_ACCEPT,
NULL);
fc = GTK_FILE_CHOOSER(fcd);
gtk_file_chooser_set_local_only(fc, FALSE);
@ -35,12 +35,12 @@ static char *filedialog(GtkWindow *parent, GtkFileChooserAction mode, const gcha
char *uiOpenFile(uiWindow *parent)
{
return filedialog(windowWindow(parent), GTK_FILE_CHOOSER_ACTION_OPEN, GTK_STOCK_OPEN);
return filedialog(windowWindow(parent), GTK_FILE_CHOOSER_ACTION_OPEN, "_Open");
}
char *uiSaveFile(uiWindow *parent)
{
return filedialog(windowWindow(parent), GTK_FILE_CHOOSER_ACTION_SAVE, GTK_STOCK_SAVE);
return filedialog(windowWindow(parent), GTK_FILE_CHOOSER_ACTION_SAVE, "_Save");
}
static void msgbox(GtkWindow *parent, const char *title, const char *description, GtkMessageType type, GtkButtonsType buttons)

View File

@ -1,8 +1,8 @@
// 22 april 2015
#define GLIB_VERSION_MIN_REQUIRED GLIB_VERSION_2_32
#define GLIB_VERSION_MAX_ALLOWED GLIB_VERSION_2_32
#define GDK_VERSION_MIN_REQUIRED GDK_VERSION_3_4
#define GDK_VERSION_MAX_ALLOWED GDK_VERSION_3_4
#define GLIB_VERSION_MIN_REQUIRED GLIB_VERSION_2_40
#define GLIB_VERSION_MAX_ALLOWED GLIB_VERSION_2_40
#define GDK_VERSION_MIN_REQUIRED GDK_VERSION_3_10
#define GDK_VERSION_MAX_ALLOWED GDK_VERSION_3_10
#include <gtk/gtk.h>
#include <math.h>
#include <dlfcn.h> // see drawtext.c