Rebuild rpm mutter – Gnome 3 freezes after 50 days

Still there is no update mutter package to fix this issue.

Solution

Example on CentOS 7.5 minimal:

yum -y group install "Development Tools"
yum -y install rpmdevtools
rpmdev-setuptree
curl -O http://vault.centos.org/7.5.1804/os/Source/SPackages/mutter-3.26.2-13.el7.src.rpm
rpm -ivh mutter-3.26.2-13.el7.src.rpm 
cd rpmbuild/SOURCES/
tar xvf mutter-3.26.2.tar.xz 
vi mutter-3.26.2/src/backends/x11/meta-backend-x11.c -c 115

Replace line 115:

      if (device_event->time < priv->latest_evtime)

With line:

      if (XSERVER_TIME_IS_BEFORE (device_event->time, priv->latest_evtime))
mv mutter-3.26.2.tar.xz old_mutter-3.26.2.tar.xz
tar cfJ mutter-3.26.2.tar.xz mutter-3.26.2
yum -y install chrpath 
yum -y install pango-devel 
yum -y install startup-notification-devel 
yum -y install gnome-desktop3-devel 
yum -y install glib2-devel 
yum -y install gtk3-devel 
yum -y install gobject-introspection-devel 
yum -y install libSM-devel 
yum -y install libwacom-devel 
yum -y install libXdamage-devel 
yum -y install libXext-devel 
yum -y install libXfixes-devel 
yum -y install libXi-devel 
yum -y install libXrandr-devel 
yum -y install libXrender-devel 
yum -y install libXcursor-devel 
yum -y install libXcomposite-devel 
yum -y install libxkbcommon-devel 
yum -y install libxkbcommon-x11-devel 
yum -y install libxkbfile-devel 
yum -y install libXtst-devel 
yum -y install mesa-libEGL-devel 
yum -y install mesa-libGLES-devel 
yum -y install mesa-libGL-devel 
yum -y install mesa-libgbm-devel 
yum -y install pam-devel 
yum -y install upower-devel 
yum -y install xkeyboard-config-devel 
yum -y install gtk-doc 
yum -y install gnome-common 
yum -y install libcanberra-devel 
yum -y install gsettings-desktop-schemas-devel
yum -y install pkgconfig
yum -y install json-glib-devel
yum -y install libgudev1-devel 
yum -y install libinput-devel
yum -y install wayland-protocols-devel
yum -y install zenity
yum -y install desktop-file-utils
cd ..
rpmbuild -ba SPECS/mutter.spec 
yum install /root/rpmbuild/RPMS/x86_64/mutter-3.26.2-13.el7.centos.x86_64.rpm