systrayplugin: bugfix:

1,retrymanage every time
    2,icon show in center

Change-Id: I9659bf72b4bd0411cab66e4a6d33757f0f900024
This commit is contained in:
杨万青 2015-10-16 18:49:25 +08:00
parent a41c48040d
commit 99cf01434a
Notes: Deepin Code Review 2016-06-14 07:19:47 +00:00
Verified+1: Anonymous Coward #1000004
Code-Review+2: <mr.asianwang@gmail.com>
Submitted-by: <mr.asianwang@gmail.com>
Submitted-at: Mon, 19 Oct 2015 13:59:14 +0800
Reviewed-on: https://cr.deepin.io/7832
Project: dde/dde-dock
Branch: refs/heads/master
3 changed files with 18 additions and 9 deletions

View File

@ -32,10 +32,13 @@ void CompositeTrayItem::addTrayIcon(QString key, TrayIcon * icon)
void CompositeTrayItem::remove(QString key)
{
TrayIcon * icon = m_icons.take(key);
icon->setParent(NULL);
icon->deleteLater();
if (icon) {
this->relayout();
icon->setParent(NULL);
icon->deleteLater();
this->relayout();
}
}
Dock::DockMode CompositeTrayItem::mode() const

View File

@ -31,6 +31,7 @@ void SystrayPlugin::init(DockPluginProxyInterface * proxy)
connect(m_dbusTrayManager, &TrayManager::Removed, this, &SystrayPlugin::onRemoved);
}
m_dbusTrayManager->RetryManager();
QList<uint> trayIcons = m_dbusTrayManager->trayIcons();
qDebug() << "Found trayicons: " << trayIcons;

View File

@ -11,14 +11,19 @@
#include <X11/Xlib.h>
QWindow* wrapper(WId w)
{
Display * dpy = QX11Info::display();
QWindow *tmpWindow = QWindow::fromWinId(w);
tmpWindow->resize(Dock::APPLET_CLASSIC_ICON_SIZE, Dock::APPLET_CLASSIC_ICON_SIZE);
Display * dpy = QX11Info::display();
//需要在TrayIcon销毁时候释放
QWindow* fake = new QWindow();
XReparentWindow(dpy, w, fake->winId(), 0, 0);
XMapSubwindows(dpy, fake->winId());
XFlush(dpy);
QWindow* fake = new QWindow();
// QSurfaceFormat format;
// format.setAlphaBufferSize(8);
// fake->setFormat(format);
XReparentWindow(dpy, tmpWindow->winId(), fake->winId(), 0, 0);
XMapSubwindows(dpy, fake->winId());
XFlush(dpy);
return QWindow::fromWinId(fake->winId());
return QWindow::fromWinId(fake->winId());
}
TrayIcon::TrayIcon(WId winId, QWidget *parent) :