Pthreads again, and some gtk+ fixes - Alex
authorterminatorX <>
Wed, 29 May 2002 16:11:02 +0000 (16:11 +0000)
committerterminatorX <>
Wed, 29 May 2002 16:11:02 +0000 (16:11 +0000)
ChangeLog
configure.in
src/main.cc
src/tX_dial.c
src/tX_dialog.cc
src/tX_knobloader.c
src/tX_knobloader.h
src/tX_mastergui.cc

index 24dce654d52bc05b40610188b3a312303b8cfad1..35dee74e2a3a81b32daf31a49279b41037018574 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,6 +6,8 @@ changed.
 [v3.73]
 - Fixed a compilation bug ocurring on big endian systems only.
 - Fixed the built-in wav loading routines for big endian systems (again).
+- Finally traced down and fixed a long outstanding bug in the dial widget,
+  the background of the dials is now drawn correctly.
 - Ported terminatorX to gtk+ Version 2. The code for gtk2 will be enabled
   when gtk2 is detected by configure. To force terminatorX to use the good
   old gtk 1.2.x (x>=5) run configure with the '--disable-gtk2' switch.
index b59621565ee5be36c20884a309bcd7d4ad2efe2b..a3b7029e6da219f52118bcb68ef5a63d6b403552 100644 (file)
@@ -54,6 +54,18 @@ if test "$no_threads_flags" = "yes"; then
        tX_threads=auto
 fi
 
+dnl Some machines prefer the -lpthread...
+
+if test "$tX_threads" = "no"; then
+       pthread_lib=no
+       AC_CHECK_LIB(pthread, pthread_detach, pthread_lib=yes, pthread_lib=no)
+       
+       if test "$pthread_lib" = "yes"; then
+               tX_threads=lpthread
+               LIBS="$LIBS -lpthread"
+       fi
+fi
+
 dnl Some machines prefer a -pthread...
 
 if test "$tX_threads" = "no"; then
@@ -77,17 +89,6 @@ if test "$tX_threads" = "no"; then
        fi
 fi
 
-dnl If we haven't found pthreads yet will try -lpthread...
-
-if test "$tX_threads" = "no"; then
-       pthread_lib=no
-       AC_CHECK_LIB(pthread, pthread_detach, pthread_lib=yes, pthread_lib=no)
-       
-       if test "$pthread_lib" = "yes"; then
-               tX_threads=lpthread
-       fi
-fi
-
 dnl If we still haven't found pthreads, we panic...
 
 if test "$tX_threads" = "no"; then
index ad42ee21a12199820216635ab61256dc7c37b9d2..fd40f90cdff91dde681954d98ce359f0dcf0d791 100644 (file)
 #include "tX_vtt.h"
 #endif
 
-#ifdef USE_DIAL
-#include "tX_knobloader.h"
-#endif
-
 GTimer *my_time;
 gint idle_tag;
 
@@ -422,9 +418,6 @@ int main(int argc, char **argv)
        }
                
 #ifndef CREATE_BENCHMARK
-#ifdef USE_DIAL
-       load_knob_pixs(main_window);
-#endif 
 
 //     gdk_input_init();
 
index 2df5d892e959a119ba25e82d44a570e9930365b7..d68708ec9ac2d6201b4b5ff9d867035c807e656e 100644 (file)
@@ -257,12 +257,14 @@ gtk_tx_dial_realize (GtkWidget *widget)
                                   &attributes,
                                   attributes_mask);
 
-  widget->style = gtk_style_attach (widget->style, widget->window);
-
   gdk_window_set_user_data (widget->window, widget);
+  widget->style = gtk_style_attach (widget->style, widget->window);
+  gtk_widget_set_style(widget, gtk_widget_get_default_style());
+  gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
 
-//  gtk_widget_set_style(widget, gtk_widget_get_default_style());
-  gtk_style_set_background (widget->style, widget->window, GTK_WIDGET_STATE (widget));
+  gdk_window_set_background (widget->window, 
+                             &widget->style->base[GTK_STATE_NORMAL]); 
+  gtk_widget_shape_combine_mask (widget, knob_mask, 0,0);
 }
 
 static void 
@@ -301,9 +303,10 @@ gtk_tx_dial_size_allocate (GtkWidget     *widget,
 inline void
 gtk_tx_dial_draw (GtkTxDial *tx_dial, GtkWidget *widget)
 {
-       if (GTK_WIDGET_DRAWABLE (widget))
-       gdk_draw_pixmap(widget->window, widget->style->fg_gc[GTK_WIDGET_STATE(widget)],
-                 knob_pixmaps[tx_dial->old_image], 0, 0, tx_dial->xofs, tx_dial->yofs, KNOB_SIZE, KNOB_SIZE);
+       if (GTK_WIDGET_DRAWABLE (widget)) {
+               gdk_draw_pixmap(widget->window, widget->style->bg_gc[GTK_WIDGET_STATE(widget)],
+                        knob_pixmaps[tx_dial->old_image], 0, 0, tx_dial->xofs, tx_dial->yofs, KNOB_SIZE, KNOB_SIZE);
+       }                
 }
 
 static gint
@@ -321,14 +324,6 @@ gtk_tx_dial_expose (GtkWidget      *widget,
   
   tx_dial = GTK_TX_DIAL (widget);
 
-/*  gdk_window_clear_area (widget->window,
-                        0, 0,
-                        widget->allocation.width,
-                        widget->allocation.height);
-gdk_draw_rectangle(widget->window, widget->style->fg_gc[widget->state], 1, 0, 0,
-                        widget->allocation.width,
-                        widget->allocation.height);*/
-
   gtk_tx_dial_draw(tx_dial, widget);
                  
   return FALSE;
index 5e006a32483029be21544374b0dc1bf4e959eee6..98860a8d105aa26d530fa17ae9b84b58dea2545a 100644 (file)
@@ -521,6 +521,9 @@ void destroy_about()
 #define add_about_wid(wid); gtk_box_pack_start(GTK_BOX(box), wid, WID_DYN); \
        gtk_widget_show(wid);
 
+#define add_about_wid_fix(wid); gtk_box_pack_start(GTK_BOX(box), wid, WID_FIX); \
+       gtk_widget_show(wid);
+
 GdkFont *GPL_font=NULL;
 
 void show_about(int nag)
@@ -585,12 +588,16 @@ void show_about(int nag)
        else
        {
                box=gtk_vbox_new(FALSE, 5);
-               add_about_wid(pwid);
+               add_about_wid_fix(pwid);
                
                sep=gtk_hseparator_new();
-               add_about_wid(sep);
+               add_about_wid_fix(sep);
+#ifdef USE_GTK2
+               char about_prefix_umlaut[]="\nThis is "PACKAGE" Release "VERSION" - Copyright (C) 1999-2002 by Alexander K\xC3\xB6nig";
+#else
                char about_prefix_umlaut[]="\nThis is "PACKAGE" Release "VERSION" - Copyright (C) 1999-2002 by Alexander K├Ânig";
                char about_prefix_broken_umlaut[]="\nThis is "PACKAGE" Release "VERSION" - Copyright (C) 1999-2002 by Alexander Ko\"nig";
+#endif         
                char about_rest[]="\n\nSend comments, patches and scratches to: alex@lisas.de\n"
                "terminatorX-homepage: http://www.terminatorX.cx\n\nThis binary has been compiled with the following flags: "
                "Sox support: "
@@ -641,9 +648,11 @@ void show_about(int nag)
                strcat(buffer, about_rest);
                
                label=gtk_label_new(buffer);
+
+#ifndef USE_GTK2
                gtk_label_get(GTK_LABEL(label), &str);
                
-               /* Fixng a strange gtk+ bug that appears at least on my system.
+               /* Fixing a strange gtk+ bug that appears at least on my system.
                */
                if (strlen(str)==0) 
                {
@@ -652,16 +661,17 @@ void show_about(int nag)
                        strcat(buffer, about_rest);
                        gtk_label_set(GTK_LABEL(label), buffer);                
                }
+#endif
                
                gtk_misc_set_alignment (GTK_MISC(label), 0.5 ,0.5);
-               add_about_wid(label);
+               add_about_wid_fix(label);
                
                sep=gtk_hseparator_new();
-               add_about_wid(sep);
+               add_about_wid_fix(sep);
 
                label=gtk_label_new("License (GPL V2):");
                gtk_misc_set_alignment (GTK_MISC(label), 0.5 ,0.5);
-               add_about_wid(label);
+               add_about_wid_fix(label);
 
                hbox=gtk_hbox_new(FALSE, 5);            
 
@@ -676,11 +686,15 @@ void show_about(int nag)
                gtk_text_buffer_get_iter_at_offset (tbuffer, &iter, 0);
                
                scroll=gtk_scrolled_window_new (NULL, NULL);
-        gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+               gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
                gtk_container_add (GTK_CONTAINER (scroll), text);
+               gtk_text_buffer_create_tag (tbuffer, "courier", "family", "courier", NULL);
+               
+               gtk_text_buffer_insert_with_tags_by_name(tbuffer, &iter, license, -1, "courier", NULL);
+               gtk_text_view_set_left_margin(GTK_TEXT_VIEW(text), 5);
+               gtk_text_view_set_right_margin(GTK_TEXT_VIEW(text), 5);
+               gtk_widget_set_usize(GTK_WIDGET(text), 640, 180);
                gtk_widget_show(text);          
-
-               gtk_text_buffer_insert (tbuffer, &iter, license, -1);
                
                gtk_box_pack_start(GTK_BOX(hbox), scroll, WID_DYN);
                gtk_widget_show(scroll);                
@@ -702,10 +716,10 @@ void show_about(int nag)
                add_about_wid(hbox);
 
                sep=gtk_hseparator_new();
-               add_about_wid(sep);
+               add_about_wid_fix(sep);
 
                btn=gtk_button_new_with_label("Close");
-               add_about_wid(btn);
+               add_about_wid_fix(btn);
 
                gtk_container_add(GTK_CONTAINER(window), box);
                gtk_widget_show(box);
index c9e5b93d9c0cc7bfa2a541496b7cc0686bb47304..6af60d19bd8eda011c3ab2269fdfb641e3e54229 100644 (file)
@@ -183,18 +183,18 @@ char ** knob_pixs[MAX_KNOB_PIX]={
        };
 
 GdkPixmap *knob_pixmaps[MAX_KNOB_PIX];
+GdkBitmap *knob_mask;
 
 void load_knob_pixs(GtkWidget *wid_for_style)
 {
        int i;
-       GdkBitmap *mask;
        GtkStyle *style;
        
        style = gtk_widget_get_style(wid_for_style);
        
        for (i=0; i<MAX_KNOB_PIX; i++)
        {
-               knob_pixmaps[i]=gdk_pixmap_create_from_xpm_d(wid_for_style->window, &mask,
+               knob_pixmaps[i]=gdk_pixmap_create_from_xpm_d(wid_for_style->window, &knob_mask,
                                         &style->bg[GTK_STATE_NORMAL],
                                         (gchar **) knob_pixs[i]);
        }
index e4b9518105a6b27adbec1770c270a24256cc7a76..9739025db05993c9d323c14a79e664b73970a14d 100644 (file)
@@ -47,6 +47,7 @@ extern "C" {
 #endif
 
 extern GdkPixmap *knob_pixmaps[MAX_KNOB_PIX];
+extern GdkBitmap *knob_mask;
 extern void load_knob_pixs(GtkWidget *);
 
 #ifdef __cplusplus
index 15c81800e08917294ce3d8e1066b0a66661c1cc6..a64339beadfe78cf6026b6fb85dd94580684a8c6 100644 (file)
@@ -40,6 +40,7 @@
 #include "tX_pbutton.h"
 #include "tX_sequencer.h"
 #include "tX_mastergui.h"
+#include "tX_knobloader.h"
 
 /* I don't know a display that can handle that, but
    just to be on the safe side...
@@ -1192,6 +1193,8 @@ void display_mastergui()
        GtkWidget *top;
        gtk_widget_realize(main_window);
        tX_set_icon(main_window, "terminatorX");
+       load_knob_pixs(main_window);
+
        gtk_widget_show(main_window);
        top=gtk_widget_get_toplevel(main_window);
        xwindow=GDK_WINDOW_XWINDOW(top->window);