From 447eba6007aa221ec18a2c76569cf792bfe24009 Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Sun, 10 Mar 2002 15:48:38 +0000 Subject: [PATCH] we didn't claim to support _NET_ACTIVE_WINDOW so gtk_window_present() 2002-03-10 Havoc Pennington * src/screen.c (set_supported_hint): we didn't claim to support _NET_ACTIVE_WINDOW so gtk_window_present() didn't work. Mumble. Only worked with tasklist because libwnck didn't check for WM support. * src/window.c (meta_window_free): clean off window state when windows are withdrawn, to avoid sticking dialogs to their initial desktop. (meta_window_queue_calc_showing): return if window is withdrawn --- ChangeLog | 12 +++++++++++ src/core.c | 4 ++++ src/display.c | 3 +++ src/run-metacity.sh | 2 +- src/screen.c | 3 ++- src/window.c | 52 ++++++++++++++++++++++++++++++++++++++++----- 6 files changed, 69 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 29297f08c..b09035e1d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2002-03-10 Havoc Pennington + + * src/screen.c (set_supported_hint): we didn't claim to support + _NET_ACTIVE_WINDOW so gtk_window_present() didn't work. Mumble. + Only worked with tasklist because libwnck didn't check for + WM support. + + * src/window.c (meta_window_free): clean off window state + when windows are withdrawn, to avoid sticking dialogs + to their initial desktop. + (meta_window_queue_calc_showing): return if window is withdrawn + 2002-03-08 Laszlo Peter * configure.in: fix the X linker flags diff --git a/src/core.c b/src/core.c index b2baa7b0e..89b294502 100644 --- a/src/core.c +++ b/src/core.c @@ -526,6 +526,10 @@ meta_core_get_grab_frame (Display *xdisplay) display = meta_display_for_x_display (xdisplay); g_assert (display != NULL); + g_assert (display->grab_op == META_GRAB_OP_NONE || + display->grab_window != NULL); + g_assert (display->grab_op == META_GRAB_OP_NONE || + display->grab_window->display->xdisplay == xdisplay); if (display->grab_op != META_GRAB_OP_NONE && display->grab_window->frame) diff --git a/src/display.c b/src/display.c index c40a85238..0ea81ad73 100644 --- a/src/display.c +++ b/src/display.c @@ -1646,6 +1646,9 @@ meta_spew_event (MetaDisplay *display, break; case ResizeRequest: name = "ResizeRequest"; + extra = g_strdup_printf ("width = %d height = %d", + event->xresizerequest.width, + event->xresizerequest.height); break; case CirculateNotify: name = "CirculateNotify"; diff --git a/src/run-metacity.sh b/src/run-metacity.sh index 1e842e3e0..474139c73 100755 --- a/src/run-metacity.sh +++ b/src/run-metacity.sh @@ -75,5 +75,5 @@ if test -z "$ONLY_WM"; then fi if test -z "$ONLY_SETUP"; then - METACITY_DEBUG_BUTTON_GRABS=1 METACITY_DISPLAY=$CLIENT_DISPLAY exec libtool --mode=execute $DEBUG ./metacity $OPTIONS + METACITY_VERBOSE=1 METACITY_DEBUG=1 METACITY_USE_LOGFILE=1 METACITY_DEBUG_BUTTON_GRABS=1 METACITY_DISPLAY=$CLIENT_DISPLAY exec libtool --mode=execute $DEBUG ./metacity $OPTIONS fi diff --git a/src/screen.c b/src/screen.c index f2e7e4d6e..0925b7241 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 28 +#define N_SUPPORTED 29 #define N_WIN_SUPPORTED 1 Atom atoms[N_SUPPORTED]; @@ -110,6 +110,7 @@ set_supported_hint (MetaScreen *screen) atoms[25] = screen->display->atom_net_wm_window_type_splashscreen; atoms[26] = screen->display->atom_net_wm_state_fullscreen; atoms[27] = screen->display->atom_net_wm_ping; + atoms[28] = screen->display->atom_net_active_window; XChangeProperty (screen->display->xdisplay, screen->xroot, screen->display->atom_net_supported, diff --git a/src/window.c b/src/window.c index 979dafc52..27cca9efb 100644 --- a/src/window.c +++ b/src/window.c @@ -134,6 +134,22 @@ static void meta_window_apply_session_info (MetaWindow *window, const MetaWindowSessionInfo *info); +static const char* +wm_state_to_string (int state) +{ + switch (state) + { + case NormalState: + return "NormalState"; + case IconicState: + return "IconicState"; + case WithdrawnState: + return "WithdrawnState"; + } + + return "Unknown"; +} + MetaWindow* meta_window_new (MetaDisplay *display, Window xwindow, gboolean must_be_viewable) @@ -176,7 +192,8 @@ meta_window_new (MetaDisplay *display, Window xwindow, return NULL; } - meta_verbose ("attrs.map_state = %d (%s)\n", + meta_verbose ("must_be_viewable = %d attrs.map_state = %d (%s)\n", + must_be_viewable, attrs.map_state, (attrs.map_state == IsUnmapped) ? "IsUnmapped" : @@ -205,6 +222,8 @@ meta_window_new (MetaDisplay *display, Window xwindow, } existing_wm_state = state; + meta_verbose ("WM_STATE of %lx = %s\n", xwindow, + wm_state_to_string (existing_wm_state)); } meta_error_trap_push (display); @@ -768,7 +787,21 @@ meta_window_free (MetaWindow *window) /* FIXME restore original size if window has maximized */ if (window->withdrawn) - set_wm_state (window, WithdrawnState); + { + /* We need to clean off the window's state so it + * won't be restored if the app maps it again. + */ + meta_error_trap_push (window->display); + meta_verbose ("Cleaning state from window %s\n", window->desc); + XDeleteProperty (window->display->xdisplay, + window->xwindow, + window->display->atom_net_wm_desktop); + XDeleteProperty (window->display->xdisplay, + window->xwindow, + window->display->atom_net_wm_state); + set_wm_state (window, WithdrawnState); + meta_error_trap_pop (window->display); + } if (window->frame) meta_window_destroy_frame (window); @@ -811,7 +844,10 @@ set_wm_state (MetaWindow *window, int state) { unsigned long data[2]; - + + meta_verbose ("Setting wm state %s on %s\n", + wm_state_to_string (state), window->desc); + /* twm sets the icon window as data[1], I couldn't find that in * ICCCM. */ @@ -1072,7 +1108,10 @@ meta_window_flush_calc_showing (MetaWindow *window) void meta_window_queue_calc_showing (MetaWindow *window) { - if (window->unmanaging) + /* if withdrawn = TRUE then unmanaging should also be TRUE, + * really. + */ + if (window->unmanaging || window->withdrawn) return; if (window->calc_showing_queued) @@ -2628,7 +2667,10 @@ meta_window_set_current_workspace_hint (MetaWindow *window) unsigned long data[1]; if (window->workspaces == NULL) - return Success; /* this happens when destroying windows */ + { + /* this happens when unmanaging windows */ + return Success; + } data[0] = meta_window_get_net_wm_desktop (window);