mirror of
https://github.com/brl/mutter.git
synced 2024-11-22 08:00:42 -05:00
nuke the lists of struts here, to improve confidence that we never try to
2003-06-26 Havoc Pennington <hp@pobox.com> * src/workspace.c (meta_workspace_invalidate_work_area): nuke the lists of struts here, to improve confidence that we never try to use them after a window with rects in the list gets freed. (it wasn't broken before I don't think, just making the code more robust against future mods) * src/window.c (meta_window_update_struts): replace magic "75" with a macro * src/constraints.c (constraint_hints_applies_func): don't apply hints to maximized or fullscreen, rather than only fullscreen (constrain_move): add paranoia max number of iterations to the heuristic loop
This commit is contained in:
parent
e1102bc6ff
commit
fa075eb8f1
16
ChangeLog
16
ChangeLog
@ -1,3 +1,19 @@
|
|||||||
|
2003-06-26 Havoc Pennington <hp@pobox.com>
|
||||||
|
|
||||||
|
* src/workspace.c (meta_workspace_invalidate_work_area): nuke the
|
||||||
|
lists of struts here, to improve confidence that we never try to
|
||||||
|
use them after a window with rects in the list gets freed.
|
||||||
|
(it wasn't broken before I don't think, just making the
|
||||||
|
code more robust against future mods)
|
||||||
|
|
||||||
|
* src/window.c (meta_window_update_struts): replace magic "75"
|
||||||
|
with a macro
|
||||||
|
|
||||||
|
* src/constraints.c (constraint_hints_applies_func): don't apply
|
||||||
|
hints to maximized or fullscreen, rather than only fullscreen
|
||||||
|
(constrain_move): add paranoia max number of iterations to the
|
||||||
|
heuristic loop
|
||||||
|
|
||||||
2003-06-26 Rob Adams <robadams@ucla.edu>
|
2003-06-26 Rob Adams <robadams@ucla.edu>
|
||||||
|
|
||||||
Add keybinding to allow the user to toggle _NET_WM_STATE_ABOVE on
|
Add keybinding to allow the user to toggle _NET_WM_STATE_ABOVE on
|
||||||
|
@ -364,9 +364,8 @@ get_outermost_onscreen_positions (MetaWindow *window,
|
|||||||
/* to handle struts, we get the list of workspaces for the window
|
/* to handle struts, we get the list of workspaces for the window
|
||||||
* and traverse all the struts in each of the cached strut lists for
|
* and traverse all the struts in each of the cached strut lists for
|
||||||
* the workspaces. Note that because the workarea has already been
|
* the workspaces. Note that because the workarea has already been
|
||||||
* computed, these strut lists should already be up to date. No
|
* computed, these strut lists should already be up to date. This function
|
||||||
* memory allocation should take place in this function for
|
* should have good performance since we call it a lot.
|
||||||
* performance.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
current = *orig;
|
current = *orig;
|
||||||
@ -681,10 +680,12 @@ static const Constraint constraint_onscreen = {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define USE_HINTS_FOR_WINDOW_STATE(window) (!((window)->fullscreen || (window)->maximized))
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
constraint_hints_applies_func (MetaWindow *window)
|
constraint_hints_applies_func (MetaWindow *window)
|
||||||
{
|
{
|
||||||
return (!window->fullscreen);
|
return USE_HINTS_FOR_WINDOW_STATE (window);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -912,7 +913,11 @@ constrain_move (MetaWindow *window,
|
|||||||
{
|
{
|
||||||
const Constraint **cp;
|
const Constraint **cp;
|
||||||
int old_x, old_y;
|
int old_x, old_y;
|
||||||
|
int paranoia;
|
||||||
|
|
||||||
|
/* Evidence that we can't actually prove this algorithm is right */
|
||||||
|
#define MAX_ITERATIONS 10
|
||||||
|
paranoia = 0;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
old_x = x_delta;
|
old_x = x_delta;
|
||||||
@ -936,10 +941,16 @@ constrain_move (MetaWindow *window,
|
|||||||
++cp;
|
++cp;
|
||||||
}
|
}
|
||||||
|
|
||||||
} while ((old_x != x_delta) || (old_y != y_delta));
|
++paranoia;
|
||||||
|
} while (((old_x != x_delta) || (old_y != y_delta)) && paranoia < MAX_ITERATIONS);
|
||||||
|
|
||||||
new->x = orig->x + x_delta;
|
new->x = orig->x + x_delta;
|
||||||
new->y = orig->y + y_delta;
|
new->y = orig->y + y_delta;
|
||||||
|
|
||||||
|
if (paranoia >= MAX_ITERATIONS)
|
||||||
|
meta_topic (META_DEBUG_GEOMETRY,
|
||||||
|
"Constraints were never satisfied for window %s\n",
|
||||||
|
window->desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -1154,6 +1165,10 @@ update_position_limits (MetaWindow *window,
|
|||||||
int nw_x, nw_y;
|
int nw_x, nw_y;
|
||||||
int se_x, se_y;
|
int se_x, se_y;
|
||||||
|
|
||||||
|
/* For maximized windows the limits are the work area, for
|
||||||
|
* other windows we see which struts apply based on the
|
||||||
|
* window's position later on
|
||||||
|
*/
|
||||||
if (window->maximized)
|
if (window->maximized)
|
||||||
{
|
{
|
||||||
nw_x = MIN (info->work_area_xinerama.x, info->work_area_screen.x);
|
nw_x = MIN (info->work_area_xinerama.x, info->work_area_screen.x);
|
||||||
|
18
src/window.c
18
src/window.c
@ -4843,6 +4843,8 @@ meta_window_update_struts (MetaWindow *window)
|
|||||||
MetaRectangle new_top;
|
MetaRectangle new_top;
|
||||||
MetaRectangle new_bottom;
|
MetaRectangle new_bottom;
|
||||||
|
|
||||||
|
#define MIN_EMPTY (75)
|
||||||
|
|
||||||
meta_verbose ("Updating struts for %s\n", window->desc);
|
meta_verbose ("Updating struts for %s\n", window->desc);
|
||||||
|
|
||||||
if (window->struts)
|
if (window->struts)
|
||||||
@ -4893,13 +4895,13 @@ meta_window_update_struts (MetaWindow *window)
|
|||||||
{
|
{
|
||||||
new_has_struts = TRUE;
|
new_has_struts = TRUE;
|
||||||
new_left.width = MIN ((int)struts[0],
|
new_left.width = MIN ((int)struts[0],
|
||||||
window->screen->width/2 - 75);
|
window->screen->width/2 - MIN_EMPTY);
|
||||||
new_right.width = MIN ((int)struts[1],
|
new_right.width = MIN ((int)struts[1],
|
||||||
window->screen->width/2 - 75);
|
window->screen->width/2 - MIN_EMPTY);
|
||||||
new_top.height = MIN ((int)struts[2],
|
new_top.height = MIN ((int)struts[2],
|
||||||
window->screen->height/2 - 75);
|
window->screen->height/2 - MIN_EMPTY);
|
||||||
new_bottom.height = MIN ((int)struts[3],
|
new_bottom.height = MIN ((int)struts[3],
|
||||||
window->screen->height/2 - 75);
|
window->screen->height/2 - MIN_EMPTY);
|
||||||
new_right.x = window->screen->width -
|
new_right.x = window->screen->width -
|
||||||
new_right.width;
|
new_right.width;
|
||||||
new_bottom.y = window->screen->height -
|
new_bottom.y = window->screen->height -
|
||||||
@ -4945,13 +4947,13 @@ meta_window_update_struts (MetaWindow *window)
|
|||||||
{
|
{
|
||||||
new_has_struts = TRUE;
|
new_has_struts = TRUE;
|
||||||
new_left.width = MIN ((int)struts[0],
|
new_left.width = MIN ((int)struts[0],
|
||||||
window->screen->width/2 - 75);
|
window->screen->width/2 - MIN_EMPTY);
|
||||||
new_right.width = MIN ((int)struts[1],
|
new_right.width = MIN ((int)struts[1],
|
||||||
window->screen->width/2 - 75);
|
window->screen->width/2 - MIN_EMPTY);
|
||||||
new_top.height = MIN ((int)struts[2],
|
new_top.height = MIN ((int)struts[2],
|
||||||
window->screen->height/2 - 75);
|
window->screen->height/2 - MIN_EMPTY);
|
||||||
new_bottom.height = MIN ((int)struts[3],
|
new_bottom.height = MIN ((int)struts[3],
|
||||||
window->screen->height/2 - 75);
|
window->screen->height/2 - MIN_EMPTY);
|
||||||
new_left.x = 0;
|
new_left.x = 0;
|
||||||
new_right.x = window->screen->width -
|
new_right.x = window->screen->width -
|
||||||
new_right.width;
|
new_right.width;
|
||||||
|
@ -349,6 +349,15 @@ meta_workspace_invalidate_work_area (MetaWorkspace *workspace)
|
|||||||
g_free (workspace->work_areas);
|
g_free (workspace->work_areas);
|
||||||
workspace->work_areas = NULL;
|
workspace->work_areas = NULL;
|
||||||
|
|
||||||
|
g_slist_free (workspace->left_struts);
|
||||||
|
workspace->left_struts = NULL;
|
||||||
|
g_slist_free (workspace->right_struts);
|
||||||
|
workspace->right_struts = NULL;
|
||||||
|
g_slist_free (workspace->top_struts);
|
||||||
|
workspace->top_struts = NULL;
|
||||||
|
g_slist_free (workspace->bottom_struts);
|
||||||
|
workspace->bottom_struts = NULL;
|
||||||
|
|
||||||
workspace->work_areas_invalid = TRUE;
|
workspace->work_areas_invalid = TRUE;
|
||||||
|
|
||||||
/* redo the size/position constraints on all windows */
|
/* redo the size/position constraints on all windows */
|
||||||
@ -386,14 +395,10 @@ ensure_work_areas_validated (MetaWorkspace *workspace)
|
|||||||
if (!workspace->work_areas_invalid)
|
if (!workspace->work_areas_invalid)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
g_slist_free (workspace->left_struts);
|
g_assert (workspace->top_struts == NULL);
|
||||||
workspace->left_struts = NULL;
|
g_assert (workspace->bottom_struts == NULL);
|
||||||
g_slist_free (workspace->right_struts);
|
g_assert (workspace->left_struts == NULL);
|
||||||
workspace->right_struts = NULL;
|
g_assert (workspace->right_struts == NULL);
|
||||||
g_slist_free (workspace->top_struts);
|
|
||||||
workspace->top_struts = NULL;
|
|
||||||
g_slist_free (workspace->bottom_struts);
|
|
||||||
workspace->bottom_struts = NULL;
|
|
||||||
|
|
||||||
windows = meta_workspace_list_windows (workspace);
|
windows = meta_workspace_list_windows (workspace);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user