X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=src%2Fscreen.cc;h=16e37df61a731502f4a10349162cf3502f3fe77f;hb=ea8d450ed30c96c1a5dd627740ec4533eeae2a09;hp=11f0f5d371ce4bebca2c033650e0d1b8fdb33eb4;hpb=361303715b6eb54d77ed8e1c9ad8f35e44e4ede1;p=chaz%2Fopenbox diff --git a/src/screen.cc b/src/screen.cc index 11f0f5d3..16e37df6 100644 --- a/src/screen.cc +++ b/src/screen.cc @@ -40,8 +40,7 @@ namespace ob { Screen::Screen(int screen) - : _number(screen), - _config(screen) + : _number(screen) { assert(screen >= 0); assert(screen < ScreenCount(**otk::display)); _info = otk::display->screenInfo(screen); @@ -80,7 +79,7 @@ Screen::Screen(int screen) _desktop = 0; - changeNumDesktops(1); // set the hint + changeNumDesktops(4); // set the hint changeDesktop(0); // set the hint // don't start in showing-desktop mode @@ -198,7 +197,7 @@ void Screen::updateDesktopLayout() otk::Property::atoms.net_desktop_layout, otk::Property::atoms.cardinal, &num, &data)) { - if (num >= 4) { + if (num == 4) { if (data[0] == _NET_WM_ORIENTATION_VERT) _layout.orientation = DesktopLayout::Vertical; if (data[3] == _NET_WM_TOPRIGHT) @@ -783,7 +782,7 @@ void Screen::changeNumDesktops(unsigned int num) ce.xclient.window = (*it)->window(); ce.xclient.format = 32; ce.xclient.data.l[0] = num - 1; - XSendEvent(**otk::display, _info->rootWindow(), False, + XSendEvent(**otk::display, _info->rootWindow(), false, SubstructureNotifyMask | SubstructureRedirectMask, &ce); } } @@ -810,6 +809,9 @@ void Screen::changeNumDesktops(unsigned int num) // the number of rows/columns will differ updateDesktopLayout(); + // may be some unnamed desktops that we need to fill in with names + updateDesktopNames(); + // change our desktop if we're on one that no longer exists! if (_desktop >= _num_desktops) changeDesktop(_num_desktops - 1); @@ -818,7 +820,7 @@ void Screen::changeNumDesktops(unsigned int num) void Screen::updateDesktopNames() { - unsigned long num = (unsigned) -1; + unsigned long num; if (!otk::Property::get(_info->rootWindow(), otk::Property::atoms.net_desktop_names, @@ -829,23 +831,6 @@ void Screen::updateDesktopNames() } -void Screen::setDesktopName(unsigned int i, const otk::ustring &name) -{ - if (i >= _num_desktops) return; - - otk::Property::StringVect newnames = _desktop_names; - newnames[i] = name; - otk::Property::set(_info->rootWindow(), - otk::Property::atoms.net_desktop_names, - otk::Property::utf8, newnames); -} - -otk::ustring Screen::desktopName(unsigned int i) const -{ - if (i >= _num_desktops) return ""; - return _desktop_names[i]; -} - const otk::Rect& Screen::area(unsigned int desktop) const { assert(desktop < _num_desktops || desktop == 0xffffffff); if (desktop < _num_desktops)