Be more strict about what is considered a valid region with partial
2006-01-09 Elijah Newren <newren@gmail.com> Be more strict about what is considered a valid region with partial struts. Fixes #322070. * src/boxes.[ch]: (meta_rectangle_expand_region_conditionally): new function behaving like meta_rectangle_expand_region() but which only does so when the width and height of the rectangles meet a certain threshold (replace_rect_with_list): Remove a compiling warning * src/constraints.c: (constrain_partially_onscreen): provide minimum thresholds in each direction for the size of the rectangles to avoid cases where only a single pixel thick layer of a window might be showing
This commit is contained in:
parent
ee54debd6a
commit
d884f9ce8a
20
ChangeLog
20
ChangeLog
@ -1,3 +1,23 @@
|
|||||||
|
2006-01-09 Elijah Newren <newren@gmail.com>
|
||||||
|
|
||||||
|
Be more strict about what is considered a valid region with
|
||||||
|
partial struts. Fixes #322070.
|
||||||
|
|
||||||
|
* src/boxes.[ch]:
|
||||||
|
(meta_rectangle_expand_region_conditionally):
|
||||||
|
new function behaving like meta_rectangle_expand_region() but
|
||||||
|
which only does so when the width and height of the rectangles
|
||||||
|
meet a certain threshold
|
||||||
|
|
||||||
|
(replace_rect_with_list):
|
||||||
|
Remove a compiling warning
|
||||||
|
|
||||||
|
* src/constraints.c:
|
||||||
|
(constrain_partially_onscreen):
|
||||||
|
provide minimum thresholds in each direction for the size of the
|
||||||
|
rectangles to avoid cases where only a single pixel thick layer of
|
||||||
|
a window might be showing
|
||||||
|
|
||||||
2006-01-09 Elijah Newren <newren@gmail.com>
|
2006-01-09 Elijah Newren <newren@gmail.com>
|
||||||
|
|
||||||
* src/bell.c (meta_bell_notify_frame_destroy): Use the right
|
* src/bell.c (meta_bell_notify_frame_destroy): Use the right
|
||||||
|
28
src/boxes.c
28
src/boxes.c
@ -622,15 +622,38 @@ meta_rectangle_expand_region (GList *region,
|
|||||||
const int top_expand,
|
const int top_expand,
|
||||||
const int bottom_expand)
|
const int bottom_expand)
|
||||||
{
|
{
|
||||||
/* Now it's time to do the directional expansion */
|
return meta_rectangle_expand_region_conditionally (region,
|
||||||
|
left_expand,
|
||||||
|
right_expand,
|
||||||
|
top_expand,
|
||||||
|
bottom_expand,
|
||||||
|
0,
|
||||||
|
0);
|
||||||
|
}
|
||||||
|
|
||||||
|
GList*
|
||||||
|
meta_rectangle_expand_region_conditionally (GList *region,
|
||||||
|
const int left_expand,
|
||||||
|
const int right_expand,
|
||||||
|
const int top_expand,
|
||||||
|
const int bottom_expand,
|
||||||
|
const int min_x,
|
||||||
|
const int min_y)
|
||||||
|
{
|
||||||
GList *tmp_list = region;
|
GList *tmp_list = region;
|
||||||
while (tmp_list)
|
while (tmp_list)
|
||||||
{
|
{
|
||||||
MetaRectangle *rect = (MetaRectangle*) tmp_list->data;
|
MetaRectangle *rect = (MetaRectangle*) tmp_list->data;
|
||||||
|
if (rect->width >= min_x)
|
||||||
|
{
|
||||||
rect->x -= left_expand;
|
rect->x -= left_expand;
|
||||||
rect->width += (left_expand + right_expand);
|
rect->width += (left_expand + right_expand);
|
||||||
|
}
|
||||||
|
if (rect->height >= min_y)
|
||||||
|
{
|
||||||
rect->y -= top_expand;
|
rect->y -= top_expand;
|
||||||
rect->height += (top_expand + bottom_expand);
|
rect->height += (top_expand + bottom_expand);
|
||||||
|
}
|
||||||
tmp_list = tmp_list->next;
|
tmp_list = tmp_list->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1091,8 +1114,7 @@ replace_rect_with_list (GList *old_element,
|
|||||||
if (!new_list)
|
if (!new_list)
|
||||||
{
|
{
|
||||||
/* If there is no new list, just remove the old_element */
|
/* If there is no new list, just remove the old_element */
|
||||||
ret = old_element->next;
|
ret = g_list_remove_link (old_element, old_element);
|
||||||
g_list_remove_link (old_element, old_element);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
12
src/boxes.h
12
src/boxes.h
@ -146,11 +146,23 @@ GList* meta_rectangle_get_minimal_spanning_set_for_region (
|
|||||||
const MetaRectangle *basic_rect,
|
const MetaRectangle *basic_rect,
|
||||||
const GSList *all_struts);
|
const GSList *all_struts);
|
||||||
|
|
||||||
|
/* Expand all rectangles in region by the given amount on each side */
|
||||||
GList* meta_rectangle_expand_region (GList *region,
|
GList* meta_rectangle_expand_region (GList *region,
|
||||||
const int left_expand,
|
const int left_expand,
|
||||||
const int right_expand,
|
const int right_expand,
|
||||||
const int top_expand,
|
const int top_expand,
|
||||||
const int bottom_expand);
|
const int bottom_expand);
|
||||||
|
/* Same as for meta_rectangle_expand_region except that rectangles not at
|
||||||
|
* least min_x or min_y in size are not expanded in that direction
|
||||||
|
*/
|
||||||
|
GList* meta_rectangle_expand_region_conditionally (
|
||||||
|
GList *region,
|
||||||
|
const int left_expand,
|
||||||
|
const int right_expand,
|
||||||
|
const int top_expand,
|
||||||
|
const int bottom_expand,
|
||||||
|
const int min_x,
|
||||||
|
const int min_y);
|
||||||
|
|
||||||
/* Free the list created by
|
/* Free the list created by
|
||||||
* meta_rectangle_get_minimal_spanning_set_for_region()
|
* meta_rectangle_get_minimal_spanning_set_for_region()
|
||||||
|
@ -1046,7 +1046,9 @@ constrain_partially_onscreen (MetaWindow *window,
|
|||||||
gboolean check_only)
|
gboolean check_only)
|
||||||
{
|
{
|
||||||
gboolean retval;
|
gboolean retval;
|
||||||
int top_amount, bottom_amount, horiz_amount, vert_amount;
|
int top_amount, bottom_amount;
|
||||||
|
int horiz_amount_offscreen, vert_amount_offscreen;
|
||||||
|
int horiz_amount_onscreen, vert_amount_onscreen;
|
||||||
|
|
||||||
if (priority > PRIORITY_PARTIALLY_VISIBLE_ON_WORKAREA)
|
if (priority > PRIORITY_PARTIALLY_VISIBLE_ON_WORKAREA)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -1066,39 +1068,46 @@ constrain_partially_onscreen (MetaWindow *window,
|
|||||||
* Then, the amount that is allowed off is just the window size minus
|
* Then, the amount that is allowed off is just the window size minus
|
||||||
* this amount.
|
* this amount.
|
||||||
*/
|
*/
|
||||||
horiz_amount = info->current.width / 4;
|
horiz_amount_onscreen = info->current.width / 4;
|
||||||
vert_amount = info->current.height / 4;
|
vert_amount_onscreen = info->current.height / 4;
|
||||||
horiz_amount = CLAMP (horiz_amount, 10, 75);
|
horiz_amount_onscreen = CLAMP (horiz_amount_onscreen, 10, 75);
|
||||||
vert_amount = CLAMP (vert_amount, 10, 75);
|
vert_amount_onscreen = CLAMP (vert_amount_onscreen, 10, 75);
|
||||||
horiz_amount = info->current.width - horiz_amount;
|
horiz_amount_offscreen = info->current.width - horiz_amount_onscreen;
|
||||||
vert_amount = info->current.height - vert_amount;
|
vert_amount_offscreen = info->current.height - vert_amount_onscreen;
|
||||||
top_amount = vert_amount;
|
top_amount = vert_amount_offscreen;
|
||||||
/* Allow the titlebar to touch the bottom panel; If there is no titlebar,
|
/* Allow the titlebar to touch the bottom panel; If there is no titlebar,
|
||||||
* require vert_amount to remain on the screen.
|
* require vert_amount to remain on the screen.
|
||||||
*/
|
*/
|
||||||
if (window->frame)
|
if (window->frame)
|
||||||
|
{
|
||||||
bottom_amount = info->current.height + info->fgeom->bottom_height;
|
bottom_amount = info->current.height + info->fgeom->bottom_height;
|
||||||
|
vert_amount_onscreen = info->fgeom->top_height;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
bottom_amount = vert_amount;
|
bottom_amount = vert_amount_offscreen;
|
||||||
|
|
||||||
/* Extend the region, have a helper function handle the constraint,
|
/* Extend the region, have a helper function handle the constraint,
|
||||||
* then return the region to its original size.
|
* then return the region to its original size.
|
||||||
*/
|
*/
|
||||||
meta_rectangle_expand_region (info->usable_screen_region,
|
meta_rectangle_expand_region_conditionally (info->usable_screen_region,
|
||||||
horiz_amount,
|
horiz_amount_offscreen,
|
||||||
horiz_amount,
|
horiz_amount_offscreen,
|
||||||
top_amount,
|
top_amount,
|
||||||
bottom_amount);
|
bottom_amount,
|
||||||
|
horiz_amount_onscreen,
|
||||||
|
vert_amount_onscreen);
|
||||||
retval =
|
retval =
|
||||||
do_screen_and_xinerama_relative_constraints (window,
|
do_screen_and_xinerama_relative_constraints (window,
|
||||||
info->usable_screen_region,
|
info->usable_screen_region,
|
||||||
info,
|
info,
|
||||||
check_only);
|
check_only);
|
||||||
meta_rectangle_expand_region (info->usable_screen_region,
|
meta_rectangle_expand_region_conditionally (info->usable_screen_region,
|
||||||
-horiz_amount,
|
-horiz_amount_offscreen,
|
||||||
-horiz_amount,
|
-horiz_amount_offscreen,
|
||||||
-top_amount,
|
-top_amount,
|
||||||
-bottom_amount);
|
-bottom_amount,
|
||||||
|
horiz_amount_onscreen,
|
||||||
|
vert_amount_onscreen);
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user