From a2f8af08ce37b9c0f322a1c3cb596658b0593e7c Mon Sep 17 00:00:00 2001 From: Alexey Yakovenko Date: Tue, 27 Aug 2013 22:11:51 +0200 Subject: osx support WIP --- plugins/gtkui/Makefile.am | 6 +++--- plugins/gtkui/callbacks.c | 5 +++-- plugins/gtkui/gtkui.c | 43 ++++++++++++++++++++++++++----------------- plugins/gtkui/gtkuigl.c | 2 ++ plugins/gtkui/gtkuigl.h | 3 ++- plugins/gtkui/hotkeys.c | 16 +++++++++++++--- plugins/gtkui/widgets.c | 10 ++++++++++ plugins/supereq/Makefile.am | 2 +- 8 files changed, 60 insertions(+), 27 deletions(-) (limited to 'plugins') diff --git a/plugins/gtkui/Makefile.am b/plugins/gtkui/Makefile.am index 718418c2..b6651f8a 100644 --- a/plugins/gtkui/Makefile.am +++ b/plugins/gtkui/Makefile.am @@ -150,10 +150,10 @@ GTKGLEXT_SOURCES = \ gtkglext-gtk3/gdk/x11/gdkx11glquery.h\ gtkglext-gtk3/gdk/x11/gdkx11glwindow.h -GTKGLEXT_CFLAGS = -I@top_srcdir@/plugins/gtkui/gtkglext-gtk3 -I@top_srcdir@/plugins/gtkui/gtkglext-gtk3/gdk -DGTK_GL_COMPILATION -DGDK_GL_COMPILATION -GTKGLEXT_LIBS = -lGL +GTKGLEXT_CFLAGS = +GTKGLEXT_LIBS = -ddb_gui_GTK3_la_SOURCES = $(GTKUI_SOURCES) $(GTKGLEXT_SOURCES) +ddb_gui_GTK3_la_SOURCES = $(GTKUI_SOURCES) ddb_gui_GTK3_la_LDFLAGS = -module if STATICLINK diff --git a/plugins/gtkui/callbacks.c b/plugins/gtkui/callbacks.c index c1f09515..031aeb7d 100644 --- a/plugins/gtkui/callbacks.c +++ b/plugins/gtkui/callbacks.c @@ -27,7 +27,7 @@ #include #include #include -#include +//#include #include "../../gettext.h" #include "callbacks.h" @@ -183,6 +183,7 @@ on_mainwin_key_press_event (GtkWidget *widget, GdkEventKey *event, gpointer user_data) { +#if 0 // local hotkeys // first translate gdk modifiers into X11 constants int mods = 0; @@ -230,7 +231,7 @@ on_mainwin_key_press_event (GtkWidget *widget, } } trace ("action not found\n"); - +#endif return FALSE; } diff --git a/plugins/gtkui/gtkui.c b/plugins/gtkui/gtkui.c index 8f54643b..ead2e28b 100644 --- a/plugins/gtkui/gtkui.c +++ b/plugins/gtkui/gtkui.c @@ -51,7 +51,7 @@ #include "gtkui_api.h" #include "wingeom.h" #include "widgets.h" -#include "X11/Xlib.h" +//#include "X11/Xlib.h" #undef EGG_SM_CLIENT_BACKEND_XSMP #ifdef EGG_SM_CLIENT_BACKEND_XSMP #include "smclient/eggsmclient.h" @@ -816,6 +816,12 @@ gtkui_pl_add_files_end (void); DB_playItem_t * gtkui_plt_load (ddb_playlist_t *plt, DB_playItem_t *after, const char *fname, int *pabort, int (*cb)(DB_playItem_t *it, void *data), void *user_data); +int +gtkui_command (int n, ...) { + gtkui_thread (NULL); + return 0; +} + int gtkui_message (uint32_t id, uintptr_t ctx, uint32_t p1, uint32_t p2) { ddb_gtkui_widget_t *rootwidget = w_get_rootwidget (); @@ -824,6 +830,7 @@ gtkui_message (uint32_t id, uintptr_t ctx, uint32_t p1, uint32_t p2) { } switch (id) { case DB_EV_PLUGINSLOADED: + break; // gtk must be running in separate thread gtk_initialized = 0; gtk_tid = deadbeef->thread_start (gtkui_thread, NULL); @@ -832,21 +839,6 @@ gtkui_message (uint32_t id, uintptr_t ctx, uint32_t p1, uint32_t p2) { usleep (10000); } - // override default file adding APIs to show progress bar - gtkui_original_plt_add_dir = deadbeef->plt_add_dir; - deadbeef->plt_add_dir = gtkui_plt_add_dir; - - gtkui_original_plt_add_file = deadbeef->plt_add_file; - deadbeef->plt_add_file = gtkui_plt_add_file; - - gtkui_original_pl_add_files_begin = deadbeef->pl_add_files_begin; - deadbeef->pl_add_files_begin = gtkui_pl_add_files_begin; - - gtkui_original_pl_add_files_end = deadbeef->pl_add_files_end; - deadbeef->pl_add_files_end = gtkui_pl_add_files_end; - - gtkui_original_plt_load = deadbeef->plt_load; - deadbeef->plt_load = gtkui_plt_load; break; case DB_EV_ACTIVATED: g_idle_add (activate_cb, NULL); @@ -948,7 +940,7 @@ gtkui_thread (void *ctx) { #ifdef __linux__ prctl (PR_SET_NAME, "deadbeef-gtkui", 0, 0, 0, 0); #endif - XInitThreads (); // gtkglext/xcb doesn't work without this + //XInitThreads (); // gtkglext/xcb doesn't work without this // let's start some gtk g_thread_init (NULL); add_pixmap_directory (deadbeef->get_pixmap_dir ()); @@ -1110,6 +1102,22 @@ gtkui_thread (void *ctx) { g_idle_add (unlock_playlist_columns_cb, NULL); + // override default file adding APIs to show progress bar + gtkui_original_plt_add_dir = deadbeef->plt_add_dir; + deadbeef->plt_add_dir = gtkui_plt_add_dir; + + gtkui_original_plt_add_file = deadbeef->plt_add_file; + deadbeef->plt_add_file = gtkui_plt_add_file; + + gtkui_original_pl_add_files_begin = deadbeef->pl_add_files_begin; + deadbeef->pl_add_files_begin = gtkui_pl_add_files_begin; + + gtkui_original_pl_add_files_end = deadbeef->pl_add_files_end; + deadbeef->pl_add_files_end = gtkui_pl_add_files_end; + + gtkui_original_plt_load = deadbeef->plt_load; + deadbeef->plt_load = gtkui_plt_load; + gtk_main (); w_free (); @@ -1766,5 +1774,6 @@ static ddb_gtkui_t plugin = { .w_append = w_append, .w_replace = w_replace, .w_remove = w_remove, + .gui.plugin.command = gtkui_command, .create_pltmenu = gtkui_create_pltmenu, }; diff --git a/plugins/gtkui/gtkuigl.c b/plugins/gtkui/gtkuigl.c index db2a5667..24423a10 100644 --- a/plugins/gtkui/gtkuigl.c +++ b/plugins/gtkui/gtkuigl.c @@ -21,6 +21,7 @@ #include "support.h" #include "gtkuigl.h" +#if 0 static int gl_initialized; static int gl_init_state; //PFNGLXSWAPINTERVALSGIPROC glXSwapIntervalSGI; @@ -50,3 +51,4 @@ void gtkui_gl_free (void) { // ??? } +#endif diff --git a/plugins/gtkui/gtkuigl.h b/plugins/gtkui/gtkuigl.h index ddba54dd..a19b36e2 100644 --- a/plugins/gtkui/gtkuigl.h +++ b/plugins/gtkui/gtkuigl.h @@ -19,6 +19,7 @@ #ifndef __GTKUIGL_H #define __GTKUIGL_H +#if 0 #include #include #include @@ -32,5 +33,5 @@ int gtkui_gl_init (void); - +#endif #endif diff --git a/plugins/gtkui/hotkeys.c b/plugins/gtkui/hotkeys.c index d3026b5d..7b3d1664 100644 --- a/plugins/gtkui/hotkeys.c +++ b/plugins/gtkui/hotkeys.c @@ -57,9 +57,19 @@ typedef struct #include "interface.h" #include "../libparser/parser.h" #include "../hotkeys/hotkeys.h" -#include // only for the KeySym type +//#include // only for the KeySym type #include "hotkeys.h" +#ifndef strdupa +# define strdupa(s) \ + ({ \ + const char *old = (s); \ + size_t len = strlen (old) + 1; \ + char *new = (char *) alloca (len); \ + (char *) memcpy (new, old, len); \ + }) +#endif + void on_hotkeys_actions_cursor_changed (GtkTreeView *treeview, gpointer user_data); @@ -600,13 +610,13 @@ on_hotkey_is_global_toggled (GtkToggleButton *togglebutton, typedef struct { const char *name; - KeySym keysym; + int keysym; } xkey_t; #define KEY(kname, kcode) { .name=kname, .keysym=kcode }, static const xkey_t keys[] = { - #include "../hotkeys/keysyms.inc" +// #include "../hotkeys/keysyms.inc" }; static const char * diff --git a/plugins/gtkui/widgets.c b/plugins/gtkui/widgets.c index cbb9358e..7318d894 100644 --- a/plugins/gtkui/widgets.c +++ b/plugins/gtkui/widgets.c @@ -41,6 +41,16 @@ #define min(x,y) ((x)<(y)?(x):(y)) #define max(x,y) ((x)>(y)?(x):(y)) +#ifndef strdupa +# define strdupa(s) \ + ({ \ + const char *old = (s); \ + size_t len = strlen (old) + 1; \ + char *new = (char *) alloca (len); \ + (char *) memcpy (new, old, len); \ + }) +#endif + // utility code for parsing keyvalues #define get_keyvalue(s,key,val) {\ s = gettoken_ext (s, key, "={}();");\ diff --git a/plugins/supereq/Makefile.am b/plugins/supereq/Makefile.am index 0096e4ab..ad476ee6 100644 --- a/plugins/supereq/Makefile.am +++ b/plugins/supereq/Makefile.am @@ -6,7 +6,7 @@ supereq_la_SOURCES = supereq.c Equ.cpp Equ.h Fftsg_fl.c paramlist.hpp AM_CFLAGS = $(CFLAGS) -std=c99 -DUSE_OOURA AM_CPPFLAGS = $(CXXFLAGS) -fno-exceptions -fno-rtti -nostdlib -fno-unwind-tables -DUSE_OOURA -supereq_la_LDFLAGS = -module -nostdlib -lsupc++ +supereq_la_LDFLAGS = -module supereq_la_LIBADD = $(LDADD) endif -- cgit v1.2.3