mirror of
https://github.com/hyprwm/Hypr.git
synced 2024-11-25 22:35:58 +01:00
made the bar into EWMH dock
This commit is contained in:
parent
c914abe3ba
commit
da0029d45c
2 changed files with 30 additions and 5 deletions
|
@ -34,6 +34,27 @@ int64_t barMainThread() {
|
||||||
|
|
||||||
Debug::log(LOG, "Bar init Phase 1 done.");
|
Debug::log(LOG, "Bar init Phase 1 done.");
|
||||||
|
|
||||||
|
// Init atoms
|
||||||
|
// get atoms
|
||||||
|
for (auto& ATOM : HYPRATOMS) {
|
||||||
|
xcb_intern_atom_cookie_t cookie = xcb_intern_atom(g_pWindowManager->DisplayConnection, 0, ATOM.first.length(), ATOM.first.c_str());
|
||||||
|
xcb_intern_atom_reply_t* reply = xcb_intern_atom_reply(g_pWindowManager->DisplayConnection, cookie, NULL);
|
||||||
|
|
||||||
|
if (!reply) {
|
||||||
|
Debug::log(ERR, "Atom failed: " + ATOM.first);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
ATOM.second = reply->atom;
|
||||||
|
}
|
||||||
|
|
||||||
|
Debug::log(LOG, "Atoms done.");
|
||||||
|
|
||||||
|
g_pWindowManager->EWMHConnection = (xcb_ewmh_connection_t*)malloc(sizeof(xcb_ewmh_connection_t));
|
||||||
|
xcb_ewmh_init_atoms_replies(g_pWindowManager->EWMHConnection, xcb_ewmh_init_atoms(g_pWindowManager->DisplayConnection, g_pWindowManager->EWMHConnection), nullptr);
|
||||||
|
|
||||||
|
Debug::log(LOG, "Bar init EWMH done.");
|
||||||
|
|
||||||
// Init randr for monitors.
|
// Init randr for monitors.
|
||||||
g_pWindowManager->setupRandrMonitors();
|
g_pWindowManager->setupRandrMonitors();
|
||||||
|
|
||||||
|
@ -140,6 +161,10 @@ void CStatusBar::setup(int MonitorID) {
|
||||||
0, XCB_WINDOW_CLASS_INPUT_OUTPUT, g_pWindowManager->Screen->root_visual,
|
0, XCB_WINDOW_CLASS_INPUT_OUTPUT, g_pWindowManager->Screen->root_visual,
|
||||||
XCB_CW_EVENT_MASK, values);
|
XCB_CW_EVENT_MASK, values);
|
||||||
|
|
||||||
|
// Set the state to dock to avoid some issues
|
||||||
|
xcb_atom_t dockAtom[] = { HYPRATOMS["_NET_WM_WINDOW_TYPE_DOCK"] };
|
||||||
|
xcb_ewmh_set_wm_window_type(g_pWindowManager->EWMHConnection, m_iWindowID, 1, dockAtom);
|
||||||
|
|
||||||
// map
|
// map
|
||||||
xcb_map_window(g_pWindowManager->DisplayConnection, m_iWindowID);
|
xcb_map_window(g_pWindowManager->DisplayConnection, m_iWindowID);
|
||||||
|
|
||||||
|
|
|
@ -21,8 +21,9 @@
|
||||||
|
|
||||||
class CWindowManager {
|
class CWindowManager {
|
||||||
public:
|
public:
|
||||||
xcb_connection_t* DisplayConnection;
|
xcb_connection_t* DisplayConnection = nullptr;
|
||||||
xcb_screen_t* Screen;
|
xcb_ewmh_connection_t* EWMHConnection = nullptr; // Bar uses this
|
||||||
|
xcb_screen_t* Screen = nullptr;
|
||||||
xcb_drawable_t Drawable;
|
xcb_drawable_t Drawable;
|
||||||
uint32_t Values[3];
|
uint32_t Values[3];
|
||||||
|
|
||||||
|
@ -121,7 +122,7 @@ public:
|
||||||
|
|
||||||
inline std::unique_ptr<CWindowManager> g_pWindowManager = std::make_unique<CWindowManager>();
|
inline std::unique_ptr<CWindowManager> g_pWindowManager = std::make_unique<CWindowManager>();
|
||||||
|
|
||||||
inline std::map<std::string, int64_t> HYPRATOMS = {
|
inline std::map<std::string, xcb_atom_t> HYPRATOMS = {
|
||||||
HYPRATOM("_NET_SUPPORTED"),
|
HYPRATOM("_NET_SUPPORTED"),
|
||||||
HYPRATOM("_NET_SUPPORTING_WM_CHECK"),
|
HYPRATOM("_NET_SUPPORTING_WM_CHECK"),
|
||||||
HYPRATOM("_NET_WM_NAME"),
|
HYPRATOM("_NET_WM_NAME"),
|
||||||
|
@ -179,5 +180,4 @@ inline std::map<std::string, int64_t> HYPRATOMS = {
|
||||||
HYPRATOM("_NET_FRAME_EXTENTS"),
|
HYPRATOM("_NET_FRAME_EXTENTS"),
|
||||||
HYPRATOM("_MOTIF_WM_HINTS"),
|
HYPRATOM("_MOTIF_WM_HINTS"),
|
||||||
HYPRATOM("WM_CHANGE_STATE"),
|
HYPRATOM("WM_CHANGE_STATE"),
|
||||||
HYPRATOM("MANAGER")
|
HYPRATOM("MANAGER")};
|
||||||
};
|
|
||||||
|
|
Loading…
Reference in a new issue