Commit Graph

165 Commits

Author SHA1 Message Date
N-R-K
850bc788c3
code-style: general cleanups (#137)
* tns_clean_cache: remove unused function arg

* remove malloc casting

* improve consistency

use sizeof(T) at the end

* avoid comparing integers of different signedness

* use Window type for embed and parent

* remove unnecessary comparisons

* remove cpp style comments

* improve consistency: remove comma from the end of enumerator list

* Removed useless _IMAGE_CONFIG defines

* consistency: use the same order as snprintf

* Resolve c89 warnings


Co-authored-by: uidops <uidops@protonmail.com>
Co-authored-by: Arthur Williams <taaparthur@gmail.com>
2021-10-29 02:00:53 +06:00
N-R-K
03eb664e89
remove unnecessary animated webp related check
this code snippet was introduced in
2703809a23
but does not seem to be needed.

from what i can tell this is some sort of hack that might've been needed
back when we didn't bypass imlib2 when loading webp.
2021-10-28 16:45:26 +06:00
eylles
5b3221cfa6
update copyright notice (#139) 2021-10-28 16:41:16 +06:00
N-R-K
1f01c670c5
fix: memory leak in img_load_webp (#135)
if `multi.cap` is >0 that means `multi.frames` has already been malloc-ed. by
unconditionally malloc-ing again, we're losing all the old memory.

this makes it so we're only malloc-ing (or realloc-ing) when needed.
2021-10-26 17:41:11 +00:00
N-R-K
7b37a6272f
Revert "Fix in tabbed with alpha patch (#3)" (#121)
This reverts commit c7ca547b55.

cd710f5 fixed the issue with embedding into a parent that has alpha and
partially reverted c7ca547

this commit fully reverts c7ca547 , as these changes aren't needed for
embedding into an alpha-parent.
2021-10-16 18:00:46 +00:00
miseran
cd710f583f
Fix behaviour when TrueColor / 24 bit depth is not available (#114)
* Fix regression introduced in c7ca547 which made nsxiv not start in
  non-TrueColor X server.
* Introduce a new fix for embedding into tabbed-alpha. 
* Fixes a visual glitch from original sxiv when drawing transparent images in 8
  bit depth. In 8 bit PseudoColor, `.pixel` is just an index into the 256
  defined colors and thus trying to extract rgb bits from it would result in
  visual glitch. The values `.color.red` on the other hand and so on are always
  integers between 0 and 0xFFFF representing the color as expected.
* Use XColor for win_bg/fg and mrk_fg

Co-authored-by: NRK <nrk@disroot.org>
2021-10-11 23:46:35 +00:00
Berke Kocaoğlu
1449bfc5e9
code-style: fix consistency issues all over the codebase (#94)
* remove duplicate comment
* remove empty tabs and blank lines
* move macros and globals ontop
* comment to seprate function implementation
* fix alignment
* switch to *argv[] similar to other suckless code
* kill all empty last lines
* append comment to endif
* reuse existing ARRLEN macro
* comment fall through
* use while (true) everywhere

Co-authored-by: NRK <nrk@disroot.org>
2021-10-11 09:07:18 +06:00
Arthur Williams
675db4bbb6 Make statusbar optional (#95)
libXft and libfontconfig are now optional dependencies which can be
disabled via `HAVE_LIBFONTS=0`. Disabling them means disabling the
statusbar. This also does not search for freetype2 header if disabled.

Co-authored-by: NRK <nrk@disroot.org>
2021-10-10 02:17:50 +06:00
Lu Xu
a2339e70fd Use zoom steps instead of hard-coding levels (#92)
Co-authored-by: NRK <nrk@disroot.org>
Co-authored-by: Berke Kocaoğlu <berke.kocaoglu@metu.edu.tr>
2021-09-25 11:11:21 +06:00
Sam Whitehead
af98249b68 Add animated webp support (#20)
Co-authored-by: NRK <nrk@disroot.org>
Co-authored-by: Stein Gunnar Bakkeby <bakkeby@gmail.com>
Co-authored-by: Berke Kocaoğlu <berke.kocaoglu@metu.edu.tr>
2021-09-24 17:27:22 +06:00
Berke Kocaoğlu
7cce7ea857 Rename, Update Docs and Prepare for Release (#9)
Co-authored-by: Guilherme Rugai Freire <41879254+GRFreire@users.noreply.github.com>
Co-authored-by: N-R-K <79544946+N-R-K@users.noreply.github.com>
Co-authored-by: NRK <nrk@disroot.org>
Co-authored-by: Arthur Williams <taaparthur@gmail.com>
Co-authored-by: eylles <ed.ylles1997@gmail.com>
2021-09-16 22:55:31 +03:00
TAAPArthur
25a3114709 Rework the build system (#19)
* Added simple configure script

Added simple script to autodetect if optional dependencies are installed
and enable/disable them as needed. Note this solution uses the compiler
directly instead of an external program like pkgconfig so it doesn't
require any extra dependencies. It is intended to work with any
arbitrary compiler; it has been tested with tcc and gcc.

There are some "breaking" changes hidden here
- HAVE_GIFLIB was renamed to HAVE_LIBGIF to match HAVE_LIBEXIF
- Simply typing `make` will no longer try to build with optional
  dependencies

* use implicit RM variable

* General clean-up in configure

- Use printf instead of echo
- Format style

* honor env PREFIX, use LDLIBS

* Revert "General clean-up in configure"

This reverts commit 8683c179dbf273a330f9a224a4d481a7bea42c5f.

* honor env LDFLAGS if set

* Don't set OPTIONAL_LIBS in configure

* make OBJ all caps

* follow suckless style build system

- remove configure script.
- HAVE_LIBGIF and HAVE_LIBEXIF defaults back to 1
- unload several varibales onto config.mk
- make version all-caps
- add -O2 optimization
- use CPPFLAGS for includes and defines

* Revert "follow suckless style build system"

This reverts commit 8bf75b1f68d72df349edba8d998d4659dd956dd8.

* Generate config.mk from make

* Inlined configure in Makefile

* update docs

* cleanups

- changes to config.mk should trigger a rebuild
- remove potentially confusing variables form Makefile

* Use install instead of mkdir/cp/chmod when sensible

* fixup! Inlined configure in Makefile

* Don't generate config.mk on rm -f *.o sxiv

* update docs and cleanups

- make config.mk silent
- mention editing config.mk in README

* fallback to 0 if user edits config.mk in unexpected way

* add comment on config.mk

* remove invalid comment

configure script is removed

* slight restructure

- make version all caps
- restructure variables that users may want to edit to top
- use CPPFLAGS for defines
- add some comments
- remove needless echos since we have verbose output now

* add echos back

Co-authored-by: NRK <nrk@disroot.org>
Co-authored-by: Berke Kocaoğlu <berke.kocaoglu@metu.edu.tr>
2021-09-16 22:55:31 +03:00
whowillbellthecat
cca7834e67 fix: out-of-bounds access when bg not in color map 2021-09-16 22:55:31 +03:00
NRK
91d9b3128e change gamma on -G
Closes: https://github.com/nsxiv/nsxiv/issues/30
2021-09-16 22:55:31 +03:00
Guilherme Freire
f7557c55b5 Custom bar colors (#10)
* set bar and text colors independently

* change xresources to Program.class.resource

* rename color variables to win/bar_bg/fg

* change default bar colors to match window colors
2021-09-16 22:55:31 +03:00
Berke Kocaoğlu
c7ca547b55 Fix in tabbed with alpha patch (#3)
* Fix in tabbed with alpha patch

Co-authored-by: Jared Forrest <jared_forrest@mailbox.org>
2021-09-16 22:55:31 +03:00
Berke Kocaoğlu
88f77bc59c Implement fill scale mode 2021-09-16 22:55:31 +03:00
Bert Münnich
28868767e6 Use normal win colors in fullscreen mode
Fixes issues #361 and #367
2019-07-16 19:18:13 +02:00
Bert Münnich
919ada1123 Align compile-time color options with X resource colors
Two colors are more than enough!
2019-01-23 21:21:15 +01:00
Bert Münnich
6d1e00627b Do not limit fit-to-win to smallest zoom level
Related to issue #303
2018-01-22 10:48:56 +01:00
Bert Münnich
727939b3e6 Make zoomdiff compare impact on image dimensions
Before that zoomdiff was a merely heuristic.

Related to issue #303
2018-01-22 10:37:10 +01:00
Bert Münnich
4c294011a9 Use float for ox/oy compare values
Fixes issue #302
2018-01-22 10:18:32 +01:00
Bert Münnich
f02661879f Reject text files resembling TGA images
Fixes issue #295

The imlib2 TGA loader returns an imlib image handle without any actual data
when given a text file like this:

    T
    Content-Type: application/javascript
    Content-Length: 3836
    Last-Modified: Wed, 23 Sep 2015 12:25:47 GMT
    Etag: "56029a4b-efc"
    Expires: Sat, 20 Aug 2016 15:14:33 GMT
    Cache-Control: max-age=604800, public
    Accept-Ranges: bytes

Fortunately, `imlib_image_get_data()` returns NULL in this case, so that we can
use it as an additional check when opening files.
2017-11-23 14:35:34 +01:00
Bert Münnich
148026007c One header file for type definitions and function declarations 2017-10-16 21:10:35 +02:00
Bert Münnich
a5403178e3 Zoom into mouse cursor position 2017-10-16 10:56:53 +02:00
Bert Münnich
e310136e02 Mouse drag translates pointer position to image area
This makes mouse panning more direct and faster.
2017-10-04 18:22:43 +02:00
jcalve
ec545a6b6c Make pan fraction configurable 2017-09-06 19:39:22 +02:00
Bert Münnich
ff2ce99bf7 Merge djhejna/floatdelay 2016-12-01 21:18:41 +01:00
Don Hejna
27bbaab976 Support for DELAY as a floating point number including less than 1
second while maintaining backward compatibiitiy with integer
arguments.
2016-11-27 20:36:23 -08:00
dwminer
2c566c5320 Add -A option to force framerate on animated images 2016-11-27 02:59:05 -05:00
Bert Münnich
878d97068c Only open regular files; fixes issue #252 2016-10-20 10:21:55 +02:00
Bert Münnich
c280129cef Use Xft for font loading and text drawing 2016-08-06 15:27:58 +02:00
Bert Münnich
4db3029bc6 Fix 32-bit unsigned integer shift 2015-12-26 10:14:35 +01:00
Bert Münnich
d3a70a285d Revised error handling
- Functions warn() and die() replaced by GNU-like error(3) function
- Register cleanup() with atexit(3)
- Functions called by cleanup() are marked with CLEANUP and are not allowed to
  call exit(3)
2015-10-28 23:03:37 +01:00
Bert Münnich
851e4288c1 Prefix safe allocation functions with 'e' instead of 's_' 2015-10-28 22:29:01 +01:00
Bert Münnich
e574a6d0dd Removed feature test macro definitions from source files 2015-10-28 21:37:45 +01:00
Bert Münnich
e0e96977b3 Removed overcautious parameter checks 2015-10-28 21:01:24 +01:00
Bert Münnich
01ed483b50 Round integer cast of image offset during rendering; fixes issue #197 2015-02-06 08:52:44 +01:00
Bert Münnich
47e6cd0669 Apply gamma value on thumbnails too; fixes issue #193 2015-01-05 20:53:04 +01:00
Bert Münnich
9b9294bae6 Use bit-field for boolean flags in fileinfo struct 2015-01-04 21:24:43 +01:00
Bert Münnich
93e2a757d4 Do not print could-not-open-warnings for files found by directory traversal 2014-10-24 11:14:01 +02:00
Bert Münnich
2fbc21a205 Simplified img_frame_animate 2014-09-01 20:41:33 +02:00
Bert Münnich
bb6721549b Overhauled window drawing, yet again; fixes issue #155
- Buffer for window content is bigger than the window, minimizes artifacts
  when window is resized
- Back to using XSetWindowBackgroundPixmap() instead of XCopyArea(),
  no need to handle exposure events; X server can show gray background directly
  after resize event before sxiv redraws the window contents
2014-07-28 20:36:32 +02:00
Bert Münnich
5e481912ec Revised handling of GIF animations
- New option `-a`: Play animations at startup
- Ctrl-Space toggles animation for all GIF files
- Infinite loop for all animations
2014-07-25 22:52:31 +02:00
Bert Münnich
9c92de8584 Added support for multiple commands per key/button mapping; elegant fix for issue #150 2014-07-23 23:41:23 +02:00
Bert Münnich
d26f39914e Use thumbnails in EXIF tags; requirement for libexif is back 2014-06-09 22:59:49 +02:00
Bartłomiej Piotrowski
b901236261 Fix build with giflib >= 5.1.0. 2014-05-27 11:46:42 +02:00
Bert Münnich
e685859a30 Use a checkerboard background for alpha layer; fixes issue #138 2014-04-06 22:47:42 +02:00
Bert Münnich
d049391916 Check for background image allocation failure 2014-02-07 22:57:58 +01:00
Bert Münnich
4fde8c8cbc Use separate background image for alpha layer; fixes issue #132 2014-02-06 22:04:19 +01:00