emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 16c785b621: Make xwidgets work on builds that don't use Cairo dra


From: Po Lu
Subject: master 16c785b621: Make xwidgets work on builds that don't use Cairo drawing
Date: Fri, 21 Jan 2022 06:10:16 -0500 (EST)

branch: master
commit 16c785b6212d78c0a79421e249e8036842e39382
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    Make xwidgets work on builds that don't use Cairo drawing
    
    * configure.ac: Check for the parts of Cairo that are needed for
    xwidgets when they are enabled without cairo drawing.
    
    * src/xterm.c:
    * src/xwidget.c: Always include cairo-xlib headers when xwidgets
    are enabled.
---
 configure.ac  | 79 ++++++++++++++++++++++++++++++++++-------------------------
 src/xterm.c   |  4 +++
 src/xwidget.c |  1 +
 3 files changed, 50 insertions(+), 34 deletions(-)

diff --git a/configure.ac b/configure.ac
index 6e15c1727a..515ae82536 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2913,40 +2913,6 @@ if test "${HAVE_GTK}" = "yes"; then
   fi
 fi
 
-
-dnl Enable xwidgets if GTK3 and WebKitGTK+ are available.
-dnl Enable xwidgets if macOS Cocoa and WebKit framework are available.
-HAVE_XWIDGETS=no
-XWIDGETS_OBJ=
-if test "$with_xwidgets" != "no"; then
-  if test "$USE_GTK_TOOLKIT" = "GTK3" && test "$window_system" != "none"; then
-    WEBKIT_REQUIRED=2.12
-    WEBKIT_MODULES="webkit2gtk-4.0 >= $WEBKIT_REQUIRED"
-    EMACS_CHECK_MODULES([WEBKIT], [$WEBKIT_MODULES])
-    HAVE_XWIDGETS=$HAVE_WEBKIT
-    XWIDGETS_OBJ="xwidget.o"
-  elif test "${NS_IMPL_COCOA}" = "yes"; then
-    dnl FIXME: Check framework WebKit2
-    dnl WEBKIT_REQUIRED=M.m.p
-    WEBKIT_LIBS="-Wl,-framework -Wl,WebKit"
-    WEBKIT_CFLAGS="-I/System/Library/Frameworks/WebKit.framework/Headers"
-    HAVE_WEBKIT="yes"
-    HAVE_XWIDGETS=$HAVE_WEBKIT
-    XWIDGETS_OBJ="xwidget.o"
-    NS_OBJC_OBJ="$NS_OBJC_OBJ nsxwidget.o"
-    dnl Update NS_OBJC_OBJ with added nsxwidget.o
-    AC_SUBST(NS_OBJC_OBJ)
-  else
-    AC_MSG_ERROR([xwidgets requested, it requires GTK3 as X window toolkit or 
macOS Cocoa as window system.])
-  fi
-
-  test $HAVE_XWIDGETS = yes ||
-    AC_MSG_ERROR([xwidgets requested but WebKitGTK+ or WebKit framework not 
found.])
-
-  AC_DEFINE([HAVE_XWIDGETS], 1, [Define to 1 if you have xwidgets support.])
-fi
-AC_SUBST(XWIDGETS_OBJ)
-
 CFLAGS=$OLD_CFLAGS
 LIBS=$OLD_LIBS
 
@@ -3451,6 +3417,51 @@ if test "${HAVE_X11}" = "yes"; then
   fi
 fi
 
+dnl Enable xwidgets if GTK3 and WebKitGTK+ are available.
+dnl Enable xwidgets if macOS Cocoa and WebKit framework are available.
+HAVE_XWIDGETS=no
+XWIDGETS_OBJ=
+if test "$with_xwidgets" != "no"; then
+  if test "$USE_GTK_TOOLKIT" = "GTK3" && test "$window_system" != "none"; then
+    WEBKIT_REQUIRED=2.12
+    WEBKIT_MODULES="webkit2gtk-4.0 >= $WEBKIT_REQUIRED"
+    EMACS_CHECK_MODULES([WEBKIT], [$WEBKIT_MODULES])
+    HAVE_XWIDGETS=$HAVE_WEBKIT
+    XWIDGETS_OBJ="xwidget.o"
+    if test "$HAVE_X_WINDOWS" = "yes" && test "${with_cairo}" = "no"; then
+      CAIRO_XLIB_MODULES="cairo >= 1.8.0 cairo-xlib >= 1.8.0"
+      EMACS_CHECK_MODULES(CAIRO_XLIB, $CAIRO_XLIB_MODULES)
+      if test $HAVE_CAIRO_XLIB = "yes"; then
+        CAIRO_CFLAGS="$CAIRO_XLIB_CFLAGS"
+       CAIRO_LIBS="$CAIRO_XLIB_LIBS"
+       AC_SUBST(CAIRO_CFLAGS)
+       AC_SUBST(CAIRO_LIBS)
+      else
+        AC_MSG_ERROR([xwidgets requested, but a suitable cairo installation 
wasn't found])
+      fi
+    fi
+  elif test "${NS_IMPL_COCOA}" = "yes"; then
+    dnl FIXME: Check framework WebKit2
+    dnl WEBKIT_REQUIRED=M.m.p
+    WEBKIT_LIBS="-Wl,-framework -Wl,WebKit"
+    WEBKIT_CFLAGS="-I/System/Library/Frameworks/WebKit.framework/Headers"
+    HAVE_WEBKIT="yes"
+    HAVE_XWIDGETS=$HAVE_WEBKIT
+    XWIDGETS_OBJ="xwidget.o"
+    NS_OBJC_OBJ="$NS_OBJC_OBJ nsxwidget.o"
+    dnl Update NS_OBJC_OBJ with added nsxwidget.o
+    AC_SUBST(NS_OBJC_OBJ)
+  else
+    AC_MSG_ERROR([xwidgets requested, it requires GTK3 as X window toolkit or 
macOS Cocoa as window system.])
+  fi
+
+  test $HAVE_XWIDGETS = yes ||
+    AC_MSG_ERROR([xwidgets requested but WebKitGTK+ or WebKit framework not 
found.])
+
+  AC_DEFINE([HAVE_XWIDGETS], 1, [Define to 1 if you have xwidgets support.])
+fi
+AC_SUBST(XWIDGETS_OBJ)
+
 if test "$window_system" = "pgtk"; then
   CAIRO_REQUIRED=1.12.0
   CAIRO_MODULE="cairo >= $CAIRO_REQUIRED"
diff --git a/src/xterm.c b/src/xterm.c
index c7d2dadff1..0f98cc7bec 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -173,6 +173,10 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 #include "../lwlib/xlwmenu.h"
 #endif
 
+#ifdef HAVE_XWIDGETS
+#include <cairo-xlib.h>
+#endif
+
 #ifdef USE_X_TOOLKIT
 
 /* Include toolkit specific headers for the scroll bar widget.  */
diff --git a/src/xwidget.c b/src/xwidget.c
index 69e9d5b64b..fb66a17acd 100644
--- a/src/xwidget.c
+++ b/src/xwidget.c
@@ -39,6 +39,7 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 #include <webkit2/webkit2.h>
 #include <JavaScriptCore/JavaScript.h>
 #include <cairo.h>
+#include <cairo-xlib.h>
 #ifndef HAVE_PGTK
 #include <X11/Xlib.h>
 #else



reply via email to

[Prev in Thread] Current Thread [Next in Thread]