From b26f60f42536787126bbf050b84b53b69eaa4292 Mon Sep 17 00:00:00 2001 From: Elijah Newren Date: Wed, 19 Oct 2005 18:28:48 +0000 Subject: Update things fixed, list new bug that I previously forgot 2005-10-19 Elijah Newren * constraints-ideas.txt: Update things fixed, list new bug that I previously forgot * src/boxes.c (rect2String): remove this function, (meta_rectangle_get_minimal_spanning_set_for_region, merge_spanning_rects_in_region): use meta_rectangle_to_string() and meta_rectangle_region_to_string() instead of manually printing out rectangles or using print_rect_list(). * src/boxes.h (meta_rectangle_to_string): correct comment above this function about the size of the string needed to hold the output * src/window.c (meta_window_configure_request): only try to move/resize the window if part of the configure request included a move or resize request, (update_resize): point out stupidity of the function due to meta_window_update_wireframe() not taking or making use of gravity, don't allow supposed North/South resizes during META_GRAB_OP_RESIZING_(E|W) and vice versa, don't call meta_window_resize_with_gravity() if we don't have a different size to specify --- ChangeLog | 24 ++++++++++++++++++ constraints-ideas.txt | 21 +++++++++++----- src/boxes.c | 68 +++++++++++++++++++++++++-------------------------- src/boxes.h | 2 +- src/window.c | 51 +++++++++++++++++++++++++++++--------- 5 files changed, 112 insertions(+), 54 deletions(-) diff --git a/ChangeLog b/ChangeLog index d1960223..d652da81 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,27 @@ +2005-10-19 Elijah Newren + + * constraints-ideas.txt: Update things fixed, list new bug that I + previously forgot + + * src/boxes.c (rect2String): remove this function, + (meta_rectangle_get_minimal_spanning_set_for_region, + merge_spanning_rects_in_region): use meta_rectangle_to_string() + and meta_rectangle_region_to_string() instead of manually printing + out rectangles or using print_rect_list(). + + * src/boxes.h (meta_rectangle_to_string): correct comment above + this function about the size of the string needed to hold the + output + + * src/window.c (meta_window_configure_request): only try to + move/resize the window if part of the configure request included a + move or resize request, (update_resize): point out stupidity of + the function due to meta_window_update_wireframe() not taking or + making use of gravity, don't allow supposed North/South resizes + during META_GRAB_OP_RESIZING_(E|W) and vice versa, don't call + meta_window_resize_with_gravity() if we don't have a different + size to specify + 2005-10-19 Elijah Newren Update docs, fix up the require onscreen/on-single-xinerama flag diff --git a/constraints-ideas.txt b/constraints-ideas.txt index 216ab59b..482c81b0 100644 --- a/constraints-ideas.txt +++ b/constraints-ideas.txt @@ -1,15 +1,18 @@ Short-term (I hope...) TODO list/reminders: - Brokenness left in aspect-ratio resizing: - - gtk+ seems to be doing nit-picky fighting with us over which way to + X gtk+ seems to be doing nit-picky fighting with us over which way to round the size. This means that if the user increases the width of an aspect-ratio'ed window, we increase the height of the window in a way that keeps the center fixed, gtk+ doesn't like our selected size and sends a configure request, and then we resize the window to the configure request size using NorthWestGravity instead of WestGravity--resulting in the window drifting slightly either upward - or downward. sucks. - ! Why not just ignore configure requests? + or downward. Can also result in heavy flickering sometimes. sucks. + *UPDATE*: It wasn't gtk+ -- it was window.c:update_resize() causing + all the flickering that I saw. However, this configure request stuff + doesn't appear to be the cause of the drift... + - There's still a drift... - Interplay between various onscreen constraints is not very good (resizing should stop when any window edge hits the screen edge, instead of arbitrarily clipping that edge). Similar problems @@ -20,6 +23,11 @@ Short-term (I hope...) TODO list/reminders: that. Some care will be needed, e.g. for East/West/North/South gravity where some sides only get increase/2 amount of change instead of increase + - Doesn't work well with fixed sides--if the aspect ratio needs to + be enforced, then fixed_directsion should be set to 0. (Also, + fixed_directions should probably be reset to its former nonzero + value if all constraints couldn't be satisfied + simultaneously...) - edge resistance need not be much different than the current code that exists for the keyboard except that (a) only non-covered edges should @@ -34,9 +42,6 @@ Short-term (I hope...) TODO list/reminders: - Need to add a test_find_closest_linepoint to testboxes.c to test that function nice and thoroughly. - - Clicking on an XMMS window causes a failed assertion due to unfixed - FIXME in meta_window_configure_request() - - Ought to rewrite adjust_for_gravity to do less and then just use meta_rectangle_resize_with_gravity() - This appears to be related to the breakage of testgravity; @@ -61,6 +66,10 @@ Short-term (I hope...) TODO list/reminders: - Do I need the include_frame parameter to get_size_limits() anymore? + X Clicking on an XMMS window causes a failed assertion due to unfixed + FIXME in meta_window_configure_request() (Problem was that we tried to + call meta_window_move_resize_internal() on restack configure requests) + X Once the window goes offscreen, clicking on the edge in order to resize results in all kinds of weirdness: clipping the window to the screen, sending the window totally and completely offscreen, or who knows what diff --git a/src/boxes.c b/src/boxes.c index 61166775..41996e4c 100644 --- a/src/boxes.c +++ b/src/boxes.c @@ -34,22 +34,6 @@ * any issues crop up. */ /* #define PRINT_DEBUG */ -#ifdef PRINT_DEBUG -static const char* -rect2String (const MetaRectangle *rect) -{ - static char* little_string = NULL; - - if (little_string == NULL) - little_string = g_new(char, 100); - - sprintf(little_string, - "%d,%d +%d,%d", - rect->x, rect->y, rect->width, rect->height); - - return little_string; -} -#endif char* meta_rectangle_to_string (const MetaRectangle *rect, @@ -310,10 +294,13 @@ merge_spanning_rects_in_region (GList *region) g_assert (region); #ifdef PRINT_DEBUG + char spanning_region[1 + 28 * g_list_length (region)]; + char rect1_string[25]; + char rect2_string[25]; printf ("Merging stats:\n"); printf (" Length of initial list: %d\n", g_list_length (region)); - printf (" Initial rectangles:\n"); - print_rect_list (region, " "); + printf (" Initial rectangles: %s\n", + meta_rectangle_region_to_string (region, ", ", spanning_region)); #endif while (compare && compare->next) @@ -331,9 +318,9 @@ merge_spanning_rects_in_region (GList *region) g_assert (b->width > 0 && b->height > 0); #ifdef PRINT_DEBUG - printf (" -- Comparing %d,%d +%d,%d to %d,%d + %d,%d --\n", - a->x, a->y, a->width, a->height, - b->x, b->y, b->width, b->height); + printf (" -- Comparing %s to %s --\n", + meta_rectangle_to_string (a, rect1_string), + meta_rectangle_to_string (b, rect2_string)); #endif /* If a contains b, just remove b */ @@ -418,8 +405,8 @@ merge_spanning_rects_in_region (GList *region) { #ifdef PRINT_DEBUG MetaRectangle *bla = delete_me->data; - printf (" Deleting rect %d,%d +%d,%d\n", - bla->x, bla->y, bla->width, bla->height); + printf (" Deleting rect %s\n", + meta_rectangle_to_string (bla, rect1_string)); #endif /* Deleting the rect we compare others to is a little tricker */ @@ -436,8 +423,9 @@ merge_spanning_rects_in_region (GList *region) } #ifdef PRINT_DEBUG - printf (" After comparison, new list is:\n"); - print_rect_list (region, " "); + char new_list[1 + 28 * g_list_length (region)]; + printf (" After comparison, new list is: %s\n", + meta_rectangle_region_to_string (region, ", ", new_list)); #endif } @@ -451,6 +439,7 @@ merge_spanning_rects_in_region (GList *region) * with some kind of optimization for this funcation, given that there * exists someone who really wants to do that. */ + char final_list[1 + 28 * g_list_length (region)]; printf (" Num rectangles contained in others : %d\n", num_contains); printf (" Num rectangles partially contained in others: %d\n", @@ -459,8 +448,8 @@ merge_spanning_rects_in_region (GList *region) num_adjacent); printf (" Num rectangles merged with others : %d\n", num_merged); - printf (" Final rectangles:\n"); - print_rect_list (region, " "); + printf (" Final rectangles: %s\n", + meta_rectangle_region_to_string (region, ", ", final_list)); #endif return region; @@ -570,7 +559,9 @@ meta_rectangle_get_minimal_spanning_set_for_region ( *temp_rect = *basic_rect; ret = g_list_prepend (NULL, temp_rect); #ifdef PRINT_DEBUG - printf("Initialized spanning set with %s.\n", rect2String (basic_rect)); + char rect_string[25]; + printf("Initialized spanning set with %s.\n", + meta_rectangle_to_string (basic_rect, rect_string)); #endif strut_iter = all_struts; @@ -579,7 +570,8 @@ meta_rectangle_get_minimal_spanning_set_for_region ( GList *rect_iter; MetaRectangle *strut = (MetaRectangle*) strut_iter->data; #ifdef PRINT_DEBUG - printf("Dealing with strut %s.\n", rect2String (strut)); + printf("Dealing with strut %s.\n", + meta_rectangle_to_string (strut, rect_string)); #endif tmp_list = ret; ret = NULL; @@ -588,13 +580,15 @@ meta_rectangle_get_minimal_spanning_set_for_region ( { MetaRectangle *rect = (MetaRectangle*) rect_iter->data; #ifdef PRINT_DEBUG - printf(" Looking if we need to chop up %s.\n", rect2String (rect)); + printf(" Looking if we need to chop up %s.\n", + meta_rectangle_to_string (rect, rect_string)); #endif if (!meta_rectangle_overlap (rect, strut)) { ret = g_list_prepend (ret, rect); #ifdef PRINT_DEBUG - printf(" No chopping of %s.\n", rect2String (rect)); + printf(" No chopping of %s.\n", + meta_rectangle_to_string (rect, rect_string)); #endif } else @@ -607,7 +601,8 @@ meta_rectangle_get_minimal_spanning_set_for_region ( temp_rect->width = strut->x - rect->x; ret = g_list_prepend (ret, temp_rect); #ifdef PRINT_DEBUG - printf(" Added %s.\n", rect2String (temp_rect)); + printf(" Added %s.\n", + meta_rectangle_to_string (temp_rect, rect_string)); #endif } /* If there is area in rect right of strut */ @@ -621,7 +616,8 @@ meta_rectangle_get_minimal_spanning_set_for_region ( temp_rect->x = new_x; ret = g_list_prepend (ret, temp_rect); #ifdef PRINT_DEBUG - printf(" Added %s.\n", rect2String (temp_rect)); + printf(" Added %s.\n", + meta_rectangle_to_string (temp_rect, rect_string)); #endif } /* If there is area in rect above strut */ @@ -632,7 +628,8 @@ meta_rectangle_get_minimal_spanning_set_for_region ( temp_rect->height = strut->y - rect->y; ret = g_list_prepend (ret, temp_rect); #ifdef PRINT_DEBUG - printf(" Added %s.\n", rect2String (temp_rect)); + printf(" Added %s.\n", + meta_rectangle_to_string (temp_rect, rect_string)); #endif } /* If there is area in rect below strut */ @@ -646,7 +643,8 @@ meta_rectangle_get_minimal_spanning_set_for_region ( temp_rect->y = new_y; ret = g_list_prepend (ret, temp_rect); #ifdef PRINT_DEBUG - printf(" Added %s.\n", rect2String (temp_rect)); + printf(" Added %s.\n", + meta_rectangle_to_string (temp_rect, rect_string)); #endif } g_free (rect); diff --git a/src/boxes.h b/src/boxes.h index 22d51f74..f89fb09e 100644 --- a/src/boxes.h +++ b/src/boxes.h @@ -50,7 +50,7 @@ typedef enum /* Output functions -- note that the output buffer had better be big enough: * region_to_string: 1 + (26+strlen(separator_string))*g_list_length (region) - * rect_to_string: 24 + * rect_to_string: 1 + 24 */ char* meta_rectangle_to_string (const MetaRectangle *rect, char *output); diff --git a/src/window.c b/src/window.c index 53c497d7..23700078 100644 --- a/src/window.c +++ b/src/window.c @@ -4079,9 +4079,6 @@ meta_window_configure_request (MetaWindow *window, * have a different setup for meta_window_move_resize_internal()... */ - /* FIXME: This causes a failed assertion on window.c:2543 of - * (flags & (META_IS_MOVE_ACTION | META_IS_RESIZE_ACTION)) - */ MetaMoveResizeFlags flags = META_IS_CONFIGURE_REQUEST; if (event->xconfigurerequest.value_mask & (CWX | CWY)) @@ -4089,14 +4086,15 @@ meta_window_configure_request (MetaWindow *window, if (event->xconfigurerequest.value_mask & (CWWidth | CWHeight)) flags |= META_IS_RESIZE_ACTION; - meta_window_move_resize_internal (window, - flags, - only_resize ? - window->size_hints.win_gravity : NorthWestGravity, - window->size_hints.x, - window->size_hints.y, - window->size_hints.width, - window->size_hints.height); + if (flags & (META_IS_MOVE_ACTION | META_IS_RESIZE_ACTION)) + meta_window_move_resize_internal (window, + flags, + only_resize ? + window->size_hints.win_gravity : NorthWestGravity, + window->size_hints.x, + window->size_hints.y, + window->size_hints.width, + window->size_hints.height); /* Handle stacking. We only handle raises/lowers, mostly because * stack.c really can't deal with anything else. I guess we'll fix @@ -6648,6 +6646,11 @@ update_resize (MetaWindow *window, } } + /* FIXME: This stupidity only needed because of wireframe mode and + * the fact that wireframe isn't making use of + * meta_rectangle_resize_with_gravity(). If we were to use that, we + * could just increment new_w and new_h by dx and dy in all cases. + */ switch (window->display->grab_op) { case META_GRAB_OP_RESIZING_SE: @@ -6722,6 +6725,26 @@ update_resize (MetaWindow *window, old = window->rect; + /* One sided resizing ought to actually be one-sided, despite the fact that + * aspect ratio windows don't interact nicely with the above stuff. So, + * to avoid some nasty flicker, we enforce that. + */ + switch (window->display->grab_op) + { + case META_GRAB_OP_RESIZING_S: + case META_GRAB_OP_RESIZING_N: + new_w = old.width; + break; + + case META_GRAB_OP_RESIZING_E: + case META_GRAB_OP_RESIZING_W: + new_h = old.height; + break; + + default: + break; + } + /* compute gravity of client during operation */ gravity = meta_resize_gravity_from_grab_op (window->display->grab_op); g_assert (gravity >= 0); @@ -6742,7 +6765,11 @@ update_resize (MetaWindow *window, } else { - meta_window_resize_with_gravity (window, TRUE, new_w, new_h, gravity); + /* We don't need to update unless the specified width and height + * are actually different from what we had before. + */ + if (old.width != new_w || old.height != new_h) + meta_window_resize_with_gravity (window, TRUE, new_w, new_h, gravity); } /* Store the latest resize time, if we actually resized. */ -- cgit v1.2.1