Update QScreen::availableGeometry() on _NET_WORKAREA atom changes

When the window manager sets new workarea using the _NET_WORKAREA xcb
atom, QScreen::availableGeometry() does not react to that and returns an
invalid available geometry. This patch reacts to that change and updates
the QScreen property properly on xcb platform.

Change-Id: I8f0b4a27bab0ce450fb7393f4d9a56f3ce9a4ea1
Reviewed-by: Uli Schlachter <psychon@znc.in>
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
bb10
Martin Klapetek 2014-03-11 13:39:53 +01:00 committed by The Qt Project
parent eadaaf69fb
commit 2ae50d9123
2 changed files with 5 additions and 1 deletions

View File

@ -371,7 +371,6 @@ void QXcbScreen::handleScreenChange(xcb_randr_screen_change_notify_event_t *chan
}
QWindowSystemInterface::handleScreenGeometryChange(QPlatformScreen::screen(), geometry());
QWindowSystemInterface::handleScreenAvailableGeometryChange(QPlatformScreen::screen(), availableGeometry());
QWindowSystemInterface::handleScreenOrientationChange(QPlatformScreen::screen(), m_orientation);
QDpi ldpi = logicalDpi();
@ -409,6 +408,8 @@ void QXcbScreen::updateGeometry(xcb_timestamp_t timestamp)
m_availableGeometry = m_geometry & virtualAvailableGeometry;
}
free(workArea);
QWindowSystemInterface::handleScreenAvailableGeometryChange(QPlatformScreen::screen(), m_availableGeometry);
}
void QXcbScreen::updateRefreshRate()

View File

@ -1825,6 +1825,7 @@ void QXcbWindow::handlePropertyNotifyEvent(const xcb_property_notify_event_t *ev
const bool propertyDeleted = event->state == XCB_PROPERTY_DELETE;
const xcb_atom_t netWmStateAtom = atom(QXcbAtom::_NET_WM_STATE);
const xcb_atom_t wmStateAtom = atom(QXcbAtom::WM_STATE);
const xcb_atom_t netWorkAreaAtom = atom(QXcbAtom::_NET_WORKAREA);
if (event->atom == netWmStateAtom || event->atom == wmStateAtom) {
if (propertyDeleted)
@ -1860,6 +1861,8 @@ void QXcbWindow::handlePropertyNotifyEvent(const xcb_property_notify_event_t *ev
m_windowState = newState;
}
return;
} else if (event->atom == netWorkAreaAtom && event->window == m_screen->root()) {
m_screen->updateGeometry(event->time);
}
}