Skip to content

Commit 20ccd8f

Browse files
authored
Merge pull request #23 from william8000/xv5-fix-warnings
Xv5 HiDPI, C23, fixes
2 parents be94fb3 + 3052257 commit 20ccd8f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+6098
-4838
lines changed

.gitignore

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# staging area
2+
tmp*
3+
4+
# temporary build files
5+
*-
6+
*.err
7+
*.log
8+
*.orig
9+
*.rej
10+
*.save
11+
12+
#objects
13+
*.o
14+
15+
# executables
16+
xv
17+
bggen
18+
vdcomp
19+
xcmap
20+
xvpictoppm

CMakeLists.txt

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ cmake_minimum_required(VERSION 3.12)
77
# The major, minor, and micro version numbers of the project.
88
set(XV_VERSION_MAJOR 5)
99
set(XV_VERSION_MINOR 2)
10-
set(XV_VERSION_PATCH 0)
11-
set(XV_VERSION_DATE "20240625")
10+
set(XV_VERSION_PATCH 3)
11+
set(XV_VERSION_DATE "20240801")
1212

1313
# Generate the project version.
1414
set(XV_VERSION "${XV_VERSION_MAJOR}.${XV_VERSION_MINOR}.${XV_VERSION_PATCH}")
@@ -28,6 +28,8 @@ option(XV_ENABLE_PDS "Enable PDF Support" ON)
2828
option(XV_ENABLE_PNG "Enable PNG Support" ON)
2929
option(XV_ENABLE_TIFF "Enable TIFF Support" ON)
3030
option(XV_ENABLE_WEBP "Enable WEBP Support" ON)
31+
option(XV_ENABLE_G3 "Enable G3 Support" ON)
32+
option(XV_ENABLE_XRANDR "Enable XRANDR Support" ON)
3133

3234
option(XV_STRICT "Treat compiler warnings as errors" OFF)
3335

@@ -198,11 +200,37 @@ if(XV_ENABLE_WEBP AND NOT TARGET WebP::libwebp)
198200
set(XV_ENABLE_WEBP OFF)
199201
endif()
200202

203+
if(XV_ENABLE_XRANDR)
204+
find_path(XRANDR_INCLUDE_DIR NAMES X11/extensions/Xrandr.h
205+
PATH_SUFFIXES X11/extensions
206+
DOC "The XRANDR include directory"
207+
)
208+
209+
find_library(XRANDR_LIBRARY NAMES Xrandr
210+
DOC "The XRANDR library"
211+
)
212+
213+
include(FindPackageHandleStandardArgs)
214+
FIND_PACKAGE_HANDLE_STANDARD_ARGS(XRANDR DEFAULT_MSG XRANDR_LIBRARY XRANDR_INCLUDE_DIR)
215+
216+
mark_as_advanced(XRANDR_INCLUDE_DIR XRANDR_LIBRARY)
217+
218+
if(XRANDR_FOUND)
219+
set(XRANDR_LIBRARIES ${XRANDR_LIBRARY})
220+
set(XRANDR_INCLUDE_DIRS ${XRANDR_INCLUDE_DIR})
221+
else()
222+
message(WARNING "Disabling RANDR Support.")
223+
set(XV_ENABLE_XRANDR OFF)
224+
endif()
225+
endif()
226+
201227
message("JP2K: ${XV_ENABLE_JP2K}")
202228
message("JPEG: ${XV_ENABLE_JPEG}")
203229
message("TIFF: ${XV_ENABLE_TIFF}")
204230
message("PNG: ${XV_ENABLE_PNG}")
205231
message("WEBP: ${XV_ENABLE_WEBP}")
232+
message("G3: ${XV_ENABLE_G3}")
233+
message("RANDR: ${XV_ENABLE_XRANDR}")
206234

207235
################################################################################
208236
# Subdirectories.

NEWS.txt

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,53 @@
33

44
* Made some improvements to WEBP support.
55

6+
5.0.1 (2024-08-01)
7+
==================
8+
9+
* Applied patches from other xv forks.
10+
Add contributed xv.xpm and xv.desktop.
11+
BMP updates for WIN_95, 98, and NT.
12+
xv was not really exiting with 0 for a valid call "xv -help".
13+
sprintf() to snprintf() safety fix.
14+
Add XrandR support.
15+
Add webp support for browsing and saving.
16+
Add support for reading G3 facsimile image files.
17+
Eliminate flicker in the image window.
18+
Add TRUE and FALSE defines in case these don't get defined elsewhere.
19+
Change C++ style comments to C style.
20+
Allow main and save/load window resizes.
21+
Add README.debian.
22+
Fix dashes and formatting on manual pages.
23+
Minor tweak to 'nopos' parameter.
24+
24-bit autocrop bug partial fix (applied to all four places).
25+
* Increased some buffers to fix compile warnings and sanitizer warnings.
26+
* Fixed unused variable warnings with XV_UNUSED macro or by removing the variables.
27+
* Updated prototypes in xv.h to fix warnings about declarations without prototypes.
28+
* Added a -c option to the build script to do a clean build.
29+
* Added .gitignore
30+
* Fixes for G3, tiff, and wbmp processing.
31+
* Fixed memory leak of tv->lines in computeText() in xvtext.c.
32+
* Fixed possible overwrite in add_filelist_to_namelist() in xv.c.
33+
* Added overprint.ps sample PS image.
34+
* Switched order of calloc() args to fix compile warning in xvbrowse.c.
35+
* Fixed crash on long file names in xv.c.
36+
* Added Add a test image with a long file name in data/images.
37+
* Rebuilt with clang and fixed compile warnings.
38+
* Added HiDPI support.
39+
New options -dpimult # to set the scale factor,
40+
-hidpi to set a scale factor of 2,
41+
+hidpi to set a scale factor of 1.
42+
Most dialogs scale based on the dpi multiplier.
43+
xv automatically defaults to -hidpi for displays with more than 144 dpi.
44+
* Fixed error from negative shift in xvpic.c.
45+
* Fixed crash on NULL monofsetinfo in xv.c.
46+
* Fixed bad pointer reference in last interation of LoadCurrentDirectory in xvdir.c.
47+
* Fixed loop limit in CharsetDelWin to avoid accessing csinfo out of bounds if there are no text windows in xvtext.c.
48+
* Convert function definitions to use prototypes as required by C23.
49+
* Add support for xz compressed files.
50+
* Fixed opening archives and compressed files with special characters in their name.
51+
* Fixed opening compressed archives.
52+
653
5.0.0 (2024-02-06)
754
==================
855

build/build

Lines changed: 64 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,20 @@ usage()
2424
Set the build directory to \$build_dir.
2525
-i \$install_dir
2626
Set the install directory to \$install_dir.
27+
-c
28+
Clean the build and install directories.
29+
-r
30+
Build to make a release.
31+
-d
32+
Build for debugging.
33+
-s
34+
Strict build to treat warnings as errors.
35+
-o \$configure_options
36+
Add \$configure_options to the cmake command line.
37+
-f
38+
Fast build, don't install.
39+
-p clang|gcc
40+
Set compiler
2741
-v
2842
Enable verbose mode.
2943
-h
@@ -34,32 +48,48 @@ usage()
3448

3549
program_dir=$(dirname "$0") || exit 1
3650
top_dir="$program_dir/.."
51+
real_top_dir=$(realpath "$top_dir")
52+
if [ -n "$real_top_dir" ] && [ -d "$real_top_dir" ] ; then top_dir="$real_top_dir" ; fi
3753

3854
verbose=0
3955
build_dir=
4056
install_dir=
4157
tmp_dir=
58+
install=1
4259
mode=release
4360
strict=0
61+
clean=0
62+
c_compiler=
63+
configure_options=()
4464

45-
while getopts vb:i:t:drs opt; do
65+
while getopts vhcb:i:o:t:fp:drs opt; do
4666
case $opt in
4767
s)
4868
strict=1;;
4969
r)
5070
mode=release;;
5171
d)
5272
mode=debug;;
73+
t)
74+
tmp_dir="$OPTARG";;
5375
b)
5476
build_dir="$OPTARG";;
5577
i)
5678
install_dir="$OPTARG";;
79+
o)
80+
configure_options+=("$OPTARG");;
81+
c)
82+
clean=1;;
83+
f)
84+
install=0;;
85+
p)
86+
c_compiler="$OPTARG";;
5787
v)
5888
verbose=$((verbose + 1));;
5989
h)
60-
usage;;
90+
usage "$@";;
6191
\?)
62-
usage;;
92+
usage "$@";;
6393
esac
6494
done
6595
shift $((OPTIND - 1))
@@ -74,9 +104,29 @@ if [ -z "$install_dir" ]; then
74104
install_dir="$tmp_dir/install"
75105
fi
76106

77-
cmake --version || panic "cannot run cmake"
107+
if [ "$clean" -ge 1 ]; then
108+
echo "Cleaning..."
109+
case "$build_dir" in
110+
*tmp*/*build*)
111+
rm -rf "$build_dir" || panic "Could not clean build dir ${build_dir}.";;
112+
*)
113+
panic "Not cleaning build dir ${build_dir}. Does not look match *tmp*build.";;
114+
esac
115+
case "$install_dir" in
116+
*tmp*/*install*)
117+
rm -rf "$install_dir" || panic "Could not clean install dir ${install_dir}.";;
118+
*)
119+
panic "Not cleaning install dir ${install_dir}. Does not look match *tmp*install.";;
120+
esac
121+
fi
78122

79-
configure_options=()
123+
case "$c_compiler" in
124+
gcc) configure_options+=(-DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++) ;;
125+
clang) configure_options+=(-DCMAKE_C_COMPILER="$c_compiler" -DCMAKE_CXX_COMPILER="${c_compiler}++") ;;
126+
*) if [ -n "$c_compiler" ] ; then panic "Unknown compiler ${c_compiler}." ; fi
127+
esac
128+
129+
cmake --version || panic "cannot run cmake"
80130

81131
configure_options+=(-DCMAKE_INSTALL_PREFIX="$install_dir")
82132

@@ -93,9 +143,17 @@ if [ "$strict" -ne 0 ]; then
93143
configure_options+=(-DXV_STRICT=1)
94144
fi
95145

146+
echo "Starting $mode build"
147+
echo "Top dir: $top_dir"
148+
echo "Build dir: $build_dir"
149+
echo "Install dir: $install_dir"
150+
echo "Options: ${configure_options[*]}"
151+
96152
cmake "${configure_options[@]}" -H"$top_dir" -B"$build_dir" || \
97153
panic "configure failed"
98154

99155
cmake --build "$build_dir" || panic "build failed"
100156

101-
cmake --build "$build_dir" --target install || panic "install failed"
157+
if [ "$install" -ne 0 ]; then
158+
cmake --build "$build_dir" --target install || panic "install failed"
159+
fi
3.34 KB
Loading

data/images/newtonian_fractal.pcd

770 KB
Binary file not shown.

data/images/overprint.ps

652 Bytes
Binary file not shown.

data/images/pythagoras_tree.wbmp

32 KB
Binary file not shown.

data/images/sierpinski_triangle.g3

8.63 KB
Binary file not shown.

src/CMakeLists.txt

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,20 @@ if(XV_ENABLE_JP2K)
3737
set(xv_libs ${xv_libs} Jasper::Jasper)
3838
endif()
3939

40+
if(XV_ENABLE_G3)
41+
add_compile_definitions(DOG3)
42+
endif()
43+
4044
if(XV_ENABLE_PDS)
4145
add_compile_definitions(DOPDS)
4246
#set(xv_libs ${xv_libs} XXX::XXX)
4347
endif()
4448

49+
if(XV_ENABLE_XRANDR)
50+
add_compile_definitions(DOXRANDR)
51+
set(xv_libs ${xv_libs} ${XRANDR_LIBRARIES})
52+
endif()
53+
4554
set(xv_sources
4655
vprintf.c
4756
xv24to8.c
@@ -59,6 +68,7 @@ set(xv_sources
5968
xvdir.c
6069
xvevent.c
6170
xvfits.c
71+
xvg3.c
6272
xvgam.c
6373
xvgif.c
6474
xvgifwr.c
@@ -92,6 +102,7 @@ set(xv_sources
92102
xvrle.c
93103
xvroot.c
94104
xvscrl.c
105+
xvselect.c
95106
xvsmooth.c
96107
xvsunras.c
97108
xvtarga.c
@@ -100,7 +111,7 @@ set(xv_sources
100111
xvtiffwr.c
101112
xvvd.c
102113
xvwbmp.c
103-
xvwebp.c
114+
xvwebp.c
104115
xvxbm.c
105116
xvxpm.c
106117
xvxwd.c
@@ -205,3 +216,11 @@ install(FILES
205216
# Install directories into DOCDIR/manuals.
206217
install(DIRECTORY docs/manuals/html
207218
DESTINATION "${CMAKE_INSTALL_DOCDIR}/manuals")
219+
220+
# Install files into share/pixmaps
221+
install(FILES contrib/xv.xpm
222+
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/pixmaps")
223+
224+
# Install files into share/applications
225+
install(FILES contrib/xv.desktop
226+
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/applications")

0 commit comments

Comments
 (0)