From 844a8ac13f057f235cf3044f23b23cabf10e65f7 Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Sat, 9 Feb 2002 04:50:58 +0000 Subject: [PATCH] add _NET_WM_STATE_HIDDEN to _NET_SUPPORTED 2002-02-08 Havoc Pennington * src/screen.c (set_supported_hint): add _NET_WM_STATE_HIDDEN to _NET_SUPPORTED * src/keybindings.c (meta_set_keybindings_disabled): put in header file, to fix warning. * src/display.c (meta_display_open): add _NET_WM_STATE_HIDDEN atom * src/window.c (set_net_wm_state): set _NET_WM_STATE_HIDDEN for shaded and minimized windows (meta_window_show): call set_net_wm_state() if we map the window or frame (meta_window_hide): call set_net_wm_state() if we unmap the window or frame --- ChangeLog | 17 +++++++++++++++++ src/display.c | 4 +++- src/display.h | 1 + src/keybindings.h | 1 + src/screen.c | 3 ++- src/window.c | 15 ++++++++++++--- 6 files changed, 36 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index b9ee0446c..f03f18139 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2002-02-08 Havoc Pennington + + * src/screen.c (set_supported_hint): add _NET_WM_STATE_HIDDEN + to _NET_SUPPORTED + + * src/keybindings.c (meta_set_keybindings_disabled): put in header + file, to fix warning. + + * src/display.c (meta_display_open): add _NET_WM_STATE_HIDDEN atom + + * src/window.c (set_net_wm_state): set _NET_WM_STATE_HIDDEN for + shaded and minimized windows + (meta_window_show): call set_net_wm_state() if we map the window + or frame + (meta_window_hide): call set_net_wm_state() if we unmap the window + or frame + 2002-02-08 Havoc Pennington * src/window.c (set_net_wm_state): only set skip pager/tasklist if diff --git a/src/display.c b/src/display.c index 4d1a02ccb..5b969e55c 100644 --- a/src/display.c +++ b/src/display.c @@ -143,7 +143,8 @@ meta_display_open (const char *name) "_NET_WM_STRUT", "_WIN_HINTS", "_METACITY_RELOAD_THEME_MESSAGE", - "_METACITY_SET_KEYBINDINGS_MESSAGE" + "_METACITY_SET_KEYBINDINGS_MESSAGE", + "_NET_WM_STATE_HIDDEN" }; Atom atoms[G_N_ELEMENTS(atom_names)]; @@ -241,6 +242,7 @@ meta_display_open (const char *name) display->atom_win_hints = atoms[46]; display->atom_metacity_reload_theme_message = atoms[47]; display->atom_metacity_set_keybindings_message = atoms[48]; + display->atom_net_wm_state_hidden = atoms[49]; /* Offscreen unmapped window used for _NET_SUPPORTING_WM_CHECK, * created in screen_new diff --git a/src/display.h b/src/display.h index cfd43d2ea..746a423c0 100644 --- a/src/display.h +++ b/src/display.h @@ -108,6 +108,7 @@ struct _MetaDisplay Atom atom_win_hints; Atom atom_metacity_reload_theme_message; Atom atom_metacity_set_keybindings_message; + Atom atom_net_wm_state_hidden; /* This is the actual window from focus events, * not the one we last set diff --git a/src/keybindings.h b/src/keybindings.h index e6c16b418..85255a78a 100644 --- a/src/keybindings.h +++ b/src/keybindings.h @@ -35,6 +35,7 @@ void meta_window_ungrab_all_keys (MetaWindow *window); void meta_display_process_key_event (MetaDisplay *display, MetaWindow *window, XEvent *event); +void meta_set_keybindings_disabled (gboolean setting); #endif diff --git a/src/screen.c b/src/screen.c index 719d75333..eb607ada9 100644 --- a/src/screen.c +++ b/src/screen.c @@ -78,7 +78,7 @@ set_wm_check_hint (MetaScreen *screen) static int set_supported_hint (MetaScreen *screen) { -#define N_SUPPORTED 23 +#define N_SUPPORTED 24 #define N_WIN_SUPPORTED 1 Atom atoms[N_SUPPORTED]; @@ -105,6 +105,7 @@ set_supported_hint (MetaScreen *screen) atoms[20] = screen->display->atom_net_wm_state_skip_pager; atoms[21] = screen->display->atom_net_wm_icon; atoms[22] = screen->display->atom_net_wm_moveresize; + atoms[23] = screen->display->atom_net_wm_state_hidden; XChangeProperty (screen->display->xdisplay, screen->xroot, screen->display->atom_net_supported, diff --git a/src/window.c b/src/window.c index 0cf884844..112ad05a7 100644 --- a/src/window.c +++ b/src/window.c @@ -845,7 +845,12 @@ set_net_wm_state (MetaWindow *window) data[i] = window->display->atom_net_wm_state_maximized_vert; ++i; } - + if (window->shaded || window->minimized) + { + data[i] = window->display->atom_net_wm_state_hidden; + ++i; + } + meta_verbose ("Setting _NET_WM_STATE with %d atoms\n", i); meta_error_trap_push (window->display); @@ -1106,6 +1111,7 @@ meta_window_show (MetaWindow *window) "Frame actually needs map\n"); window->frame->mapped = TRUE; meta_ui_map_frame (window->screen->ui, window->frame->xwindow); + did_show = TRUE; } if (window->shaded) @@ -1150,7 +1156,6 @@ meta_window_show (MetaWindow *window) } } - if (did_placement) { if (window->xtransient_for != None) @@ -1179,6 +1184,8 @@ meta_window_show (MetaWindow *window) if (did_show) { + set_net_wm_state (window); + if (window->has_struts) { meta_topic (META_DEBUG_WORKAREA, @@ -1227,9 +1234,11 @@ meta_window_hide (MetaWindow *window) window->iconic = TRUE; set_wm_state (window, IconicState); } - + if (did_hide) { + set_net_wm_state (window); + if (window->has_struts) { meta_topic (META_DEBUG_WORKAREA,