diff -Nru metacity-3.18.3/debian/changelog metacity-3.18.3/debian/changelog --- metacity-3.18.3/debian/changelog 2016-04-04 15:10:55.000000000 +0000 +++ metacity-3.18.3/debian/changelog 2016-04-13 14:33:16.000000000 +0000 @@ -1,3 +1,10 @@ +metacity (1:3.18.3-1ubuntu3) xenial; urgency=medium + + * Backport upstream change (add_window_back_to_compositor.diff) to fix + windows getting hidden sometimes (LP: #1538111). + + -- Dmitry Shachnev Wed, 13 Apr 2016 17:31:12 +0300 + metacity (1:3.18.3-1ubuntu2) xenial; urgency=medium * Backport upstream change (compositor_root_background.diff) to fix root diff -Nru metacity-3.18.3/debian/patches/add_window_back_to_compositor.diff metacity-3.18.3/debian/patches/add_window_back_to_compositor.diff --- metacity-3.18.3/debian/patches/add_window_back_to_compositor.diff 1970-01-01 00:00:00.000000000 +0000 +++ metacity-3.18.3/debian/patches/add_window_back_to_compositor.diff 2016-04-13 14:31:08.000000000 +0000 @@ -0,0 +1,68 @@ +Description: compositor: add window back to compositor + Remove window from compositor when calling meta_window_free and + make sure to re-add window to the compositor when we re-create + MetaWindow on MapRequest. +Origin: upstream, https://git.gnome.org/browse/metacity/commit/?id=04c99abaa2825c0c +Bug: https://bugs.launchpad.net/bugs/1538111 +Last-Update: 2016-04-13 + +--- a/src/compositor/compositor-xrender.c ++++ b/src/compositor/compositor-xrender.c +@@ -2864,28 +2864,12 @@ + { + #ifdef HAVE_COMPOSITE_EXTENSIONS + MetaCompositorXRender *xrc; +- MetaFrame *frame; + Window xwindow; + + xrc = (MetaCompositorXRender *) compositor; +- frame = meta_window_get_frame (window); +- xwindow = None; ++ xwindow = meta_window_get_xwindow (window); + +- if (frame) +- { +- xwindow = meta_frame_get_xwindow (frame); +- } +- else +- { +- /* FIXME: When an undecorated window is hidden this is called, but the +- * window does not get readded if it is subsequentally shown again. See: +- * http://bugzilla.gnome.org/show_bug.cgi?id=504876 +- */ +- /* xwindow = meta_window_get_xwindow (window); */ +- } +- +- if (xwindow != None) +- destroy_win (xrc->display, xwindow, FALSE); ++ destroy_win (xrc->display, xwindow, FALSE); + #endif + } + +--- a/src/core/display.c ++++ b/src/core/display.c +@@ -2116,8 +2116,22 @@ + case MapRequest: + if (window == NULL) + { +- window = meta_window_new (display, event->xmaprequest.window, +- FALSE); ++ Window xwindow; ++ XWindowAttributes attr; ++ int result; ++ ++ xwindow = event->xmaprequest.window; ++ window = meta_window_new (display, xwindow, FALSE); ++ ++ meta_error_trap_push (display); ++ result = XGetWindowAttributes (display->xdisplay, xwindow, &attr); ++ meta_error_trap_pop (display, TRUE); ++ ++ if (result != 0) ++ { ++ meta_compositor_add_window (display->compositor, window, ++ xwindow, &attr); ++ } + } + /* if frame was receiver it's some malicious send event or something */ + else if (!frame_was_receiver && window) diff -Nru metacity-3.18.3/debian/patches/series metacity-3.18.3/debian/patches/series --- metacity-3.18.3/debian/patches/series 2016-04-04 15:08:30.000000000 +0000 +++ metacity-3.18.3/debian/patches/series 2016-04-13 14:28:20.000000000 +0000 @@ -1 +1,2 @@ compositor_root_background.diff +add_window_back_to_compositor.diff