diff options
-rw-r--r-- | libLumina/LuminaX11.cpp | 14 | ||||
-rw-r--r-- | libLumina/LuminaX11.h | 2 | ||||
-rw-r--r-- | lumina-desktop/panel-plugins/systemtray/TrayIcon.cpp | 15 | ||||
-rw-r--r-- | lumina-desktop/panel-plugins/systemtray/TrayIcon.h | 14 |
4 files changed, 20 insertions, 25 deletions
diff --git a/libLumina/LuminaX11.cpp b/libLumina/LuminaX11.cpp index 05a03631..89c138ca 100644 --- a/libLumina/LuminaX11.cpp +++ b/libLumina/LuminaX11.cpp @@ -27,6 +27,7 @@ #include <xcb/xcb_icccm.h> #include <xcb/xcb_image.h> #include <xcb/composite.h> +#include <xcb/damage.h> //===== WindowList() ======== @@ -1357,15 +1358,16 @@ void LXCB::MoveResizeWindow(WId win, QRect geom){ } // === EmbedWindow() === -bool LXCB::EmbedWindow(WId win, WId container){ - if(win==0 || container==0){ return false; } +uint LXCB::EmbedWindow(WId win, WId container){ + //This returns the damage control ID number (or 0 for a failure) + if(win==0 || container==0){ return 0; } //qDebug() << "Embed Window:" << win << container; //Initialize any atoms that will be needed xcb_intern_atom_cookie_t ecookie = xcb_intern_atom_unchecked(QX11Info::connection(), 0, 7, "_XEMBED"); xcb_intern_atom_reply_t *ereply = xcb_intern_atom_reply(QX11Info::connection(), ecookie, NULL); - if(ereply==0){ return false; } //unable to initialize the atom + if(ereply==0){ return 0; } //unable to initialize the atom xcb_atom_t emb = ereply->atom; free(ereply); //done with this structure @@ -1399,8 +1401,12 @@ bool LXCB::EmbedWindow(WId win, WId container){ //Now map the window (will be a transparent child of the container) xcb_map_window(QX11Info::connection(), win); + //Now create/register the damage handler + xcb_damage_damage_t dmgID = xcb_generate_id(QX11Info::connection()); //This is a typedef for a 32-bit unsigned integer + xcb_damage_create(QX11Info::connection(), dmgID, win, XCB_DAMAGE_REPORT_LEVEL_RAW_RECTANGLES); + //qDebug() << " - Done"; - return true; + return ( (uint) dmgID ); } // === Unembed Window() === diff --git a/libLumina/LuminaX11.h b/libLumina/LuminaX11.h index 4ce279f4..0a950d63 100644 --- a/libLumina/LuminaX11.h +++ b/libLumina/LuminaX11.h @@ -153,7 +153,7 @@ public: void MoveResizeWindow(WId win, QRect geom); //Window Embedding/Detaching (for system tray) - bool EmbedWindow(WId win, WId container); + uint EmbedWindow(WId win, WId container); //returns the damage ID (or 0 for an error) bool UnembedWindow(WId win); }; diff --git a/lumina-desktop/panel-plugins/systemtray/TrayIcon.cpp b/lumina-desktop/panel-plugins/systemtray/TrayIcon.cpp index 8d0cacb3..a35db4d7 100644 --- a/lumina-desktop/panel-plugins/systemtray/TrayIcon.cpp +++ b/lumina-desktop/panel-plugins/systemtray/TrayIcon.cpp @@ -8,19 +8,20 @@ //#include <X11/Xlib.h> //#include <X11/Xutil.h> -#include <X11/extensions/Xdamage.h> +//#include <X11/extensions/Xdamage.h> //#include <xcb/damage.h> //static xcb_damage_damage_t dmgID; #include <LSession.h> #include <QScreen> - -static int dmgID = 0; +#include <LuminaX11.h> +//static int dmgID = 0; TrayIcon::TrayIcon(QWidget *parent) : QWidget(parent){ AID = 0; //nothing yet IID = 0; + dmgID = 0; } TrayIcon::~TrayIcon(){ @@ -38,12 +39,10 @@ void TrayIcon::attachApp(WId id){ else if(AID!=0){ qWarning() << "Tray Icon is already attached to a window!"; return; } AID = id; IID = this->winId(); //embed directly into this widget - //IID = LX11::CreateWindow( this->winId(), this->rect() ); //Create an intermediate window to be the parent - if( LSession::handle()->XCB->EmbedWindow(AID, IID) ){ + dmgID = LSession::handle()->XCB->EmbedWindow(AID, IID); + if( dmgID != 0 ){ 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 ); + //dmgID = XDamageCreate( QX11Info::display(), AID, XDamageReportRawRectangles ); qDebug() << "New System Tray App:" << AID; QTimer::singleShot(1000, this, SLOT(updateIcon()) ); }else{ diff --git a/lumina-desktop/panel-plugins/systemtray/TrayIcon.h b/lumina-desktop/panel-plugins/systemtray/TrayIcon.h index a3cbac31..18c51a66 100644 --- a/lumina-desktop/panel-plugins/systemtray/TrayIcon.h +++ b/lumina-desktop/panel-plugins/systemtray/TrayIcon.h @@ -22,9 +22,7 @@ #include <QImage> // libLumina includes -#include <LuminaX11.h> - -//Local includes +//#include <LuminaX11.h> class TrayIcon : public QWidget{ Q_OBJECT @@ -42,19 +40,11 @@ public slots: private: WId IID, AID; //icon ID and app ID - -//private slots: - //void slotAttach(); //so that the attachment can be done in a new thread - + uint dmgID; protected: void paintEvent(QPaintEvent *event); - //void moveEvent(QMoveEvent *event); void resizeEvent(QResizeEvent *event); - //bool x11Event(XEvent *event); -//signals: - //void AppClosed(); - //void AppAttached(); }; #endif
\ No newline at end of file |