diff options
author | Ken Moore <ken@ixsystems.com> | 2017-08-25 13:51:23 -0400 |
---|---|---|
committer | Ken Moore <ken@ixsystems.com> | 2017-08-25 13:51:23 -0400 |
commit | fe614e648144af72c8112d96901d9919d9ac2e29 (patch) | |
tree | 2ea7f22d28a973b0e5c385fb6d557d7b2cc7c650 /src-qt5/core | |
parent | Merge branch 'master' of github.com:trueos/lumina (diff) | |
download | lumina-fe614e648144af72c8112d96901d9919d9ac2e29.tar.gz lumina-fe614e648144af72c8112d96901d9919d9ac2e29.tar.bz2 lumina-fe614e648144af72c8112d96901d9919d9ac2e29.zip |
Re-enable compositing and ensure that the window embed routines work for all types of windows.
Diffstat (limited to 'src-qt5/core')
-rw-r--r-- | src-qt5/core/libLumina/NativeEmbedWidget.cpp | 57 | ||||
-rw-r--r-- | src-qt5/core/libLumina/NativeEventFilter.cpp | 6 | ||||
-rw-r--r-- | src-qt5/core/libLumina/NativeWindowSystem.cpp | 10 |
3 files changed, 39 insertions, 34 deletions
diff --git a/src-qt5/core/libLumina/NativeEmbedWidget.cpp b/src-qt5/core/libLumina/NativeEmbedWidget.cpp index 487d1040..68ba44a4 100644 --- a/src-qt5/core/libLumina/NativeEmbedWidget.cpp +++ b/src-qt5/core/libLumina/NativeEmbedWidget.cpp @@ -16,22 +16,22 @@ #include <xcb/composite.h> #include <X11/extensions/Xdamage.h> -#define DISABLE_COMPOSITING true +#define DISABLE_COMPOSITING false -#define NORMAL_WIN_EVENT_MASK (XCB_EVENT_MASK_BUTTON_PRESS | \ - XCB_EVENT_MASK_BUTTON_RELEASE | \ - XCB_EVENT_MASK_POINTER_MOTION | \ - XCB_EVENT_MASK_BUTTON_MOTION | \ - XCB_EVENT_MASK_EXPOSURE | \ - XCB_EVENT_MASK_STRUCTURE_NOTIFY | \ - XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT | \ - XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY | \ - XCB_EVENT_MASK_ENTER_WINDOW| \ - XCB_EVENT_MASK_PROPERTY_CHANGE) +#define NORMAL_WIN_EVENT_MASK () inline void registerClientEvents(WId id){ - uint32_t value_list[1] = {NORMAL_WIN_EVENT_MASK}; + uint32_t value_list[1] = {XCB_EVENT_MASK_BUTTON_PRESS + | XCB_EVENT_MASK_BUTTON_RELEASE + | XCB_EVENT_MASK_POINTER_MOTION + | XCB_EVENT_MASK_BUTTON_MOTION + | XCB_EVENT_MASK_EXPOSURE + | XCB_EVENT_MASK_STRUCTURE_NOTIFY + | XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT + | XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY + | XCB_EVENT_MASK_ENTER_WINDOW + | XCB_EVENT_MASK_PROPERTY_CHANGE}; xcb_change_window_attributes(QX11Info::connection(), id, XCB_CW_EVENT_MASK, value_list); } @@ -40,12 +40,13 @@ inline void registerClientEvents(WId id){ // ============ //Simplification functions for the XCB/XLib interactions void NativeEmbedWidget::syncWinSize(QSize sz){ - if(WIN==0 ){ return; } + if(WIN==0 || paused){ return; } else if(!sz.isValid()){ sz = this->size(); } //use the current widget size //qDebug() << "Sync Window Size:" << sz; - if(sz == winSize){ return; } //no change - const uint32_t valList[2] = {(uint32_t) sz.width(), (uint32_t) sz.height()}; - const uint32_t mask = XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT; + //if(sz == winSize){ return; } //no change + QPoint pt= this->mapToGlobal(QPoint(0,0)); + const uint32_t valList[4] = {(uint32_t) pt.x(), (uint32_t) pt.y(), (uint32_t) sz.width(), (uint32_t) sz.height()}; + const uint32_t mask = XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y | XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT; xcb_configure_window(QX11Info::connection(), WIN->id(), mask, valList); winSize = sz; //save this for checking later } @@ -95,8 +96,8 @@ NativeEmbedWidget::NativeEmbedWidget(QWidget *parent) : QWidget(parent){ bool NativeEmbedWidget::embedWindow(NativeWindow *window){ WIN = window; - //PIXBACK = xcb_generate_id(QX11Info::connection()); - xcb_reparent_window(QX11Info::connection(), WIN->id(), this->winId(), 0, 0); + //xcb_reparent_window(QX11Info::connection(), WIN->id(), this->winId(), 0, 0); + //Now send the embed event to the app //qDebug() << " - send _XEMBED event"; /*xcb_client_message_event_t event; @@ -131,8 +132,8 @@ bool NativeEmbedWidget::embedWindow(NativeWindow *window){ connect(WIN, SIGNAL(VisualChanged()), this, SLOT(repaintWindow()) ); //make sure we repaint the widget on visual change registerClientEvents(WIN->id()); - registerClientEvents(this->winId()); - qDebug() << "Events Registered:" << WIN->id() << this->winId(); + //registerClientEvents(this->winId()); + //qDebug() << "Events Registered:" << WIN->id() << this->winId(); return true; } @@ -157,15 +158,16 @@ void NativeEmbedWidget::pause(){ void NativeEmbedWidget::resume(){ paused = false; - //syncWinSize(); + syncWinSize(); //showWindow(); repaintWindow(); //update the cached image right away } void NativeEmbedWidget::resyncWindow(){ if(WIN==0){ return; } - /*return; //skip the stuff below (not working) - QRect geom = WIN->geometry(); + + // Attempt 1 : spec says to send an artificial configure event to the window + /*QRect geom = WIN->geometry(); //Send an artificial configureNotify event to the window with the global position/size included xcb_configure_notify_event_t event; event.x = geom.x() + this->pos().x(); @@ -180,15 +182,18 @@ void NativeEmbedWidget::resyncWindow(){ event.response_type = XCB_CONFIGURE_NOTIFY; xcb_send_event(QX11Info::connection(), false, WIN->id(), XCB_EVENT_MASK_STRUCTURE_NOTIFY | XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY, (const char *) &event); */ - //Just jitter the window size by 1 pixel really quick so the window knows to update it's geometry - QSize sz = this->size(); + + // Attempt 2 : Just jitter the window size by 1 pixel really quick so the window knows to update it's geometry + /*QSize sz = this->size(); uint32_t valList[2] = {(uint32_t) sz.width()-1, (uint32_t) sz.height()}; uint32_t mask = XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT; xcb_configure_window(QX11Info::connection(), WIN->id(), mask, valList); xcb_flush(QX11Info::connection()); valList[0] = (uint32_t) sz.width(); xcb_configure_window(QX11Info::connection(), WIN->id(), mask, valList); - xcb_flush(QX11Info::connection()); + xcb_flush(QX11Info::connection());*/ + + //Make sure the window size is syncronized and visual up to date syncWinSize(); QTimer::singleShot(10, this, SLOT(repaintWindow()) ); } diff --git a/src-qt5/core/libLumina/NativeEventFilter.cpp b/src-qt5/core/libLumina/NativeEventFilter.cpp index 354dbe76..df44c7fb 100644 --- a/src-qt5/core/libLumina/NativeEventFilter.cpp +++ b/src-qt5/core/libLumina/NativeEventFilter.cpp @@ -65,7 +65,7 @@ static xcb_ewmh_connection_t EWMH; static xcb_atom_t _NET_SYSTEM_TRAY_OPCODE = 0; inline void ParsePropertyEvent(xcb_property_notify_event_t *ev, NativeEventFilter *obj){ - qDebug() << "Got Property Event:" << ev->window << ev->atom; + //qDebug() << "Got Property Event:" << ev->window << ev->atom; NativeWindow::Property prop = NativeWindow::None; //Now determine which properties are getting changed, and update the native window as appropriate if(ev->atom == EWMH._NET_WM_NAME){ prop = NativeWindow::Title; } @@ -76,8 +76,8 @@ inline void ParsePropertyEvent(xcb_property_notify_event_t *ev, NativeEventFilte else if( ev->atom == EWMH._NET_WM_STATE){ prop = NativeWindow::States; } //Send out the signal if necessary if(prop!=NativeWindow::None){ - //if(DEBUG){ - qDebug() << "Detected Property Change:" << ev->window << prop; + //if(DEBUG){ + qDebug() << "Detected Property Change:" << ev->window << prop; //} obj->emit WindowPropertyChanged(ev->window, prop); }else{ diff --git a/src-qt5/core/libLumina/NativeWindowSystem.cpp b/src-qt5/core/libLumina/NativeWindowSystem.cpp index 71e95a0e..ea170b98 100644 --- a/src-qt5/core/libLumina/NativeWindowSystem.cpp +++ b/src-qt5/core/libLumina/NativeWindowSystem.cpp @@ -480,24 +480,24 @@ void NativeWindowSystem::ChangeWindowProperties(NativeWindow* win, QList< Native } if(props.contains(NativeWindow::Size) || props.contains(NativeWindow::GlobalPos) ){ xcb_configure_window_value_list_t valList; - valList.x = 0; //Note that this is the relative position - should always be 0,0 relative to the embed widget - valList.y = 0; + //valList.x = 0; //Note that this is the relative position - should always be 0,0 relative to the embed widget + //valList.y = 0; QSize sz = win->property(NativeWindow::Size).toSize(); if(props.contains(NativeWindow::Size)){ sz = vals[ props.indexOf(NativeWindow::Size) ] .toSize(); } valList.width = sz.width(); valList.height = sz.height(); - /*if(props.contains(NativeWindow::GlobalPos)){ + if(props.contains(NativeWindow::GlobalPos)){ QPoint pt = vals[ props.indexOf(NativeWindow::GlobalPos) ] .toPoint(); valList.x = pt.x(); valList.y = pt.y(); }else{ valList.x = win->property(NativeWindow::GlobalPos).toPoint().x(); valList.y = win->property(NativeWindow::GlobalPos).toPoint().y(); - }*/ + } uint16_t mask = 0; - mask = mask | XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT;// | XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y; + mask = mask | XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT | XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y; qDebug() << "Configure window Geometry:" << sz; xcb_configure_window_aux(QX11Info::connection(), win->id(), mask, &valList); } |