From 4be19e3fdce0a64287205f96f1c8c7be1d9b61b0 Mon Sep 17 00:00:00 2001 From: trialuser02 Date: Mon, 21 Feb 2011 17:22:42 +0000 Subject: fixed WM_CLASS/WM_ROLE properties (Closes issue 414) git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@2066 90c681e8-e032-0410-971d-27865f9a5e38 --- src/ui/eqwidget.cpp | 3 +++ src/ui/mainwindow.cpp | 2 ++ src/ui/playlist.cpp | 3 +++ src/ui/windowsystem.cpp | 12 ++++++++++++ src/ui/windowsystem.h | 2 ++ 5 files changed, 22 insertions(+) (limited to 'src') diff --git a/src/ui/eqwidget.cpp b/src/ui/eqwidget.cpp index bdcf85f3d..1327b1bd9 100644 --- a/src/ui/eqwidget.cpp +++ b/src/ui/eqwidget.cpp @@ -428,7 +428,10 @@ void EqWidget::keyPressEvent (QKeyEvent *ke) bool EqWidget::event (QEvent *event) { if(event->type() == QEvent::WinIdChange || event->type() == QEvent::Show) + { WindowSystem::ghostWindow(winId()); + WindowSystem::setWinHint(winId(), "equalizer", "Qmmp"); + } return QWidget::event(event); } #endif diff --git a/src/ui/mainwindow.cpp b/src/ui/mainwindow.cpp index 2a4c967b0..f4f7fa4e6 100644 --- a/src/ui/mainwindow.cpp +++ b/src/ui/mainwindow.cpp @@ -322,6 +322,7 @@ void MainWindow::readSettings() } #ifdef Q_WS_X11 WindowSystem::changeWinSticky(winId(), ACTION(ActionManager::WM_STICKY)->isChecked()); + WindowSystem::setWinHint(winId(), "player", "Qmmp"); #endif //Call setWindowOpacity only if needed double opacity = settings.value("MainWindow/opacity", 1.0).toDouble(); @@ -400,6 +401,7 @@ void MainWindow::toggleVisibility() } #ifdef Q_WS_X11 WindowSystem::changeWinSticky(winId(), ACTION(ActionManager::WM_STICKY)->isChecked()); + WindowSystem::setWinHint(winId(), "player", "Qmmp"); raise(); #endif } diff --git a/src/ui/playlist.cpp b/src/ui/playlist.cpp index dcbabb8db..9ecec594c 100644 --- a/src/ui/playlist.cpp +++ b/src/ui/playlist.cpp @@ -438,7 +438,10 @@ void PlayList::readSettings() bool PlayList::event (QEvent *event) { if(event->type() == QEvent::WinIdChange || event->type() == QEvent::Show) + { WindowSystem::ghostWindow(winId()); + WindowSystem::setWinHint(winId(), "playlist", "Qmmp"); + } return QWidget::event(event); } #endif diff --git a/src/ui/windowsystem.cpp b/src/ui/windowsystem.cpp index 72746434d..4b66ae025 100644 --- a/src/ui/windowsystem.cpp +++ b/src/ui/windowsystem.cpp @@ -1,6 +1,7 @@ /*************************************************************************** * Based on Licq * * Copyright (C) 2006-2009 Licq developers * + * Copyright (C) 2011 Ilya Kotov * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -135,6 +136,17 @@ void WindowSystem::changeWinSticky(WId win, bool stick) SubstructureRedirectMask | SubstructureNotifyMask, &xev); } +void WindowSystem::setWinHint(WId win, const char *res_name, const char *res_class) +{ + Display* dsp = QX11Info::display(); + XClassHint hint; + hint.res_name = strdup(res_name); + hint.res_class = strdup(res_class); + XSetClassHint(dsp, win, &hint); + free(hint.res_name); + free(hint.res_class); +} + unsigned char* WindowSystem::getWindowProperty(WId win, const char* prop) { Display* dsp = QX11Info::display(); diff --git a/src/ui/windowsystem.h b/src/ui/windowsystem.h index 051982de5..a9d8fb001 100644 --- a/src/ui/windowsystem.h +++ b/src/ui/windowsystem.h @@ -1,6 +1,7 @@ /*************************************************************************** * Based on Licq * * Copyright (C) 2006-2009 Licq developers * + * Copyright (C) 2011 Ilya Kotov * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -30,6 +31,7 @@ public: static void ghostWindow(WId id); static QString netWindowManagerName(); static void changeWinSticky(WId win, bool stick); + static void setWinHint(WId win, const char *res_name, const char *res_class); private: static unsigned char* getWindowProperty(WId win, const char* prop); #endif -- cgit v1.2.3-13-gbd6f