all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: dannym@scratchpost.org
To: 54654@debbugs.gnu.org
Subject: bug#54654: [PATCH] gnu: openjdk15: Make big cursors work.
Date: Thu, 31 Mar 2022 19:13:11 +0200	[thread overview]
Message-ID: <20220331171311.20805-1-dannym@scratchpost.org> (raw)
In-Reply-To: <20220331153156.0ae2b4ce@scratchpost.org>

From: Danny Milosavljevic <dannym@scratchpost.org>

* gnu/packages/patches/openjdk-15-xcursor-no-dynamic.patch: New file.
* gnu/local.mk (dist_patch_DATA):  Add it.
* gnu/packages/java.scm (openjdk15)[source]: Add it.
---
 .../openjdk-15-xcursor-no-dynamic.patch       | 66 +++++++++++++++++++
 1 file changed, 66 insertions(+)
 create mode 100644 gnu/packages/patches/openjdk-15-xcursor-no-dynamic.patch

diff --git a/gnu/packages/patches/openjdk-15-xcursor-no-dynamic.patch b/gnu/packages/patches/openjdk-15-xcursor-no-dynamic.patch
new file mode 100644
index 0000000000..975730518b
--- /dev/null
+++ b/gnu/packages/patches/openjdk-15-xcursor-no-dynamic.patch
@@ -0,0 +1,66 @@
+From: Danny Milosavljevic <dannym@scratchpost.org>
+Date: Thu, 31 Mar 2022 17:02:00 +0200
+Subject: Make openjdk use libxcursor directly
+
+Fixes <https://issues.guix.gnu.org/54654>.
+
+This patch makes openjdk use libxcursor directly.
+Without it, libx11 would try to dlopen("libXcursor.so.1") and fail.
+
+diff -ru orig/22kjr9lzrml0h5m55viq7zlfkqr9p7ny-openjdk-15.0.3-checkout/make/modules/java.desktop/lib/Awt2dLibraries.gmk 22kjr9lzrml0h5m55viq7zlfkqr9p7ny-openjdk-15.0.3-checkout/make/modules/java.desktop/lib/Awt2dLibraries.gmk
+--- orig/22kjr9lzrml0h5m55viq7zlfkqr9p7ny-openjdk-15.0.3-checkout/make/modules/java.desktop/lib/Awt2dLibraries.gmk	2022-03-31 15:34:08.773419480 +0200
++++ 22kjr9lzrml0h5m55viq7zlfkqr9p7ny-openjdk-15.0.3-checkout/make/modules/java.desktop/lib/Awt2dLibraries.gmk	2022-03-31 17:47:26.259535832 +0200
+@@ -217,7 +217,7 @@
+       endif
+     endif
+ 
+-    LIBAWT_XAWT_LIBS := $(LIBM) -lawt -lXext -lX11 -lXrender $(LIBDL) -lXtst -lXi -ljava -ljvm
++    LIBAWT_XAWT_LIBS := $(LIBM) -lawt -lXext -lX11 -lXcursor -lXrender $(LIBDL) -lXtst -lXi -ljava -ljvm
+ 
+     ifeq ($(call isTargetOs, linux), true)
+       LIBAWT_XAWT_LIBS += -lpthread
+diff -ru orig/22kjr9lzrml0h5m55viq7zlfkqr9p7ny-openjdk-15.0.3-checkout/test/jdk/java/awt/JAWT/Makefile.unix 22kjr9lzrml0h5m55viq7zlfkqr9p7ny-openjdk-15.0.3-checkout/test/jdk/java/awt/JAWT/Makefile.unix
+--- orig/22kjr9lzrml0h5m55viq7zlfkqr9p7ny-openjdk-15.0.3-checkout/test/jdk/java/awt/JAWT/Makefile.unix	2022-03-31 15:34:10.553466316 +0200
++++ 22kjr9lzrml0h5m55viq7zlfkqr9p7ny-openjdk-15.0.3-checkout/test/jdk/java/awt/JAWT/Makefile.unix	2022-03-31 17:47:08.027052750 +0200
+@@ -31,7 +31,7 @@
+ 
+ J_INC =		$(TESTJAVA)/include
+ INCLUDES =	-I$(J_INC) -I$(J_INC)/$(SYST) -I.
+-LIBS =		-L$(TESTJAVA)/lib -ljawt -lX11
++LIBS =		-L$(TESTJAVA)/lib -ljawt -lX11 -lXcursor
+ 
+ all:		$(CLASSES) libmylib.so
+ 
+diff -ru orig/22kjr9lzrml0h5m55viq7zlfkqr9p7ny-openjdk-15.0.3-checkout/src/java.desktop/unix/native/libawt_xawt/xawt/XlibWrapper.c 22kjr9lzrml0h5m55viq7zlfkqr9p7ny-openjdk-15.0.3-checkout/src/java.desktop/unix/native/libawt_xawt/xawt/XlibWrapper.c
+--- orig/22kjr9lzrml0h5m55viq7zlfkqr9p7ny-openjdk-15.0.3-checkout/src/java.desktop/unix/native/libawt_xawt/xawt/XlibWrapper.c	2022-03-31 15:34:11.917502206 +0200
++++ 22kjr9lzrml0h5m55viq7zlfkqr9p7ny-openjdk-15.0.3-checkout/src/java.desktop/unix/native/libawt_xawt/xawt/XlibWrapper.c	2022-03-31 17:07:25.664488391 +0200
+@@ -44,6 +44,7 @@
+ #include <X11/XKBlib.h>
+ #include <X11/Xos.h>
+ #include <X11/Xutil.h>
++#include <X11/Xcursor/Xcursor.h>
+ 
+ #if defined(AIX)
+ #undef X_HAVE_UTF8_STRING
+@@ -972,10 +973,20 @@
+ 
+ }
+ 
++static XColor _Xconst foreground = { 0,    0,     0,     0  };  /* black */
++static XColor _Xconst background = { 0, 65535, 65535, 65535 };  /* white */
++
+ JNIEXPORT jint JNICALL Java_sun_awt_X11_XlibWrapper_XCreateFontCursor
+ (JNIEnv *env, jclass clazz, jlong display, jint shape) {
+     AWT_CHECK_HAVE_LOCK_RETURN(0);
+-    return XCreateFontCursor((Display *) jlong_to_ptr(display), (int) shape);
++    Display * dpy = (Display *) jlong_to_ptr(display);
++    Font font = XLoadFont(dpy, "cursor"); /* note: leak */
++    if (font == None)
++        return 0;
++    Cursor result = XcursorTryShapeCursor(dpy, font, font, (int) shape, (int) shape + 1, &foreground, &background);
++    if (!result)
++        result = XCreateFontCursor(dpy, (int) shape);
++    return result;
+ }
+ 
+ /*
-- 
2.34.0





  reply	other threads:[~2022-03-31 17:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-31 13:31 bug#54654: libx11 libxcursor handling - Problems with big cursors not working in Java and xterm Danny Milosavljevic
2022-03-31 17:13 ` dannym [this message]
2022-03-31 20:03 ` bug#54654: [PATCH v2] gnu: openjdk15: Make big cursors work dannym
2022-04-01  6:16 ` bug#54654: libx11 libxcursor handling - Problems with big cursors not working in Java and xterm Liliana Marie Prikler
2022-04-04 10:14 ` Danny Milosavljevic
2022-04-07 18:04 ` Danny Milosavljevic
2022-04-07 20:21 ` Danny Milosavljevic

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220331171311.20805-1-dannym@scratchpost.org \
    --to=dannym@scratchpost.org \
    --cc=54654@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.