aboutsummaryrefslogtreecommitdiff
path: root/window.c
Commit message (Collapse)AuthorAgeFilesLines
* fix: window title not working on certain WMsNRK2022-03-021-11/+10
| | | | | | | not all WMs support `_NET_WM_NAME` and `_NET_WM_ICON_NAME` this patch sets `WM_NAME` and `WM_ICON_NAME` inside win_set_title() Closes: https://github.com/nsxiv/nsxiv/issues/233
* always initialize window titleNRK2022-03-021-4/+4
| | | | | before if exec/win-title didn't exist then window title wouldn't be set. this patch makes it so window title is always set to something.
* code-style: slight cleanupsNRK2022-03-021-6/+5
| | | | | | * put TOP_STATUSBAR under the HAVE_LIBFONTS guard * change get_win_title param to take unsigned char ptr * init UTF8_STRING like other atoms
* add config.h option for top statusbar (#231)N-R-K2022-02-261-2/+3
| | | | Closes: https://github.com/nsxiv/nsxiv/issues/230 Co-authored-by: mamg22 <45301823+mamg22@users.noreply.github.com>
* use win-title script for customizing window title (#213)N-R-K2022-02-231-13/+8
| | | | | this removes the cli flag `-T` as well as related config.h options. Co-authored-by: Berke Kocaoğlu <berke.kocaoglu@metu.edu.tr>
* update copyright yearNRK2022-02-131-1/+1
|
* fix -Wwrite-strings related warningsNRK2022-01-061-4/+6
|
* fix: send implicit_mod to process_bindings (#176)N-R-K2021-12-011-1/+4
| | | | | | | | | | | | * fix: send implicit_mod to process_bindings this solves the edge case where someone might have `ShiftMask + A` in their keybindings compared to a plain `A`. Closes: https://github.com/nsxiv/nsxiv/pull/166#issuecomment-978853136 * code-style: smuggle small style fix in win_draw_bar now mimics autoreload_nop.c functions
* mark functions and vars as static (#146)N-R-K2021-11-201-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | the goal here to mark functions and variables not used outside the translation unit as static. main reason for this is cleanliness. however as a side-effect this can help compilers optimize better as it now has guarantee that a certain function won't be called outside of that translation unit. one other side-effect of this is that accessing these vars/function from config.h is now different. if one wants to access a static var/func from different translation unit in config.h, he would have to create a wrapper function under the right ifdef. for static functions one would also need to forward declare it. here's a dummy example of accessing the function `run_key_handler` from config.h under _MAPPINGS_CONFIG ``` static void run_key_handler(const char *, unsigned); bool send_with_ctrl(arg_t key) { run_key_handler(XKeysymToString(key), ControlMask); return false; } ```
* Add colors and fonts to config.h (#115)Arthur Williams2021-10-291-6/+6
| | | | | | | | Adds a set of config vars to control window fg/bg, bar fg/bg, mark color and bar font. This allows everything that can be done from .Xresources to be configurable from config.h. Co-authored-by: N-R-K <79544946+N-R-K@users.noreply.github.com>
* code-style: general cleanups (#137)N-R-K2021-10-291-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
* update copyright notice (#139)eylles2021-10-281-1/+2
|
* fix: memory leak due to not destroying XrmDatabase (#134)N-R-K2021-10-281-2/+3
|
* Add default key-binding for DRAG_RELATIVE (#117)LuXu2021-10-271-1/+1
| | | | | | | | 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 behaviour when TrueColor / 24 bit depth is not available (#114)miseran2021-10-111-24/+15
| | | | | | | | | | | | | * 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>
* code-style: fix consistency issues all over the codebase (#94)Berke Kocaoğlu2021-10-111-30/+19
| | | | | | | | | | | | | | | * 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>
* Make statusbar optional (#95)Arthur Williams2021-10-101-20/+40
| | | | | | | | 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>
* code-style: use constant length array (#79)N-R-K2021-09-221-1/+1
| | | | | | | | | | | 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.
* add .mark.foreground to XresourcesNRK2021-09-171-1/+3
| | | | | since we're already allowing both window and bar colors to be customizable, it doesn't make sense to not allow so for mark color.
* Fix font memory leak. (#57)Sam Whitehead2021-09-161-0/+1
| | | | | | | | | | | * 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>
* change .font to .bar.font for consistency (#48)N-R-K2021-09-161-1/+1
|
* Rename, Update Docs and Prepare for Release (#9)Berke Kocaoğlu2021-09-161-9/+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>
* set title based on prefix and suffix (#23)qsmodo2021-09-161-4/+16
| | | | | | Co-authored-by: Guilherme Rugai Freire <41879254+GRFreire@users.noreply.github.com> Co-authored-by: NRK <nrk@disroot.org> Co-authored-by: Berke Kocaoğlu <berke.kocaoglu@metu.edu.tr>
* Custom bar colors (#10)Guilherme Freire2021-09-161-12/+16
| | | | | | | | | * 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 (#13)eylles2021-09-161-0/+20
| | | | | | | 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>
* Fix in tabbed with alpha patch (#3)Berke Kocaoğlu2021-09-161-8/+21
| | | | | * Fix in tabbed with alpha patch Co-authored-by: Jared Forrest <jared_forrest@mailbox.org>
* Added ICCCM WM_HINTSArthur Williams2021-09-161-0/+6
| | | | | | | | | | | | | | | | | 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.
* Fix memory leak in win_res()Bert Münnich2020-01-161-11/+13
| | | | Fixes issue #372.
* Do not keep track of fullscreen stateBert Münnich2019-07-161-49/+2
| | | | | There is no more need for this after the removal of the special color handling for fullscreen mode in commit 2886876.
* Use normal win colors in fullscreen modeBert Münnich2019-07-161-20/+7
| | | | Fixes issues #361 and #367
* Change colors and font only via X resourcesBert Münnich2019-04-191-3/+3
|
* Add Xresources font supportvxid2019-04-191-2/+3
|
* Match fallback font FC_SIZE to original fontFoldex2019-03-151-1/+4
|
* Align compile-time color options with X resource colorsBert Münnich2019-01-231-17/+26
| | | | Two colors are more than enough!
* Simplify X resource retrievalBert Münnich2019-01-231-18/+17
| | | | Also makes the color names in config.def.h constant again.
* Support X resource entries with Sxiv class nameBert Münnich2019-01-231-13/+9
|
* Fix code style of merged codeBert Münnich2019-01-231-14/+10
|
* Add Xresources capabilitynoamcore2019-01-231-1/+36
|
* Set window title only once at startupBert Münnich2018-10-151-3/+0
| | | | | | | Putting image info in the title predates the info bar; it no longer seems necessary. Fixes issue #318.
* Initialize window bar buffers to empty stringBert Münnich2018-04-111-0/+2
| | | | Fixes issue #308.
* Simplify drawing of bar textBert Münnich2017-12-071-53/+34
| | | | | | | | | 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.
* Replace utf8codepoint with Chris Wellons' utf8_decodeBert Münnich2017-12-071-5/+7
| | | | | | 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.
* win_textwidth is no longer needed outside window.cBert Münnich2017-12-071-11/+8
|
* Try to match a fallback font if neededSquibby2017-12-061-6/+41
| | | | | | | | | | | | | | 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.
* One header file for type definitions and function declarationsBert Münnich2017-10-161-8/+5
|
* Improve mouse supportBert Münnich2017-10-061-1/+2
| | | | | | | | | | | | 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.
* Own win method for mouse cursor locationBert Münnich2017-10-051-0/+11
|
* Simplify cursor handlingBert Münnich2017-10-051-29/+20
|
* Mouse drag translates pointer position to image areaBert Münnich2017-10-041-5/+5
| | | | This makes mouse panning more direct and faster.
* Use -e for X window embeddingBert Münnich2016-10-301-5/+3
|