diff options
Diffstat (limited to 'lumina-desktop/panel-plugins/systemtray/TrayIcon.cpp')
-rw-r--r-- | lumina-desktop/panel-plugins/systemtray/TrayIcon.cpp | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/lumina-desktop/panel-plugins/systemtray/TrayIcon.cpp b/lumina-desktop/panel-plugins/systemtray/TrayIcon.cpp index 64c7c77d..716a49ed 100644 --- a/lumina-desktop/panel-plugins/systemtray/TrayIcon.cpp +++ b/lumina-desktop/panel-plugins/systemtray/TrayIcon.cpp @@ -6,11 +6,13 @@ //=========================================== #include "TrayIcon.h" -#include <X11/Xlib.h> -#include <X11/Xutil.h> +//#include <X11/Xlib.h> +//#include <X11/Xutil.h> #include <X11/extensions/Xdamage.h> -static Damage dmgID = 0; +//#include <xcb/damage.h> +//static xcb_damage_damage_t dmgID; +static int dmgID = 0; TrayIcon::TrayIcon(QWidget *parent) : QWidget(parent){ AID = 0; //nothing yet @@ -36,10 +38,10 @@ void TrayIcon::attachApp(WId id){ if( LX11::EmbedWindow(AID, IID) ){ LX11::RestoreWindow(AID); //make it visible //XSelectInput(QX11Info::display(), AID, StructureNotifyMask); + //xcb_damage_create(QX11Info::connection(), dmgID, AID, XCB_DAMAGE_REPORT_LEVEL_RAW_RECTANGLES); dmgID = XDamageCreate( QX11Info::display(), AID, XDamageReportRawRectangles ); - updateIcon(); qDebug() << "New System Tray App:" << AID; - QTimer::singleShot(500, this, SLOT(updateIcon()) ); + QTimer::singleShot(1000, this, SLOT(updateIcon()) ); }else{ qWarning() << "Could not Embed Tray Application:" << AID; //LX11::DestroyWindow(IID); @@ -64,9 +66,9 @@ void TrayIcon::detachApp(){ //Now detach the application window and clean up qDebug() << " - Unembed"; LX11::UnembedWindow(tmp); - if(dmgID!=0){ - XDamageDestroy(QX11Info::display(), dmgID); - } + //if(dmgID!=0){ + //XDamageDestroy(QX11Info::display(), dmgID); + //} qDebug() << " - finished app:" << tmp; //if(IID!=this->winId()){ LX11::DestroyWindow(IID); } IID = 0; @@ -98,6 +100,7 @@ void TrayIcon::updateIcon(){ //Make sure the icon is square QSize icosize = this->size(); LX11::ResizeWindow(AID, icosize.width(), icosize.height()); + QTimer::singleShot(500, this, SLOT(update()) ); //make sure to re-draw the window in a moment } // ============= @@ -115,7 +118,7 @@ void TrayIcon::paintEvent(QPaintEvent *event){ QPixmap pix = LX11::WindowImage(AID, false); if(pix.isNull()){ //Try to grab the window directly with Qt - //qDebug() << " - - Grab window directly"; + qDebug() << " - - Grab window directly"; pix = QPixmap::grabWindow(AID); } //qDebug() << " - Pix size:" << pix.size().width() << pix.size().height(); @@ -138,6 +141,7 @@ void TrayIcon::resizeEvent(QResizeEvent *event){ //qDebug() << "Resize Event:" << event->size().width() << event->size().height(); if(AID!=0){ LX11::ResizeWindow(AID, event->size().width(), event->size().height()); + QTimer::singleShot(500, this, SLOT(update()) ); //make sure to re-draw the window in a moment } } |