aboutsummaryrefslogtreecommitdiff
path: root/gnu/packages/patches/fluxbox-1.3.7-no-dynamic-cursor.patch
blob: 8ac455833cb0888a0216c403a9842780bb93cc74 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
From: Danny Milosavljevic <dannym@scratchpost.org>
Date: Sun, 19 Feb 2023 15:48:23 +0100
Subject: Make fluxbox use libxcursor directly

This patch makes fluxbox use libxcursor directly. This way, big cursors work.
Without it, libx11 would try to dlopen("libXcursor.so.1") and fail.

--- orig/fluxbox-1.3.7/configure.ac	2015-02-08 11:44:45.333187008 +0100
+++ fluxbox-1.3.7/configure.ac	2023-02-19 15:42:50.595886984 +0100
@@ -214,6 +214,18 @@
 CXXFLAGS="$X11_CFLAGS $CXXFLAGS"
 LIBS="$X11_LIBS $LIBS"
 
+dnl Check for Xcursor
+PKG_CHECK_MODULES([XCURSOR], [ xcursor ],
+        [AC_DEFINE([HAVE_XCURSOR], [1], [Define if xcursor is available]) have_cursor=yes],
+        [have_xcursor=no])
+AM_CONDITIONAL([XCURSOR], [test "$have_xcursor" = "yes"], AC_MSG_ERROR([Could not find XOpenDisplay in -lXcursor.]))
+AS_IF([test x$have_xcursor = "xno"], [
+        AC_MSG_ERROR([Fluxbox requires the Xcursor libraries and headers.])
+])
+
+CXXFLAGS="$XCURSOR_CFLAGS $CXXFLAGS"
+LIBS="$XCURSOR_LIBS $LIBS"
+
 dnl Check for xpg4
 AC_CHECK_LIB([xpg4], [setlocale], [LIBS="-lxpg4 $LIBS"])
 AC_CHECK_PROGS([gencat_cmd], [gencat])
diff -ru orig/fluxbox-1.3.7/src/FbWinFrameTheme.cc fluxbox-1.3.7/src/FbWinFrameTheme.cc
--- orig/fluxbox-1.3.7/src/FbWinFrameTheme.cc	2015-02-08 11:44:45.365187009 +0100
+++ fluxbox-1.3.7/src/FbWinFrameTheme.cc	2023-02-19 15:28:56.183284901 +0100
@@ -20,6 +20,7 @@
 // DEALINGS IN THE SOFTWARE.
 
 #include "FbWinFrameTheme.hh"
+#include "Xutil.hh"
 #include "IconbarTheme.hh"
 
 #include "FbTk/App.hh"
@@ -53,15 +54,15 @@
 
     // create cursors
     Display *disp = FbTk::App::instance()->display();
-    m_cursor_move = XCreateFontCursor(disp, XC_fleur);
-    m_cursor_lower_left_angle = XCreateFontCursor(disp, XC_bottom_left_corner);
-    m_cursor_lower_right_angle = XCreateFontCursor(disp, XC_bottom_right_corner);
-    m_cursor_upper_right_angle = XCreateFontCursor(disp, XC_top_right_corner);
-    m_cursor_upper_left_angle = XCreateFontCursor(disp, XC_top_left_corner);
-    m_cursor_left_side = XCreateFontCursor(disp, XC_left_side);
-    m_cursor_top_side = XCreateFontCursor(disp, XC_top_side);
-    m_cursor_right_side = XCreateFontCursor(disp, XC_right_side);
-    m_cursor_bottom_side = XCreateFontCursor(disp, XC_bottom_side);
+    m_cursor_move = Xutil::hidpiCreateFontCursor(disp, XC_fleur);
+    m_cursor_lower_left_angle = Xutil::hidpiCreateFontCursor(disp, XC_bottom_left_corner);
+    m_cursor_lower_right_angle = Xutil::hidpiCreateFontCursor(disp, XC_bottom_right_corner);
+    m_cursor_upper_right_angle = Xutil::hidpiCreateFontCursor(disp, XC_top_right_corner);
+    m_cursor_upper_left_angle = Xutil::hidpiCreateFontCursor(disp, XC_top_left_corner);
+    m_cursor_left_side = Xutil::hidpiCreateFontCursor(disp, XC_left_side);
+    m_cursor_top_side = Xutil::hidpiCreateFontCursor(disp, XC_top_side);
+    m_cursor_right_side = Xutil::hidpiCreateFontCursor(disp, XC_right_side);
+    m_cursor_bottom_side = Xutil::hidpiCreateFontCursor(disp, XC_bottom_side);
 
     FbTk::ThemeManager::instance().loadTheme(*this);
     reconfigTheme();
diff -ru orig/fluxbox-1.3.7/src/Screen.cc fluxbox-1.3.7/src/Screen.cc
--- orig/fluxbox-1.3.7/src/Screen.cc	2015-02-08 11:44:45.369187009 +0100
+++ fluxbox-1.3.7/src/Screen.cc	2023-02-19 15:28:23.783092203 +0100
@@ -53,6 +53,7 @@
 #include "SystemTray.hh"
 #endif
 #include "Debug.hh"
+#include "Xutil.hh"
 
 #include "FbTk/I18n.hh"
 #include "FbTk/FbWindow.hh"
@@ -306,7 +307,7 @@
     if (keys)
         keys->registerWindow(rootWindow().window(), *this,
                              Keys::GLOBAL|Keys::ON_DESKTOP);
-    rootWindow().setCursor(XCreateFontCursor(disp, XC_left_ptr));
+    rootWindow().setCursor(Xutil::hidpiCreateFontCursor(disp, XC_left_ptr));
 
     // load this screens resources
     fluxbox->load_rc(*this);
diff -ru orig/fluxbox-1.3.7/src/Xutil.cc fluxbox-1.3.7/src/Xutil.cc
--- orig/fluxbox-1.3.7/src/Xutil.cc	2015-02-08 11:44:45.377187009 +0100
+++ fluxbox-1.3.7/src/Xutil.cc	2023-02-19 15:47:29.009541689 +0100
@@ -28,6 +28,10 @@
 
 #include <X11/Xutil.h>
 #include <X11/Xatom.h>
+#include <X11/Xlibint.h>
+#undef min
+#undef max
+#include <X11/Xcursor/Xcursor.h>
 #include <iostream>
 
 #ifdef HAVE_CSTRING
@@ -133,5 +137,19 @@
     return class_name;
 }
 
+static XColor _Xconst foreground = { 0,    0,     0,     0  };  /* black */
+static XColor _Xconst background = { 0, 65535, 65535, 65535 };  /* white */
+Cursor hidpiCreateFontCursor(Display* dpy, unsigned int shape) {
+	if (dpy->cursor_font == None) {
+		dpy->cursor_font = XLoadFont(dpy, "cursor");
+		if (dpy->cursor_font == None) return None;
+	}
+
+	Cursor result = XcursorTryShapeCursor(dpy, dpy->cursor_font, dpy->cursor_font, (int) shape, (int) shape + 1, &foreground, &background);
+	if (!result)
+		result = XCreateFontCursor(dpy, (int) shape);
+	return result;
+}
+
 } // end namespace Xutil
 
diff -ru orig/fluxbox-1.3.7/src/Xutil.hh fluxbox-1.3.7/src/Xutil.hh
--- orig/fluxbox-1.3.7/src/Xutil.hh	2015-02-08 11:44:45.377187009 +0100
+++ fluxbox-1.3.7/src/Xutil.hh	2023-02-19 15:26:37.495619659 +0100
@@ -32,7 +32,7 @@
 
 FbTk::FbString getWMClassName(Window win);
 FbTk::FbString getWMClassClass(Window win);
-
+Cursor hidpiCreateFontCursor(Display* dpy, unsigned int shape);
 
 } // end namespace Xutil
 
diff -ru orig/fluxbox-1.3.7/util/fbrun/FbRun.cc fluxbox-1.3.7/util/fbrun/FbRun.cc
--- orig/fluxbox-1.3.7/util/fbrun/FbRun.cc	2015-02-08 11:44:45.377187009 +0100
+++ fluxbox-1.3.7/util/fbrun/FbRun.cc	2023-02-19 15:28:18.532468099 +0100
@@ -26,6 +26,7 @@
 #include "FbTk/Color.hh"
 #include "FbTk/KeyUtil.hh"
 #include "FbTk/FileUtil.hh"
+#include "Xutil.hh"
 
 #ifdef HAVE_XPM
 #include <X11/xpm.h>
@@ -67,7 +68,7 @@
     m_current_history_item(0),
     m_last_completion_prefix(""),
     m_current_apps_item(0),
-    m_cursor(XCreateFontCursor(FbTk::App::instance()->display(), XC_xterm)) {
+    m_cursor(Xutil::hidpiCreateFontCursor(FbTk::App::instance()->display(), XC_xterm)) {
 
     setGC(m_gc.gc());
     setCursor(m_cursor);
diff -ru orig/fluxbox-1.3.7/util/fbrun/Makemodule.am fluxbox-1.3.7/util/fbrun/Makemodule.am
--- orig/fluxbox-1.3.7/util/fbrun/Makemodule.am	2015-02-08 11:44:45.377187009 +0100
+++ fluxbox-1.3.7/util/fbrun/Makemodule.am	2023-02-19 15:50:33.029069099 +0100
@@ -8,7 +8,8 @@
 	util/fbrun/FbRun.hh \
 	util/fbrun/FbRun.cc \
 	util/fbrun/main.cc \
-	util/fbrun/fbrun.xpm
+	util/fbrun/fbrun.xpm \
+	src/Xutil.cc
 
 fbrun_LDADD = libFbTk.a \
 	$(FRIBIDI_LIBS) \