Index: includes/theme.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/theme.inc,v
retrieving revision 1.497
diff -u -p -r1.497 theme.inc
--- includes/theme.inc	2 Jul 2009 04:27:22 -0000	1.497
+++ includes/theme.inc	7 Jul 2009 10:31:42 -0000
@@ -1713,7 +1713,7 @@ function theme_more_link($url, $title) {
  */
 function theme_closure($main = 0) {
   $footer = module_invoke_all('footer', $main);
-  return implode("\n", $footer) . drupal_get_js('footer');
+  return drupal_render($footer) . drupal_get_js('footer');
 }
 
 /**
Index: modules/system/page.tpl.php
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/page.tpl.php,v
retrieving revision 1.24
diff -u -p -r1.24 page.tpl.php
--- modules/system/page.tpl.php	4 Jul 2009 05:21:15 -0000	1.24
+++ modules/system/page.tpl.php	7 Jul 2009 10:31:42 -0000
@@ -104,11 +104,6 @@
 </head>
 <body class="<?php print $classes; ?>">
 
-  <?php if ($page_top): ?>
-    <div id="page-top-region" class="clearfix">
-      <?php print $page_top; ?>
-    </div>
-  <?php endif; ?>
   <div id="page-wrapper"><div id="page">
 
     <div id="header"><div class="section clearfix">
Index: modules/system/system.api.php
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.api.php,v
retrieving revision 1.47
diff -u -p -r1.47 system.api.php
--- modules/system/system.api.php	5 Jul 2009 18:00:10 -0000	1.47
+++ modules/system/system.api.php	7 Jul 2009 10:31:42 -0000
@@ -148,9 +148,9 @@ function hook_exit($destination = NULL) 
 }
 
 /**
- * Insert closing HTML.
+ * Insert closing elements.
  *
- * This hook enables modules to insert HTML just before the \</body\> closing
+ * This hook enables modules to insert elements just before the \</body\> closing
  * tag of web pages. This is useful for adding JavaScript code to the footer
  * and for outputting debug information. It is not possible to add JavaScript
  * to the header at this point, and developers wishing to do so should use
@@ -159,11 +159,16 @@ function hook_exit($destination = NULL) 
  * @param $main
  *   Whether the current page is the front page of the site.
  * @return
- *   The HTML to be inserted.
+ *   A renderable array to be inserted, keyed by the hook_footer implementation.
  */
 function hook_footer($main = 0) {
   if (variable_get('dev_query', 0)) {
-    return '<div style="clear:both;">' . devel_query_table() . '</div>';
+    return array(
+      'devel' => array(
+        '#type' => 'markup',
+        '#value' => '<div style="clear:both;">' . devel_query_table() . '</div>',
+      ),
+    );
   }
 }
 
Index: modules/system/system.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.module,v
retrieving revision 1.722
diff -u -p -r1.722 system.module
--- modules/system/system.module	5 Jul 2009 18:00:10 -0000	1.722
+++ modules/system/system.module	7 Jul 2009 10:31:43 -0000
@@ -1822,7 +1831,6 @@ function _system_get_theme_data() {
         'footer' => 'Footer',
         'highlight' => 'Highlighted content',
         'help' => 'Help',
-        'page_top' => 'Page top',
       ),
       'description' => '',
       'features' => array(
Index: themes/garland/page.tpl.php
===================================================================
RCS file: /cvs/drupal/drupal/themes/garland/page.tpl.php,v
retrieving revision 1.28
diff -u -p -r1.28 page.tpl.php
--- themes/garland/page.tpl.php	4 Jul 2009 05:21:15 -0000	1.28
+++ themes/garland/page.tpl.php	7 Jul 2009 10:31:43 -0000
@@ -15,12 +15,6 @@
   </head>
   <body class="<?php print $classes ?>">
 
-  <?php if ($page_top): ?>
-    <div id="page-top-region" class="clearfix">
-      <?php print $page_top; ?>
-    </div>
-  <?php endif; ?>
-
   <div id="header-region" class="clearfix"><?php print $header ?></div>
 
   <div id="wrapper">
Index: modules/toolbar/toolbar.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/toolbar/toolbar.module,v
retrieving revision 1.2
diff -u -p -r1.2 toolbar.module
--- modules/toolbar/toolbar.module	5 Jul 2009 18:00:11 -0000	1.2
+++ modules/toolbar/toolbar.module	7 Jul 2009 10:31:43 -0000
@@ -31,13 +31,13 @@ function toolbar_theme($existing, $type,
 }
 
 /**
- * Implementation of hook_page_alter().
+ * Implementation of hook_footer().
  * 
- * Add admin toolbar to the page_top region automatically.
+ * Add admin toolbar to the page automatically.
  */
-function toolbar_page_alter(&$page) {
-  if (user_access('access toolbar')) {
-    $page['page_top']['toolbar'] = toolbar_build();
+function toolbar_footer(&$page) {
+  if (user_access('access toolbar') && !toolbar_suppress()) {
+    return array('toolbar' => toolbar_build());
   }
 }
 
@@ -184,3 +184,14 @@ function toolbar_in_active_trail($path) 
   }
   return in_array($path, $active_paths);
 }
+
+/**
+ * Let other modules, such as the overlay suppress the toolbar module output.
+ */
+function toolbar_suppress($suppress = NULL) {
+  static $is_suppressed = FALSE;
+  if (isset($suppress)) {
+    $is_suppressed = $suppress;
+  }
+  return $is_suppressed;
+}
