summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElijah Newren <newren@gmail.com>2004-12-20 02:46:42 +0000
committerElijah Newren <newren@src.gnome.org>2004-12-20 02:46:42 +0000
commitd8d77bd65b03e87e7aba04c1e298568ee7a021b3 (patch)
tree965fc754aa4c0b81729706b10f833c806506995e
parentc3a607f999844574a3850ea0ea3d8fd77f7215e1 (diff)
downloadmetacity-d8d77bd65b03e87e7aba04c1e298568ee7a021b3.tar.gz
Focus the desktop when showing it. Fixes #159257.
2004-12-19 Elijah Newren <newren@gmail.com> Focus the desktop when showing it. Fixes #159257. * src/display.c (event_callback): obtain a timestamp to pass to meta_screen_show_desktop * src/keybindings.c (handle_toggle_desktop): obtain a timestamp to pass to meta_screen_show_desktop * src/screen.c (meta_screen_show_desktop): add a timestamp parameter, get the most recently used window of type DESKTOP (if there is one) and focus it * src/screen.h (meta_screen_show_desktop): add a timestamp parameter
-rw-r--r--ChangeLog17
-rw-r--r--src/display.c2
-rw-r--r--src/keybindings.c2
-rw-r--r--src/screen.c24
-rw-r--r--src/screen.h3
5 files changed, 44 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 0e61bc01..9040fbbe 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,22 @@
2004-12-19 Elijah Newren <newren@gmail.com>
+ Focus the desktop when showing it. Fixes #159257.
+
+ * src/display.c (event_callback): obtain a timestamp to pass to
+ meta_screen_show_desktop
+
+ * src/keybindings.c (handle_toggle_desktop): obtain a timestamp to
+ pass to meta_screen_show_desktop
+
+ * src/screen.c (meta_screen_show_desktop): add a timestamp
+ parameter, get the most recently used window of type DESKTOP (if
+ there is one) and focus it
+
+ * src/screen.h (meta_screen_show_desktop): add a timestamp
+ parameter
+
+2004-12-19 Elijah Newren <newren@gmail.com>
+
Thanks to ash@contact.bg for this fix.
* po/POTFILES.in: Remove reference to metacity-properties.* files
diff --git a/src/display.c b/src/display.c
index 225d6c75..65692a4d 100644
--- a/src/display.c
+++ b/src/display.c
@@ -2152,7 +2152,7 @@ event_callback (XEvent *event,
meta_verbose ("Request to %s desktop\n", showing_desktop ? "show" : "hide");
if (showing_desktop)
- meta_screen_show_desktop (screen);
+ meta_screen_show_desktop (screen, meta_display_get_current_time_roundtrip (display));
else
{
meta_screen_unshow_desktop (screen);
diff --git a/src/keybindings.c b/src/keybindings.c
index 3adb85f0..27e82ce0 100644
--- a/src/keybindings.c
+++ b/src/keybindings.c
@@ -2837,7 +2837,7 @@ handle_toggle_desktop (MetaDisplay *display,
event->xkey.time);
}
else
- meta_screen_show_desktop (screen);
+ meta_screen_show_desktop (screen, event->xkey.time);
}
static void
diff --git a/src/screen.c b/src/screen.c
index 9cb462d1..ab07dd80 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -2229,14 +2229,36 @@ meta_screen_minimize_all_on_active_workspace_except (MetaScreen *screen,
}
void
-meta_screen_show_desktop (MetaScreen *screen)
+meta_screen_show_desktop (MetaScreen *screen,
+ Time timestamp)
{
+ GList *windows;
+
if (screen->active_workspace->showing_desktop)
return;
screen->active_workspace->showing_desktop = TRUE;
queue_windows_showing (screen);
+
+ /* Focus the most recently used META_WINDOW_DESKTOP window, if there is one;
+ * see bug 159257.
+ */
+ windows = screen->active_workspace->mru_list;
+ while (windows != NULL)
+ {
+ MetaWindow *w = windows->data;
+
+ if (w->screen == screen &&
+ w->type == META_WINDOW_DESKTOP)
+ {
+ meta_window_focus (w, timestamp);
+ break;
+ }
+
+ windows = windows->next;
+ }
+
meta_screen_update_showing_desktop_hint (screen);
}
diff --git a/src/screen.h b/src/screen.h
index 30b45d01..46bf2208 100644
--- a/src/screen.h
+++ b/src/screen.h
@@ -200,7 +200,8 @@ void meta_screen_minimize_all_on_active_workspace_except (MetaScreen *screen
MetaWindow *keep);
/* Show/hide the desktop (temporarily hide all windows) */
-void meta_screen_show_desktop (MetaScreen *screen);
+void meta_screen_show_desktop (MetaScreen *screen,
+ Time timestamp);
void meta_screen_unshow_desktop (MetaScreen *screen);
/* Update whether the destkop is being shown for the current active_workspace */