Remove YesIKnowWhatImDoing from internal API

No need to have Allowed everywhere.

REVIEW: 110197
icc-effect-5.14.5
Martin Gräßlin 2013-04-26 09:47:45 +02:00
parent 8e8a18748d
commit 89c2fd5598
13 changed files with 79 additions and 85 deletions

View File

@ -227,7 +227,7 @@ namespace KWin
activeClient(). And of course, to propagate the active client to the
world.
*/
void Workspace::setActiveClient(Client* c, allowed_t)
void Workspace::setActiveClient(Client* c)
{
if (active_client == c)
return;
@ -284,7 +284,7 @@ void Workspace::activateClient(Client* c, bool force)
{
if (c == NULL) {
focusToNull();
setActiveClient(NULL, Allowed);
setActiveClient(NULL);
return;
}
raiseClient(c);
@ -377,7 +377,7 @@ void Workspace::takeActivity(Client* c, int flags, bool handled)
kWarning(1212) << "takeActivity: not shown" ;
return;
}
c->takeActivity(flags, handled, Allowed);
c->takeActivity(flags, handled);
if (!c->isOnActiveScreen())
screens()->setCurrent(c->screen());
}
@ -389,7 +389,7 @@ void Workspace::handleTakeActivity(Client* c, Time /*timestamp*/, int flags)
if ((flags & ActivityRaise) != 0)
raiseClient(c);
if ((flags & ActivityFocus) != 0 && c->isShown(false))
c->takeFocus(Allowed);
c->takeFocus();
pending_take_activity = NULL;
}
@ -439,7 +439,7 @@ bool Workspace::activateNextClient(Client* c)
if (c != NULL) {
if (c == active_client)
setActiveClient(NULL, Allowed);
setActiveClient(NULL);
should_get_focus.removeAll(c);
}
@ -811,7 +811,7 @@ void Client::setActive(bool act)
? rules()->checkOpacityActive(qRound(opacity() * 100.0))
: rules()->checkOpacityInactive(qRound(opacity() * 100.0));
setOpacity(ruledOpacity / 100.0);
workspace()->setActiveClient(act ? this : NULL, Allowed);
workspace()->setActiveClient(act ? this : NULL);
if (!active)
cancelAutoRaise();

View File

@ -255,7 +255,7 @@ Client::~Client()
}
// Use destroyClient() or releaseWindow(), Client instances cannot be deleted directly
void Client::deleteClient(Client* c, allowed_t)
void Client::deleteClient(Client* c)
{
delete c;
}
@ -295,7 +295,7 @@ void Client::releaseWindow(bool on_shutdown)
destroyDecoration();
cleanGrouping();
if (!on_shutdown) {
workspace()->removeClient(this, Allowed);
workspace()->removeClient(this);
// Only when the window is being unmapped, not when closing down KWin (NETWM sections 5.5,5.7)
info->setDesktop(0);
desk = 0;
@ -326,7 +326,7 @@ void Client::releaseWindow(bool on_shutdown)
del->unrefWindow();
}
checkNonExistentClients();
deleteClient(this, Allowed);
deleteClient(this);
ungrabXServer();
}
@ -356,7 +356,7 @@ void Client::destroyClient()
workspace()->clientHidden(this);
destroyDecoration();
cleanGrouping();
workspace()->removeClient(this, Allowed);
workspace()->removeClient(this);
client = None; // invalidate
XDestroyWindow(display(), wrapper);
wrapper = None;
@ -366,7 +366,7 @@ void Client::destroyClient()
disownDataPassedToDeleted();
del->unrefWindow();
checkNonExistentClients();
deleteClient(this, Allowed);
deleteClient(this);
}
// DnD handling for input shaping is broken in the clients for all Qt versions before 4.8.3
@ -1070,9 +1070,9 @@ void Client::updateVisibility()
info->setState(NET::Hidden, NET::Hidden);
setSkipTaskbar(true, false); // Also hide from taskbar
if (compositing() && options->hiddenPreviews() == HiddenPreviewsAlways)
internalKeep(Allowed);
internalKeep();
else
internalHide(Allowed);
internalHide();
return;
}
if (isCurrentTab())
@ -1080,29 +1080,29 @@ void Client::updateVisibility()
if (minimized) {
info->setState(NET::Hidden, NET::Hidden);
if (compositing() && options->hiddenPreviews() == HiddenPreviewsAlways)
internalKeep(Allowed);
internalKeep();
else
internalHide(Allowed);
internalHide();
return;
}
info->setState(0, NET::Hidden);
if (!isOnCurrentDesktop()) {
if (compositing() && options->hiddenPreviews() != HiddenPreviewsNever)
internalKeep(Allowed);
internalKeep();
else
internalHide(Allowed);
internalHide();
return;
}
if (!isOnCurrentActivity()) {
if (compositing() && options->hiddenPreviews() != HiddenPreviewsNever)
internalKeep(Allowed);
internalKeep();
else
internalHide(Allowed);
internalHide();
return;
}
if (isManaged())
resetShowingDesktop(true);
internalShow(Allowed);
internalShow();
}
@ -1141,14 +1141,14 @@ void Client::exportMappingState(int s)
PropModeReplace, (unsigned char*)(data), 2);
}
void Client::internalShow(allowed_t)
void Client::internalShow()
{
if (mapping_state == Mapped)
return;
MappingState old = mapping_state;
mapping_state = Mapped;
if (old == Unmapped || old == Withdrawn)
map(Allowed);
map();
if (old == Kept) {
m_decoInputExtent.map();
updateHiddenPreview();
@ -1158,14 +1158,14 @@ void Client::internalShow(allowed_t)
}
}
void Client::internalHide(allowed_t)
void Client::internalHide()
{
if (mapping_state == Unmapped)
return;
MappingState old = mapping_state;
mapping_state = Unmapped;
if (old == Mapped || old == Kept)
unmap(Allowed);
unmap();
if (old == Kept)
updateHiddenPreview();
addWorkspaceRepaint(visibleRect());
@ -1175,7 +1175,7 @@ void Client::internalHide(allowed_t)
}
}
void Client::internalKeep(allowed_t)
void Client::internalKeep()
{
assert(compositing());
if (mapping_state == Kept)
@ -1183,7 +1183,7 @@ void Client::internalKeep(allowed_t)
MappingState old = mapping_state;
mapping_state = Kept;
if (old == Unmapped || old == Withdrawn)
map(Allowed);
map();
m_decoInputExtent.unmap();
updateHiddenPreview();
addWorkspaceRepaint(visibleRect());
@ -1198,7 +1198,7 @@ void Client::internalKeep(allowed_t)
* not necessarily the client window itself (i.e. a shaded window is here
* considered mapped, even though it is in IconicState).
*/
void Client::map(allowed_t)
void Client::map()
{
// XComposite invalidates backing pixmaps on unmap (minimize, different
// virtual desktop, etc.). We kept the last known good pixmap around
@ -1220,7 +1220,7 @@ void Client::map(allowed_t)
/**
* Unmaps the client. Again, this is about the frame.
*/
void Client::unmap(allowed_t)
void Client::unmap()
{
// Here it may look like a race condition, as some other client might try to unmap
// the window between these two XSelectInput() calls. However, they're supposed to
@ -1641,11 +1641,11 @@ void Client::setOnAllActivities(bool on)
/**
* Performs activation and/or raising of the window
*/
void Client::takeActivity(int flags, bool handled, allowed_t)
void Client::takeActivity(int flags, bool handled)
{
if (!handled || !Ptakeactivity) {
if (flags & ActivityFocus)
takeFocus(Allowed);
takeFocus();
if (flags & ActivityRaise)
workspace()->raiseClient(this);
return;
@ -1671,7 +1671,7 @@ void Client::takeActivity(int flags, bool handled, allowed_t)
/**
* Performs the actual focusing of the window using XSetInputFocus and WM_TAKE_FOCUS
*/
void Client::takeFocus(allowed_t)
void Client::takeFocus()
{
#ifndef NDEBUG
static Time previous_focus_timestamp;
@ -1962,12 +1962,12 @@ void Client::setClientShown(bool shown)
if (options->isInactiveTabsSkipTaskbar())
setSkipTaskbar(hidden, false); // TODO: Causes reshuffle of the taskbar
if (shown) {
map(Allowed);
takeFocus(Allowed);
map();
takeFocus();
autoRaise();
FocusChain::self()->update(this, FocusChain::MakeFirst);
} else {
unmap(Allowed);
unmap();
// Don't move tabs to the end of the list when another tab get's activated
if (isCurrentTab())
FocusChain::self()->update(this, FocusChain::MakeLast);

View File

@ -432,8 +432,8 @@ public:
bool isMovableAcrossScreens() const;
bool isCloseable() const; ///< May be closed by the user (May have a close button)
void takeActivity(int flags, bool handled, allowed_t); // Takes ActivityFlags as arg (in utils.h)
void takeFocus(allowed_t);
void takeActivity(int flags, bool handled); // Takes ActivityFlags as arg (in utils.h)
void takeFocus();
bool isDemandingAttention() const {
return demands_attention;
}
@ -521,7 +521,7 @@ public:
bool hasUserTimeSupport() const;
/// Does 'delete c;'
static void deleteClient(Client* c, allowed_t);
static void deleteClient(Client* c);
static bool belongToSameApplication(const Client* c1, const Client* c2, bool active_hack = false);
static bool sameAppWindowRoleMatch(const Client* c1, const Client* c2, bool active_hack);
@ -822,11 +822,11 @@ private:
void destroyDecoration();
void updateFrameExtents();
void internalShow(allowed_t);
void internalHide(allowed_t);
void internalKeep(allowed_t);
void map(allowed_t);
void unmap(allowed_t);
void internalShow();
void internalHide();
void internalKeep();
void map();
void unmap();
void updateHiddenPreview();
void updateInputShape();

View File

@ -292,7 +292,7 @@ void Compositor::finish()
}
// discard all Deleted windows (#152914)
while (!Workspace::self()->deletedList().isEmpty())
Workspace::self()->deletedList().first()->discard(Allowed);
Workspace::self()->deletedList().first()->discard();
m_finishing = false;
emit compositingToggled(false);
}

View File

@ -47,7 +47,7 @@ Deleted::~Deleted()
if (delete_refcount != 0)
kError(1212) << "Deleted client has non-zero reference count (" << delete_refcount << ")";
assert(delete_refcount == 0);
workspace()->removeDeleted(this, Allowed);
workspace()->removeDeleted(this);
deleteEffectWindow();
}
@ -55,12 +55,12 @@ Deleted* Deleted::create(Toplevel* c)
{
Deleted* d = new Deleted(c->workspace());
d->copyToDeleted(c);
d->workspace()->addDeleted(d, c, Allowed);
d->workspace()->addDeleted(d, c);
return d;
}
// to be used only from Workspace::finishCompositing()
void Deleted::discard(allowed_t)
void Deleted::discard()
{
delete_refcount = 0;
delete this;

View File

@ -37,7 +37,7 @@ public:
// used by effects to keep the window around for e.g. fadeout effects when it's destroyed
void refWindow();
void unrefWindow(bool delay = false);
void discard(allowed_t);
void discard();
virtual int desktop() const;
virtual QStringList activities() const;
virtual QPoint clientPos() const;

View File

@ -208,7 +208,7 @@ Group::Group(Window leader_P, Workspace* workspace_P)
properties, 2);
}
effect_group = new EffectWindowGroupImpl(this);
workspace()->addGroup(this, Allowed);
workspace()->addGroup(this);
}
Group::~Group()
@ -285,7 +285,7 @@ void Group::removeMember(Client* member_P)
// other members of the group (which would be however deleted already
// if there were no other members)
if (refcount == 0 && _members.isEmpty()) {
workspace()->removeGroup(this, Allowed);
workspace()->removeGroup(this);
delete this;
}
}
@ -298,7 +298,7 @@ void Group::ref()
void Group::deref()
{
if (--refcount == 0 && _members.isEmpty()) {
workspace()->removeGroup(this, Allowed);
workspace()->removeGroup(this);
delete this;
}
}
@ -314,7 +314,7 @@ void Group::lostLeader()
assert(!_members.contains(leader_client));
leader_client = NULL;
if (_members.isEmpty()) {
workspace()->removeGroup(this, Allowed);
workspace()->removeGroup(this);
delete this;
}
}

View File

@ -96,15 +96,15 @@ void Unmanaged::release(bool on_shutdown)
XSelectInput(display(), window(), NoEventMask);
}
if (!on_shutdown) {
workspace()->removeUnmanaged(this, Allowed);
workspace()->removeUnmanaged(this);
addWorkspaceRepaint(del->visibleRect());
disownDataPassedToDeleted();
del->unrefWindow();
}
deleteUnmanaged(this, Allowed);
deleteUnmanaged(this);
}
void Unmanaged::deleteUnmanaged(Unmanaged* c, allowed_t)
void Unmanaged::deleteUnmanaged(Unmanaged* c)
{
delete c;
}

View File

@ -37,7 +37,7 @@ public:
bool windowEvent(XEvent* e);
void release(bool on_shutdown = false);
bool track(Window w);
static void deleteUnmanaged(Unmanaged* c, allowed_t);
static void deleteUnmanaged(Unmanaged* c);
virtual int desktop() const;
virtual QStringList activities() const;
virtual QPoint clientPos() const;

View File

@ -1010,7 +1010,7 @@ void Workspace::setupWindowShortcutDone(bool ok)
client_keys_dialog = NULL;
client_keys_client = NULL;
if (active_client)
active_client->takeFocus(Allowed);
active_client->takeFocus();
}
void Workspace::clientShortcutUpdated(Client* c)

View File

@ -137,12 +137,6 @@ private:
};
typedef QVector<StrutRect> StrutRects;
// Some KWin classes, mainly Client and Workspace, are very tighly coupled,
// and some of the methods of one class may be called only from speficic places.
// Those methods have additional allowed_t argument. If you pass Allowed
// as an argument to any function, make sure you really know what you're doing.
enum allowed_t { Allowed };
// some enums to have more readable code, instead of using bools
enum ForceGeometry_t { NormalGeometrySet, ForceGeometrySet };

View File

@ -541,10 +541,10 @@ Client* Workspace::createClient(Window w, bool is_mapped)
connect(c, SIGNAL(clientFullScreenSet(KWin::Client*,bool,bool)), ScreenEdges::self(), SIGNAL(checkBlocking()));
#endif
if (!c->manage(w, is_mapped)) {
Client::deleteClient(c, Allowed);
Client::deleteClient(c);
return NULL;
}
addClient(c, Allowed);
addClient(c);
return c;
}
@ -554,16 +554,16 @@ Unmanaged* Workspace::createUnmanaged(Window w)
return NULL;
Unmanaged* c = new Unmanaged(this);
if (!c->track(w)) {
Unmanaged::deleteUnmanaged(c, Allowed);
Unmanaged::deleteUnmanaged(c);
return NULL;
}
connect(c, SIGNAL(needsRepaint()), m_compositor, SLOT(scheduleRepaint()));
addUnmanaged(c, Allowed);
addUnmanaged(c);
emit unmanagedAdded(c);
return c;
}
void Workspace::addClient(Client* c, allowed_t)
void Workspace::addClient(Client* c)
{
Group* grp = findGroup(c->window());
@ -611,7 +611,7 @@ void Workspace::addClient(Client* c, allowed_t)
#endif
}
void Workspace::addUnmanaged(Unmanaged* c, allowed_t)
void Workspace::addUnmanaged(Unmanaged* c)
{
unmanaged.append(c);
x_stacking_dirty = true;
@ -620,7 +620,7 @@ void Workspace::addUnmanaged(Unmanaged* c, allowed_t)
/**
* Destroys the client \a c
*/
void Workspace::removeClient(Client* c, allowed_t)
void Workspace::removeClient(Client* c)
{
emit clientRemoved(c);
@ -681,14 +681,14 @@ void Workspace::removeClient(Client* c, allowed_t)
updateClientArea();
}
void Workspace::removeUnmanaged(Unmanaged* c, allowed_t)
void Workspace::removeUnmanaged(Unmanaged* c)
{
assert(unmanaged.contains(c));
unmanaged.removeAll(c);
x_stacking_dirty = true;
}
void Workspace::addDeleted(Deleted* c, Toplevel *orig, allowed_t)
void Workspace::addDeleted(Deleted* c, Toplevel *orig)
{
assert(!deleted.contains(c));
deleted.append(c);
@ -708,7 +708,7 @@ void Workspace::addDeleted(Deleted* c, Toplevel *orig, allowed_t)
connect(c, SIGNAL(needsRepaint()), m_compositor, SLOT(scheduleRepaint()));
}
void Workspace::removeDeleted(Deleted* c, allowed_t)
void Workspace::removeDeleted(Deleted* c)
{
assert(deleted.contains(c));
emit deletedRemoved(c);
@ -1065,7 +1065,7 @@ void Workspace::activateClientOnNewDesktop(uint desktop)
c = findDesktop(true, desktop);
if (c != active_client)
setActiveClient(NULL, Allowed);
setActiveClient(NULL);
if (c)
requestFocus(c);
@ -1186,7 +1186,7 @@ void Workspace::updateCurrentActivity(const QString &new_activity)
c = findDesktop(true, VirtualDesktopManager::self()->current());
if (c != active_client)
setActiveClient(NULL, Allowed);
setActiveClient(NULL);
if (c)
requestFocus(c);

View File

@ -265,16 +265,16 @@ public:
void sendPingToWindow(Window w, Time timestamp); // Called from Client::pingWindow()
void sendTakeActivity(Client* c, Time timestamp, long flags); // Called from Client::takeActivity()
void removeClient(Client*, allowed_t); // Only called from Client::destroyClient() or Client::releaseWindow()
void setActiveClient(Client*, allowed_t);
void removeClient(Client*); // Only called from Client::destroyClient() or Client::releaseWindow()
void setActiveClient(Client*);
Group* findGroup(Window leader) const;
void addGroup(Group* group, allowed_t);
void removeGroup(Group* group, allowed_t);
void addGroup(Group* group);
void removeGroup(Group* group);
Group* findClientLeaderGroup(const Client* c) const;
void removeUnmanaged(Unmanaged*, allowed_t); // Only called from Unmanaged::release()
void removeDeleted(Deleted*, allowed_t);
void addDeleted(Deleted*, Toplevel*, allowed_t);
void removeUnmanaged(Unmanaged*); // Only called from Unmanaged::release()
void removeDeleted(Deleted*);
void addDeleted(Deleted*, Toplevel*);
bool checkStartupNotification(Window w, KStartupInfoId& id, KStartupInfoData& data);
@ -460,9 +460,9 @@ private:
/// This is the right way to create a new client
Client* createClient(Window w, bool is_mapped);
void addClient(Client* c, allowed_t);
void addClient(Client* c);
Unmanaged* createUnmanaged(Window w);
void addUnmanaged(Unmanaged* c, allowed_t);
void addUnmanaged(Unmanaged* c);
Window findSpecialEventWindow(XEvent* e);
@ -650,13 +650,13 @@ inline Client* Workspace::mostRecentlyActivatedClient() const
return should_get_focus.count() > 0 ? should_get_focus.last() : active_client;
}
inline void Workspace::addGroup(Group* group, allowed_t)
inline void Workspace::addGroup(Group* group)
{
emit groupAdded(group);
groups.append(group);
}
inline void Workspace::removeGroup(Group* group, allowed_t)
inline void Workspace::removeGroup(Group* group)
{
groups.removeAll(group);
}