Refactoring of KWin::Options: getter methods instead of public variables
parent
26b345358f
commit
212908ee88
|
@ -449,7 +449,7 @@ bool Workspace::activateNextClient(Client* c)
|
|||
|
||||
Client* get_focus = NULL;
|
||||
|
||||
if (options->nextFocusPrefersMouse) {
|
||||
if (options->isNextFocusPrefersMouse()) {
|
||||
get_focus = clientUnderMouse(c ? c->screen() : activeScreen());
|
||||
if (get_focus && (get_focus == c || get_focus->isDesktop())) {
|
||||
// should rather not happen, but it cannot get the focus. rest of usability is tested above
|
||||
|
@ -460,14 +460,14 @@ bool Workspace::activateNextClient(Client* c)
|
|||
if (!get_focus) { // no suitable window under the mouse -> find sth. else
|
||||
|
||||
// first try to pass the focus to the (former) active clients leader
|
||||
if (c && (get_focus = c->transientFor()) && isUsableFocusCandidate(get_focus, c, options->separateScreenFocus)) {
|
||||
if (c && (get_focus = c->transientFor()) && isUsableFocusCandidate(get_focus, c, options->isSeparateScreenFocus())) {
|
||||
raiseClient(get_focus); // also raise - we don't know where it came from
|
||||
} else {
|
||||
// nope, ask the focus chain for the next candidate
|
||||
get_focus = NULL; // reset from the inline assignment above
|
||||
for (int i = focus_chain[ currentDesktop()].size() - 1; i >= 0; --i) {
|
||||
Client* ci = focus_chain[ currentDesktop()].at(i);
|
||||
if (isUsableFocusCandidate(ci, c, options->separateScreenFocus)) {
|
||||
if (isUsableFocusCandidate(ci, c, options->isSeparateScreenFocus())) {
|
||||
get_focus = ci;
|
||||
break; // we're done
|
||||
}
|
||||
|
@ -545,7 +545,7 @@ bool Workspace::allowClientActivation(const Client* c, Time time, bool focus_in,
|
|||
// 4 - extreme - no window gets focus without user intervention
|
||||
if (time == -1U)
|
||||
time = c->userTime();
|
||||
int level = c->rules()->checkFSP(options->focusStealingPreventionLevel);
|
||||
int level = c->rules()->checkFSP(options->focusStealingPreventionLevel());
|
||||
if (session_saving && level <= 2) { // <= normal
|
||||
return true;
|
||||
}
|
||||
|
@ -600,7 +600,7 @@ bool Workspace::allowClientActivation(const Client* c, Time time, bool focus_in,
|
|||
// to the same application
|
||||
bool Workspace::allowFullClientRaising(const Client* c, Time time)
|
||||
{
|
||||
int level = c->rules()->checkFSP(options->focusStealingPreventionLevel);
|
||||
int level = c->rules()->checkFSP(options->focusStealingPreventionLevel());
|
||||
if (session_saving && level <= 2) { // <= normal
|
||||
return true;
|
||||
}
|
||||
|
@ -786,7 +786,7 @@ Time Client::readUserTimeMapTimestamp(const KStartupInfoId* asn_id, const KStart
|
|||
first_window = false;
|
||||
}
|
||||
// don't refuse if focus stealing prevention is turned off
|
||||
if (!first_window && rules()->checkFSP(options->focusStealingPreventionLevel) > 0) {
|
||||
if (!first_window && rules()->checkFSP(options->focusStealingPreventionLevel()) > 0) {
|
||||
kDebug(1212) << "User timestamp, already exists:" << 0;
|
||||
return 0; // refuse activation
|
||||
}
|
||||
|
|
14
client.cpp
14
client.cpp
|
@ -1161,7 +1161,7 @@ void Client::updateVisibility()
|
|||
if (hidden && isCurrentTab()) {
|
||||
info->setState(NET::Hidden, NET::Hidden);
|
||||
setSkipTaskbar(true, false); // Also hide from taskbar
|
||||
if (compositing() && options->hiddenPreviews == HiddenPreviewsAlways)
|
||||
if (compositing() && options->hiddenPreviews() == HiddenPreviewsAlways)
|
||||
internalKeep(Allowed);
|
||||
else
|
||||
internalHide(Allowed);
|
||||
|
@ -1171,7 +1171,7 @@ void Client::updateVisibility()
|
|||
setSkipTaskbar(original_skip_taskbar, false); // Reset from 'hidden'
|
||||
if (minimized) {
|
||||
info->setState(NET::Hidden, NET::Hidden);
|
||||
if (compositing() && options->hiddenPreviews == HiddenPreviewsAlways)
|
||||
if (compositing() && options->hiddenPreviews() == HiddenPreviewsAlways)
|
||||
internalKeep(Allowed);
|
||||
else
|
||||
internalHide(Allowed);
|
||||
|
@ -1179,14 +1179,14 @@ void Client::updateVisibility()
|
|||
}
|
||||
info->setState(0, NET::Hidden);
|
||||
if (!isOnCurrentDesktop()) {
|
||||
if (compositing() && options->hiddenPreviews != HiddenPreviewsNever)
|
||||
if (compositing() && options->hiddenPreviews() != HiddenPreviewsNever)
|
||||
internalKeep(Allowed);
|
||||
else
|
||||
internalHide(Allowed);
|
||||
return;
|
||||
}
|
||||
if (!isOnCurrentActivity()) {
|
||||
if (compositing() && options->hiddenPreviews != HiddenPreviewsNever)
|
||||
if (compositing() && options->hiddenPreviews() != HiddenPreviewsNever)
|
||||
internalKeep(Allowed);
|
||||
else
|
||||
internalHide(Allowed);
|
||||
|
@ -1425,14 +1425,14 @@ void Client::pingWindow()
|
|||
{
|
||||
if (!Pping)
|
||||
return; // Can't ping :(
|
||||
if (options->killPingTimeout == 0)
|
||||
if (options->killPingTimeout() == 0)
|
||||
return; // Turned off
|
||||
if (ping_timer != NULL)
|
||||
return; // Pinging already
|
||||
ping_timer = new QTimer(this);
|
||||
connect(ping_timer, SIGNAL(timeout()), SLOT(pingTimeout()));
|
||||
ping_timer->setSingleShot(true);
|
||||
ping_timer->start(options->killPingTimeout);
|
||||
ping_timer->start(options->killPingTimeout());
|
||||
ping_timestamp = xTime();
|
||||
workspace()->sendPingToWindow(window(), ping_timestamp);
|
||||
}
|
||||
|
@ -1967,7 +1967,7 @@ void Client::setClientShown(bool shown)
|
|||
if (shown != hidden)
|
||||
return; // nothing to change
|
||||
hidden = !shown;
|
||||
if (options->inactiveTabsSkipTaskbar)
|
||||
if (options->isInactiveTabsSkipTaskbar())
|
||||
setSkipTaskbar(hidden, false); // TODO: Causes reshuffle of the taskbar
|
||||
if (shown) {
|
||||
map(Allowed);
|
||||
|
|
|
@ -90,7 +90,7 @@ void Workspace::setupCompositing()
|
|||
return;
|
||||
}
|
||||
|
||||
if (!options->compositingInitialized)
|
||||
if (!options->isCompositingInitialized())
|
||||
options->reloadCompositingSettings(true);
|
||||
|
||||
char selection_name[ 100 ];
|
||||
|
@ -99,7 +99,7 @@ void Workspace::setupCompositing()
|
|||
connect(cm_selection, SIGNAL(lostOwnership()), SLOT(lostCMSelection()));
|
||||
cm_selection->claim(true); // force claiming
|
||||
|
||||
switch(options->compositingMode) {
|
||||
switch(options->compositingMode()) {
|
||||
case OpenGLCompositing: {
|
||||
kDebug(1212) << "Initializing OpenGL compositing";
|
||||
|
||||
|
@ -155,7 +155,7 @@ void Workspace::setupCompositing()
|
|||
return;
|
||||
}
|
||||
xrrRefreshRate = KWin::currentRefreshRate();
|
||||
fpsInterval = (options->maxFpsInterval << 10);
|
||||
fpsInterval = (options->maxFpsInterval() << 10);
|
||||
if (scene->waitSyncAvailable()) { // if we do vsync, set the fps to the next multiple of the vblank rate
|
||||
vBlankInterval = (1000 << 10) / xrrRefreshRate;
|
||||
fpsInterval -= (fpsInterval % vBlankInterval);
|
||||
|
@ -235,7 +235,7 @@ void Workspace::fallbackToXRenderCompositing()
|
|||
restartKWin("automatic graphicssystem change for XRender backend");
|
||||
return;
|
||||
} else {
|
||||
options->compositingMode = XRenderCompositing;
|
||||
options->setCompositingMode(XRenderCompositing);
|
||||
setupCompositing();
|
||||
}
|
||||
}
|
||||
|
@ -480,7 +480,7 @@ bool Workspace::compositingActive()
|
|||
// force is needed when the list of windows changes (e.g. a window goes away)
|
||||
void Workspace::checkUnredirect(bool force)
|
||||
{
|
||||
if (!compositing() || scene->overlayWindow()->window() == None || !options->unredirectFullscreen)
|
||||
if (!compositing() || scene->overlayWindow()->window() == None || !options->isUnredirectFullscreen())
|
||||
return;
|
||||
if (force)
|
||||
forceUnredirectCheck = true;
|
||||
|
@ -490,7 +490,7 @@ void Workspace::checkUnredirect(bool force)
|
|||
|
||||
void Workspace::delayedCheckUnredirect()
|
||||
{
|
||||
if (!compositing() || scene->overlayWindow()->window() == None || !options->unredirectFullscreen)
|
||||
if (!compositing() || scene->overlayWindow()->window() == None || !options->isUnredirectFullscreen())
|
||||
return;
|
||||
ToplevelList list;
|
||||
bool changed = forceUnredirectCheck;
|
||||
|
|
|
@ -718,7 +718,7 @@ QString EffectsHandlerImpl::desktopName(int desktop) const
|
|||
|
||||
bool EffectsHandlerImpl::optionRollOverDesktops() const
|
||||
{
|
||||
return options->rollOverDesktops;
|
||||
return options->isRollOverDesktops();
|
||||
}
|
||||
|
||||
double EffectsHandlerImpl::animationTimeFactor() const
|
||||
|
|
24
events.cpp
24
events.cpp
|
@ -868,28 +868,28 @@ void Client::enterNotifyEvent(XCrossingEvent* e)
|
|||
(!options->focusPolicyIsReasonable() &&
|
||||
e->mode == NotifyUngrab)) {
|
||||
|
||||
if (options->shadeHover) {
|
||||
if (options->isShadeHover()) {
|
||||
cancelShadeHoverTimer();
|
||||
if (isShade()) {
|
||||
shadeHoverTimer = new QTimer(this);
|
||||
connect(shadeHoverTimer, SIGNAL(timeout()), this, SLOT(shadeHover()));
|
||||
shadeHoverTimer->setSingleShot(true);
|
||||
shadeHoverTimer->start(options->shadeHoverInterval);
|
||||
shadeHoverTimer->start(options->shadeHoverInterval());
|
||||
}
|
||||
}
|
||||
|
||||
if (options->focusPolicy == Options::ClickToFocus)
|
||||
if (options->focusPolicy() == Options::ClickToFocus)
|
||||
return;
|
||||
|
||||
if (options->autoRaise && !isDesktop() &&
|
||||
if (options->isAutoRaise() && !isDesktop() &&
|
||||
!isDock() && workspace()->focusChangeEnabled() &&
|
||||
workspace()->topClientOnDesktop(workspace()->currentDesktop(),
|
||||
options->separateScreenFocus ? screen() : -1) != this) {
|
||||
options->isSeparateScreenFocus() ? screen() : -1) != this) {
|
||||
delete autoRaiseTimer;
|
||||
autoRaiseTimer = new QTimer(this);
|
||||
connect(autoRaiseTimer, SIGNAL(timeout()), this, SLOT(autoRaise()));
|
||||
autoRaiseTimer->setSingleShot(true);
|
||||
autoRaiseTimer->start(options->autoRaiseInterval);
|
||||
autoRaiseTimer->start(options->autoRaiseInterval());
|
||||
}
|
||||
|
||||
QPoint currentPos(e->x_root, e->y_root);
|
||||
|
@ -897,7 +897,7 @@ void Client::enterNotifyEvent(XCrossingEvent* e)
|
|||
return;
|
||||
// for FocusFollowsMouse, change focus only if the mouse has actually been moved, not if the focus
|
||||
// change came because of window changes (e.g. closing a window) - #92290
|
||||
if (options->focusPolicy != Options::FocusFollowsMouse
|
||||
if (options->focusPolicy() != Options::FocusFollowsMouse
|
||||
|| currentPos != workspace()->focusMousePosition()) {
|
||||
workspace()->requestDelayFocus(this);
|
||||
}
|
||||
|
@ -938,10 +938,10 @@ void Client::leaveNotifyEvent(XCrossingEvent* e)
|
|||
shadeHoverTimer = new QTimer(this);
|
||||
connect(shadeHoverTimer, SIGNAL(timeout()), this, SLOT(shadeUnhover()));
|
||||
shadeHoverTimer->setSingleShot(true);
|
||||
shadeHoverTimer->start(options->shadeHoverInterval);
|
||||
shadeHoverTimer->start(options->shadeHoverInterval());
|
||||
}
|
||||
}
|
||||
if (options->focusPolicy == Options::FocusStrictlyUnderMouse && isActive() && lostMouse) {
|
||||
if (options->focusPolicy() == Options::FocusStrictlyUnderMouse && isActive() && lostMouse) {
|
||||
workspace()->requestDelayFocus(0);
|
||||
}
|
||||
return;
|
||||
|
@ -996,7 +996,7 @@ void Client::updateMouseGrab()
|
|||
XUngrabButton(display(), AnyButton, AnyModifier, wrapperId());
|
||||
// keep grab for the simple click without modifiers if needed (see below)
|
||||
bool not_obscured = workspace()->topClientOnDesktop(workspace()->currentDesktop(), -1, true, false) == this;
|
||||
if (!(!options->clickRaise || not_obscured))
|
||||
if (!(!options->isClickRaise() || not_obscured))
|
||||
grabButton(None);
|
||||
return;
|
||||
}
|
||||
|
@ -1011,7 +1011,7 @@ void Client::updateMouseGrab()
|
|||
// (it is unobscured if it the topmost in the unconstrained stacking order, i.e. it is
|
||||
// the most recently raised window)
|
||||
bool not_obscured = workspace()->topClientOnDesktop(workspace()->currentDesktop(), -1, true, false) == this;
|
||||
if (!options->clickRaise || not_obscured)
|
||||
if (!options->isClickRaise() || not_obscured)
|
||||
ungrabButton(None);
|
||||
else
|
||||
grabButton(None);
|
||||
|
@ -1149,7 +1149,7 @@ bool Client::buttonPressEvent(Window w, int button, int state, int x, int y, int
|
|||
}
|
||||
// active inner window
|
||||
if (isActive() && w == wrapperId()
|
||||
&& options->clickRaise && button < 4) { // exclude wheel
|
||||
&& options->isClickRaise() && button < 4) { // exclude wheel
|
||||
com = Options::MouseActivateRaiseAndPassClick;
|
||||
was_action = true;
|
||||
perform_handled = true;
|
||||
|
|
22
geometry.cpp
22
geometry.cpp
|
@ -365,8 +365,8 @@ QPoint Workspace::adjustClientPosition(Client* c, QPoint pos, bool unrestricted,
|
|||
//CT 16mar98, 27May98 - magics: BorderSnapZone, WindowSnapZone
|
||||
//CT adapted for kwin on 25Nov1999
|
||||
//aleXXX 02Nov2000 added second snapping mode
|
||||
if (options->windowSnapZone || options->borderSnapZone || options->centerSnapZone) {
|
||||
const bool sOWO = options->snapOnlyWhenOverlapping;
|
||||
if (options->windowSnapZone() || options->borderSnapZone() || options->centerSnapZone()) {
|
||||
const bool sOWO = options->isSnapOnlyWhenOverlapping();
|
||||
const QRect maxRect = clientArea(MovementArea, pos + c->rect().center(), c->desktop());
|
||||
const int xmin = maxRect.left();
|
||||
const int xmax = maxRect.right() + 1; //desk size
|
||||
|
@ -387,7 +387,7 @@ QPoint Workspace::adjustClientPosition(Client* c, QPoint pos, bool unrestricted,
|
|||
int lx, ly, lrx, lry; //coords and size for the comparison client, l
|
||||
|
||||
// border snap
|
||||
int snap = options->borderSnapZone * snapAdjust; //snap trigger
|
||||
int snap = options->borderSnapZone() * snapAdjust; //snap trigger
|
||||
if (snap) {
|
||||
if ((sOWO ? (cx < xmin) : true) && (qAbs(xmin - cx) < snap)) {
|
||||
deltaX = xmin - cx;
|
||||
|
@ -409,7 +409,7 @@ QPoint Workspace::adjustClientPosition(Client* c, QPoint pos, bool unrestricted,
|
|||
}
|
||||
|
||||
// windows snap
|
||||
snap = options->windowSnapZone * snapAdjust;
|
||||
snap = options->windowSnapZone() * snapAdjust;
|
||||
if (snap) {
|
||||
QList<Client *>::ConstIterator l;
|
||||
for (l = clients.constBegin(); l != clients.constEnd(); ++l) {
|
||||
|
@ -476,7 +476,7 @@ QPoint Workspace::adjustClientPosition(Client* c, QPoint pos, bool unrestricted,
|
|||
}
|
||||
|
||||
// center snap
|
||||
snap = options->centerSnapZone * snapAdjust; //snap trigger
|
||||
snap = options->centerSnapZone() * snapAdjust; //snap trigger
|
||||
if (snap) {
|
||||
int diffX = qAbs((xmin + xmax) / 2 - (cx + cw / 2));
|
||||
int diffY = qAbs((ymin + ymax) / 2 - (cy + ch / 2));
|
||||
|
@ -486,7 +486,7 @@ QPoint Workspace::adjustClientPosition(Client* c, QPoint pos, bool unrestricted,
|
|||
deltaY = diffY;
|
||||
nx = (xmin + xmax) / 2 - cw / 2;
|
||||
ny = (ymin + ymax) / 2 - ch / 2;
|
||||
} else if (options->borderSnapZone) {
|
||||
} else if (options->borderSnapZone()) {
|
||||
// Enhance border snap
|
||||
if ((nx == xmin || nx == xmax - cw) && diffY < snap && diffY < deltaY) {
|
||||
// Snap to vertical center on screen edge
|
||||
|
@ -511,8 +511,8 @@ QRect Workspace::adjustClientSize(Client* c, QRect moveResizeGeom, int mode)
|
|||
//adapted from adjustClientPosition on 29May2004
|
||||
//this function is called when resizing a window and will modify
|
||||
//the new dimensions to snap to other windows/borders if appropriate
|
||||
if (options->windowSnapZone || options->borderSnapZone) { // || options->centerSnapZone )
|
||||
const bool sOWO = options->snapOnlyWhenOverlapping;
|
||||
if (options->windowSnapZone() || options->borderSnapZone()) { // || options->centerSnapZone )
|
||||
const bool sOWO = options->isSnapOnlyWhenOverlapping();
|
||||
|
||||
const QRect maxRect = clientArea(MovementArea, c->rect().center(), c->desktop());
|
||||
const int xmin = maxRect.left();
|
||||
|
@ -533,7 +533,7 @@ QRect Workspace::adjustClientSize(Client* c, QRect moveResizeGeom, int mode)
|
|||
int lx, ly, lrx, lry; //coords and size for the comparison client, l
|
||||
|
||||
// border snap
|
||||
int snap = options->borderSnapZone; //snap trigger
|
||||
int snap = options->borderSnapZone(); //snap trigger
|
||||
if (snap) {
|
||||
deltaX = int(snap);
|
||||
deltaY = int(snap);
|
||||
|
@ -603,7 +603,7 @@ QRect Workspace::adjustClientSize(Client* c, QRect moveResizeGeom, int mode)
|
|||
}
|
||||
|
||||
// windows snap
|
||||
snap = options->windowSnapZone;
|
||||
snap = options->windowSnapZone();
|
||||
if (snap) {
|
||||
deltaX = int(snap);
|
||||
deltaY = int(snap);
|
||||
|
@ -2427,7 +2427,7 @@ QRect Client::fullscreenMonitorsArea(NETFullscreenMonitors requestedTopology) co
|
|||
|
||||
int Client::checkFullScreenHack(const QRect& geom) const
|
||||
{
|
||||
if (!options->legacyFullscreenSupport)
|
||||
if (!options->isLegacyFullscreenSupport())
|
||||
return 0;
|
||||
// if it's noborder window, and has size of one screen or the whole desktop geometry, it's fullscreen hack
|
||||
if (noBorder() && app_noborder && isFullScreenable(true)) {
|
||||
|
|
|
@ -270,7 +270,7 @@ void Workspace::raiseOrLowerClient(Client *c)
|
|||
topmost = most_recently_raised;
|
||||
else
|
||||
topmost = topClientOnDesktop(c->isOnAllDesktops() ? currentDesktop() : c->desktop(),
|
||||
options->separateScreenFocus ? c->screen() : -1);
|
||||
options->isSeparateScreenFocus() ? c->screen() : -1);
|
||||
|
||||
if (c == topmost)
|
||||
lowerClient(c);
|
||||
|
|
10
manage.cpp
10
manage.cpp
|
@ -274,7 +274,7 @@ bool Client::manage(Window w, bool isMapped)
|
|||
else
|
||||
usePosition = true;
|
||||
if (!rules()->checkIgnoreGeometry(!usePosition)) {
|
||||
bool ignorePPosition = options->ignorePositionClasses.contains(
|
||||
bool ignorePPosition = options->ignorePositionClasses().contains(
|
||||
QString::fromLatin1(resourceClass()));
|
||||
|
||||
if (((xSizeHint.flags & PPosition) && !ignorePPosition) ||
|
||||
|
@ -307,8 +307,8 @@ bool Client::manage(Window w, bool isMapped)
|
|||
bool dontKeepInArea = false;
|
||||
setTabGroup(NULL);
|
||||
if (!noBorder()) {
|
||||
const bool autogrouping = rules()->checkAutogrouping(options->autogroupSimilarWindows);
|
||||
const bool autogroupInFg = rules()->checkAutogroupInForeground(options->autogroupInForeground);
|
||||
const bool autogrouping = rules()->checkAutogrouping(options->isAutogroupSimilarWindows());
|
||||
const bool autogroupInFg = rules()->checkAutogroupInForeground(options->isAutogroupInForeground());
|
||||
// Automatically add to previous groups on session restore
|
||||
if (session && session->tabGroupClient && session->tabGroupClient != this) {
|
||||
tabBehind(session->tabGroupClient, autogroupInFg);
|
||||
|
@ -563,7 +563,7 @@ bool Client::manage(Window w, bool isMapped)
|
|||
break;
|
||||
}
|
||||
if (!belongs_to_desktop && workspace()->showingDesktop())
|
||||
workspace()->resetShowingDesktop(options->showDesktopIsMinimizeAll);
|
||||
workspace()->resetShowingDesktop(options->isShowDesktopIsMinimizeAll());
|
||||
|
||||
if (isOnCurrentDesktop() && !isMapped && !allow && (!session || session->stackingOrder < 0))
|
||||
workspace()->restackClientUnderActive(this);
|
||||
|
@ -706,7 +706,7 @@ Client* Client::findAutogroupCandidate() const
|
|||
return NULL;
|
||||
|
||||
// If we don't have an ID take a guess
|
||||
if (rules()->checkAutogrouping(options->autogroupSimilarWindows)) {
|
||||
if (rules()->checkAutogrouping(options->isAutogroupSimilarWindows())) {
|
||||
QByteArray wRole = truncatedWindowRole(windowRole());
|
||||
foreach (Client *c, workspace()->clientList()) {
|
||||
if (desktop() != c->desktop() || activities() != c->activities())
|
||||
|
|
138
options.cpp
138
options.cpp
|
@ -53,8 +53,8 @@ namespace KWin
|
|||
int currentRefreshRate()
|
||||
{
|
||||
int rate = -1;
|
||||
if (options->refreshRate > 0) // use manually configured refresh rate
|
||||
rate = options->refreshRate;
|
||||
if (options->refreshRate() > 0) // use manually configured refresh rate
|
||||
rate = options->refreshRate();
|
||||
#ifndef KWIN_HAVE_OPENGLES
|
||||
else if (GLPlatform::instance()->driver() == Driver_NVidia) {
|
||||
QProcess nvidia_settings;
|
||||
|
@ -92,7 +92,7 @@ Options::Options()
|
|||
: electric_borders(0)
|
||||
, electric_border_delay(0)
|
||||
{
|
||||
compositingInitialized = false;
|
||||
m_compositingInitialized = false;
|
||||
updateSettings();
|
||||
}
|
||||
|
||||
|
@ -112,60 +112,60 @@ unsigned long Options::updateSettings()
|
|||
QString val;
|
||||
|
||||
val = config.readEntry("FocusPolicy", "ClickToFocus");
|
||||
focusPolicy = ClickToFocus; // what a default :-)
|
||||
m_focusPolicy = ClickToFocus; // what a default :-)
|
||||
if (val == "FocusFollowsMouse")
|
||||
focusPolicy = FocusFollowsMouse;
|
||||
m_focusPolicy = FocusFollowsMouse;
|
||||
else if (val == "FocusUnderMouse")
|
||||
focusPolicy = FocusUnderMouse;
|
||||
m_focusPolicy = FocusUnderMouse;
|
||||
else if (val == "FocusStrictlyUnderMouse")
|
||||
focusPolicy = FocusStrictlyUnderMouse;
|
||||
m_focusPolicy = FocusStrictlyUnderMouse;
|
||||
|
||||
nextFocusPrefersMouse = config.readEntry("NextFocusPrefersMouse", false);
|
||||
m_nextFocusPrefersMouse = config.readEntry("NextFocusPrefersMouse", false);
|
||||
|
||||
separateScreenFocus = config.readEntry("SeparateScreenFocus", false);
|
||||
activeMouseScreen = config.readEntry("ActiveMouseScreen", focusPolicy != ClickToFocus);
|
||||
m_separateScreenFocus = config.readEntry("SeparateScreenFocus", false);
|
||||
m_activeMouseScreen = config.readEntry("ActiveMouseScreen", m_focusPolicy != ClickToFocus);
|
||||
|
||||
rollOverDesktops = config.readEntry("RollOverDesktops", true);
|
||||
m_rollOverDesktops = config.readEntry("RollOverDesktops", true);
|
||||
|
||||
legacyFullscreenSupport = config.readEntry("LegacyFullscreenSupport", false);
|
||||
m_legacyFullscreenSupport = config.readEntry("LegacyFullscreenSupport", false);
|
||||
|
||||
// focusStealingPreventionLevel = config.readEntry( "FocusStealingPreventionLevel", 2 );
|
||||
// TODO use low level for now
|
||||
focusStealingPreventionLevel = config.readEntry("FocusStealingPreventionLevel", 1);
|
||||
focusStealingPreventionLevel = qMax(0, qMin(4, focusStealingPreventionLevel));
|
||||
m_focusStealingPreventionLevel = config.readEntry("FocusStealingPreventionLevel", 1);
|
||||
m_focusStealingPreventionLevel = qMax(0, qMin(4, m_focusStealingPreventionLevel));
|
||||
if (!focusPolicyIsReasonable()) // #48786, comments #7 and later
|
||||
focusStealingPreventionLevel = 0;
|
||||
m_focusStealingPreventionLevel = 0;
|
||||
|
||||
#ifdef KWIN_BUILD_DECORATIONS
|
||||
placement = Placement::policyFromString(config.readEntry("Placement"), true);
|
||||
m_placement = Placement::policyFromString(config.readEntry("Placement"), true);
|
||||
#else
|
||||
placement = Placement::Maximizing;
|
||||
m_placement = Placement::Maximizing;
|
||||
#endif
|
||||
|
||||
if (focusPolicy == ClickToFocus) {
|
||||
autoRaise = false;
|
||||
autoRaiseInterval = 0;
|
||||
delayFocusInterval = 0;
|
||||
if (m_focusPolicy == ClickToFocus) {
|
||||
m_autoRaise = false;
|
||||
m_autoRaiseInterval = 0;
|
||||
m_delayFocusInterval = 0;
|
||||
} else {
|
||||
autoRaise = config.readEntry("AutoRaise", false);
|
||||
autoRaiseInterval = config.readEntry("AutoRaiseInterval", 0);
|
||||
delayFocusInterval = config.readEntry("DelayFocusInterval", 0);
|
||||
m_autoRaise = config.readEntry("AutoRaise", false);
|
||||
m_autoRaiseInterval = config.readEntry("AutoRaiseInterval", 0);
|
||||
m_delayFocusInterval = config.readEntry("DelayFocusInterval", 0);
|
||||
}
|
||||
|
||||
shadeHover = config.readEntry("ShadeHover", false);
|
||||
shadeHoverInterval = config.readEntry("ShadeHoverInterval", 250);
|
||||
m_shadeHover = config.readEntry("ShadeHover", false);
|
||||
m_shadeHoverInterval = config.readEntry("ShadeHoverInterval", 250);
|
||||
|
||||
tilingOn = config.readEntry("TilingOn", false);
|
||||
tilingLayout = static_cast<TilingLayoutFactory::Layouts>(config.readEntry("TilingDefaultLayout", 0));
|
||||
tilingRaisePolicy = config.readEntry("TilingRaisePolicy", 0);
|
||||
m_tilingOn = config.readEntry("TilingOn", false);
|
||||
m_tilingLayout = static_cast<TilingLayoutFactory::Layouts>(config.readEntry("TilingDefaultLayout", 0));
|
||||
m_tilingRaisePolicy = config.readEntry("TilingRaisePolicy", 0);
|
||||
|
||||
// important: autoRaise implies ClickRaise
|
||||
clickRaise = autoRaise || config.readEntry("ClickRaise", true);
|
||||
m_clickRaise = m_autoRaise || config.readEntry("ClickRaise", true);
|
||||
|
||||
borderSnapZone = config.readEntry("BorderSnapZone", 10);
|
||||
windowSnapZone = config.readEntry("WindowSnapZone", 10);
|
||||
centerSnapZone = config.readEntry("CenterSnapZone", 0);
|
||||
snapOnlyWhenOverlapping = config.readEntry("SnapOnlyWhenOverlapping", false);
|
||||
m_borderSnapZone = config.readEntry("BorderSnapZone", 10);
|
||||
m_windowSnapZone = config.readEntry("WindowSnapZone", 10);
|
||||
m_centerSnapZone = config.readEntry("CenterSnapZone", 0);
|
||||
m_snapOnlyWhenOverlapping = config.readEntry("SnapOnlyWhenOverlapping", false);
|
||||
|
||||
// Electric borders
|
||||
KConfigGroup borderConfig(_config, "ElectricBorders");
|
||||
|
@ -189,12 +189,12 @@ unsigned long Options::updateSettings()
|
|||
setOpMaxButtonMiddleClick(windowOperation(config.readEntry("MaximizeButtonMiddleClickCommand", "Maximize (vertical only)"), true));
|
||||
setOpMaxButtonRightClick(windowOperation(config.readEntry("MaximizeButtonRightClickCommand", "Maximize (horizontal only)"), true));
|
||||
|
||||
ignorePositionClasses = config.readEntry("IgnorePositionClasses", QStringList());
|
||||
m_ignorePositionClasses = config.readEntry("IgnorePositionClasses", QStringList());
|
||||
ignoreFocusStealingClasses = config.readEntry("IgnoreFocusStealingClasses", QStringList());
|
||||
// Qt3.2 and older had resource class all lowercase, but Qt3.3 has it capitalized
|
||||
// therefore Client::resourceClass() forces lowercase, force here lowercase as well
|
||||
for (QStringList::Iterator it = ignorePositionClasses.begin();
|
||||
it != ignorePositionClasses.end();
|
||||
for (QStringList::Iterator it = m_ignorePositionClasses.begin();
|
||||
it != m_ignorePositionClasses.end();
|
||||
++it)
|
||||
(*it) = (*it).toLower();
|
||||
for (QStringList::Iterator it = ignoreFocusStealingClasses.begin();
|
||||
|
@ -202,12 +202,12 @@ unsigned long Options::updateSettings()
|
|||
++it)
|
||||
(*it) = (*it).toLower();
|
||||
|
||||
killPingTimeout = config.readEntry("KillPingTimeout", 5000);
|
||||
hideUtilityWindowsForInactive = config.readEntry("HideUtilityWindowsForInactive", true);
|
||||
inactiveTabsSkipTaskbar = config.readEntry("InactiveTabsSkipTaskbar", false);
|
||||
autogroupSimilarWindows = config.readEntry("AutogroupSimilarWindows", false);
|
||||
autogroupInForeground = config.readEntry("AutogroupInForeground", true);
|
||||
showDesktopIsMinimizeAll = config.readEntry("ShowDesktopIsMinimizeAll", false);
|
||||
m_killPingTimeout = config.readEntry("KillPingTimeout", 5000);
|
||||
m_hideUtilityWindowsForInactive = config.readEntry("HideUtilityWindowsForInactive", true);
|
||||
m_inactiveTabsSkipTaskbar = config.readEntry("InactiveTabsSkipTaskbar", false);
|
||||
m_autogroupSimilarWindows = config.readEntry("AutogroupSimilarWindows", false);
|
||||
m_autogroupInForeground = config.readEntry("AutogroupInForeground", true);
|
||||
m_showDesktopIsMinimizeAll = config.readEntry("ShowDesktopIsMinimizeAll", false);
|
||||
|
||||
borderless_maximized_windows = config.readEntry("BorderlessMaximizedWindows", false);
|
||||
|
||||
|
@ -231,8 +231,8 @@ unsigned long Options::updateSettings()
|
|||
CmdAllWheel = mouseWheelCommand(config.readEntry("CommandAllWheel", "Nothing"));
|
||||
|
||||
config = KConfigGroup(_config, "Compositing");
|
||||
maxFpsInterval = qRound(1000.0 / config.readEntry("MaxFPS", 60));
|
||||
refreshRate = config.readEntry("RefreshRate", 0);
|
||||
m_maxFpsInterval = qRound(1000.0 / config.readEntry("MaxFPS", 60));
|
||||
m_refreshRate = config.readEntry("RefreshRate", 0);
|
||||
|
||||
// Read button tooltip animation effect from kdeglobals
|
||||
// Since we want to allow users to enable window decoration tooltips
|
||||
|
@ -244,7 +244,7 @@ unsigned long Options::updateSettings()
|
|||
// KDE4 this probably needs to be done manually in clients
|
||||
|
||||
// Driver-specific config detection
|
||||
compositingInitialized = false;
|
||||
m_compositingInitialized = false;
|
||||
reloadCompositingSettings();
|
||||
|
||||
return changed;
|
||||
|
@ -257,29 +257,29 @@ void Options::reloadCompositingSettings(bool force)
|
|||
|
||||
QString compositingBackend = config.readEntry("Backend", "OpenGL");
|
||||
if (compositingBackend == "XRender")
|
||||
compositingMode = XRenderCompositing;
|
||||
m_compositingMode = XRenderCompositing;
|
||||
else
|
||||
compositingMode = OpenGLCompositing;
|
||||
m_compositingMode = OpenGLCompositing;
|
||||
|
||||
useCompositing = false;
|
||||
m_useCompositing = false;
|
||||
if (const char *c = getenv("KWIN_COMPOSE")) {
|
||||
switch(c[0]) {
|
||||
case 'O':
|
||||
kDebug(1212) << "Compositing forced to OpenGL mode by environment variable";
|
||||
compositingMode = OpenGLCompositing;
|
||||
useCompositing = true;
|
||||
m_compositingMode = OpenGLCompositing;
|
||||
m_useCompositing = true;
|
||||
break;
|
||||
case 'X':
|
||||
kDebug(1212) << "Compositing forced to XRender mode by environment variable";
|
||||
compositingMode = XRenderCompositing;
|
||||
useCompositing = true;
|
||||
m_compositingMode = XRenderCompositing;
|
||||
m_useCompositing = true;
|
||||
break;
|
||||
case 'N':
|
||||
if (getenv("KDE_FAILSAFE"))
|
||||
kDebug(1212) << "Compositing disabled forcefully by KDE failsafe mode";
|
||||
else
|
||||
kDebug(1212) << "Compositing disabled forcefully by environment variable";
|
||||
compositingMode = NoCompositing;
|
||||
m_compositingMode = NoCompositing;
|
||||
break;
|
||||
default:
|
||||
kDebug(1212) << "Unknown KWIN_COMPOSE mode set, ignoring";
|
||||
|
@ -287,42 +287,42 @@ void Options::reloadCompositingSettings(bool force)
|
|||
}
|
||||
}
|
||||
|
||||
if (compositingMode == NoCompositing)
|
||||
if (m_compositingMode == NoCompositing)
|
||||
return; // do not even detect compositing preferences if explicitly disabled
|
||||
|
||||
// it's either enforced by env or by initial resume from "suspend" or we check the settings
|
||||
useCompositing = useCompositing || force || config.readEntry("Enabled", true);
|
||||
m_useCompositing = m_useCompositing || force || config.readEntry("Enabled", true);
|
||||
|
||||
if (!useCompositing)
|
||||
if (!m_useCompositing)
|
||||
return; // not enforced or necessary and not "enabled" by setting
|
||||
|
||||
// from now on we've an initial setup and don't have to reload settigns on compositing activation
|
||||
// see Workspace::setupCompositing(), composite.cpp
|
||||
compositingInitialized = true;
|
||||
m_compositingInitialized = true;
|
||||
|
||||
// Compositing settings
|
||||
CompositingPrefs prefs;
|
||||
prefs.detect();
|
||||
|
||||
useCompositing = config.readEntry("Enabled" , prefs.recommendCompositing());
|
||||
glDirect = prefs.enableDirectRendering();
|
||||
glVSync = config.readEntry("GLVSync", prefs.enableVSync());
|
||||
glSmoothScale = qBound(-1, config.readEntry("GLTextureFilter", 2), 2);
|
||||
glStrictBinding = config.readEntry("GLStrictBinding", prefs.strictBinding());
|
||||
m_useCompositing = config.readEntry("Enabled" , prefs.recommendCompositing());
|
||||
m_glDirect = prefs.enableDirectRendering();
|
||||
m_glVSync = config.readEntry("GLVSync", prefs.enableVSync());
|
||||
m_glSmoothScale = qBound(-1, config.readEntry("GLTextureFilter", 2), 2);
|
||||
m_glStrictBinding = config.readEntry("GLStrictBinding", prefs.strictBinding());
|
||||
|
||||
xrenderSmoothScale = config.readEntry("XRenderSmoothScale", false);
|
||||
m_xrenderSmoothScale = config.readEntry("XRenderSmoothScale", false);
|
||||
|
||||
hiddenPreviews = HiddenPreviewsShown;
|
||||
m_hiddenPreviews = HiddenPreviewsShown;
|
||||
// 4 - off, 5 - shown, 6 - always, other are old values
|
||||
int hps = config.readEntry("HiddenPreviews", 5);
|
||||
if (hps == 4)
|
||||
hiddenPreviews = HiddenPreviewsNever;
|
||||
m_hiddenPreviews = HiddenPreviewsNever;
|
||||
else if (hps == 5)
|
||||
hiddenPreviews = HiddenPreviewsShown;
|
||||
m_hiddenPreviews = HiddenPreviewsShown;
|
||||
else if (hps == 6)
|
||||
hiddenPreviews = HiddenPreviewsAlways;
|
||||
m_hiddenPreviews = HiddenPreviewsAlways;
|
||||
|
||||
unredirectFullscreen = config.readEntry("UnredirectFullscreen", false);
|
||||
m_unredirectFullscreen = config.readEntry("UnredirectFullscreen", false);
|
||||
animationSpeed = qBound(0, config.readEntry("AnimationSpeed", 3), 6);
|
||||
}
|
||||
|
||||
|
|
216
options.h
216
options.h
|
@ -78,106 +78,155 @@ public:
|
|||
</ul>
|
||||
*/
|
||||
enum FocusPolicy { ClickToFocus, FocusFollowsMouse, FocusUnderMouse, FocusStrictlyUnderMouse };
|
||||
FocusPolicy focusPolicy;
|
||||
bool nextFocusPrefersMouse;
|
||||
FocusPolicy focusPolicy() const {
|
||||
return m_focusPolicy;
|
||||
}
|
||||
bool isNextFocusPrefersMouse() const {
|
||||
return m_nextFocusPrefersMouse;
|
||||
}
|
||||
|
||||
/**
|
||||
Whether clicking on a window raises it in FocusFollowsMouse
|
||||
mode or not.
|
||||
*/
|
||||
bool clickRaise;
|
||||
bool isClickRaise() const {
|
||||
return m_clickRaise;
|
||||
}
|
||||
|
||||
/**
|
||||
whether autoraise is enabled FocusFollowsMouse mode or not.
|
||||
*/
|
||||
bool autoRaise;
|
||||
bool isAutoRaise() const {
|
||||
return m_autoRaise;
|
||||
}
|
||||
|
||||
/**
|
||||
autoraise interval
|
||||
*/
|
||||
int autoRaiseInterval;
|
||||
int autoRaiseInterval() const {
|
||||
return m_autoRaiseInterval;
|
||||
}
|
||||
|
||||
/**
|
||||
delayed focus interval
|
||||
*/
|
||||
int delayFocusInterval;
|
||||
int delayFocusInterval() const {
|
||||
return m_delayFocusInterval;
|
||||
}
|
||||
|
||||
/**
|
||||
Whether shade hover is enabled or not
|
||||
*/
|
||||
bool shadeHover;
|
||||
bool isShadeHover() const {
|
||||
return m_shadeHover;
|
||||
}
|
||||
|
||||
/**
|
||||
shade hover interval
|
||||
*/
|
||||
int shadeHoverInterval;
|
||||
int shadeHoverInterval() {
|
||||
return m_shadeHoverInterval;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether tiling is enabled or not
|
||||
*/
|
||||
bool tilingOn;
|
||||
bool isTilingOn() const {
|
||||
return m_tilingOn;
|
||||
}
|
||||
void setTilingOn(bool enabled) {
|
||||
m_tilingOn = enabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tiling Layout
|
||||
*/
|
||||
enum TilingLayoutFactory::Layouts tilingLayout;
|
||||
TilingLayoutFactory::Layouts tilingLayout() const {
|
||||
return m_tilingLayout;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tiling window raise policy.
|
||||
*/
|
||||
int tilingRaisePolicy;
|
||||
int tilingRaisePolicy() const {
|
||||
return m_tilingRaisePolicy;
|
||||
}
|
||||
|
||||
// whether to see Xinerama screens separately for focus (in Alt+Tab, when activating next client)
|
||||
bool separateScreenFocus;
|
||||
bool isSeparateScreenFocus() const {
|
||||
return m_separateScreenFocus;
|
||||
}
|
||||
// whether active Xinerama screen is the one with mouse (or with the active window)
|
||||
bool activeMouseScreen;
|
||||
bool isActiveMouseScreen() const {
|
||||
return m_activeMouseScreen;
|
||||
}
|
||||
|
||||
Placement::Policy placement;
|
||||
Placement::Policy placement() const {
|
||||
return m_placement;
|
||||
}
|
||||
|
||||
bool focusPolicyIsReasonable() {
|
||||
return focusPolicy == ClickToFocus || focusPolicy == FocusFollowsMouse;
|
||||
return m_focusPolicy == ClickToFocus || m_focusPolicy == FocusFollowsMouse;
|
||||
}
|
||||
|
||||
/**
|
||||
* the size of the zone that triggers snapping on desktop borders
|
||||
*/
|
||||
int borderSnapZone;
|
||||
int borderSnapZone() const {
|
||||
return m_borderSnapZone;
|
||||
}
|
||||
|
||||
/**
|
||||
* the size of the zone that triggers snapping with other windows
|
||||
*/
|
||||
int windowSnapZone;
|
||||
int windowSnapZone() const {
|
||||
return m_windowSnapZone;
|
||||
}
|
||||
|
||||
/**
|
||||
* the size of the zone that triggers snapping on the screen center
|
||||
*/
|
||||
int centerSnapZone;
|
||||
int centerSnapZone() const {
|
||||
return m_centerSnapZone;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* snap only when windows will overlap
|
||||
*/
|
||||
bool snapOnlyWhenOverlapping;
|
||||
bool isSnapOnlyWhenOverlapping() const {
|
||||
return m_snapOnlyWhenOverlapping;
|
||||
}
|
||||
|
||||
bool showDesktopIsMinimizeAll;
|
||||
bool isShowDesktopIsMinimizeAll() const {
|
||||
return m_showDesktopIsMinimizeAll;
|
||||
}
|
||||
|
||||
/**
|
||||
* whether or not we roll over to the other edge when switching desktops past the edge
|
||||
*/
|
||||
bool rollOverDesktops;
|
||||
bool isRollOverDesktops() const {
|
||||
return m_rollOverDesktops;
|
||||
}
|
||||
|
||||
// 0 - 4 , see Workspace::allowClientActivation()
|
||||
int focusStealingPreventionLevel;
|
||||
int focusStealingPreventionLevel() const {
|
||||
return m_focusStealingPreventionLevel;
|
||||
}
|
||||
|
||||
/**
|
||||
* List of window classes to ignore PPosition size hint
|
||||
*/
|
||||
QStringList ignorePositionClasses;
|
||||
const QStringList &ignorePositionClasses() const {
|
||||
return m_ignorePositionClasses;
|
||||
}
|
||||
|
||||
/**
|
||||
* support legacy fullscreen windows hack: borderless non-netwm windows with screen geometry
|
||||
*/
|
||||
bool legacyFullscreenSupport;
|
||||
bool isLegacyFullscreenSupport() const {
|
||||
return m_legacyFullscreenSupport;
|
||||
}
|
||||
|
||||
bool checkIgnoreFocusStealing(const Client* c);
|
||||
|
||||
|
@ -314,14 +363,24 @@ public:
|
|||
}
|
||||
|
||||
// timeout before non-responding application will be killed after attempt to close
|
||||
int killPingTimeout;
|
||||
int killPingTimeout() const {
|
||||
return m_killPingTimeout;
|
||||
}
|
||||
|
||||
// Whether to hide utility windows for inactive applications.
|
||||
bool hideUtilityWindowsForInactive;
|
||||
bool isHideUtilityWindowsForInactive() const {
|
||||
return m_hideUtilityWindowsForInactive;
|
||||
}
|
||||
|
||||
bool inactiveTabsSkipTaskbar;
|
||||
bool autogroupSimilarWindows;
|
||||
bool autogroupInForeground;
|
||||
bool isInactiveTabsSkipTaskbar() const {
|
||||
return m_inactiveTabsSkipTaskbar;
|
||||
}
|
||||
bool isAutogroupSimilarWindows() const {
|
||||
return m_autogroupSimilarWindows;
|
||||
}
|
||||
bool isAutogroupInForeground() const {
|
||||
return m_autogroupInForeground;
|
||||
}
|
||||
|
||||
// Desktop effects
|
||||
double animationTimeFactor() const;
|
||||
|
@ -329,30 +388,105 @@ public:
|
|||
//----------------------
|
||||
// Compositing settings
|
||||
void reloadCompositingSettings(bool force = false);
|
||||
CompositingType compositingMode;
|
||||
bool useCompositing; // Separate to mode so the user can toggle
|
||||
bool compositingInitialized;
|
||||
CompositingType compositingMode() const {
|
||||
return m_compositingMode;
|
||||
}
|
||||
void setCompositingMode(CompositingType mode) {
|
||||
m_compositingMode = mode;
|
||||
}
|
||||
// Separate to mode so the user can toggle
|
||||
bool isUseCompositing() const {
|
||||
return m_useCompositing;
|
||||
}
|
||||
bool isCompositingInitialized() const {
|
||||
return m_compositingInitialized;
|
||||
}
|
||||
void setCompositingInitialized(bool set) {
|
||||
m_compositingInitialized = set;
|
||||
}
|
||||
|
||||
// General preferences
|
||||
HiddenPreviews hiddenPreviews;
|
||||
bool unredirectFullscreen;
|
||||
HiddenPreviews hiddenPreviews() const {
|
||||
return m_hiddenPreviews;
|
||||
}
|
||||
bool isUnredirectFullscreen() const {
|
||||
return m_unredirectFullscreen;
|
||||
}
|
||||
// OpenGL
|
||||
int glSmoothScale; // 0 = no, 1 = yes when transformed,
|
||||
// 0 = no, 1 = yes when transformed,
|
||||
// 2 = try trilinear when transformed; else 1,
|
||||
// -1 = auto
|
||||
bool glVSync;
|
||||
int glSmoothScale() const {
|
||||
return m_glSmoothScale;
|
||||
}
|
||||
bool isGlVSync() const {
|
||||
return m_glVSync;
|
||||
}
|
||||
// XRender
|
||||
bool xrenderSmoothScale;
|
||||
bool isXrenderSmoothScale() const {
|
||||
return m_xrenderSmoothScale;
|
||||
}
|
||||
|
||||
uint maxFpsInterval;
|
||||
uint maxFpsInterval() const {
|
||||
return m_maxFpsInterval;
|
||||
}
|
||||
// Settings that should be auto-detected
|
||||
uint refreshRate;
|
||||
bool glDirect;
|
||||
bool glStrictBinding;
|
||||
uint refreshRate() const {
|
||||
return m_refreshRate;
|
||||
}
|
||||
bool isGlDirect() const {
|
||||
return m_glDirect;
|
||||
}
|
||||
bool isGlStrictBinding() const {
|
||||
return m_glStrictBinding;
|
||||
}
|
||||
|
||||
//----------------------
|
||||
|
||||
private:
|
||||
FocusPolicy m_focusPolicy;
|
||||
bool m_nextFocusPrefersMouse;
|
||||
bool m_clickRaise;
|
||||
bool m_autoRaise;
|
||||
int m_autoRaiseInterval;
|
||||
int m_delayFocusInterval;
|
||||
bool m_shadeHover;
|
||||
int m_shadeHoverInterval;
|
||||
bool m_tilingOn;
|
||||
TilingLayoutFactory::Layouts m_tilingLayout;
|
||||
int m_tilingRaisePolicy;
|
||||
bool m_separateScreenFocus;
|
||||
bool m_activeMouseScreen;
|
||||
Placement::Policy m_placement;
|
||||
int m_borderSnapZone;
|
||||
int m_windowSnapZone;
|
||||
int m_centerSnapZone;
|
||||
bool m_snapOnlyWhenOverlapping;
|
||||
bool m_showDesktopIsMinimizeAll;
|
||||
bool m_rollOverDesktops;
|
||||
int m_focusStealingPreventionLevel;
|
||||
QStringList m_ignorePositionClasses;
|
||||
bool m_legacyFullscreenSupport;
|
||||
int m_killPingTimeout;
|
||||
bool m_hideUtilityWindowsForInactive;
|
||||
bool m_inactiveTabsSkipTaskbar;
|
||||
bool m_autogroupSimilarWindows;
|
||||
bool m_autogroupInForeground;
|
||||
|
||||
CompositingType m_compositingMode;
|
||||
bool m_useCompositing;
|
||||
bool m_compositingInitialized;
|
||||
HiddenPreviews m_hiddenPreviews;
|
||||
bool m_unredirectFullscreen;
|
||||
int m_glSmoothScale;
|
||||
bool m_glVSync;
|
||||
bool m_xrenderSmoothScale;
|
||||
uint m_maxFpsInterval;
|
||||
// Settings that should be auto-detected
|
||||
uint m_refreshRate;
|
||||
bool m_glDirect;
|
||||
bool m_glStrictBinding;
|
||||
|
||||
WindowOperation OpTitlebarDblClick;
|
||||
|
||||
// mouse bindings
|
||||
|
|
|
@ -58,13 +58,13 @@ void Placement::place(Client* c, QRect& area)
|
|||
}
|
||||
|
||||
if (c->isUtility())
|
||||
placeUtility(c, area, options->placement);
|
||||
placeUtility(c, area, options->placement());
|
||||
else if (c->isDialog())
|
||||
placeDialog(c, area, options->placement);
|
||||
placeDialog(c, area, options->placement());
|
||||
else if (c->isSplash())
|
||||
placeOnMainWindow(c, area); // on mainwindow, if any, otherwise centered
|
||||
else
|
||||
place(c, area, options->placement);
|
||||
place(c, area, options->placement());
|
||||
}
|
||||
|
||||
void Placement::place(Client* c, QRect& area, Policy policy, Policy nextPlacement)
|
||||
|
@ -72,7 +72,7 @@ void Placement::place(Client* c, QRect& area, Policy policy, Policy nextPlacemen
|
|||
if (policy == Unknown)
|
||||
policy = Default;
|
||||
if (policy == Default)
|
||||
policy = options->placement;
|
||||
policy = options->placement();
|
||||
if (policy == NoPlacement)
|
||||
return;
|
||||
else if (policy == Random)
|
||||
|
|
|
@ -487,7 +487,7 @@ void SceneOpenGL::Window::performPaint(int mask, QRegion region, WindowPaintData
|
|||
return;
|
||||
|
||||
// Update the texture filter
|
||||
if (options->glSmoothScale != 0 &&
|
||||
if (options->glSmoothScale() != 0 &&
|
||||
(mask & (PAINT_WINDOW_TRANSFORMED | PAINT_SCREEN_TRANSFORMED)))
|
||||
filter = ImageFilterGood;
|
||||
else
|
||||
|
|
|
@ -288,7 +288,7 @@ bool SceneOpenGL::Texture::load(const Pixmap& pix, const QSize& size,
|
|||
|
||||
void SceneOpenGL::TexturePrivate::onDamage()
|
||||
{
|
||||
if (options->glStrictBinding) {
|
||||
if (options->isGlStrictBinding()) {
|
||||
// This is just implemented to be consistent with
|
||||
// the example in mesa/demos/src/egl/opengles1/texture_from_pixmap.c
|
||||
eglWaitNative(EGL_CORE_NATIVE_ENGINE);
|
||||
|
|
|
@ -76,7 +76,7 @@ SceneOpenGL::SceneOpenGL(Workspace* ws)
|
|||
glDrawBuffer(GL_BACK);
|
||||
// Check whether certain features are supported
|
||||
has_waitSync = false;
|
||||
if (glXGetVideoSync && glXIsDirect(display(), ctxbuffer) && options->glVSync) {
|
||||
if (glXGetVideoSync && glXIsDirect(display(), ctxbuffer) && options->isGlVSync()) {
|
||||
unsigned int sync;
|
||||
if (glXGetVideoSync(&sync) == 0) {
|
||||
if (glXWaitVideoSync(1, 0, &sync) == 0)
|
||||
|
@ -168,7 +168,7 @@ bool SceneOpenGL::initTfp()
|
|||
|
||||
bool SceneOpenGL::initRenderingContext()
|
||||
{
|
||||
bool direct_rendering = options->glDirect;
|
||||
bool direct_rendering = options->isGlDirect();
|
||||
KXErrorHandler errs1;
|
||||
ctxbuffer = glXCreateNewContext(display(), fbcbuffer, GLX_RGBA_TYPE, NULL,
|
||||
direct_rendering ? GL_TRUE : GL_FALSE);
|
||||
|
@ -608,7 +608,7 @@ SceneOpenGL::TexturePrivate::TexturePrivate()
|
|||
SceneOpenGL::TexturePrivate::~TexturePrivate()
|
||||
{
|
||||
if (m_glxpixmap != None) {
|
||||
if (!options->glStrictBinding) {
|
||||
if (!options->isGlStrictBinding()) {
|
||||
glXReleaseTexImageEXT(display(), m_glxpixmap, GLX_FRONT_LEFT_EXT);
|
||||
}
|
||||
glXDestroyPixmap(display(), m_glxpixmap);
|
||||
|
@ -722,7 +722,7 @@ bool SceneOpenGL::Texture::load(const Pixmap& pix, const QSize& size,
|
|||
|
||||
void SceneOpenGL::TexturePrivate::onDamage()
|
||||
{
|
||||
if (options->glStrictBinding && m_glxpixmap) {
|
||||
if (options->isGlStrictBinding() && m_glxpixmap) {
|
||||
glXReleaseTexImageEXT(display(), m_glxpixmap, GLX_FRONT_LEFT_EXT);
|
||||
glXBindTexImageEXT(display(), m_glxpixmap, GLX_FRONT_LEFT_EXT, NULL);
|
||||
}
|
||||
|
|
|
@ -450,7 +450,7 @@ void SceneXrender::Window::performPaint(int mask, QRegion region, WindowPaintDat
|
|||
if (pic == None) // The render format can be null for GL and/or Xv visuals
|
||||
return;
|
||||
// set picture filter
|
||||
if (options->xrenderSmoothScale) { // only when forced, it's slow
|
||||
if (options->isXrenderSmoothScale()) { // only when forced, it's slow
|
||||
if (mask & PAINT_WINDOW_TRANSFORMED)
|
||||
filter = ImageFilterGood;
|
||||
else if (mask & PAINT_SCREEN_TRANSFORMED)
|
||||
|
|
|
@ -309,19 +309,19 @@ void ScreenEdge::switchDesktop(ElectricBorder border, const QPoint& _pos)
|
|||
int desk = Workspace::self()->currentDesktop();
|
||||
const int OFFSET = 2;
|
||||
if (border == ElectricLeft || border == ElectricTopLeft || border == ElectricBottomLeft) {
|
||||
desk = Workspace::self()->desktopToLeft(desk, options->rollOverDesktops);
|
||||
desk = Workspace::self()->desktopToLeft(desk, options->isRollOverDesktops());
|
||||
pos.setX(displayWidth() - 1 - OFFSET);
|
||||
}
|
||||
if (border == ElectricRight || border == ElectricTopRight || border == ElectricBottomRight) {
|
||||
desk = Workspace::self()->desktopToRight(desk, options->rollOverDesktops);
|
||||
desk = Workspace::self()->desktopToRight(desk, options->isRollOverDesktops());
|
||||
pos.setX(OFFSET);
|
||||
}
|
||||
if (border == ElectricTop || border == ElectricTopLeft || border == ElectricTopRight) {
|
||||
desk = Workspace::self()->desktopAbove(desk, options->rollOverDesktops);
|
||||
desk = Workspace::self()->desktopAbove(desk, options->isRollOverDesktops());
|
||||
pos.setY(displayHeight() - 1 - OFFSET);
|
||||
}
|
||||
if (border == ElectricBottom || border == ElectricBottomLeft || border == ElectricBottomRight) {
|
||||
desk = Workspace::self()->desktopBelow(desk, options->rollOverDesktops);
|
||||
desk = Workspace::self()->desktopBelow(desk, options->isRollOverDesktops());
|
||||
pos.setY(OFFSET);
|
||||
}
|
||||
Client *c = Workspace::self()->getMovingClient();
|
||||
|
|
|
@ -159,7 +159,7 @@ TabBoxClient* TabBoxHandlerImpl::clientToAddToList(TabBoxClient* client, int des
|
|||
}
|
||||
}
|
||||
}
|
||||
if (options->separateScreenFocus) {
|
||||
if (options->isSeparateScreenFocus()) {
|
||||
if (current->screen() != workspace->activeScreen())
|
||||
ret = NULL;
|
||||
}
|
||||
|
@ -1052,7 +1052,7 @@ void TabBox::CDEWalkThroughWindows(bool forward)
|
|||
Workspace::self()->lowerClient(c);
|
||||
if (options->focusPolicyIsReasonable()) {
|
||||
Workspace::self()->activateClient(nc);
|
||||
if (nc->isShade() && options->shadeHover)
|
||||
if (nc->isShade() && options->isShadeHover())
|
||||
nc->setShade(ShadeActivated);
|
||||
} else {
|
||||
if (!nc->isOnDesktop(currentDesktop()))
|
||||
|
@ -1069,7 +1069,7 @@ void TabBox::KDEOneStepThroughWindows(bool forward, TabBoxMode mode)
|
|||
nextPrev(forward);
|
||||
if (Client* c = currentClient()) {
|
||||
Workspace::self()->activateClient(c);
|
||||
if (c->isShade() && options->shadeHover)
|
||||
if (c->isShade() && options->isShadeHover())
|
||||
c->setShade(ShadeActivated);
|
||||
}
|
||||
}
|
||||
|
@ -1157,7 +1157,7 @@ void TabBox::accept()
|
|||
close();
|
||||
if (c) {
|
||||
Workspace::self()->activateClient(c);
|
||||
if (c->isShade() && options->shadeHover)
|
||||
if (c->isShade() && options->isShadeHover())
|
||||
c->setShade(ShadeActivated);
|
||||
if (c->isDesktop())
|
||||
Workspace::self()->setShowingDesktop(!Workspace::self()->showingDesktop());
|
||||
|
|
|
@ -87,7 +87,7 @@ void Tiling::setEnabled(bool tiling)
|
|||
KConfigGroup config(_config, "Windows");
|
||||
config.writeEntry("TilingOn", m_enabled);
|
||||
config.sync();
|
||||
options->tilingOn = m_enabled;
|
||||
options->setTilingOn(m_enabled);
|
||||
|
||||
if (m_enabled) {
|
||||
connect(m_workspace, SIGNAL(clientAdded(KWin::Client*)), this, SLOT(createTile(KWin::Client*)));
|
||||
|
@ -270,7 +270,7 @@ void Tiling::notifyTilingWindowActivated(KWin::Client *c)
|
|||
if (c == NULL)
|
||||
return;
|
||||
|
||||
if (options->tilingRaisePolicy == 1) // individual raise/lowers
|
||||
if (options->tilingRaisePolicy() == 1) // individual raise/lowers
|
||||
return;
|
||||
|
||||
if (m_tilingLayouts.value(c->desktop())) {
|
||||
|
@ -286,7 +286,7 @@ void Tiling::notifyTilingWindowActivated(KWin::Client *c)
|
|||
|
||||
kDebug(1212) << "FOUND TILE";
|
||||
bool raise_floating = false;
|
||||
if (options->tilingRaisePolicy == 2) // floating always on top
|
||||
if (options->tilingRaisePolicy() == 2) // floating always on top
|
||||
raise_floating = true;
|
||||
else
|
||||
raise_floating = tile_to_raise->floating();
|
||||
|
|
|
@ -54,7 +54,7 @@ TilingLayout* TilingLayoutFactory::createLayout(int type, Workspace *w)
|
|||
/* For new layouts, make a case entry here */
|
||||
switch(type) {
|
||||
case DefaultLayout: // NOTE: fall through makes first layout default
|
||||
layout = createLayout(indexToLayoutIndex(options->tilingLayout), w);
|
||||
layout = createLayout(indexToLayoutIndex(options->tilingLayout()), w);
|
||||
break;
|
||||
|
||||
ADD_LAYOUT(Spiral, I18N_NOOP2_NOSTRIP("Spiral tiling layout", "Spiral"));
|
||||
|
|
|
@ -819,7 +819,7 @@ bool Client::performMouseCommand(Options::MouseCommand command, const QPoint &gl
|
|||
cancelShadeHoverTimer();
|
||||
break;
|
||||
case Options::MouseOperationsMenu:
|
||||
if (isActive() && options->clickRaise)
|
||||
if (isActive() && options->isClickRaise())
|
||||
autoRaise();
|
||||
workspace()->showWindowMenu(globalPos, this);
|
||||
break;
|
||||
|
@ -1028,7 +1028,7 @@ void Workspace::slotSwitchDesktopNext()
|
|||
{
|
||||
int d = currentDesktop() + 1;
|
||||
if (d > numberOfDesktops()) {
|
||||
if (options->rollOverDesktops) {
|
||||
if (options->isRollOverDesktops()) {
|
||||
d = 1;
|
||||
} else {
|
||||
return;
|
||||
|
@ -1041,7 +1041,7 @@ void Workspace::slotSwitchDesktopPrevious()
|
|||
{
|
||||
int d = currentDesktop() - 1;
|
||||
if (d <= 0) {
|
||||
if (options->rollOverDesktops)
|
||||
if (options->isRollOverDesktops())
|
||||
d = numberOfDesktops();
|
||||
else
|
||||
return;
|
||||
|
@ -1051,7 +1051,7 @@ void Workspace::slotSwitchDesktopPrevious()
|
|||
|
||||
void Workspace::slotSwitchDesktopRight()
|
||||
{
|
||||
int desktop = desktopToRight(currentDesktop(), options->rollOverDesktops);
|
||||
int desktop = desktopToRight(currentDesktop(), options->isRollOverDesktops());
|
||||
if (desktop == currentDesktop())
|
||||
return;
|
||||
setCurrentDesktop(desktop);
|
||||
|
@ -1059,7 +1059,7 @@ void Workspace::slotSwitchDesktopRight()
|
|||
|
||||
void Workspace::slotSwitchDesktopLeft()
|
||||
{
|
||||
int desktop = desktopToLeft(currentDesktop(), options->rollOverDesktops);
|
||||
int desktop = desktopToLeft(currentDesktop(), options->isRollOverDesktops());
|
||||
if (desktop == currentDesktop())
|
||||
return;
|
||||
setCurrentDesktop(desktop);
|
||||
|
@ -1067,7 +1067,7 @@ void Workspace::slotSwitchDesktopLeft()
|
|||
|
||||
void Workspace::slotSwitchDesktopUp()
|
||||
{
|
||||
int desktop = desktopAbove(currentDesktop(), options->rollOverDesktops);
|
||||
int desktop = desktopAbove(currentDesktop(), options->isRollOverDesktops());
|
||||
if (desktop == currentDesktop())
|
||||
return;
|
||||
setCurrentDesktop(desktop);
|
||||
|
@ -1075,7 +1075,7 @@ void Workspace::slotSwitchDesktopUp()
|
|||
|
||||
void Workspace::slotSwitchDesktopDown()
|
||||
{
|
||||
int desktop = desktopBelow(currentDesktop(), options->rollOverDesktops);
|
||||
int desktop = desktopBelow(currentDesktop(), options->isRollOverDesktops());
|
||||
if (desktop == currentDesktop())
|
||||
return;
|
||||
setCurrentDesktop(desktop);
|
||||
|
@ -1312,7 +1312,7 @@ void Workspace::windowToPreviousDesktop(Client* c)
|
|||
void Workspace::slotWindowToDesktopRight()
|
||||
{
|
||||
if (USABLE_ACTIVE_CLIENT) {
|
||||
int d = desktopToRight(currentDesktop(), options->rollOverDesktops);
|
||||
int d = desktopToRight(currentDesktop(), options->isRollOverDesktops());
|
||||
if (d == currentDesktop())
|
||||
return;
|
||||
|
||||
|
@ -1325,7 +1325,7 @@ void Workspace::slotWindowToDesktopRight()
|
|||
void Workspace::slotWindowToDesktopLeft()
|
||||
{
|
||||
if (USABLE_ACTIVE_CLIENT) {
|
||||
int d = desktopToLeft(currentDesktop(), options->rollOverDesktops);
|
||||
int d = desktopToLeft(currentDesktop(), options->isRollOverDesktops());
|
||||
if (d == currentDesktop())
|
||||
return;
|
||||
|
||||
|
@ -1338,7 +1338,7 @@ void Workspace::slotWindowToDesktopLeft()
|
|||
void Workspace::slotWindowToDesktopUp()
|
||||
{
|
||||
if (USABLE_ACTIVE_CLIENT) {
|
||||
int d = desktopAbove(currentDesktop(), options->rollOverDesktops);
|
||||
int d = desktopAbove(currentDesktop(), options->isRollOverDesktops());
|
||||
if (d == currentDesktop())
|
||||
return;
|
||||
|
||||
|
@ -1351,7 +1351,7 @@ void Workspace::slotWindowToDesktopUp()
|
|||
void Workspace::slotWindowToDesktopDown()
|
||||
{
|
||||
if (USABLE_ACTIVE_CLIENT) {
|
||||
int d = desktopBelow(currentDesktop(), options->rollOverDesktops);
|
||||
int d = desktopBelow(currentDesktop(), options->isRollOverDesktops());
|
||||
if (d == currentDesktop())
|
||||
return;
|
||||
|
||||
|
|
|
@ -214,7 +214,7 @@ Workspace::Workspace(bool restore)
|
|||
);
|
||||
|
||||
Extensions::init();
|
||||
compositingSuspended = !options->useCompositing;
|
||||
compositingSuspended = !options->isUseCompositing();
|
||||
#ifdef KWIN_BUILD_TABBOX
|
||||
// need to create the tabbox before compositing scene is setup
|
||||
tab_box = new TabBox::TabBox(this);
|
||||
|
@ -471,7 +471,7 @@ void Workspace::init()
|
|||
|
||||
#ifdef KWIN_BUILD_TILING
|
||||
// Enable/disable tiling
|
||||
m_tiling->setEnabled(options->tilingOn);
|
||||
m_tiling->setEnabled(options->isTilingOn());
|
||||
#endif
|
||||
|
||||
// SELI TODO: This won't work with unreasonable focus policies,
|
||||
|
@ -782,7 +782,7 @@ void Workspace::updateFocusChains(Client* c, FocusChainChange change)
|
|||
void Workspace::updateToolWindows(bool also_hide)
|
||||
{
|
||||
// TODO: What if Client's transiency/group changes? should this be called too? (I'm paranoid, am I not?)
|
||||
if (!options->hideUtilityWindowsForInactive) {
|
||||
if (!options->isHideUtilityWindowsForInactive()) {
|
||||
for (ClientList::ConstIterator it = clients.constBegin(); it != clients.constEnd(); ++it)
|
||||
if (!(*it)->tabGroup() || (*it)->tabGroup()->current() == *it)
|
||||
(*it)->hideClient(false);
|
||||
|
@ -1005,7 +1005,7 @@ void Workspace::slotReconfigure()
|
|||
}
|
||||
|
||||
#ifdef KWIN_BUILD_TILING
|
||||
m_tiling->setEnabled(options->tilingOn);
|
||||
m_tiling->setEnabled(options->isTilingOn());
|
||||
// just so that we reset windows in the right manner, 'activate' the current active window
|
||||
m_tiling->notifyTilingWindowActivated(activeClient());
|
||||
#endif
|
||||
|
@ -1045,7 +1045,7 @@ void Workspace::slotReinitCompositing()
|
|||
|
||||
// resume compositing if suspended
|
||||
compositingSuspended = false;
|
||||
options->compositingInitialized = false;
|
||||
options->setCompositingInitialized(false);
|
||||
setupCompositing();
|
||||
if (hasDecorationPlugin()) {
|
||||
KDecorationFactory* factory = mgr->factory();
|
||||
|
@ -1328,7 +1328,7 @@ bool Workspace::setCurrentDesktop(int new_desktop)
|
|||
active_client->isShown(true) && active_client->isOnCurrentDesktop())
|
||||
c = active_client; // The requestFocus below will fail, as the client is already active
|
||||
// from actiavtion.cpp
|
||||
if (!c && options->nextFocusPrefersMouse) {
|
||||
if (!c && options->isNextFocusPrefersMouse()) {
|
||||
QList<Client*>::const_iterator it = stackingOrder().constEnd();
|
||||
while (it != stackingOrder().constBegin()) {
|
||||
Client *client = *(--it);
|
||||
|
@ -1348,7 +1348,7 @@ bool Workspace::setCurrentDesktop(int new_desktop)
|
|||
for (int i = focus_chain[currentDesktop()].size() - 1; i >= 0; --i) {
|
||||
Client* tmp = focus_chain[currentDesktop()].at(i);
|
||||
if (tmp->isShown(false) && tmp->isOnCurrentActivity()
|
||||
&& ( !options->separateScreenFocus || tmp->screen() == old_active_screen )) {
|
||||
&& ( !options->isSeparateScreenFocus() || tmp->screen() == old_active_screen )) {
|
||||
c = tmp;
|
||||
break;
|
||||
}
|
||||
|
@ -1690,7 +1690,7 @@ int Workspace::numScreens() const
|
|||
|
||||
int Workspace::activeScreen() const
|
||||
{
|
||||
if (!options->activeMouseScreen) {
|
||||
if (!options->isActiveMouseScreen()) {
|
||||
if (activeClient() != NULL && !activeClient()->isOnScreen(active_screen))
|
||||
return activeClient()->screen();
|
||||
return active_screen;
|
||||
|
@ -1813,7 +1813,7 @@ void Workspace::requestDelayFocus(Client* c)
|
|||
delayFocusTimer = new QTimer(this);
|
||||
connect(delayFocusTimer, SIGNAL(timeout()), this, SLOT(delayFocus()));
|
||||
delayFocusTimer->setSingleShot(true);
|
||||
delayFocusTimer->start(options->delayFocusInterval);
|
||||
delayFocusTimer->start(options->delayFocusInterval());
|
||||
}
|
||||
|
||||
void Workspace::cancelDelayFocus()
|
||||
|
|
Loading…
Reference in New Issue