Adjust kde-workspace to introduction of flags in NET classes

This commit is contained in:
Martin Gräßlin 2014-02-03 09:37:08 +01:00
parent dc9f613113
commit fdee4ea8c8
17 changed files with 44 additions and 52 deletions

View file

@ -699,7 +699,7 @@ void Client::demandAttention(bool set)
if (demands_attention == set) if (demands_attention == set)
return; return;
demands_attention = set; 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); workspace()->clientAttentionChanged(this, set);
emit demandsAttentionChanged(); emit demandsAttentionChanged();
} }

View file

@ -1020,8 +1020,8 @@ void Client::setShade(ShadeMode mode)
if (isActive()) if (isActive())
workspace()->requestFocus(this); workspace()->requestFocus(this);
} }
info->setState(isShade() ? NET::Shaded : 0, NET::Shaded); info->setState(isShade() ? NET::Shaded : NET::States(0), NET::Shaded);
info->setState(isShown(false) ? 0 : NET::Hidden, NET::Hidden); info->setState(isShown(false) ? NET::States(0) : NET::Hidden, NET::Hidden);
discardWindowPixmap(); discardWindowPixmap();
updateVisibility(); updateVisibility();
updateAllowedActions(); updateAllowedActions();
@ -1398,7 +1398,7 @@ void Client::setSkipTaskbar(bool b, bool from_outside)
if (b == skipTaskbar()) if (b == skipTaskbar())
return; return;
skip_taskbar = b; skip_taskbar = b;
info->setState(b ? NET::SkipTaskbar : 0, NET::SkipTaskbar); info->setState(b ? NET::SkipTaskbar : NET::States(0), NET::SkipTaskbar);
updateWindowRules(Rules::SkipTaskbar); updateWindowRules(Rules::SkipTaskbar);
if (was_wants_tab_focus != wantsTabFocus()) if (was_wants_tab_focus != wantsTabFocus())
FocusChain::self()->update(this, FocusChain::self()->update(this,
@ -1412,7 +1412,7 @@ void Client::setSkipPager(bool b)
if (b == skipPager()) if (b == skipPager())
return; return;
skip_pager = b; skip_pager = b;
info->setState(b ? NET::SkipPager : 0, NET::SkipPager); info->setState(b ? NET::SkipPager : NET::States(0), NET::SkipPager);
updateWindowRules(Rules::SkipPager); updateWindowRules(Rules::SkipPager);
emit skipPagerChanged(); emit skipPagerChanged();
} }
@ -2279,7 +2279,7 @@ void Client::updateAllowedActions(bool force)
{ {
if (!isManaged() && !force) if (!isManaged() && !force)
return; return;
unsigned long old_allowed_actions = allowed_actions; NET::Actions old_allowed_actions = NET::Actions(allowed_actions);
allowed_actions = 0; allowed_actions = 0;
if (isMovable()) if (isMovable())
allowed_actions |= NET::ActionMove; allowed_actions |= NET::ActionMove;
@ -2303,7 +2303,7 @@ void Client::updateAllowedActions(bool force)
info->setAllowedActions(allowed_actions); info->setAllowedActions(allowed_actions);
// ONLY if relevant features have changed (and the window didn't just get/loose moveresize for maximization state changes) // 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)) if (decoration && (allowed_actions & relevant) != (old_allowed_actions & relevant))
emit decoration->decorationButtonsChanged(); emit decoration->decorationButtonsChanged();
} }
@ -2461,7 +2461,7 @@ NET::WindowType Client::windowType(bool direct, int supportedTypes) const
if (supportedTypes == 0) { if (supportedTypes == 0) {
supportedTypes = SUPPORTED_MANAGED_WINDOW_TYPES_MASK; supportedTypes = SUPPORTED_MANAGED_WINDOW_TYPES_MASK;
} }
NET::WindowType wt = info->windowType(supportedTypes); NET::WindowType wt = info->windowType(NET::WindowTypes(supportedTypes));
if (direct) { if (direct) {
return wt; return wt;
} }

View file

@ -940,7 +940,7 @@ private:
qint64 m_killHelperPID; qint64 m_killHelperPID;
xcb_timestamp_t m_pingTimestamp; xcb_timestamp_t m_pingTimestamp;
xcb_timestamp_t m_userTime; xcb_timestamp_t m_userTime;
unsigned long allowed_actions; NET::Actions allowed_actions;
QSize client_size; QSize client_size;
int block_geometry_updates; // > 0 = New geometry is remembered, but not actually set int block_geometry_updates; // > 0 = New geometry is remembered, but not actually set
enum PendingGeometry_t { enum PendingGeometry_t {

View file

@ -81,7 +81,7 @@ namespace Oxygen
return; return;
} }
_info.reset(new KWindowInfo( window, -1U, -1U )); _info.reset(new KWindowInfo( window, NET::WMAllProperties, NET::WM2AllProperties ));
if( !_info->valid()) if( !_info->valid())
{ {
emit detectionDone( false ); emit detectionDone( false );

View file

@ -179,7 +179,7 @@ NET::WindowType Deleted::windowType(bool direct, int supportedTypes) const
if (supportedTypes == 0) { if (supportedTypes == 0) {
supportedTypes = SUPPORTED_UNMANAGED_WINDOW_TYPES_MASK; supportedTypes = SUPPORTED_UNMANAGED_WINDOW_TYPES_MASK;
} }
return info->windowType(supportedTypes); return info->windowType(NET::WindowTypes(supportedTypes));
} }
void Deleted::mainClientClosed(Toplevel *client) void Deleted::mainClientClosed(Toplevel *client)

View file

@ -2415,7 +2415,7 @@ void Client::setFullScreen(bool set, bool user)
StackingUpdatesBlocker blocker1(workspace()); StackingUpdatesBlocker blocker1(workspace());
GeometryUpdatesBlocker blocker2(this); GeometryUpdatesBlocker blocker2(this);
workspace()->updateClientLayer(this); // active fullscreens get different layer 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); updateDecoration(false, false);
if (isFullScreen()) { if (isFullScreen()) {
if (info->fullscreenMonitors().isSet()) if (info->fullscreenMonitors().isSet())

View file

@ -78,7 +78,7 @@ void DetectDialog::readWindow(WId w)
emit detectionDone(false); emit detectionDone(false);
return; return;
} }
info.reset(new KWindowInfo(w, -1U, -1U)); // read everything info.reset(new KWindowInfo(w, NET::WMAllProperties, NET::WM2AllProperties)); // read everything
if (!info->valid()) { if (!info->valid()) {
emit detectionDone(false); emit detectionDone(false);
return; return;

View file

@ -164,7 +164,7 @@ static Rules* findRule(const QList< Rules* >& rules, Window wid, bool whole_app)
if (type == NET::Unknown) if (type == NET::Unknown)
ret->types = NET::NormalMask; ret->types = NET::NormalMask;
else 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->title = title; // set, but make unimportant
ret->titlematch = Rules::UnimportantMatch; ret->titlematch = Rules::UnimportantMatch;
ret->clientmachine = machine; // set, but make unimportant ret->clientmachine = machine; // set, but make unimportant

View file

@ -552,16 +552,16 @@ Rules* RulesWidget::rules() const
if (all_types) // if all types are selected, use AllTypesMask (for future expansion) if (all_types) // if all types are selected, use AllTypesMask (for future expansion)
rules->types = NET::AllTypesMask; rules->types = NET::AllTypesMask;
else { else {
rules->types |= types->item(0)->isSelected() ? NET::NormalMask : 0U; rules->types |= types->item(0)->isSelected() ? NET::NormalMask : NET::WindowTypeMask(0);
rules->types |= types->item(1)->isSelected() ? NET::DialogMask : 0U; rules->types |= types->item(1)->isSelected() ? NET::DialogMask : NET::WindowTypeMask(0);
rules->types |= types->item(2)->isSelected() ? NET::UtilityMask : 0U; rules->types |= types->item(2)->isSelected() ? NET::UtilityMask : NET::WindowTypeMask(0);
rules->types |= types->item(3)->isSelected() ? NET::DockMask : 0U; rules->types |= types->item(3)->isSelected() ? NET::DockMask : NET::WindowTypeMask(0);
rules->types |= types->item(4)->isSelected() ? NET::ToolbarMask : 0U; rules->types |= types->item(4)->isSelected() ? NET::ToolbarMask : NET::WindowTypeMask(0);
rules->types |= types->item(5)->isSelected() ? NET::MenuMask : 0U; rules->types |= types->item(5)->isSelected() ? NET::MenuMask : NET::WindowTypeMask(0);
rules->types |= types->item(6)->isSelected() ? NET::SplashMask : 0U; rules->types |= types->item(6)->isSelected() ? NET::SplashMask : NET::WindowTypeMask(0);
rules->types |= types->item(7)->isSelected() ? NET::DesktopMask : 0U; rules->types |= types->item(7)->isSelected() ? NET::DesktopMask : NET::WindowTypeMask(0);
rules->types |= types->item(8)->isSelected() ? NET::OverrideMask : 0U; rules->types |= types->item(8)->isSelected() ? NET::OverrideMask : NET::WindowTypeMask(0);
rules->types |= types->item(9)->isSelected() ? NET::TopMenuMask : 0U; rules->types |= types->item(9)->isSelected() ? NET::TopMenuMask : NET::WindowTypeMask(0);
} }
rules->title = title->text(); rules->title = title->text();
rules->titlematch = static_cast< Rules::StringMatch >(title_match->currentIndex()); rules->titlematch = static_cast< Rules::StringMatch >(title_match->currentIndex());
@ -762,7 +762,7 @@ bool RulesWidget::finalCheck()
void RulesWidget::prepareWindowSpecific(WId window) void RulesWidget::prepareWindowSpecific(WId window)
{ {
tabs->setCurrentIndex(1); // geometry tab, skip tab for window identification 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); prefillUnusedValues(info);
} }

View file

@ -774,11 +774,11 @@ void Client::setKeepAbove(bool b)
if (b == keepAbove()) { if (b == keepAbove()) {
// force hint change if different // force hint change if different
if (bool(info->state() & NET::KeepAbove) != keepAbove()) 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; return;
} }
keep_above = b; keep_above = b;
info->setState(keepAbove() ? NET::KeepAbove : 0, NET::KeepAbove); info->setState(keepAbove() ? NET::KeepAbove : NET::States(0), NET::KeepAbove);
workspace()->updateClientLayer(this); workspace()->updateClientLayer(this);
updateWindowRules(Rules::Above); updateWindowRules(Rules::Above);
@ -796,11 +796,11 @@ void Client::setKeepBelow(bool b)
if (b == keepBelow()) { if (b == keepBelow()) {
// force hint change if different // force hint change if different
if (bool(info->state() & NET::KeepBelow) != keepBelow()) 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; return;
} }
keep_below = b; keep_below = b;
info->setState(keepBelow() ? NET::KeepBelow : 0, NET::KeepBelow); info->setState(keepBelow() ? NET::KeepBelow : NET::States(0), NET::KeepBelow);
workspace()->updateClientLayer(this); workspace()->updateClientLayer(this);
updateWindowRules(Rules::Below); updateWindowRules(Rules::Below);

View file

@ -90,16 +90,14 @@ bool Client::manage(xcb_window_t w, bool isMapped)
NET::WMIconGeometry | NET::WMIconGeometry |
NET::WMIcon | NET::WMIcon |
NET::WMPid | NET::WMPid |
NET::WMIconName | NET::WMIconName;
0;
properties[WinInfo::PROTOCOLS2] = properties[WinInfo::PROTOCOLS2] =
NET::WM2UserTime | NET::WM2UserTime |
NET::WM2StartupId | NET::WM2StartupId |
NET::WM2ExtendedStrut | NET::WM2ExtendedStrut |
NET::WM2Opacity | NET::WM2Opacity |
NET::WM2FullscreenMonitors | NET::WM2FullscreenMonitors |
NET::WM2FrameOverlap | NET::WM2FrameOverlap;
0;
info = new WinInfo(this, m_client, rootWindow(), properties, 2); info = new WinInfo(this, m_client, rootWindow(), properties, 2);

View file

@ -86,9 +86,8 @@ RootInfo *RootInfo::create()
NET::DialogMask | NET::DialogMask |
NET::OverrideMask | NET::OverrideMask |
NET::UtilityMask | NET::UtilityMask |
NET::SplashMask | NET::SplashMask
// No compositing window types here unless we support them also as managed window types // No compositing window types here unless we support them also as managed window types
0
, ,
NET::Modal | NET::Modal |
//NET::Sticky | // Large desktops not supported (and probably never will be) //NET::Sticky | // Large desktops not supported (and probably never will be)
@ -102,8 +101,7 @@ RootInfo *RootInfo::create()
NET::Hidden | NET::Hidden |
NET::FullScreen | NET::FullScreen |
NET::KeepBelow | NET::KeepBelow |
NET::DemandsAttention | NET::DemandsAttention
0
, ,
NET::WM2UserTime | NET::WM2UserTime |
NET::WM2StartupId | NET::WM2StartupId |
@ -116,8 +114,7 @@ RootInfo *RootInfo::create()
NET::WM2DesktopLayout | NET::WM2DesktopLayout |
NET::WM2FullPlacement | NET::WM2FullPlacement |
NET::WM2FullscreenMonitors | NET::WM2FullscreenMonitors |
NET::WM2KDEShadow | NET::WM2KDEShadow
0
, ,
NET::ActionMove | NET::ActionMove |
NET::ActionResize | NET::ActionResize |
@ -128,8 +125,7 @@ RootInfo *RootInfo::create()
NET::ActionMaxHoriz | NET::ActionMaxHoriz |
NET::ActionFullScreen | NET::ActionFullScreen |
NET::ActionChangeDesktop | NET::ActionChangeDesktop |
NET::ActionClose | NET::ActionClose
0
, ,
}; };
@ -265,7 +261,7 @@ void WinInfo::changeFullscreenMonitors(NETFullscreenMonitors topology)
m_client->updateFullscreenMonitors(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::Sticky; // KWin doesn't support large desktops, ignore
mask &= ~NET::Hidden; // clients are not allowed to change this directly mask &= ~NET::Hidden; // clients are not allowed to change this directly

View file

@ -81,7 +81,7 @@ public:
xcb_window_t rwin, const unsigned long pr[], int pr_size); xcb_window_t rwin, const unsigned long pr[], int pr_size);
virtual void changeDesktop(int desktop) override; virtual void changeDesktop(int desktop) override;
virtual void changeFullscreenMonitors(NETFullscreenMonitors topology) 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(); void disable();
private: private:

View file

@ -144,7 +144,7 @@ void Rules::readFromCfg(const KConfigGroup& cfg)
READ_MATCH_STRING(windowrole, .toLower().toLatin1()); READ_MATCH_STRING(windowrole, .toLower().toLatin1());
READ_MATCH_STRING(title,); READ_MATCH_STRING(title,);
READ_MATCH_STRING(clientmachine, .toLower().toLatin1()); READ_MATCH_STRING(clientmachine, .toLower().toLatin1());
types = cfg.readEntry("types", uint(NET::AllTypesMask)); types = NET::WindowTypeMask(cfg.readEntry<uint>("types", NET::AllTypesMask));
READ_FORCE_RULE2(placement, QString(), Placement::policyFromString, false); READ_FORCE_RULE2(placement, QString(), Placement::policyFromString, false);
READ_SET_RULE_DEF(position, , invalidPoint); READ_SET_RULE_DEF(position, , invalidPoint);
READ_SET_RULE(size, , QSize()); READ_SET_RULE(size, , QSize());

View file

@ -211,7 +211,7 @@ private:
StringMatch titlematch; StringMatch titlematch;
QByteArray clientmachine; QByteArray clientmachine;
StringMatch clientmachinematch; StringMatch clientmachinematch;
unsigned long types; // types for matching NET::WindowTypes types; // types for matching
Placement::Policy placement; Placement::Policy placement;
ForceRule placementrule; ForceRule placementrule;
QPoint position; QPoint position;

View file

@ -66,11 +66,9 @@ bool Unmanaged::track(Window w)
unsigned long properties[ 2 ]; unsigned long properties[ 2 ];
properties[ NETWinInfo::PROTOCOLS ] = properties[ NETWinInfo::PROTOCOLS ] =
NET::WMWindowType | NET::WMWindowType |
NET::WMPid | NET::WMPid;
0;
properties[ NETWinInfo::PROTOCOLS2 ] = properties[ NETWinInfo::PROTOCOLS2 ] =
NET::WM2Opacity | NET::WM2Opacity;
0;
info = new NETWinInfo(connection(), w, rootWindow(), properties, 2); info = new NETWinInfo(connection(), w, rootWindow(), properties, 2);
getResourceClass(); getResourceClass();
getWindowRole(); getWindowRole();
@ -153,7 +151,7 @@ NET::WindowType Unmanaged::windowType(bool direct, int supportedTypes) const
if (supportedTypes == 0) { if (supportedTypes == 0) {
supportedTypes = SUPPORTED_UNMANAGED_WINDOW_TYPES_MASK; supportedTypes = SUPPORTED_UNMANAGED_WINDOW_TYPES_MASK;
} }
return info->windowType(supportedTypes); return info->windowType(NET::WindowTypes(supportedTypes));
} }
} // namespace } // namespace

View file

@ -42,11 +42,11 @@ namespace KWin
{ {
// window types that are supported as normal windows (i.e. KWin actually manages them) // 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::ToolbarMask | NET::MenuMask | NET::DialogMask /*| NET::OverrideMask*/ | NET::TopMenuMask
| NET::UtilityMask | NET::SplashMask | NET::NotificationMask; | NET::UtilityMask | NET::SplashMask | NET::NotificationMask;
// window types that are supported as unmanaged (mainly for compositing) // 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::ToolbarMask | NET::MenuMask | NET::DialogMask /*| NET::OverrideMask*/ | NET::TopMenuMask
| NET::UtilityMask | NET::SplashMask | NET::DropdownMenuMask | NET::PopupMenuMask | NET::UtilityMask | NET::SplashMask | NET::DropdownMenuMask | NET::PopupMenuMask
| NET::TooltipMask | NET::NotificationMask | NET::ComboBoxMask | NET::DNDIconMask; | NET::TooltipMask | NET::NotificationMask | NET::ComboBoxMask | NET::DNDIconMask;