MCPcopy Create free account
hub / github.com/SFML/SFML / setProtocols

Method setProtocols

src/SFML/Window/Unix/WindowImplX11.cpp:1582–1643  ·  view source on GitHub ↗

///////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

1580
1581////////////////////////////////////////////////////////////
1582void WindowImplX11::setProtocols()
1583{
1584 using namespace WindowImplX11Impl;
1585
1586 static const auto wmProtocols = getAtom("WM_PROTOCOLS");
1587
1588 if (!wmProtocols)
1589 {
1590 err() << "Failed to request WM_PROTOCOLS atom." << std::endl;
1591 return;
1592 }
1593
1594 std::vector<Atom> atoms;
1595 static const auto wmDeleteWindow = getAtom("WM_DELETE_WINDOW");
1596
1597 if (wmDeleteWindow)
1598 {
1599 atoms.push_back(wmDeleteWindow);
1600 }
1601 else
1602 {
1603 err() << "Failed to request WM_DELETE_WINDOW atom." << std::endl;
1604 }
1605
1606 if (isFeatureSupported("_NET_WM_PING") && isFeatureSupported("_NET_WM_PID"))
1607 {
1608 static const auto netWmPing = getAtom("_NET_WM_PING");
1609 static const auto netWmPid = getAtom("_NET_WM_PID");
1610
1611 if (netWmPing && netWmPid)
1612 {
1613 const long pid = getpid();
1614
1615 XChangeProperty(m_display.get(),
1616 m_window,
1617 netWmPid,
1618 XA_CARDINAL,
1619 32,
1620 PropModeReplace,
1621 reinterpret_cast<const unsigned char*>(&pid),
1622 1);
1623
1624 atoms.push_back(netWmPing);
1625 }
1626 }
1627
1628 if (!atoms.empty())
1629 {
1630 XChangeProperty(m_display.get(),
1631 m_window,
1632 wmProtocols,
1633 XA_ATOM,
1634 32,
1635 PropModeReplace,
1636 reinterpret_cast<const unsigned char*>(atoms.data()),
1637 static_cast<int>(atoms.size()));
1638 }
1639 else

Callers

nothing calls this directly

Calls 3

getAtomFunction · 0.85
isFeatureSupportedFunction · 0.85
getMethod · 0.80

Tested by

no test coverage detected