Bug 54303

Summary: noatun "show playlist" option in Young Hickory sometimes hides playlist
Product: [Unmaintained] noatun Reporter: mark
Component: generalAssignee: Charles Samuels <charles>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Debian testing   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description mark 2003-02-08 18:41:33 UTC
Version:            (using KDE KDE 3.0.99)
Installed from:    Debian stable Packages
OS:          Linux

My housemate Matt and I are both fans of Noatun and have been confused by this bug. What happens is that sometimes we have to click "show playlist" twice from the Young Hickory interface before the playlist appears. I understand now  what's been happening and how to fix it. 

If the playlist is maximized somewhere (whether I can see it or not), the "Show Playlist" function actually /hides/ the playlist. It has to be selected a second time to actually show it  to you. 

The way it seems like it should work to me is that the the "Show Playlist" function should always try to open the playlist, maximize it, and bring it to the front.. 

If it's already in front of you and you want to hide it, you can use the standard KDE window widgets for that.
Comment 1 Charles Samuels 2003-08-03 09:36:29 UTC
It's caused by when it gets to another desktop, or is otherwise put into state where it's 
marked as "visible" even though it's not actually visible. 
 
I'm not sure how to fix this, does NETWM provide such events? 
 
Comment 2 Stefan Gehn 2003-11-16 13:26:16 UTC
This problem also applies to all gui plugins, their buttons get set to "off" status as soon as you move the playlist onto another desktop.
If just KWin devel could give us a hint on how to solve this... :(
Comment 3 Felix Berger 2004-09-25 00:16:38 UTC
This code does it for the iList playlist. It also makes iList the active window when it is hidden behind other windows on the current desktop. This may be unwanted though.

  WId id = m_window->winId();
  KWin::WindowInfo info = KWin::windowInfo(id);
  if (!info.isOnCurrentDesktop()) {
    KWin::setOnDesktop(id, KWin::currentDesktop());
    KWin::activateWindow(id);
    showList();
  }
  else if (!listVisible()) {
    showList();
  }
  else if (!m_window->isActiveWindow()) {
    KWin::activateWindow(id);
  }
  else {
    hideList();
  }
Comment 4 Stefan Gehn 2004-10-20 22:44:03 UTC
CVS commit by metz: 

- return false for listVisible() if the window is minimized/shaded/on another desktop/hidden
- make sure the playlist window opens on current desktop on showList(), opening on another desktop is too confusing

TODO: also unshade a shaded window on showList(), I cannot test this right now because kwin is awfully broken and crashes all the time when showing shaded+hidden windows again.
BUG: 54303


  M +5 -1      playlist.cpp   1.53


--- kdemultimedia/noatun/modules/splitplaylist/playlist.cpp  #1.52:1.53
@@ -6,4 +6,5 @@
 #include <krandomsequence.h>
 #include <kdebug.h>
+#include <kwin.h>
 
 #include <kiconloader.h>
@@ -168,12 +169,15 @@ PlaylistItem SplitPlaylist::getAfter(con
 bool SplitPlaylist::listVisible() const
 {
-        return view->isVisible();
+        KWin::WindowInfo info = KWin::windowInfo(view->winId());
+        return !(info.hasState(NET::Shaded) || info.hasState(NET::Hidden) || !info.valid() || !info.isOnCurrentDesktop());
 }
 
 void SplitPlaylist::showList()
 {
+        KWin::setOnDesktop(view->winId(), KWin::currentDesktop());
         view->show();
         if (view->isMinimized())
                 view->showNormal();
+        view->raise();
 }