Bug 99246 - compiling KDE with --without-arts breaks notifications using external player.
Summary: compiling KDE with --without-arts breaks notifications using external player.
Status: RESOLVED FIXED
Alias: None
Product: kdelibs
Classification: Frameworks and Libraries
Component: knotify (show other bugs)
Version: unspecified
Platform: Gentoo Packages Linux
: NOR wishlist
Target Milestone: ---
Assignee: Carsten Pfeiffer
URL:
Keywords:
: 93387 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-02-13 05:03 UTC by Dave Massey
Modified: 2007-08-03 00:33 UTC (History)
6 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Patch for make knotify compile with -arts USE flag (6.88 KB, patch)
2005-06-07 16:19 UTC, Francesco D'Offizi
Details
Additional patch to actually enable knotify when --without-arts is passed (1.27 KB, patch)
2006-10-19 03:28 UTC, Diego Elio Pettenò
Details
Updated patch that works (1.65 KB, patch)
2006-10-19 04:37 UTC, Diego Elio Pettenò
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dave Massey 2005-02-13 05:03:41 UTC
Version:            (using KDE KDE 3.3.2)
Installed from:    Gentoo Packages
Compiler:          GCC 3.4 
OS:                Linux

comiling kde with --without-arts as configure option (in gentoo linux, with the "-arts" use flag)  knotify breaks, no system notifications are heard using an external player to play sounds.

see this:

http://bugs.gentoo.org/show_bug.cgi?id=79029
Comment 1 Stephan Kulow 2005-02-13 13:43:59 UTC
this is basically expected as --without-arts is a major hack and not well supported
Comment 2 Christian Hesse 2005-02-28 12:28:46 UTC
Same problem here.

Since alsa dmix works perfectly there is no need for a soundserver any more, imho. So disabling it should be possible without breaking anything.
Comment 3 Paul Hoepfner-Homme 2005-03-18 07:29:32 UTC
I think the title of this bug should be renamed to "compiling KDE with --without-arts breaks all program notifications", as not everyone uses knotify to play sounds. Personally, I only use (or used to use, before they broke) knotify's message alerts.

Is there any reason this bug hasn't been marked as confirmed?
Comment 4 Luka 2005-03-21 10:46:50 UTC
kde 3.4 doesn't solve the problem
Comment 5 kde 2005-03-24 02:24:20 UTC
*** This bug has been confirmed by popular vote. ***
Comment 6 Dave Massey 2005-03-24 03:48:09 UTC
I can confirm as well kde 3.4 doesnt solve it, and yes all knotify notifications, including messages and sounds break.
Comment 7 Thomas Beinicke 2005-03-24 03:57:33 UTC
I can confirm this as well.
The whole notification system doesn't work anymore, not only sound but everything else eg. pop ups, stop working as well.
Comment 8 Timo Maier 2005-05-18 12:01:04 UTC
Just another "/me too" - no system sounds at all without artsd.
Comment 9 Marshall Bjerke 2005-06-01 02:36:47 UTC
I have the same problem.  People should be able to use kde without arts.  Alsa dmix is a better solution than a sound server for many people so abstracting arts from kde should be easier than it is.
Comment 10 Francesco D'Offizi 2005-06-07 16:19:01 UTC
Created attachment 11365 [details]
Patch for make knotify compile with -arts USE flag

Don't know if it really works, I'm still compiling it.
I've found this patch googling and I edited it to make a better -p1 patch.
Try it and let me know if it works. If it doesn't it a good starting point, I
think.
Comment 11 Christian Hesse 2005-06-07 23:15:42 UTC
It does not work for me... Did anybody succeed?
Comment 12 Christian Hesse 2005-10-01 22:03:47 UTC
KDE SVN from 2005-09-25 does not solve the problem (and I think it will not be addressed before 3.5 final?). Any chance to get this fixed any time?
Comment 13 Chetan Reddy 2005-10-02 16:34:21 UTC
The genkdesvn ebuilds use a patch that allows notifications and sounds through external player even when kdelibs is compiled with --without-arts. Some of us(atleast one person other than me) have been using the patch since 2 months and have experienced no problems. Mario(the author of the ebuilds) even modified the patch to allow simultaneous sounds(the new kernels support this). Here is a link to the patch.

http://svn.berlios.de/wsvn/genkdesvn/trunk/kde-base/kdelibs/files/kdelibs-7-knotify-noarts.patch?op=file&rev=0&sc=0
Comment 14 Mario Tanev 2005-10-04 06:39:38 UTC
Actually, although I have not heard complaints about the patch, the truth is that the "allow simultaneous sounds" functionality that I added, might be at the price of memory leaks, which I have not had the time to investigate thoroughly. Hence, I cannot really recommend this patch. This patch is adapted from another patch that just allowed knotify to be compiled --without-arts, so maybe it's a better idea to use the original patch instead.
Comment 15 Bram Schoenmakers 2006-05-16 13:46:14 UTC
It seems to work in post KDE 3.5.2 (almost 3.5.3). Can someone please verify?
Comment 16 Carsten Lohrke 2006-05-16 17:42:38 UTC
> this is basically expected as --without-arts is a major hack and not well supported

Stephan, users want to get rid of aRts in masses. And while it's not 100% perfect, as there're a few applications, which need it - is there a chance that you add the patch to kdelibs in perspective to 3.5.4 or a possible 3.6 (be it, with a big fat warning)? If so I'd add it to Gentoo to give it some testing. Apart from the applications depending on aRts, I don't see any problem with it. Am I missing something?
Comment 17 Dexter Magnific 2006-08-24 09:06:07 UTC
Same problem here, i compiled 3.5.2, 3.5.3, 3.5.4 --without-arts and this problem has never been fixed.
Comment 18 Dexter Magnific 2006-10-17 10:16:05 UTC
Again, the new version of KDE 3.3.5 doesn't play notifications when compiled without arts support and using external player.
When do you plan to fix this bug ?
(i saw already a patch from someone, and it is just a matter of commenting two lines starting with an #ifdef and if)
Comment 19 Dexter Magnific 2006-10-17 10:17:19 UTC
Sorry it was the 3.5.5 version above.
Comment 20 Vladimir Pouzanov 2006-10-17 13:49:15 UTC
Seems to be broken in 3.5.5
Comment 21 Carsten Pfeiffer 2006-10-18 23:39:03 UTC
SVN commit 596924 by pfeiffer:

support playing sounds even with --disable-arts
apply patch from the bugreport, slightly edited
(avoiding some #ifndefs by reordering some things)
BUG: 99246


 M  +38 -5     knotify.cpp  
 M  +2 -0      knotify.h  


--- branches/KDE/3.5/kdelibs/arts/knotify/knotify.cpp #596923:596924
@@ -26,24 +26,29 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 
+#include <config.h>
+#ifndef WITHOUT_ARTS
 // aRts headers
 #include <connect.h>
 #include <dispatcher.h>
 #include <flowsystem.h>
+#include <qiomanager.h>
 #include <soundserver.h>
+#endif
 
 // QT headers
 #include <qfile.h>
 #include <qfileinfo.h>
-#include <qiomanager.h>
 #include <qstringlist.h>
 #include <qtextstream.h>
 
 // KDE headers
 #include <dcopclient.h>
 #include <kaboutdata.h>
+#ifndef WITHOUT_ARTS
 #include <kartsdispatcher.h>
 #include <kartsserver.h>
+#endif
 #include <kcmdlineargs.h>
 #include <kconfig.h>
 #include <kdebug.h>
@@ -53,8 +58,10 @@
 #include <kpassivepopup.h>
 #include <kiconloader.h>
 #include <kmacroexpander.h>
+#ifndef WITHOUT_ARTS
 #include <kplayobjectfactory.h>
 #include <kaudiomanagerplay.h>
+#endif
 #include <kprocess.h>
 #include <kstandarddirs.h>
 #include <kuniqueapplication.h>
@@ -73,22 +80,26 @@
     QString externalPlayer;
     KProcess *externalPlayerProc;
 
+#ifndef WITHOUT_ARTS
     QPtrList<KDE::PlayObject> playObjects;
     QMap<KDE::PlayObject*,int> playObjectEventMap;
+    KAudioManagerPlay *audioManager;
+#endif
     int externalPlayerEventId;
 
     bool useExternal;
     bool useArts;
     int volume;
     QTimer *playTimer;
-    KAudioManagerPlay *audioManager;
     bool inStartup;
     QString startupEvents;
 };
 
 // Yes, it's ugly to put this here, but this facilitates the cautious startup
 // procedure.
+#ifndef WITHOUT_ARTS
 KArtsServer *soundServer = 0;
+#endif
 
 extern "C"{
 
@@ -124,6 +135,7 @@
     // We try to prevent this by tracking our startup and offer options to
     // abort this.
 
+#ifndef WITHOUT_ARTS
     KConfigGroup config( KGlobal::config(), "StartProgress" );
     KConfig artsKCMConfig( "kcmartsrc" );
     artsKCMConfig.setGroup( "Arts" );
@@ -208,14 +220,23 @@
     config.writeEntry( "KNotify Init", true );
     config.sync();
 
+#else
+
+    // start notify service, without aRts
+    KNotify *notify = new KNotify( false );
+
+#endif
+
     app.dcopClient()->setDefaultObject( "Notify" );
     app.dcopClient()->setDaemonMode( true );
     // kdDebug() << "knotify starting" << endl;
 
     int ret = app.exec();
     delete notify;
+#ifndef WITHOUT_ARTS
     delete soundServer;
     delete dispatcher;
+#endif
     return ret;
 }
 }// end extern "C"
@@ -228,14 +249,16 @@
     d->globalConfig = new KConfig("knotify.eventsrc", true, false);
     d->externalPlayerProc = 0;
     d->useArts = useArts;
+    d->inStartup = true;
+#ifndef WITHOUT_ARTS
     d->playObjects.setAutoDelete(true);
     d->audioManager = 0;
-    d->inStartup = true;
     if( useArts )
     {
         connect( soundServer, SIGNAL( restartedServer() ), this, SLOT( restartedArtsd() ) );
         restartedArtsd(); //started allready need to initialize d->audioManager
     }
+#endif
 
     d->volume = 100;
 
@@ -248,12 +271,14 @@
 {
     reconfigure();
 
+#ifndef WITHOUT_ARTS
     d->playObjects.clear();
 
     delete d->globalEvents;
     delete d->globalConfig;
     delete d->externalPlayerProc;
     delete d->audioManager;
+#endif
     delete d;
 }
 
@@ -449,6 +474,7 @@
             return false;
         }
 
+#ifndef WITHOUT_ARTS
         // play sound finally
         while( d->playObjects.count()>5 )
             abortFirstPlayObject();
@@ -506,7 +532,7 @@
         }
         if ( !d->playTimer->isActive() )
             d->playTimer->start( 1000 );
-
+#endif
         return true;
 
     } else if(!d->externalPlayer.isEmpty()) {
@@ -661,6 +687,7 @@
 
 void KNotify::playTimeout()
 {
+#ifndef WITHOUT_ARTS
     for ( QPtrListIterator< KDE::PlayObject > it(d->playObjects); *it;)
     {
         QPtrListIterator< KDE::PlayObject > current = it;
@@ -678,16 +705,18 @@
     }
     if ( !d->playObjects.count() )
         d->playTimer->stop();
+#endif
 }
 
 bool KNotify::isPlaying( const QString& soundFile ) const
 {
+#ifndef WITHOUT_ARTS
     for ( QPtrListIterator< KDE::PlayObject > it(d->playObjects); *it; ++it)
     {
         if ( (*it)->mediaName() == soundFile )
             return true;
     }
-
+#endif
     return false;
 }
 
@@ -699,6 +728,7 @@
 
 void KNotify::abortFirstPlayObject()
 {
+#ifndef WITHOUT_ARTS
     QMap<KDE::PlayObject*,int>::Iterator it = d->playObjectEventMap.find( d->playObjects.getFirst() );
     if ( it != d->playObjectEventMap.end() )
     {
@@ -706,6 +736,7 @@
         d->playObjectEventMap.remove( it );
     }
     d->playObjects.removeFirst();
+#endif
 }
 
 void KNotify::soundFinished( int eventId, PlayingFinishedStatus reason )
@@ -750,10 +781,12 @@
 
 void KNotify::restartedArtsd()
 {
+#ifndef WITHOUT_ARTS
     delete d->audioManager;
     d->audioManager = new KAudioManagerPlay( soundServer );
     d->audioManager->setTitle( i18n( "KDE System Notifications" ) );
     d->audioManager->setAutoRestoreID( "KNotify Aman Play" );
+#endif
 }
 
 void KNotify::sessionReady()
--- branches/KDE/3.5/kdelibs/arts/knotify/knotify.h #596923:596924
@@ -23,7 +23,9 @@
 #include <qobject.h>
 #include <knotifyclient.h>
 #include <dcopobject.h>
+#ifndef WITHOUT_ARTS
 #include <soundserver.h>
+#endif
 
 class KNotifyPrivate;
 class KProcess;
Comment 22 Diego Elio Pettenò 2006-10-19 02:55:55 UTC
I'm not sure if that patch alone is good enough, considering that --without-arts disables the building of the whole arts subdirectory, thus effectively removing knotify from being built.
Comment 23 Diego Elio Pettenò 2006-10-19 03:26:44 UTC
Just checked twice, and KNotify support is not built when passing --without-arts as the whole arts subdirectory is skipped.
Comment 24 Diego Elio Pettenò 2006-10-19 03:28:44 UTC
Created attachment 18184 [details]
Additional patch to actually enable knotify when --without-arts is passed

I haven't compile-tested this yet, as I've just completed it and launched the
build, but as I'm going to sleep better put it here in the mean time.

This should enable only the arts/knotify subdirectory when building with
--without-arts, finally allowing it to be built as intended.

Will provide more information about it working/non-working state as soon as the
build end.
Comment 25 Diego Elio Pettenò 2006-10-19 04:37:36 UTC
Created attachment 18185 [details]
Updated patch that works

Okay this patch does build, haven't tested if it finally solves the problem
though.

soundserver.h is removed entirely from knotify.h as a) WITHOUT_ARTS is not
defined in that context when building the stub b) it does not seem to be
actually used by knotify.h itself.

Rebuilding now from scratch to make sure it builds as intended, and then will
test the rest.
Comment 26 Diego Elio Pettenò 2006-10-19 06:58:03 UTC
Patch tested and checked, it works fine here.
Comment 27 Carsten Pfeiffer 2006-10-19 09:38:11 UTC
SVN commit 597017 by pfeiffer:

apply patch by Diego Pettenò <flameeyes@gentoo.org>
to build knotify at all when arts is disabled
Thanks!
BUG: 99246


 M  +4 -0      Makefile.am  
 M  +0 -1      configure.in.in  
 M  +2 -0      knotify/Makefile.am  
 M  +0 -3      knotify/knotify.h  


--- branches/KDE/3.5/kdelibs/arts/Makefile.am #597016:597017
@@ -1,4 +1,8 @@
+if include_ARTS
 SUBDIRS = kde knotify message
+else
+SUBDIRS = knotify
+endif
 
 DOXYGEN_REFERENCES = kio kdecore kdeui
 include ../admin/Doxyfile.am
--- branches/KDE/3.5/kdelibs/arts/configure.in.in #597016:597017
@@ -22,7 +22,6 @@
 ARTS_OK=no
 
 if test "$build_arts" != "yes"; then
-  DO_NOT_COMPILE="$DO_NOT_COMPILE arts"
   AC_MSG_RESULT(disabled)
 else
 
--- branches/KDE/3.5/kdelibs/arts/knotify/Makefile.am #597016:597017
@@ -6,7 +6,9 @@
 kde_module_LTLIBRARIES = knotify.la
 
 knotify_la_SOURCES	= knotify.cpp knotify.skel
+if include_ARTS
 knotify_la_LIBADD	= -lsoundserver_idl -lqtmcop $(LIB_KDEUI) $(top_builddir)/arts/kde/libartskde.la
+endif
 knotify_la_LDFLAGS = $(all_libraries) -module -avoid-version
 knotify_la_METASOURCES = AUTO
 
--- branches/KDE/3.5/kdelibs/arts/knotify/knotify.h #597016:597017
@@ -23,9 +23,6 @@
 #include <qobject.h>
 #include <knotifyclient.h>
 #include <dcopobject.h>
-#ifndef WITHOUT_ARTS
-#include <soundserver.h>
-#endif
 
 class KNotifyPrivate;
 class KProcess;
Comment 28 Pino Toscano 2007-08-03 00:33:01 UTC
*** Bug 93387 has been marked as a duplicate of this bug. ***