From 662676e3b8bf06d365e4906c1979e188125906da Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Tue, 20 Feb 2024 17:23:56 +0100 Subject: [PATCH] Avoid patching miinitext.c for Xvnc Things do not need to be this complicated. We can make sure the VNC extension is always included in a much cleaner way, at least since Xorg 1.16. --- unix/xserver/hw/vnc/Makefile.am | 2 -- unix/xserver/hw/vnc/xvnc.c | 25 ++++++++++++------------- unix/xserver116.patch | 24 ------------------------ unix/xserver117.patch | 24 ------------------------ unix/xserver118.patch | 24 ------------------------ unix/xserver119.patch | 24 ------------------------ unix/xserver120.patch | 20 -------------------- unix/xserver21.1.1.patch | 19 ------------------- 8 files changed, 12 insertions(+), 150 deletions(-) diff --git a/unix/xserver/hw/vnc/Makefile.am b/unix/xserver/hw/vnc/Makefile.am index cd1f7fe9..f9ed19d9 100644 --- a/unix/xserver/hw/vnc/Makefile.am +++ b/unix/xserver/hw/vnc/Makefile.am @@ -42,8 +42,6 @@ Xvnc_SOURCES = xvnc.c \ # recommendation for coaxing automake. nodist_EXTRA_Xvnc_SOURCES = dummy.cxx -Xvnc_CPPFLAGS = $(AM_CPPFLAGS) -DTIGERVNC - LOCAL_LIBS = \ $(XVNC_LIBS) \ $(XSERVER_LIBS) \ diff --git a/unix/xserver/hw/vnc/xvnc.c b/unix/xserver/hw/vnc/xvnc.c index 6065cc49..4ee1cd1b 100644 --- a/unix/xserver/hw/vnc/xvnc.c +++ b/unix/xserver/hw/vnc/xvnc.c @@ -1,6 +1,6 @@ /* Copyright (c) 1993 X Consortium Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved. - Copyright 2009-2015 Pierre Ossman for Cendio AB + Copyright 2009-2024 Pierre Ossman for Cendio AB Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -1106,14 +1106,17 @@ vncClientStateChange(CallbackListPtr *a, void *b, void *c) #ifdef GLXEXT #if XORG_OLDER_THAN(1, 20, 0) extern void GlxExtensionInit(void); +#endif +#endif -static ExtensionModule glxExt = { - GlxExtensionInit, - "GLX", - &noGlxExtension -}; +static const ExtensionModule vncExtensions[] = { + {vncExtensionInit, "VNC-EXTENSION", NULL}, +#ifdef GLXEXT +#if XORG_OLDER_THAN(1, 20, 0) + { GlxExtensionInit, "GLX", &noGlxExtension }, #endif #endif +}; void InitOutput(ScreenInfo * scrInfo, int argc, char **argv) @@ -1123,15 +1126,11 @@ InitOutput(ScreenInfo * scrInfo, int argc, char **argv) vncPrintBanner(); -#if XORG_AT_LEAST(1, 20, 0) - xorgGlxCreateVendor(); -#else - -#ifdef GLXEXT if (serverGeneration == 1) - LoadExtensionList(&glxExt, 1, TRUE); -#endif + LoadExtensionList(vncExtensions, ARRAY_SIZE(vncExtensions), TRUE); +#if XORG_AT_LEAST(1, 20, 0) + xorgGlxCreateVendor(); #endif /* initialize pixmap formats */ diff --git a/unix/xserver116.patch b/unix/xserver116.patch index 82a286a1..c5b1ac08 100644 --- a/unix/xserver116.patch +++ b/unix/xserver116.patch @@ -40,30 +40,6 @@ diff -up xorg-server-1.16.0/hw/Makefile.am.vnc xorg-server-1.16.0/hw/Makefile.am DIST_SUBDIRS = dmx xfree86 vfb xnest xwin xquartz kdrive xwayland -diff -up xorg-server-1.16.0/mi/miinitext.c.vnc xorg-server-1.16.0/mi/miinitext.c ---- xorg-server-1.16.0/mi/miinitext.c.vnc 2014-04-16 21:24:00.000000000 +0100 -+++ xorg-server-1.16.0/mi/miinitext.c 2014-09-03 10:21:49.508109234 +0100 -@@ -111,6 +111,10 @@ SOFTWARE. - #include "micmap.h" - #include "globals.h" - -+#ifdef TIGERVNC -+extern void vncExtensionInit(void); -+#endif -+ - /* The following is only a small first step towards run-time - * configurable extensions. - */ -@@ -235,6 +239,9 @@ EnableDisableExtensionError(const char * - - /* List of built-in (statically linked) extensions */ - static const ExtensionModule staticExtensions[] = { -+#ifdef TIGERVNC -+ {vncExtensionInit, "VNC-EXTENSION", NULL}, -+#endif - {GEExtensionInit, "Generic Event Extension", &noGEExtension}, - {ShapeExtensionInit, "SHAPE", NULL}, - #ifdef MITSHM diff -up xorg-server-1.16.0/os/WaitFor.c.vnc xorg-server-1.16.0/os/WaitFor.c --- xorg-server-1.16.0/os/WaitFor.c.vnc 2014-02-05 03:08:57.000000000 +0000 +++ xorg-server-1.16.0/os/WaitFor.c 2014-09-03 10:21:49.508109234 +0100 diff --git a/unix/xserver117.patch b/unix/xserver117.patch index 1b7fe35c..ed47d6d4 100644 --- a/unix/xserver117.patch +++ b/unix/xserver117.patch @@ -40,30 +40,6 @@ diff -up xorg-server-1.17.1/hw/Makefile.am.vnc xorg-server-1.17.1/hw/Makefile.am DIST_SUBDIRS = dmx xfree86 vfb xnest xwin xquartz kdrive xwayland -diff -up xorg-server-1.17.1/mi/miinitext.c.vnc xorg-server-1.17.1/mi/miinitext.c ---- xorg-server-1.17.1/mi/miinitext.c.vnc 2015-01-17 23:42:52.000000000 +0000 -+++ xorg-server-1.17.1/mi/miinitext.c 2015-02-13 16:14:05.131516821 +0000 -@@ -111,6 +111,10 @@ SOFTWARE. - #include "micmap.h" - #include "globals.h" - -+#ifdef TIGERVNC -+extern void vncExtensionInit(void); -+#endif -+ - /* The following is only a small first step towards run-time - * configurable extensions. - */ -@@ -235,6 +239,9 @@ EnableDisableExtensionError(const char * - - /* List of built-in (statically linked) extensions */ - static const ExtensionModule staticExtensions[] = { -+#ifdef TIGERVNC -+ {vncExtensionInit, "VNC-EXTENSION", NULL}, -+#endif - {GEExtensionInit, "Generic Event Extension", &noGEExtension}, - {ShapeExtensionInit, "SHAPE", NULL}, - #ifdef MITSHM diff -up xorg-server-1.17.1/os/WaitFor.c.vnc xorg-server-1.17.1/os/WaitFor.c --- xorg-server-1.17.1/os/WaitFor.c.vnc 2015-01-26 18:40:30.000000000 +0000 +++ xorg-server-1.17.1/os/WaitFor.c 2015-02-13 16:14:05.132516837 +0000 diff --git a/unix/xserver118.patch b/unix/xserver118.patch index 5eda1ec5..bdc2f91e 100644 --- a/unix/xserver118.patch +++ b/unix/xserver118.patch @@ -39,30 +39,6 @@ diff -ur xorg-server.orig/hw/Makefile.am xorg-server/hw/Makefile.am DIST_SUBDIRS = dmx xfree86 vfb xnest xwin xquartz kdrive xwayland -diff -ur xorg-server.orig/mi/miinitext.c xorg-server/mi/miinitext.c ---- xorg-server.orig/mi/miinitext.c 2016-04-09 21:28:27.015999965 +0200 -+++ xorg-server/mi/miinitext.c 2016-04-09 21:28:57.587999860 +0200 -@@ -114,6 +114,10 @@ - #include "micmap.h" - #include "globals.h" - -+#ifdef TIGERVNC -+extern void vncExtensionInit(void); -+#endif -+ - /* The following is only a small first step towards run-time - * configurable extensions. - */ -@@ -238,6 +242,9 @@ - - /* List of built-in (statically linked) extensions */ - static const ExtensionModule staticExtensions[] = { -+#ifdef TIGERVNC -+ {vncExtensionInit, "VNC-EXTENSION", NULL}, -+#endif - {GEExtensionInit, "Generic Event Extension", &noGEExtension}, - {ShapeExtensionInit, "SHAPE", NULL}, - #ifdef MITSHM diff -ur xorg-server.orig/os/WaitFor.c xorg-server/os/WaitFor.c --- xorg-server.orig/os/WaitFor.c 2016-04-09 21:28:27.071999965 +0200 +++ xorg-server/os/WaitFor.c 2016-04-09 21:28:57.587999860 +0200 diff --git a/unix/xserver119.patch b/unix/xserver119.patch index e445569f..e0898df3 100644 --- a/unix/xserver119.patch +++ b/unix/xserver119.patch @@ -40,30 +40,6 @@ diff -up xserver/hw/Makefile.am.xserver116-rebased xserver/hw/Makefile.am DIST_SUBDIRS = dmx xfree86 vfb xnest xwin xquartz kdrive xwayland -diff -up xserver/mi/miinitext.c.xserver116-rebased xserver/mi/miinitext.c ---- xserver/mi/miinitext.c.xserver116-rebased 2016-09-29 13:14:45.618441855 +0200 -+++ xserver/mi/miinitext.c 2016-09-29 13:14:45.631442006 +0200 -@@ -114,6 +114,10 @@ SOFTWARE. - #include "micmap.h" - #include "globals.h" - -+#ifdef TIGERVNC -+extern void vncExtensionInit(void); -+#endif -+ - /* The following is only a small first step towards run-time - * configurable extensions. - */ -@@ -238,6 +242,9 @@ EnableDisableExtensionError(const char * - - /* List of built-in (statically linked) extensions */ - static const ExtensionModule staticExtensions[] = { -+#ifdef TIGERVNC -+ {vncExtensionInit, "VNC-EXTENSION", NULL}, -+#endif - {GEExtensionInit, "Generic Event Extension", &noGEExtension}, - {ShapeExtensionInit, "SHAPE", NULL}, - #ifdef MITSHM --- xserver/include/os.h~ 2016-10-03 09:07:29.000000000 +0200 +++ xserver/include/os.h 2016-10-03 14:13:00.013654506 +0200 @@ -621,7 +621,7 @@ diff --git a/unix/xserver120.patch b/unix/xserver120.patch index 18972868..2f555eeb 100644 --- a/unix/xserver120.patch +++ b/unix/xserver120.patch @@ -42,23 +42,3 @@ Index: xserver/hw/Makefile.am DIST_SUBDIRS = dmx xfree86 vfb xnest xwin xquartz kdrive xwayland -Index: xserver/mi/miinitext.c -=================================================================== ---- xserver.orig/mi/miinitext.c -+++ xserver/mi/miinitext.c -@@ -107,8 +107,15 @@ SOFTWARE. - #include "os.h" - #include "globals.h" - -+#ifdef TIGERVNC -+extern void vncExtensionInit(void); -+#endif -+ - /* List of built-in (statically linked) extensions */ - static const ExtensionModule staticExtensions[] = { -+#ifdef TIGERVNC -+ {vncExtensionInit, "VNC-EXTENSION", NULL}, -+#endif - {GEExtensionInit, "Generic Event Extension", &noGEExtension}, - {ShapeExtensionInit, "SHAPE", NULL}, - #ifdef MITSHM diff --git a/unix/xserver21.1.1.patch b/unix/xserver21.1.1.patch index a6d237ef..3fbaae51 100644 --- a/unix/xserver21.1.1.patch +++ b/unix/xserver21.1.1.patch @@ -36,22 +36,3 @@ diff -urpN xorg-server-1.20.0/hw/Makefile.am xorg-server-1.20.0/hw/Makefile.am $(AM_V_at)for i in $(SUBDIRS) ; do $(MAKE) -C $$i relink || exit 1 ; done + +SUBDIRS += vnc -diff -urpN xorg-server-1.20.0/mi/miinitext.c xorg-server-1.20.0/mi/miinitext.c ---- xorg-server-1.20.0/mi/miinitext.c 2018-05-10 09:32:37.000000000 -0700 -+++ xorg-server-1.20.0/mi/miinitext.c 2018-06-13 19:05:14.742200675 -0700 -@@ -107,8 +107,15 @@ SOFTWARE. - #include "os.h" - #include "globals.h" - -+#ifdef TIGERVNC -+extern void vncExtensionInit(void); -+#endif -+ - /* List of built-in (statically linked) extensions */ - static const ExtensionModule staticExtensions[] = { -+#ifdef TIGERVNC -+ {vncExtensionInit, "VNC-EXTENSION", NULL}, -+#endif - {GEExtensionInit, "Generic Event Extension", &noGEExtension}, - {ShapeExtensionInit, "SHAPE", NULL}, - #ifdef MITSHM -- 2.39.5