1
0
Fork 0
Commit graph

10 commits

Author SHA1 Message Date
Elijah Newren
ec51e41c62 Patch from Carlo Wood to do some miscellaneous code cleanups found while
2007-04-02  Elijah Newren  <newren gmail com>

	Patch from Carlo Wood to do some miscellaneous code cleanups found
	while working on #358311.

	* src/constraints.c (do_screen_and_xinerama_relative_constraints):
	nicer way of avoiding compilation warning

	* src/boxes.c (meta_rectangle_clamp_to_fit_into_region,
	  meta_rectangle_clip_to_region, meta_rectangle_shove_into_region):
	Much cleaner way of ignoring invalid boxes in comparisons

svn path=/trunk/; revision=3145
2007-04-03 18:40:00 +00:00
Elijah Newren
08f51fdf94 Patch from Carlo Wood to fix handling of unidirectional maximization and
2007-04-02  Elijah Newren  <newren gmail com>

	Patch from Carlo Wood to fix handling of unidirectional
	maximization and partial struts.  #358311.

	* src/constraints.c (constrain_maximization):
	determine target size for unidirectionally maximized windows by
	determining how far they can be maximized without hitting
	orthogonal struts.  Avoids weird "empty spaces".

	* src/boxes.[ch] (meta_rectangle_expand_to_avoiding_struts):
	new function

2007-04-02  Elijah Newren  <newren gmail com>

	Make the strut lists (stored in workspaces) record both the
	rectangle and the side that the strut is on.  Lots of code
	cleanups relating to struts.

	* src/boxes.h (struct MetaStrut):
	new struct for struts

	* src/window.[ch] (struct MetaStruts, struct MetaWindow,
	  meta_window_update_struts):
	overhaul to make window's struts remember their side as well as
	their rectangular location, and just use a list instead of several
	copies of near-identical code for left/right/top/bottom (allowing
	us to nuke MetaStruts struct as well)
	
	* src/testboxes.c (new_meta_strut, get_strut_list):
	* src/workspace.c (ensure_work_areas_validated):
	* src/boxes.c (meta_rectangle_get_minimal_spanning_set_for_region,
	  meta_rectangle_expand_to_avoiding_struts,
	  get_disjoint_strut_rect_list_in_region, fix_up_edges,
	  meta_rectangle_find_onscreen_edges,
	  meta_rectangle_find_nonintersected_xinerama_edges):
	modify to handle struts being rectangle + side instead of just rectangle

	* src/workspace.c (ensure_work_areas_validated):
	simplify strut list creation considerably given MetaWindow change,
	modify work_area computations to take advantage of region
	computations being done (makes the code shorter as well as more
	robust against pathological cases).

	* src/util.[ch] (meta_free_gslist_and_elements):
	new convenience function

	* src/common.h (enum MetaDirection):
	* src/edge-resistance.c (movement_towards_edge):
	* src/boxes.c (meta_rectangle_edge_aligns,
	  rectangle_and_edge_intersection, split_edge):
	Add more MetaDirection fields for convenience

	* src/boxes.h (enum FixedDirections):
	* src/constraints.c (setup_constraint_info, place_window_if_needed):
	add a FIXED_DIRECTION_NONE to the FixedDirections enum to make
	code more clear

svn path=/trunk/; revision=3144
2007-04-03 03:41:10 +00:00
Elijah Newren
0201fcfc6c Stick an emacs comment directive at the beginning of all the code files so
2006-10-01  Elijah Newren  <newren gmail com>

	* src/*.[ch]: Stick an emacs comment directive at the beginning of
	all the code files so that people using emacs will be more likely
	to get coding style correct in their patches.  We still need a
	similar vi directive.  #358866
2006-10-01 22:30:10 +00:00
Elijah Newren
57bedc42a4 Add a constrain_titlebar_visible constraint; should fix both bug 333328
2006-08-07  Elijah Newren  <newren gmail com>

	Add a constrain_titlebar_visible constraint; should fix both bug
	333328 and bug 345522.  Not perfect (minor annoying snap pulling
	windows back onscreen, plus an ugly hack almost as bad as the old
	one), but tarballs are due in less than half an hour.  ;-)

	* src/boxes.[ch] (meta_rectangle_overlaps_with_region):
	new function

	* src/constraints.c (constrain_titlebar_visible): new function,
	  (enum ConstraintPriority, array all_constraints,
	  update_onscreen_requirements): various small changes to
	  accomodate the new function

	* src/edge-resistance.c: remove the infinite edge resistance,
	which was a big hack of a way to workaround the lack of a
	titlebar_visible constraint

	* src/window.[ch] (MetaWindow): new require_titlebar_visible
	bitfield, (meta_window_new_with_attrs): initialized here
2006-08-07 23:34:55 +00:00
Elijah Newren
ef792fc1f7 Patch from Jens Granseuer to fix more build issues with gcc 2.95. #327050.
2006-01-15  Elijah Newren  <newren@gmail.com>

	Patch from Jens Granseuer to fix more build issues with gcc 2.95.
	#327050.

	* src/boxes.c (meta_rectangle_edge_cmp_ignore_type):
	* src/window.c (meta_window_show):
	Remove C99 style variable initiailization
2006-01-15 16:37:06 +00:00
Elijah Newren
5913b8c5ab Whoops, I forgot to keep my copyright info updated with my previous
2006-01-10  Elijah Newren  <newren@gmail.com>

	* src/bell.c:
	* src/boxes.c:
	* src/boxes.h:
	* src/constraints.c:
	* src/core.c:
	* src/display.c:
	* src/display.h:
	* src/edge-resistance.c:
	* src/frames.c:
	* src/keybindings.c:
	* src/main.c:
	* src/prefs.c:
	* src/prefs.h:
	* src/screen.c:
	* src/screen.h:
	* src/window.c:
	* src/window.h:
	Whoops, I forgot to keep my copyright info updated with my previous
	commits as Havoc had asked me to do.  Doing that now...
2006-01-10 19:43:21 +00:00
Elijah Newren
d884f9ce8a 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
2006-01-10 04:57:51 +00:00
Elijah Newren
9516694385 Allow edge resistance at both sides of a window and also when edges don't
2006-01-09  Elijah Newren  <newren@gmail.com>

	Allow edge resistance at both sides of a window and also when
	edges don't overlap but are a single pixel away from doing so.
	Fixes one of the zillions of issues covered in #321905.

	* src/boxes.[ch]:
	(meta_rectangle_edges_align):
	new function to handle the overlap or off by one determining
	whether edge resistance should kick in for an edge.

	(meta_rectangle_edge_cmp_ignore_type):
	new function to sort edges but ignore the type so that e.g. left &
	right edges of windows can be used interchangeably.

	(meta_rectangle_edge_cmp):
	now uses meta_rectangle_edge_cmp_ignore_type() to do most the work
	and just adds an extra condition

	* src/edge-resistance.c:
	(find_nearest_position):
	use meta_rectangle_edges_align() now to determine whether the
	edges align,

	(apply_edge_resistance, apply_edge_resistance_to_each_side):
	have the edge resistance kick in if either the beginning or ending
	positions would cause overlap in the given direction -- fixes an
	uncommon but annoying corner case,

	(apply_edge_snapping, apply_edge_resistance_to_each_side,
	 meta_display_cleanup_edges,
	 stupid_sort_requiring_extra_pointer_dereference, cache_edges):
	mix edges from both sides now
2006-01-10 04:33:58 +00:00
Elijah Newren
ebd0c7e9a6 Patch from Jens Granseuer to fix build with gcc 2.95. #322622.
2006-01-02  Elijah Newren  <newren@gmail.com>

	Patch from Jens Granseuer to fix build with gcc 2.95.  #322622.

	* src/boxes.c (meta_rectangle_region_to_string,
	  meta_rectangle_edge_list_to_string, fix_up_edges):
	* src/constraints.c (meta_window_constrain, setup_constraint_info,
	  place_window_if_needed, constrain_maximization,
	  constrain_fullscreen, constrain_size_increments,
	  constrain_size_limits, constrain_aspect_ratio,
	  do_screen_and_xinerama_relative_constrai,
	  constrain_to_single_xinerama, constrain_fully_onscreen,
	  constrain_partially_onscreen):
	* src/edge-resistance.c (find_nearest_position,
	  apply_edge_resistance, apply_edge_resistance_to_each_side):
	* src/testboxes.c (test_clamping_to_region,
	  test_clipping_to_region, test_shoving_into_region):
	* src/window.c (meta_window_new_with_attrs,
	  meta_window_apply_session_info, meta_window_resize,
	  meta_window_resize_with_gravity, meta_window_configure_request):
	Remove C99 style variable initiailization
2006-01-02 18:37:46 +00:00
Elijah Newren
a7201d27d1 Merge of all the changes on the constraints_experiments branch. This is
2005-11-18  Elijah Newren  <newren@gmail.com>

	Merge of all the changes on the constraints_experiments branch.
	This is just a summary, to get the full ChangeLog of those
	changes (approx. 2000 lines):
	  cvs -q -z3 update -Pd -r constraints_experiments
	  cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog

	Bugs fixed:
	  unfiled - constraints.c is overly complicated[1]
	  unfiled - constraints.c is not robust when all constraints
	            cannot simultaneously be met (constraints need to be
	            prioritized)
	  unfiled - keep-titlebar-onscreen constraint is decoration
	            unaware (since get_outermost_onscreen_positions()
	            forgets to include decorations)
	  unfiled - keyboard snap-moving and snap-resizing snap to hidden
	            edges
	   109553 - gravity w/ simultaneous move & resize doesn't work
	   113601 - maximize vertical and horizontal should toggle and be
	            constrained
	   122196 - windows show up under vertical panels
	   122670 - jerky/random resizing of window via keyboard[2]
	   124582 - keyboard and mouse snap-resizing and snap-moving
	            erroneously moves the window multidimensionally
	   136307 - don't allow apps to resize themselves off the screen
	            (*cough* filechooser *cough*)
	   142016, 143784 - windows should not span multiple xineramas
	            unless placed there by the user
	   143145 - clamp new windows to screensize and force them
	            onscreen, if they'll fit
	   144126 - Handle pathological strut lists sanely[3]
	   149867 - fixed aspect ratio windows are difficult to resize[4]
	   152898 - make screen edges consistent; allow easy slamming of
	            windows into the left, right, and bottom edges of the
	            screen too.
	   154706 - bouncing weirdness at screen edge with keyboard moving
	            or resizing
	   156699 - avoid struts when placing windows, if possible (nasty
	            a11y blocker)
	   302456 - dragging offscreen too restrictive
	   304857 - wireframe moving off the top of the screen is misleading
	   308521 - make uni-directional resizing easier with
	            alt-middle-drag and prevent the occasional super
	            annoying resize-the-wrong-side(s) behavior
	   312007 - snap-resize moves windows with a minimum size
	            constraint
	   312104 - resizing the top of a window can cause the bottom to
	            grow
	   319351 - don't instantly snap on mouse-move-snapping, remove
	            braindeadedness of having order of releasing shift and
	            releasing button press matter so much

	   [1] fixed in my opinion, anyway.
	   [2] Actually, it's not totally fixed--it's just annoying
	       instead of almost completely unusable.  Matthias had a
	       suggestion that may fix the remainder of the problems (see
	       http://tinyurl.com/bwzuu).
	   [3] This bug was originally about not-quite-so-pathological
	       cases but was left open for the worse cases. The code from
	       the branch handles the remainder of the cases mentioned in
	       this bug.
	   [4] Actually, although it's far better there's still some minor
	       issues left: a slight drift that's only noticeable after
	       lots of resizing, and potential problems with partially
	       onscreen constraints due to not clearing any
	       fixed_directions flags (aspect ratio windows get resized in
	       both directions and thus aren't fixed in one of them)

	New feature:
	    81704 - edge resistance for user move and resize operations;
	            in particular 3 different kinds of resistance are
	            implemented:
             	 Pixel-Distance: window movement is resisted when it
	     	   aligns with an edge unless the movement is greater than
	     	   a threshold number of pixels
             	 Timeout: window movement past an edge is prevented until
	     	   a certain amount of time has elapsed during the
	     	   operation since the first request to move it past that
	     	   edge
             	 Keyboard-Buildup: when moving or resizing with the
	     	   keyboard, once a window is aligned with a certain edge
	     	   it cannot move past until the correct direction has
	     	   been pressed enough times (e.g. 2 or 3 times)

	Major changes:
	  - constraints.c has been rewritten; very few lines of code from
	    the old version remain.  There is a comment near the top of
	    the function explaining the basics of how the new framework
	    works.  A more detailed explanation can be found in
	    doc/how-constraints-works.txt
	  - edge-resistance.[ch] are new files implementing edge-resistance.
	  - boxes.[ch] are new files containing low-level error-prone
	    functions used heavily in constraints.c and edge-resistance.c,
	    among various places throughout the code.  testboxes.c
	    contains a thorough testsuite for the boxes.[ch] functions
	    compiled into a program, testboxes.
	  - meta_window_move_resize_internal() *must* be told the gravity
	    of the associated operation (if it's just a move operation,
	    the gravity will be ignored, but for resize and move+resize
	    the correct value is needed)
	  - the craziness of different values that
	    meta_window_move_resize_internal() accepts has been documented
	    in a large comment at the beginning of the function.  It may
	    be possible to clean this up some, but until then things will
	    remain as they were before--caller beware.
	  - screen and xinerama usable areas (i.e. places not covered by
	    e.g. panels) are cached in the workspace now, as are the
	    screen and xinerama edges.  These get updated with the
	    workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 14:58:50 +00:00