From a29c93a95a94a3da8f03d727e5b77848ae673292 Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Mon, 15 Oct 2001 03:39:41 +0000 Subject: [PATCH] raise/focus windows on left-click, seem to have broken that yesterday 2001-10-14 Havoc Pennington * src/frames.c (meta_frames_button_press_event): raise/focus windows on left-click, seem to have broken that yesterday * src/keybindings.c, src/display.c, src/window.c: add keybinding to show/hide all normal windows (so you can see the desktop). Currently Ctrl+Alt+D, which I don't like, but yay. --- ChangeLog | 9 +++++++++ README | 1 + src/display.c | 44 ++++++++++++++++++++++++++++++++++++++++++ src/display.h | 6 ++++++ src/frames.c | 9 +++++++++ src/keybindings.c | 27 ++++++++++++++++++++++---- src/uislave/.cvsignore | 5 ----- src/window.c | 10 ++++++++++ 8 files changed, 102 insertions(+), 9 deletions(-) delete mode 100644 src/uislave/.cvsignore diff --git a/ChangeLog b/ChangeLog index b746cc1a8..47bc2266c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2001-10-14 Havoc Pennington + + * src/frames.c (meta_frames_button_press_event): raise/focus + windows on left-click, seem to have broken that yesterday + + * src/keybindings.c, src/display.c, src/window.c: add keybinding + to show/hide all normal windows (so you can see the desktop). + Currently Ctrl+Alt+D, which I don't like, but yay. + 2001-10-14 Havoc Pennington * src/window.c (meta_window_new): take a window mapped at diff --git a/README b/README index 75cd16b16..cb3a7a238 100644 --- a/README +++ b/README @@ -49,6 +49,7 @@ METACITY FEATURES Alt-Escape focus previous window Alt-Left Arrow previous workspace Alt-Right Arrow next workspace + Ctrl-Alt-D minimize/unminimize all, to show desktop - Window keybindings: Alt-space window menu diff --git a/src/display.c b/src/display.c index de548c733..482754ff3 100644 --- a/src/display.c +++ b/src/display.c @@ -172,6 +172,8 @@ meta_display_open (const char *name) display->focus_window = NULL; display->prev_focus_window = NULL; + + display->showing_desktop = FALSE; /* we have to go ahead and do this so error handlers work */ all_displays = g_slist_prepend (all_displays, display); @@ -1722,3 +1724,45 @@ meta_display_update_active_window_hint (MetaDisplay *display) tmp = tmp->next; } } + +static void +queue_windows_showing (MetaDisplay *display) +{ + GSList *windows; + GSList *tmp; + + windows = meta_display_list_windows (display); + + tmp = windows; + while (tmp != NULL) + { + meta_window_queue_calc_showing (tmp->data); + + tmp = tmp->next; + } + + g_slist_free (windows); +} + +void +meta_display_show_desktop (MetaDisplay *display) +{ + + if (display->showing_desktop) + return; + + display->showing_desktop = TRUE; + + queue_windows_showing (display); +} + +void +meta_display_unshow_desktop (MetaDisplay *display) +{ + if (!display->showing_desktop) + return; + + display->showing_desktop = FALSE; + + queue_windows_showing (display); +} diff --git a/src/display.h b/src/display.h index fe2a9e6bb..80072c2af 100644 --- a/src/display.h +++ b/src/display.h @@ -111,6 +111,8 @@ struct _MetaDisplay MetaWindow *prev_focus_window; GList *workspaces; + + guint showing_desktop : 1; /*< private-ish >*/ MetaEventQueue *events; @@ -197,4 +199,8 @@ void meta_display_increment_event_serial (MetaDisplay *display); void meta_display_update_active_window_hint (MetaDisplay *display); +/* Show/hide the desktop (temporarily hide all windows) */ +void meta_display_show_desktop (MetaDisplay *display); +void meta_display_unshow_desktop (MetaDisplay *display); + #endif diff --git a/src/frames.c b/src/frames.c index 7e1c38b98..59ef40ced 100644 --- a/src/frames.c +++ b/src/frames.c @@ -1025,6 +1025,15 @@ meta_frames_button_press_event (GtkWidget *widget, if (control == META_FRAME_CONTROL_CLIENT_AREA) return FALSE; /* not on the frame, just passed through from client */ + + if (event->button == 1) + { + meta_core_user_raise (gdk_display, + frame->xwindow); + meta_core_user_focus (gdk_display, + frame->xwindow, + event->time); + } /* We want to shade even if we have a GrabOp, since we'll have a move grab * if we double click the titlebar. diff --git a/src/keybindings.c b/src/keybindings.c index bf72f6d20..6417ed8db 100644 --- a/src/keybindings.c +++ b/src/keybindings.c @@ -61,11 +61,16 @@ static void handle_workspace_left (MetaDisplay *display, MetaWindow *window, XEvent *event, gpointer data); -static void handle_workspace_right (MetaDisplay *display, - MetaWindow *window, - XEvent *event, - gpointer data); +static void handle_workspace_right (MetaDisplay *display, + MetaWindow *window, + XEvent *event, + gpointer data); +static void handle_toggle_desktop (MetaDisplay *display, + MetaWindow *window, + XEvent *event, + gpointer data); + static gboolean process_keyboard_move_grab (MetaDisplay *display, MetaWindow *window, XEvent *event, @@ -110,6 +115,8 @@ static MetaKeyBinding screen_bindings[] = { { XK_Escape, Mod1Mask, KeyPress, handle_focus_previous, NULL, 0 }, { XK_Left, Mod1Mask, KeyPress, handle_workspace_left, NULL, 0 }, { XK_Right, Mod1Mask, KeyPress, handle_workspace_right, NULL, 0 }, + /* I don't like this binding, but haven't picked the right one yet */ + { XK_d, Mod1Mask | ControlMask, KeyPress, handle_toggle_desktop, NULL, 0 }, { None, 0, 0, NULL, NULL, 0 } }; @@ -867,6 +874,18 @@ handle_workspace_right (MetaDisplay *display, } } +static void +handle_toggle_desktop (MetaDisplay *display, + MetaWindow *window, + XEvent *event, + gpointer data) +{ + if (display->showing_desktop) + meta_display_unshow_desktop (display); + else + meta_display_show_desktop (display); +} + static void handle_activate_menu (MetaDisplay *display, MetaWindow *event_window, diff --git a/src/uislave/.cvsignore b/src/uislave/.cvsignore deleted file mode 100644 index 603f53e80..000000000 --- a/src/uislave/.cvsignore +++ /dev/null @@ -1,5 +0,0 @@ -Makefile.in -Makefile -.libs -.deps -metacity-uislave diff --git a/src/window.c b/src/window.c index fdd04402e..ab642daf6 100644 --- a/src/window.c +++ b/src/window.c @@ -814,6 +814,16 @@ meta_window_calc_showing (MetaWindow *window) on_workspace = TRUE; meta_verbose ("Window %s is on all workspaces\n", window->desc); } + + if (on_workspace && + window->display->showing_desktop && + window->type != META_WINDOW_DESKTOP && + window->type != META_WINDOW_DOCK) + { + meta_verbose ("Window %s is on current workspace, but we're showing the desktop\n", + window->desc); + on_workspace = FALSE; + } if (window->minimized || !on_workspace) {