Commit graph

122 commits

Author SHA1 Message Date
Bert Münnich d9e60cb4c0 Fix memory leak in win_res()
Fixes issue #372.
2020-01-16 12:36:04 +01:00
Bert Münnich 07300da7df Do not keep track of fullscreen state
There is no more need for this after the removal of the special color handling
for fullscreen mode in commit 2886876.
2019-07-16 19:26:04 +02: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 7bde7e618a Change colors and font only via X resources 2019-04-19 15:25:06 +02:00
vxid 4407a3de54 Add Xresources font support 2019-04-19 15:03:03 +02:00
Foldex 278f0ce94e Match fallback font FC_SIZE to original font 2019-03-15 12:29:44 +01: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 9d244da512 Simplify X resource retrieval
Also makes the color names in config.def.h constant again.
2019-01-23 20:13:25 +01:00
Bert Münnich f7fc6637f3 Support X resource entries with Sxiv class name 2019-01-23 20:04:17 +01:00
Bert Münnich e4fb084f26 Fix code style of merged code 2019-01-23 20:00:18 +01:00
noamcore 4853e17b83 Add Xresources capability 2019-01-23 19:53:39 +01:00
Bert Münnich 0bf3265430 Set window title only once at startup
Putting image info in the title predates the info bar; it no longer seems
necessary.

Fixes issue #318.
2018-10-15 15:29:39 +02:00
Bert Münnich b78aaee9d7 Initialize window bar buffers to empty string
Fixes issue #308.
2018-04-11 09:55:28 +02:00
Bert Münnich e63843d369 Simplify drawing of bar text
Non-fitting text is truncated by simply cutting it off.

win_textwidth() has been replaced by a simple macro wrapper around
win_draw_text() with a maximum width of zero, which results in a dry-run that
still calculates the number of pixels used by the text, much like snprintf(3)
with a buffer length of zero.
2017-12-07 21:29:44 +01:00
Bert Münnich 3c7d6f3528 Replace utf8codepoint with Chris Wellons' utf8_decode
Code under a different license should be kept in a separate file. This
implemention is a single header file with ~65 lines, so it better fits this
requirement.
2017-12-07 21:19:53 +01:00
Bert Münnich 69b2d3cafd win_textwidth is no longer needed outside window.c 2017-12-07 14:19:35 +01:00
Squibby eb96c71725 Try to match a fallback font if needed
Fixes #276

Instead of rendering the entire filename at once, Xft will let us do it
character by character. This will allow sxiv to query fontconfig for
a font that can provide any missing codepoints, if needed.

A known issue of this patch is that the "..." dots rendering will not
work properly for very long multibyte filenames. That is because we
cannot easily predict the final width of the rendered filename before
drawing it. I couldn't figure out a clean way to deal with this, so I
ended up just truncating the offending filenames.
2017-12-06 20:39:07 -03: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 8081cbebf3 Improve mouse support
None of the mouse mappings uses a keyboard modifier, making it possible to
access the most basic features by only using the mouse.

Next/previous image with left button depending on cursor position, middle
button for dragging, right button for switching to thumnail mode and wheel for
zooming.

Users can keep the old behaviour by simply not adapting the changes to the
buttons array in config.def.h to their config.h file.
2017-10-06 10:15:43 +02:00
Bert Münnich d81442f55d Own win method for mouse cursor location 2017-10-05 13:47:02 +02:00
Bert Münnich b8fd923e74 Simplify cursor handling 2017-10-05 12:30:31 +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
Bert Münnich c772d3c3f3 Use -e for X window embedding 2016-10-30 19:16:51 +01:00
shuall 0b758e08f2 added support for XEMBED into other windows (ie tabbed) with -w 2016-10-28 22:09:26 -04:00
Bert Münnich c280129cef Use Xft for font loading and text drawing 2016-08-06 15:27:58 +02: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 c33f2ad355 Corrected & refactored handling of window bar content...
Old snprintf calls could have overflowed the buffers.
2014-10-01 22:35:22 +02:00
Bert Münnich d0ba2c585d Simplified thumbnail selection and marks 2014-08-17 23:01:39 +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 5d0679b855 Show key handler status in bar while it is running 2014-06-15 14:15:48 +02:00
Bert Münnich 0b83386bff Do not center window on screen, workaround for issue #9 2014-04-21 21:29:27 +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 72f1b1ca6f Removed command line option -F 2014-02-05 09:58:36 +01:00
Bert Münnich 524d9de877 Removed fit-win-to-img command 2014-02-04 22:38:24 +01:00
Bert Münnich 2e758f78c1 Check if window manager supports fullscreen; related to issue #128 2014-02-02 14:56:01 +01:00
Bert Münnich e2fa49ecfe Unified X atom initialization 2014-02-02 14:36:10 +01:00
Bert Münnich 135c4f9263 Added window icons; fixes issue #125 2014-01-15 22:40:34 +01:00
Bert Münnich 593da23cf3 Use bgcol as window background pixel; fixed issue #89 2013-04-14 19:50:47 +02:00
Bert Münnich aac28cce7a Fixed non-ASCII characters in window bar, issue #88 2013-04-06 14:04:46 +02:00
Bert Münnich 30802cec0f Spawn info script & update bar contents only when needed 2013-03-19 21:14:32 +01:00
Bert Münnich f3298400e6 Spawn and read from info script without blocking 2013-03-19 21:13:44 +01:00
Bert Münnich c6bfac1566 Merge branch 'sizehints', fixed issue #78 2013-02-09 19:07:29 +01:00
Bert Münnich 1e2ddc44d8 No checks on window size, use whatever the user has specified 2013-02-09 17:24:41 +01:00
Bert Münnich a527025314 Correctly set window height after i_fit_to_img() 2013-02-09 01:39:18 +01:00
Bert Münnich cef8d51153 Refined US{Position,Size} & WinGravity handling 2013-02-09 01:36:10 +01:00
Bert Münnich bf41012493 Merge remote-tracking branch '4z3/set-user-specified-sizehints' into sizehints
Conflicts:
	window.c
2013-02-09 01:21:57 +01:00
Bert Münnich f7301cf4f9 Correctly updated window pixmap after i_fit_to_img() 2013-02-08 23:26:06 +01:00