diff options
author | Ken Moore <ken@pcbsd.org> | 2015-03-27 14:29:03 -0400 |
---|---|---|
committer | Ken Moore <ken@pcbsd.org> | 2015-03-27 14:29:03 -0400 |
commit | f6c1de2b36756803800199cf9c80a135de1a7a51 (patch) | |
tree | 0396afa6cd57fd2a945cb9068ab249fe469135fc /libLumina | |
parent | Update the system tray Embed/Unembed routines to use the XCB library instead ... (diff) | |
download | lumina-f6c1de2b36756803800199cf9c80a135de1a7a51.tar.gz lumina-f6c1de2b36756803800199cf9c80a135de1a7a51.tar.bz2 lumina-f6c1de2b36756803800199cf9c80a135de1a7a51.zip |
Clean up a bit of the new XCB system tray embedding process. Still does not fix FreeBSD 11, but it is a lot more reliable now.
Diffstat (limited to 'libLumina')
-rw-r--r-- | libLumina/LuminaX11.cpp | 36 | ||||
-rw-r--r-- | libLumina/LuminaX11.h | 1 |
2 files changed, 29 insertions, 8 deletions
diff --git a/libLumina/LuminaX11.cpp b/libLumina/LuminaX11.cpp index 65a2c9a7..ab992dc3 100644 --- a/libLumina/LuminaX11.cpp +++ b/libLumina/LuminaX11.cpp @@ -1358,27 +1358,29 @@ bool LXCB::EmbedWindow(WId win, WId container){ //Reparent the window //XCompositeRedirectSubwindows(disp, container, CompositeRedirectAutomatic); //container/window should be aware of each other //qDebug() << "Embed Window:" << win << container; - xcb_reparent_window(QX11Info::connection(), win, container, 0, 0); - //Map the window - xcb_map_window(QX11Info::connection(), win); + //Initialize any atoms that will be needed - xcb_intern_atom_cookie_t acookie = xcb_intern_atom_unchecked(QX11Info::connection(), 0, 12, "_XEMBED_INFO"); + //xcb_intern_atom_cookie_t acookie = xcb_intern_atom_unchecked(QX11Info::connection(), 0, 12, "_XEMBED_INFO"); xcb_intern_atom_cookie_t ecookie = xcb_intern_atom_unchecked(QX11Info::connection(), 0, 7, "_XEMBED"); - xcb_intern_atom_reply_t *areply = xcb_intern_atom_reply(QX11Info::connection(), acookie, NULL); + /*xcb_intern_atom_reply_t *areply = xcb_intern_atom_reply(QX11Info::connection(), acookie, NULL); if(areply==0){ return false; } //unable to initialize the atom xcb_atom_t embinfo = areply->atom; free(areply); //done with this structure - + */ xcb_intern_atom_reply_t *ereply = xcb_intern_atom_reply(QX11Info::connection(), ecookie, NULL); if(ereply==0){ return false; } //unable to initialize the atom xcb_atom_t emb = ereply->atom; free(ereply); //done with this structure + //Reparent the window into the container + xcb_reparent_window(QX11Info::connection(), win, container, 0, 0); + xcb_map_window(QX11Info::connection(), win); + //Check that the window has _XEMBED_INFO //qDebug() << " - check for _XEMBED_INFO"; - xcb_get_property_cookie_t cookie = xcb_get_property_unchecked(QX11Info::connection(), 0, win, embinfo, embinfo, 0, 2); + /*xcb_get_property_cookie_t cookie = xcb_get_property_unchecked(QX11Info::connection(), 0, win, embinfo, embinfo, 0, 2); xcb_get_property_reply_t *reply = xcb_get_property_reply(QX11Info::connection(), cookie, NULL); if(reply ==0 || reply->value_len<1){ //Embed Error @@ -1386,7 +1388,7 @@ bool LXCB::EmbedWindow(WId win, WId container){ return false; } free(reply); //done with the reply structure - +*/ //Now send the embed event to the app //qDebug() << " - send _XEMBED event"; xcb_client_message_event_t event; @@ -1410,6 +1412,9 @@ bool LXCB::EmbedWindow(WId win, WId container){ //qDebug() << " - Composite Redirect"; xcb_composite_redirect_window(QX11Info::connection(), win, XCB_COMPOSITE_REDIRECT_MANUAL); + //Now map the window (will be a transparent child of the container) + xcb_map_window(QX11Info::connection(), win); + //qDebug() << " - Done"; return true; } @@ -1428,6 +1433,21 @@ bool LXCB::UnembedWindow(WId win){ return true; } +// === GetTrayIconPixmap() === +/*QPixmap LXCB::SetTrayIconBackground(WId win, WId container, QSize size){ + //Get the image of the container, copy the tray image onto it, and re-draw the combined image onto the tray + xcb_pixmap_t back, fore; + xcb_create_pixmap(QX11Info::connection(), depth, back, container, size->width(), size->height()); + xcb_create_pixmap(QX11Info::connection(), depth, fore, win, size->width(), size->height()); + + //Copy the foreround pixmap onto the background pixmap + xcb_copy_area( QX11Info::connection(), win, container, GC, 0,0,0,0 size->width(), size->height()); + + + //Now free the pixmaps + xcb_free_pixmap(QX11Info::connection(), back); + xcb_free_pixmap(QX11Info::connection(), fore); +}*/ diff --git a/libLumina/LuminaX11.h b/libLumina/LuminaX11.h index beedae36..d0b0765e 100644 --- a/libLumina/LuminaX11.h +++ b/libLumina/LuminaX11.h @@ -155,6 +155,7 @@ public: //Window Embedding/Detaching (for system tray) bool EmbedWindow(WId win, WId container); bool UnembedWindow(WId win); + //QPixmap GetTrayIconPixmap(WId win); }; |