4
* Copyright (c) 1997 Patrick Dowler dowler@morgul.fsh.uvic.ca
5
* Copyright (c) 2001 Waldo Bastian bastian@kde.org
7
* This program is free software; you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation; either version 2 of the License, or
10
* (at your option) any later version.
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
17
* You should have received a copy of the GNU General Public License
18
* along with this program; if not, write to the Free Software
19
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24
#include <config-workspace.h>
26
#include <QApplication>
28
#include <QRadioButton>
31
#include <QHBoxLayout>
32
#include <QFormLayout>
33
#include <QtDBus/QtDBus>
35
#include <KButtonGroup>
37
#include <knuminput.h>
42
#include <X11/Xutil.h>
46
#include <kephal/screens.h>
48
// kwin config keywords
49
#define KWIN_FOCUS "FocusPolicy"
50
#define KWIN_PLACEMENT "Placement"
51
#define KWIN_MOVE "MoveMode"
52
#define KWIN_RESIZE_OPAQUE "ResizeMode"
53
#define KWIN_GEOMETRY "GeometryTip"
54
#define KWIN_AUTORAISE_INTERVAL "AutoRaiseInterval"
55
#define KWIN_AUTORAISE "AutoRaise"
56
#define KWIN_DELAYFOCUS_INTERVAL "DelayFocusInterval"
57
#define KWIN_DELAYFOCUS "DelayFocus"
58
#define KWIN_CLICKRAISE "ClickRaise"
59
#define KWIN_MOVE_RESIZE_MAXIMIZED "MoveResizeMaximizedWindows"
60
#define KWIN_SHADEHOVER "ShadeHover"
61
#define KWIN_SHADEHOVER_INTERVAL "ShadeHoverInterval"
62
#define KWIN_FOCUS_STEALING "FocusStealingPreventionLevel"
63
#define KWIN_HIDE_UTILITY "HideUtilityWindowsForInactive"
64
#define KWIN_INACTIVE_SKIP_TASKBAR "InactiveTabsSkipTaskbar"
65
#define KWIN_AUTOGROUP_SIMILAR "AutogroupSimilarWindows"
66
#define KWIN_AUTOGROUP_FOREGROUND "AutogroupInForeground"
67
#define KWIN_SEPARATE_SCREEN_FOCUS "SeparateScreenFocus"
68
#define KWIN_ACTIVE_MOUSE_SCREEN "ActiveMouseScreen"
69
#define KWIN_TILINGON "TilingOn"
70
#define KWIN_TILING_DEFAULT_LAYOUT "TilingDefaultLayout"
71
#define KWIN_TILING_RAISE_POLICY "TilingRaisePolicy"
73
//CT 15mar 98 - magics
74
#define KWM_BRDR_SNAP_ZONE "BorderSnapZone"
75
#define KWM_BRDR_SNAP_ZONE_DEFAULT 10
76
#define KWM_WNDW_SNAP_ZONE "WindowSnapZone"
77
#define KWM_WNDW_SNAP_ZONE_DEFAULT 10
78
#define KWM_CNTR_SNAP_ZONE "CenterSnapZone"
79
#define KWM_CNTR_SNAP_ZONE_DEFAULT 0
81
#define MAX_BRDR_SNAP 100
82
#define MAX_WNDW_SNAP 100
83
#define MAX_CNTR_SNAP 100
84
#define MAX_EDGE_RES 1000
87
KFocusConfig::~KFocusConfig()
93
// removed the LCD display over the slider - this is not good GUI design :) RNolden 051701
94
KFocusConfig::KFocusConfig(bool _standAlone, KConfig *_config, const KComponentData &inst, QWidget * parent)
95
: KCModule(inst, parent), config(_config), standAlone(_standAlone)
98
QBoxLayout *lay = new QVBoxLayout(this);
101
//iTLabel = new QLabel(i18n(" Allowed overlap:\n"
102
// "(% of desktop space)"),
104
//iTLabel->setAlignment(AlignTop|AlignHCenter);
105
//pLay->addWidget(iTLabel,1,1);
107
//interactiveTrigger = new QSpinBox(0, 500, 1, plcBox);
108
//pLay->addWidget(interactiveTrigger,1,2);
110
//pLay->addRowSpacing(2,KDialog::spacingHint());
112
//lay->addWidget(plcBox);
115
//fcsBox = new QGroupBox(i18n("Focus"),this);
116
fcsBox = new QWidget(this);
118
QGridLayout *gLay = new QGridLayout();
120
fcsBox->setLayout(gLay);
122
focusStealing = new KComboBox(this);
123
focusStealing->addItem(i18nc("Focus Stealing Prevention Level", "None"));
124
focusStealing->addItem(i18nc("Focus Stealing Prevention Level", "Low"));
125
focusStealing->addItem(i18nc("Focus Stealing Prevention Level", "Medium"));
126
focusStealing->addItem(i18nc("Focus Stealing Prevention Level", "High"));
127
focusStealing->addItem(i18nc("Focus Stealing Prevention Level", "Extreme"));
128
wtstr = i18n("<p>This option specifies how much KWin will try to prevent unwanted focus stealing "
129
"caused by unexpected activation of new windows. (Note: This feature does not "
130
"work with the Focus Under Mouse or Focus Strictly Under Mouse focus policies.)"
132
"<li><em>None:</em> Prevention is turned off "
133
"and new windows always become activated.</li>"
134
"<li><em>Low:</em> Prevention is enabled; when some window does not have support "
135
"for the underlying mechanism and KWin cannot reliably decide whether to "
136
"activate the window or not, it will be activated. This setting may have both "
137
"worse and better results than the medium level, depending on the applications.</li>"
138
"<li><em>Medium:</em> Prevention is enabled.</li>"
139
"<li><em>High:</em> New windows get activated only if no window is currently active "
140
"or if they belong to the currently active application. This setting is probably "
141
"not really usable when not using mouse focus policy.</li>"
142
"<li><em>Extreme:</em> All windows must be explicitly activated by the user.</li>"
144
"<p>Windows that are prevented from stealing focus are marked as demanding attention, "
145
"which by default means their taskbar entry will be highlighted. This can be changed "
146
"in the Notifications control module.</p>");
147
focusStealing->setWhatsThis(wtstr);
148
connect(focusStealing, SIGNAL(activated(int)), SLOT(changed()));
149
focusStealing->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
150
label = new QLabel(i18n("Focus stealing prevention level:"), this);
151
label->setAlignment(Qt::AlignVCenter | Qt::AlignRight);
152
label->setBuddy(focusStealing);
153
gLay->addWidget(label, 0, 0, 1, 2);
154
gLay->addWidget(focusStealing, 0, 2);
156
focusCombo = new KComboBox(fcsBox);
157
focusCombo->setEditable(false);
158
focusCombo->addItem(i18n("Click to Focus"), CLICK_TO_FOCUS);
159
focusCombo->addItem(i18n("Focus Follows Mouse"), FOCUS_FOLLOWS_MOUSE);
160
focusCombo->addItem(i18n("Focus Under Mouse"), FOCUS_UNDER_MOUSE);
161
focusCombo->addItem(i18n("Focus Strictly Under Mouse"), FOCUS_STRICTLY_UNDER_MOUSE);
162
focusCombo->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
163
label = new QLabel(i18n("&Policy:"), this);
164
label->setAlignment(Qt::AlignVCenter | Qt::AlignRight);
165
label->setBuddy(focusCombo);
166
gLay->addWidget(label, 1, 0, 1, 2);
167
gLay->addWidget(focusCombo, 1, 2);
170
// FIXME, when more policies have been added to KWin
171
wtstr = i18n("The focus policy is used to determine the active window, i.e."
172
" the window you can work in. <ul>"
173
" <li><em>Click to focus:</em> A window becomes active when you click into it."
174
" This is the behavior you might know from other operating systems.</li>"
175
" <li><em>Focus follows mouse:</em> Moving the mouse pointer actively on to a"
176
" normal window activates it. New windows will receive the focus,"
177
" without you having to point the mouse at them explicitly."
178
" Very practical if you are using the mouse a lot.</li>"
179
" <li><em>Focus under mouse:</em> The window that happens to be under the"
180
" mouse pointer is active. If the mouse points nowhere, the last window"
181
" that was under the mouse has focus."
182
" New windows will not automatically receive the focus.</li>"
183
" <li><em>Focus strictly under mouse:</em> Only the window under the mouse pointer is"
184
" active. If the mouse points nowhere, nothing has focus.</li>"
186
"Note that 'Focus under mouse' and 'Focus strictly under mouse' prevent certain"
187
" features such as the Alt+Tab walk through windows dialog in the KDE mode"
188
" from working properly."
190
focusCombo->setWhatsThis(wtstr);
192
connect(focusCombo, SIGNAL(activated(int)), this, SLOT(focusPolicyChanged()));
195
autoRaiseOn = new QCheckBox(fcsBox);
196
connect(autoRaiseOn, SIGNAL(toggled(bool)), this, SLOT(autoRaiseOnTog(bool)));
197
autoRaise = new KIntNumInput(500, fcsBox);
198
autoRaise->setRange(0, 3000, 100);
199
autoRaise->setSteps(100, 100);
200
autoRaise->setSuffix(i18n(" ms"));
201
autoRaise->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
202
autoRaiseOnLabel = new QLabel(i18n("&Raise, with the following delay:"), this);
203
autoRaiseOnLabel->setAlignment(Qt::AlignVCenter | Qt::AlignRight);
204
autoRaiseOnLabel->setBuddy(autoRaise);
205
gLay->addWidget(autoRaiseOn, 2, 0);
206
gLay->addWidget(autoRaiseOnLabel, 2, 1);
207
gLay->addWidget(autoRaise, 2, 2);
209
connect(focusCombo, SIGNAL(activated(int)), this, SLOT(setDelayFocusEnabled()));
211
delayFocusOn = new QCheckBox(fcsBox);
212
connect(delayFocusOn, SIGNAL(toggled(bool)), this, SLOT(delayFocusOnTog(bool)));
213
delayFocus = new KIntNumInput(500, fcsBox);
214
delayFocus->setRange(0, 3000, 100);
215
delayFocus->setSteps(100, 100);
216
delayFocus->setSuffix(i18n(" ms"));
217
delayFocus->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
218
delayFocusOnLabel = new QLabel(i18n("Delay focus by:"), this);
219
delayFocusOnLabel->setAlignment(Qt::AlignVCenter | Qt::AlignRight);
220
delayFocusOnLabel->setBuddy(delayFocus);
221
gLay->addWidget(delayFocusOn, 3, 0);
222
gLay->addWidget(delayFocusOnLabel, 3, 1);
223
gLay->addWidget(delayFocus, 3, 2);
225
clickRaiseOn = new QCheckBox(i18n("C&lick raises active window"), fcsBox);
226
connect(clickRaiseOn, SIGNAL(toggled(bool)), this, SLOT(clickRaiseOnTog(bool)));
227
gLay->addWidget(clickRaiseOn, 4, 0, 1, 3);
229
autoRaiseOn->setWhatsThis(i18n("When this option is enabled, a window in the background will automatically"
230
" come to the front when the mouse pointer has been over it for some time."));
231
wtstr = i18n("This is the delay after which the window that the mouse pointer is over will automatically"
232
" come to the front.");
233
autoRaise->setWhatsThis(wtstr);
235
clickRaiseOn->setWhatsThis(i18n("When this option is enabled, the active window will be brought to the"
236
" front when you click somewhere into the window contents. To change"
237
" it for inactive windows, you need to change the settings"
238
" in the Actions tab."));
240
delayFocusOn->setWhatsThis(i18n("When this option is enabled, there will be a delay after which the"
241
" window the mouse pointer is over will become active (receive focus)."));
242
delayFocus->setWhatsThis(i18n("This is the delay after which the window the mouse pointer is over"
243
" will automatically receive focus."));
245
separateScreenFocus = new QCheckBox(i18n("S&eparate screen focus"), fcsBox);
246
gLay->addWidget(separateScreenFocus, 5, 0, 1, 3);
247
wtstr = i18n("When this option is enabled, focus operations are limited only to the active Xinerama screen");
248
separateScreenFocus->setWhatsThis(wtstr);
250
activeMouseScreen = new QCheckBox(i18n("Active screen follows &mouse"), fcsBox);
251
gLay->addWidget(activeMouseScreen, 6, 0, 1, 3);
252
wtstr = i18n("When this option is enabled, the active Xinerama screen (where new windows appear, for example)"
253
" is the screen containing the mouse pointer. When disabled, the active Xinerama screen is the "
254
" screen containing the focused window. By default this option is disabled for Click to focus and"
255
" enabled for other focus policies.");
256
activeMouseScreen->setWhatsThis(wtstr);
257
connect(focusCombo, SIGNAL(activated(int)), this, SLOT(updateActiveMouseScreen()));
259
if (Kephal::ScreenUtils::numScreens() == 1) { // No Ximerama
260
separateScreenFocus->hide();
261
activeMouseScreen->hide();
264
lay->addWidget(fcsBox);
268
// Any changes goes to slotChanged()
269
connect(focusCombo, SIGNAL(activated(int)), SLOT(changed()));
270
connect(autoRaiseOn, SIGNAL(clicked()), SLOT(changed()));
271
connect(delayFocusOn, SIGNAL(clicked()), SLOT(changed()));
272
connect(clickRaiseOn, SIGNAL(clicked()), SLOT(changed()));
273
connect(autoRaise, SIGNAL(valueChanged(int)), SLOT(changed()));
274
connect(delayFocus, SIGNAL(valueChanged(int)), SLOT(changed()));
275
connect(separateScreenFocus, SIGNAL(clicked()), SLOT(changed()));
276
connect(activeMouseScreen, SIGNAL(clicked()), SLOT(changed()));
282
int KFocusConfig::getFocus()
284
return focusCombo->currentIndex();
287
void KFocusConfig::setFocus(int foc)
289
focusCombo->setCurrentIndex(foc);
291
// this will disable/hide the auto raise delay widget if focus==click
292
focusPolicyChanged();
295
void KFocusConfig::setAutoRaiseInterval(int tb)
297
autoRaise->setValue(tb);
300
void KFocusConfig::setDelayFocusInterval(int tb)
302
delayFocus->setValue(tb);
305
int KFocusConfig::getAutoRaiseInterval()
307
return autoRaise->value();
310
int KFocusConfig::getDelayFocusInterval()
312
return delayFocus->value();
315
void KFocusConfig::setAutoRaise(bool on)
317
autoRaiseOn->setChecked(on);
320
void KFocusConfig::setDelayFocus(bool on)
322
delayFocusOn->setChecked(on);
325
void KFocusConfig::setClickRaise(bool on)
327
clickRaiseOn->setChecked(on);
330
void KFocusConfig::focusPolicyChanged()
332
int policyIndex = focusCombo->currentIndex();
334
// the auto raise related widgets are: autoRaise
335
autoRaiseOn->setEnabled(policyIndex != CLICK_TO_FOCUS);
336
autoRaiseOnLabel->setEnabled(policyIndex != CLICK_TO_FOCUS);
337
autoRaiseOnTog(policyIndex != CLICK_TO_FOCUS && autoRaiseOn->isChecked());
339
focusStealing->setDisabled(policyIndex == FOCUS_UNDER_MOUSE || policyIndex == FOCUS_STRICTLY_UNDER_MOUSE);
343
void KFocusConfig::setDelayFocusEnabled()
345
int policyIndex = focusCombo->currentIndex();
347
// the delayed focus related widgets are: delayFocus
348
delayFocusOn->setEnabled(policyIndex != CLICK_TO_FOCUS);
349
delayFocusOnLabel->setEnabled(policyIndex != CLICK_TO_FOCUS);
350
delayFocusOnTog(policyIndex != CLICK_TO_FOCUS && delayFocusOn->isChecked());
353
void KFocusConfig::autoRaiseOnTog(bool a)
355
autoRaise->setEnabled(a);
356
clickRaiseOn->setEnabled(!a);
359
void KFocusConfig::delayFocusOnTog(bool a)
361
delayFocus->setEnabled(a);
364
void KFocusConfig::clickRaiseOnTog(bool)
368
void KFocusConfig::setFocusStealing(int l)
370
l = qMax(0, qMin(4, l));
371
focusStealing->setCurrentIndex(l);
374
void KFocusConfig::setSeparateScreenFocus(bool s)
376
separateScreenFocus->setChecked(s);
379
void KFocusConfig::setActiveMouseScreen(bool a)
381
activeMouseScreen->setChecked(a);
384
void KFocusConfig::updateActiveMouseScreen()
386
// on by default for non click to focus policies
387
KConfigGroup cfg(config, "Windows");
388
if (!cfg.hasKey(KWIN_ACTIVE_MOUSE_SCREEN))
389
setActiveMouseScreen(focusCombo->currentIndex() != 0);
392
void KFocusConfig::showEvent(QShowEvent *ev)
395
QWidget::showEvent(ev);
398
KCModule::showEvent(ev);
401
void KFocusConfig::load(void)
405
KConfigGroup cg(config, "Windows");
407
key = cg.readEntry(KWIN_FOCUS);
408
if (key == "ClickToFocus")
409
setFocus(CLICK_TO_FOCUS);
410
else if (key == "FocusFollowsMouse")
411
setFocus(FOCUS_FOLLOWS_MOUSE);
412
else if (key == "FocusUnderMouse")
413
setFocus(FOCUS_UNDER_MOUSE);
414
else if (key == "FocusStrictlyUnderMouse")
415
setFocus(FOCUS_STRICTLY_UNDER_MOUSE);
417
int k = cg.readEntry(KWIN_AUTORAISE_INTERVAL, 750);
418
setAutoRaiseInterval(k);
420
k = cg.readEntry(KWIN_DELAYFOCUS_INTERVAL, 750);
421
setDelayFocusInterval(k);
423
setAutoRaise(cg.readEntry(KWIN_AUTORAISE, false));
424
setDelayFocus(cg.readEntry(KWIN_DELAYFOCUS, false));
425
setClickRaise(cg.readEntry(KWIN_CLICKRAISE, true));
426
focusPolicyChanged(); // this will disable/hide the auto raise delay widget if focus==click
427
setDelayFocusEnabled();
429
setSeparateScreenFocus(cg.readEntry(KWIN_SEPARATE_SCREEN_FOCUS, false));
430
// on by default for non click to focus policies
431
setActiveMouseScreen(cg.readEntry(KWIN_ACTIVE_MOUSE_SCREEN, focusCombo->currentIndex() != 0));
433
// setFocusStealing( cg.readEntry(KWIN_FOCUS_STEALING, 2 ));
434
// TODO default to low for now
435
setFocusStealing(cg.readEntry(KWIN_FOCUS_STEALING, 1));
437
emit KCModule::changed(false);
440
void KFocusConfig::save(void)
444
KConfigGroup cg(config, "Windows");
447
if (v == CLICK_TO_FOCUS)
448
cg.writeEntry(KWIN_FOCUS, "ClickToFocus");
449
else if (v == FOCUS_UNDER_MOUSE)
450
cg.writeEntry(KWIN_FOCUS, "FocusUnderMouse");
451
else if (v == FOCUS_STRICTLY_UNDER_MOUSE)
452
cg.writeEntry(KWIN_FOCUS, "FocusStrictlyUnderMouse");
454
cg.writeEntry(KWIN_FOCUS, "FocusFollowsMouse");
456
v = getAutoRaiseInterval();
458
cg.writeEntry(KWIN_AUTORAISE_INTERVAL, v);
460
v = getDelayFocusInterval();
462
cg.writeEntry(KWIN_DELAYFOCUS_INTERVAL, v);
464
cg.writeEntry(KWIN_AUTORAISE, autoRaiseOn->isChecked());
466
cg.writeEntry(KWIN_DELAYFOCUS, delayFocusOn->isChecked());
468
cg.writeEntry(KWIN_CLICKRAISE, clickRaiseOn->isChecked());
470
cg.writeEntry(KWIN_SEPARATE_SCREEN_FOCUS, separateScreenFocus->isChecked());
471
cg.writeEntry(KWIN_ACTIVE_MOUSE_SCREEN, activeMouseScreen->isChecked());
473
cg.writeEntry(KWIN_FOCUS_STEALING, focusStealing->currentIndex());
478
// Send signal to all kwin instances
479
QDBusMessage message =
480
QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig");
481
QDBusConnection::sessionBus().send(message);
483
emit KCModule::changed(false);
486
void KFocusConfig::defaults()
488
setAutoRaiseInterval(0);
489
setDelayFocusInterval(0);
490
setFocus(CLICK_TO_FOCUS);
492
setDelayFocus(false);
494
setSeparateScreenFocus(false);
496
// setFocusStealing(2);
497
// TODO default to low for now
500
// on by default for non click to focus policies
501
setActiveMouseScreen(focusCombo->currentIndex() != 0);
502
setDelayFocusEnabled();
503
emit KCModule::changed(true);
506
KAdvancedConfig::~KAdvancedConfig()
512
KAdvancedConfig::KAdvancedConfig(bool _standAlone, KConfig *_config, const KComponentData &inst, QWidget *parent)
513
: KCModule(inst, parent), config(_config), standAlone(_standAlone)
517
QVBoxLayout *lay = new QVBoxLayout(this);
519
//iTLabel = new QLabel(i18n(" Allowed overlap:\n"
520
// "(% of desktop space)"),
522
//iTLabel->setAlignment(AlignTop|AlignHCenter);
523
//pLay->addWidget(iTLabel,1,1);
525
//interactiveTrigger = new QSpinBox(0, 500, 1, plcBox);
526
//pLay->addWidget(interactiveTrigger,1,2);
528
//pLay->addRowSpacing(2,KDialog::spacingHint());
530
//lay->addWidget(plcBox);
532
shBox = new KButtonGroup(this);
533
shBox->setTitle(i18n("Shading"));
534
QGridLayout *kLay = new QGridLayout(shBox);
536
shadeHoverOn = new QCheckBox(i18n("&Enable hover"), shBox);
538
connect(shadeHoverOn, SIGNAL(toggled(bool)), this, SLOT(shadeHoverChanged(bool)));
539
kLay->addWidget(shadeHoverOn, 0, 0, 1, 2);
541
shadeHover = new KIntNumInput(500, shBox);
542
shadeHover->setRange(0, 3000, 100);
543
shadeHover->setSteps(100, 100);
544
shadeHover->setSuffix(i18n(" ms"));
546
shadeHoverOn->setWhatsThis(i18n("If Shade Hover is enabled, a shaded window will un-shade automatically "
547
"when the mouse pointer has been over the title bar for some time."));
549
wtstr = i18n("Sets the time in milliseconds before the window unshades "
550
"when the mouse pointer goes over the shaded window.");
551
shadeHover->setWhatsThis(wtstr);
552
shadeHover->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
553
shadeHoverLabel = new QLabel(i18n("Dela&y:"), this);
554
shadeHoverLabel->setAlignment(Qt::AlignVCenter | Qt::AlignRight);
555
shadeHoverLabel->setBuddy(shadeHover);
556
kLay->addWidget(shadeHoverLabel, 1, 0);
557
kLay->addWidget(shadeHover, 1, 1);
559
lay->addWidget(shBox);
564
wtBox = new KButtonGroup(this);
565
wtBox->setTitle(i18n("Window Tabbing"));
566
QVBoxLayout *wtLay = new QVBoxLayout(wtBox);
568
inactiveTabsSkipTaskbar = new QCheckBox(i18n("Hide inactive window tabs from the taskbar"), this);
569
inactiveTabsSkipTaskbar->setVisible(false); // TODO: We want translations in case this is fixed...
570
inactiveTabsSkipTaskbar->setWhatsThis(
571
i18n("When turned on hide all tabs that are not active from the taskbar."));
572
connect(inactiveTabsSkipTaskbar, SIGNAL(toggled(bool)), SLOT(changed()));
573
wtLay->addWidget(inactiveTabsSkipTaskbar);
575
autogroupSimilarWindows = new QCheckBox(i18n("Automatically group similar windows"), this);
576
autogroupSimilarWindows->setWhatsThis(
577
i18n("When turned on attempt to automatically detect when a newly opened window is related"
578
" to an existing one and place them in the same window group."));
579
connect(autogroupSimilarWindows, SIGNAL(toggled(bool)), SLOT(changed()));
580
wtLay->addWidget(autogroupSimilarWindows);
582
autogroupInForeground = new QCheckBox(i18n("Switch to automatically grouped windows immediately"), this);
583
autogroupInForeground->setWhatsThis(
584
i18n("When turned on immediately switch to any new window tabs that were automatically added"
585
" to the current group."));
586
connect(autogroupInForeground, SIGNAL(toggled(bool)), SLOT(changed()));
587
wtLay->addWidget(autogroupInForeground);
589
lay->addWidget(wtBox);
593
// Any changes goes to slotChanged()
594
connect(shadeHoverOn, SIGNAL(toggled(bool)), SLOT(changed()));
595
connect(shadeHover, SIGNAL(valueChanged(int)), SLOT(changed()));
597
QGridLayout *vLay = new QGridLayout();
598
lay->addLayout(vLay);
600
placementCombo = new KComboBox(this);
601
placementCombo->setEditable(false);
602
placementCombo->addItem(i18n("Smart"), SMART_PLACEMENT);
603
placementCombo->addItem(i18n("Maximizing"), MAXIMIZING_PLACEMENT);
604
placementCombo->addItem(i18n("Cascade"), CASCADE_PLACEMENT);
605
placementCombo->addItem(i18n("Random"), RANDOM_PLACEMENT);
606
placementCombo->addItem(i18n("Centered"), CENTERED_PLACEMENT);
607
placementCombo->addItem(i18n("Zero-Cornered"), ZEROCORNERED_PLACEMENT);
608
// CT: disabling is needed as long as functionality misses in kwin
609
//placementCombo->addItem(i18n("Interactive"), INTERACTIVE_PLACEMENT);
610
//placementCombo->addItem(i18n("Manual"), MANUAL_PLACEMENT);
611
placementCombo->setCurrentIndex(SMART_PLACEMENT);
613
// FIXME, when more policies have been added to KWin
614
wtstr = i18n("The placement policy determines where a new window"
615
" will appear on the desktop."
617
" <li><em>Smart</em> will try to achieve a minimum overlap of windows</li>"
618
" <li><em>Maximizing</em> will try to maximize every window to fill the whole screen."
619
" It might be useful to selectively affect placement of some windows using"
620
" the window-specific settings.</li>"
621
" <li><em>Cascade</em> will cascade the windows</li>"
622
" <li><em>Random</em> will use a random position</li>"
623
" <li><em>Centered</em> will place the window centered</li>"
624
" <li><em>Zero-Cornered</em> will place the window in the top-left corner</li>"
627
placementCombo->setWhatsThis(wtstr);
629
placementCombo->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
630
label = new QLabel(i18n("&Placement:"), this);
631
label->setAlignment(Qt::AlignVCenter | Qt::AlignRight);
632
label->setBuddy(placementCombo);
633
vLay->addWidget(label, 0, 0);
634
vLay->addWidget(placementCombo, 0, 1);
636
connect(placementCombo, SIGNAL(activated(int)), SLOT(changed()));
638
hideUtilityWindowsForInactive = new QCheckBox(i18n("Hide utility windows for inactive applications"), this);
639
hideUtilityWindowsForInactive->setWhatsThis(
640
i18n("When turned on, utility windows (tool windows, torn-off menus,...) of inactive applications will be"
641
" hidden and will be shown only when the application becomes active. Note that applications"
642
" have to mark the windows with the proper window type for this feature to work."));
643
connect(hideUtilityWindowsForInactive, SIGNAL(toggled(bool)), SLOT(changed()));
644
vLay->addWidget(hideUtilityWindowsForInactive, 1, 0, 1, 2);
646
tilBox = new KButtonGroup(this);
647
tilBox->setTitle(i18n("Tiling"));
648
QGridLayout *tilBoxLay = new QGridLayout(tilBox);
650
tilingOn = new QCheckBox(i18n("Enable Tiling"), tilBox);
651
tilingOn->setWhatsThis(
652
i18n("A tiling window manager lays out all the windows in a non-overlapping manner."
653
" This way all windows are always visible."));
654
tilBoxLay->addWidget(tilingOn);
655
connect(tilingOn, SIGNAL(toggled(bool)), SLOT(tilingOnChanged(bool)));
656
connect(tilingOn, SIGNAL(toggled(bool)), SLOT(changed()));
658
tilingLayoutLabel = new QLabel(i18n("Default Tiling &Layout"), tilBox);
659
tilBoxLay->addWidget(tilingLayoutLabel, 1, 0);
661
tilingLayoutCombo = new KComboBox(tilBox);
663
// NOTE: add your layout to the bottom of this list
664
tilingLayoutCombo->addItem(i18nc("Spiral tiling layout", "Spiral"));
665
tilingLayoutCombo->addItem(i18nc("Two-column horizontal tiling layout", "Columns"));
666
tilingLayoutCombo->addItem(i18nc("Floating layout, windows aren't tiled at all", "Floating"));
668
tilingLayoutLabel->setBuddy(tilingLayoutCombo);
669
connect(tilingLayoutCombo, SIGNAL(activated(int)), SLOT(changed()));
670
tilBoxLay->addWidget(tilingLayoutCombo, 1, 1);
672
tilingRaiseLabel = new QLabel(i18n("Floating &Windows Raising"), tilBox);
673
tilBoxLay->addWidget(tilingRaiseLabel, 2, 0);
675
tilingRaiseCombo = new KComboBox(tilBox);
676
// when a floating window is activated, all other floating
677
// windows are also brought to the front, above the tiled windows
678
// when a tiled window is focused, all floating windows go to the back.
679
// NOTE: If the user has explicitly set a client to "keep above others", that will be respected.
680
tilingRaiseCombo->addItem(i18nc("Window Raising Policy", "Raise/Lower all floating windows"));
681
tilingRaiseCombo->addItem(i18nc("Window Raising Policy", "Raise/Lower current window only"));
682
tilingRaiseCombo->addItem(i18nc("Window Raising Policy", "Floating windows are always on top"));
683
wtstr = i18n("The window raising policy determines how floating windows are stacked"
685
" <li><em>Raise/Lower all</em> will raise all floating windows when a"
686
" floating window is activated.</li>"
687
" <li><em>Raise/Lower current</em> will raise only the current window.</li>"
688
" <li><em>Floating windows on top</em> will always keep floating windows on top, even"
689
" when a tiled window is activated."
691
tilingRaiseCombo->setWhatsThis(wtstr);
692
connect(tilingRaiseCombo, SIGNAL(activated(int)), SLOT(changed()));
693
tilingRaiseLabel->setBuddy(tilingRaiseCombo);
694
tilBoxLay->addWidget(tilingRaiseCombo, 2, 1);
696
lay->addWidget(tilBox);
703
void KAdvancedConfig::setShadeHover(bool on)
705
shadeHoverOn->setChecked(on);
706
shadeHoverLabel->setEnabled(on);
707
shadeHover->setEnabled(on);
710
void KAdvancedConfig::setShadeHoverInterval(int k)
712
shadeHover->setValue(k);
715
int KAdvancedConfig::getShadeHoverInterval()
718
return shadeHover->value();
721
void KAdvancedConfig::shadeHoverChanged(bool a)
723
shadeHoverLabel->setEnabled(a);
724
shadeHover->setEnabled(a);
727
void KAdvancedConfig::setTilingOn(bool on)
729
tilingOn->setChecked(on);
730
tilingLayoutLabel->setEnabled(on);
731
tilingLayoutCombo->setEnabled(on);
732
tilingRaiseLabel->setEnabled(on);
733
tilingRaiseCombo->setEnabled(on);
736
void KAdvancedConfig::setTilingLayout(int l)
738
tilingLayoutCombo->setCurrentIndex(l);
741
void KAdvancedConfig::setTilingRaisePolicy(int l)
743
tilingRaiseCombo->setCurrentIndex(l);
746
void KAdvancedConfig::tilingOnChanged(bool a)
748
tilingLayoutLabel->setEnabled(a);
749
tilingLayoutCombo->setEnabled(a);
750
tilingRaiseLabel->setEnabled(a);
751
tilingRaiseCombo->setEnabled(a);
754
void KAdvancedConfig::showEvent(QShowEvent *ev)
757
QWidget::showEvent(ev);
760
KCModule::showEvent(ev);
763
void KAdvancedConfig::load(void)
765
KConfigGroup cg(config, "Windows");
767
setShadeHover(cg.readEntry(KWIN_SHADEHOVER, false));
768
setShadeHoverInterval(cg.readEntry(KWIN_SHADEHOVER_INTERVAL, 250));
771
// placement policy --- CT 19jan98 ---
772
key = cg.readEntry(KWIN_PLACEMENT);
773
//CT 13mar98 interactive placement
774
// if ( key.left(11) == "interactive") {
775
// setPlacement(INTERACTIVE_PLACEMENT);
776
// int comma_pos = key.find(',');
777
// if (comma_pos < 0)
778
// interactiveTrigger->setValue(0);
780
// interactiveTrigger->setValue (key.right(key.length()
781
// - comma_pos).toUInt(0));
782
// iTLabel->setEnabled(true);
783
// interactiveTrigger->show();
786
// interactiveTrigger->setValue(0);
787
// iTLabel->setEnabled(false);
788
// interactiveTrigger->hide();
790
setPlacement(RANDOM_PLACEMENT);
791
else if (key == "Cascade")
792
setPlacement(CASCADE_PLACEMENT); //CT 31jan98
793
//CT 31mar98 manual placement
794
else if (key == "manual")
795
setPlacement(MANUAL_PLACEMENT);
796
else if (key == "Centered")
797
setPlacement(CENTERED_PLACEMENT);
798
else if (key == "ZeroCornered")
799
setPlacement(ZEROCORNERED_PLACEMENT);
800
else if (key == "Maximizing")
801
setPlacement(MAXIMIZING_PLACEMENT);
803
setPlacement(SMART_PLACEMENT);
806
setHideUtilityWindowsForInactive(cg.readEntry(KWIN_HIDE_UTILITY, true));
807
setInactiveTabsSkipTaskbar(cg.readEntry(KWIN_INACTIVE_SKIP_TASKBAR, false));
808
setAutogroupSimilarWindows(cg.readEntry(KWIN_AUTOGROUP_SIMILAR, false));
809
setAutogroupInForeground(cg.readEntry(KWIN_AUTOGROUP_FOREGROUND, true));
811
setTilingOn(cg.readEntry(KWIN_TILINGON, false));
812
setTilingLayout(cg.readEntry(KWIN_TILING_DEFAULT_LAYOUT, 0));
813
setTilingRaisePolicy(cg.readEntry(KWIN_TILING_RAISE_POLICY, 0));
815
emit KCModule::changed(false);
818
void KAdvancedConfig::save(void)
822
KConfigGroup cg(config, "Windows");
823
cg.writeEntry(KWIN_SHADEHOVER, shadeHoverOn->isChecked());
825
v = getShadeHoverInterval();
827
cg.writeEntry(KWIN_SHADEHOVER_INTERVAL, v);
829
// placement policy --- CT 31jan98 ---
831
if (v == RANDOM_PLACEMENT)
832
cg.writeEntry(KWIN_PLACEMENT, "Random");
833
else if (v == CASCADE_PLACEMENT)
834
cg.writeEntry(KWIN_PLACEMENT, "Cascade");
835
else if (v == CENTERED_PLACEMENT)
836
cg.writeEntry(KWIN_PLACEMENT, "Centered");
837
else if (v == ZEROCORNERED_PLACEMENT)
838
cg.writeEntry(KWIN_PLACEMENT, "ZeroCornered");
839
else if (v == MAXIMIZING_PLACEMENT)
840
cg.writeEntry(KWIN_PLACEMENT, "Maximizing");
841
//CT 13mar98 manual and interactive placement
842
// else if (v == MANUAL_PLACEMENT)
843
// cg.writeEntry(KWIN_PLACEMENT, "Manual");
844
// else if (v == INTERACTIVE_PLACEMENT) {
845
// QString tmpstr = QString("Interactive,%1").arg(interactiveTrigger->value());
846
// cg.writeEntry(KWIN_PLACEMENT, tmpstr);
849
cg.writeEntry(KWIN_PLACEMENT, "Smart");
851
cg.writeEntry(KWIN_HIDE_UTILITY, hideUtilityWindowsForInactive->isChecked());
852
cg.writeEntry(KWIN_INACTIVE_SKIP_TASKBAR, inactiveTabsSkipTaskbar->isChecked());
853
cg.writeEntry(KWIN_AUTOGROUP_SIMILAR, autogroupSimilarWindows->isChecked());
854
cg.writeEntry(KWIN_AUTOGROUP_FOREGROUND, autogroupInForeground->isChecked());
858
// Send signal to all kwin instances
859
QDBusMessage message =
860
QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig");
861
QDBusConnection::sessionBus().send(message);
865
cg.writeEntry(KWIN_TILINGON, tilingOn->isChecked());
866
cg.writeEntry(KWIN_TILING_DEFAULT_LAYOUT, tilingLayoutCombo->currentIndex());
867
cg.writeEntry(KWIN_TILING_RAISE_POLICY, tilingRaiseCombo->currentIndex());
868
emit KCModule::changed(false);
871
void KAdvancedConfig::defaults()
873
setShadeHover(false);
874
setShadeHoverInterval(250);
875
setPlacement(SMART_PLACEMENT);
876
setHideUtilityWindowsForInactive(true);
879
setTilingRaisePolicy(0);
880
setInactiveTabsSkipTaskbar(false);
881
setAutogroupSimilarWindows(false);
882
setAutogroupInForeground(true);
883
emit KCModule::changed(true);
886
// placement policy --- CT 31jan98 ---
887
int KAdvancedConfig::getPlacement()
889
return placementCombo->currentIndex();
892
void KAdvancedConfig::setPlacement(int plac)
894
placementCombo->setCurrentIndex(plac);
898
void KAdvancedConfig::setHideUtilityWindowsForInactive(bool s)
900
hideUtilityWindowsForInactive->setChecked(s);
903
void KAdvancedConfig::setInactiveTabsSkipTaskbar(bool s)
905
inactiveTabsSkipTaskbar->setChecked(s);
908
void KAdvancedConfig::setAutogroupSimilarWindows(bool s)
910
autogroupSimilarWindows->setChecked(s);
913
void KAdvancedConfig::setAutogroupInForeground(bool s)
915
autogroupInForeground->setChecked(s);
918
KMovingConfig::~KMovingConfig()
924
KMovingConfig::KMovingConfig(bool _standAlone, KConfig *_config, const KComponentData &inst, QWidget *parent)
925
: KCModule(inst, parent), config(_config), standAlone(_standAlone)
928
QBoxLayout *lay = new QVBoxLayout(this);
930
windowsBox = new KButtonGroup(this);
931
windowsBox->setTitle(i18n("Windows"));
933
QBoxLayout *wLay = new QVBoxLayout(windowsBox);
935
QBoxLayout *bLay = new QVBoxLayout;
936
wLay->addLayout(bLay);
938
opaque = new QCheckBox(i18n("Di&splay content in moving windows"), windowsBox);
939
bLay->addWidget(opaque);
940
opaque->setWhatsThis(i18n("Enable this option if you want a window's content to be fully shown"
941
" while moving it, instead of just showing a window 'skeleton'. The result may not be satisfying"
942
" on slow machines without graphic acceleration."));
944
resizeOpaqueOn = new QCheckBox(i18n("Display content in &resizing windows"), windowsBox);
945
bLay->addWidget(resizeOpaqueOn);
946
resizeOpaqueOn->setWhatsThis(i18n("Enable this option if you want a window's content to be shown"
947
" while resizing it, instead of just showing a window 'skeleton'. The result may not be satisfying"
948
" on slow machines."));
950
geometryTipOn = new QCheckBox(i18n("Display window &geometry when moving or resizing"), windowsBox);
951
bLay->addWidget(geometryTipOn);
952
geometryTipOn->setWhatsThis(i18n("Enable this option if you want a window's geometry to be displayed"
953
" while it is being moved or resized. The window position relative"
954
" to the top-left corner of the screen is displayed together with"
957
moveResizeMaximized = new QCheckBox(i18n("Display borders on &maximized windows"), windowsBox);
958
bLay->addWidget(moveResizeMaximized);
959
moveResizeMaximized->setWhatsThis(i18n("When enabled, this feature activates the border of maximized windows"
960
" and allows you to move or resize them,"
961
" just like for normal windows"));
964
lay->addWidget(windowsBox);
966
//iTLabel = new QLabel(i18n(" Allowed overlap:\n"
967
// "(% of desktop space)"),
969
//iTLabel->setAlignment(AlignTop|AlignHCenter);
970
//pLay->addWidget(iTLabel,1,1);
972
//interactiveTrigger = new QSpinBox(0, 500, 1, plcBox);
973
//pLay->addWidget(interactiveTrigger,1,2);
975
//pLay->addRowSpacing(2,KDialog::spacingHint());
977
//lay->addWidget(plcBox);
983
//CT 15mar98 - add EdgeResistance, BorderAttractor, WindowsAttractor config
984
MagicBox = new KButtonGroup(this);
985
MagicBox->setTitle(i18n("Snap Zones"));
986
QGridLayout *kLay = new QGridLayout(MagicBox);
988
BrdrSnap = new KIntNumInput(10, MagicBox);
989
BrdrSnap->setSpecialValueText(i18nc("no border snap zone", "none"));
990
BrdrSnap->setRange(0, MAX_BRDR_SNAP);
991
BrdrSnap->setSteps(1, 10);
992
BrdrSnap->setWhatsThis(i18n("Here you can set the snap zone for screen borders, i.e."
993
" the 'strength' of the magnetic field which will make windows snap to the border when"
995
BrdrSnap->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
996
BrdrSnapLabel = new QLabel(i18n("&Border snap zone:"), this);
997
BrdrSnapLabel->setAlignment(Qt::AlignVCenter | Qt::AlignRight);
998
BrdrSnapLabel->setBuddy(BrdrSnap);
999
kLay->addWidget(BrdrSnapLabel, 0, 0);
1000
kLay->addWidget(BrdrSnap, 0, 1);
1002
WndwSnap = new KIntNumInput(10, MagicBox);
1003
WndwSnap->setSpecialValueText(i18nc("no window snap zone", "none"));
1004
WndwSnap->setRange(0, MAX_WNDW_SNAP);
1005
WndwSnap->setSteps(1, 10);
1006
WndwSnap->setWhatsThis(i18n("Here you can set the snap zone for windows, i.e."
1007
" the 'strength' of the magnetic field which will make windows snap to each other when"
1008
" they are moved near another window."));
1009
BrdrSnap->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
1010
WndwSnapLabel = new QLabel(i18n("&Window snap zone:"), this);
1011
WndwSnapLabel->setAlignment(Qt::AlignVCenter | Qt::AlignRight);
1012
WndwSnapLabel->setBuddy(WndwSnap);
1013
kLay->addWidget(WndwSnapLabel, 1, 0);
1014
kLay->addWidget(WndwSnap, 1, 1);
1016
CntrSnap = new KIntNumInput(10, MagicBox);
1017
CntrSnap->setSpecialValueText(i18nc("no center snap zone", "none"));
1018
CntrSnap->setRange(0, MAX_CNTR_SNAP);
1019
CntrSnap->setSteps(1, 10);
1020
CntrSnap->setWhatsThis(i18n("Here you can set the snap zone for the screen center, i.e."
1021
" the 'strength' of the magnetic field which will make windows snap to the center of"
1022
" the screen when moved near it."));
1023
BrdrSnap->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
1024
CntrSnapLabel = new QLabel(i18n("&Center snap zone:"), this);
1025
CntrSnapLabel->setAlignment(Qt::AlignVCenter | Qt::AlignRight);
1026
CntrSnapLabel->setBuddy(CntrSnap);
1027
kLay->addWidget(CntrSnapLabel, 2, 0);
1028
kLay->addWidget(CntrSnap, 2, 1);
1030
OverlapSnap = new QCheckBox(i18n("Snap windows onl&y when overlapping"), MagicBox);
1031
OverlapSnap->setWhatsThis(i18n("Here you can set that windows will be only"
1032
" snapped if you try to overlap them, i.e. they will not be snapped if the windows"
1033
" comes only near another window or border."));
1034
kLay->addWidget(OverlapSnap, 3, 0, 1, 2);
1036
lay->addWidget(MagicBox);
1041
// Any changes goes to slotChanged()
1042
connect(opaque, SIGNAL(clicked()), SLOT(changed()));
1043
connect(resizeOpaqueOn, SIGNAL(clicked()), SLOT(changed()));
1044
connect(geometryTipOn, SIGNAL(clicked()), SLOT(changed()));
1045
connect(moveResizeMaximized, SIGNAL(toggled(bool)), SLOT(changed()));
1046
connect(BrdrSnap, SIGNAL(valueChanged(int)), SLOT(changed()));
1047
connect(BrdrSnap, SIGNAL(valueChanged(int)), SLOT(slotBrdrSnapChanged(int)));
1048
connect(WndwSnap, SIGNAL(valueChanged(int)), SLOT(changed()));
1049
connect(WndwSnap, SIGNAL(valueChanged(int)), SLOT(slotWndwSnapChanged(int)));
1050
connect(CntrSnap, SIGNAL(valueChanged(int)), SLOT(changed()));
1051
connect(CntrSnap, SIGNAL(valueChanged(int)), SLOT(slotCntrSnapChanged(int)));
1052
connect(OverlapSnap, SIGNAL(clicked()), SLOT(changed()));
1054
// To get suffix to BrdrSnap, WndwSnap and CntrSnap inputs with default values.
1055
slotBrdrSnapChanged(BrdrSnap->value());
1056
slotWndwSnapChanged(WndwSnap->value());
1057
slotCntrSnapChanged(CntrSnap->value());
1060
int KMovingConfig::getMove()
1062
return (opaque->isChecked()) ? OPAQUE : TRANSPARENT;
1065
void KMovingConfig::setMove(int trans)
1067
opaque->setChecked(trans == OPAQUE);
1070
void KMovingConfig::setGeometryTip(bool showGeometryTip)
1072
geometryTipOn->setChecked(showGeometryTip);
1075
bool KMovingConfig::getGeometryTip()
1077
return geometryTipOn->isChecked();
1080
int KMovingConfig::getResizeOpaque()
1082
return (resizeOpaqueOn->isChecked()) ? RESIZE_OPAQUE : RESIZE_TRANSPARENT;
1085
void KMovingConfig::setResizeOpaque(int opaque)
1087
resizeOpaqueOn->setChecked(opaque == RESIZE_OPAQUE);
1090
void KMovingConfig::setMoveResizeMaximized(bool a)
1092
moveResizeMaximized->setChecked(a);
1095
void KMovingConfig::slotBrdrSnapChanged(int value)
1097
BrdrSnap->setSuffix(i18np(" pixel", " pixels", value));
1100
void KMovingConfig::slotWndwSnapChanged(int value)
1102
WndwSnap->setSuffix(i18np(" pixel", " pixels", value));
1105
void KMovingConfig::slotCntrSnapChanged(int value)
1107
CntrSnap->setSuffix(i18np(" pixel", " pixels", value));
1110
void KMovingConfig::showEvent(QShowEvent *ev)
1113
QWidget::showEvent(ev);
1116
KCModule::showEvent(ev);
1119
void KMovingConfig::load(void)
1123
KConfigGroup cg(config, "Windows");
1125
key = cg.readEntry(KWIN_MOVE, "Opaque");
1126
if (key == "Transparent")
1127
setMove(TRANSPARENT);
1128
else if (key == "Opaque")
1131
// DF: please keep the default consistent with kwin (options.cpp line 145)
1132
key = cg.readEntry(KWIN_RESIZE_OPAQUE, "Opaque");
1133
if (key == "Opaque")
1134
setResizeOpaque(RESIZE_OPAQUE);
1135
else if (key == "Transparent")
1136
setResizeOpaque(RESIZE_TRANSPARENT);
1138
//KS 10Jan2003 - Geometry Tip during window move/resize
1139
bool showGeomTip = cg.readEntry(KWIN_GEOMETRY, false);
1140
setGeometryTip(showGeomTip);
1143
setMoveResizeMaximized(cg.readEntry(KWIN_MOVE_RESIZE_MAXIMIZED, false));
1147
v = cg.readEntry(KWM_BRDR_SNAP_ZONE, KWM_BRDR_SNAP_ZONE_DEFAULT);
1148
if (v > MAX_BRDR_SNAP) setBorderSnapZone(MAX_BRDR_SNAP);
1149
else if (v < 0) setBorderSnapZone(0);
1150
else setBorderSnapZone(v);
1152
v = cg.readEntry(KWM_WNDW_SNAP_ZONE, KWM_WNDW_SNAP_ZONE_DEFAULT);
1153
if (v > MAX_WNDW_SNAP) setWindowSnapZone(MAX_WNDW_SNAP);
1154
else if (v < 0) setWindowSnapZone(0);
1155
else setWindowSnapZone(v);
1157
v = cg.readEntry(KWM_CNTR_SNAP_ZONE, KWM_CNTR_SNAP_ZONE_DEFAULT);
1158
if (v > MAX_CNTR_SNAP) setCenterSnapZone(MAX_CNTR_SNAP);
1159
else if (v < 0) setCenterSnapZone(0);
1160
else setCenterSnapZone(v);
1162
OverlapSnap->setChecked(cg.readEntry("SnapOnlyWhenOverlapping", false));
1163
emit KCModule::changed(false);
1166
void KMovingConfig::save(void)
1170
KConfigGroup cg(config, "Windows");
1173
if (v == TRANSPARENT)
1174
cg.writeEntry(KWIN_MOVE, "Transparent");
1176
cg.writeEntry(KWIN_MOVE, "Opaque");
1178
cg.writeEntry(KWIN_GEOMETRY, getGeometryTip());
1180
v = getResizeOpaque();
1181
if (v == RESIZE_OPAQUE)
1182
cg.writeEntry(KWIN_RESIZE_OPAQUE, "Opaque");
1184
cg.writeEntry(KWIN_RESIZE_OPAQUE, "Transparent");
1186
cg.writeEntry(KWIN_MOVE_RESIZE_MAXIMIZED, moveResizeMaximized->isChecked());
1189
cg.writeEntry(KWM_BRDR_SNAP_ZONE, getBorderSnapZone());
1190
cg.writeEntry(KWM_WNDW_SNAP_ZONE, getWindowSnapZone());
1191
cg.writeEntry(KWM_CNTR_SNAP_ZONE, getCenterSnapZone());
1192
cg.writeEntry("SnapOnlyWhenOverlapping", OverlapSnap->isChecked());
1194
KConfigGroup(config, "Plugins").writeEntry("kwin4_effect_windowgeometryEnabled", getGeometryTip());
1198
// Send signal to all kwin instances
1199
QDBusMessage message =
1200
QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig");
1201
QDBusConnection::sessionBus().send(message);
1203
emit KCModule::changed(false);
1206
void KMovingConfig::defaults()
1209
setResizeOpaque(RESIZE_TRANSPARENT);
1210
setGeometryTip(false);
1211
setMoveResizeMaximized(false);
1213
//copied from kcontrol/konq/kwindesktop, aleXXX
1214
setWindowSnapZone(KWM_WNDW_SNAP_ZONE_DEFAULT);
1215
setBorderSnapZone(KWM_BRDR_SNAP_ZONE_DEFAULT);
1216
setCenterSnapZone(KWM_CNTR_SNAP_ZONE_DEFAULT);
1217
OverlapSnap->setChecked(false);
1219
emit KCModule::changed(true);
1222
int KMovingConfig::getBorderSnapZone()
1224
return BrdrSnap->value();
1227
void KMovingConfig::setBorderSnapZone(int pxls)
1229
BrdrSnap->setValue(pxls);
1232
int KMovingConfig::getWindowSnapZone()
1234
return WndwSnap->value();
1237
void KMovingConfig::setWindowSnapZone(int pxls)
1239
WndwSnap->setValue(pxls);
1242
int KMovingConfig::getCenterSnapZone()
1244
return CntrSnap->value();
1247
void KMovingConfig::setCenterSnapZone(int pxls)
1249
CntrSnap->setValue(pxls);
1252
#include "windows.moc"