From fdee4ea8c801d41ad92eaf96d4fb820462a6ca1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Mon, 3 Feb 2014 09:37:08 +0100 Subject: [PATCH] Adjust kde-workspace to introduction of flags in NET classes --- activation.cpp | 2 +- client.cpp | 14 ++++++------- client.h | 2 +- clients/oxygen/config/oxygendetectwidget.cpp | 2 +- deleted.cpp | 2 +- geometry.cpp | 2 +- kcmkwin/kwinrules/detectwidget.cpp | 2 +- kcmkwin/kwinrules/main.cpp | 2 +- kcmkwin/kwinrules/ruleswidget.cpp | 22 ++++++++++---------- layers.cpp | 8 +++---- manage.cpp | 6 ++---- netinfo.cpp | 14 +++++-------- netinfo.h | 2 +- rules.cpp | 2 +- rules.h | 2 +- unmanaged.cpp | 8 +++---- utils.h | 4 ++-- 17 files changed, 44 insertions(+), 52 deletions(-) diff --git a/activation.cpp b/activation.cpp index cfad01a479..6261eaa3a0 100644 --- a/activation.cpp +++ b/activation.cpp @@ -699,7 +699,7 @@ void Client::demandAttention(bool set) if (demands_attention == set) return; demands_attention = set; - info->setState(set ? NET::DemandsAttention : 0, NET::DemandsAttention); + info->setState(set ? NET::DemandsAttention : NET::States(0), NET::DemandsAttention); workspace()->clientAttentionChanged(this, set); emit demandsAttentionChanged(); } diff --git a/client.cpp b/client.cpp index b269502703..f8fb4bbd4a 100644 --- a/client.cpp +++ b/client.cpp @@ -1020,8 +1020,8 @@ void Client::setShade(ShadeMode mode) if (isActive()) workspace()->requestFocus(this); } - info->setState(isShade() ? NET::Shaded : 0, NET::Shaded); - info->setState(isShown(false) ? 0 : NET::Hidden, NET::Hidden); + info->setState(isShade() ? NET::Shaded : NET::States(0), NET::Shaded); + info->setState(isShown(false) ? NET::States(0) : NET::Hidden, NET::Hidden); discardWindowPixmap(); updateVisibility(); updateAllowedActions(); @@ -1398,7 +1398,7 @@ void Client::setSkipTaskbar(bool b, bool from_outside) if (b == skipTaskbar()) return; skip_taskbar = b; - info->setState(b ? NET::SkipTaskbar : 0, NET::SkipTaskbar); + info->setState(b ? NET::SkipTaskbar : NET::States(0), NET::SkipTaskbar); updateWindowRules(Rules::SkipTaskbar); if (was_wants_tab_focus != wantsTabFocus()) FocusChain::self()->update(this, @@ -1412,7 +1412,7 @@ void Client::setSkipPager(bool b) if (b == skipPager()) return; skip_pager = b; - info->setState(b ? NET::SkipPager : 0, NET::SkipPager); + info->setState(b ? NET::SkipPager : NET::States(0), NET::SkipPager); updateWindowRules(Rules::SkipPager); emit skipPagerChanged(); } @@ -2279,7 +2279,7 @@ void Client::updateAllowedActions(bool force) { if (!isManaged() && !force) return; - unsigned long old_allowed_actions = allowed_actions; + NET::Actions old_allowed_actions = NET::Actions(allowed_actions); allowed_actions = 0; if (isMovable()) allowed_actions |= NET::ActionMove; @@ -2303,7 +2303,7 @@ void Client::updateAllowedActions(bool force) info->setAllowedActions(allowed_actions); // ONLY if relevant features have changed (and the window didn't just get/loose moveresize for maximization state changes) - const unsigned long relevant = ~(NET::ActionMove|NET::ActionResize); + const NET::Actions relevant = ~(NET::ActionMove|NET::ActionResize); if (decoration && (allowed_actions & relevant) != (old_allowed_actions & relevant)) emit decoration->decorationButtonsChanged(); } @@ -2461,7 +2461,7 @@ NET::WindowType Client::windowType(bool direct, int supportedTypes) const if (supportedTypes == 0) { supportedTypes = SUPPORTED_MANAGED_WINDOW_TYPES_MASK; } - NET::WindowType wt = info->windowType(supportedTypes); + NET::WindowType wt = info->windowType(NET::WindowTypes(supportedTypes)); if (direct) { return wt; } diff --git a/client.h b/client.h index daedc1b8ec..6a0dbe4f45 100644 --- a/client.h +++ b/client.h @@ -940,7 +940,7 @@ private: qint64 m_killHelperPID; xcb_timestamp_t m_pingTimestamp; xcb_timestamp_t m_userTime; - unsigned long allowed_actions; + NET::Actions allowed_actions; QSize client_size; int block_geometry_updates; // > 0 = New geometry is remembered, but not actually set enum PendingGeometry_t { diff --git a/clients/oxygen/config/oxygendetectwidget.cpp b/clients/oxygen/config/oxygendetectwidget.cpp index 1162b74326..d8f44cedb7 100644 --- a/clients/oxygen/config/oxygendetectwidget.cpp +++ b/clients/oxygen/config/oxygendetectwidget.cpp @@ -81,7 +81,7 @@ namespace Oxygen return; } - _info.reset(new KWindowInfo( window, -1U, -1U )); + _info.reset(new KWindowInfo( window, NET::WMAllProperties, NET::WM2AllProperties )); if( !_info->valid()) { emit detectionDone( false ); diff --git a/deleted.cpp b/deleted.cpp index 57e8db85e4..a65aa64808 100644 --- a/deleted.cpp +++ b/deleted.cpp @@ -179,7 +179,7 @@ NET::WindowType Deleted::windowType(bool direct, int supportedTypes) const if (supportedTypes == 0) { supportedTypes = SUPPORTED_UNMANAGED_WINDOW_TYPES_MASK; } - return info->windowType(supportedTypes); + return info->windowType(NET::WindowTypes(supportedTypes)); } void Deleted::mainClientClosed(Toplevel *client) diff --git a/geometry.cpp b/geometry.cpp index 8c7491d22f..c07c92ce9b 100644 --- a/geometry.cpp +++ b/geometry.cpp @@ -2415,7 +2415,7 @@ void Client::setFullScreen(bool set, bool user) StackingUpdatesBlocker blocker1(workspace()); GeometryUpdatesBlocker blocker2(this); workspace()->updateClientLayer(this); // active fullscreens get different layer - info->setState(isFullScreen() ? NET::FullScreen : 0, NET::FullScreen); + info->setState(isFullScreen() ? NET::FullScreen : NET::States(0), NET::FullScreen); updateDecoration(false, false); if (isFullScreen()) { if (info->fullscreenMonitors().isSet()) diff --git a/kcmkwin/kwinrules/detectwidget.cpp b/kcmkwin/kwinrules/detectwidget.cpp index 1def56a9bd..3f1aa692a7 100644 --- a/kcmkwin/kwinrules/detectwidget.cpp +++ b/kcmkwin/kwinrules/detectwidget.cpp @@ -78,7 +78,7 @@ void DetectDialog::readWindow(WId w) emit detectionDone(false); return; } - info.reset(new KWindowInfo(w, -1U, -1U)); // read everything + info.reset(new KWindowInfo(w, NET::WMAllProperties, NET::WM2AllProperties)); // read everything if (!info->valid()) { emit detectionDone(false); return; diff --git a/kcmkwin/kwinrules/main.cpp b/kcmkwin/kwinrules/main.cpp index 98885948f3..3386aa4f2d 100644 --- a/kcmkwin/kwinrules/main.cpp +++ b/kcmkwin/kwinrules/main.cpp @@ -164,7 +164,7 @@ static Rules* findRule(const QList< Rules* >& rules, Window wid, bool whole_app) if (type == NET::Unknown) ret->types = NET::NormalMask; else - ret->types = 1 << type; // convert type to its mask + ret->types = NET::WindowTypeMask( 1 << type); // convert type to its mask ret->title = title; // set, but make unimportant ret->titlematch = Rules::UnimportantMatch; ret->clientmachine = machine; // set, but make unimportant diff --git a/kcmkwin/kwinrules/ruleswidget.cpp b/kcmkwin/kwinrules/ruleswidget.cpp index 7d5991f574..48fe076a45 100644 --- a/kcmkwin/kwinrules/ruleswidget.cpp +++ b/kcmkwin/kwinrules/ruleswidget.cpp @@ -552,16 +552,16 @@ Rules* RulesWidget::rules() const if (all_types) // if all types are selected, use AllTypesMask (for future expansion) rules->types = NET::AllTypesMask; else { - rules->types |= types->item(0)->isSelected() ? NET::NormalMask : 0U; - rules->types |= types->item(1)->isSelected() ? NET::DialogMask : 0U; - rules->types |= types->item(2)->isSelected() ? NET::UtilityMask : 0U; - rules->types |= types->item(3)->isSelected() ? NET::DockMask : 0U; - rules->types |= types->item(4)->isSelected() ? NET::ToolbarMask : 0U; - rules->types |= types->item(5)->isSelected() ? NET::MenuMask : 0U; - rules->types |= types->item(6)->isSelected() ? NET::SplashMask : 0U; - rules->types |= types->item(7)->isSelected() ? NET::DesktopMask : 0U; - rules->types |= types->item(8)->isSelected() ? NET::OverrideMask : 0U; - rules->types |= types->item(9)->isSelected() ? NET::TopMenuMask : 0U; + rules->types |= types->item(0)->isSelected() ? NET::NormalMask : NET::WindowTypeMask(0); + rules->types |= types->item(1)->isSelected() ? NET::DialogMask : NET::WindowTypeMask(0); + rules->types |= types->item(2)->isSelected() ? NET::UtilityMask : NET::WindowTypeMask(0); + rules->types |= types->item(3)->isSelected() ? NET::DockMask : NET::WindowTypeMask(0); + rules->types |= types->item(4)->isSelected() ? NET::ToolbarMask : NET::WindowTypeMask(0); + rules->types |= types->item(5)->isSelected() ? NET::MenuMask : NET::WindowTypeMask(0); + rules->types |= types->item(6)->isSelected() ? NET::SplashMask : NET::WindowTypeMask(0); + rules->types |= types->item(7)->isSelected() ? NET::DesktopMask : NET::WindowTypeMask(0); + rules->types |= types->item(8)->isSelected() ? NET::OverrideMask : NET::WindowTypeMask(0); + rules->types |= types->item(9)->isSelected() ? NET::TopMenuMask : NET::WindowTypeMask(0); } rules->title = title->text(); rules->titlematch = static_cast< Rules::StringMatch >(title_match->currentIndex()); @@ -762,7 +762,7 @@ bool RulesWidget::finalCheck() void RulesWidget::prepareWindowSpecific(WId window) { tabs->setCurrentIndex(1); // geometry tab, skip tab for window identification - KWindowInfo info(window, -1U, -1U); // read everything + KWindowInfo info(window, NET::WMAllProperties, NET::WM2AllProperties); // read everything prefillUnusedValues(info); } diff --git a/layers.cpp b/layers.cpp index cb95b3a783..de03f18037 100644 --- a/layers.cpp +++ b/layers.cpp @@ -774,11 +774,11 @@ void Client::setKeepAbove(bool b) if (b == keepAbove()) { // force hint change if different if (bool(info->state() & NET::KeepAbove) != keepAbove()) - info->setState(keepAbove() ? NET::KeepAbove : 0, NET::KeepAbove); + info->setState(keepAbove() ? NET::KeepAbove : NET::States(0), NET::KeepAbove); return; } keep_above = b; - info->setState(keepAbove() ? NET::KeepAbove : 0, NET::KeepAbove); + info->setState(keepAbove() ? NET::KeepAbove : NET::States(0), NET::KeepAbove); workspace()->updateClientLayer(this); updateWindowRules(Rules::Above); @@ -796,11 +796,11 @@ void Client::setKeepBelow(bool b) if (b == keepBelow()) { // force hint change if different if (bool(info->state() & NET::KeepBelow) != keepBelow()) - info->setState(keepBelow() ? NET::KeepBelow : 0, NET::KeepBelow); + info->setState(keepBelow() ? NET::KeepBelow : NET::States(0), NET::KeepBelow); return; } keep_below = b; - info->setState(keepBelow() ? NET::KeepBelow : 0, NET::KeepBelow); + info->setState(keepBelow() ? NET::KeepBelow : NET::States(0), NET::KeepBelow); workspace()->updateClientLayer(this); updateWindowRules(Rules::Below); diff --git a/manage.cpp b/manage.cpp index afeccd7a3e..3e385cd6ae 100644 --- a/manage.cpp +++ b/manage.cpp @@ -90,16 +90,14 @@ bool Client::manage(xcb_window_t w, bool isMapped) NET::WMIconGeometry | NET::WMIcon | NET::WMPid | - NET::WMIconName | - 0; + NET::WMIconName; properties[WinInfo::PROTOCOLS2] = NET::WM2UserTime | NET::WM2StartupId | NET::WM2ExtendedStrut | NET::WM2Opacity | NET::WM2FullscreenMonitors | - NET::WM2FrameOverlap | - 0; + NET::WM2FrameOverlap; info = new WinInfo(this, m_client, rootWindow(), properties, 2); diff --git a/netinfo.cpp b/netinfo.cpp index c1c2c06adf..5e0b139364 100644 --- a/netinfo.cpp +++ b/netinfo.cpp @@ -86,9 +86,8 @@ RootInfo *RootInfo::create() NET::DialogMask | NET::OverrideMask | NET::UtilityMask | - NET::SplashMask | + NET::SplashMask // No compositing window types here unless we support them also as managed window types - 0 , NET::Modal | //NET::Sticky | // Large desktops not supported (and probably never will be) @@ -102,8 +101,7 @@ RootInfo *RootInfo::create() NET::Hidden | NET::FullScreen | NET::KeepBelow | - NET::DemandsAttention | - 0 + NET::DemandsAttention , NET::WM2UserTime | NET::WM2StartupId | @@ -116,8 +114,7 @@ RootInfo *RootInfo::create() NET::WM2DesktopLayout | NET::WM2FullPlacement | NET::WM2FullscreenMonitors | - NET::WM2KDEShadow | - 0 + NET::WM2KDEShadow , NET::ActionMove | NET::ActionResize | @@ -128,8 +125,7 @@ RootInfo *RootInfo::create() NET::ActionMaxHoriz | NET::ActionFullScreen | NET::ActionChangeDesktop | - NET::ActionClose | - 0 + NET::ActionClose , }; @@ -265,7 +261,7 @@ void WinInfo::changeFullscreenMonitors(NETFullscreenMonitors topology) m_client->updateFullscreenMonitors(topology); } -void WinInfo::changeState(unsigned long state, unsigned long mask) +void WinInfo::changeState(NET::States state, NET::States mask) { mask &= ~NET::Sticky; // KWin doesn't support large desktops, ignore mask &= ~NET::Hidden; // clients are not allowed to change this directly diff --git a/netinfo.h b/netinfo.h index b9ad733bcd..8530396718 100644 --- a/netinfo.h +++ b/netinfo.h @@ -81,7 +81,7 @@ public: xcb_window_t rwin, const unsigned long pr[], int pr_size); virtual void changeDesktop(int desktop) override; virtual void changeFullscreenMonitors(NETFullscreenMonitors topology) override; - virtual void changeState(unsigned long state, unsigned long mask) override; + virtual void changeState(NET::States state, NET::States mask) override; void disable(); private: diff --git a/rules.cpp b/rules.cpp index 6a9f693b6f..7a50f1bb5d 100644 --- a/rules.cpp +++ b/rules.cpp @@ -144,7 +144,7 @@ void Rules::readFromCfg(const KConfigGroup& cfg) READ_MATCH_STRING(windowrole, .toLower().toLatin1()); READ_MATCH_STRING(title,); READ_MATCH_STRING(clientmachine, .toLower().toLatin1()); - types = cfg.readEntry("types", uint(NET::AllTypesMask)); + types = NET::WindowTypeMask(cfg.readEntry("types", NET::AllTypesMask)); READ_FORCE_RULE2(placement, QString(), Placement::policyFromString, false); READ_SET_RULE_DEF(position, , invalidPoint); READ_SET_RULE(size, , QSize()); diff --git a/rules.h b/rules.h index d1624d9867..245963f1d6 100644 --- a/rules.h +++ b/rules.h @@ -211,7 +211,7 @@ private: StringMatch titlematch; QByteArray clientmachine; StringMatch clientmachinematch; - unsigned long types; // types for matching + NET::WindowTypes types; // types for matching Placement::Policy placement; ForceRule placementrule; QPoint position; diff --git a/unmanaged.cpp b/unmanaged.cpp index b69e1abaeb..66c925b2c0 100644 --- a/unmanaged.cpp +++ b/unmanaged.cpp @@ -66,11 +66,9 @@ bool Unmanaged::track(Window w) unsigned long properties[ 2 ]; properties[ NETWinInfo::PROTOCOLS ] = NET::WMWindowType | - NET::WMPid | - 0; + NET::WMPid; properties[ NETWinInfo::PROTOCOLS2 ] = - NET::WM2Opacity | - 0; + NET::WM2Opacity; info = new NETWinInfo(connection(), w, rootWindow(), properties, 2); getResourceClass(); getWindowRole(); @@ -153,7 +151,7 @@ NET::WindowType Unmanaged::windowType(bool direct, int supportedTypes) const if (supportedTypes == 0) { supportedTypes = SUPPORTED_UNMANAGED_WINDOW_TYPES_MASK; } - return info->windowType(supportedTypes); + return info->windowType(NET::WindowTypes(supportedTypes)); } } // namespace diff --git a/utils.h b/utils.h index a2d404277a..69cfa03b92 100644 --- a/utils.h +++ b/utils.h @@ -42,11 +42,11 @@ namespace KWin { // window types that are supported as normal windows (i.e. KWin actually manages them) -const int SUPPORTED_MANAGED_WINDOW_TYPES_MASK = NET::NormalMask | NET::DesktopMask | NET::DockMask +const NET::WindowTypes SUPPORTED_MANAGED_WINDOW_TYPES_MASK = NET::NormalMask | NET::DesktopMask | NET::DockMask | NET::ToolbarMask | NET::MenuMask | NET::DialogMask /*| NET::OverrideMask*/ | NET::TopMenuMask | NET::UtilityMask | NET::SplashMask | NET::NotificationMask; // window types that are supported as unmanaged (mainly for compositing) -const int SUPPORTED_UNMANAGED_WINDOW_TYPES_MASK = NET::NormalMask | NET::DesktopMask | NET::DockMask +const NET::WindowTypes SUPPORTED_UNMANAGED_WINDOW_TYPES_MASK = NET::NormalMask | NET::DesktopMask | NET::DockMask | NET::ToolbarMask | NET::MenuMask | NET::DialogMask /*| NET::OverrideMask*/ | NET::TopMenuMask | NET::UtilityMask | NET::SplashMask | NET::DropdownMenuMask | NET::PopupMenuMask | NET::TooltipMask | NET::NotificationMask | NET::ComboBoxMask | NET::DNDIconMask;