mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 01:20:42 -05:00
Revert to the old edge resistance behavior for keyboard movement/resizing
2006-01-09 Elijah Newren <newren@gmail.com> * src/edge-resistance.c (apply_edge_resistance): Revert to the old edge resistance behavior for keyboard movement/resizing based resistance. Not only makes the code much simpler and shorter, but also fixes another of the zillions of issues covered in #321905.
This commit is contained in:
parent
de65967b62
commit
008a811e10
@ -1,3 +1,10 @@
|
|||||||
|
2006-01-09 Elijah Newren <newren@gmail.com>
|
||||||
|
|
||||||
|
* src/edge-resistance.c (apply_edge_resistance): Revert to the old
|
||||||
|
edge resistance behavior for keyboard movement/resizing based
|
||||||
|
resistance. Not only makes the code much simpler and shorter, but
|
||||||
|
also fixes another of the zillions of issues covered in #321905.
|
||||||
|
|
||||||
2006-01-09 Elijah Newren <newren@gmail.com>
|
2006-01-09 Elijah Newren <newren@gmail.com>
|
||||||
|
|
||||||
* src/edge-resistance.c (apply_edge_resistance): Remove the
|
* src/edge-resistance.c (apply_edge_resistance): Remove the
|
||||||
|
@ -329,8 +329,6 @@ apply_edge_resistance (MetaWindow *window,
|
|||||||
gboolean keyboard_op)
|
gboolean keyboard_op)
|
||||||
{
|
{
|
||||||
int i, begin, end;
|
int i, begin, end;
|
||||||
gboolean okay_to_clear_keyboard_buildup = FALSE;
|
|
||||||
int keyboard_buildup_edge = G_MAXINT;
|
|
||||||
gboolean increasing = new_pos > old_pos;
|
gboolean increasing = new_pos > old_pos;
|
||||||
int increment = increasing ? 1 : -1;
|
int increment = increasing ? 1 : -1;
|
||||||
|
|
||||||
@ -343,12 +341,6 @@ apply_edge_resistance (MetaWindow *window,
|
|||||||
const int TIMEOUT_RESISTANCE_LENGTH_MS_WINDOW = 0;
|
const int TIMEOUT_RESISTANCE_LENGTH_MS_WINDOW = 0;
|
||||||
const int TIMEOUT_RESISTANCE_LENGTH_MS_XINERAMA = 0;
|
const int TIMEOUT_RESISTANCE_LENGTH_MS_XINERAMA = 0;
|
||||||
const int TIMEOUT_RESISTANCE_LENGTH_MS_SCREEN = 0;
|
const int TIMEOUT_RESISTANCE_LENGTH_MS_SCREEN = 0;
|
||||||
const int KEYBOARD_BUILDUP_THRESHOLD_TOWARDS_WINDOW = 16;
|
|
||||||
const int KEYBOARD_BUILDUP_THRESHOLD_AWAYFROM_WINDOW = 16;
|
|
||||||
const int KEYBOARD_BUILDUP_THRESHOLD_TOWARDS_XINERAMA = 24;
|
|
||||||
const int KEYBOARD_BUILDUP_THRESHOLD_AWAYFROM_XINERAMA = 16;
|
|
||||||
const int KEYBOARD_BUILDUP_THRESHOLD_TOWARDS_SCREEN = 32;
|
|
||||||
const int KEYBOARD_BUILDUP_THRESHOLD_AWAYFROM_SCREEN = 16;
|
|
||||||
|
|
||||||
/* Quit if no movement was specified */
|
/* Quit if no movement was specified */
|
||||||
if (old_pos == new_pos)
|
if (old_pos == new_pos)
|
||||||
@ -397,73 +389,9 @@ apply_edge_resistance (MetaWindow *window,
|
|||||||
/* Rest is easier to read if we split on keyboard vs. mouse op */
|
/* Rest is easier to read if we split on keyboard vs. mouse op */
|
||||||
if (keyboard_op)
|
if (keyboard_op)
|
||||||
{
|
{
|
||||||
int resistance, threshold;
|
if ((old_pos < compare && compare < new_pos) ||
|
||||||
|
(old_pos > compare && compare > new_pos))
|
||||||
/* KEYBOARD ENERGY BUILDUP RESISTANCE: If the user has is moving
|
return compare;
|
||||||
* fast enough or has already built up enough "energy", then let
|
|
||||||
* the user past the edge, otherwise stop at this edge. If the
|
|
||||||
* user was previously stopped at this edge, add movement amount
|
|
||||||
* to the built up energy.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* First, determine the amount of the resistance */
|
|
||||||
resistance = 0;
|
|
||||||
switch (edge->edge_type)
|
|
||||||
{
|
|
||||||
case META_EDGE_WINDOW:
|
|
||||||
if (movement_towards_edge (edge->side_type, increment))
|
|
||||||
resistance = KEYBOARD_BUILDUP_THRESHOLD_TOWARDS_WINDOW;
|
|
||||||
else
|
|
||||||
resistance = KEYBOARD_BUILDUP_THRESHOLD_AWAYFROM_WINDOW;
|
|
||||||
break;
|
|
||||||
case META_EDGE_XINERAMA:
|
|
||||||
if (movement_towards_edge (edge->side_type, increment))
|
|
||||||
resistance = KEYBOARD_BUILDUP_THRESHOLD_TOWARDS_XINERAMA;
|
|
||||||
else
|
|
||||||
resistance = KEYBOARD_BUILDUP_THRESHOLD_AWAYFROM_XINERAMA;
|
|
||||||
break;
|
|
||||||
case META_EDGE_SCREEN:
|
|
||||||
if (movement_towards_edge (edge->side_type, increment))
|
|
||||||
resistance = KEYBOARD_BUILDUP_THRESHOLD_TOWARDS_SCREEN;
|
|
||||||
else
|
|
||||||
resistance = KEYBOARD_BUILDUP_THRESHOLD_AWAYFROM_SCREEN;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Clear any previous buildup if we've run into an edge at a
|
|
||||||
* different location than what we were building up on before.
|
|
||||||
* See below for more details where these get set.
|
|
||||||
*/
|
|
||||||
if (okay_to_clear_keyboard_buildup &&
|
|
||||||
compare != keyboard_buildup_edge)
|
|
||||||
{
|
|
||||||
okay_to_clear_keyboard_buildup = FALSE;
|
|
||||||
resistance_data->keyboard_buildup = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Determine the threshold */
|
|
||||||
threshold = resistance - resistance_data->keyboard_buildup;
|
|
||||||
|
|
||||||
/* See if threshold hasn't been met yet or not */
|
|
||||||
if (ABS (compare - new_pos) < threshold)
|
|
||||||
{
|
|
||||||
if (resistance_data->keyboard_buildup != 0)
|
|
||||||
resistance_data->keyboard_buildup += ABS (new_pos - compare);
|
|
||||||
else
|
|
||||||
resistance_data->keyboard_buildup = 1; /* 0 causes stuckage */
|
|
||||||
return compare;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* It may be the case that there are two windows with edges
|
|
||||||
* at the same location. If so, the buildup ought to count
|
|
||||||
* towards both edges. So we just not that it's okay to
|
|
||||||
* clear the buildup once we find an edge at a different
|
|
||||||
* location.
|
|
||||||
*/
|
|
||||||
okay_to_clear_keyboard_buildup = TRUE;
|
|
||||||
keyboard_buildup_edge = compare;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else /* mouse op */
|
else /* mouse op */
|
||||||
{
|
{
|
||||||
@ -561,12 +489,6 @@ apply_edge_resistance (MetaWindow *window,
|
|||||||
i += increment;
|
i += increment;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we didn't run into any new edges in keyboard buildup but had moved
|
|
||||||
* far enough to get past the last one, clear the buildup
|
|
||||||
*/
|
|
||||||
if (okay_to_clear_keyboard_buildup && new_pos != keyboard_buildup_edge)
|
|
||||||
resistance_data->keyboard_buildup = 0;
|
|
||||||
|
|
||||||
return new_pos;
|
return new_pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user