///////////////////////////////////////////////////////
| 1540 | |
| 1541 | //////////////////////////////////////////////////////////// |
| 1542 | void WindowImplX11::switchToFullscreen() |
| 1543 | { |
| 1544 | using namespace WindowImplX11Impl; |
| 1545 | |
| 1546 | grabFocus(); |
| 1547 | |
| 1548 | if (isFeatureSupported("_NET_WM_STATE") && isFeatureSupported("_NET_WM_STATE_FULLSCREEN")) |
| 1549 | { |
| 1550 | static const auto netWmState = getAtom("_NET_WM_STATE"); |
| 1551 | static const auto netWmStateFullscreen = getAtom("_NET_WM_STATE_FULLSCREEN"); |
| 1552 | |
| 1553 | if (!netWmState || !netWmStateFullscreen) |
| 1554 | { |
| 1555 | err() << "Setting fullscreen failed. Could not get required atoms" << std::endl; |
| 1556 | return; |
| 1557 | } |
| 1558 | |
| 1559 | auto event = XEvent(); |
| 1560 | event.type = ClientMessage; |
| 1561 | event.xclient.window = m_window; |
| 1562 | event.xclient.format = 32; |
| 1563 | event.xclient.message_type = netWmState; |
| 1564 | event.xclient.data.l[0] = 1; // _NET_WM_STATE_ADD |
| 1565 | event.xclient.data.l[1] = static_cast<long>(netWmStateFullscreen); |
| 1566 | event.xclient.data.l[2] = 0; // No second property |
| 1567 | event.xclient.data.l[3] = 1; // Normal window |
| 1568 | |
| 1569 | const int result = XSendEvent(m_display.get(), |
| 1570 | DefaultRootWindow(m_display.get()), |
| 1571 | False, |
| 1572 | SubstructureNotifyMask | SubstructureRedirectMask, |
| 1573 | &event); |
| 1574 | |
| 1575 | if (!result) |
| 1576 | err() << "Setting fullscreen failed, could not send \"_NET_WM_STATE\" event" << std::endl; |
| 1577 | } |
| 1578 | } |
| 1579 | |
| 1580 | |
| 1581 | //////////////////////////////////////////////////////////// |
nothing calls this directly
no test coverage detected