Bug 89242 - Signal KApplication::backgroundChanged(int) is confusing
Summary: Signal KApplication::backgroundChanged(int) is confusing
Status: CLOSED UNMAINTAINED
Alias: None
Product: kdesktop
Classification: Miscellaneous
Component: general (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: David Faure
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-09-10 15:49 UTC by Seb
Modified: 2009-01-02 20:29 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Seb 2004-09-10 15:49:41 UTC
Version:            (using KDE KDE 3.3.0)

I believe the signal void KApplication::backgroundChanged(int) is not emitted when it is necessary.
You can track the event with the application kpager2 0.3.2:

www.uni-weimar.de/~wolff3/kdelook/kpager2-0.3.2.tar.bz2

It will print to the command line when the signal is emitted and if it is a common desktop (that means one unique wallpaper for all desktops) or not. 

It seems that the the signal is emitted when I am on the desktop where I change the wallpaper. 

If I am on desktop 3 and change for desktop 2, teh signal is not emitted immediately. Iit is emitted, when I switch to desktop 2. 

Well, mostly. Sometimes, the behaviour is completely weird - no rule at all. 

KDesktop is not affected by this bug, only pagers. 

How it has to be:

If a common desktop is set and is changed, the signal should be emitted for all desktops. 
If a common desktop is set and is changed such that it's not common anymore, the signal should be emitted for all desktops.
If an uncommon desktop is set and is changed to common, the signal should be emitted for all desktops.
If an uncommon desktop is set and is changed, but stays uncommon, the signal should be emitted for that desktop, independent if it is the current desktop or not. 

There might be a second bug, too. If I ask KDesktop to send the wallpaper via dcop, it sometimes wrong. Maybe KDesktop listens on the same signal?

Best regards
Sebastian
Comment 1 David Faure 2004-09-10 20:30:31 UTC
I think whoever programmed this signal meant it to be for features like the transparency,
i.e. where only the current desktop matters (whereas for a pager all desktops matter indeed)

I don't really know the code, but the signal is emitted from KBackgroundManager::exportBackground()
in kdebase/kdesktop/. I think the exp_from check could be where your bug comes from,
maybe this patch would help?

Index: bgmanager.cc
===================================================================
RCS file: /home/kde/kdebase/kdesktop/bgmanager.cc,v
retrieving revision 1.90
diff -u -p -r1.90 bgmanager.cc
--- bgmanager.cc        28 Aug 2004 10:48:48 -0000      1.90
+++ bgmanager.cc        10 Sep 2004 18:30:11 -0000
@@ -321,13 +321,17 @@ void KBackgroundManager::slotChangeDeskt
  */
 void KBackgroundManager::exportBackground(int pixmap, int desk)
 {
-    if (!m_bExport || (m_Cache[desk]->exp_from == pixmap))
+    if ( !m_bExport )
+       return;
+
+    KIPC::sendMessageAll(KIPC::BackgroundChanged, desk+1);
+
+    if (m_Cache[desk]->exp_from == pixmap)
         return;

     m_Cache[desk]->exp_from = pixmap;
     m_pPixmapServer->add(KRootPixmap::pixmapName(desk+1),
            m_Cache[pixmap]->pixmap);
-    KIPC::sendMessageAll(KIPC::BackgroundChanged, desk+1);
 }

Comment 2 Seb 2004-09-11 00:18:55 UTC
Ouch

I can't confirm this patch. I can't compile kde by myself. (modem connection - that would be a long run to download the kde sources). I hope you can test it by yourself, download the pager from the above link and verify the patch. (And then there might be a bug in the pager itself) I'll trust you, you can close the bug and I am gonna wait for kde 3.3.1. 

Thanks for the fast reply!
Sebastian
Comment 3 Seb 2004-09-11 02:27:11 UTC
The above link is not correct.

It works with
http://www.uni-weimar.de/~wolff3/kdelook/kpager2-2004.09.11.tar.bz2

One questions about the source code (it might still be wrong):

The signal that it the background was changed must be emitted AFTER the internal pixmaps are saved. Else I would receive the signal, would ask KDesktop via DCOP to send me the background pixmap and it would send me either the old or no picture.
Comment 4 Seb 2004-09-12 02:27:07 UTC
Another issue (I am sorry for these uncompressed mails): 

 What is also wrong is that the signal is emitted whenever the desktop is changed if there are multiple wallpapers. This would be a bug in Konsole. They have to listen on KWinModule::desktopChanged to catch this and then to load the background if it is not common. 
Comment 5 David Faure 2005-06-17 21:16:49 UTC
Still didn't get a chance to test the patch?
Comment 6 FiNeX 2008-12-10 02:06:53 UTC
Kdesktop is no more mantained. Fortunatly this bug seems not to be valid for KDE 4. Please reopen if this bug is not a kdesktop one (and it is not solved) or it can be reproduced on KDE 4.
Comment 7 FiNeX 2009-01-02 20:29:10 UTC
Bug closed. Kdesktop is no more mantained.