Fix several bugs with handling of fullscreen windows, causing them to not

2006-08-21  Elijah Newren  <newren gmail com>

	Fix several bugs with handling of fullscreen windows, causing them
	to not actually be fullscreen.  #343115 (and also #346927,
	#350547, #351643, the recent additional WINE-related issue
	mentioned on the mailing list, and probably others...)

	* src/constraints.c (setup_constraint_info): if a window tries to
	resize to fullscreen-size and it has a fullscreen function but
	isn't actually marked as fullscreen then assist it by marking it
	as such, (constrain_fully_onscreen, constrain_titlebar_visible):
	ignore this constraint for fullscreen windows since such windows
	have a separate specialized constraint

	* src/stack.c (window_is_fullscreen_size, get_standalone_layer):
	remove the old window_is_fullscreen_size() hack for detecting
	windows to treat as fullscreen since it doesn't work well with the
	new constraints framework (i.e. we needed a slightly different
	hack)

	* src/window.[ch] (meta_window_new_with_addrs): shuffle the order
	of adding the window to the stack and moveresizing the window
	since moveresizing can cause stack changes if the window's initial
	size is fullscreen size, (meta_window_make_fullscreen,
	meta_window_make_fullscreen_internal): split
	meta_window_make_fullscreen() similar to meta_window_maximize() so
	that constraints can make use of it
This commit is contained in:
Elijah Newren 2006-08-21 18:08:05 +00:00 committed by Elijah Newren
parent 7ea55a1e54
commit 4c96afba71
5 changed files with 74 additions and 48 deletions

View File

@ -1,3 +1,31 @@
2006-08-21 Elijah Newren <newren gmail com>
Fix several bugs with handling of fullscreen windows, causing them
to not actually be fullscreen. #343115 (and also #346927,
#350547, #351643, the recent additional WINE-related issue
mentioned on the mailing list, and probably others...)
* src/constraints.c (setup_constraint_info): if a window tries to
resize to fullscreen-size and it has a fullscreen function but
isn't actually marked as fullscreen then assist it by marking it
as such, (constrain_fully_onscreen, constrain_titlebar_visible):
ignore this constraint for fullscreen windows since such windows
have a separate specialized constraint
* src/stack.c (window_is_fullscreen_size, get_standalone_layer):
remove the old window_is_fullscreen_size() hack for detecting
windows to treat as fullscreen since it doesn't work well with the
new constraints framework (i.e. we needed a slightly different
hack)
* src/window.[ch] (meta_window_new_with_addrs): shuffle the order
of adding the window to the stack and moveresizing the window
since moveresizing can cause stack changes if the window's initial
size is fullscreen size, (meta_window_make_fullscreen,
meta_window_make_fullscreen_internal): split
meta_window_make_fullscreen() similar to meta_window_maximize() so
that constraints can make use of it
2006-08-19 Baptiste Mille-Mathias <baptiste.millemathias@gmail.com>
* src/stock_delete.png: Update the pixmap to a new one which

View File

@ -399,6 +399,23 @@ setup_constraint_info (ConstraintInfo *info,
meta_workspace_get_onxinerama_region (cur_workspace,
xinerama_info->number);
/* Workaround braindead legacy apps that don't know how to
* fullscreen themselves properly.
*/
if (meta_rectangle_equal (new, &xinerama_info->rect) &&
window->has_fullscreen_func &&
!window->fullscreen)
{
/*
meta_topic (META_DEBUG_GEOMETRY,
*/
meta_warning (
"Treating resize request of legacy application %s as a "
"fullscreen request\n",
window->desc);
meta_window_make_fullscreen_internal (window);
}
/* Log all this information for debugging */
meta_topic (META_DEBUG_GEOMETRY,
"Setting up constraint info:\n"
@ -1069,6 +1086,7 @@ constrain_fully_onscreen (MetaWindow *window,
*/
if (window->type == META_WINDOW_DESKTOP ||
window->type == META_WINDOW_DOCK ||
window->fullscreen ||
!window->require_fully_onscreen ||
info->is_user_action)
return TRUE;
@ -1110,6 +1128,7 @@ constrain_titlebar_visible (MetaWindow *window,
*/
if (window->type == META_WINDOW_DESKTOP ||
window->type == META_WINDOW_DOCK ||
window->fullscreen ||
!window->require_titlebar_visible ||
!window->decorated ||
unconstrained_user_action)

View File

@ -196,42 +196,6 @@ meta_stack_thaw (MetaStack *stack)
meta_stack_sync_to_server (stack);
}
static gboolean
window_is_fullscreen_size (MetaWindow *window)
{
int i;
if (meta_rectangle_could_fit_rect (&window->rect, &window->screen->rect))
{
/* we use the work area since windows that try to
* position at 0,0 will get pushed down by menu panel
*/
MetaRectangle workarea;
meta_window_get_work_area_current_xinerama (window, &workarea);
if (meta_rectangle_contains_rect (&window->rect, &workarea))
return TRUE;
}
i = 0;
while (i < window->screen->n_xinerama_infos)
{
if (meta_rectangle_could_fit_rect (&window->rect,
&window->screen->xinerama_infos[i].rect))
{
MetaRectangle workarea;
meta_window_get_work_area_current_xinerama (window, &workarea);
if (meta_rectangle_contains_rect (&window->rect, &workarea))
return TRUE;
}
++i;
}
return FALSE;
}
static gboolean
is_focused_foreach (MetaWindow *window,
void *data)
@ -283,7 +247,7 @@ get_standalone_layer (MetaWindow *window)
if (window->wm_state_below)
layer = META_LAYER_BOTTOM;
else if ((window->fullscreen || window_is_fullscreen_size (window)) &&
else if (window->fullscreen &&
(focused_transient ||
window == window->display->expected_focus_window ||
window->display->expected_focus_window == NULL ||

View File

@ -701,6 +701,16 @@ meta_window_new_with_attrs (MetaDisplay *display,
meta_window_update_struts (window);
/* Must add window to stack before doing move/resize, since the
* window might have fullscreen size (i.e. should have been
* fullscreen'd; acrobat is one such braindead case; it withdraws
* and remaps its window whenever trying to become fullscreen...)
* and thus constraints may try to auto-fullscreen it which also
* means restacking it.
*/
meta_stack_add (window->screen->stack,
window);
/* Put our state back where it should be,
* passing TRUE for is_configure_request, ICCCM says
* initial map is handled same as configure request
@ -715,9 +725,6 @@ meta_window_new_with_attrs (MetaDisplay *display,
window->size_hints.width,
window->size_hints.height);
meta_stack_add (window->screen->stack,
window);
/* Now try applying saved stuff from the session */
{
const MetaWindowSessionInfo *info;
@ -2359,7 +2366,7 @@ meta_window_unmake_above (MetaWindow *window)
}
void
meta_window_make_fullscreen (MetaWindow *window)
meta_window_make_fullscreen_internal (MetaWindow *window)
{
if (!window->fullscreen)
{
@ -2379,12 +2386,20 @@ meta_window_make_fullscreen (MetaWindow *window)
meta_window_raise (window);
meta_stack_thaw (window->screen->stack);
recalc_window_features (window);
set_net_wm_state (window);
}
}
void
meta_window_make_fullscreen (MetaWindow *window)
{
if (!window->fullscreen)
{
meta_window_make_fullscreen_internal (window);
/* move_resize with new constraints
*/
meta_window_queue_move_resize (window);
recalc_window_features (window);
set_net_wm_state (window);
}
}

View File

@ -407,7 +407,7 @@ void meta_window_activate (MetaWindow *window,
void meta_window_activate_with_workspace (MetaWindow *window,
guint32 current_time,
MetaWorkspace *workspace);
void meta_window_make_fullscreen_internal (MetaWindow *window);
void meta_window_make_fullscreen (MetaWindow *window);
void meta_window_unmake_fullscreen (MetaWindow *window);