[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-optimize
Subject:    Re: kdeinit hack for faster apps startup and more shared memory
From:       Lubos Lunak <l.lunak () suse ! cz>
Date:       2004-07-01 16:07:10
Message-ID: 200407011807.10842.l.lunak () suse ! cz
[Download RAW message or body]

On Wednesday 30 of June 2004 17:58, Lubos Lunak wrote:
>  Hello,
>
>  KDE3.2 got quite good reputation for being faster than KDE3.1. And since
> (AFAIK) there haven't been any noticeable optimizations for KDE3.3, I'd
> like to get in 3.3 at least the attached kdeinit hack. Done by Michael
> Matz, tested by Coolo, fixed by me :).
>

 Silence is agreement, so I'll commit :). It can be simply turned off if there 
will be any problem with it (I hope I got the configure checks right).

-- 
Lubos Lunak
KDE developer
---------------------------------------------------------------------
SuSE CR, s.r.o.  e-mail: l.lunak@suse.cz , l.lunak@kde.org
Drahobejlova 27  tel: +420 2 9654 2373
190 00 Praha 9   fax: +420 2 9654 2374
Czech Republic   http://www.suse.cz/

["kinit.patch" (text/x-diff)]

--- kinit/configure.in.in.sav	2004-07-01 16:41:12.000000000 +0200
+++ kinit/configure.in.in	2004-07-01 18:01:26.219247536 +0200
@@ -0,0 +1,21 @@
+KDEINIT_USE_XFT=1
+dnl check if Qt is linked against Xft
+KDE_CHECK_LIB(qt-mt,XftInit,[],[KDEINIT_USE_XFT=])
+
+dnl Xft requires freetype to compile
+KDE_FIND_PATH(freetype-config, KDEINIT_FREETYPE_CONFIG, [${prefix}/bin \
${exec_prefix}/bin /usr/bin /usr/local/bin /opt/local/bin]) +if test -n \
"$KDEINIT_FREETYPE_CONFIG"; then +    KDEINIT_XFT_INCLUDES=`$KDEINIT_FREETYPE_CONFIG \
--cflags` +    kdeinit_cppflags=$CPPFLAGS
+    CPPFLAGS="$CPPFLAGS $KDEINIT_XFT_INCLUDES"
+    KDE_CHECK_HEADER(X11/Xft/Xft.h,[],[KDEINIT_USE_XFT=])
+    CPPFLAGS=$kdeinit_cppflags
+    KDE_CHECK_HEADER(fontconfig/fontconfig.h,[],[KDEINIT_USE_XFT=])
+else
+    KDEINIT_USE_XFT=
+fi
+
+if test -n "$KDEINIT_USE_XFT"; then
+    AC_DEFINE(KDEINIT_USE_XFT,1,[Use Xft preinitialization in kdeinit])
+    AC_SUBST(KDEINIT_XFT_INCLUDES)
+fi
--- kinit/Makefile.am.sav	2003-07-01 10:05:02.000000000 +0200
+++ kinit/Makefile.am	2004-07-01 18:01:09.885730608 +0200
@@ -15,7 +15,7 @@
 #    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 #    Boston, MA 02111-1307, USA.
 
-INCLUDES = -I$(srcdir)/../libltdl/ $(all_includes)
+INCLUDES = -I$(srcdir)/../libltdl/ $(all_includes) $(KDEINIT_XFT_INCLUDES)
 
 SUBDIRS = . tests
 
--- kinit/kinit.cpp.sav	2004-05-28 17:34:36.000000000 +0200
+++ kinit/kinit.cpp	2004-07-01 18:02:20.781952744 +0200
@@ -42,6 +42,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
+#include <locale.h>
 
 #include <qstring.h>
 #include <qfile.h>
@@ -49,6 +50,7 @@
 #include <qfileinfo.h>
 #include <qtextstream.h>
 #include <qregexp.h>
+#include <qfont.h>
 #include <kinstance.h>
 #include <kstandarddirs.h>
 #include <kglobal.h>
@@ -87,6 +89,12 @@
 # endif
 #endif
 
+#ifdef KDEINIT_USE_XFT
+#include <X11/Xft/Xft.h>
+extern "C" FcBool XftInitFtLibrary (void);
+#include <fontconfig/fontconfig.h>
+#endif
+
 extern char **environ;
 
 extern int lt_dlopen_flag;
@@ -1316,6 +1324,10 @@ static void handle_requests(pid_t waitFo
          int sock = accept(d.wrapper, (struct sockaddr *)&client, &sClient);
          if (sock >= 0)
          {
+#ifdef KDEINIT_USE_XFT
+            if( !FcConfigUptoDate(NULL))
+               FcInitReinitialize();
+#endif
             if (fork() == 0)
             {
                 close_fds();
@@ -1332,6 +1344,10 @@ static void handle_requests(pid_t waitFo
          int sock = accept(d.wrapper_old, (struct sockaddr *)&client, &sClient);
          if (sock >= 0)
          {
+#ifdef KDEINIT_USE_XFT
+            if( !FcConfigUptoDate(NULL))
+               FcInitReinitialize();
+#endif
             if (fork() == 0)
             {
                 close_fds();
@@ -1742,6 +1758,22 @@ int main(int argc, char **argv, char **e
    X11fd = initXconnection();
 #endif
 
+   {
+#ifdef KDEINIT_USE_XFT
+      XftInit(0);
+      XftInitFtLibrary();
+#endif
+      QFont::initialize();
+      setlocale (LC_ALL, "");
+      setlocale (LC_NUMERIC, "C");
+      if (XSupportsLocale ())
+      {
+         // Similar to QApplication::create_xim()
+	 // but we need to use our own display
+	 XOpenIM (X11display, 0, 0, 0);
+      }
+   }
+
    for(i = 1; i < argc; i++)
    {
       if (safe_argv[i][0] == '+')



_______________________________________________
Kde-optimize mailing list
Kde-optimize@kde.org
https://mail.kde.org/mailman/listinfo/kde-optimize


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic