Skip to content

Commit

Permalink
x11-wm/mutter: Apply multiple upstream fixes
Browse files Browse the repository at this point in the history
Package-Manager: portage-2.2.26
  • Loading branch information
pacho2 committed Jan 10, 2016
1 parent 9a10d16 commit c2837c5
Show file tree
Hide file tree
Showing 6 changed files with 329 additions and 0 deletions.
30 changes: 30 additions & 0 deletions x11-wm/mutter/files/mutter-3.18.2-bypass-hint.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
From e5067368f5379af21a16ecbc890cbc9b80f46a55 Mon Sep 17 00:00:00 2001
From: Rui Matos <[email protected]>
Date: Mon, 23 Nov 2015 15:17:38 +0100
Subject: x11/window-props: Initialize bypass compositor hint

If a client only ever sets the hint on window creation we'd never pick
the value. Also, include override redirect windows since the hint is
relevant to them too.

https://bugzilla.gnome.org/show_bug.cgi?id=758544
---
src/x11/window-props.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/x11/window-props.c b/src/x11/window-props.c
index 3268bbc..0a67980 100644
--- a/src/x11/window-props.c
+++ b/src/x11/window-props.c
@@ -1843,7 +1843,7 @@ meta_display_init_window_prop_hooks (MetaDisplay *display)
{ display->atom__NET_WM_WINDOW_TYPE, META_PROP_VALUE_ATOM_LIST, reload_net_wm_window_type, LOAD_INIT | INCLUDE_OR | FORCE_INIT },
{ display->atom__NET_WM_STRUT, META_PROP_VALUE_INVALID, reload_struts, NONE },
{ display->atom__NET_WM_STRUT_PARTIAL, META_PROP_VALUE_INVALID, reload_struts, NONE },
- { display->atom__NET_WM_BYPASS_COMPOSITOR, META_PROP_VALUE_CARDINAL, reload_bypass_compositor, NONE },
+ { display->atom__NET_WM_BYPASS_COMPOSITOR, META_PROP_VALUE_CARDINAL, reload_bypass_compositor, LOAD_INIT | INCLUDE_OR },
{ display->atom__NET_WM_WINDOW_OPACITY, META_PROP_VALUE_CARDINAL, reload_window_opacity, LOAD_INIT | INCLUDE_OR },
{ 0 },
};
--
cgit v0.11.2

56 changes: 56 additions & 0 deletions x11-wm/mutter/files/mutter-3.18.2-configure-notify.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
From 26a18e83125529605eda88a5eb60a884914c311c Mon Sep 17 00:00:00 2001
From: Rui Matos <[email protected]>
Date: Wed, 16 Dec 2015 18:26:23 +0100
Subject: x11/window: Ensure we send a ConfigureNotify to just mapped windows

When managing a non-OR window we're required by the ICCCM to behave as
if we received a ConfigureRequest which means that we must generate a
synthetic ConfigureNotify even if the window isn't moved or resized
from its current (initial) geometry.

During MetaWindow's x11/wayland split a slight behavior change for x11
windows crept in. Before the code split, MetaWindow->rect was
initialized with the X window's geometry, but now we're not
initializing MetaWindowX11Private->client_rect which causes the checks
for whether it's necessary to move/resize the window in
meta_window_x11_move_resize_internal() to tell us that we do need to
move/resize which means we do an XConfigureWindow() call and don't
send the sythetic ConfigureNotify. But since the X window isn't really
moving, the XConfigureWindow() call doesn't cause the X server to
generate a ConfigureNotify which breaks some clients such as Java's
AWT.

We can fix this by setting MetaWindowX11Privatew->client_rect for both
OR and non-OR windows. We can set buffer_rect for non-OR windows as
well to simplify the code since it will be assigned the correct value
in meta_window_x11_move_resize_internal() .

https://bugzilla.gnome.org/show_bug.cgi?id=759492
---
src/x11/window-x11.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/src/x11/window-x11.c b/src/x11/window-x11.c
index b6e5621..de9f725 100644
--- a/src/x11/window-x11.c
+++ b/src/x11/window-x11.c
@@ -542,13 +542,10 @@ meta_window_x11_manage (MetaWindow *window)
* For normal windows, do a full ConfigureRequest based on the
* window hints, as that's what the ICCCM says to do.
*/
+ priv->client_rect = window->rect;
+ window->buffer_rect = window->rect;

- if (window->override_redirect)
- {
- priv->client_rect = window->rect;
- window->buffer_rect = window->rect;
- }
- else
+ if (!window->override_redirect)
{
MetaRectangle rect;
MetaMoveResizeFlags flags;
--
cgit v0.11.2

56 changes: 56 additions & 0 deletions x11-wm/mutter/files/mutter-3.18.2-cursor-renderer.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
From 58d2bd05815a8917460ec7231a1e50ed8cedf19f Mon Sep 17 00:00:00 2001
From: Marek Chalupa <[email protected]>
Date: Mon, 9 Nov 2015 15:51:02 +0100
Subject: cursor-renderer: do not update cursor if it is out of monitor

if the cursor coordinates are out of monitor, just don't render the
cursor

https://bugzilla.gnome.org/show_bug.cgi?id=756698
---
src/backends/meta-cursor-renderer.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)

diff --git a/src/backends/meta-cursor-renderer.c b/src/backends/meta-cursor-renderer.c
index 48cd239..a76241b 100644
--- a/src/backends/meta-cursor-renderer.c
+++ b/src/backends/meta-cursor-renderer.c
@@ -27,6 +27,8 @@
#include "meta-cursor-renderer.h"

#include <meta/meta-backend.h>
+#include <backends/meta-backend-private.h>
+#include <backends/meta-monitor-manager-private.h>
#include <meta/util.h>

#include <cogl/cogl.h>
@@ -116,6 +118,14 @@ meta_cursor_renderer_calculate_rect (MetaCursorRenderer *renderer,
};
}

+static gboolean
+is_cursor_in_monitors_area (int x, int y)
+{
+ MetaMonitorManager *monitor_manager = meta_backend_get_monitor_manager (meta_get_backend ());
+ return meta_monitor_manager_get_monitor_at_point (monitor_manager,
+ (gfloat) x, (gfloat) y) >= 0;
+}
+
static void
update_cursor (MetaCursorRenderer *renderer,
MetaCursorSprite *cursor_sprite)
@@ -124,6 +134,11 @@ update_cursor (MetaCursorRenderer *renderer,
gboolean handled_by_backend;
gboolean should_redraw = FALSE;

+ /* do not render cursor if it is not on any monitor. Such situation
+ * can occur e. g. after monitor hot-plug */
+ if (!is_cursor_in_monitors_area (priv->current_x, priv->current_y))
+ return;
+
if (cursor_sprite)
meta_cursor_sprite_prepare_at (cursor_sprite,
priv->current_x,
--
cgit v0.11.2

35 changes: 35 additions & 0 deletions x11-wm/mutter/files/mutter-3.18.2-logical-monitors.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
From 958cdd5117cd2056076edc6cc52af1a3a929d262 Mon Sep 17 00:00:00 2001
From: Rui Matos <[email protected]>
Date: Fri, 3 Jul 2015 18:01:14 +0200
Subject: monitor-manager: Fix the max potential number of logical monitors

The max potential number of logical monitors (i.e. MetaMonitorInfos)
is the number of CRTCs, not the number of outputs.

In cases where we have more enabled CRTCs than connected outputs we
would end up appending more MetaMonitorInfos to the GArray than the
size it was initialized with which means the array would get
re-allocated rendering invalid some MetaCRTC->logical_monitor pointers
assigned previously and thus ending in crashes later on.

https://bugzilla.gnome.org/show_bug.cgi?id=751638
---
src/backends/meta-monitor-manager.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/backends/meta-monitor-manager.c b/src/backends/meta-monitor-manager.c
index 38ccc72..56a52bb 100644
--- a/src/backends/meta-monitor-manager.c
+++ b/src/backends/meta-monitor-manager.c
@@ -178,7 +178,7 @@ make_logical_config (MetaMonitorManager *manager)
unsigned int i, j;

monitor_infos = g_array_sized_new (FALSE, TRUE, sizeof (MetaMonitorInfo),
- manager->n_outputs);
+ manager->n_crtcs);

/* Walk the list of MetaCRTCs, and build a MetaMonitorInfo
for each of them, unless they reference a rectangle that
--
cgit v0.11.2

41 changes: 41 additions & 0 deletions x11-wm/mutter/files/mutter-3.18.2-wayland-crash.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
From 2ea121a1869d21ef0726aca27abd02a3245d1d74 Mon Sep 17 00:00:00 2001
From: Marek Chalupa <[email protected]>
Date: Thu, 2 Jul 2015 10:41:37 +0200
Subject: wayland: bind wayland socket after xwayland is initialized

During xwayland initialization we run main loop and dispatch wayland
events, so that xwayland can initialize. If some client during this
phase connects and creates surface, mutter crashes because
it is not initialized yet. If we bind wayland socket after xwayland
is initialized and main loop is not running anymore, no client can
connect to mutter during initialization and that is what we want.

https://bugzilla.gnome.org/show_bug.cgi?id=751845
---
src/wayland/meta-wayland.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/wayland/meta-wayland.c b/src/wayland/meta-wayland.c
index 0d37489..d51e8b5 100644
--- a/src/wayland/meta-wayland.c
+++ b/src/wayland/meta-wayland.c
@@ -337,13 +337,13 @@ meta_wayland_init (void)
meta_wayland_pointer_gestures_init (compositor);
meta_wayland_seat_init (compositor);

+ if (!meta_xwayland_start (&compositor->xwayland_manager, compositor->wayland_display))
+ g_error ("Failed to start X Wayland");
+
compositor->display_name = wl_display_add_socket_auto (compositor->wayland_display);
if (compositor->display_name == NULL)
g_error ("Failed to create socket");

- if (!meta_xwayland_start (&compositor->xwayland_manager, compositor->wayland_display))
- g_error ("Failed to start X Wayland");
-
set_gnome_env ("DISPLAY", meta_wayland_get_xwayland_display_name (compositor));
set_gnome_env ("WAYLAND_DISPLAY", meta_wayland_get_wayland_display_name (compositor));
}
--
cgit v0.11.2

111 changes: 111 additions & 0 deletions x11-wm/mutter/mutter-3.18.2-r1.ebuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

EAPI="5"
GCONF_DEBUG="yes"

inherit eutils gnome2

DESCRIPTION="GNOME 3 compositing window manager based on Clutter"
HOMEPAGE="https://git.gnome.org/browse/mutter/"

LICENSE="GPL-2+"
SLOT="0"
IUSE="+introspection +kms test wayland"
KEYWORDS="~alpha ~amd64 ~arm ~ia64 ~ppc ~ppc64 ~sparc ~x86"

# libXi-1.7.4 or newer needed per:
# https://bugzilla.gnome.org/show_bug.cgi?id=738944
COMMON_DEPEND="
>=x11-libs/pango-1.2[X,introspection?]
>=x11-libs/cairo-1.10[X]
>=x11-libs/gtk+-3.9.11:3[X,introspection?]
>=dev-libs/glib-2.36.0:2[dbus]
>=media-libs/clutter-1.23.4:1.0[X,introspection?]
>=media-libs/cogl-1.17.1:1.0=[introspection?]
>=media-libs/libcanberra-0.26[gtk3]
>=x11-libs/startup-notification-0.7
>=x11-libs/libXcomposite-0.2
>=gnome-base/gsettings-desktop-schemas-3.15.92[introspection?]
gnome-base/gnome-desktop:3=
>sys-power/upower-0.99:=
x11-libs/libICE
x11-libs/libSM
x11-libs/libX11
>=x11-libs/libXcomposite-0.2
x11-libs/libXcursor
x11-libs/libXdamage
x11-libs/libXext
x11-libs/libXfixes
>=x11-libs/libXi-1.7.4
x11-libs/libXinerama
>=x11-libs/libXrandr-1.5
x11-libs/libXrender
x11-libs/libxcb
x11-libs/libxkbfile
>=x11-libs/libxkbcommon-0.4.3[X]
x11-misc/xkeyboard-config
gnome-extra/zenity
introspection? ( >=dev-libs/gobject-introspection-1.42:= )
kms? (
dev-libs/libinput
>=media-libs/clutter-1.20[egl]
media-libs/cogl:1.0=[kms]
>=media-libs/mesa-10.3[gbm]
sys-apps/systemd
virtual/libgudev
x11-libs/libdrm:= )
wayland? (
>=dev-libs/wayland-1.6.90
>=media-libs/clutter-1.20[wayland]
x11-base/xorg-server[wayland] )
"
DEPEND="${COMMON_DEPEND}
>=dev-util/intltool-0.41
sys-devel/gettext
virtual/pkgconfig
x11-proto/xextproto
x11-proto/xineramaproto
x11-proto/xproto
test? ( app-text/docbook-xml-dtd:4.5 )
"
RDEPEND="${COMMON_DEPEND}
!x11-misc/expocity
"

src_prepare() {
# Multiple patches from gnome-3.18 branch

# x11/window-props: Initialize bypass compositor hint
epatch "${FILESDIR}"/${P}-bypass-hint.patch

# cursor-renderer: do not update cursor if it is out of monitor
epatch "${FILESDIR}"/${P}-cursor-renderer.patch

# monitor-manager: Fix the max potential number of logical monitors
epatch "${FILESDIR}"/${P}-logical-monitors.patch

# wayland: bind wayland socket after xwayland is initialized
epatch "${FILESDIR}"/${P}-wayland-crash.patch

# x11/window: Ensure we send a ConfigureNotify to just mapped windows
epatch "${FILESDIR}"/${P}-configure-notify.patch

gnome2_src_prepare
}

src_configure() {
gnome2_src_configure \
--disable-static \
--enable-sm \
--enable-startup-notification \
--enable-verbose-mode \
--with-libcanberra \
$(use_enable introspection) \
$(use_enable kms native-backend) \
$(use_enable wayland)
}

0 comments on commit c2837c5

Please sign in to comment.