don't promote due to transiency; we handle that elsewhere now.

2004-03-01  Rob Adams  <readams@readams.net>

	* src/stack.c (compute_layer): don't promote due to transiency; we
	handle that elsewhere now.
	(ensure_above): perform layer promotion here as well as stack
	position promotion.  Note that this means that we need to do stack
	constraints now on layer change now.
	(get_maximum_layer_of_ancestor): remove function
	(max_layer_func): remove function
	(MaxLayerData): remove struct
This commit is contained in:
Rob Adams 2004-03-02 02:28:21 +00:00 committed by Rob Adams
parent 56609cbb39
commit f3cc59c78a
2 changed files with 56 additions and 94 deletions

View File

@ -1,3 +1,14 @@
2004-03-01 Rob Adams <readams@readams.net>
* src/stack.c (compute_layer): don't promote due to transiency; we
handle that elsewhere now.
(ensure_above): perform layer promotion here as well as stack
position promotion. Note that this means that we need to do stack
constraints now on layer change now.
(get_maximum_layer_of_ancestor): remove function
(max_layer_func): remove function
(MaxLayerData): remove struct
2004-02-28 Rob Adams <readams@readams.net> 2004-02-28 Rob Adams <readams@readams.net>
Revert 2/27 patch for layer promotion. Revert 2/27 patch for layer promotion.

View File

@ -32,6 +32,20 @@
#include <X11/Xatom.h> #include <X11/Xatom.h>
#define WINDOW_HAS_TRANSIENT_TYPE(w) \
(w->type == META_WINDOW_DIALOG || \
w->type == META_WINDOW_MODAL_DIALOG || \
w->type == META_WINDOW_TOOLBAR || \
w->type == META_WINDOW_MENU || \
w->type == META_WINDOW_UTILITY)
#define WINDOW_TRANSIENT_FOR_WHOLE_GROUP(w) \
((w->xtransient_for == None || \
w->transient_parent_is_root_window) && \
WINDOW_HAS_TRANSIENT_TYPE (w))
#define WINDOW_IN_STACK(w) (w->stack_position >= 0)
static void meta_stack_sync_to_server (MetaStack *stack); static void meta_stack_sync_to_server (MetaStack *stack);
MetaStack* MetaStack*
@ -281,36 +295,6 @@ get_standalone_layer (MetaWindow *window)
return layer; return layer;
} }
typedef struct
{
MetaStackLayer max;
} MaxLayerData;
static gboolean
max_layer_func (MetaWindow *window,
void *data)
{
MaxLayerData *d = data;
MetaStackLayer layer;
layer = get_standalone_layer (window);
if (layer > d->max)
d->max = layer;
return TRUE;
}
static MetaStackLayer
get_maximum_layer_of_ancestor (MetaWindow *window)
{
MaxLayerData d;
d.max = get_standalone_layer (window);
meta_window_foreach_ancestor (window, max_layer_func, &d);
return d.max;
}
/* Note that this function can never use window->layer only /* Note that this function can never use window->layer only
* get_standalone_layer, or we'd have issues. * get_standalone_layer, or we'd have issues.
*/ */
@ -360,28 +344,9 @@ compute_layer (MetaWindow *window)
* windows getting in fullscreen layer if any terminal is * windows getting in fullscreen layer if any terminal is
* fullscreen. * fullscreen.
*/ */
if (window->type == META_WINDOW_DIALOG || if (WINDOW_HAS_TRANSIENT_TYPE(window) &&
window->type == META_WINDOW_MODAL_DIALOG || (window->xtransient_for == None ||
window->type == META_WINDOW_UTILITY || window->transient_parent_is_root_window))
window->type == META_WINDOW_MENU ||
window->type == META_WINDOW_TOOLBAR)
{
if (window->xtransient_for != None &&
!window->transient_parent_is_root_window)
{
MetaStackLayer ancestor_max;
ancestor_max = get_maximum_layer_of_ancestor (window);
if (ancestor_max > window->layer)
{
meta_topic (META_DEBUG_STACK,
"Promoting window %s from layer %d to %d due to transiency\n",
window->desc, window->layer, ancestor_max);
window->layer = ancestor_max;
}
}
else
{ {
/* We only do the group thing if the dialog is NOT transient for /* We only do the group thing if the dialog is NOT transient for
* a particular window. Imagine a group with a normal window, a dock, * a particular window. Imagine a group with a normal window, a dock,
@ -389,15 +354,6 @@ compute_layer (MetaWindow *window)
* above the dock if it wouldn't normally be. * above the dock if it wouldn't normally be.
*/ */
/* FIXME when promoting a window here,
* it's necessary to promote its transient children
* (or other windows constrained to be above it)
* as well, but we aren't handling that, and it's
* somewhat hard to fix.
*
* http://bugzilla.gnome.org/show_bug.cgi?id=96140
*/
MetaStackLayer group_max; MetaStackLayer group_max;
group_max = get_maximum_layer_in_group (window); group_max = get_maximum_layer_in_group (window);
@ -410,7 +366,6 @@ compute_layer (MetaWindow *window)
window->layer = group_max; window->layer = group_max;
} }
} }
}
meta_topic (META_DEBUG_STACK, "Window %s on layer %d type = %d has_focus = %d\n", meta_topic (META_DEBUG_STACK, "Window %s on layer %d type = %d has_focus = %d\n",
window->desc, window->layer, window->desc, window->layer,
@ -541,20 +496,6 @@ add_constraint (Constraint **constraints,
constraints[below->stack_position] = c; constraints[below->stack_position] = c;
} }
#define WINDOW_HAS_TRANSIENT_TYPE(w) \
(w->type == META_WINDOW_DIALOG || \
w->type == META_WINDOW_MODAL_DIALOG || \
w->type == META_WINDOW_TOOLBAR || \
w->type == META_WINDOW_MENU || \
w->type == META_WINDOW_UTILITY)
#define WINDOW_TRANSIENT_FOR_WHOLE_GROUP(w) \
((w->xtransient_for == None || \
w->transient_parent_is_root_window) && \
WINDOW_HAS_TRANSIENT_TYPE (w))
#define WINDOW_IN_STACK(w) (w->stack_position >= 0)
static void static void
create_constraints (Constraint **constraints, create_constraints (Constraint **constraints,
GList *windows) GList *windows)
@ -716,13 +657,21 @@ static void
ensure_above (MetaWindow *above, ensure_above (MetaWindow *above,
MetaWindow *below) MetaWindow *below)
{ {
if (WINDOW_HAS_TRANSIENT_TYPE(above) &&
above->layer < below->layer)
{
meta_topic (META_DEBUG_STACK,
"Promoting window %s from layer %d to %d due to contraint\n",
above->desc, above->layer, below->layer);
above->layer = below->layer;
}
if (above->stack_position < below->stack_position) if (above->stack_position < below->stack_position)
{ {
/* move above to below->stack_position bumping below down the stack */ /* move above to below->stack_position bumping below down the stack */
meta_window_set_stack_position (above, below->stack_position); meta_window_set_stack_position (above, below->stack_position);
g_assert (below->stack_position + 1 == above->stack_position); g_assert (below->stack_position + 1 == above->stack_position);
} }
meta_topic (META_DEBUG_STACK, "%s above at %d > %s below at %d\n", meta_topic (META_DEBUG_STACK, "%s above at %d > %s below at %d\n",
above->desc, above->stack_position, above->desc, above->stack_position,
below->desc, below->stack_position); below->desc, below->stack_position);
@ -936,6 +885,7 @@ meta_stack_ensure_sorted (MetaStack *stack)
w->desc, old_layer, w->layer); w->desc, old_layer, w->layer);
stack->need_resort = TRUE; stack->need_resort = TRUE;
stack->need_constrain = TRUE;
/* don't need to constrain as constraining /* don't need to constrain as constraining
* purely operates in terms of stack_position * purely operates in terms of stack_position
* not layer * not layer
@ -948,7 +898,8 @@ meta_stack_ensure_sorted (MetaStack *stack)
stack->need_relayer = FALSE; stack->need_relayer = FALSE;
} }
/* Update stack_position to reflect transiency constraints */ /* Update stack_position and layer to reflect transiency
constraints */
constrain_stacking (stack); constrain_stacking (stack);
/* Sort stack->sorted with layers having priority over stack_position /* Sort stack->sorted with layers having priority over stack_position