Changeset View
Changeset View
Standalone View
Standalone View
xembed-sni-proxy/sniproxy.cpp
Show First 20 Lines • Show All 116 Lines • ▼ Show 20 Line(s) | 113 | /* | |||
---|---|---|---|---|---|
117 | 117 | | |||
118 | We can't composite it away anything parented owned by the root window (apparently) | 118 | We can't composite it away anything parented owned by the root window (apparently) | ||
119 | Stack Under works in the non composited case, but it doesn't seem to work in kwin's composited case (probably need set relevant NETWM hint) | 119 | Stack Under works in the non composited case, but it doesn't seem to work in kwin's composited case (probably need set relevant NETWM hint) | ||
120 | 120 | | |||
121 | As a last resort set opacity to 0 just to make sure this container never appears | 121 | As a last resort set opacity to 0 just to make sure this container never appears | ||
122 | */ | 122 | */ | ||
123 | 123 | | |||
124 | #ifndef VISUAL_DEBUG | 124 | #ifndef VISUAL_DEBUG | ||
125 | const uint32_t stackBelowData[] = {XCB_STACK_MODE_BELOW}; | 125 | stackContainerWindow(XCB_STACK_MODE_BELOW); | ||
126 | xcb_configure_window(c, m_containerWid, XCB_CONFIG_WINDOW_STACK_MODE, stackBelowData); | | |||
127 | 126 | | |||
128 | NETWinInfo wm(c, m_containerWid, screen->root, NET::Properties(), NET::Properties2()); | 127 | NETWinInfo wm(c, m_containerWid, screen->root, NET::Properties(), NET::Properties2()); | ||
129 | wm.setOpacity(0); | 128 | wm.setOpacity(0); | ||
130 | #endif | 129 | #endif | ||
131 | 130 | | |||
132 | xcb_flush(c); | 131 | xcb_flush(c); | ||
133 | 132 | | |||
134 | xcb_map_window(c, m_containerWid); | 133 | xcb_map_window(c, m_containerWid); | ||
▲ Show 20 Lines • Show All 74 Lines • ▼ Show 20 Line(s) | 197 | { | |||
209 | if (w > s_embedSize || h > s_embedSize) { | 208 | if (w > s_embedSize || h > s_embedSize) { | ||
210 | qCDebug(SNIPROXY) << "Scaling pixmap of window" << m_windowId << Title() << "from w*h" << w << h; | 209 | qCDebug(SNIPROXY) << "Scaling pixmap of window" << m_windowId << Title() << "from w*h" << w << h; | ||
211 | m_pixmap = m_pixmap.scaled(s_embedSize, s_embedSize, Qt::KeepAspectRatio, Qt::SmoothTransformation); | 210 | m_pixmap = m_pixmap.scaled(s_embedSize, s_embedSize, Qt::KeepAspectRatio, Qt::SmoothTransformation); | ||
212 | } | 211 | } | ||
213 | emit NewIcon(); | 212 | emit NewIcon(); | ||
214 | emit NewToolTip(); | 213 | emit NewToolTip(); | ||
215 | } | 214 | } | ||
216 | 215 | | |||
216 | void SNIProxy::stackContainerWindow(const uint32_t stackMode) const | ||||
217 | { | ||||
218 | auto c = QX11Info::connection(); | ||||
219 | const uint32_t stackData[] = {stackMode}; | ||||
220 | xcb_configure_window(c, m_containerWid, XCB_CONFIG_WINDOW_STACK_MODE, stackData); | ||||
221 | } | ||||
222 | | ||||
217 | QSize SNIProxy::calculateClientWindowSize() const | 223 | QSize SNIProxy::calculateClientWindowSize() const | ||
218 | { | 224 | { | ||
219 | auto c = QX11Info::connection(); | 225 | auto c = QX11Info::connection(); | ||
220 | 226 | | |||
221 | auto cookie = xcb_get_geometry(c, m_windowId); | 227 | auto cookie = xcb_get_geometry(c, m_windowId); | ||
222 | QScopedPointer<xcb_get_geometry_reply_t, QScopedPointerPodDeleter> | 228 | QScopedPointer<xcb_get_geometry_reply_t, QScopedPointerPodDeleter> | ||
223 | clientGeom(xcb_get_geometry_reply(c, cookie, nullptr)); | 229 | clientGeom(xcb_get_geometry_reply(c, cookie, nullptr)); | ||
224 | 230 | | |||
▲ Show 20 Lines • Show All 308 Lines • ▼ Show 20 Line(s) | 499 | { | |||
533 | if (pointer->root_y > y + clientGeom->height) | 539 | if (pointer->root_y > y + clientGeom->height) | ||
534 | configVals[1] = pointer->root_y - clientGeom->height + 1; | 540 | configVals[1] = pointer->root_y - clientGeom->height + 1; | ||
535 | else | 541 | else | ||
536 | configVals[1] = static_cast<uint32_t>(y - clickPoint.y()); | 542 | configVals[1] = static_cast<uint32_t>(y - clickPoint.y()); | ||
537 | } | 543 | } | ||
538 | xcb_configure_window(c, m_containerWid, XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y, configVals); | 544 | xcb_configure_window(c, m_containerWid, XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y, configVals); | ||
539 | 545 | | |||
540 | //pull window up | 546 | //pull window up | ||
541 | const uint32_t stackAboveData[] = {XCB_STACK_MODE_ABOVE}; | 547 | stackContainerWindow(XCB_STACK_MODE_ABOVE); | ||
542 | xcb_configure_window(c, m_containerWid, XCB_CONFIG_WINDOW_STACK_MODE, stackAboveData); | | |||
543 | 548 | | |||
544 | //mouse down | 549 | //mouse down | ||
545 | if (m_injectMode == Direct) { | 550 | if (m_injectMode == Direct) { | ||
546 | xcb_button_press_event_t* event = new xcb_button_press_event_t; | 551 | xcb_button_press_event_t* event = new xcb_button_press_event_t; | ||
547 | memset(event, 0x00, sizeof(xcb_button_press_event_t)); | 552 | memset(event, 0x00, sizeof(xcb_button_press_event_t)); | ||
548 | event->response_type = XCB_BUTTON_PRESS; | 553 | event->response_type = XCB_BUTTON_PRESS; | ||
549 | event->event = m_windowId; | 554 | event->event = m_windowId; | ||
550 | event->time = QX11Info::getTimestamp(); | 555 | event->time = QX11Info::getTimestamp(); | ||
Show All 33 Lines | 574 | { | |||
584 | 589 | | |||
585 | xcb_send_event(c, false, m_windowId, XCB_EVENT_MASK_BUTTON_RELEASE, (char *) event); | 590 | xcb_send_event(c, false, m_windowId, XCB_EVENT_MASK_BUTTON_RELEASE, (char *) event); | ||
586 | delete event; | 591 | delete event; | ||
587 | } else { | 592 | } else { | ||
588 | sendXTestReleased(QX11Info::display(), mouseButton); | 593 | sendXTestReleased(QX11Info::display(), mouseButton); | ||
589 | } | 594 | } | ||
590 | 595 | | |||
591 | #ifndef VISUAL_DEBUG | 596 | #ifndef VISUAL_DEBUG | ||
592 | const uint32_t stackBelowData[] = {XCB_STACK_MODE_BELOW}; | 597 | stackContainerWindow(XCB_STACK_MODE_BELOW); | ||
593 | xcb_configure_window(c, m_containerWid, XCB_CONFIG_WINDOW_STACK_MODE, stackBelowData); | | |||
594 | #endif | 598 | #endif | ||
595 | } | 599 | } |