summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog1
-rwxr-xr-xosx/bundleify.sh2
-rw-r--r--osx/gtkrc461
-rw-r--r--src/Patchage.cpp36
-rw-r--r--src/Patchage.hpp2
-rw-r--r--src/patchage.ui2
-rw-r--r--wscript11
7 files changed, 100 insertions, 415 deletions
diff --git a/ChangeLog b/ChangeLog
index e5801aa..f198cc8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,7 @@ patchage (UNRELEASED) unstable; urgency=low
* Remove Raul dependency.
* Fix font configuration on OSX.
* Use Mac style key bindings on OSX.
+ * Integrate with Mac menu bar on OSX.
-- David Robillard <d@drobilla.net> (UNRELEASED)
diff --git a/osx/bundleify.sh b/osx/bundleify.sh
index 9a49a78..220eb78 100755
--- a/osx/bundleify.sh
+++ b/osx/bundleify.sh
@@ -11,7 +11,7 @@ mkdir -p "$bundle/Contents/lib/modules"
sed -i '' 's/GDK_CONTROL_MASK/GDK_META_MASK/' $bundle/Contents/patchage.ui
# Copy GTK and pango modules to bundle
-cp /opt/local/lib/gtk-2.0/2.10.0/engines/libclearlooks.so $bundle/Contents/lib/engines
+cp /usr/local/lib/gtk-2.0/2.10.0/engines/libquartz.so $bundle/Contents/lib/engines
cp /opt/local/lib/pango/1.6.0/modules/*basic*.so $bundle/Contents/lib/modules
# Copy libraries depended on by the executable to bundle
diff --git a/osx/gtkrc b/osx/gtkrc
index 6df11b2..ba7477b 100644
--- a/osx/gtkrc
+++ b/osx/gtkrc
@@ -1,426 +1,75 @@
+# FIXME: What sizes should we have?
+gtk-icon-sizes = "gtk-menu=16,16:gtk-small-toolbar=16,16:gtk-large-toolbar=24,24:gtk-dnd=32,32"
+gtk-toolbar-icon-size = small-toolbar
-# Please keep this gtkrc in sync with the other ones from Clearlooks based themes.
+gtk_color_scheme = "fg_color:#000\nbg_color:ededed\nbase_color:#fff\ntext_color:#1A1A1A\nselected_bg_color:#86ABD9\nselected_fg_color:#fff\ntooltip_bg_color:#F5F5B5\ntooltip_fg_color:#000"
-gtk-color-scheme = "base_color:#ffffff\nfg_color:#000000\ntooltip_fg_color:#000000\nselected_bg_color:#86ABD9\nselected_fg_color:#ffffff\ntext_color:#1A1A1A\nbg_color:#EDECEB\ntooltip_bg_color:#F5F5B5"
+gtk-button-images = 0
+gtk-menu-images = 0
+gtk-enable-mnemonics = 0
-style "default" {
- xthickness = 1
- ythickness = 1
+style "quartz-default"
+{
+ xthickness = 0
+ ythickness = 0
- #######################
- # Style Properties
- #######################
- GtkButton::child-displacement-x = 1
- GtkButton::child-displacement-y = 1
- GtkButton::default-border = { 0, 0, 0, 0 }
- GtkButton::image-spacing = 4
- GtkToolButton::icon-spacing = 4
+ GtkWidget::interior-focus = 1
+ GtkWidget::focus-line-width = 0
+ GtkWidget::focus-padding = 0
- GtkCheckButton::indicator-size = 14
+ GtkButton::default-border = { 0, 0, 0, 0 }
+ GtkButton::default-outside-border = { 0, 0, 0, 0 }
+ GtkButton::child-displacement-x = 0
+ GtkButton::child-displacement-y = 0
- GtkPaned::handle-size = 6
+ GtkCheckButton::indicator-spacing = 3
- GtkRange::trough-border = 0
- GtkRange::slider-width = 15
- GtkRange::stepper-size = 15
+ #GtkOptionMenu::indicator-size = { 9, 5 }
+ #GtkOptionMenu::indicator-spacing = { 7, 5, 2, 2 }
- GtkScale::slider-length = 23
- GtkScale::trough-side-details = 1
+ # We have to set a shadow to get the whole box exposed
+ GtkSpinButton::shadow-type = out
- GtkScrollbar::min-slider-length = 30
- GtkMenuBar::internal-padding = 0
- GtkExpander::expander-size = 16
- GtkToolbar::internal-padding = 1
- GtkTreeView::expander-size = 14
- GtkTreeView::vertical-separator = 0
+ GtkComboBox::appears-as-list = 0
+ GtkComboBox::focus-on-click = 0
- GtkMenu::horizontal-padding = 0
- GtkMenu::vertical-padding = 0
+ GtkNotebook::tab-curvature = 4
+ GtkNotebook::tab-overlap = 0
+
+ GtkTreeView::allow-rules = 1
+ GtkTreeView::expander-size = 14
+ GtkToolbar::internal-padding = 3
+ GtkExpander::expander-size = 14
- WnckTasklist::fade-overlay-rect = 0
- # The following line hints to gecko (and possibly other appliations)
- # that the entry should be drawn transparently on the canvas.
- # Without this, gecko will fill in the background of the entry.
- GtkEntry::honors-transparent-bg-hint = 1
+ GtkScrolledWindow::scrollbar-spacing = 0
- GtkEntry::progress-border = { 2, 2, 2, 2 }
+ #GtkMenuItem::toggle-spacing = ...
+ GtkMenuItem::horizontal-padding = 8
+ GtkSeparatorMenuItem::horizontal-padding = 2
- ####################
- # Color Definitions
- ####################
- bg[NORMAL] = @bg_color
- bg[PRELIGHT] = shade (1.02, @bg_color)
- bg[SELECTED] = @selected_bg_color
- bg[INSENSITIVE] = @bg_color
- bg[ACTIVE] = shade (0.9, @bg_color)
-
- fg[NORMAL] = @fg_color
- fg[PRELIGHT] = @fg_color
- fg[SELECTED] = @selected_fg_color
- fg[INSENSITIVE] = darker (@bg_color)
- fg[ACTIVE] = @fg_color
-
- text[NORMAL] = @text_color
- text[PRELIGHT] = @text_color
- text[SELECTED] = @selected_fg_color
- text[INSENSITIVE] = darker (@bg_color)
- text[ACTIVE] = @selected_fg_color
-
- base[NORMAL] = @base_color
- base[PRELIGHT] = shade (0.95, @bg_color)
- base[SELECTED] = @selected_bg_color
- base[INSENSITIVE] = @bg_color
- base[ACTIVE] = shade (0.9, @selected_bg_color)
-
- engine "clearlooks" {
- colorize_scrollbar = TRUE
- reliefstyle = 1
- menubarstyle = 2
- toolbarstyle = 1
- animation = FALSE
- radius = 3.0
- style = GUMMY
-
- # Set a hint to disable backward compatibility fallbacks.
- hint = "use-hints"
- }
-}
-
-style "wide" {
- xthickness = 2
- ythickness = 2
-}
-
-style "wider" {
- xthickness = 3
- ythickness = 3
-}
-
-style "entry" {
- xthickness = 3
- ythickness = 3
-
- bg[SELECTED] = mix (0.4, @selected_bg_color, @base_color)
- fg[SELECTED] = @text_color
-
- engine "clearlooks" {
- focus_color = shade (0.65, @selected_bg_color)
- }
-}
-
-style "spinbutton" {
-
- engine "clearlooks" {
- hint = "spinbutton"
- }
-}
-
-style "scale" {
- xthickness = 2
- ythickness = 2
-
- engine "clearlooks" {
- hint = "scale"
- }
-}
-
-style "vscale" {
-
- engine "clearlooks" {
- hint = "vscale"
- }
-}
-
-style "hscale" {
-
- engine "clearlooks" {
- hint = "hscale"
- }
-}
-
-style "scrollbar" {
- xthickness = 2
- ythickness = 2
-
- engine "clearlooks" {
- hint = "scrollbar"
- }
-}
-
-style "hscrollbar" {
-
- engine "clearlooks" {
- hint = "hscrollbar"
- }
-}
-
-style "vscrollbar" {
-
- engine "clearlooks" {
- hint = "vscrollbar"
- }
-}
-
-style "notebook_bg" {
-
- bg[NORMAL] = shade (1.02, @bg_color)
-}
-
-style "button" {
- xthickness = 3
- ythickness = 3
-
- bg[NORMAL] = shade (1.04, @bg_color)
- bg[PRELIGHT] = shade (1.06, @bg_color)
- bg[ACTIVE] = shade (0.85, @bg_color)
-}
-
-# The color is changed by the notebook_bg style, this style
-# changes the x/ythickness
-style "notebook" {
- xthickness = 3
- ythickness = 3
-}
-
-style "statusbar" {
-
- engine "clearlooks" {
- hint = "statusbar"
- }
-}
-
-style "comboboxentry" {
-
- engine "clearlooks" {
- # Note:
- # If you set the appears-as-list option on comboboxes in the theme,
- # then you should set this hint on the combobox instead.
- hint = "comboboxentry"
- }
-}
-
-style "menubar" {
-
- engine "clearlooks" {
- hint = "menubar"
- }
-}
-
-style "menu" {
- xthickness = 0
- ythickness = 0
-
- bg[NORMAL] = shade (1.08, @bg_color)
-
- engine "clearlooks" {
- radius = 0.0
- }
-}
-
-style "menu_item" {
- xthickness = 2
- ythickness = 3
-
- fg[PRELIGHT] = @selected_fg_color
-}
-
-# This style is there to modify the separator menu items. The goals are:
-# 1. Get a specific height.
-# 2. The line should go to the edges (ie. no border at the left/right)
-style "separator_menu_item" {
- xthickness = 1
- ythickness = 0
-
- GtkSeparatorMenuItem::horizontal-padding = 0
- GtkWidget::wide-separators = 1
- GtkWidget::separator-width = 1
- GtkWidget::separator-height = 7
+ engine "quartz"
+ {
+ }
}
+class "*" style "quartz-default"
-style "frame_title" {
-
- fg[NORMAL] = lighter (@fg_color)
+style "quartz-toolbar"
+{
+ xthickness = 3
+ ythickness = 3
}
+widget_class "*Toolbar*" style "quartz-toolbar"
-style "treeview" {
-
- engine "clearlooks" {
- hint = "treeview"
- }
+style "quartz-frame"
+{
+ xthickness = 2
+ ythickness = 2
}
+widget_class "*.<GtkFrame>" style "quartz-frame"
-# The almost useless progress bar style
-style "progressbar" {
- xthickness = 1
- ythickness = 1
-
- fg[PRELIGHT] = @selected_fg_color
-
- engine "clearlooks" {
- # Explicitly set the radius for the progress bars inside menu items.
- radius = 3.0
-
- hint = "progressbar"
- }
+style "quartz-scrolled-window"
+{
+ xthickness = 2
+ ythickness = 2
}
-
-# This style is based on the default style, so that the colors from the button
-# style are overriden again.
-style "treeview_header" = "default" {
- xthickness = 2
- ythickness = 1
-
- engine "clearlooks" {
- hint = "treeview-header"
- }
-}
-
-style "tooltips" {
- xthickness = 4
- ythickness = 4
-
- bg[NORMAL] = @tooltip_bg_color
- fg[NORMAL] = @tooltip_fg_color
-}
-
-style "nautilus_location" {
-
- bg[NORMAL] = mix (0.60, shade (1.05, @bg_color), @selected_bg_color)
-}
-
-# Wrokaroudn style for places where the text color is used instead of the fg color.
-style "text_is_fg_color_workaround" {
-
- text[NORMAL] = @fg_color
- text[PRELIGHT] = @fg_color
- text[SELECTED] = @selected_fg_color
- text[ACTIVE] = @fg_color
- text[INSENSITIVE] = darker (@bg_color)
-}
-
-# Workaround style for menus where the text color is used instead of the fg color.
-style "menuitem_text_is_fg_color_workaround" {
-
- text[NORMAL] = @fg_color
- text[PRELIGHT] = @selected_fg_color
- text[SELECTED] = @selected_fg_color
- text[ACTIVE] = @fg_color
- text[INSENSITIVE] = darker (@bg_color)
-}
-
-# Workaround style for places where the fg color is used instead of the text color.
-style "fg_is_text_color_workaround" {
-
- fg[NORMAL] = @text_color
- fg[PRELIGHT] = @text_color
- fg[SELECTED] = @selected_fg_color
- fg[ACTIVE] = @selected_fg_color
- fg[INSENSITIVE] = darker (@bg_color)
-}
-
-# Style to set the toolbar to use a flat style. This is because the "New" button in
-# Evolution is not drawn transparent. So if there is a gradient in the background it will
-# look really wrong.
-# See http://bugzilla.gnome.org/show_bug.cgi?id=446953.
-style "evo_new_button_workaround" {
-
- engine "clearlooks" {
- toolbarstyle = 0
- }
-}
-
-
-###############################################################################
-# The following part of the gtkrc applies the different styles to the widgets.
-###############################################################################
-
-# The default style is applied to every widget
-class "GtkWidget" style "default"
-
-class "GtkSeparator" style "wide"
-class "GtkFrame" style "wide"
-class "GtkCalendar" style "wide"
-class "GtkEntry" style "entry"
-
-class "GtkSpinButton" style "spinbutton"
-class "GtkScale" style "scale"
-class "GtkVScale" style "vscale"
-class "GtkHScale" style "hscale"
-class "GtkScrollbar" style "scrollbar"
-class "GtkHScrollbar" style "hscrollbar"
-class "GtkVScrollbar" style "vscrollbar"
-
-# General matching follows. The order is choosen so that the right styles override
-# each other. EG. progressbar needs to be more important than the menu match.
-widget_class "*<GtkNotebook>" style "notebook_bg"
-# This is not perfect, it could be done better.
-# (That is modify *every* widget in the notebook, and change those back that
-# we really don't want changed)
-widget_class "*<GtkNotebook>*<GtkEventBox>" style "notebook_bg"
-widget_class "*<GtkNotebook>*<GtkDrawingArea>" style "notebook_bg"
-widget_class "*<GtkNotebook>*<GtkLayout>" style "notebook_bg"
-widget_class "*<GtkNotebook>*<GtkViewport>" style "notebook_bg"
-widget_class "*<GtkNotebook>*<GtkScrolledWindow>" style "notebook_bg"
-
-widget_class "*<GtkButton>" style "button"
-widget_class "*<GtkNotebook>" style "notebook"
-widget_class "*<GtkStatusbar>*" style "statusbar"
-
-widget_class "*<GtkComboBoxEntry>*" style "comboboxentry"
-widget_class "*<GtkCombo>*" style "comboboxentry"
-
-widget_class "*<GtkMenuBar>*" style "menubar"
-widget_class "*<GtkMenu>*" style "menu"
-widget_class "*<GtkMenuItem>*" style "menu_item"
-widget_class "*<GtkSeparatorMenuItem>*" style "separator_menu_item"
-
-widget_class "*.<GtkFrame>.<GtkLabel>" style "frame_title"
-widget_class "*.<GtkTreeView>*" style "treeview"
-
-widget_class "*<GtkProgress>" style "progressbar"
-
-# Treeview headers (and similar stock GTK+ widgets)
-widget_class "*.<GtkTreeView>.<GtkButton>" style "treeview_header"
-widget_class "*.<GtkCTree>.<GtkButton>" style "treeview_header"
-widget_class "*.<GtkList>.<GtkButton>" style "treeview_header"
-widget_class "*.<GtkCList>.<GtkButton>" style "treeview_header"
-
-# The window of the tooltip is called "gtk-tooltip"
-##################################################################
-# FIXME:
-# This will not work if one embeds eg. a button into the tooltip.
-# As far as I can tell right now we will need to rework the theme
-# quite a bit to get this working correctly.
-# (It will involve setting different priorities, etc.)
-##################################################################
-widget "gtk-tooltip*" style "tooltips"
-
-##########################################################################
-# Following are special cases and workarounds for issues in applications.
-##########################################################################
-
-# Workaround for the evolution ETable (bug #527532)
-widget_class "*.<ETable>.<ECanvas>" style "treeview_header"
-# Workaround for the evolution ETree
-widget_class "*.<ETree>.<ECanvas>" style "treeview_header"
-
-# Special case the nautilus-extra-view-widget
-# ToDo: A more generic approach for all applications that have a widget like this.
-widget "*.nautilus-extra-view-widget" style : highest "nautilus_location"
-
-# Work around for http://bugzilla.gnome.org/show_bug.cgi?id=382646
-# Note that this work around assumes that the combobox is _not_ in appears-as-list mode.
-widget_class "*.<GtkComboBox>.<GtkCellView>" style "text_is_fg_color_workaround"
-# This is the part of the workaround that fixes the menus
-widget "*.gtk-combobox-popup-menu.*" style "menuitem_text_is_fg_color_workaround"
-
-# Work around the usage of GtkLabel inside GtkListItems to display text.
-# This breaks because the label is shown on a background that is based on the base color.
-widget_class "*<GtkListItem>*" style "fg_is_text_color_workaround"
-# GtkCList also uses the fg color to draw text on top of the base colors.
-widget_class "*<GtkCList>" style "fg_is_text_color_workaround"
-# Nautilus when renaming files, and maybe other places.
-widget_class "*<EelEditableLabel>" style "fg_is_text_color_workaround"
-
-# See the documentation of the style.
-widget_class "EShellWindow.GtkVBox.BonoboDock.BonoboDockBand.BonoboDockItem*" style "evo_new_button_workaround"
+widget_class "*.<GtkScrolledWindow>" style "quartz-scrolled-window"
diff --git a/src/Patchage.cpp b/src/Patchage.cpp
index b5f621e..0933535 100644
--- a/src/Patchage.cpp
+++ b/src/Patchage.cpp
@@ -41,18 +41,28 @@
#include "StateManager.hpp"
#if defined(HAVE_JACK_DBUS)
- #include "JackDbusDriver.hpp"
+ #include "JackDbusDriver.hpp"
#elif defined(PATCHAGE_LIBJACK)
- #include "JackDriver.hpp"
- #include <jack/statistics.h>
+ #include "JackDriver.hpp"
+ #include <jack/statistics.h>
#endif
#ifdef PATCHAGE_JACK_SESSION
-#include <jack/session.h>
+ #include <jack/session.h>
+#endif
+
+#ifdef PATCHAGE_GTK_OSX
+ #include <gtkosxapplication.h>
+
+static gboolean
+can_activate_cb(GtkWidget* widget, guint signal_id, gpointer data)
+{
+ return gtk_widget_is_sensitive(widget);
+}
#endif
#ifdef HAVE_ALSA
- #include "AlsaDriver.hpp"
+ #include "AlsaDriver.hpp"
#endif
using std::cout;
@@ -75,6 +85,7 @@ Patchage::Patchage(int argc, char** argv)
, INIT_WIDGET(_about_win)
, INIT_WIDGET(_main_scrolledwin)
, INIT_WIDGET(_main_win)
+ , INIT_WIDGET(_menubar)
, INIT_WIDGET(_menu_alsa_connect)
, INIT_WIDGET(_menu_alsa_disconnect)
, INIT_WIDGET(_menu_file_quit)
@@ -143,7 +154,7 @@ Patchage::Patchage(int argc, char** argv)
_main_scrolledwin->property_vadjustment().get_value()->set_step_increment(10);
_main_scrolledwin->signal_scroll_event().connect(
- sigc::mem_fun(this, &Patchage::on_scroll));
+ sigc::mem_fun(this, &Patchage::on_scroll));
#ifdef PATCHAGE_JACK_SESSION
_menu_open_session->signal_activate().connect(
@@ -235,6 +246,19 @@ Patchage::Patchage(int argc, char** argv)
// Idle callback, check if we need to refresh
Glib::signal_timeout().connect(
sigc::mem_fun(this, &Patchage::idle_callback), 100);
+
+#ifdef PATCHAGE_GTK_OSX
+ // Set up Mac menu bar
+ GtkOSXApplication* osxapp;
+ gtk_osxapplication_ready(osxapp);
+
+ _menubar->hide();
+ gtk_osxapplication_set_menu_bar(osxapp, GTK_MENU_SHELL(_menubar->gobj()));
+ gtk_osxapplication_insert_app_menu_item(
+ osxapp, GTK_WIDGET(_menu_help_about->gobj()), 0);
+ g_signal_connect(_menubar->gobj(), "can-activate-accel",
+ G_CALLBACK(can_activate_cb), NULL);
+#endif
}
Patchage::~Patchage()
diff --git a/src/Patchage.hpp b/src/Patchage.hpp
index 0027b2c..a4b8c73 100644
--- a/src/Patchage.hpp
+++ b/src/Patchage.hpp
@@ -30,6 +30,7 @@
#include <gtkmm/imagemenuitem.h>
#include <gtkmm/label.h>
#include <gtkmm/main.h>
+#include <gtkmm/menubar.h>
#include <gtkmm/menuitem.h>
#include <gtkmm/progressbar.h>
#include <gtkmm/scrolledwindow.h>
@@ -129,6 +130,7 @@ protected:
Widget<Gtk::AboutDialog> _about_win;
Widget<Gtk::ScrolledWindow> _main_scrolledwin;
Widget<Gtk::Window> _main_win;
+ Widget<Gtk::MenuBar> _menubar;
Widget<Gtk::MenuItem> _menu_alsa_connect;
Widget<Gtk::MenuItem> _menu_alsa_disconnect;
Widget<Gtk::MenuItem> _menu_file_quit;
diff --git a/src/patchage.ui b/src/patchage.ui
index 2cc21ca..c999396 100644
--- a/src/patchage.ui
+++ b/src/patchage.ui
@@ -774,7 +774,7 @@ Nedko Arnaudov &lt;nedko@arnaudov.name&gt;</property>
</object>
</child>
<child>
- <object class="GtkSeparatorMenuItem" id="separator3">
+ <object class="GtkSeparatorMenuItem" id="menu_file_quit_sep">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
diff --git a/wscript b/wscript
index 2712c4f..ce32d8c 100644
--- a/wscript
+++ b/wscript
@@ -59,6 +59,12 @@ def configure(conf):
autowaf.check_pkg(conf, 'flowcanvas-1', uselib_store='FLOWCANVAS',
atleast_version='1.0.0', mandatory=True)
+ if Options.platform == 'darwin':
+ autowaf.check_pkg(conf, 'gtk-mac-integration', uselib_store='GTK_OSX',
+ atleast_version='1.0.0', mandatory=True)
+ if conf.is_defined('HAVE_GTK_OSX'):
+ autowaf.define(conf, 'PATCHAGE_GTK_OSX', 1)
+
# Check for dladdr
conf.check(function_name='dladdr',
header_name='dlfcn.h',
@@ -108,6 +114,9 @@ def configure(conf):
autowaf.display_msg(conf, "Jack (libjack)", conf.is_defined('PATCHAGE_LIBJACK'))
autowaf.display_msg(conf, "Jack Session", conf.is_defined('PATCHAGE_JACK_SESSION'))
autowaf.display_msg(conf, "Alsa Sequencer", conf.is_defined('HAVE_ALSA'))
+ if Options.platform == 'darwin':
+ autowaf.display_msg(conf, "Mac Integration", conf.is_defined('HAVE_GTK_OSX'))
+
print('')
def build(bld):
@@ -120,7 +129,7 @@ def build(bld):
prog.includes = ['.', 'src']
prog.target = out_base + bld.env['APP_INSTALL_NAME']
prog.install_path = '${BINDIR}'
- autowaf.use_lib(bld, prog, 'DBUS FLOWCANVAS DBUS_GLIB GTKMM GNOMECANVASMM GTHREAD')
+ autowaf.use_lib(bld, prog, 'DBUS FLOWCANVAS DBUS_GLIB GTKMM GNOMECANVASMM GTHREAD GTK_OSX')
prog.source = '''
src/Patchage.cpp
src/PatchageCanvas.cpp