diff --git a/xembed-sni-proxy/fdoselectionmanager.cpp b/xembed-sni-proxy/fdoselectionmanager.cpp --- a/xembed-sni-proxy/fdoselectionmanager.cpp +++ b/xembed-sni-proxy/fdoselectionmanager.cpp @@ -158,8 +158,10 @@ const auto event = reinterpret_cast(ev); const auto sniProxy = m_proxies.value(event->window); if (sniProxy) { - // The embedded window tries to move or resize. Ignore this request and send the current configuration. - sniProxy->sendConfigureNotification(); + // The embedded window tries to move or resize. Ignore move, handle resize only. + if ((event->value_mask & XCB_CONFIG_WINDOW_WIDTH) || (event->value_mask & XCB_CONFIG_WINDOW_HEIGHT)) { + sniProxy->resizeWindow(event->width, event->height); + } } } diff --git a/xembed-sni-proxy/sniproxy.h b/xembed-sni-proxy/sniproxy.h --- a/xembed-sni-proxy/sniproxy.h +++ b/xembed-sni-proxy/sniproxy.h @@ -50,7 +50,7 @@ void update(); void stackContainerWindow(const uint32_t stackMode) const; - void sendConfigureNotification() const; + void resizeWindow(const uint16_t width, const uint16_t height) const; /** * @return the category of the application associated to this item diff --git a/xembed-sni-proxy/sniproxy.cpp b/xembed-sni-proxy/sniproxy.cpp --- a/xembed-sni-proxy/sniproxy.cpp +++ b/xembed-sni-proxy/sniproxy.cpp @@ -20,6 +20,7 @@ #include "sniproxy.h" +#include #include #include #include @@ -223,20 +224,19 @@ xcb_configure_window(c, m_containerWid, XCB_CONFIG_WINDOW_STACK_MODE, stackData); } -void SNIProxy::sendConfigureNotification() const +void SNIProxy::resizeWindow(const uint16_t width, const uint16_t height) const { - xcb_configure_notify_event_t event; - memset(&event, 0x00, sizeof(xcb_configure_notify_event_t)); - event.response_type = XCB_CONFIGURE_NOTIFY; - event.event = m_windowId; - event.window = m_windowId; - event.x = 0; - event.y = 0; - event.width = s_embedSize; - event.height = s_embedSize; - auto connection = QX11Info::connection(); - xcb_send_event(connection, false, m_windowId, XCB_EVENT_MASK_STRUCTURE_NOTIFY, reinterpret_cast(&event)); + + uint16_t widthNormalized = std::min(width, s_embedSize); + uint16_t heighNormalized = std::min(height, s_embedSize); + + const uint32_t windowSizeConfigVals[2] = { widthNormalized, heighNormalized }; + xcb_configure_window(connection, m_windowId, + XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT, + windowSizeConfigVals); + + xcb_flush(connection); } QSize SNIProxy::calculateClientWindowSize() const @@ -258,12 +258,7 @@ if (clientWindowSize.isEmpty() || clientWindowSize.width() > s_embedSize || clientWindowSize.height() > s_embedSize) { qCDebug(SNIPROXY) << "Resizing window" << m_windowId << Title() << "from w*h" << clientWindowSize; - sendConfigureNotification(); - - const uint32_t windowSizeConfigVals[2] = { s_embedSize, s_embedSize }; - xcb_configure_window(c, m_windowId, - XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT, - windowSizeConfigVals); + resizeWindow(s_embedSize, s_embedSize); clientWindowSize = QSize(s_embedSize, s_embedSize); }