fix(xworkspaces): active ws upon ws deletion (#1713)
Active desktop was tracked via it's index, but when desktops are removed from `_NET_DESKTOP_NAMES` that index may become invalid. Fixes #1710
This commit is contained in:
parent
31a25af3d3
commit
25f99c0a61
@ -92,6 +92,7 @@ namespace modules {
|
|||||||
|
|
||||||
vector<string> m_desktop_names;
|
vector<string> m_desktop_names;
|
||||||
unsigned int m_current_desktop;
|
unsigned int m_current_desktop;
|
||||||
|
string m_current_desktop_name;
|
||||||
|
|
||||||
vector<xcb_window_t> m_clientlist;
|
vector<xcb_window_t> m_clientlist;
|
||||||
vector<unique_ptr<viewport>> m_viewports;
|
vector<unique_ptr<viewport>> m_viewports;
|
||||||
|
@ -83,6 +83,7 @@ namespace modules {
|
|||||||
// Get desktop details
|
// Get desktop details
|
||||||
m_desktop_names = get_desktop_names();
|
m_desktop_names = get_desktop_names();
|
||||||
m_current_desktop = ewmh_util::get_current_desktop();
|
m_current_desktop = ewmh_util::get_current_desktop();
|
||||||
|
m_current_desktop_name = m_desktop_names[m_current_desktop];
|
||||||
|
|
||||||
rebuild_desktops();
|
rebuild_desktops();
|
||||||
rebuild_desktop_states();
|
rebuild_desktop_states();
|
||||||
@ -103,6 +104,7 @@ namespace modules {
|
|||||||
rebuild_desktop_states();
|
rebuild_desktop_states();
|
||||||
} else if (evt->atom == m_ewmh->_NET_CURRENT_DESKTOP) {
|
} else if (evt->atom == m_ewmh->_NET_CURRENT_DESKTOP) {
|
||||||
m_current_desktop = ewmh_util::get_current_desktop();
|
m_current_desktop = ewmh_util::get_current_desktop();
|
||||||
|
m_current_desktop_name = m_desktop_names[m_current_desktop];
|
||||||
rebuild_desktop_states();
|
rebuild_desktop_states();
|
||||||
} else if (evt->atom == WM_HINTS) {
|
} else if (evt->atom == WM_HINTS) {
|
||||||
if (icccm_util::get_wm_urgency(m_connection, evt->window)) {
|
if (icccm_util::get_wm_urgency(m_connection, evt->window)) {
|
||||||
@ -209,7 +211,7 @@ namespace modules {
|
|||||||
void xworkspaces_module::rebuild_desktop_states() {
|
void xworkspaces_module::rebuild_desktop_states() {
|
||||||
for (auto&& v : m_viewports) {
|
for (auto&& v : m_viewports) {
|
||||||
for (auto&& d : v->desktops) {
|
for (auto&& d : v->desktops) {
|
||||||
if (d->index == m_current_desktop) {
|
if (m_desktop_names[d->index] == m_current_desktop_name) {
|
||||||
d->state = desktop_state::ACTIVE;
|
d->state = desktop_state::ACTIVE;
|
||||||
} else {
|
} else {
|
||||||
d->state = desktop_state::EMPTY;
|
d->state = desktop_state::EMPTY;
|
||||||
|
Loading…
Reference in New Issue
Block a user