350
350
else if (flags & META_IS_RESIZE_ACTION)
351
351
info->action_type = ACTION_RESIZE;
352
352
else if (flags & META_IS_MOVE_ACTION)
353
info->action_type = ACTION_MOVE_AND_RESIZE;
353
info->action_type = ACTION_MOVE;
355
355
g_error ("BAD, BAD developer! No treat for you! (Fix your calls to "
356
356
"meta_window_move_resize_internal()).\n");
365
365
* and (b) ignored it for aspect ratio windows -- at least in those
366
366
* cases where both directions do actually change size.
368
info->fixed_directions = 0;
368
info->fixed_directions = FIXED_DIRECTION_NONE;
369
369
/* If x directions don't change but either y direction does */
370
370
if ( orig->x == new->x && orig->x + orig->width == new->x + new->width &&
371
371
(orig->y != new->y || orig->y + orig->height != new->y + new->height))
385
385
* aren't explicit user interaction, though, so just clear it out.
387
387
if (!info->is_user_action)
388
info->fixed_directions = 0;
388
info->fixed_directions = FIXED_DIRECTION_NONE;
391
391
meta_screen_get_xinerama_for_rect (window->screen, &info->current);
441
441
"Freakin' Invalid Stupid",
442
442
(info->is_user_action) ? "true" : "false",
443
443
meta_gravity_to_string (info->resize_gravity),
444
(info->fixed_directions == 0) ? "None" :
444
(info->fixed_directions == FIXED_DIRECTION_NONE) ? "None" :
445
445
(info->fixed_directions == FIXED_DIRECTION_X) ? "X fixed" :
446
446
(info->fixed_directions == FIXED_DIRECTION_Y) ? "Y fixed" :
447
447
"Freakin' Invalid Stupid",
691
691
ConstraintPriority priority,
692
692
gboolean check_only)
694
MetaRectangle min_size, max_size, work_area;
694
MetaRectangle target_size;
695
MetaRectangle min_size, max_size;
695
696
gboolean hminbad, vminbad;
696
697
gboolean horiz_equal, vert_equal;
697
698
gboolean constraint_already_satisfied;
703
704
if (!window->maximized_horizontally && !window->maximized_vertically)
706
work_area = info->work_area_xinerama;
707
unextend_by_frame (&work_area, info->fgeom);
707
/* Calculate target_size = maximized size of (window + frame) */
708
if (window->maximized_horizontally && window->maximized_vertically)
709
target_size = info->work_area_xinerama;
712
/* Amount of maximization possible in a single direction depends
713
* on which struts could occlude the window given its current
714
* position. For example, a vertical partial strut on the right
715
* is only relevant for a horizontally maximized window when the
716
* window is at a vertical position where it could be occluded
717
* by that partial strut.
719
MetaDirection direction;
720
GSList *active_workspace_struts;
722
if (window->maximized_horizontally)
723
direction = META_DIRECTION_HORIZONTAL;
725
direction = META_DIRECTION_VERTICAL;
726
active_workspace_struts = window->screen->active_workspace->all_struts;
728
target_size = info->current;
729
extend_by_frame (&target_size, info->fgeom);
730
meta_rectangle_expand_to_avoiding_struts (&target_size,
731
&info->entire_xinerama,
733
active_workspace_struts);
735
/* Now make target_size = maximized size of client window */
736
unextend_by_frame (&target_size, info->fgeom);
738
/* Check min size constraints; max size constraints are ignored for maximized
739
* windows, as per bug 327543.
708
741
get_size_limits (window, info->fgeom, FALSE, &min_size, &max_size);
710
hminbad = work_area.width < min_size.width && window->maximized_horizontally;
711
vminbad = work_area.height < min_size.height && window->maximized_vertically;
742
hminbad = target_size.width < min_size.width && window->maximized_horizontally;
743
vminbad = target_size.height < min_size.height && window->maximized_vertically;
712
744
if (hminbad || vminbad)
715
747
/* Determine whether constraint is already satisfied; exit if it is */
716
horiz_equal = work_area.x == info->current.x &&
717
work_area.width == info->current.width;
718
vert_equal = work_area.y == info->current.y &&
719
work_area.height == info->current.height;
748
horiz_equal = target_size.x == info->current.x &&
749
target_size.width == info->current.width;
750
vert_equal = target_size.y == info->current.y &&
751
target_size.height == info->current.height;
720
752
constraint_already_satisfied =
721
753
(horiz_equal || !window->maximized_horizontally) &&
722
754
(vert_equal || !window->maximized_vertically);
726
758
/*** Enforce constraint ***/
727
759
if (window->maximized_horizontally)
729
info->current.x = work_area.x;
730
info->current.width = work_area.width;
761
info->current.x = target_size.x;
762
info->current.width = target_size.width;
732
764
if (window->maximized_vertically)
734
info->current.y = work_area.y;
735
info->current.height = work_area.height;
766
info->current.y = target_size.y;
767
info->current.height = target_size.height;
777
809
gboolean check_only)
779
811
int bh, hi, bw, wi, extra_height, extra_width;
812
int new_width, new_height;
780
813
gboolean constraint_already_satisfied;
782
815
if (priority > PRIORITY_SIZE_HINTS_INCREMENTS)
794
827
wi = window->size_hints.width_inc;
795
828
extra_height = (info->current.height - bh) % hi;
796
829
extra_width = (info->current.width - bw) % wi;
830
/* ignore size increments for maximized windows */
797
831
if (window->maximized_horizontally)
798
832
extra_width *= 0;
799
833
if (window->maximized_vertically)
800
834
extra_height *= 0;
835
/* constraint is satisfied iff there is no extra height or width */
801
836
constraint_already_satisfied =
802
837
(extra_height == 0 && extra_width == 0);
805
840
return constraint_already_satisfied;
807
842
/*** Enforce constraint ***/
808
/* Shrink to base + N * inc */
843
new_width = info->current.width - extra_width;
844
new_height = info->current.height - extra_height;
846
/* Adjusting down instead of up (as done in the above two lines) may
847
* violate minimum size constraints; fix the adjustment if this
850
if (new_width < window->size_hints.min_width)
851
new_width += ((window->size_hints.min_width - new_width)/wi + 1)*wi;
852
if (new_height < window->size_hints.min_height)
853
new_height += ((window->size_hints.min_height - new_height)/hi + 1)*hi;
855
/* Resize to the new size */
809
856
meta_rectangle_resize_with_gravity (&info->orig,
811
858
info->resize_gravity,
812
info->current.width - extra_width,
813
info->current.height - extra_height);
994
1041
gboolean exit_early = FALSE, constraint_satisfied;
995
1042
MetaRectangle how_far_it_can_be_smushed, min_size, max_size;
1044
#ifdef WITH_VERBOSE_MODE
997
1045
/* First, log some debugging information */
998
1046
char spanning_region[1 + 28 * g_list_length (region_spanning_rectangles)];
999
(void) spanning_region; /* Avoid stupid & incorrect compiler warnings... */
1000
1048
meta_topic (META_DEBUG_GEOMETRY,
1001
1049
"screen/xinerama constraint; region_spanning_rectangles: %s\n",
1002
1050
meta_rectangle_region_to_string (region_spanning_rectangles, ", ",
1003
1051
spanning_region));
1005
1054
/* Determine whether constraint applies; exit if it doesn't */
1006
1055
how_far_it_can_be_smushed = info->current;