2007-04-29 17:35:43 +00:00
|
|
|
/*
|
|
|
|
* windows.cpp
|
|
|
|
*
|
|
|
|
* Copyright (c) 1997 Patrick Dowler dowler@morgul.fsh.uvic.ca
|
|
|
|
* Copyright (c) 2001 Waldo Bastian bastian@kde.org
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2007-06-25 11:03:18 +00:00
|
|
|
#include <config-workspace.h>
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2008-05-12 12:13:52 +00:00
|
|
|
#include <QApplication>
|
2007-04-29 17:35:43 +00:00
|
|
|
#include <QCheckBox>
|
|
|
|
#include <QRadioButton>
|
|
|
|
#include <QLabel>
|
2009-10-30 08:10:35 +00:00
|
|
|
#include <KComboBox>
|
2007-04-29 17:35:43 +00:00
|
|
|
#include <QHBoxLayout>
|
2008-08-25 02:22:56 +00:00
|
|
|
#include <QFormLayout>
|
2008-02-02 20:54:19 +00:00
|
|
|
#include <QtDBus/QtDBus>
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2008-05-12 12:13:52 +00:00
|
|
|
#include <KButtonGroup>
|
2007-04-29 17:35:43 +00:00
|
|
|
#include <klocale.h>
|
|
|
|
#include <knuminput.h>
|
|
|
|
#include <kdialog.h>
|
|
|
|
|
|
|
|
#include <X11/X.h>
|
|
|
|
#include <X11/Xlib.h>
|
|
|
|
#include <X11/Xutil.h>
|
|
|
|
|
|
|
|
#include "windows.h"
|
|
|
|
|
2008-11-15 03:04:44 +00:00
|
|
|
#include <kephal/screens.h>
|
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
// kwin config keywords
|
|
|
|
#define KWIN_FOCUS "FocusPolicy"
|
|
|
|
#define KWIN_PLACEMENT "Placement"
|
|
|
|
#define KWIN_GEOMETRY "GeometryTip"
|
|
|
|
#define KWIN_AUTORAISE_INTERVAL "AutoRaiseInterval"
|
|
|
|
#define KWIN_AUTORAISE "AutoRaise"
|
|
|
|
#define KWIN_DELAYFOCUS_INTERVAL "DelayFocusInterval"
|
|
|
|
#define KWIN_DELAYFOCUS "DelayFocus"
|
|
|
|
#define KWIN_CLICKRAISE "ClickRaise"
|
|
|
|
#define KWIN_MOVE_RESIZE_MAXIMIZED "MoveResizeMaximizedWindows"
|
|
|
|
#define KWIN_SHADEHOVER "ShadeHover"
|
|
|
|
#define KWIN_SHADEHOVER_INTERVAL "ShadeHoverInterval"
|
|
|
|
#define KWIN_FOCUS_STEALING "FocusStealingPreventionLevel"
|
|
|
|
#define KWIN_HIDE_UTILITY "HideUtilityWindowsForInactive"
|
2009-11-17 11:25:03 +00:00
|
|
|
#define KWIN_INACTIVE_SKIP_TASKBAR "InactiveTabsSkipTaskbar"
|
2009-11-16 10:09:03 +00:00
|
|
|
#define KWIN_AUTOGROUP_SIMILAR "AutogroupSimilarWindows"
|
2009-11-17 07:51:55 +00:00
|
|
|
#define KWIN_AUTOGROUP_FOREGROUND "AutogroupInForeground"
|
2007-05-09 12:34:55 +00:00
|
|
|
#define KWIN_SEPARATE_SCREEN_FOCUS "SeparateScreenFocus"
|
|
|
|
#define KWIN_ACTIVE_MOUSE_SCREEN "ActiveMouseScreen"
|
2010-04-25 16:43:14 +00:00
|
|
|
#define KWIN_TILINGON "TilingOn"
|
|
|
|
#define KWIN_TILING_DEFAULT_LAYOUT "TilingDefaultLayout"
|
|
|
|
#define KWIN_TILING_RAISE_POLICY "TilingRaisePolicy"
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
//CT 15mar 98 - magics
|
|
|
|
#define KWM_BRDR_SNAP_ZONE "BorderSnapZone"
|
|
|
|
#define KWM_BRDR_SNAP_ZONE_DEFAULT 10
|
|
|
|
#define KWM_WNDW_SNAP_ZONE "WindowSnapZone"
|
|
|
|
#define KWM_WNDW_SNAP_ZONE_DEFAULT 10
|
2008-07-09 15:18:47 +00:00
|
|
|
#define KWM_CNTR_SNAP_ZONE "CenterSnapZone"
|
|
|
|
#define KWM_CNTR_SNAP_ZONE_DEFAULT 0
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
#define MAX_BRDR_SNAP 100
|
|
|
|
#define MAX_WNDW_SNAP 100
|
2008-07-09 15:18:47 +00:00
|
|
|
#define MAX_CNTR_SNAP 100
|
2007-04-29 17:35:43 +00:00
|
|
|
#define MAX_EDGE_RES 1000
|
|
|
|
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
KFocusConfig::~KFocusConfig()
|
2007-04-29 17:35:43 +00:00
|
|
|
{
|
|
|
|
if (standAlone)
|
|
|
|
delete config;
|
|
|
|
}
|
|
|
|
|
|
|
|
// removed the LCD display over the slider - this is not good GUI design :) RNolden 051701
|
2011-01-30 14:34:42 +00:00
|
|
|
KFocusConfig::KFocusConfig(bool _standAlone, KConfig *_config, const KComponentData &inst, QWidget * parent)
|
2007-04-29 17:35:43 +00:00
|
|
|
: KCModule(inst, parent), config(_config), standAlone(_standAlone)
|
|
|
|
{
|
|
|
|
QString wtstr;
|
|
|
|
QBoxLayout *lay = new QVBoxLayout(this);
|
2008-10-19 09:06:35 +00:00
|
|
|
QLabel *label;
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
//iTLabel = new QLabel(i18n(" Allowed overlap:\n"
|
|
|
|
// "(% of desktop space)"),
|
|
|
|
// plcBox);
|
|
|
|
//iTLabel->setAlignment(AlignTop|AlignHCenter);
|
|
|
|
//pLay->addWidget(iTLabel,1,1);
|
|
|
|
|
|
|
|
//interactiveTrigger = new QSpinBox(0, 500, 1, plcBox);
|
|
|
|
//pLay->addWidget(interactiveTrigger,1,2);
|
|
|
|
|
|
|
|
//pLay->addRowSpacing(2,KDialog::spacingHint());
|
|
|
|
|
|
|
|
//lay->addWidget(plcBox);
|
|
|
|
|
|
|
|
// focus policy
|
2008-09-07 21:08:26 +00:00
|
|
|
//fcsBox = new QGroupBox(i18n("Focus"),this);
|
|
|
|
fcsBox = new QWidget(this);
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2008-10-19 09:06:35 +00:00
|
|
|
QGridLayout *gLay = new QGridLayout();
|
2008-05-12 12:13:52 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
fcsBox->setLayout(gLay);
|
|
|
|
|
|
|
|
focusStealing = new KComboBox(this);
|
|
|
|
focusStealing->addItem(i18nc("Focus Stealing Prevention Level", "None"));
|
|
|
|
focusStealing->addItem(i18nc("Focus Stealing Prevention Level", "Low"));
|
|
|
|
focusStealing->addItem(i18nc("Focus Stealing Prevention Level", "Medium"));
|
|
|
|
focusStealing->addItem(i18nc("Focus Stealing Prevention Level", "High"));
|
|
|
|
focusStealing->addItem(i18nc("Focus Stealing Prevention Level", "Extreme"));
|
|
|
|
wtstr = i18n("<p>This option specifies how much KWin will try to prevent unwanted focus stealing "
|
|
|
|
"caused by unexpected activation of new windows. (Note: This feature does not "
|
|
|
|
"work with the Focus Under Mouse or Focus Strictly Under Mouse focus policies.)"
|
|
|
|
"<ul>"
|
|
|
|
"<li><em>None:</em> Prevention is turned off "
|
|
|
|
"and new windows always become activated.</li>"
|
|
|
|
"<li><em>Low:</em> Prevention is enabled; when some window does not have support "
|
|
|
|
"for the underlying mechanism and KWin cannot reliably decide whether to "
|
|
|
|
"activate the window or not, it will be activated. This setting may have both "
|
|
|
|
"worse and better results than the medium level, depending on the applications.</li>"
|
|
|
|
"<li><em>Medium:</em> Prevention is enabled.</li>"
|
|
|
|
"<li><em>High:</em> New windows get activated only if no window is currently active "
|
|
|
|
"or if they belong to the currently active application. This setting is probably "
|
|
|
|
"not really usable when not using mouse focus policy.</li>"
|
|
|
|
"<li><em>Extreme:</em> All windows must be explicitly activated by the user.</li>"
|
|
|
|
"</ul></p>"
|
|
|
|
"<p>Windows that are prevented from stealing focus are marked as demanding attention, "
|
|
|
|
"which by default means their taskbar entry will be highlighted. This can be changed "
|
|
|
|
"in the Notifications control module.</p>");
|
|
|
|
focusStealing->setWhatsThis(wtstr);
|
2008-10-19 09:06:35 +00:00
|
|
|
connect(focusStealing, SIGNAL(activated(int)), SLOT(changed()));
|
2008-10-19 09:35:11 +00:00
|
|
|
focusStealing->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
2008-10-19 09:06:35 +00:00
|
|
|
label = new QLabel(i18n("Focus stealing prevention level:"), this);
|
2011-01-30 14:34:42 +00:00
|
|
|
label->setAlignment(Qt::AlignVCenter | Qt::AlignRight);
|
2008-10-19 09:06:35 +00:00
|
|
|
label->setBuddy(focusStealing);
|
|
|
|
gLay->addWidget(label, 0, 0, 1, 2);
|
|
|
|
gLay->addWidget(focusStealing, 0, 2);
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2009-10-30 08:10:35 +00:00
|
|
|
focusCombo = new KComboBox(fcsBox);
|
2011-01-30 14:34:42 +00:00
|
|
|
focusCombo->setEditable(false);
|
2007-04-29 17:35:43 +00:00
|
|
|
focusCombo->addItem(i18n("Click to Focus"), CLICK_TO_FOCUS);
|
|
|
|
focusCombo->addItem(i18n("Focus Follows Mouse"), FOCUS_FOLLOWS_MOUSE);
|
|
|
|
focusCombo->addItem(i18n("Focus Under Mouse"), FOCUS_UNDER_MOUSE);
|
|
|
|
focusCombo->addItem(i18n("Focus Strictly Under Mouse"), FOCUS_STRICTLY_UNDER_MOUSE);
|
2008-10-19 09:35:11 +00:00
|
|
|
focusCombo->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
2008-10-19 09:06:35 +00:00
|
|
|
label = new QLabel(i18n("&Policy:"), this);
|
2011-01-30 14:34:42 +00:00
|
|
|
label->setAlignment(Qt::AlignVCenter | Qt::AlignRight);
|
2008-10-19 09:06:35 +00:00
|
|
|
label->setBuddy(focusCombo);
|
|
|
|
gLay->addWidget(label, 1, 0, 1, 2);
|
|
|
|
gLay->addWidget(focusCombo, 1, 2);
|
2008-09-07 21:08:26 +00:00
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
// FIXME, when more policies have been added to KWin
|
|
|
|
wtstr = i18n("The focus policy is used to determine the active window, i.e."
|
2011-01-30 14:34:42 +00:00
|
|
|
" the window you can work in. <ul>"
|
|
|
|
" <li><em>Click to focus:</em> A window becomes active when you click into it."
|
|
|
|
" This is the behavior you might know from other operating systems.</li>"
|
|
|
|
" <li><em>Focus follows mouse:</em> Moving the mouse pointer actively on to a"
|
|
|
|
" normal window activates it. New windows will receive the focus,"
|
|
|
|
" without you having to point the mouse at them explicitly."
|
|
|
|
" Very practical if you are using the mouse a lot.</li>"
|
|
|
|
" <li><em>Focus under mouse:</em> The window that happens to be under the"
|
|
|
|
" mouse pointer is active. If the mouse points nowhere, the last window"
|
|
|
|
" that was under the mouse has focus."
|
|
|
|
" New windows will not automatically receive the focus.</li>"
|
|
|
|
" <li><em>Focus strictly under mouse:</em> Only the window under the mouse pointer is"
|
|
|
|
" active. If the mouse points nowhere, nothing has focus.</li>"
|
|
|
|
" </ul>"
|
|
|
|
"Note that 'Focus under mouse' and 'Focus strictly under mouse' prevent certain"
|
|
|
|
" features such as the Alt+Tab walk through windows dialog in the KDE mode"
|
|
|
|
" from working properly."
|
|
|
|
);
|
|
|
|
focusCombo->setWhatsThis(wtstr);
|
|
|
|
|
|
|
|
connect(focusCombo, SIGNAL(activated(int)), this, SLOT(focusPolicyChanged()));
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
// autoraise delay
|
2008-10-19 09:06:35 +00:00
|
|
|
autoRaiseOn = new QCheckBox(fcsBox);
|
2011-01-30 14:34:42 +00:00
|
|
|
connect(autoRaiseOn, SIGNAL(toggled(bool)), this, SLOT(autoRaiseOnTog(bool)));
|
2007-04-29 17:35:43 +00:00
|
|
|
autoRaise = new KIntNumInput(500, fcsBox);
|
2007-10-19 13:32:08 +00:00
|
|
|
autoRaise->setRange(0, 3000, 100);
|
2011-01-30 14:34:42 +00:00
|
|
|
autoRaise->setSteps(100, 100);
|
2008-01-14 19:39:12 +00:00
|
|
|
autoRaise->setSuffix(i18n(" ms"));
|
2008-10-19 09:35:11 +00:00
|
|
|
autoRaise->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
2008-10-19 09:06:35 +00:00
|
|
|
autoRaiseOnLabel = new QLabel(i18n("&Raise, with the following delay:"), this);
|
2011-01-30 14:34:42 +00:00
|
|
|
autoRaiseOnLabel->setAlignment(Qt::AlignVCenter | Qt::AlignRight);
|
2008-10-19 09:06:35 +00:00
|
|
|
autoRaiseOnLabel->setBuddy(autoRaise);
|
|
|
|
gLay->addWidget(autoRaiseOn, 2, 0);
|
|
|
|
gLay->addWidget(autoRaiseOnLabel, 2, 1);
|
|
|
|
gLay->addWidget(autoRaise, 2, 2);
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
connect(focusCombo, SIGNAL(activated(int)), this, SLOT(setDelayFocusEnabled()));
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2008-10-19 09:06:35 +00:00
|
|
|
delayFocusOn = new QCheckBox(fcsBox);
|
2011-01-30 14:34:42 +00:00
|
|
|
connect(delayFocusOn, SIGNAL(toggled(bool)), this, SLOT(delayFocusOnTog(bool)));
|
2007-04-29 17:35:43 +00:00
|
|
|
delayFocus = new KIntNumInput(500, fcsBox);
|
2007-10-19 13:32:08 +00:00
|
|
|
delayFocus->setRange(0, 3000, 100);
|
2011-01-30 14:34:42 +00:00
|
|
|
delayFocus->setSteps(100, 100);
|
2008-01-14 19:39:12 +00:00
|
|
|
delayFocus->setSuffix(i18n(" ms"));
|
2008-10-19 09:35:11 +00:00
|
|
|
delayFocus->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
2008-10-19 09:06:35 +00:00
|
|
|
delayFocusOnLabel = new QLabel(i18n("Delay focus by:"), this);
|
2011-01-30 14:34:42 +00:00
|
|
|
delayFocusOnLabel->setAlignment(Qt::AlignVCenter | Qt::AlignRight);
|
2008-10-19 09:06:35 +00:00
|
|
|
delayFocusOnLabel->setBuddy(delayFocus);
|
|
|
|
gLay->addWidget(delayFocusOn, 3, 0);
|
|
|
|
gLay->addWidget(delayFocusOnLabel, 3, 1);
|
|
|
|
gLay->addWidget(delayFocus, 3, 2);
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2008-09-07 21:08:26 +00:00
|
|
|
clickRaiseOn = new QCheckBox(i18n("C&lick raises active window"), fcsBox);
|
2011-01-30 14:34:42 +00:00
|
|
|
connect(clickRaiseOn, SIGNAL(toggled(bool)), this, SLOT(clickRaiseOnTog(bool)));
|
2008-10-19 09:06:35 +00:00
|
|
|
gLay->addWidget(clickRaiseOn, 4, 0, 1, 3);
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
autoRaiseOn->setWhatsThis(i18n("When this option is enabled, a window in the background will automatically"
|
|
|
|
" come to the front when the mouse pointer has been over it for some time."));
|
2007-04-29 17:35:43 +00:00
|
|
|
wtstr = i18n("This is the delay after which the window that the mouse pointer is over will automatically"
|
|
|
|
" come to the front.");
|
2011-01-30 14:34:42 +00:00
|
|
|
autoRaise->setWhatsThis(wtstr);
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
clickRaiseOn->setWhatsThis(i18n("When this option is enabled, the active window will be brought to the"
|
|
|
|
" front when you click somewhere into the window contents. To change"
|
|
|
|
" it for inactive windows, you need to change the settings"
|
|
|
|
" in the Actions tab."));
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
delayFocusOn->setWhatsThis(i18n("When this option is enabled, there will be a delay after which the"
|
|
|
|
" window the mouse pointer is over will become active (receive focus)."));
|
|
|
|
delayFocus->setWhatsThis(i18n("This is the delay after which the window the mouse pointer is over"
|
|
|
|
" will automatically receive focus."));
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
separateScreenFocus = new QCheckBox(i18n("S&eparate screen focus"), fcsBox);
|
2008-10-19 09:06:35 +00:00
|
|
|
gLay->addWidget(separateScreenFocus, 5, 0, 1, 3);
|
2011-01-30 14:34:42 +00:00
|
|
|
wtstr = i18n("When this option is enabled, focus operations are limited only to the active Xinerama screen");
|
|
|
|
separateScreenFocus->setWhatsThis(wtstr);
|
2007-05-09 12:34:55 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
activeMouseScreen = new QCheckBox(i18n("Active screen follows &mouse"), fcsBox);
|
2008-10-19 09:06:35 +00:00
|
|
|
gLay->addWidget(activeMouseScreen, 6, 0, 1, 3);
|
2011-01-30 14:34:42 +00:00
|
|
|
wtstr = i18n("When this option is enabled, the active Xinerama screen (where new windows appear, for example)"
|
|
|
|
" is the screen containing the mouse pointer. When disabled, the active Xinerama screen is the "
|
|
|
|
" screen containing the focused window. By default this option is disabled for Click to focus and"
|
|
|
|
" enabled for other focus policies.");
|
|
|
|
activeMouseScreen->setWhatsThis(wtstr);
|
2007-05-09 12:34:55 +00:00
|
|
|
connect(focusCombo, SIGNAL(activated(int)), this, SLOT(updateActiveMouseScreen()));
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
if (Kephal::ScreenUtils::numScreens() == 1) { // No Ximerama
|
2007-05-09 12:34:55 +00:00
|
|
|
separateScreenFocus->hide();
|
|
|
|
activeMouseScreen->hide();
|
|
|
|
}
|
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
lay->addWidget(fcsBox);
|
|
|
|
|
|
|
|
lay->addStretch();
|
|
|
|
|
|
|
|
// Any changes goes to slotChanged()
|
|
|
|
connect(focusCombo, SIGNAL(activated(int)), SLOT(changed()));
|
2011-01-30 14:34:42 +00:00
|
|
|
connect(autoRaiseOn, SIGNAL(clicked()), SLOT(changed()));
|
2008-01-10 13:18:01 +00:00
|
|
|
connect(delayFocusOn, SIGNAL(clicked()), SLOT(changed()));
|
|
|
|
connect(clickRaiseOn, SIGNAL(clicked()), SLOT(changed()));
|
2007-04-29 17:35:43 +00:00
|
|
|
connect(autoRaise, SIGNAL(valueChanged(int)), SLOT(changed()));
|
|
|
|
connect(delayFocus, SIGNAL(valueChanged(int)), SLOT(changed()));
|
2007-05-09 12:34:55 +00:00
|
|
|
connect(separateScreenFocus, SIGNAL(clicked()), SLOT(changed()));
|
|
|
|
connect(activeMouseScreen, SIGNAL(clicked()), SLOT(changed()));
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
load();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int KFocusConfig::getFocus()
|
|
|
|
{
|
|
|
|
return focusCombo->currentIndex();
|
|
|
|
}
|
|
|
|
|
|
|
|
void KFocusConfig::setFocus(int foc)
|
|
|
|
{
|
|
|
|
focusCombo->setCurrentIndex(foc);
|
|
|
|
|
|
|
|
// this will disable/hide the auto raise delay widget if focus==click
|
2008-09-07 21:08:26 +00:00
|
|
|
focusPolicyChanged();
|
2007-04-29 17:35:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void KFocusConfig::setAutoRaiseInterval(int tb)
|
|
|
|
{
|
|
|
|
autoRaise->setValue(tb);
|
|
|
|
}
|
|
|
|
|
|
|
|
void KFocusConfig::setDelayFocusInterval(int tb)
|
|
|
|
{
|
|
|
|
delayFocus->setValue(tb);
|
|
|
|
}
|
|
|
|
|
|
|
|
int KFocusConfig::getAutoRaiseInterval()
|
|
|
|
{
|
|
|
|
return autoRaise->value();
|
|
|
|
}
|
|
|
|
|
|
|
|
int KFocusConfig::getDelayFocusInterval()
|
|
|
|
{
|
|
|
|
return delayFocus->value();
|
|
|
|
}
|
|
|
|
|
|
|
|
void KFocusConfig::setAutoRaise(bool on)
|
|
|
|
{
|
|
|
|
autoRaiseOn->setChecked(on);
|
|
|
|
}
|
|
|
|
|
|
|
|
void KFocusConfig::setDelayFocus(bool on)
|
|
|
|
{
|
|
|
|
delayFocusOn->setChecked(on);
|
|
|
|
}
|
|
|
|
|
|
|
|
void KFocusConfig::setClickRaise(bool on)
|
|
|
|
{
|
|
|
|
clickRaiseOn->setChecked(on);
|
|
|
|
}
|
|
|
|
|
2008-09-07 21:08:26 +00:00
|
|
|
void KFocusConfig::focusPolicyChanged()
|
2007-04-29 17:35:43 +00:00
|
|
|
{
|
2011-01-30 14:34:42 +00:00
|
|
|
int policyIndex = focusCombo->currentIndex();
|
2008-09-07 21:08:26 +00:00
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
// the auto raise related widgets are: autoRaise
|
2008-09-07 21:08:26 +00:00
|
|
|
autoRaiseOn->setEnabled(policyIndex != CLICK_TO_FOCUS);
|
2008-10-19 09:06:35 +00:00
|
|
|
autoRaiseOnLabel->setEnabled(policyIndex != CLICK_TO_FOCUS);
|
2008-09-07 21:08:26 +00:00
|
|
|
autoRaiseOnTog(policyIndex != CLICK_TO_FOCUS && autoRaiseOn->isChecked());
|
|
|
|
|
|
|
|
focusStealing->setDisabled(policyIndex == FOCUS_UNDER_MOUSE || policyIndex == FOCUS_STRICTLY_UNDER_MOUSE);
|
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void KFocusConfig::setDelayFocusEnabled()
|
|
|
|
{
|
2011-01-30 14:34:42 +00:00
|
|
|
int policyIndex = focusCombo->currentIndex();
|
2008-09-07 21:08:26 +00:00
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
// the delayed focus related widgets are: delayFocus
|
2008-09-07 21:08:26 +00:00
|
|
|
delayFocusOn->setEnabled(policyIndex != CLICK_TO_FOCUS);
|
2008-10-19 09:06:35 +00:00
|
|
|
delayFocusOnLabel->setEnabled(policyIndex != CLICK_TO_FOCUS);
|
2008-09-07 21:08:26 +00:00
|
|
|
delayFocusOnTog(policyIndex != CLICK_TO_FOCUS && delayFocusOn->isChecked());
|
2007-04-29 17:35:43 +00:00
|
|
|
}
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
void KFocusConfig::autoRaiseOnTog(bool a)
|
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
autoRaise->setEnabled(a);
|
2011-01-30 14:34:42 +00:00
|
|
|
clickRaiseOn->setEnabled(!a);
|
2007-04-29 17:35:43 +00:00
|
|
|
}
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
void KFocusConfig::delayFocusOnTog(bool a)
|
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
delayFocus->setEnabled(a);
|
|
|
|
}
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
void KFocusConfig::clickRaiseOnTog(bool)
|
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
}
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
void KFocusConfig::setFocusStealing(int l)
|
|
|
|
{
|
|
|
|
l = qMax(0, qMin(4, l));
|
2008-09-07 21:08:26 +00:00
|
|
|
focusStealing->setCurrentIndex(l);
|
|
|
|
}
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
void KFocusConfig::setSeparateScreenFocus(bool s)
|
|
|
|
{
|
2007-05-09 12:34:55 +00:00
|
|
|
separateScreenFocus->setChecked(s);
|
|
|
|
}
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
void KFocusConfig::setActiveMouseScreen(bool a)
|
|
|
|
{
|
2007-05-09 12:34:55 +00:00
|
|
|
activeMouseScreen->setChecked(a);
|
|
|
|
}
|
|
|
|
|
|
|
|
void KFocusConfig::updateActiveMouseScreen()
|
|
|
|
{
|
|
|
|
// on by default for non click to focus policies
|
2011-01-30 14:34:42 +00:00
|
|
|
KConfigGroup cfg(config, "Windows");
|
|
|
|
if (!cfg.hasKey(KWIN_ACTIVE_MOUSE_SCREEN))
|
|
|
|
setActiveMouseScreen(focusCombo->currentIndex() != 0);
|
2007-05-09 12:34:55 +00:00
|
|
|
}
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
void KFocusConfig::showEvent(QShowEvent *ev)
|
2009-12-14 03:18:43 +00:00
|
|
|
{
|
2011-01-30 14:34:42 +00:00
|
|
|
if (!standAlone) {
|
|
|
|
QWidget::showEvent(ev);
|
2009-12-14 03:18:43 +00:00
|
|
|
return;
|
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
KCModule::showEvent(ev);
|
2009-12-14 03:18:43 +00:00
|
|
|
}
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
void KFocusConfig::load(void)
|
2007-04-29 17:35:43 +00:00
|
|
|
{
|
|
|
|
QString key;
|
|
|
|
|
|
|
|
KConfigGroup cg(config, "Windows");
|
|
|
|
|
|
|
|
key = cg.readEntry(KWIN_FOCUS);
|
2011-01-30 14:34:42 +00:00
|
|
|
if (key == "ClickToFocus")
|
2007-04-29 17:35:43 +00:00
|
|
|
setFocus(CLICK_TO_FOCUS);
|
2011-01-30 14:34:42 +00:00
|
|
|
else if (key == "FocusFollowsMouse")
|
2007-04-29 17:35:43 +00:00
|
|
|
setFocus(FOCUS_FOLLOWS_MOUSE);
|
2011-01-30 14:34:42 +00:00
|
|
|
else if (key == "FocusUnderMouse")
|
2007-04-29 17:35:43 +00:00
|
|
|
setFocus(FOCUS_UNDER_MOUSE);
|
2011-01-30 14:34:42 +00:00
|
|
|
else if (key == "FocusStrictlyUnderMouse")
|
2007-04-29 17:35:43 +00:00
|
|
|
setFocus(FOCUS_STRICTLY_UNDER_MOUSE);
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
int k = cg.readEntry(KWIN_AUTORAISE_INTERVAL, 750);
|
2007-04-29 17:35:43 +00:00
|
|
|
setAutoRaiseInterval(k);
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
k = cg.readEntry(KWIN_DELAYFOCUS_INTERVAL, 750);
|
2007-04-29 17:35:43 +00:00
|
|
|
setDelayFocusInterval(k);
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
setAutoRaise(cg.readEntry(KWIN_AUTORAISE, false));
|
|
|
|
setDelayFocus(cg.readEntry(KWIN_DELAYFOCUS, false));
|
|
|
|
setClickRaise(cg.readEntry(KWIN_CLICKRAISE, true));
|
2008-09-07 21:08:26 +00:00
|
|
|
focusPolicyChanged(); // this will disable/hide the auto raise delay widget if focus==click
|
2007-04-29 17:35:43 +00:00
|
|
|
setDelayFocusEnabled();
|
2007-09-18 14:44:41 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
setSeparateScreenFocus(cg.readEntry(KWIN_SEPARATE_SCREEN_FOCUS, false));
|
2007-05-09 12:34:55 +00:00
|
|
|
// on by default for non click to focus policies
|
2011-01-30 14:34:42 +00:00
|
|
|
setActiveMouseScreen(cg.readEntry(KWIN_ACTIVE_MOUSE_SCREEN, focusCombo->currentIndex() != 0));
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2008-09-07 21:08:26 +00:00
|
|
|
// setFocusStealing( cg.readEntry(KWIN_FOCUS_STEALING, 2 ));
|
|
|
|
// TODO default to low for now
|
2011-01-30 14:34:42 +00:00
|
|
|
setFocusStealing(cg.readEntry(KWIN_FOCUS_STEALING, 1));
|
2008-09-07 21:08:26 +00:00
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
emit KCModule::changed(false);
|
|
|
|
}
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
void KFocusConfig::save(void)
|
2007-04-29 17:35:43 +00:00
|
|
|
{
|
|
|
|
int v;
|
|
|
|
|
|
|
|
KConfigGroup cg(config, "Windows");
|
|
|
|
|
|
|
|
v = getFocus();
|
|
|
|
if (v == CLICK_TO_FOCUS)
|
2011-01-30 14:34:42 +00:00
|
|
|
cg.writeEntry(KWIN_FOCUS, "ClickToFocus");
|
2007-04-29 17:35:43 +00:00
|
|
|
else if (v == FOCUS_UNDER_MOUSE)
|
2011-01-30 14:34:42 +00:00
|
|
|
cg.writeEntry(KWIN_FOCUS, "FocusUnderMouse");
|
2007-04-29 17:35:43 +00:00
|
|
|
else if (v == FOCUS_STRICTLY_UNDER_MOUSE)
|
2011-01-30 14:34:42 +00:00
|
|
|
cg.writeEntry(KWIN_FOCUS, "FocusStrictlyUnderMouse");
|
2007-04-29 17:35:43 +00:00
|
|
|
else
|
2011-01-30 14:34:42 +00:00
|
|
|
cg.writeEntry(KWIN_FOCUS, "FocusFollowsMouse");
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
v = getAutoRaiseInterval();
|
2011-01-30 14:34:42 +00:00
|
|
|
if (v < 0) v = 0;
|
|
|
|
cg.writeEntry(KWIN_AUTORAISE_INTERVAL, v);
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
v = getDelayFocusInterval();
|
2011-01-30 14:34:42 +00:00
|
|
|
if (v < 0) v = 0;
|
|
|
|
cg.writeEntry(KWIN_DELAYFOCUS_INTERVAL, v);
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2007-09-18 14:44:41 +00:00
|
|
|
cg.writeEntry(KWIN_AUTORAISE, autoRaiseOn->isChecked());
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2007-09-18 14:44:41 +00:00
|
|
|
cg.writeEntry(KWIN_DELAYFOCUS, delayFocusOn->isChecked());
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2007-09-18 14:44:41 +00:00
|
|
|
cg.writeEntry(KWIN_CLICKRAISE, clickRaiseOn->isChecked());
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2007-05-09 12:34:55 +00:00
|
|
|
cg.writeEntry(KWIN_SEPARATE_SCREEN_FOCUS, separateScreenFocus->isChecked());
|
|
|
|
cg.writeEntry(KWIN_ACTIVE_MOUSE_SCREEN, activeMouseScreen->isChecked());
|
|
|
|
|
2008-09-07 21:08:26 +00:00
|
|
|
cg.writeEntry(KWIN_FOCUS_STEALING, focusStealing->currentIndex());
|
|
|
|
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
if (standAlone) {
|
2007-04-29 17:35:43 +00:00
|
|
|
config->sync();
|
2011-01-30 14:34:42 +00:00
|
|
|
// Send signal to all kwin instances
|
|
|
|
QDBusMessage message =
|
|
|
|
QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig");
|
|
|
|
QDBusConnection::sessionBus().send(message);
|
2007-04-29 17:35:43 +00:00
|
|
|
}
|
|
|
|
emit KCModule::changed(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
void KFocusConfig::defaults()
|
|
|
|
{
|
|
|
|
setAutoRaiseInterval(0);
|
|
|
|
setDelayFocusInterval(0);
|
|
|
|
setFocus(CLICK_TO_FOCUS);
|
|
|
|
setAutoRaise(false);
|
|
|
|
setDelayFocus(false);
|
|
|
|
setClickRaise(true);
|
2011-01-30 14:34:42 +00:00
|
|
|
setSeparateScreenFocus(false);
|
2008-09-07 21:08:26 +00:00
|
|
|
|
|
|
|
// setFocusStealing(2);
|
|
|
|
// TODO default to low for now
|
|
|
|
setFocusStealing(1);
|
|
|
|
|
2007-05-09 12:34:55 +00:00
|
|
|
// on by default for non click to focus policies
|
2011-01-30 14:34:42 +00:00
|
|
|
setActiveMouseScreen(focusCombo->currentIndex() != 0);
|
2007-10-25 21:12:59 +00:00
|
|
|
setDelayFocusEnabled();
|
2007-04-29 17:35:43 +00:00
|
|
|
emit KCModule::changed(true);
|
|
|
|
}
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
KAdvancedConfig::~KAdvancedConfig()
|
2007-04-29 17:35:43 +00:00
|
|
|
{
|
|
|
|
if (standAlone)
|
|
|
|
delete config;
|
|
|
|
}
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
KAdvancedConfig::KAdvancedConfig(bool _standAlone, KConfig *_config, const KComponentData &inst, QWidget *parent)
|
2007-04-29 17:35:43 +00:00
|
|
|
: KCModule(inst, parent), config(_config), standAlone(_standAlone)
|
|
|
|
{
|
|
|
|
QString wtstr;
|
2008-10-19 09:35:11 +00:00
|
|
|
QLabel *label;
|
2011-01-30 14:34:42 +00:00
|
|
|
QVBoxLayout *lay = new QVBoxLayout(this);
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
//iTLabel = new QLabel(i18n(" Allowed overlap:\n"
|
|
|
|
// "(% of desktop space)"),
|
|
|
|
// plcBox);
|
|
|
|
//iTLabel->setAlignment(AlignTop|AlignHCenter);
|
|
|
|
//pLay->addWidget(iTLabel,1,1);
|
|
|
|
|
|
|
|
//interactiveTrigger = new QSpinBox(0, 500, 1, plcBox);
|
|
|
|
//pLay->addWidget(interactiveTrigger,1,2);
|
|
|
|
|
|
|
|
//pLay->addRowSpacing(2,KDialog::spacingHint());
|
|
|
|
|
|
|
|
//lay->addWidget(plcBox);
|
|
|
|
|
2008-05-12 12:13:52 +00:00
|
|
|
shBox = new KButtonGroup(this);
|
|
|
|
shBox->setTitle(i18n("Shading"));
|
2008-10-19 09:35:11 +00:00
|
|
|
QGridLayout *kLay = new QGridLayout(shBox);
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
shadeHoverOn = new QCheckBox(i18n("&Enable hover"), shBox);
|
|
|
|
|
|
|
|
connect(shadeHoverOn, SIGNAL(toggled(bool)), this, SLOT(shadeHoverChanged(bool)));
|
2008-10-19 09:35:11 +00:00
|
|
|
kLay->addWidget(shadeHoverOn, 0, 0, 1, 2);
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
shadeHover = new KIntNumInput(500, shBox);
|
2007-10-19 13:32:08 +00:00
|
|
|
shadeHover->setRange(0, 3000, 100);
|
2007-04-29 17:35:43 +00:00
|
|
|
shadeHover->setSteps(100, 100);
|
2008-01-14 19:39:12 +00:00
|
|
|
shadeHover->setSuffix(i18n(" ms"));
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
shadeHoverOn->setWhatsThis(i18n("If Shade Hover is enabled, a shaded window will un-shade automatically "
|
|
|
|
"when the mouse pointer has been over the title bar for some time."));
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
wtstr = i18n("Sets the time in milliseconds before the window unshades "
|
2011-01-30 14:34:42 +00:00
|
|
|
"when the mouse pointer goes over the shaded window.");
|
|
|
|
shadeHover->setWhatsThis(wtstr);
|
2008-10-19 09:35:11 +00:00
|
|
|
shadeHover->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
|
|
|
shadeHoverLabel = new QLabel(i18n("Dela&y:"), this);
|
2011-01-30 14:34:42 +00:00
|
|
|
shadeHoverLabel->setAlignment(Qt::AlignVCenter | Qt::AlignRight);
|
2008-10-19 09:35:11 +00:00
|
|
|
shadeHoverLabel->setBuddy(shadeHover);
|
|
|
|
kLay->addWidget(shadeHoverLabel, 1, 0);
|
|
|
|
kLay->addWidget(shadeHover, 1, 1);
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2009-02-27 15:40:53 +00:00
|
|
|
lay->addWidget(shBox);
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2009-11-17 07:51:55 +00:00
|
|
|
//----------------
|
|
|
|
// Window tabbing
|
|
|
|
|
|
|
|
wtBox = new KButtonGroup(this);
|
|
|
|
wtBox->setTitle(i18n("Window Tabbing"));
|
|
|
|
QVBoxLayout *wtLay = new QVBoxLayout(wtBox);
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
inactiveTabsSkipTaskbar = new QCheckBox(i18n("Hide inactive window tabs from the taskbar"), this);
|
|
|
|
inactiveTabsSkipTaskbar->setVisible(false); // TODO: We want translations in case this is fixed...
|
2009-11-17 11:25:03 +00:00
|
|
|
inactiveTabsSkipTaskbar->setWhatsThis(
|
2011-01-30 14:34:42 +00:00
|
|
|
i18n("When turned on hide all tabs that are not active from the taskbar."));
|
2009-11-17 11:25:03 +00:00
|
|
|
connect(inactiveTabsSkipTaskbar, SIGNAL(toggled(bool)), SLOT(changed()));
|
2011-01-30 14:34:42 +00:00
|
|
|
wtLay->addWidget(inactiveTabsSkipTaskbar);
|
2009-11-17 11:25:03 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
autogroupSimilarWindows = new QCheckBox(i18n("Automatically group similar windows"), this);
|
2009-11-17 07:51:55 +00:00
|
|
|
autogroupSimilarWindows->setWhatsThis(
|
2011-01-30 14:34:42 +00:00
|
|
|
i18n("When turned on attempt to automatically detect when a newly opened window is related"
|
|
|
|
" to an existing one and place them in the same window group."));
|
2009-11-17 07:51:55 +00:00
|
|
|
connect(autogroupSimilarWindows, SIGNAL(toggled(bool)), SLOT(changed()));
|
2011-01-30 14:34:42 +00:00
|
|
|
wtLay->addWidget(autogroupSimilarWindows);
|
2009-11-17 07:51:55 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
autogroupInForeground = new QCheckBox(i18n("Switch to automatically grouped windows immediately"), this);
|
2009-11-17 07:51:55 +00:00
|
|
|
autogroupInForeground->setWhatsThis(
|
2011-01-30 14:34:42 +00:00
|
|
|
i18n("When turned on immediately switch to any new window tabs that were automatically added"
|
|
|
|
" to the current group."));
|
2009-11-17 07:51:55 +00:00
|
|
|
connect(autogroupInForeground, SIGNAL(toggled(bool)), SLOT(changed()));
|
2011-01-30 14:34:42 +00:00
|
|
|
wtLay->addWidget(autogroupInForeground);
|
2009-11-17 07:51:55 +00:00
|
|
|
|
|
|
|
lay->addWidget(wtBox);
|
|
|
|
|
|
|
|
//----------------
|
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
// Any changes goes to slotChanged()
|
|
|
|
connect(shadeHoverOn, SIGNAL(toggled(bool)), SLOT(changed()));
|
|
|
|
connect(shadeHover, SIGNAL(valueChanged(int)), SLOT(changed()));
|
|
|
|
|
2008-10-19 09:35:11 +00:00
|
|
|
QGridLayout *vLay = new QGridLayout();
|
2011-01-30 14:34:42 +00:00
|
|
|
lay->addLayout(vLay);
|
2008-09-07 21:08:26 +00:00
|
|
|
|
2009-10-30 08:10:35 +00:00
|
|
|
placementCombo = new KComboBox(this);
|
2011-01-30 14:34:42 +00:00
|
|
|
placementCombo->setEditable(false);
|
2008-09-07 21:08:26 +00:00
|
|
|
placementCombo->addItem(i18n("Smart"), SMART_PLACEMENT);
|
|
|
|
placementCombo->addItem(i18n("Maximizing"), MAXIMIZING_PLACEMENT);
|
|
|
|
placementCombo->addItem(i18n("Cascade"), CASCADE_PLACEMENT);
|
|
|
|
placementCombo->addItem(i18n("Random"), RANDOM_PLACEMENT);
|
|
|
|
placementCombo->addItem(i18n("Centered"), CENTERED_PLACEMENT);
|
|
|
|
placementCombo->addItem(i18n("Zero-Cornered"), ZEROCORNERED_PLACEMENT);
|
|
|
|
// CT: disabling is needed as long as functionality misses in kwin
|
|
|
|
//placementCombo->addItem(i18n("Interactive"), INTERACTIVE_PLACEMENT);
|
|
|
|
//placementCombo->addItem(i18n("Manual"), MANUAL_PLACEMENT);
|
|
|
|
placementCombo->setCurrentIndex(SMART_PLACEMENT);
|
|
|
|
|
|
|
|
// FIXME, when more policies have been added to KWin
|
|
|
|
wtstr = i18n("The placement policy determines where a new window"
|
|
|
|
" will appear on the desktop."
|
|
|
|
" <ul>"
|
|
|
|
" <li><em>Smart</em> will try to achieve a minimum overlap of windows</li>"
|
|
|
|
" <li><em>Maximizing</em> will try to maximize every window to fill the whole screen."
|
|
|
|
" It might be useful to selectively affect placement of some windows using"
|
|
|
|
" the window-specific settings.</li>"
|
|
|
|
" <li><em>Cascade</em> will cascade the windows</li>"
|
|
|
|
" <li><em>Random</em> will use a random position</li>"
|
|
|
|
" <li><em>Centered</em> will place the window centered</li>"
|
|
|
|
" <li><em>Zero-Cornered</em> will place the window in the top-left corner</li>"
|
|
|
|
"</ul>") ;
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
placementCombo->setWhatsThis(wtstr);
|
2008-09-07 21:08:26 +00:00
|
|
|
|
2008-10-19 09:35:11 +00:00
|
|
|
placementCombo->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
|
|
|
label = new QLabel(i18n("&Placement:"), this);
|
2011-01-30 14:34:42 +00:00
|
|
|
label->setAlignment(Qt::AlignVCenter | Qt::AlignRight);
|
2008-10-19 09:35:11 +00:00
|
|
|
label->setBuddy(placementCombo);
|
|
|
|
vLay->addWidget(label, 0, 0);
|
|
|
|
vLay->addWidget(placementCombo, 0, 1);
|
2008-09-07 21:08:26 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
connect(placementCombo, SIGNAL(activated(int)), SLOT(changed()));
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
hideUtilityWindowsForInactive = new QCheckBox(i18n("Hide utility windows for inactive applications"), this);
|
2007-04-29 17:35:43 +00:00
|
|
|
hideUtilityWindowsForInactive->setWhatsThis(
|
2011-01-30 14:34:42 +00:00
|
|
|
i18n("When turned on, utility windows (tool windows, torn-off menus,...) of inactive applications will be"
|
|
|
|
" hidden and will be shown only when the application becomes active. Note that applications"
|
|
|
|
" have to mark the windows with the proper window type for this feature to work."));
|
2007-04-29 17:35:43 +00:00
|
|
|
connect(hideUtilityWindowsForInactive, SIGNAL(toggled(bool)), SLOT(changed()));
|
2011-01-30 14:34:42 +00:00
|
|
|
vLay->addWidget(hideUtilityWindowsForInactive, 1, 0, 1, 2);
|
2008-09-07 21:08:26 +00:00
|
|
|
|
2010-04-25 16:43:14 +00:00
|
|
|
tilBox = new KButtonGroup(this);
|
|
|
|
tilBox->setTitle(i18n("Tiling"));
|
|
|
|
QGridLayout *tilBoxLay = new QGridLayout(tilBox);
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
tilingOn = new QCheckBox(i18n("Enable Tiling"), tilBox);
|
2010-04-25 16:43:14 +00:00
|
|
|
tilingOn->setWhatsThis(
|
2011-01-30 14:34:42 +00:00
|
|
|
i18n("A tiling window manager lays out all the windows in a non-overlapping manner."
|
|
|
|
" This way all windows are always visible."));
|
|
|
|
tilBoxLay->addWidget(tilingOn);
|
|
|
|
connect(tilingOn, SIGNAL(toggled(bool)), SLOT(tilingOnChanged(bool)));
|
|
|
|
connect(tilingOn, SIGNAL(toggled(bool)), SLOT(changed()));
|
2010-04-25 16:43:14 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
tilingLayoutLabel = new QLabel(i18n("Default Tiling &Layout"), tilBox);
|
|
|
|
tilBoxLay->addWidget(tilingLayoutLabel, 1, 0);
|
2010-04-25 16:43:14 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
tilingLayoutCombo = new KComboBox(tilBox);
|
2010-04-25 16:43:14 +00:00
|
|
|
|
|
|
|
// NOTE: add your layout to the bottom of this list
|
2011-01-30 14:34:42 +00:00
|
|
|
tilingLayoutCombo->addItem(i18nc("Spiral tiling layout", "Spiral"));
|
|
|
|
tilingLayoutCombo->addItem(i18nc("Two-column horizontal tiling layout", "Columns"));
|
|
|
|
tilingLayoutCombo->addItem(i18nc("Floating layout, windows aren't tiled at all", "Floating"));
|
2010-04-25 16:43:14 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
tilingLayoutLabel->setBuddy(tilingLayoutCombo);
|
|
|
|
connect(tilingLayoutCombo, SIGNAL(activated(int)), SLOT(changed()));
|
|
|
|
tilBoxLay->addWidget(tilingLayoutCombo, 1, 1);
|
2010-04-25 16:43:14 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
tilingRaiseLabel = new QLabel(i18n("Floating &Windows Raising"), tilBox);
|
|
|
|
tilBoxLay->addWidget(tilingRaiseLabel, 2, 0);
|
2010-04-25 16:43:14 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
tilingRaiseCombo = new KComboBox(tilBox);
|
2010-05-09 06:15:40 +00:00
|
|
|
// when a floating window is activated, all other floating
|
|
|
|
// windows are also brought to the front, above the tiled windows
|
|
|
|
// when a tiled window is focused, all floating windows go to the back.
|
|
|
|
// NOTE: If the user has explicitly set a client to "keep above others", that will be respected.
|
2011-01-30 14:34:42 +00:00
|
|
|
tilingRaiseCombo->addItem(i18nc("Window Raising Policy", "Raise/Lower all floating windows"));
|
|
|
|
tilingRaiseCombo->addItem(i18nc("Window Raising Policy", "Raise/Lower current window only"));
|
|
|
|
tilingRaiseCombo->addItem(i18nc("Window Raising Policy", "Floating windows are always on top"));
|
2010-04-25 16:43:14 +00:00
|
|
|
wtstr = i18n("The window raising policy determines how floating windows are stacked"
|
|
|
|
" <ul>"
|
|
|
|
" <li><em>Raise/Lower all</em> will raise all floating windows when a"
|
|
|
|
" floating window is activated.</li>"
|
|
|
|
" <li><em>Raise/Lower current</em> will raise only the current window.</li>"
|
|
|
|
" <li><em>Floating windows on top</em> will always keep floating windows on top, even"
|
|
|
|
" when a tiled window is activated."
|
|
|
|
"</ul>") ;
|
2011-01-30 14:34:42 +00:00
|
|
|
tilingRaiseCombo->setWhatsThis(wtstr);
|
|
|
|
connect(tilingRaiseCombo, SIGNAL(activated(int)), SLOT(changed()));
|
|
|
|
tilingRaiseLabel->setBuddy(tilingRaiseCombo);
|
|
|
|
tilBoxLay->addWidget(tilingRaiseCombo, 2, 1);
|
2010-04-25 16:43:14 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
lay->addWidget(tilBox);
|
2010-04-25 16:43:14 +00:00
|
|
|
|
2009-02-27 15:40:53 +00:00
|
|
|
lay->addStretch();
|
2007-04-29 17:35:43 +00:00
|
|
|
load();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
void KAdvancedConfig::setShadeHover(bool on)
|
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
shadeHoverOn->setChecked(on);
|
2008-10-19 09:35:11 +00:00
|
|
|
shadeHoverLabel->setEnabled(on);
|
2007-04-29 17:35:43 +00:00
|
|
|
shadeHover->setEnabled(on);
|
|
|
|
}
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
void KAdvancedConfig::setShadeHoverInterval(int k)
|
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
shadeHover->setValue(k);
|
|
|
|
}
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
int KAdvancedConfig::getShadeHoverInterval()
|
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
return shadeHover->value();
|
|
|
|
}
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
void KAdvancedConfig::shadeHoverChanged(bool a)
|
|
|
|
{
|
2008-10-19 09:35:11 +00:00
|
|
|
shadeHoverLabel->setEnabled(a);
|
2007-04-29 17:35:43 +00:00
|
|
|
shadeHover->setEnabled(a);
|
|
|
|
}
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
void KAdvancedConfig::setTilingOn(bool on)
|
|
|
|
{
|
|
|
|
tilingOn->setChecked(on);
|
|
|
|
tilingLayoutLabel->setEnabled(on);
|
|
|
|
tilingLayoutCombo->setEnabled(on);
|
|
|
|
tilingRaiseLabel->setEnabled(on);
|
|
|
|
tilingRaiseCombo->setEnabled(on);
|
2010-04-25 16:43:14 +00:00
|
|
|
}
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
void KAdvancedConfig::setTilingLayout(int l)
|
|
|
|
{
|
|
|
|
tilingLayoutCombo->setCurrentIndex(l);
|
2010-04-25 16:43:14 +00:00
|
|
|
}
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
void KAdvancedConfig::setTilingRaisePolicy(int l)
|
|
|
|
{
|
|
|
|
tilingRaiseCombo->setCurrentIndex(l);
|
2010-04-25 16:43:14 +00:00
|
|
|
}
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
void KAdvancedConfig::tilingOnChanged(bool a)
|
|
|
|
{
|
|
|
|
tilingLayoutLabel->setEnabled(a);
|
|
|
|
tilingLayoutCombo->setEnabled(a);
|
|
|
|
tilingRaiseLabel->setEnabled(a);
|
|
|
|
tilingRaiseCombo->setEnabled(a);
|
2010-04-25 16:43:14 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
void KAdvancedConfig::showEvent(QShowEvent *ev)
|
2009-12-14 03:18:43 +00:00
|
|
|
{
|
2011-01-30 14:34:42 +00:00
|
|
|
if (!standAlone) {
|
|
|
|
QWidget::showEvent(ev);
|
2009-12-14 03:18:43 +00:00
|
|
|
return;
|
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
KCModule::showEvent(ev);
|
2009-12-14 03:18:43 +00:00
|
|
|
}
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
void KAdvancedConfig::load(void)
|
2007-04-29 17:35:43 +00:00
|
|
|
{
|
|
|
|
KConfigGroup cg(config, "Windows");
|
|
|
|
|
|
|
|
setShadeHover(cg.readEntry(KWIN_SHADEHOVER, false));
|
|
|
|
setShadeHoverInterval(cg.readEntry(KWIN_SHADEHOVER_INTERVAL, 250));
|
|
|
|
|
2008-09-07 21:08:26 +00:00
|
|
|
QString key;
|
|
|
|
// placement policy --- CT 19jan98 ---
|
|
|
|
key = cg.readEntry(KWIN_PLACEMENT);
|
|
|
|
//CT 13mar98 interactive placement
|
2011-01-30 14:34:42 +00:00
|
|
|
// if ( key.left(11) == "interactive") {
|
2008-09-07 21:08:26 +00:00
|
|
|
// setPlacement(INTERACTIVE_PLACEMENT);
|
|
|
|
// int comma_pos = key.find(',');
|
|
|
|
// if (comma_pos < 0)
|
|
|
|
// interactiveTrigger->setValue(0);
|
|
|
|
// else
|
|
|
|
// interactiveTrigger->setValue (key.right(key.length()
|
|
|
|
// - comma_pos).toUInt(0));
|
|
|
|
// iTLabel->setEnabled(true);
|
|
|
|
// interactiveTrigger->show();
|
|
|
|
// }
|
|
|
|
// else {
|
|
|
|
// interactiveTrigger->setValue(0);
|
|
|
|
// iTLabel->setEnabled(false);
|
|
|
|
// interactiveTrigger->hide();
|
2011-01-30 14:34:42 +00:00
|
|
|
if (key == "Random")
|
2008-09-07 21:08:26 +00:00
|
|
|
setPlacement(RANDOM_PLACEMENT);
|
2011-01-30 14:34:42 +00:00
|
|
|
else if (key == "Cascade")
|
2008-09-07 21:08:26 +00:00
|
|
|
setPlacement(CASCADE_PLACEMENT); //CT 31jan98
|
|
|
|
//CT 31mar98 manual placement
|
2011-01-30 14:34:42 +00:00
|
|
|
else if (key == "manual")
|
2008-09-07 21:08:26 +00:00
|
|
|
setPlacement(MANUAL_PLACEMENT);
|
2011-01-30 14:34:42 +00:00
|
|
|
else if (key == "Centered")
|
2008-09-07 21:08:26 +00:00
|
|
|
setPlacement(CENTERED_PLACEMENT);
|
2011-01-30 14:34:42 +00:00
|
|
|
else if (key == "ZeroCornered")
|
2008-09-07 21:08:26 +00:00
|
|
|
setPlacement(ZEROCORNERED_PLACEMENT);
|
2011-01-30 14:34:42 +00:00
|
|
|
else if (key == "Maximizing")
|
2008-09-07 21:08:26 +00:00
|
|
|
setPlacement(MAXIMIZING_PLACEMENT);
|
|
|
|
else
|
|
|
|
setPlacement(SMART_PLACEMENT);
|
|
|
|
// }
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
setHideUtilityWindowsForInactive(cg.readEntry(KWIN_HIDE_UTILITY, true));
|
|
|
|
setInactiveTabsSkipTaskbar(cg.readEntry(KWIN_INACTIVE_SKIP_TASKBAR, false));
|
|
|
|
setAutogroupSimilarWindows(cg.readEntry(KWIN_AUTOGROUP_SIMILAR, false));
|
|
|
|
setAutogroupInForeground(cg.readEntry(KWIN_AUTOGROUP_FOREGROUND, true));
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
setTilingOn(cg.readEntry(KWIN_TILINGON, false));
|
|
|
|
setTilingLayout(cg.readEntry(KWIN_TILING_DEFAULT_LAYOUT, 0));
|
|
|
|
setTilingRaisePolicy(cg.readEntry(KWIN_TILING_RAISE_POLICY, 0));
|
2010-04-25 16:43:14 +00:00
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
emit KCModule::changed(false);
|
|
|
|
}
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
void KAdvancedConfig::save(void)
|
2007-04-29 17:35:43 +00:00
|
|
|
{
|
|
|
|
int v;
|
|
|
|
|
|
|
|
KConfigGroup cg(config, "Windows");
|
2007-09-18 14:44:41 +00:00
|
|
|
cg.writeEntry(KWIN_SHADEHOVER, shadeHoverOn->isChecked());
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
v = getShadeHoverInterval();
|
2011-01-30 14:34:42 +00:00
|
|
|
if (v < 0) v = 0;
|
2007-04-29 17:35:43 +00:00
|
|
|
cg.writeEntry(KWIN_SHADEHOVER_INTERVAL, v);
|
|
|
|
|
2008-09-07 21:08:26 +00:00
|
|
|
// placement policy --- CT 31jan98 ---
|
2011-01-30 14:34:42 +00:00
|
|
|
v = getPlacement();
|
2008-09-07 21:08:26 +00:00
|
|
|
if (v == RANDOM_PLACEMENT)
|
|
|
|
cg.writeEntry(KWIN_PLACEMENT, "Random");
|
|
|
|
else if (v == CASCADE_PLACEMENT)
|
|
|
|
cg.writeEntry(KWIN_PLACEMENT, "Cascade");
|
|
|
|
else if (v == CENTERED_PLACEMENT)
|
|
|
|
cg.writeEntry(KWIN_PLACEMENT, "Centered");
|
|
|
|
else if (v == ZEROCORNERED_PLACEMENT)
|
|
|
|
cg.writeEntry(KWIN_PLACEMENT, "ZeroCornered");
|
|
|
|
else if (v == MAXIMIZING_PLACEMENT)
|
|
|
|
cg.writeEntry(KWIN_PLACEMENT, "Maximizing");
|
|
|
|
//CT 13mar98 manual and interactive placement
|
|
|
|
// else if (v == MANUAL_PLACEMENT)
|
|
|
|
// cg.writeEntry(KWIN_PLACEMENT, "Manual");
|
|
|
|
// else if (v == INTERACTIVE_PLACEMENT) {
|
|
|
|
// QString tmpstr = QString("Interactive,%1").arg(interactiveTrigger->value());
|
|
|
|
// cg.writeEntry(KWIN_PLACEMENT, tmpstr);
|
|
|
|
// }
|
|
|
|
else
|
|
|
|
cg.writeEntry(KWIN_PLACEMENT, "Smart");
|
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
cg.writeEntry(KWIN_HIDE_UTILITY, hideUtilityWindowsForInactive->isChecked());
|
2009-11-17 11:25:03 +00:00
|
|
|
cg.writeEntry(KWIN_INACTIVE_SKIP_TASKBAR, inactiveTabsSkipTaskbar->isChecked());
|
2009-11-16 10:09:03 +00:00
|
|
|
cg.writeEntry(KWIN_AUTOGROUP_SIMILAR, autogroupSimilarWindows->isChecked());
|
2009-11-17 07:51:55 +00:00
|
|
|
cg.writeEntry(KWIN_AUTOGROUP_FOREGROUND, autogroupInForeground->isChecked());
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
if (standAlone) {
|
2007-04-29 17:35:43 +00:00
|
|
|
config->sync();
|
2011-01-30 14:34:42 +00:00
|
|
|
// Send signal to all kwin instances
|
|
|
|
QDBusMessage message =
|
|
|
|
QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig");
|
|
|
|
QDBusConnection::sessionBus().send(message);
|
2007-04-30 11:32:47 +00:00
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
}
|
2010-04-25 16:43:14 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
cg.writeEntry(KWIN_TILINGON, tilingOn->isChecked());
|
|
|
|
cg.writeEntry(KWIN_TILING_DEFAULT_LAYOUT, tilingLayoutCombo->currentIndex());
|
|
|
|
cg.writeEntry(KWIN_TILING_RAISE_POLICY, tilingRaiseCombo->currentIndex());
|
2007-04-29 17:35:43 +00:00
|
|
|
emit KCModule::changed(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
void KAdvancedConfig::defaults()
|
|
|
|
{
|
|
|
|
setShadeHover(false);
|
|
|
|
setShadeHoverInterval(250);
|
2008-09-07 21:08:26 +00:00
|
|
|
setPlacement(SMART_PLACEMENT);
|
2011-01-30 14:34:42 +00:00
|
|
|
setHideUtilityWindowsForInactive(true);
|
|
|
|
setTilingOn(false);
|
|
|
|
setTilingLayout(0);
|
|
|
|
setTilingRaisePolicy(0);
|
|
|
|
setInactiveTabsSkipTaskbar(false);
|
|
|
|
setAutogroupSimilarWindows(false);
|
|
|
|
setAutogroupInForeground(true);
|
2007-04-29 17:35:43 +00:00
|
|
|
emit KCModule::changed(true);
|
|
|
|
}
|
|
|
|
|
2008-09-07 21:08:26 +00:00
|
|
|
// placement policy --- CT 31jan98 ---
|
|
|
|
int KAdvancedConfig::getPlacement()
|
|
|
|
{
|
|
|
|
return placementCombo->currentIndex();
|
|
|
|
}
|
|
|
|
|
|
|
|
void KAdvancedConfig::setPlacement(int plac)
|
|
|
|
{
|
|
|
|
placementCombo->setCurrentIndex(plac);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
void KAdvancedConfig::setHideUtilityWindowsForInactive(bool s)
|
|
|
|
{
|
|
|
|
hideUtilityWindowsForInactive->setChecked(s);
|
2008-09-07 21:08:26 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
void KAdvancedConfig::setInactiveTabsSkipTaskbar(bool s)
|
|
|
|
{
|
|
|
|
inactiveTabsSkipTaskbar->setChecked(s);
|
2009-11-17 11:25:03 +00:00
|
|
|
}
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
void KAdvancedConfig::setAutogroupSimilarWindows(bool s)
|
|
|
|
{
|
|
|
|
autogroupSimilarWindows->setChecked(s);
|
2009-11-16 10:09:03 +00:00
|
|
|
}
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
void KAdvancedConfig::setAutogroupInForeground(bool s)
|
|
|
|
{
|
|
|
|
autogroupInForeground->setChecked(s);
|
2009-11-17 07:51:55 +00:00
|
|
|
}
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
KMovingConfig::~KMovingConfig()
|
2007-04-29 17:35:43 +00:00
|
|
|
{
|
|
|
|
if (standAlone)
|
|
|
|
delete config;
|
|
|
|
}
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
KMovingConfig::KMovingConfig(bool _standAlone, KConfig *_config, const KComponentData &inst, QWidget *parent)
|
2007-04-29 17:35:43 +00:00
|
|
|
: KCModule(inst, parent), config(_config), standAlone(_standAlone)
|
|
|
|
{
|
|
|
|
QString wtstr;
|
2011-01-30 14:34:42 +00:00
|
|
|
QBoxLayout *lay = new QVBoxLayout(this);
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2008-05-12 12:13:52 +00:00
|
|
|
windowsBox = new KButtonGroup(this);
|
|
|
|
windowsBox->setTitle(i18n("Windows"));
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
QBoxLayout *wLay = new QVBoxLayout(windowsBox);
|
2007-09-01 21:20:46 +00:00
|
|
|
|
|
|
|
QBoxLayout *bLay = new QVBoxLayout;
|
|
|
|
wLay->addLayout(bLay);
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
geometryTipOn = new QCheckBox(i18n("Display window &geometry when moving or resizing"), windowsBox);
|
2007-09-01 21:20:46 +00:00
|
|
|
bLay->addWidget(geometryTipOn);
|
2011-01-30 14:34:42 +00:00
|
|
|
geometryTipOn->setWhatsThis(i18n("Enable this option if you want a window's geometry to be displayed"
|
|
|
|
" while it is being moved or resized. The window position relative"
|
|
|
|
" to the top-left corner of the screen is displayed together with"
|
|
|
|
" its size."));
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
moveResizeMaximized = new QCheckBox(i18n("Display borders on &maximized windows"), windowsBox);
|
2007-09-01 21:20:46 +00:00
|
|
|
bLay->addWidget(moveResizeMaximized);
|
2011-01-30 14:34:42 +00:00
|
|
|
moveResizeMaximized->setWhatsThis(i18n("When enabled, this feature activates the border of maximized windows"
|
|
|
|
" and allows you to move or resize them,"
|
|
|
|
" just like for normal windows"));
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
lay->addWidget(windowsBox);
|
|
|
|
|
|
|
|
//iTLabel = new QLabel(i18n(" Allowed overlap:\n"
|
|
|
|
// "(% of desktop space)"),
|
|
|
|
// plcBox);
|
|
|
|
//iTLabel->setAlignment(AlignTop|AlignHCenter);
|
|
|
|
//pLay->addWidget(iTLabel,1,1);
|
|
|
|
|
|
|
|
//interactiveTrigger = new QSpinBox(0, 500, 1, plcBox);
|
|
|
|
//pLay->addWidget(interactiveTrigger,1,2);
|
|
|
|
|
|
|
|
//pLay->addRowSpacing(2,KDialog::spacingHint());
|
|
|
|
|
|
|
|
//lay->addWidget(plcBox);
|
|
|
|
|
|
|
|
|
2008-08-25 02:22:56 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
//CT 15mar98 - add EdgeResistance, BorderAttractor, WindowsAttractor config
|
2008-05-12 12:13:52 +00:00
|
|
|
MagicBox = new KButtonGroup(this);
|
|
|
|
MagicBox->setTitle(i18n("Snap Zones"));
|
2008-10-19 09:06:35 +00:00
|
|
|
QGridLayout *kLay = new QGridLayout(MagicBox);
|
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
BrdrSnap = new KIntNumInput(10, MagicBox);
|
2011-01-30 14:34:42 +00:00
|
|
|
BrdrSnap->setSpecialValueText(i18nc("no border snap zone", "none"));
|
|
|
|
BrdrSnap->setRange(0, MAX_BRDR_SNAP);
|
|
|
|
BrdrSnap->setSteps(1, 10);
|
|
|
|
BrdrSnap->setWhatsThis(i18n("Here you can set the snap zone for screen borders, i.e."
|
|
|
|
" the 'strength' of the magnetic field which will make windows snap to the border when"
|
|
|
|
" moved near it."));
|
2008-10-19 09:35:11 +00:00
|
|
|
BrdrSnap->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
2008-10-19 09:06:35 +00:00
|
|
|
BrdrSnapLabel = new QLabel(i18n("&Border snap zone:"), this);
|
2011-01-30 14:34:42 +00:00
|
|
|
BrdrSnapLabel->setAlignment(Qt::AlignVCenter | Qt::AlignRight);
|
2008-10-19 09:06:35 +00:00
|
|
|
BrdrSnapLabel->setBuddy(BrdrSnap);
|
|
|
|
kLay->addWidget(BrdrSnapLabel, 0, 0);
|
|
|
|
kLay->addWidget(BrdrSnap, 0, 1);
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
WndwSnap = new KIntNumInput(10, MagicBox);
|
2011-01-30 14:34:42 +00:00
|
|
|
WndwSnap->setSpecialValueText(i18nc("no window snap zone", "none"));
|
|
|
|
WndwSnap->setRange(0, MAX_WNDW_SNAP);
|
|
|
|
WndwSnap->setSteps(1, 10);
|
|
|
|
WndwSnap->setWhatsThis(i18n("Here you can set the snap zone for windows, i.e."
|
|
|
|
" the 'strength' of the magnetic field which will make windows snap to each other when"
|
|
|
|
" they are moved near another window."));
|
2008-10-19 09:35:11 +00:00
|
|
|
BrdrSnap->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
2008-10-19 09:06:35 +00:00
|
|
|
WndwSnapLabel = new QLabel(i18n("&Window snap zone:"), this);
|
2011-01-30 14:34:42 +00:00
|
|
|
WndwSnapLabel->setAlignment(Qt::AlignVCenter | Qt::AlignRight);
|
2008-10-19 09:06:35 +00:00
|
|
|
WndwSnapLabel->setBuddy(WndwSnap);
|
|
|
|
kLay->addWidget(WndwSnapLabel, 1, 0);
|
|
|
|
kLay->addWidget(WndwSnap, 1, 1);
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2008-07-09 15:18:47 +00:00
|
|
|
CntrSnap = new KIntNumInput(10, MagicBox);
|
2011-01-30 14:34:42 +00:00
|
|
|
CntrSnap->setSpecialValueText(i18nc("no center snap zone", "none"));
|
|
|
|
CntrSnap->setRange(0, MAX_CNTR_SNAP);
|
|
|
|
CntrSnap->setSteps(1, 10);
|
|
|
|
CntrSnap->setWhatsThis(i18n("Here you can set the snap zone for the screen center, i.e."
|
|
|
|
" the 'strength' of the magnetic field which will make windows snap to the center of"
|
|
|
|
" the screen when moved near it."));
|
2008-10-19 09:35:11 +00:00
|
|
|
BrdrSnap->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
2008-10-19 09:06:35 +00:00
|
|
|
CntrSnapLabel = new QLabel(i18n("&Center snap zone:"), this);
|
2011-01-30 14:34:42 +00:00
|
|
|
CntrSnapLabel->setAlignment(Qt::AlignVCenter | Qt::AlignRight);
|
2008-10-19 09:06:35 +00:00
|
|
|
CntrSnapLabel->setBuddy(CntrSnap);
|
|
|
|
kLay->addWidget(CntrSnapLabel, 2, 0);
|
|
|
|
kLay->addWidget(CntrSnap, 2, 1);
|
2008-07-09 15:18:47 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
OverlapSnap = new QCheckBox(i18n("Snap windows onl&y when overlapping"), MagicBox);
|
|
|
|
OverlapSnap->setWhatsThis(i18n("Here you can set that windows will be only"
|
|
|
|
" snapped if you try to overlap them, i.e. they will not be snapped if the windows"
|
|
|
|
" comes only near another window or border."));
|
2008-10-19 09:06:35 +00:00
|
|
|
kLay->addWidget(OverlapSnap, 3, 0, 1, 2);
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
lay->addWidget(MagicBox);
|
|
|
|
lay->addStretch();
|
|
|
|
|
|
|
|
load();
|
|
|
|
|
|
|
|
// Any changes goes to slotChanged()
|
2011-01-30 14:34:42 +00:00
|
|
|
connect(geometryTipOn, SIGNAL(clicked()), SLOT(changed()));
|
|
|
|
connect(moveResizeMaximized, SIGNAL(toggled(bool)), SLOT(changed()));
|
|
|
|
connect(BrdrSnap, SIGNAL(valueChanged(int)), SLOT(changed()));
|
|
|
|
connect(BrdrSnap, SIGNAL(valueChanged(int)), SLOT(slotBrdrSnapChanged(int)));
|
|
|
|
connect(WndwSnap, SIGNAL(valueChanged(int)), SLOT(changed()));
|
|
|
|
connect(WndwSnap, SIGNAL(valueChanged(int)), SLOT(slotWndwSnapChanged(int)));
|
|
|
|
connect(CntrSnap, SIGNAL(valueChanged(int)), SLOT(changed()));
|
|
|
|
connect(CntrSnap, SIGNAL(valueChanged(int)), SLOT(slotCntrSnapChanged(int)));
|
|
|
|
connect(OverlapSnap, SIGNAL(clicked()), SLOT(changed()));
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2008-07-09 15:18:47 +00:00
|
|
|
// To get suffix to BrdrSnap, WndwSnap and CntrSnap inputs with default values.
|
2007-04-29 17:35:43 +00:00
|
|
|
slotBrdrSnapChanged(BrdrSnap->value());
|
|
|
|
slotWndwSnapChanged(WndwSnap->value());
|
2008-07-09 15:18:47 +00:00
|
|
|
slotCntrSnapChanged(CntrSnap->value());
|
2007-04-29 17:35:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void KMovingConfig::setGeometryTip(bool showGeometryTip)
|
|
|
|
{
|
|
|
|
geometryTipOn->setChecked(showGeometryTip);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool KMovingConfig::getGeometryTip()
|
|
|
|
{
|
|
|
|
return geometryTipOn->isChecked();
|
|
|
|
}
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
void KMovingConfig::setMoveResizeMaximized(bool a)
|
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
moveResizeMaximized->setChecked(a);
|
|
|
|
}
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
void KMovingConfig::slotBrdrSnapChanged(int value)
|
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
BrdrSnap->setSuffix(i18np(" pixel", " pixels", value));
|
|
|
|
}
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
void KMovingConfig::slotWndwSnapChanged(int value)
|
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
WndwSnap->setSuffix(i18np(" pixel", " pixels", value));
|
|
|
|
}
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
void KMovingConfig::slotCntrSnapChanged(int value)
|
|
|
|
{
|
2008-07-09 15:18:47 +00:00
|
|
|
CntrSnap->setSuffix(i18np(" pixel", " pixels", value));
|
|
|
|
}
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
void KMovingConfig::showEvent(QShowEvent *ev)
|
2009-12-14 03:18:43 +00:00
|
|
|
{
|
2011-01-30 14:34:42 +00:00
|
|
|
if (!standAlone) {
|
|
|
|
QWidget::showEvent(ev);
|
2009-12-14 03:18:43 +00:00
|
|
|
return;
|
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
KCModule::showEvent(ev);
|
2009-12-14 03:18:43 +00:00
|
|
|
}
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
void KMovingConfig::load(void)
|
2007-04-29 17:35:43 +00:00
|
|
|
{
|
|
|
|
QString key;
|
|
|
|
|
|
|
|
KConfigGroup cg(config, "Windows");
|
|
|
|
|
|
|
|
//KS 10Jan2003 - Geometry Tip during window move/resize
|
|
|
|
bool showGeomTip = cg.readEntry(KWIN_GEOMETRY, false);
|
2011-01-30 14:34:42 +00:00
|
|
|
setGeometryTip(showGeomTip);
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
setMoveResizeMaximized(cg.readEntry(KWIN_MOVE_RESIZE_MAXIMIZED, false));
|
|
|
|
|
|
|
|
int v;
|
|
|
|
|
|
|
|
v = cg.readEntry(KWM_BRDR_SNAP_ZONE, KWM_BRDR_SNAP_ZONE_DEFAULT);
|
|
|
|
if (v > MAX_BRDR_SNAP) setBorderSnapZone(MAX_BRDR_SNAP);
|
2011-01-30 14:34:42 +00:00
|
|
|
else if (v < 0) setBorderSnapZone(0);
|
2007-04-29 17:35:43 +00:00
|
|
|
else setBorderSnapZone(v);
|
|
|
|
|
|
|
|
v = cg.readEntry(KWM_WNDW_SNAP_ZONE, KWM_WNDW_SNAP_ZONE_DEFAULT);
|
|
|
|
if (v > MAX_WNDW_SNAP) setWindowSnapZone(MAX_WNDW_SNAP);
|
2011-01-30 14:34:42 +00:00
|
|
|
else if (v < 0) setWindowSnapZone(0);
|
2007-04-29 17:35:43 +00:00
|
|
|
else setWindowSnapZone(v);
|
|
|
|
|
2008-07-09 15:18:47 +00:00
|
|
|
v = cg.readEntry(KWM_CNTR_SNAP_ZONE, KWM_CNTR_SNAP_ZONE_DEFAULT);
|
|
|
|
if (v > MAX_CNTR_SNAP) setCenterSnapZone(MAX_CNTR_SNAP);
|
2011-01-30 14:34:42 +00:00
|
|
|
else if (v < 0) setCenterSnapZone(0);
|
2008-07-09 15:18:47 +00:00
|
|
|
else setCenterSnapZone(v);
|
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
OverlapSnap->setChecked(cg.readEntry("SnapOnlyWhenOverlapping", false));
|
|
|
|
emit KCModule::changed(false);
|
|
|
|
}
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
void KMovingConfig::save(void)
|
2007-04-29 17:35:43 +00:00
|
|
|
{
|
|
|
|
int v;
|
|
|
|
|
|
|
|
KConfigGroup cg(config, "Windows");
|
|
|
|
|
|
|
|
cg.writeEntry(KWIN_MOVE_RESIZE_MAXIMIZED, moveResizeMaximized->isChecked());
|
|
|
|
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
cg.writeEntry(KWM_BRDR_SNAP_ZONE, getBorderSnapZone());
|
|
|
|
cg.writeEntry(KWM_WNDW_SNAP_ZONE, getWindowSnapZone());
|
|
|
|
cg.writeEntry(KWM_CNTR_SNAP_ZONE, getCenterSnapZone());
|
|
|
|
cg.writeEntry("SnapOnlyWhenOverlapping", OverlapSnap->isChecked());
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
KConfigGroup(config, "Plugins").writeEntry("kwin4_effect_windowgeometryEnabled", getGeometryTip());
|
2010-11-10 19:21:56 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
if (standAlone) {
|
2007-04-29 17:35:43 +00:00
|
|
|
config->sync();
|
2007-04-30 11:32:47 +00:00
|
|
|
// Send signal to all kwin instances
|
|
|
|
QDBusMessage message =
|
2011-01-30 14:34:42 +00:00
|
|
|
QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig");
|
2007-04-30 11:32:47 +00:00
|
|
|
QDBusConnection::sessionBus().send(message);
|
2007-04-29 17:35:43 +00:00
|
|
|
}
|
|
|
|
emit KCModule::changed(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
void KMovingConfig::defaults()
|
|
|
|
{
|
|
|
|
setGeometryTip(false);
|
|
|
|
setMoveResizeMaximized(false);
|
|
|
|
|
|
|
|
//copied from kcontrol/konq/kwindesktop, aleXXX
|
|
|
|
setWindowSnapZone(KWM_WNDW_SNAP_ZONE_DEFAULT);
|
|
|
|
setBorderSnapZone(KWM_BRDR_SNAP_ZONE_DEFAULT);
|
2008-07-09 15:18:47 +00:00
|
|
|
setCenterSnapZone(KWM_CNTR_SNAP_ZONE_DEFAULT);
|
2007-04-29 17:35:43 +00:00
|
|
|
OverlapSnap->setChecked(false);
|
|
|
|
|
|
|
|
emit KCModule::changed(true);
|
|
|
|
}
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
int KMovingConfig::getBorderSnapZone()
|
|
|
|
{
|
|
|
|
return BrdrSnap->value();
|
2007-04-29 17:35:43 +00:00
|
|
|
}
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
void KMovingConfig::setBorderSnapZone(int pxls)
|
|
|
|
{
|
|
|
|
BrdrSnap->setValue(pxls);
|
2007-04-29 17:35:43 +00:00
|
|
|
}
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
int KMovingConfig::getWindowSnapZone()
|
|
|
|
{
|
|
|
|
return WndwSnap->value();
|
2007-04-29 17:35:43 +00:00
|
|
|
}
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
void KMovingConfig::setWindowSnapZone(int pxls)
|
|
|
|
{
|
|
|
|
WndwSnap->setValue(pxls);
|
2007-04-29 17:35:43 +00:00
|
|
|
}
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
int KMovingConfig::getCenterSnapZone()
|
|
|
|
{
|
|
|
|
return CntrSnap->value();
|
2008-07-09 15:18:47 +00:00
|
|
|
}
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
void KMovingConfig::setCenterSnapZone(int pxls)
|
|
|
|
{
|
|
|
|
CntrSnap->setValue(pxls);
|
2008-07-09 15:18:47 +00:00
|
|
|
}
|
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
#include "windows.moc"
|