bunch of small fixes, add msg.txt to about prefs
[goodguy/history.git] / cinelerra-5.0 / guicast / bcwindowbase.C
index 797dbbc62baa246f765bc43db3839f21b50b98c2..32547118e6514c29fd63d1b52b0884b7082fb3e0 100644 (file)
@@ -173,7 +173,9 @@ BC_WindowBase::~BC_WindowBase()
                XFreeFont(display, largefont);
                XFreeFont(display, bigfont);
 
-#ifdef HAVE_XFT
+// bug in X causes XRenderExtensionInfo to be damaged if this is done here
+//  left to be done in XCloseDisplay by Xlib.
+#if defined(HAVE_XFT) && 0
                if(bigfont_xft)
                        XftFontClose (display, (XftFont*)bigfont_xft);
                if(largefont_xft)
@@ -200,8 +202,8 @@ BC_WindowBase::~BC_WindowBase()
 #ifndef SINGLE_THREAD
 #ifdef HAVE_GL
                if( (options & GLX_DISPLAY) != 0 && get_resources()->get_synchronous() ) {
-                       printf("BC_WindowBase::~BC_WindowBase window deleted but opengl deletion is not\n"
-                               "implemented for BC_Pixmap.\n");
+                       printf(_("BC_WindowBase::~BC_WindowBase window deleted but opengl deletion is not\n"
+                               "implemented for BC_Pixmap.\n"));
                        get_resources()->get_synchronous()->delete_display(this);
                }
                else
@@ -406,7 +408,7 @@ int BC_WindowBase::create_window(BC_WindowBase *parent_window,
        else
                this->display_name[0] = 0;
 
-       strcpy(this->title, _(title));
+       put_title(_(title));
        if(bg_pixmap) shared_bg_pixmap = 1;
 
        subwindows = new BC_SubWindowList;
@@ -655,7 +657,7 @@ Display* BC_WindowBase::init_display(const char *display_name)
                printf("BC_WindowBase::init_display: cannot connect to X server %s\n",
                        display_name);
                if(getenv("DISPLAY") == NULL) {
-                       printf("'DISPLAY' environment variable not set.\n");
+                       printf(_("'DISPLAY' environment variable not set.\n"));
                        exit(1);
                }
                else {
@@ -2253,9 +2255,6 @@ int BC_WindowBase::init_fonts()
 void BC_WindowBase::init_xft()
 {
 #ifdef HAVE_XFT
-// does not seem to be thread safe (07/06/2015)
-       static Mutex xft_lock;
-       xft_lock.lock("BC_WindowBase::init_xft");
        if(!(smallfont_xft =
                (resources.small_font_xft[0] == '-' ?
                        XftFontOpenXlfd(display, screen, resources.small_font_xft) :
@@ -2295,7 +2294,6 @@ void BC_WindowBase::init_xft()
                get_resources()->use_xft = 0;
                exit(1);
        }
-       xft_lock.unlock();
 #endif // HAVE_XFT
 }
 
@@ -3996,15 +3994,30 @@ void BC_WindowBase::set_background(VFrame *bitmap)
        draw_background(0, 0, w, h);
 }
 
+void BC_WindowBase::put_title(const char *text)
+{
+       if( BC_Resources::locale_utf8 ) {
+               char *bp=this->title, *ep = bp+sizeof(this->title)-1;
+               for( const char *cp=text; *cp!=0 && bp<ep; ) {
+                       if( *cp < 0 ) { do { *bp++ = *cp++; } while( *cp < 0 );  continue; }
+                       if( *cp < ' ' ) { *bp++ = ' ';  ++cp;  continue; }
+                       *bp++ = *cp++;
+               }
+               *bp = 0;
+       }
+       else
+               strcpy(this->title, text);
+}
+
 void BC_WindowBase::set_title(const char *text)
 {
-       XTextProperty titleprop;
-       char *txlist[2];
+       put_title(_(text));
 
-       strcpy(this->title, _(text));
+       char *txlist[2];
        txlist[0] = this->title;
        txlist[1] = 0;
 
+       XTextProperty titleprop;
        XmbTextListToTextProperty(top_level->display, txlist, 1,
                XStdICCTextStyle, &titleprop);
        XSetWMName(top_level->display, top_level->win, &titleprop);