Tune electric borders...
svn path=/trunk/kdebase/kwin/; revision=113523
This commit is contained in:
parent
827e9b92be
commit
7d5e50bab8
3 changed files with 22 additions and 4 deletions
10
options.cpp
10
options.cpp
|
@ -20,7 +20,8 @@ class OptionsPrivate
|
|||
{
|
||||
public:
|
||||
OptionsPrivate() : title_buttons_left( "MS" ), title_buttons_right( "HIAX" ),
|
||||
custom_button_positions( false ), electric_borders( false ) {};
|
||||
custom_button_positions( false ), electric_borders( false ),
|
||||
electric_border_delay(0) {};
|
||||
QColor colors[KWINCOLORS*2];
|
||||
QColorGroup *cg[KWINCOLORS*2];
|
||||
QString title_buttons_left;
|
||||
|
@ -30,6 +31,7 @@ public:
|
|||
bool fade_tooltips;
|
||||
bool animate_tooltips;
|
||||
bool electric_borders;
|
||||
int electric_border_delay;
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -220,6 +222,7 @@ void Options::reload()
|
|||
windowSnapZone = config->readNumEntry("WindowSnapZone", 10);
|
||||
snapOnlyWhenOverlapping=config->readBoolEntry("SnapOnlyWhenOverlapping",FALSE);
|
||||
d->electric_borders = config->readBoolEntry("ElectricBorders", false);
|
||||
d->electric_border_delay = config->readNumEntry("ElectricBorderDelay", 150);
|
||||
|
||||
OpTitlebarDblClick = windowOperation( config->readEntry("TitlebarDoubleClickCommand", "Shade") );
|
||||
|
||||
|
@ -357,5 +360,10 @@ bool Options::electricBorders()
|
|||
return d->electric_borders;
|
||||
}
|
||||
|
||||
int Options::electricBorderDelay()
|
||||
{
|
||||
return d->electric_border_delay;
|
||||
}
|
||||
|
||||
#include "options.moc"
|
||||
|
||||
|
|
|
@ -316,6 +316,11 @@ public:
|
|||
*/
|
||||
bool electricBorders();
|
||||
|
||||
/**
|
||||
* @returns the activation delay for electric borders in milliseconds.
|
||||
*/
|
||||
int electricBorderDelay();
|
||||
|
||||
public slots:
|
||||
void reload();
|
||||
|
||||
|
|
|
@ -116,6 +116,7 @@ public:
|
|||
WId electric_right_border;
|
||||
Time electric_time_first;
|
||||
Time electric_time_last;
|
||||
QPoint electric_push_point;
|
||||
Client *movingClient;
|
||||
};
|
||||
|
||||
|
@ -4215,11 +4216,14 @@ void Workspace::electricBorder(XEvent *e)
|
|||
{
|
||||
Window border = e->xcrossing.window;
|
||||
Time now = e->xcrossing.time;
|
||||
int treshold_set = 150; // set timeout
|
||||
int treshold_reset = 150; // reset timeout
|
||||
int treshold_set = options->electricBorderDelay(); // set timeout
|
||||
int treshold_reset = 250; // reset timeout
|
||||
int distance_reset = 10; // Mouse should not move more than this many pixels
|
||||
QPoint p(e->xcrossing.x_root, e->xcrossing.y_root);
|
||||
|
||||
if ((d->electric_current_border == border) &&
|
||||
(TimeDiff(d->electric_time_last, now) < treshold_reset))
|
||||
(TimeDiff(d->electric_time_last, now) < treshold_reset) &&
|
||||
((p-d->electric_push_point).manhattanLength() < distance_reset))
|
||||
{
|
||||
d->electric_time_last = now;
|
||||
|
||||
|
@ -4257,6 +4261,7 @@ void Workspace::electricBorder(XEvent *e)
|
|||
d->electric_current_border = border;
|
||||
d->electric_time_first = now;
|
||||
d->electric_time_last = now;
|
||||
d->electric_push_point = p;
|
||||
}
|
||||
|
||||
int mouse_warp = 1;
|
||||
|
|
Loading…
Reference in a new issue