Commit 21a89dd6 authored by Konrad Materka's avatar Konrad Materka
Browse files

[XembedSNIProxy] Regression - really resize instead of notifying only.

Summary:
Regression introduced in previous commit, review D25777. Tray icons should have an ability to resize. If not, icons smaller than 32x32 will render incorectly. In addition, do not notify using xcb_configure_notify_event_t, in some cases (Wine) it messes up the event handling.

BUG: 414667
FIXED-IN: 5.18.0

Test Plan: Tested with keepass2, keepassx, pidgin, xchat, hexchat, tuxguitar, liferea, wine tflash.exe, workrave, stardict

Reviewers: #plasma_workspaces, #plasma, davidedmundson

Reviewed By: #plasma_workspaces, #plasma, davidedmundson

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D26088
parent 88c8e4b0
......@@ -158,8 +158,10 @@ bool FdoSelectionManager::nativeEventFilter(const QByteArray &eventType, void *m
const auto event = reinterpret_cast<xcb_configure_request_event_t *>(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);
}
}
}
......
......@@ -20,6 +20,7 @@
#include "sniproxy.h"
#include <algorithm>
#include <xcb/xcb.h>
#include <xcb/xcb_atom.h>
#include <xcb/xcb_event.h>
......@@ -223,20 +224,19 @@ void SNIProxy::stackContainerWindow(const uint32_t stackMode) const
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<char *>(&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 @@ QSize SNIProxy::calculateClientWindowSize() const
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);
}
......
......@@ -50,7 +50,7 @@ public:
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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment