Revert "Remove a bunch of dead code"

This reverts commit 0d794f28f0.

I thought this was marked ACN. It wasn't.
This commit is contained in:
Jasper St. Pierre 2012-04-24 18:02:33 -04:00
parent b58366d3ad
commit c44438b19f
6 changed files with 336 additions and 1 deletions

View File

@ -407,7 +407,24 @@ async_get_property_handler (Display *dpy,
* via the standard X mechanism, so don't do anything about
* it, other than store it in task->error.
*/
task->error = BadImplementation;
{
#if 0
xError error;
#endif
task->error = BadImplementation;
#if 0
error.sequenceNumber = task->request_seq;
error.type = X_Error;
error.majorCode = X_GetProperty;
error.minorCode = 0;
error.errorCode = BadImplementation;
_XError (dpy, &error);
#endif
}
nbytes = netbytes = 0L;
break;
}

View File

@ -162,6 +162,34 @@ meta_window_delete (MetaWindow *window,
delete_ping_reply_func,
delete_ping_timeout_func,
window);
if (window->has_focus)
{
/* FIXME Clean this up someday
* http://bugzilla.gnome.org/show_bug.cgi?id=108706
*/
#if 0
/* This is unfortunately going to result in weirdness
* if the window doesn't respond to the delete event.
* I don't know how to avoid that though.
*/
meta_topic (META_DEBUG_FOCUS,
"Focusing default window because focus window %s was deleted/killed\n",
window->desc);
meta_workspace_focus_default_window (window->screen->active_workspace,
window);
#else
meta_topic (META_DEBUG_FOCUS,
"Not unfocusing %s on delete/kill\n",
window->desc);
#endif
}
else
{
meta_topic (META_DEBUG_FOCUS,
"Window %s was deleted/killed but didn't have focus\n",
window->desc);
}
}

View File

@ -1565,6 +1565,44 @@ meta_display_queue_autoraise_callback (MetaDisplay *display,
display->autoraise_window = window;
}
#if 0
static void
handle_net_restack_window (MetaDisplay* display,
XEvent *event)
{
MetaWindow *window;
window = meta_display_lookup_x_window (display,
event->xclient.window);
if (window)
{
/* FIXME: The EWMH includes a sibling for the restack request, but we
* (stupidly) don't currently support these types of raises.
*
* Also, unconditionally following these is REALLY stupid--we should
* combine this code with the stuff in
* meta_window_configure_request() which is smart about whether to
* follow the request or do something else (though not smart enough
* and is also too stupid to handle the sibling stuff).
*/
switch (event->xclient.data.l[2])
{
case Above:
meta_window_raise (window);
break;
case Below:
meta_window_lower (window);
break;
case TopIf:
case BottomIf:
case Opposite:
break;
}
}
}
#endif
/**
* event_callback:
* @event: The event that just happened
@ -2412,6 +2450,11 @@ event_callback (XEvent *event,
else if (event->xproperty.atom ==
display->atom__NET_DESKTOP_NAMES)
meta_screen_update_workspace_names (screen);
#if 0
else if (event->xproperty.atom ==
display->atom__NET_RESTACK_WINDOW)
handle_net_restack_window (display, event);
#endif
/* we just use this property as a sentinel to avoid
* certain race conditions. See the comment for the
@ -3999,6 +4042,21 @@ meta_display_grab_focus_window_button (MetaDisplay *display,
/* Grab button 1 for activating unfocused windows */
meta_verbose ("Grabbing unfocused window buttons for %s\n", window->desc);
#if 0
/* FIXME:115072 */
/* Don't grab at all unless in click to focus mode. In click to
* focus, we may sometimes be clever about intercepting and eating
* the focus click. But in mouse focus, we never do that since the
* focus window may not be raised, and who wants to think about
* mouse focus anyway.
*/
if (meta_prefs_get_focus_mode () != G_DESKTOP_FOCUS_MODE_CLICK)
{
meta_verbose (" (well, not grabbing since not in click to focus mode)\n");
return;
}
#endif
if (window->have_focus_click_grab)
{
meta_verbose (" (well, not grabbing since we already have the grab)\n");

View File

@ -602,7 +602,16 @@ create_constraints (Constraint **constraints,
continue;
}
#if 0
/* old way of doing it */
if (!(meta_window_is_ancestor_of_transient (w, group_window)) &&
!WINDOW_TRANSIENT_FOR_WHOLE_GROUP (group_window)) /* note */;/*note*/
#else
/* better way I think, so transient-for-group are constrained
* only above non-transient-type windows in their group
*/
if (!WINDOW_HAS_TRANSIENT_TYPE (group_window))
#endif
{
meta_topic (META_DEBUG_STACK, "Constraining %s above %s as it's transient for its group\n",
w->desc, group_window->desc);

View File

@ -356,6 +356,181 @@ get_monitor_edges (int which_monitor_set, int which_strut_set)
return ret;
}
#if 0
static void
test_merge_regions ()
{
/* logarithmically distributed random number of struts (range?)
* logarithmically distributed random size of struts (up to screen size???)
* uniformly distributed location of center of struts (within screen)
* merge all regions that are possible
* print stats on problem setup
* number of (non-completely-occluded?) struts
* percentage of screen covered
* length of resulting non-minimal spanning set
* length of resulting minimal spanning set
* print stats on merged regions:
* number boxes merged
* number of those merges that were of the form A contains B
* number of those merges that were of the form A partially contains B
* number of those merges that were of the form A is adjacent to B
*/
GList* region;
GList* compare;
int num_contains, num_merged, num_part_contains, num_adjacent;
num_contains = num_merged = num_part_contains = num_adjacent = 0;
compare = region = get_screen_region (2);
g_assert (region);
printf ("Merging stats:\n");
printf (" Length of initial list: %d\n", g_list_length (region));
#ifdef PRINT_DEBUG
char rect1[RECT_LENGTH], rect2[RECT_LENGTH];
char region_list[(RECT_LENGTH + 2) * g_list_length (region)];
meta_rectangle_region_to_string (region, ", ", region_list);
printf (" Initial rectangles: %s\n", region_list);
#endif
while (compare && compare->next)
{
MetaRectangle *a = compare->data;
GList *other = compare->next;
g_assert (a->width > 0 && a->height > 0);
while (other)
{
MetaRectangle *b = other->data;
GList *delete_me = NULL;
g_assert (b->width > 0 && b->height > 0);
#ifdef PRINT_DEBUG
printf (" -- Comparing %s to %s --\n",
meta_rectangle_to_string (a, rect1),
meta_rectangle_to_string (b, rect2));
#endif
/* If a contains b, just remove b */
if (meta_rectangle_contains_rect (a, b))
{
delete_me = other;
num_contains++;
num_merged++;
}
/* If b contains a, just remove a */
else if (meta_rectangle_contains_rect (a, b))
{
delete_me = compare;
num_contains++;
num_merged++;
}
/* If a and b might be mergeable horizontally */
else if (a->y == b->y && a->height == b->height)
{
/* If a and b overlap */
if (meta_rectangle_overlap (a, b))
{
int new_x = MIN (a->x, b->x);
a->width = MAX (a->x + a->width, b->x + b->width) - new_x;
a->x = new_x;
delete_me = other;
num_part_contains++;
num_merged++;
}
/* If a and b are adjacent */
else if (a->x + a->width == b->x || a->x == b->x + b->width)
{
int new_x = MIN (a->x, b->x);
a->width = MAX (a->x + a->width, b->x + b->width) - new_x;
a->x = new_x;
delete_me = other;
num_adjacent++;
num_merged++;
}
}
/* If a and b might be mergeable vertically */
else if (a->x == b->x && a->width == b->width)
{
/* If a and b overlap */
if (meta_rectangle_overlap (a, b))
{
int new_y = MIN (a->y, b->y);
a->height = MAX (a->y + a->height, b->y + b->height) - new_y;
a->y = new_y;
delete_me = other;
num_part_contains++;
num_merged++;
}
/* If a and b are adjacent */
else if (a->y + a->height == b->y || a->y == b->y + b->height)
{
int new_y = MIN (a->y, b->y);
a->height = MAX (a->y + a->height, b->y + b->height) - new_y;
a->y = new_y;
delete_me = other;
num_adjacent++;
num_merged++;
}
}
other = other->next;
/* Delete any rectangle in the list that is no longer wanted */
if (delete_me != NULL)
{
#ifdef PRINT_DEBUG
MetaRectangle *bla = delete_me->data;
printf (" Deleting rect %s\n",
meta_rectangle_to_string (bla, rect1));
#endif
/* Deleting the rect we're compare others to is a little tricker */
if (compare == delete_me)
{
compare = compare->next;
other = compare->next;
a = compare->data;
}
/* Okay, we can free it now */
g_free (delete_me->data);
region = g_list_delete_link (region, delete_me);
}
#ifdef PRINT_DEBUG
char region_list[(RECT_LENGTH + 2) * g_list_length (region)];
meta_rectangle_region_to_string (region, ", ", region_list);
printf (" After comparison, new list is: %s\n", region_list);
#endif
}
compare = compare->next;
}
printf (" Num rectangles contained in others : %d\n",
num_contains);
printf (" Num rectangles partially contained in others: %d\n",
num_part_contains);
printf (" Num rectangles adjacent to others : %d\n",
num_adjacent);
printf (" Num rectangles merged with others : %d\n",
num_merged);
#ifdef PRINT_DEBUG
char region_list2[(RECT_LENGTH + 2) * g_list_length (region)];
meta_rectangle_region_to_string (region, ", ", region_list2);
printf (" Final rectangles: %s\n", region_list2);
#endif
meta_rectangle_free_spanning_set (region);
region = NULL;
printf ("%s passed.\n", G_STRFUNC);
}
#endif
static void
verify_lists_are_equal (GList *code, GList *answer)
{
@ -459,6 +634,14 @@ test_regions_okay ()
tmp = g_list_prepend (tmp, new_meta_rect ( 900, 20, 700, 1080)); /* 756000 */
tmp = g_list_prepend (tmp, new_meta_rect ( 0, 20, 700, 1130)); /* 791000 */
tmp = g_list_prepend (tmp, new_meta_rect ( 0, 20, 1600, 505)); /* 808000 */
#if 0
printf ("Got to here...\n");
char region_list[(RECT_LENGTH+2) * g_list_length (region)];
char tmp_list[ (RECT_LENGTH+2) * g_list_length (tmp)];
meta_rectangle_region_to_string (region, ", ", region_list);
meta_rectangle_region_to_string (region, ", ", tmp_list);
printf ("%s vs. %s\n", region_list, tmp_list);
#endif
verify_lists_are_equal (region, tmp);
meta_rectangle_free_list_and_elements (tmp);
meta_rectangle_free_list_and_elements (region);
@ -910,6 +1093,15 @@ test_find_onscreen_edges ()
tmp = g_list_prepend (tmp, new_screen_edge ( 380, 1150, 0, 50, left));
tmp = g_list_prepend (tmp, new_screen_edge ( 0, 20, 0, 1180, left));
#if 0
#define FUDGE 50 /* number of edges */
char big_buffer1[(EDGE_LENGTH+2)*FUDGE], big_buffer2[(EDGE_LENGTH+2)*FUDGE];
meta_rectangle_edge_list_to_string (edges, "\n ", big_buffer1);
meta_rectangle_edge_list_to_string (tmp, "\n ", big_buffer2);
printf("Generated edge list:\n %s\nComparison edges list:\n %s\n",
big_buffer1, big_buffer2);
#endif
verify_edge_lists_are_equal (edges, tmp);
meta_rectangle_free_list_and_elements (tmp);
meta_rectangle_free_list_and_elements (edges);
@ -990,6 +1182,14 @@ test_find_nonintersected_monitor_edges ()
tmp = NULL;
tmp = g_list_prepend (tmp, new_monitor_edge ( 800, 20, 0, 1080, right));
tmp = g_list_prepend (tmp, new_monitor_edge ( 800, 20, 0, 1180, left));
#if 0
#define FUDGE 50
char big_buffer1[(EDGE_LENGTH+2)*FUDGE], big_buffer2[(EDGE_LENGTH+2)*FUDGE];
meta_rectangle_edge_list_to_string (edges, "\n ", big_buffer1);
meta_rectangle_edge_list_to_string (tmp, "\n ", big_buffer2);
printf("Generated edge list:\n %s\nComparison edges list:\n %s\n",
big_buffer1, big_buffer2);
#endif
verify_edge_lists_are_equal (edges, tmp);
meta_rectangle_free_list_and_elements (tmp);
meta_rectangle_free_list_and_elements (edges);

View File

@ -465,6 +465,29 @@ border_only_cb (GtkAction *action,
gtk_widget_show_all (window);
}
#if 0
static void
changing_icon_cb (GtkAction *action,
gpointer callback_data)
{
GtkWidget *window;
GtkWidget *vbox;
GtkWidget *label;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "Changing Icon");
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_container_add (GTK_CONTAINER (window), vbox);
label = gtk_label_new ("This window has an icon that changes over time");
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
gtk_widget_show_all (window);
}
#endif
static gboolean
focus_in_event_cb (GtkWidget *window,
GdkEvent *event,