From bba250fa58c7484248066b11844fb9df256aa92b Mon Sep 17 00:00:00 2001 From: raveit65 Date: Mar 17 2020 14:47:55 +0000 Subject: add upstream patches to avoid crashes --- diff --git a/marco.spec b/marco.spec index 2ee1092..1186f1e 100644 --- a/marco.spec +++ b/marco.spec @@ -15,7 +15,7 @@ Name: marco Version: %{branch}.4 %if 0%{?rel_build} -Release: 1%{?dist} +Release: 2%{?dist} %else Release: 0.10%{?git_rel}%{?dist} %endif @@ -29,6 +29,30 @@ URL: http://mate-desktop.org # Source for snapshot-builds. %{!?rel_build:Source0: http://git.mate-desktop.org/%{name}/snapshot/%{name}-%{commit}.tar.xz#/%{git_tar}} +# https://github.com/mate-desktop/marco/commit/b07f3f3 +Patch1: marco_0001-fix-window-type-for-splash-1.22.patch +# https://github.com/mate-desktop/marco/commit/26864e5 +Patch2: marco_0002-display.c-add-missing-break-1.22.patch +# https://github.com/mate-desktop/marco/commit/50cc7c7 +Patch3: marco_0003-testboxes-Fix-find_closest_point_to_line-test-1.22.patch +# https://github.com/mate-desktop/marco/commit/251a84f +Patch4: marco_0004-Xprops-fix-memory-leak-1.22.patch +# https://github.com/mate-desktop/marco/commit/897a11c +Patch5: marco_0005-window-handle-legacy-fullscreen-requests-1.22.patch +# https://github.com/mate-desktop/marco/commit/556c4ff +Patch6: marco_0007-util-meta_bug-raises-SIGABRT-so-it-shouldn-t-return-1.22.patch +# https://github.com/mate-desktop/marco/commit/f77dbd2 +Patch7: marco_0008-Introduce-nullpointer-checks-and-return-null-if-vali-1.22.patch +# https://github.com/mate-desktop/marco/commit/4ae91ff +Patch8: marco_0009-Guard-against-null-changes-introduced-by-previous-co-1.22.patch +# https://github.com/mate-desktop/marco/pull/605 +Patch9: marco_0001-Remove-unnecessary-warnings-about-visible-region-1.22.patch +# https://github.com/mate-desktop/marco/pull/601 +Patch10: marco_0001-window-fix-crash-if-workspace-is-null-1.22.patch +Patch11: marco_0002-compositor-fix-possible-crash-closing-destroying-win-1.22.patch +Patch12: marco_0003-stack-make-meta_window_raise-and-meta_window_lower-s-1.22.patch +Patch13: marco_0004-workspace-Don-t-try-to-use-per-workspace-MRU-lists-a-1.22.patch + BuildRequires: desktop-file-utils BuildRequires: gtk3-devel BuildRequires: libcanberra-devel @@ -145,6 +169,19 @@ desktop-file-install \ %changelog +* Tue Mar 17 2020 Wolfgang Ulbrich - 1.22.4-2 +- add upstream patches to avoid crashes +- use https://github.com/mate-desktop/marco/commit/b07f3f3 +- use https://github.com/mate-desktop/marco/commit/26864e5 +- use https://github.com/mate-desktop/marco/commit/50cc7c7 +- use https://github.com/mate-desktop/marco/commit/251a84f +- use https://github.com/mate-desktop/marco/commit/897a11c +- use https://github.com/mate-desktop/marco/commit/556c4ff +- use https://github.com/mate-desktop/marco/commit/f77dbd2 +- use https://github.com/mate-desktop/marco/commit/4ae91ff +- use https://github.com/mate-desktop/marco/pull/605 +- use https://github.com/mate-desktop/marco/pull/601 + * Fri Dec 06 2019 Wolfgang Ulbrich - 1.22.4-1 - update to 1.22.4 diff --git a/marco_0001-Remove-unnecessary-warnings-about-visible-region-1.22.patch b/marco_0001-Remove-unnecessary-warnings-about-visible-region-1.22.patch new file mode 100644 index 0000000..afb7736 --- /dev/null +++ b/marco_0001-Remove-unnecessary-warnings-about-visible-region-1.22.patch @@ -0,0 +1,57 @@ +From 03e1106f9d3b5677044923f8a4bc3ce4efe1e533 Mon Sep 17 00:00:00 2001 +From: Victor Kareh +Date: Mon, 9 Mar 2020 07:57:26 -0400 +Subject: [PATCH 1/5] Remove unnecessary warnings about visible region + +Also reformat recent code change to fix styling issues. +--- + src/compositor/compositor-xrender.c | 6 +----- + src/core/frame.c | 13 +++++++------ + 2 files changed, 8 insertions(+), 11 deletions(-) + +diff --git a/src/compositor/compositor-xrender.c b/src/compositor/compositor-xrender.c +index 4a05bc7a..59fbd93f 100644 +--- a/src/compositor/compositor-xrender.c ++++ b/src/compositor/compositor-xrender.c +@@ -1153,13 +1153,9 @@ border_size (MetaCompWindow *cw) + { + visible_region = meta_window_get_frame_bounds (cw->window); + +- if (visible_region != NULL) { ++ if (visible_region != NULL) + visible = cairo_region_to_xserver_region (xdisplay, visible_region); +- } +- else { +- g_warning ("Visible region is null"); + } +- } + + meta_error_trap_push (display); + border = XFixesCreateRegionFromWindow (xdisplay, cw->id, +diff --git a/src/core/frame.c b/src/core/frame.c +index 7ad74e5e..e85f77a2 100644 +--- a/src/core/frame.c ++++ b/src/core/frame.c +@@ -408,12 +408,13 @@ meta_frame_sync_to_window (MetaFrame *frame, + cairo_region_t * + meta_frame_get_frame_bounds (MetaFrame *frame) + { +- if(frame->xwindow && frame->window !=NULL && frame->window->screen !=NULL && frame->window->screen->ui !=NULL) { +- return meta_ui_get_frame_bounds (frame->window->screen->ui, +- frame->xwindow, +- frame->rect.width, +- frame->rect.height); +- } ++ if (frame->xwindow && frame->window != NULL && frame->window->screen != NULL && frame->window->screen->ui != NULL) ++ { ++ return meta_ui_get_frame_bounds (frame->window->screen->ui, ++ frame->xwindow, ++ frame->rect.width, ++ frame->rect.height); ++ } + return NULL; + } + +-- +2.21.1 + diff --git a/marco_0001-fix-window-type-for-splash-1.22.patch b/marco_0001-fix-window-type-for-splash-1.22.patch new file mode 100644 index 0000000..4b34823 --- /dev/null +++ b/marco_0001-fix-window-type-for-splash-1.22.patch @@ -0,0 +1,25 @@ +From b07f3f3d72aa34a1bbffb59aa33cb7e53ed3ae3d Mon Sep 17 00:00:00 2001 +From: Wu Xiaotian +Date: Wed, 29 May 2019 11:17:00 +0800 +Subject: [PATCH 1/9] fix window type for splash + +--- + src/tools/marco-window-demo.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/tools/marco-window-demo.c b/src/tools/marco-window-demo.c +index 8b3d8e43..c7268c36 100644 +--- a/src/tools/marco-window-demo.c ++++ b/src/tools/marco-window-demo.c +@@ -528,7 +528,7 @@ splashscreen_cb (GSimpleAction *action, + GtkWidget *vbox; + + window = gtk_window_new (GTK_WINDOW_TOPLEVEL); +- set_gtk_window_type (GTK_WINDOW (window), "_NET_WM_WINDOW_TYPE_SPLASHSCREEN"); ++ set_gtk_window_type (GTK_WINDOW (window), "_NET_WM_WINDOW_TYPE_SPLASH"); + gtk_window_set_title (GTK_WINDOW (window), "Splashscreen"); + + vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); +-- +2.21.1 + diff --git a/marco_0001-window-fix-crash-if-workspace-is-null-1.22.patch b/marco_0001-window-fix-crash-if-workspace-is-null-1.22.patch new file mode 100644 index 0000000..521fef9 --- /dev/null +++ b/marco_0001-window-fix-crash-if-workspace-is-null-1.22.patch @@ -0,0 +1,29 @@ +From 6cef297f2b219883946d4ea4dec998cdfb2c57e8 Mon Sep 17 00:00:00 2001 +From: rcaridade145 +Date: Sat, 29 Feb 2020 12:01:51 +0000 +Subject: [PATCH 1/4] window: fix crash if workspace is null + +Based on commit https://gitlab.gnome.org/GNOME/metacity/-/commit/24d35569bdb78d1da3b53ed1a6d81d365d60bed0 +--- + src/core/window.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/core/window.c b/src/core/window.c +index 99ac36b8..30263e96 100644 +--- a/src/core/window.c ++++ b/src/core/window.c +@@ -2102,9 +2102,10 @@ windows_overlap (const MetaWindow *w1, const MetaWindow *w2) + static gboolean + window_would_be_covered (const MetaWindow *newbie) + { +- MetaWorkspace *workspace = newbie->workspace; ++ MetaWorkspace *workspace; + GList *tmp, *windows; + ++ workspace = meta_window_get_workspace ((MetaWindow *) newbie); + windows = meta_workspace_list_windows (workspace); + + tmp = windows; +-- +2.21.1 + diff --git a/marco_0002-compositor-fix-possible-crash-closing-destroying-win-1.22.patch b/marco_0002-compositor-fix-possible-crash-closing-destroying-win-1.22.patch new file mode 100644 index 0000000..567330d --- /dev/null +++ b/marco_0002-compositor-fix-possible-crash-closing-destroying-win-1.22.patch @@ -0,0 +1,150 @@ +From 94a480ed67c51c2e74a231b9af32c55d2e8c8376 Mon Sep 17 00:00:00 2001 +From: rcaridade145 +Date: Sat, 29 Feb 2020 13:01:36 +0000 +Subject: [PATCH 2/4] compositor: fix possible crash closing/destroying window + . Fixes to previous commit. + +Partially restore call to destroy_win in compositor when calling +meta_window_free. This is needed to ensure that we never call +meta_window_get_frame_bounds while windows is destroying. + +https://bugzilla.gnome.org/show_bug.cgi?id=751833 + +Based on commit https://gitlab.gnome.org/GNOME/metacity/-/commit/a9f28dbc26f5211ef08889109db3dc8c7ba76aca +--- + src/compositor/compositor-private.h | 3 +++ + src/compositor/compositor-xrender.c | 36 +++++++++++++++++++++-------- + src/compositor/compositor.c | 4 ++++ + src/core/window-private.h | 3 +++ + src/core/window.c | 11 +++++++++ + 5 files changed, 48 insertions(+), 9 deletions(-) + +diff --git a/src/compositor/compositor-private.h b/src/compositor/compositor-private.h +index fcb15187..1fa64695 100644 +--- a/src/compositor/compositor-private.h ++++ b/src/compositor/compositor-private.h +@@ -50,6 +50,9 @@ struct _MetaCompositor + MetaScreen *screen, + MetaWindow *window); + ++ void (*free_window) (MetaCompositor *compositor, ++ MetaWindow *window); ++ + void (*maximize_window) (MetaCompositor *compositor, + MetaWindow *window); + void (*unmaximize_window) (MetaCompositor *compositor, +diff --git a/src/compositor/compositor-xrender.c b/src/compositor/compositor-xrender.c +index 4a05bc7a..43a76394 100644 +--- a/src/compositor/compositor-xrender.c ++++ b/src/compositor/compositor-xrender.c +@@ -3045,22 +3045,39 @@ xrender_end_move (MetaCompositor *compositor, + #endif + } + ++#endif /* 0 */ ++ + static void + xrender_free_window (MetaCompositor *compositor, + MetaWindow *window) + { + #ifdef HAVE_COMPOSITE_EXTENSIONS +- /* 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 +- +- I don't *think* theres any need for this call anyway, leaving it out +- does not seem to cause any side effects so far, but I should check with +- someone who understands more. */ +- /* destroy_win (compositor->display, window->xwindow, FALSE); */ ++ MetaCompositorXRender *xrc; ++ MetaFrame *frame; ++ Window xwindow; ++ ++ xrc = (MetaCompositorXRender *) compositor; ++ frame = meta_window_get_frame (window); ++ xwindow = None; ++ ++ 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); + #endif + } +-#endif /* 0 */ ++ + + static void + xrender_process_event (MetaCompositor *compositor, +@@ -3364,6 +3381,7 @@ static MetaCompositor comp_info = { + xrender_process_event, + xrender_get_window_surface, + xrender_set_active_window, ++ xrender_free_window, + xrender_maximize_window, + xrender_unmaximize_window, + }; +diff --git a/src/compositor/compositor.c b/src/compositor/compositor.c +index 7e3c79c2..68f54d92 100644 +--- a/src/compositor/compositor.c ++++ b/src/compositor/compositor.c +@@ -156,6 +156,10 @@ void meta_compositor_end_move (MetaCompositor *compositor, + void meta_compositor_free_window (MetaCompositor *compositor, + MetaWindow *window) + { ++ #ifdef HAVE_COMPOSITE_EXTENSIONS ++ if (compositor && compositor->free_window) ++ compositor->free_window (compositor, window); ++ #endif + } + + void +diff --git a/src/core/window-private.h b/src/core/window-private.h +index ada9f8bb..fa43eac5 100644 +--- a/src/core/window-private.h ++++ b/src/core/window-private.h +@@ -608,6 +608,9 @@ void meta_window_set_gravity (MetaWindow *window, + void meta_window_handle_mouse_grab_op_event (MetaWindow *window, + XEvent *event); + ++MetaWorkspace * ++meta_window_get_workspace (MetaWindow *window); ++ + GList* meta_window_get_workspaces (MetaWindow *window); + + gboolean meta_window_located_on_workspace (MetaWindow *window, +diff --git a/src/core/window.c b/src/core/window.c +index 30263e96..f9405976 100644 +--- a/src/core/window.c ++++ b/src/core/window.c +@@ -6223,6 +6223,17 @@ idle_update_icon (gpointer data) + return FALSE; + } + ++ ++MetaWorkspace * ++meta_window_get_workspace (MetaWindow *window) ++{ ++ if (window->on_all_workspaces) ++ return window->screen->active_workspace; ++ else ++ return window->workspace; ++} ++ ++ + GList* + meta_window_get_workspaces (MetaWindow *window) + { +-- +2.21.1 + diff --git a/marco_0002-display.c-add-missing-break-1.22.patch b/marco_0002-display.c-add-missing-break-1.22.patch new file mode 100644 index 0000000..9f4c7af --- /dev/null +++ b/marco_0002-display.c-add-missing-break-1.22.patch @@ -0,0 +1,25 @@ +From 26864e5fd207a7cd000fd1b6aaa2f041ce8261ef Mon Sep 17 00:00:00 2001 +From: Pavel Shlyak +Date: Sun, 25 Aug 2019 15:15:18 +0300 +Subject: [PATCH 2/9] display.c: add missing "break" + +--- + src/core/display.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/core/display.c b/src/core/display.c +index 41ba1ff5..6916a811 100644 +--- a/src/core/display.c ++++ b/src/core/display.c +@@ -3726,7 +3726,7 @@ meta_display_begin_grab_op (MetaDisplay *display, + meta_screen_ensure_tab_popup (screen, + META_TAB_LIST_GROUP, + META_TAB_SHOW_INSTANTLY); +- ++ break; + case META_GRAB_OP_KEYBOARD_WORKSPACE_SWITCHING: + case META_GRAB_OP_KEYBOARD_WORKSPACE_MOVING: + meta_screen_ensure_workspace_popup (screen); +-- +2.21.1 + diff --git a/marco_0003-stack-make-meta_window_raise-and-meta_window_lower-s-1.22.patch b/marco_0003-stack-make-meta_window_raise-and-meta_window_lower-s-1.22.patch new file mode 100644 index 0000000..49f5adc --- /dev/null +++ b/marco_0003-stack-make-meta_window_raise-and-meta_window_lower-s-1.22.patch @@ -0,0 +1,83 @@ +From fb2abec45170ffd81659c40fd5d2f6c1455fa651 Mon Sep 17 00:00:00 2001 +From: rcaridade145 +Date: Tue, 3 Mar 2020 20:05:27 +0000 +Subject: [PATCH 3/4] stack: make meta_window_raise() and meta_window_lower() + smarter + +https://bugzilla.gnome.org/show_bug.cgi?id=620744 + +Based on commit https://gitlab.gnome.org/GNOME/metacity/-/commit/9245f9588bd7c17ccbe04df65c1579313cbad07b +--- + src/core/stack.c | 42 +++++++++++++++++++++++++++++++++++++++--- + 1 file changed, 39 insertions(+), 3 deletions(-) + +diff --git a/src/core/stack.c b/src/core/stack.c +index 23a257b8..fa4dbee3 100644 +--- a/src/core/stack.c ++++ b/src/core/stack.c +@@ -181,8 +181,25 @@ void + meta_stack_raise (MetaStack *stack, + MetaWindow *window) + { +- meta_window_set_stack_position_no_sync (window, +- stack->n_positions - 1); ++ GList *l; ++ int max_stack_position = window->stack_position; ++ MetaWorkspace *workspace; ++ ++ g_assert (stack->added == NULL); ++ ++ workspace = meta_window_get_workspace (window); ++ for (l = stack->sorted; l; l = l->next) ++ { ++ MetaWindow *w = (MetaWindow *) l->data; ++ if (meta_window_located_on_workspace (w, workspace) && ++ w->stack_position > max_stack_position) ++ max_stack_position = w->stack_position; ++ } ++ ++ if (max_stack_position == window->stack_position) ++ return; ++ ++ meta_window_set_stack_position_no_sync (window, max_stack_position); + + stack_sync_to_server (stack); + } +@@ -191,7 +208,25 @@ void + meta_stack_lower (MetaStack *stack, + MetaWindow *window) + { +- meta_window_set_stack_position_no_sync (window, 0); ++ GList *l; ++ int min_stack_position = window->stack_position; ++ MetaWorkspace *workspace; ++ ++ g_assert (stack->added == NULL); ++ ++ workspace = meta_window_get_workspace (window); ++ for (l = stack->sorted; l; l = l->next) ++ { ++ MetaWindow *w = (MetaWindow *) l->data; ++ if (meta_window_located_on_workspace (w, workspace) && ++ w->stack_position < min_stack_position) ++ min_stack_position = w->stack_position; ++ } ++ ++ if (min_stack_position == window->stack_position) ++ return; ++ ++ meta_window_set_stack_position_no_sync (window, min_stack_position); + + stack_sync_to_server (stack); + } +@@ -202,6 +237,7 @@ meta_stack_freeze (MetaStack *stack) + stack->freeze_count += 1; + } + ++ + void + meta_stack_thaw (MetaStack *stack) + { +-- +2.21.1 + diff --git a/marco_0003-testboxes-Fix-find_closest_point_to_line-test-1.22.patch b/marco_0003-testboxes-Fix-find_closest_point_to_line-test-1.22.patch new file mode 100644 index 0000000..bfd75d9 --- /dev/null +++ b/marco_0003-testboxes-Fix-find_closest_point_to_line-test-1.22.patch @@ -0,0 +1,72 @@ +From 50cc7c7f2b4b8975779a34c30c052fdd7a3aaf34 Mon Sep 17 00:00:00 2001 +From: Victor Kareh +Date: Mon, 23 Sep 2019 14:55:54 -0400 +Subject: [PATCH 3/9] testboxes: Fix find_closest_point_to_line() test + +Eeeks, testing floating points for equality ... + +upstream commit: +https://gitlab.gnome.org/GNOME/mutter/commit/0fccb0fc8 +--- + src/core/testboxes.c | 10 ++++++---- + 1 file changed, 6 insertions(+), 4 deletions(-) + +diff --git a/src/core/testboxes.c b/src/core/testboxes.c +index dfd65c69..b9aa92ff 100644 +--- a/src/core/testboxes.c ++++ b/src/core/testboxes.c +@@ -27,6 +27,7 @@ + #include + #include /* Just for the definition of the various gravities */ + #include /* To initialize random seed */ ++#include + + #define NUM_RANDOM_RUNS 10000 + +@@ -1340,6 +1341,7 @@ test_gravity_resize () + printf ("%s passed.\n", G_STRFUNC); + } + ++#define EPSILON 0.000000001 + static void + test_find_closest_point_to_line () + { +@@ -1354,7 +1356,7 @@ test_find_closest_point_to_line () + x2, y2, + px, py, + &rx, &ry); +- g_assert (rx == answer_x && ry == answer_y); ++ g_assert (fabs (rx - answer_x) < EPSILON && fabs (ry - answer_y) < EPSILON); + + /* Special test for x1 == x2, so that slop of line is infinite */ + x1 = 3.0; y1 = 49.0; +@@ -1365,7 +1367,7 @@ test_find_closest_point_to_line () + x2, y2, + px, py, + &rx, &ry); +- g_assert (rx == answer_x && ry == answer_y); ++ g_assert (fabs (rx - answer_x) < EPSILON && fabs (ry - answer_y) < EPSILON); + + /* Special test for y1 == y2, so perp line has slope of infinity */ + x1 = 3.14; y1 = 7.0; +@@ -1376,7 +1378,7 @@ test_find_closest_point_to_line () + x2, y2, + px, py, + &rx, &ry); +- g_assert (rx == answer_x && ry == answer_y); ++ g_assert (fabs (rx - answer_x) < EPSILON && fabs (ry - answer_y) < EPSILON); + + /* Test when we the point we want to be closest to is actually on the line */ + x1 = 3.0; y1 = 49.0; +@@ -1387,7 +1389,7 @@ test_find_closest_point_to_line () + x2, y2, + px, py, + &rx, &ry); +- g_assert (rx == answer_x && ry == answer_y); ++ g_assert (fabs (rx - answer_x) < EPSILON && fabs (ry - answer_y) < EPSILON); + + printf ("%s passed.\n", G_STRFUNC); + } +-- +2.21.1 + diff --git a/marco_0004-Xprops-fix-memory-leak-1.22.patch b/marco_0004-Xprops-fix-memory-leak-1.22.patch new file mode 100644 index 0000000..25d75a8 --- /dev/null +++ b/marco_0004-Xprops-fix-memory-leak-1.22.patch @@ -0,0 +1,53 @@ +From 251a84f0e5450a3b89385097c62be9285b45b62a Mon Sep 17 00:00:00 2001 +From: rcaridade145 +Date: Sat, 11 Jan 2020 13:10:12 +0000 +Subject: [PATCH 4/9] Xprops fix memory leak. Origin commit : + https://gitlab.gnome.org/GNOME/metacity/commit/c87f73f3b4413720a2f3e6a672826d3fec7f77a9 + " XmbTextPropertyToTextList documentation says that XFreeStringList should be + used to free the storage for the list and its contents. " + +--- + src/core/xprops.c | 18 ++++++++++++------ + 1 file changed, 12 insertions(+), 6 deletions(-) + +diff --git a/src/core/xprops.c b/src/core/xprops.c +index 80dd7b59..938bdce4 100644 +--- a/src/core/xprops.c ++++ b/src/core/xprops.c +@@ -652,21 +652,27 @@ text_property_to_utf8 (Display *xdisplay, + { + char *ret = NULL; + char **local_list = NULL; ++ const char *charset = NULL; + int count = 0; + int res; + + res = XmbTextPropertyToTextList (xdisplay, prop, &local_list, &count); + if (res == XNoMemory || res == XLocaleNotSupported || res == XConverterNotFound) +- goto out; ++ return NULL; + + if (count == 0) +- goto out; ++ { ++ XFreeStringList (local_list); ++ return NULL; ++ } + +- ret = g_strdup (local_list[0]); ++ if (g_get_charset (&charset)) ++ ret = g_strdup (local_list[0]); ++ else ++ ret = g_convert (local_list[0], -1, "UTF-8", charset, NULL, NULL, NULL); + +- out: +- meta_XFree (local_list); +- return ret; ++ XFreeStringList (local_list); ++ return ret; + } + + static gboolean +-- +2.21.1 + diff --git a/marco_0004-workspace-Don-t-try-to-use-per-workspace-MRU-lists-a-1.22.patch b/marco_0004-workspace-Don-t-try-to-use-per-workspace-MRU-lists-a-1.22.patch new file mode 100644 index 0000000..0136b87 --- /dev/null +++ b/marco_0004-workspace-Don-t-try-to-use-per-workspace-MRU-lists-a-1.22.patch @@ -0,0 +1,150 @@ +From 8f9435ab776dc7c26a0ecc68be2755c4058d30d3 Mon Sep 17 00:00:00 2001 +From: rcaridade145 +Date: Tue, 3 Mar 2020 20:51:17 +0000 +Subject: [PATCH 4/4] workspace: Don't try to use per-workspace MRU lists as a + hint for focusing + +A prior commit switched from focusing the topmost window as the default +window to focusing the MRU window. This was done in alignment with the +introduction of per-workspace MRU lists to avoid problems where the window +stack was inadvertently changed when focusing windows during window switches. + +Now that focusing windows don't have as big an impact on the stacking order, +we can revert back to focusing the top window, which is less confusing to the +user. + +For now, leave per-workspace MRU lists, as they're a pretty good approximation +of a global MRU list, and it works well enough. + +https://bugzilla.gnome.org/show_bug.cgi?id=620744 + +Based on commit https://gitlab.gnome.org/GNOME/metacity/-/commit/f628d8f8901f46fa9e00707ae9d7ccfd1e85f427 +--- + doc/how-to-get-focus-right.txt | 2 +- + src/core/workspace.c | 42 +++++----------------------------- + src/core/workspace.h | 11 +++++++++ + 3 files changed, 18 insertions(+), 37 deletions(-) + +diff --git a/doc/how-to-get-focus-right.txt b/doc/how-to-get-focus-right.txt +index 45c0f378..b9ccee6d 100644 +--- a/doc/how-to-get-focus-right.txt ++++ b/doc/how-to-get-focus-right.txt +@@ -7,7 +7,7 @@ end of the discussion for how these special cases are handled.) The + basics are easy: + + Focus method Behavior +- click When a user clicks on a window, focus it ++ click Focus the window on top + sloppy When an EnterNotify is received, focus the window + mouse Same as sloppy, but also defocus when mouse enters DESKTOP + window +diff --git a/src/core/workspace.c b/src/core/workspace.c +index dffb1ebf..b83491e3 100644 +--- a/src/core/workspace.c ++++ b/src/core/workspace.c +@@ -33,7 +33,7 @@ + + void meta_workspace_queue_calc_showing (MetaWorkspace *workspace); + static void set_active_space_hint (MetaScreen *screen); +-static void focus_ancestor_or_mru_window (MetaWorkspace *workspace, ++static void focus_ancestor_or_top_window (MetaWorkspace *workspace, + MetaWindow *not_this_one, + guint32 timestamp); + static void free_this (gpointer candidate, +@@ -971,7 +971,7 @@ meta_workspace_focus_default_window (MetaWorkspace *workspace, + + if (meta_prefs_get_focus_mode () == META_FOCUS_MODE_CLICK || + !workspace->screen->display->mouse_mode) +- focus_ancestor_or_mru_window (workspace, not_this_one, timestamp); ++ focus_ancestor_or_top_window (workspace, not_this_one, timestamp); + else + { + MetaWindow * window; +@@ -1008,7 +1008,7 @@ meta_workspace_focus_default_window (MetaWorkspace *workspace, + } + } + else if (meta_prefs_get_focus_mode () == META_FOCUS_MODE_SLOPPY) +- focus_ancestor_or_mru_window (workspace, not_this_one, timestamp); ++ focus_ancestor_or_top_window (workspace, not_this_one, timestamp); + else if (meta_prefs_get_focus_mode () == META_FOCUS_MODE_MOUSE) + { + meta_topic (META_DEBUG_FOCUS, +@@ -1035,13 +1035,11 @@ record_ancestor (MetaWindow *window, + * window on active workspace + */ + static void +-focus_ancestor_or_mru_window (MetaWorkspace *workspace, ++focus_ancestor_or_top_window (MetaWorkspace *workspace, + MetaWindow *not_this_one, + guint32 timestamp) + { + MetaWindow *window = NULL; +- MetaWindow *desktop_window = NULL; +- GList *tmp; + + if (not_this_one) + meta_topic (META_DEBUG_FOCUS, +@@ -1072,36 +1070,8 @@ focus_ancestor_or_mru_window (MetaWorkspace *workspace, + } + } + +- /* No ancestor, look for the MRU window */ +- tmp = workspace->mru_list; +- +- while (tmp) +- { +- MetaWindow* tmp_window; +- tmp_window = ((MetaWindow*) tmp->data); +- if (tmp_window != not_this_one && +- meta_window_showing_on_its_workspace (tmp_window) && +- tmp_window->type != META_WINDOW_DOCK && +- tmp_window->type != META_WINDOW_DESKTOP) +- { +- window = tmp->data; +- break; +- } +- else if (tmp_window != not_this_one && +- desktop_window == NULL && +- meta_window_showing_on_its_workspace (tmp_window) && +- tmp_window->type == META_WINDOW_DESKTOP) +- { +- /* Found the most recently used desktop window */ +- desktop_window = tmp_window; +- } +- +- tmp = tmp->next; +- } +- +- /* If no window was found, default to the MRU desktop-window */ +- if (window == NULL) +- window = desktop_window; ++ window = meta_stack_get_default_focus_window (workspace->screen->stack, ++ workspace, NULL); + + if (window) + { +diff --git a/src/core/workspace.h b/src/core/workspace.h +index 7d02861e..b8ea3c97 100644 +--- a/src/core/workspace.h ++++ b/src/core/workspace.h +@@ -52,6 +52,17 @@ struct _MetaWorkspace + MetaScreen *screen; + + GList *windows; ++ ++ /* The "MRU list", or "most recently used" list, is a list of ++ * MetaWindows ordered based on the time the the user interacted ++ * with the window most recently. ++ * ++ * For historical reasons, we keep an MRU list per workspace. ++ * It used to be used to calculate the default focused window, ++ * but isn't anymore, as the window next in the stacking order ++ * can sometimes be not the window the user interacted with last, ++ */ ++ + GList *mru_list; + + GList *list_containing_self; +-- +2.21.1 + diff --git a/marco_0005-window-handle-legacy-fullscreen-requests-1.22.patch b/marco_0005-window-handle-legacy-fullscreen-requests-1.22.patch new file mode 100644 index 0000000..2dce9e2 --- /dev/null +++ b/marco_0005-window-handle-legacy-fullscreen-requests-1.22.patch @@ -0,0 +1,112 @@ +From 897a11c196081a31b3cd6035270da28039cb0e52 Mon Sep 17 00:00:00 2001 +From: rcaridade145 +Date: Sat, 25 Jan 2020 18:27:26 +0000 +Subject: [PATCH 5/9] window: handle legacy fullscreen requests +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +https://gitlab.gnome.org/GNOME/metacity/commit/1fafd279006ece8cf664fd777143cdfafbefad6d + +window: handle legacy fullscreen requests + +Doing this on the actual resize requests makes more sense +than handling it as a window-manager imposed constraints, +so move the code accordingly. + +Adapted from mutter patch by Florian Müllner: +https://git.gnome.org/browse/mutter/commit/?id=fba022cc06b8c7e80ef36f48d6577a251384cc4b + +https://bugzilla.gnome.org/show_bug.cgi?id=781946 + +Bug 781946 - Non-native decorated windows stuck maximised on secondary screen with Marco/Metacity +--- + src/core/constraints.c | 23 ----------------------- + src/core/window.c | 31 ++++++++++++++++++++++++++++++- + 2 files changed, 30 insertions(+), 24 deletions(-) + +diff --git a/src/core/constraints.c b/src/core/constraints.c +index a82154e0..ed70b40b 100644 +--- a/src/core/constraints.c ++++ b/src/core/constraints.c +@@ -447,29 +447,6 @@ setup_constraint_info (ConstraintInfo *info, + meta_workspace_get_onxinerama_region (cur_workspace, + xinerama_info->number); + +- /* Workaround braindead legacy apps that don't know how to +- * fullscreen themselves properly - don't get fooled by +- * windows which hide their titlebar when maximized or which are +- * client decorated; that's not the same as fullscreen, even +- * if there are no struts making the workarea smaller than +- * the monitor. +- */ +- +- if (meta_prefs_get_force_fullscreen() && +- (window->decorated || !meta_window_is_client_decorated (window)) && +- meta_rectangle_equal (new, &xinerama_info->rect) && +- window->has_fullscreen_func && +- !window->fullscreen) +- { +- /* +- meta_topic (META_DEBUG_GEOMETRY, +- */ +- meta_warning ( +- "Treating resize request of legacy application %s as a " +- "fullscreen request\n", +- window->desc); +- meta_window_make_fullscreen_internal (window); +- } + + /* Log all this information for debugging */ + meta_topic (META_DEBUG_GEOMETRY, +diff --git a/src/core/window.c b/src/core/window.c +index bc10e272..99ac36b8 100644 +--- a/src/core/window.c ++++ b/src/core/window.c +@@ -4974,13 +4974,42 @@ meta_window_move_resize_request (MetaWindow *window, + flags |= META_IS_RESIZE_ACTION; + + if (flags & (META_IS_MOVE_ACTION | META_IS_RESIZE_ACTION)) +- meta_window_move_resize_internal (window, ++ { ++ const MetaXineramaScreenInfo *xinerama_info; ++ MetaRectangle rect; ++ ++ rect.x = x; ++ rect.y = y; ++ rect.width = width; ++ rect.height = height; ++ ++ xinerama_info = meta_screen_get_xinerama_for_rect (window->screen, &rect); ++ ++ /* Workaround braindead legacy apps that don't know how to ++ * fullscreen themselves properly - don't get fooled by ++ * windows which are client decorated; that's not the same ++ * as fullscreen, even if there are no struts making the ++ * workarea smaller than the monitor. ++ */ ++ if (meta_prefs_get_force_fullscreen() && ++ (window->decorated || !meta_window_is_client_decorated (window)) && ++ meta_rectangle_equal (&rect, &xinerama_info->rect) && ++ window->has_fullscreen_func && ++ !window->fullscreen) ++ { ++ g_warning ("Treating resize request of legacy application %s as a " ++ "fullscreen request", window->desc); ++ meta_window_make_fullscreen_internal (window); ++ } ++ meta_window_move_resize_internal (window, + flags, + gravity, + x, + y, + width, + height); ++ ++ } + + /* window->user_rect exists to allow "snapping-back" the window if a + * new strut is set (causing the window to move) and then the strut +-- +2.21.1 + diff --git a/marco_0007-util-meta_bug-raises-SIGABRT-so-it-shouldn-t-return-1.22.patch b/marco_0007-util-meta_bug-raises-SIGABRT-so-it-shouldn-t-return-1.22.patch new file mode 100644 index 0000000..1e4bb09 --- /dev/null +++ b/marco_0007-util-meta_bug-raises-SIGABRT-so-it-shouldn-t-return-1.22.patch @@ -0,0 +1,39 @@ +From 556c4ffd0051da4191bff37be9dc94d94f365af9 Mon Sep 17 00:00:00 2001 +From: rbuj +Date: Mon, 3 Feb 2020 16:29:26 +0100 +Subject: [PATCH 7/9] util: meta_bug raises SIGABRT so it shouldn't return + +--- + src/core/util.c | 2 +- + src/include/util.h | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/core/util.c b/src/core/util.c +index a30707a7..c638570e 100644 +--- a/src/core/util.c ++++ b/src/core/util.c +@@ -372,7 +372,7 @@ meta_bug (const char *format, ...) + gchar *str; + FILE *out; + +- g_return_if_fail (format != NULL); ++ g_assert (format != NULL); + + va_start (args, format); + str = g_strdup_vprintf (format, args); +diff --git a/src/include/util.h b/src/include/util.h +index 545357f8..d32e1895 100644 +--- a/src/include/util.h ++++ b/src/include/util.h +@@ -43,7 +43,7 @@ void meta_verbose_real (const char *format, + ...) G_GNUC_PRINTF (1, 2); + + void meta_bug (const char *format, +- ...) G_GNUC_PRINTF (1, 2); ++ ...) G_GNUC_PRINTF (1, 2) G_GNUC_NORETURN G_ANALYZER_NORETURN; + void meta_warning (const char *format, + ...) G_GNUC_PRINTF (1, 2); + void meta_fatal (const char *format, +-- +2.21.1 + diff --git a/marco_0008-Introduce-nullpointer-checks-and-return-null-if-vali-1.22.patch b/marco_0008-Introduce-nullpointer-checks-and-return-null-if-vali-1.22.patch new file mode 100644 index 0000000..b705a08 --- /dev/null +++ b/marco_0008-Introduce-nullpointer-checks-and-return-null-if-vali-1.22.patch @@ -0,0 +1,35 @@ +From f77dbd234236322d99ae4df6bf07d06db7709d3a Mon Sep 17 00:00:00 2001 +From: rcaridade145 +Date: Sat, 22 Feb 2020 11:59:45 +0000 +Subject: [PATCH 8/9] Introduce nullpointer checks and return null if + validation fails + +--- + src/core/frame.c | 11 +++++++---- + 1 file changed, 7 insertions(+), 4 deletions(-) + +diff --git a/src/core/frame.c b/src/core/frame.c +index f6e884a5..7ad74e5e 100644 +--- a/src/core/frame.c ++++ b/src/core/frame.c +@@ -408,10 +408,13 @@ meta_frame_sync_to_window (MetaFrame *frame, + cairo_region_t * + meta_frame_get_frame_bounds (MetaFrame *frame) + { +- return meta_ui_get_frame_bounds (frame->window->screen->ui, +- frame->xwindow, +- frame->rect.width, +- frame->rect.height); ++ if(frame->xwindow && frame->window !=NULL && frame->window->screen !=NULL && frame->window->screen->ui !=NULL) { ++ return meta_ui_get_frame_bounds (frame->window->screen->ui, ++ frame->xwindow, ++ frame->rect.width, ++ frame->rect.height); ++ } ++ return NULL; + } + + void +-- +2.21.1 + diff --git a/marco_0009-Guard-against-null-changes-introduced-by-previous-co-1.22.patch b/marco_0009-Guard-against-null-changes-introduced-by-previous-co-1.22.patch new file mode 100644 index 0000000..4758730 --- /dev/null +++ b/marco_0009-Guard-against-null-changes-introduced-by-previous-co-1.22.patch @@ -0,0 +1,40 @@ +From 4ae91ff847a9d4c78dbe9eb882f3bba36f7493ef Mon Sep 17 00:00:00 2001 +From: rcaridade145 +Date: Mon, 24 Feb 2020 10:42:20 +0000 +Subject: [PATCH 9/9] Guard against null changes introduced by previous commit + +--- + src/compositor/compositor-xrender.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/src/compositor/compositor-xrender.c b/src/compositor/compositor-xrender.c +index dc7ac15f..4a05bc7a 100644 +--- a/src/compositor/compositor-xrender.c ++++ b/src/compositor/compositor-xrender.c +@@ -645,7 +645,7 @@ shadow_picture_clip (Display *xdisplay, + + visible_region = meta_window_get_frame_bounds (cw->window); + +- if (!visible_region) ++ if (visible_region == NULL) + return; + + shadow_dx = -1 * (int) shadow_offsets_x [cw->shadow_type] - borders.invisible.left; +@@ -1153,9 +1153,13 @@ border_size (MetaCompWindow *cw) + { + visible_region = meta_window_get_frame_bounds (cw->window); + +- if (visible_region) ++ if (visible_region != NULL) { + visible = cairo_region_to_xserver_region (xdisplay, visible_region); ++ } ++ else { ++ g_warning ("Visible region is null"); + } ++ } + + meta_error_trap_push (display); + border = XFixesCreateRegionFromWindow (xdisplay, cw->id, +-- +2.21.1 +