Ctrl-Button1 now has a relative drag using the XC_fleur cursor.
XC_fleur is normally the cursor for "size all" action, which has 4
arrows pointing to 4 directions.
Co-authored-by: NRK <nrk@disroot.org>
* 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>
* 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>
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>
currently the code-base doesn't make use of variable length array
despite being -std=c99. it was irresponsible of me to introduce VLA in
here.
since this function will be called quite often, i did not want to make
calls to malloc and free as they have some overhead.
512 should be sufficient enough and probably is far bigger than any
window title bar can display anyways.
* Fix font memory leak.
This memory leak has always been present in sxiv.
The font opened on window.c:58 was never closed, so I closed it, fixing a 2kB memory leak.
* document changes
Co-authored-by: NRK <nrk@disroot.org>
* 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
Set the _NET_WM_PID and WM_CLIENT_MACHINE X properties
Co-authored-by: Leon Kowarschick <lkowarschick@gmail.com>
Co-authored-by: Kian Kasad <kian@kasad.com>
Co-authored-by: NRK <nrk@disroot.org>
When the window is mapped, some ICCCM WM_HINTS are set.
The input field is set to true and state is set to NormalState.
To quote the spec, "The input field is used to communicate to the window
manager the input focus model used by the client" and "[c]lients with
the Passive and Locally Active models should set the input flag to
True". sxiv falls under the Passive Input model, since it expects keyboard
input, but only listens for key events on its single, top-level window instead
of subordinate windows (Locally Active) or the root window (Globally Active).
From the end users prospective, all EWMH/ICCCM compliant WMs (especially
the minimalistic ones) will allow the user to focus sxiv, which will
allow sxiv to receive key events. If the input field is not set, WMs are
allowed to assume that sxiv doesn't require focus.
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.
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.
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.
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.
- 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)
- 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