X11 is now optional.
authorAlexander Koenig <alex@lisas.de>
Thu, 12 May 2016 18:42:35 +0000 (20:42 +0200)
committerAlexander Koenig <alex@lisas.de>
Thu, 12 May 2016 18:42:35 +0000 (20:42 +0200)
configure.ac
src/Makefile.am
src/tX_mastergui.cc
src/tX_mastergui.h
src/tX_vttgui.cc

index d52447343244d23cf135f7910a2121b52f0582b9..dddba0745c038567f599fe359651e9178de48c27 100644 (file)
@@ -16,6 +16,7 @@ AC_ARG_ENABLE(alsa,           [  --enable-alsa           use ALSA for sound output (defau
 AC_ARG_ENABLE(jack,            [  --enable-jack           use JACK for sound output (default=auto) ])
 AC_ARG_ENABLE(oss,             [  --enable-oss            use OSS for sound output (default=auto) ])
 AC_ARG_ENABLE(pulse,           [  --enable-pulse          use PULSE for sound output (default=auto) ])
+AC_ARG_ENABLE(x11,    [  --enable-x11            include X11 specific code (default=auto) ])
 AC_ARG_ENABLE(libxml2,         [  --disable-libxml2       use libxml even if verion 2 detected (default=auto) ])
 AC_ARG_ENABLE(mad,             [  --disable-mad           disable mad for mp3 support (default=auto) ])
 AC_ARG_ENABLE(vorbis,          [  --disable-vorbis        disable libvorbis support (default=auto) ])
@@ -41,6 +42,7 @@ OPTION_OSS="no"
 OPTION_ALSA="no"
 OPTION_JACK="no"
 OPTION_PULSE="no"
+OPTION_X11="no"
 OPTION_SOX="no"
 OPTION_MPG123="no"
 OPTION_MAD="no"
@@ -407,6 +409,28 @@ if test "$using_alsa" != "yes"; then
                fi
        fi
 fi     
+
+if test "$enable_x11" != "no"; then
+               AC_CHECK_LIB(X11, XOpenDisplay, x11lib=yes, x11lib=no)
+               AC_CHECK_HEADERS(X11/Xlib.h, x11header=yes, x11header=no)
+
+    if test "$x11lib" = "yes"; then
+           if test "$x11header" = "yes"; then
+                   AC_DEFINE_UNQUOTED([USE_X11], 1, [ Define to enable X11 specific code (e.g. fullscreen mode ).])
+                                               LIBS="$LIBS -lX11"
+                   using_x11=yes
+                                               OPTION_X11=yes
+           else 
+                   if test "$enable_x11" = "yes"; then
+                           AC_MSG_ERROR([** X11 headers not installed or broken **])
+                   fi
+           fi
+    else
+           if test "$enable_x11" = "yes"; then
+                   AC_MSG_ERROR([** X11 libs not installed or broken **])
+           fi
+    fi
+fi
        
 if test "$enable_wav" != "no";
 then
@@ -558,17 +582,6 @@ GNOME_DOC_INIT
 
 xml_man="\\\"${datadir}/gnome/help/terminatorX-manual/C/terminatorX-manual.xml\\\""
 
-dnl Now Check for Xlibs - I do this here as other tests fail if these run earlier
-AC_PATH_XTRA
-
-AC_SUBST(X_CFLAGS)
-AC_SUBST(X_PRE_LIBS)
-AC_SUBST(X_EXTRA_LIBS)
-AC_SUBST(X_LIBS)
-AC_SUBST(x_libraries)
-
-GTK_LIBS="$GTK_LIBS $X_LIBS"
-AC_CHECK_LIB(X11, XOpenDisplay,, AC_MSG_ERROR([** X11-libs not installed or broken **]), $X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS)
 
 CFLAGS="$XML_CFLAGS $CFLAGS -DXML_MANUAL=$xml_man"
 LIBS="$XML_LIBS $LIBS"
@@ -638,6 +651,7 @@ option_info;
 option=lrdf; option_val=$OPTION_LRDF; option_url=http://plugin.org.uk/releases/lrdf/
 option_info;
 
+echo "x11 support: $OPTION_X11"
 echo "legacy files support: $OPTION_LEGACY"
 echo "builtin-wav support: $OPTION_WAV"
 echo "enhanced scheduling support: $OPTION_SCHEDULER"
index 9c03c27bc59642e4da470be8ecff5ac99a69f41b..d95c058c853fb8a38788331498e23c1b4291a6a5 100644 (file)
@@ -1,4 +1,4 @@
-LIBS=@X_LIBS@ @GTK_LIBS@ @LIBS@
+LIBS=@GTK_LIBS@ @LIBS@
 
 SUBDIRS = icons
 
index 8b8592bf7ecd3eec0fc8a157eaad2c10049df839..a206ea15430e87baad9e438d209418d4450f0ebb 100644 (file)
@@ -24,7 +24,6 @@
 #include <gtk/gtk.h>
 #include <gdk/gdkx.h>
 #include <pango/pango.h>
-#include <X11/Xlib.h>
 #include <math.h>
 #include <unistd.h>
 #include <string.h>
 #include <sys/resource.h>
 #endif
 
+#ifdef USE_X11
+#include <X11/Xlib.h>
+#endif
+
 #define TX_SET_ID_10 "terminatorX turntable set file - version 1.0 - data:"
 #define TX_SET_ID_11 "terminatorX turntable set file - version 1.1 - data:"
 #define TX_SET_ID_12 "terminatorX turntable set file - version 1.2 - data:"
@@ -101,7 +104,6 @@ GtkWidget *engine_btn;
 
 GtkWidget *main_menubar;
 GtkWidget *rec_menu_item;
-GtkWidget *fullscreen_item;
 
 int rec_dont_care=0;
 gint update_tag;
@@ -110,7 +112,11 @@ gint update_tag;
 #define connect_adj(wid, func, ptr); g_signal_connect(G_OBJECT(wid), "value_changed", (GCallback) func, (void *) ptr);
 #define connect_button(wid, func, ptr); g_signal_connect(G_OBJECT(wid), "clicked", (GCallback) func, (void *) ptr);
 
+#ifdef USE_X11
 Window x_window;
+GtkWidget *fullscreen_item;
+#endif
+
 GdkWindow* top_window;
 #define WID_DYN TRUE, TRUE, 0
 #define WID_FIX FALSE, FALSE, 0
@@ -905,7 +911,10 @@ void sequencer_move(GtkWidget *wid, void *d)
        gtk_box_pack_end(GTK_BOX(status_box), dummy, WID_FIX);\
        gtk_widget_show(dummy);\
 
+#ifdef USE_X11
 void fullscreen_toggle(GtkCheckMenuItem *item, gpointer data);
+#endif
+
 void display_help();
 void display_browser();
 
@@ -1240,7 +1249,8 @@ void create_master_menu()
 
        sub_menu = gtk_menu_new ();
        gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu_item), sub_menu);
-               
+
+#ifdef USE_X11         
        menu_item = gtk_check_menu_item_new_with_mnemonic("_Fullscreen");
        fullscreen_item = menu_item;
        gtk_widget_show (menu_item);
@@ -1249,11 +1259,7 @@ void create_master_menu()
        gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu_item), globals.fullscreen_enabled);
        gtk_widget_add_accelerator (menu_item, "activate", accel_group, GDK_KEY_F11, (GdkModifierType) 0, GTK_ACCEL_VISIBLE);
        g_signal_connect(menu_item, "activate", (GCallback) fullscreen_toggle, NULL);
-       
-       menu_item = gtk_menu_item_new ();
-       gtk_widget_show (menu_item);
-       gtk_container_add (GTK_CONTAINER (sub_menu), menu_item);
-       gtk_widget_set_sensitive (menu_item, FALSE);
+#endif
 
        menu_item = gtk_image_menu_item_new_from_stock ("gtk-preferences", accel_group);
        gtk_widget_show (menu_item);
@@ -1506,7 +1512,7 @@ void create_mastergui(int x, int y)
        connect_adj(dumadj, master_volume_changed, NULL);
        dummy=gtk_scale_new(GTK_ORIENTATION_VERTICAL, dumadj);
        gtk_range_set_inverted(GTK_RANGE(dummy), TRUE);
-       gtk_scale_set_draw_value(GTK_SCALE(dummy), False);
+       gtk_scale_set_draw_value(GTK_SCALE(dummy), FALSE);
        g_signal_connect(G_OBJECT(dummy), "button_press_event", (GCallback) tX_seqpar::tX_seqpar_press, &sp_master_volume);     
        
        gtk_box_pack_end(GTK_BOX(master_vol_box), dummy, WID_FIX);
@@ -1634,6 +1640,7 @@ void remove_from_panel_bar(GtkWidget *button)
        if (buttons_on_panel_bar==0) gtk_widget_hide(panel_bar);
 }
 
+#ifdef USE_X11
 /* Fullscreen code... */
 #define _WIN_LAYER_TOP                 -1
 #define _WIN_LAYER_NORMAL      4
@@ -1682,6 +1689,7 @@ void fullscreen_setup() {
                fullscreen_toggle(NULL, NULL);
        }
 }
+#endif
 
 void display_mastergui()
 {
@@ -1690,10 +1698,13 @@ void display_mastergui()
        tX_set_icon(main_window);
        load_knob_pixs(fontHeight, gdk_window_get_scale_factor(gtk_widget_get_window(GTK_WIDGET(main_window))));
        gtk_widget_show(main_window);
-       fullscreen_setup();     
        top=gtk_widget_get_toplevel(main_window);
        top_window=GDK_WINDOW(gtk_widget_get_window(top));
+
+#ifdef USE_X11 
+       fullscreen_setup();     
        x_window=gdk_x11_window_get_xid(gtk_widget_get_window(top));
+#endif
 }
 
 pid_t help_child=0;
index a03314de3801a510c8783242af8c4a0796c1ad80..1b66806080e488ecdfb46587d22f44d89ee60751 100644 (file)
 #define _h_tx_mastergui 1
 
 #include <gtk/gtk.h>
-#include <X11/Xlib.h>
 
 #include "tX_seqpar.h"
 #include "tX_mouse.h"
 
 extern int audioon;
 extern tx_mouse mouse;
-extern Window x_window;
 extern GdkWindow* top_window;
 
 extern GtkWidget *main_window;
index 9066e818cdd3e6c0601e4911fa46a9dc1dd619a5..528afb989ac662d12385ce450e201447ab7e14a4 100644 (file)
@@ -895,6 +895,7 @@ void build_vtt_gui(vtt_class *vtt)
        gtk_entry_set_max_length(GTK_ENTRY(g->name), 256);
        gtk_entry_set_text(GTK_ENTRY(g->name), vtt->name);
        gtk_entry_set_width_chars(GTK_ENTRY(g->name), 10);
+       gtk_entry_set_max_width_chars(GTK_ENTRY(g->name), 10);
        p->add_client_widget(g->name);
        gui_set_tooltip(g->name, "Enter the turntable's name here.");
        //gtk_widget_set_size_request(g->name, 40, -1);
@@ -1088,7 +1089,7 @@ void build_vtt_gui(vtt_class *vtt)
        
        g->volume=GTK_ADJUSTMENT(gtk_adjustment_new(2.0-vtt->rel_volume, 0, 2, 0.01, 0.01, 0.01));
        dummy=gtk_scale_new(GTK_ORIENTATION_VERTICAL, GTK_ADJUSTMENT(g->volume)); 
-       gtk_scale_set_draw_value(GTK_SCALE(dummy), False);
+       gtk_scale_set_draw_value(GTK_SCALE(dummy), FALSE);
        gui_set_tooltip(dummy, "Adjust this turntable's volume.");
        g_signal_connect(G_OBJECT(dummy), "button_press_event", (GCallback) tX_seqpar::tX_seqpar_press, &vtt->sp_volume);