Revamp placement policy for windows that are maximized when they are

2003-06-09  Rob Adams  <robadams@ucla.edu>

	Revamp placement policy for windows that are maximized when they
	are mapped, including windows that set a hint to be maximized or
	windows that are auto-maximized using our heuristic.  See #111902.

	* src/window.h: add new flag maximize_after_placement and new
	function meta_window_maximize_internal.

	* src/window.c (meta_window_new): initialize
	maximize_after_placement to FALSE and remove the automaximize
	heuristic.
	(meta_window_maximize_internal): new function accepts a saved_rect
	argument to be used as the new saved_rect for the window, and does
	not queue a move_resize.
	(meta_window_maximize): re-implement using
	meta_window_maximize_internal.
	(update_net_wm_state): If a window has a maximize hint set on
	startup set maximize_after_placement to TRUE

	* src/constraints.c (meta_window_constrain): Update the xinerama
	information in the ConstraintInfo after placing the window, and
	maximize the window after placement if
	window->maximize_after_placement

	* src/place.c (find_first_fit): take a natural xinerama list as an
	argument instead of generating it here
	(constrain_placement): remove function, since it is no longer
	needed
	(meta_window_place): generate the natural xinerama list here and
	pass it into find_first_fit.  If find_first_fit fails, use the
	list to find empty xineramas where we can place windows that may
	be maximized later.  This makes maximized windows follow the
	correct placement policy.  Move the automaximize heuristic here.
This commit is contained in:
Rob Adams
2003-06-09 23:49:02 +00:00
committed by Rob Adams
parent 3f6bad087d
commit 010e620a34
5 changed files with 172 additions and 107 deletions

View File

@ -1119,20 +1119,38 @@ meta_window_constrain (MetaWindow *window,
!window->maximized &&
!window->fullscreen)
{
int x, y;
MetaRectangle placed_rect = current;
meta_window_place (window, orig_fgeom, current.x, current.y,
&x, &y);
&placed_rect.x, &placed_rect.y);
/* placing the window may have changed the xinerama. Find the
* new xinerama and update the ConstraintInfo
*/
info.xinerama = meta_screen_get_xinerama_for_rect (window->screen,
&placed_rect);
meta_window_get_work_area_for_xinerama (window,
info.xinerama->number,
&info.work_area_xinerama);
update_position_limits (window, &info);
constrain_move (window, &info, &current,
x - current.x,
y - current.y,
placed_rect.x - current.x,
placed_rect.y - current.y,
new);
current = *new;
/* Ignore any non-placement movement */
x_move_delta = 0;
y_move_delta = 0;
}
if (window->maximize_after_placement &&
window->placed)
{
window->maximize_after_placement = FALSE;
meta_window_maximize_internal (window, new);
}
/* Maximization, fullscreen, etc. are defined as a move followed by