From 8dd9af59f9c46dfcfaecc847ea9bb94f894beb81 Mon Sep 17 00:00:00 2001 From: B Stack Date: Sat, 22 Aug 2020 07:37:25 -0400 Subject: UXP-elim-gtk2 revision 2 from Gord --- .../patches/UXP-eliminate-need-for-GTK-2.patch | 70 +++++++++++++++++++++- 1 file changed, 69 insertions(+), 1 deletion(-) diff --git a/newmoon/debian/patches/UXP-eliminate-need-for-GTK-2.patch b/newmoon/debian/patches/UXP-eliminate-need-for-GTK-2.patch index c266f78..f28fd10 100644 --- a/newmoon/debian/patches/UXP-eliminate-need-for-GTK-2.patch +++ b/newmoon/debian/patches/UXP-eliminate-need-for-GTK-2.patch @@ -1,4 +1,4 @@ -# This patch was created by Gordon N. Squash. +# This patch and its previous revision were created by Gordon N. Squash. # # This patch can be used to eliminate the Unified XUL Platform's need for both # GTK+ 2 and GTK+ 3, even when you are compiling UXP only to use GTK+ 3. @@ -6,6 +6,14 @@ # This patch is still highly experimental. The author of this patch has not # yet encountered any issues with this patch, but there are no guarantees. # +# This is revision 2 of the patch. The previous revisions eliminated a stub +# function from mozgtk which disabled the X Shared Memory (X MIT-SHM) extension +# from getting used by Cairo. Unfortunately, that function, while overly +# simplistic, was necessary to ensure the guaranteed operability of UXP; in +# other words, UXP crashed sometimes if this function wasn't present. +# This revision re-introduces this function into the codebase -- but part of +# libxul this time, not libmozgtk. +# # WARNING! This is not an official patch in any way, shape or form! Do not # contact the original authors of UXP for support of this patch! # @@ -312,3 +320,63 @@ diff -uprN palemoon-28.12.0-original/palemoon/installer/package-manifest.in pale [browser] ; [Base Browser Files] +# CHANGES MADE IN REVISION 2 +# +# Hooray GTK+ 3 users! UXP does not play well with Cairo! Therefore we +# need this separate file. This code was borrowed from mozgtk.c. +# According to bug # 1271100, basically if you scroll (or do almost anything) +# while UXP is rendering something on the page, UXP is not designed properly +# to handle this situation and a race condition results. The race condition +# ends up with the scratch buffer drawable UXP uses getting deleted. When +# this happens, the next operation UXP performs is a CopyArea request, to +# copy the drawable to the actual window where this stuff is getting displayed. +# The X server recognizes that the drawable has been deleted, signals an +# error condition, and GTK, which catches the error, throws up its hands and +# kills the whole #$@% application. +# +# This all apparently has something to do with the usage of the X MIT-SHM +# extension. Apparently by disabling Cairo's, and ultimately GTK's, use +# of the SHM extension, this bug does not occur. It turns out that the +# dynamic linker will load this function first and the real function second; +# Cairo will use this function and failures will be no more. UXP however +# uses XCB instead of XLib, so UXP still uses SHM. +# +# In other words, the Mozilla codebase does not play well with other libraries. +# Now, the Mozilla and UXP people can say that the other libraries should play +# well with Mozilla and UXP, but the fact is code should always adapt to error +# conditions if possible -- error conditions should not adapt to code. +# +# But at the very least this stuff works! +# +diff -uprN palemoon-28.12.0-original/platform/widget/gtk/gtk3frictionworkarounds.c palemoon-28.12.0-patched/platform/widget/gtk/gtk3frictionworkarounds.c +--- palemoon-28.12.0-original/platform/widget/gtk/gtk3frictionworkarounds.c 1969-12-31 19:00:00.000000000 -0500 ++++ palemoon-28.12.0-patched/platform/widget/gtk/gtk3frictionworkarounds.c 2020-08-21 20:30:01.616049093 -0400 +@@ -0,0 +1,16 @@ ++/* ++ * This file was added by Gordon N. Squash. Please see his original patch ++ * for details on what this code is for. If you have not received his patch ++ * then at least understand that THIS IS NOT THE OFFICIAL UXP SOURCE CODE IN ++ * ANY WAY, SHAPE OR FORM: IT IS A PATCHED VERSION. DO NOT CONTACT THE ++ * ORIGINAL DEVELOPERS OF UXP OR MOZILLA FOR SUPPORT OF THIS CODE. ++ */ ++ ++#include "mozilla/Types.h" ++#include ++ ++MOZ_EXPORT Bool ++XShmQueryExtension(Display* aDisplay) ++{ ++ return False; ++} +diff -uprN palemoon-28.12.0-original/platform/widget/gtk/moz.build palemoon-28.12.0-patched/platform/widget/gtk/moz.build +--- palemoon-28.12.0-original/platform/widget/gtk/moz.build 2020-08-20 21:24:39.148073190 -0400 ++++ palemoon-28.12.0-patched/platform/widget/gtk/moz.build 2020-08-21 20:31:09.660050615 -0400 +@@ -104,6 +104,7 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gtk2 + else: + UNIFIED_SOURCES += [ + 'gtk3drawing.cpp', ++ 'gtk3frictionworkarounds.c', + 'nsApplicationChooser.cpp', + 'WidgetStyleCache.cpp', + ] + -- cgit