Clementine
Clementine copied to clipboard
Windows: If I click on the tray icon, Clementine window is not brought to front (with possible fix)
Using Clementine 1.3.1 and Windows 7. Actually I see this issue in all version of Clementine.
Steps to reproduce:
- run Clementine
- click on a window close button to hide it
- open some application, say Firefox
- click on Clementine's tray icon
Result: Clementine is shown, but not brought to front. Clementine's icon is flashing in the Windows taskbar.
I am aware of Windows SetForegroundWindow() limitations and I use the following hack to bring my Qt application to front from tray:
DWORD foregroundProcessId;
const HWND foregroundWindow = GetForegroundWindow();
const DWORD foregroundThreadId = GetWindowThreadProcessId(foregroundWindow, &foregroundProcessId);
// foreground process is not ours: attach to it and set focus to us
if(GetCurrentProcessId() != foregroundProcessId)
{
const DWORD currentThreadId = GetCurrentThreadId();
// attach to the foreground process and activate our window
if(!AttachThreadInput(foregroundThreadId, currentThreadId, TRUE))
{
qWarning("Cannot attach to the thread %ld (%ld)", foregroundThreadId, GetLastError());
return;
}
activate();
SetForegroundWindow(reinterpret_cast<HWND>(winId())); // Qt4! Qt5 needs fixing this
AttachThreadInput(foregroundThreadId, currentThreadId, FALSE);
}
else
activate();
However this approach may need to run Clementine under administrator, because if a foreground process runs under administrator, we won't be able to attach to it.
I have the same problem on Linux Mint 17.3
Same issue not really an issue with fuctionality just an annoying issue when the behaviour expected is it to be brough to the foreground.
Windows 10 version 1803
Same issue Ubuntu Mate 20.04
same. have to delete the config to be able to see the window.
manjaro linux / gnome