summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElijah Newren <newren@gmail.com>2005-10-23 06:44:11 +0000
committerElijah Newren <newren@src.gnome.org>2005-10-23 06:44:11 +0000
commit290fad0783714056618d13530163d3bf380381bb (patch)
treec27806a348edd801d5e585ede303ebee2e34bb94
parent2c9463569448d4556f3bfb0ef88bdf1af2dd0a00 (diff)
downloadmetacity-290fad0783714056618d13530163d3bf380381bb.tar.gz
Various tiny cleanups
2005-10-23 Elijah Newren <newren@gmail.com> Various tiny cleanups * constraints-ideas.txt: Update for little things fixed, reminder that documentation needs to be updated * src/constraints.c (struct ConstraintInfo, setup_constraint_info): remove work_area_screen member as it isn't used, (constrain_size_limits, constrain_partially_onscreen): use the CLAMP() macro instead of trying to use both MIN and MAX to manually implement it, (do_screen_and_xinerama_relative_constraints): shut the stupid compiler up, (constrain_to_single_xinerama): don't apply this constraint unless we have a multiple xinerama setup * src/window.c (meta_window_move_resize_internal): clean up the huge comment by noting that two of the five cases were actually the same
-rw-r--r--ChangeLog20
-rw-r--r--constraints-ideas.txt14
-rw-r--r--src/constraints.c25
-rw-r--r--src/window.c25
4 files changed, 47 insertions, 37 deletions
diff --git a/ChangeLog b/ChangeLog
index e1d7bdd0..0ff49386 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,23 @@
+2005-10-23 Elijah Newren <newren@gmail.com>
+
+ Various tiny cleanups
+
+ * constraints-ideas.txt: Update for little things fixed, reminder
+ that documentation needs to be updated
+
+ * src/constraints.c (struct ConstraintInfo,
+ setup_constraint_info): remove work_area_screen member as it isn't
+ used, (constrain_size_limits, constrain_partially_onscreen): use
+ the CLAMP() macro instead of trying to use both MIN and MAX to
+ manually implement it,
+ (do_screen_and_xinerama_relative_constraints): shut the stupid
+ compiler up, (constrain_to_single_xinerama): don't apply this
+ constraint unless we have a multiple xinerama setup
+
+ * src/window.c (meta_window_move_resize_internal): clean up the
+ huge comment by noting that two of the five cases were actually
+ the same
+
2005-10-22 Elijah Newren <newren@gmail.com>
Make maximize_vertically and maximize_horizontally toggle and be
diff --git a/constraints-ideas.txt b/constraints-ideas.txt
index 2a0ab5f2..06b545a1 100644
--- a/constraints-ideas.txt
+++ b/constraints-ideas.txt
@@ -1,13 +1,16 @@
Short-term (I hope...) TODO list/reminders:
+ - Need to update the documentation; the huge comment is out of date and
+ misleading now
+
- Quicklist that I thought of:
- Titlebar onscreen func should use CLAMP(percent*width, 10, 75) for
width and 2-3 pixels for height for checking if the titlebar is
partially onscreen or not
- - on-single-xinerama constraint should not apply if only 1 xinerama
+ X on-single-xinerama constraint should not apply if only 1 xinerama
exists
- - use CLAMP() macro in more places of constraints.c
- - Two of meta_window_move_resize_internal() calling methods in huge
+ X use CLAMP() macro in more places of constraints.c
+ X Two of meta_window_move_resize_internal() calling methods in huge
comment are actually the same; search for "bogus" and "BEFORE"
X There may be a bug with gravity an onscreen constraints--it seems
that creating a tab then removing it and repeating this a lot made
@@ -70,9 +73,10 @@ Short-term (I hope...) TODO list/reminders:
- Need to do the titlebar offscreen checking, partial maximization, etc.
- - It looks like I can nuke work_area_screen in ConstraintInfo
+ X It looks like I can nuke work_area_screen in ConstraintInfo
- - Do I need the include_frame parameter to get_size_limits() anymore?
+ X Do I need the include_frame parameter to get_size_limits() anymore?
+ (Update: yes, do_screen_and_xinerama_relative_constraints() uses it)
X Ought to rewrite adjust_for_gravity to do less and then just use
meta_rectangle_resize_with_gravity()
diff --git a/src/constraints.c b/src/constraints.c
index abb6ed75..694a7ba2 100644
--- a/src/constraints.c
+++ b/src/constraints.c
@@ -262,11 +262,9 @@ typedef struct
FixedDirections fixed_directions;
/* work_area_xinerama - current xinerama region minus struts
- * work_area_screen - entire screen (all xineramas) minus struts
* entire_xinerama - current xienrama, including strut regions
*/
MetaRectangle work_area_xinerama;
- MetaRectangle work_area_screen;
MetaRectangle entire_xinerama;
} ConstraintInfo;
@@ -584,7 +582,6 @@ setup_constraint_info (ConstraintInfo *info,
}
meta_window_get_work_area_current_xinerama (window, &info->work_area_xinerama);
- meta_window_get_work_area_all_xineramas (window, &info->work_area_screen);
const MetaXineramaScreenInfo *xinerama_info =
meta_screen_get_xinerama_for_window (window->screen, window);
@@ -604,7 +601,6 @@ setup_constraint_info (ConstraintInfo *info,
" resize_gravity : %s\n"
" fixed_directions: %s\n"
" work_area_xinerama: %d,%d +%d,%d\n"
- " work_area_screen : %d,%d +%d,%d\n"
" entire_xinerama : %d,%d +%d,%d\n",
info->orig.x, info->orig.y, info->orig.width, info->orig.height,
info->current.x, info->current.y,
@@ -624,8 +620,6 @@ setup_constraint_info (ConstraintInfo *info,
info->work_area_xinerama.x, info->work_area_xinerama.y,
info->work_area_xinerama.width,
info->work_area_xinerama.height,
- info->work_area_screen.x, info->work_area_screen.y,
- info->work_area_screen.width, info->work_area_screen.height,
info->entire_xinerama.x, info->entire_xinerama.y,
info->entire_xinerama.width, info->entire_xinerama.height);
}
@@ -982,10 +976,9 @@ constrain_size_limits (MetaWindow *window,
return constraint_already_satisfied;
/*** Enforce constraint ***/
- int new_width = MIN (max_size.width,
- MAX (min_size.width, info->current.width));
- int new_height = MIN (max_size.height,
- MAX (min_size.height, info->current.height));
+ int new_width, new_height;
+ new_width = CLAMP (info->current.width, min_size.width, max_size.width);
+ new_height = CLAMP (info->current.height, min_size.height, max_size.height);
meta_rectangle_resize_with_gravity (&info->orig,
&info->current,
info->resize_gravity,
@@ -1129,6 +1122,7 @@ do_screen_and_xinerama_relative_constraints (
/* First, log some debugging information */
char spanning_region[1 + 28 * g_list_length (region_spanning_rectangles)];
+ (void) spanning_region; /* Avoid stupid & incorrect compiler warnings... */
meta_topic (META_DEBUG_GEOMETRY,
"screen/xinerama constraint; region_spanning_rectangles: %s\n"
meta_rectangle_region_to_string (region_spanning_rectangles, ", ",
@@ -1257,9 +1251,10 @@ constrain_to_single_xinerama (MetaWindow *window,
* is only meant for normal windows (e.g. we don't want docks to be shoved
* "onscreen" by their own strut).
*/
- if (window->type == META_WINDOW_DESKTOP ||
- window->type == META_WINDOW_DOCK ||
- !window->require_on_single_xinerama ||
+ if (window->type == META_WINDOW_DESKTOP ||
+ window->type == META_WINDOW_DOCK ||
+ window->screen->n_xinerama_infos == 1 ||
+ !window->require_on_single_xinerama ||
info->is_user_action)
return TRUE;
@@ -1342,8 +1337,8 @@ constrain_partially_onscreen (MetaWindow *window,
*/
int horiz_amount = info->current.width / 4;
int vert_amount = info->current.height / 4;
- horiz_amount = MAX (10, MIN (75, horiz_amount));
- vert_amount = MAX (10, MIN (75, vert_amount));
+ horiz_amount = CLAMP (horiz_amount, 10, 75);
+ vert_amount = CLAMP (vert_amount, 10, 75);
horiz_amount = info->current.width - horiz_amount;
vert_amount = info->current.height - vert_amount;
diff --git a/src/window.c b/src/window.c
index 56b185ed..9b749117 100644
--- a/src/window.c
+++ b/src/window.c
@@ -2532,9 +2532,8 @@ meta_window_move_resize_internal (MetaWindow *window,
* gravity will remain fixed. Kinda confusing, but it was stuff
* written by someone else and it all seems to all work, though, so
* I'm just not going to touch this code if I can help it.
- * (3) Desired positon of the NW corner of the inner window (*)
- * (4) Position of the NW corner of inner window BEFORE the resize
- * (5) Some unnatural nasty mixture of the above that is obscene and
+ * (3) Desired positon of the NW corner of the inner window
+ * (4) Some unnatural nasty mixture of the above that is obscene and
* broken and we don't even attempt to fix up; but it's #ifdef'd
* out so we don't worry about it. It needs to be fixed (not this
* function) before it really is used, though.
@@ -2551,22 +2550,14 @@ meta_window_move_resize_internal (MetaWindow *window,
* 3 | meta_window_resize (UserAction || 0; NorthWest)
* 3 | meta_window_move (UserAction || 0; NorthWest)
* 3 | meta_window_move_resize (UserAction || 0; NorthWest)
- * 4 | meta_window_resize_with_gravity (UserAction || 0; gravity)
- * 5 | various functions via handle_net_moveresize_window() in display.c
+ * 4 | various functions via handle_net_moveresize_window() in display.c
* 2 | ConfigureRequest (ConfigureRequest; gravity)
*
- * Other than the (5) case, this is all cleaned up via use of
- * adjust_for_gravity() to turn all (2) cases into (3) and
- * meta_rectangle_resize_with_gravity() to turn the (4) case into
- * (3) so that all position and size fields correspond to the
- * desired inner (or "client") window position.
- *
- * (*) Note: Technically, you could consider (3) as part of (4)
- * since in all cases that (3) is used it is used with
- * NorthWestGravity. However, one usually thinks that a function
- * called meta_window_move_resize_internal() is going to want the
- * NEW position and size, and it kind of does for (2) and does for
- * (3). I was just pointing out that (4) is weird.
+ * Other than the (4) case, this is all cleaned up via use of
+ * meta_rectangle_resize_with_gravity() to turn type (1) cases into type
+ * (3) and the use of adjust_for_gravity() to turn all (2) cases into
+ * (3). This makes it so that all position and size fields correspond to
+ * the desired inner (or "client") window position.
*/
XWindowChanges values;
unsigned int mask;