suckless/dmenu.git
2 years agofix a regression in the previous commit for tab complete
Hiltjo Posthuma [Fri, 2 Sep 2022 17:09:50 +0000 (19:09 +0200)]
fix a regression in the previous commit for tab complete

Reported by Santtu Lakkala <inz@inz.fi>, thanks!

2 years agotab-complete: figure out the size before copying
NRK [Thu, 1 Sep 2022 17:51:43 +0000 (23:51 +0600)]
tab-complete: figure out the size before copying

we already need to know the string length since `cursor` needs to be
adjusted.

so just calculate the length beforehand and use `memcpy` to copy exactly
as much as needed (as opposed to `strncpy` which always writes `n`
bytes).

2 years agoreadstdin: use getline(3)
NRK [Thu, 1 Sep 2022 18:35:18 +0000 (00:35 +0600)]
readstdin: use getline(3)

currently readstdin():
   - fgets() into a local buffer,
   - strchr() the buffer to eleminate the newline
   - stdups() the buffer into items

a simpler way is to just use getline(3), which will do the allocation
for us; eliminating the need for stdup()-ing.

additionally getline returns back the amount of bytes read, which
eliminates the need for strchr()-ing to find the newline.

2 years agosync code-style patch from libsl
Hiltjo Posthuma [Mon, 8 Aug 2022 08:42:54 +0000 (10:42 +0200)]
sync code-style patch from libsl

2 years agoMakefile: add manual path for OpenBSD
Hiltjo Posthuma [Sun, 1 May 2022 16:38:25 +0000 (18:38 +0200)]
Makefile: add manual path for OpenBSD

2 years agofix incorrect comment, math is hard
Hiltjo Posthuma [Sat, 30 Apr 2022 11:19:33 +0000 (13:19 +0200)]
fix incorrect comment, math is hard

2 years agoinputw: improve correctness and startup performance, by NRK
Hiltjo Posthuma [Fri, 29 Apr 2022 18:15:48 +0000 (20:15 +0200)]
inputw: improve correctness and startup performance, by NRK

Always use ~30% of the monitor width for the input in horizontal mode.

Patch adapted from NRK patches.
This also does not calculate inputw when using vertical mode anymore (because
the code is removed).

2 years agodrw_text: account for fallback fonts in ellipsis_width
NRK [Mon, 28 Mar 2022 15:38:49 +0000 (21:38 +0600)]
drw_text: account for fallback fonts in ellipsis_width

additionally, ellipsis_width (which shouldn't change) is made static to
avoid re-calculating it on each drw_text() call.

2 years agodrw_text: don't segfault when called with 0 width
NRK [Sun, 27 Mar 2022 19:02:52 +0000 (01:02 +0600)]
drw_text: don't segfault when called with 0 width

this patch just rejects *any* 0 width draws, which is surely an error by
the caller.

this also guards against cases where the width is too small for the
ellipsis to fit, so ellipsis_w will remain 0.
reported by Bakkeby <bakkeby@gmail.com>

2 years agofix UB with the function iscntrl()
Hiltjo Posthuma [Sat, 26 Mar 2022 16:58:47 +0000 (17:58 +0100)]
fix UB with the function iscntrl()

From commit 6818e07291f3b2913e687c8ec3d3fe4711724050 by NRK, thanks

2 years agoRevert "avoid redraw when there's no change"
Hiltjo Posthuma [Sat, 26 Mar 2022 16:57:50 +0000 (17:57 +0100)]
Revert "avoid redraw when there's no change"

This reverts commit 6818e07291f3b2913e687c8ec3d3fe4711724050.

This broke keys such as ^W to delete-backward-word

2 years agoavoid redraw when there's no change
NRK [Fri, 25 Mar 2022 21:51:45 +0000 (22:51 +0100)]
avoid redraw when there's no change

while i was timing the performance issue, i noticed that there was lots
of random redrawing going on.

turns out there were coming from here; if someone presses CTRL/ALT etc
without pressing anything else, nothing will be inserted, so nothing
will change. but the code will `break`, go down and do a needless redraw.

this patch changes it to simply return if the keypress iscntrl()

also avoid potential UB by casting *buf into an unsigned char.

2 years agofree all allocated items, use %zu for size_t
NRK [Fri, 25 Mar 2022 21:51:09 +0000 (22:51 +0100)]
free all allocated items, use %zu for size_t

`items` itself is not checked for NULL as calling free on NULL is defined to be
a no-op.

2 years agodrw_text: improve performance when there's no match
NRK [Wed, 23 Mar 2022 18:37:55 +0000 (00:37 +0600)]
drw_text: improve performance when there's no match

this was the last piece of the puzzle, the case where we can't find any
font to draw the codepoint.

in such cases, we use XftFontMatch() which is INSANELY slow. but that's
not the real problem. the real problem was we were continuously trying
to match the same thing over and over again.

this patch introduces a small cache, which keeps track a couple
codepoints for which we know we won't find any matches.

with this, i can dump lots of emojies into dmenu where some of them
don't have any matching font, and still not have dmenu lag insanely or
FREEZE completely when scrolling up and down.

this also improves startup time, which will of course depend on the
system and all installed fonts; but on my system and test case i see the
following startup time drop:

before -> after
60ms   -> 34ms

2 years agoinputw: improve correctness and startup performance
NRK [Wed, 23 Mar 2022 18:37:55 +0000 (00:37 +0600)]
inputw: improve correctness and startup performance

a massive amount of time inside readstdin() is spent trying to get the
max input width and then put it into inputw, only for it to get clamped
down to mw/3 inside setup().

it makes more sense to calculate inputw inside setup() once we have mw
available. similar to the last patch, i see noticeable startup
performance improvement:

before -> after
160ms  -> 60ms

additionally this will take fallback fonts into account compared to the
previous version, so it's not only more performant but also more correct.

2 years agosignificantly improve performance on large strings
NRK [Wed, 23 Mar 2022 20:04:04 +0000 (02:04 +0600)]
significantly improve performance on large strings

this replaces inefficient pattern of `MIN(TEXTW(..), n)` with
drw_fontset_getwidth_clamp() instead, which is far more efficient when
we only want up to a certain width.

dumping a decently sized (unicode) emoji file into dmenu, I see the
startup time drop significantly with this patch.

before -> after
360ms  -> 160ms

this should also noticeably improve input latency (responsiveness) given
that calcoffsets() and drawmenu() are pretty hot functions.

2 years agointroduce drw_fontset_getwidth_clamp()
NRK [Wed, 23 Mar 2022 20:00:00 +0000 (02:00 +0600)]
introduce drw_fontset_getwidth_clamp()

getting the width of a string is an O(n) operation, and in many cases
users only care about getting the width upto a certain number.

instead of calling drw_fontset_getwidth() and *then* clamping the
result, this patch introduces drw_fontset_getwidth_clamp() function,
similar to strnlen(), which will stop once we reach n.

the `invert` parameter was overloaded internally to preserve the API,
however library users should be calling drw_fontset_getwidth_clamp() and
not depend upon internal behavior of drw_text().

2 years agodrw_text: improve both performance and correctness
NRK [Wed, 23 Mar 2022 18:37:55 +0000 (00:37 +0600)]
drw_text: improve both performance and correctness

this patch makes some non-trivial changes, which significantly improves
the performance of drawing large strings as well as fixes any issues
regarding the printing of the ellipsis when string gets truncated.

* performance:

before there were two O(n) loops, one which finds how long we can go
without changing font, and the second loop would (incorrectly) truncate
the string if it's too big.

this patch merges the overflow calculation into the first loop and exits
out when overflow is detected. when dumping lots of emojies into dmenu,
i see some noticeable startup time improvement:

before -> after
460ms  -> 360ms

input latency when scrolling up/down is also noticeably better and can
be tested with the following:

for _ in $(seq 20); do
cat /dev/urandom | base64 | tr -d '\n' | head -c 1000000
echo
done | ./dmenu -l 10

* correctness:

the previous version would incorrectly assumed single byte chars and
would overwrite them with '.' , this caused a whole bunch of obvious
problems, including the ellipsis not getting rendered if then font
changed.

in addition to exiting out when we detect overflow, this patch also
keeps track of the last x-position where the ellipsis would fit. if we
detect overflow, we simply make a recursing call to drw_text() at the
ellipsis_x position and overwrite what was there.

so now the ellipsis will always be printed properly, regardless of
weather the font changes or if the string is single byte char or not.

the idea of rendering the ellipsis on top incase of overflow was
from Bakkeby <bakkeby@gmail.com>, thanks! however the original patch had
some issues incorrectly truncating the prompt (-p flag) and cutting off
emojies. those have been fixed in here.

2 years agoremove false-positive warning for int comparison as bool
Hiltjo Posthuma [Tue, 1 Mar 2022 21:45:39 +0000 (22:45 +0100)]
remove false-positive warning for int comparison as bool

Reported by Prathu Baronia <prathu.baronia@praton.me>, patch slightly changed.

Thanks!

2 years agobump version to 5.1
Hiltjo Posthuma [Fri, 11 Feb 2022 11:26:35 +0000 (12:26 +0100)]
bump version to 5.1

2 years agocode-style: rm newline (oops)
Hiltjo Posthuma [Tue, 8 Feb 2022 20:45:28 +0000 (21:45 +0100)]
code-style: rm newline (oops)

2 years agorevert using strcasestr and use a more optimized portable version
Hiltjo Posthuma [Tue, 8 Feb 2022 18:32:25 +0000 (19:32 +0100)]
revert using strcasestr and use a more optimized portable version

... compared to the old cistrstr().

Thanks for the feedback!

2 years agofollow-up fix: add -D_GNU_SOURCE for strcasestr for some systems
Hiltjo Posthuma [Mon, 7 Feb 2022 09:36:13 +0000 (10:36 +0100)]
follow-up fix: add -D_GNU_SOURCE for strcasestr for some systems

2 years agoimprove performance of case-insensitive matching
Hiltjo Posthuma [Sun, 6 Feb 2022 23:21:12 +0000 (00:21 +0100)]
improve performance of case-insensitive matching

3 years agoRevert "Improve speed of drw_text when provided with large strings"
Hiltjo Posthuma [Fri, 20 Aug 2021 21:05:53 +0000 (23:05 +0200)]
Revert "Improve speed of drw_text when provided with large strings"

This reverts commit c585e8e498ec6f9c423ab8ea07cf853ee5b05fbe.

It causes issues with truncation of characters when the text does not fit and
so on.  The patch should be reworked and properly tested.

3 years agoadd support for more keypad keys
Hiltjo Posthuma [Mon, 9 Aug 2021 16:39:25 +0000 (18:39 +0200)]
add support for more keypad keys

The keypad Enter key was already supported. On some keyboard layouts like my
laptop the page-up and page-down key is more comfortable to use.
This adds a few lines but no complexity.

3 years agoImprove speed of drw_text when provided with large strings
Miles Alan [Sun, 8 Aug 2021 01:34:35 +0000 (21:34 -0400)]
Improve speed of drw_text when provided with large strings

Calculates len & ew in drw_font_getexts loop by incrementing instead of
decrementing; as such avoids proportional increase in time spent in loop
based on provided strings size.

3 years agoremove always true condition in if statement
Guilherme Janczak [Sun, 25 Jul 2021 01:55:25 +0000 (01:55 +0000)]
remove always true condition in if statement

4 years agobump version to 5.0
Hiltjo Posthuma [Wed, 2 Sep 2020 16:30:56 +0000 (18:30 +0200)]
bump version to 5.0

... and bump LICENSE year.

4 years agoFix memory leaks in drw
Hiltjo Posthuma [Thu, 11 Jun 2020 16:45:33 +0000 (18:45 +0200)]
Fix memory leaks in drw

Synced from dwm.
Patch by Alex Flierl <shad0w73@freenet.de>, thanks.

5 years agorevert IME support
Hiltjo Posthuma [Sun, 3 Mar 2019 12:08:54 +0000 (13:08 +0100)]
revert IME support

dmenu will not handle IME support (st will, atleast for now).

revert parts of commit 377bd37e212b1ec4c03a481245603c6560d0be22
this commit also broke input focus.

5 years agoimprove xopenim error message
Hiltjo Posthuma [Tue, 12 Feb 2019 21:58:35 +0000 (22:58 +0100)]
improve xopenim error message

die() already prints a newline.

5 years agomake dmenu_path script executable
Hiltjo Posthuma [Tue, 12 Feb 2019 21:13:58 +0000 (22:13 +0100)]
make dmenu_path script executable

(as dmenu_run is)

5 years agofix crash when XOpenIM returns NULL
Hiltjo Posthuma [Tue, 12 Feb 2019 18:10:43 +0000 (19:10 +0100)]
fix crash when XOpenIM returns NULL

for example when IME variables are set, but the program is not started (yet).

5 years agoClose when the embedding window is destroyed
Quentin Rameau [Sun, 3 Feb 2019 23:29:26 +0000 (00:29 +0100)]
Close when the embedding window is destroyed

5 years agoPrepared 4.9 release.
Anselm R Garbe [Sat, 2 Feb 2019 12:54:15 +0000 (04:54 -0800)]
Prepared 4.9 release.

5 years agodmenu.1: document improved fastgrab behaviour from previous patch
Hiltjo Posthuma [Sun, 27 Jan 2019 14:28:02 +0000 (15:28 +0100)]
dmenu.1: document improved fastgrab behaviour from previous patch

5 years agoUse slow path if stdin is a tty
dok [Sat, 26 Jan 2019 14:49:15 +0000 (15:49 +0100)]
Use slow path if stdin is a tty

If stdin is a tty and dmenu is ran with the fast option then it's
impossible to close stdin because the keyboard is already grabbed.

6 years agodmenu_path: always use the cachedir
Quentin Rameau [Sat, 21 Jul 2018 10:47:43 +0000 (12:47 +0200)]
dmenu_path: always use the cachedir

6 years agoMakefile: just show the compiler output
Hiltjo Posthuma [Sat, 2 Jun 2018 15:09:01 +0000 (17:09 +0200)]
Makefile: just show the compiler output

Don't be fancy and just show the actual output so debugging is simpler.

6 years agoDo not strip at link stage
Hiltjo Posthuma [Sat, 2 Jun 2018 15:01:24 +0000 (17:01 +0200)]
Do not strip at link stage

Building with debug symbols is worthless unless LDFLAGS are manually adjusted
as well.

6 years agocode-style for pledge: check the return code -1, not < 0
Hiltjo Posthuma [Fri, 25 May 2018 11:07:17 +0000 (13:07 +0200)]
code-style for pledge: check the return code -1, not < 0

this is the proper idiom

6 years agocode-style for pledge(2)
Hiltjo Posthuma [Fri, 25 May 2018 11:03:25 +0000 (13:03 +0200)]
code-style for pledge(2)

feedback from Klemens, thanks

6 years agoPledge on OpenBSD
Hiltjo Posthuma [Fri, 25 May 2018 10:04:22 +0000 (12:04 +0200)]
Pledge on OpenBSD

6 years agoUse bold for keyboard shortcuts in dmenu.1
David Demelier [Wed, 9 May 2018 19:27:29 +0000 (21:27 +0200)]
Use bold for keyboard shortcuts in dmenu.1

Like dwm, use the same syntax for all keyboard shortcuts for
consistency.

6 years agoFix cursor drawn position with wide glyphs
Quentin Rameau [Sun, 22 Apr 2018 12:18:34 +0000 (14:18 +0200)]
Fix cursor drawn position with wide glyphs

6 years agoMakefile: bikesheddingly replace ${} with $()
Quentin Rameau [Thu, 22 Mar 2018 10:18:56 +0000 (11:18 +0100)]
Makefile: bikesheddingly replace ${} with $()

6 years agoHandle IME input
Quentin Rameau [Mon, 19 Mar 2018 14:42:28 +0000 (15:42 +0100)]
Handle IME input

Thanks to nzl <uruabi@gmail.com> for the patch!

6 years agoFix handling of input strings
Hiltjo Posthuma [Fri, 16 Mar 2018 15:51:22 +0000 (16:51 +0100)]
Fix handling of input strings

6 years agoUpdate LICENSE
Quentin Rameau [Thu, 15 Mar 2018 09:16:10 +0000 (10:16 +0100)]
Update LICENSE

Only "meaningful" commits and contributors who made changes over the
years have been added.

6 years agobump version to 4.8
Hiltjo Posthuma [Wed, 14 Mar 2018 18:48:05 +0000 (19:48 +0100)]
bump version to 4.8

6 years agoadd key bindings for moving to the word start or end
Quentin Rameau [Tue, 13 Mar 2018 16:15:09 +0000 (17:15 +0100)]
add key bindings for moving to the word start or end

Mod1+b/^Left and Mod1+f/^Right

6 years agoFix regression in 84a1bc5
Hiltjo Posthuma [Thu, 4 Jan 2018 22:45:49 +0000 (23:45 +0100)]
Fix regression in 84a1bc5

Reported by Jochen Sprickerhof, thanks!

Applied patch with minor change (only initialize `i` for XINERAMA).

6 years agoInstantiate j var outside #ifdef XINEMARA directive because it is used in loop outsid...
Vincent Carluer [Thu, 4 Jan 2018 12:27:37 +0000 (12:27 +0000)]
Instantiate j var outside #ifdef XINEMARA directive because it is used in loop outside directive

6 years agodrw: drw_scm_create: use Clr type
Hiltjo Posthuma [Fri, 3 Nov 2017 20:10:38 +0000 (21:10 +0100)]
drw: drw_scm_create: use Clr type

in this context XftColor is a too low-level type.

6 years agofix a possible free of a uninitialize variable in paste()
Hiltjo Posthuma [Fri, 3 Nov 2017 14:31:37 +0000 (15:31 +0100)]
fix a possible free of a uninitialize variable in paste()

6 years agoinit colors using SchemeLast
Hiltjo Posthuma [Fri, 3 Nov 2017 20:05:29 +0000 (21:05 +0100)]
init colors using SchemeLast

this makes it slightly easier to add colors to schemes.

6 years agoSet class name on menu window
Omar Sandoval [Fri, 3 Nov 2017 16:49:10 +0000 (09:49 -0700)]
Set class name on menu window

WM_CLASS is a standard ICCCM property which is used to identify windows.
Window managers and compositors use it to allow per-application
configurable behavior.

7 years agorelease 4.7
Hiltjo Posthuma [Tue, 2 May 2017 16:32:04 +0000 (18:32 +0200)]
release 4.7

7 years agoRevert "fix input text matching"
Andrew Gregory [Wed, 7 Dec 2016 14:45:01 +0000 (09:45 -0500)]
Revert "fix input text matching"

This reverts commit 09d0a36e0370f7ca9bdb171bf93c5ac3131c5a92.

Using strncmp with the length of the user input turns it into a prefix
match rather than an exact match as it's supposed to be.

7 years agoXinerama: correct variable declarations in preprocessor conditional
Thomas Gardner [Fri, 25 Nov 2016 12:38:09 +0000 (22:38 +1000)]
Xinerama: correct variable declarations in preprocessor conditional

7 years agodie() on calloc failure
Hiltjo Posthuma [Sat, 5 Nov 2016 10:36:42 +0000 (11:36 +0100)]
die() on calloc failure

thanks Markus Teich and David!

8 years agoadd embedding support with -w option
Quentin Rameau [Sat, 8 Oct 2016 12:08:28 +0000 (14:08 +0200)]
add embedding support with -w option

8 years agodmenu.1: group single options
Quentin Rameau [Sat, 8 Oct 2016 12:42:53 +0000 (14:42 +0200)]
dmenu.1: group single options

8 years agodmenu.1: fix -l option
Quentin Rameau [Sat, 8 Oct 2016 12:36:04 +0000 (14:36 +0200)]
dmenu.1: fix -l option

8 years agodie() consistency: always add newline
Hiltjo Posthuma [Fri, 12 Aug 2016 12:39:30 +0000 (14:39 +0200)]
die() consistency: always add newline

8 years agofix crash if negative monitor (< -1) was passed
Hiltjo Posthuma [Tue, 26 Jul 2016 21:13:06 +0000 (23:13 +0200)]
fix crash if negative monitor (< -1) was passed

for example: dmenu -m '-9001'

8 years agoRevert "Print highlighted input text only on single match"
Hiltjo Posthuma [Tue, 26 Jul 2016 21:02:34 +0000 (23:02 +0200)]
Revert "Print highlighted input text only on single match"

This reverts commit a4053bc4e403ae57343f43b7e363a0911bba5a3a.

My bad, was working on the wrong branch and accidently pushed it...
*facepalm*

8 years agoPrint highlighted input text only on single match
Quentin Rameau [Tue, 26 Jul 2016 10:48:23 +0000 (12:48 +0200)]
Print highlighted input text only on single match

When the input text fully matches a single item, do not draw the item
and highlight the input text to show that it matches an item in
opposition to regular input text not matching anything.

8 years agoPartially revert 44c7de3: fix items text width offset calculation
Quentin Rameau [Mon, 25 Jul 2016 09:33:25 +0000 (11:33 +0200)]
Partially revert 44c7de3: fix items text width offset calculation

Without this, we discard the item if it's longer than assigned width
instead of truncating it.

8 years agoconfig.def.h: style improvement, use color Scheme enum
Hiltjo Posthuma [Tue, 28 Jun 2016 15:56:25 +0000 (17:56 +0200)]
config.def.h: style improvement, use color Scheme enum

8 years agofix: Do not crash on e.g. dmenu < /dev/null
S. Gilles [Tue, 28 Jun 2016 05:11:50 +0000 (01:11 -0400)]
fix: Do not crash on e.g. dmenu < /dev/null

8 years agoimport new drw from libsl and minor fixes.
Markus Teich [Sat, 21 May 2016 19:51:14 +0000 (21:51 +0200)]
import new drw from libsl and minor fixes.

- extract drawitem function (code deduplication)
- fix bug where inputw was not correctly calculated from the widest item, but
  just from the one with the longest strlen() which is not the same. It's better
  now, but does not account for fallback fonts, since it would be too slow to
  calculate all the correct item widths on startup.
- minor code style fixes (indentation, useless line breaks)

8 years agoarg.h: fixed argv checks order
Lucas Gabriel Vuotto [Mon, 22 Feb 2016 14:03:36 +0000 (11:03 -0300)]
arg.h: fixed argv checks order

This prevents accessing to a potentially out-of-bounds memory section.

Signed-off-by: Lucas Gabriel Vuotto <l.vuotto92@gmail.com>
8 years agoTypofix
Klemens Nanni [Mon, 11 Jan 2016 12:26:37 +0000 (13:26 +0100)]
Typofix

8 years agoShut up glibc about _BSD_SOURCE being deprecated
Quentin Rameau [Sat, 19 Dec 2015 18:58:03 +0000 (19:58 +0100)]
Shut up glibc about _BSD_SOURCE being deprecated

8 years agoAdd config option for word delimiters
Quentin Rameau [Sat, 19 Dec 2015 08:32:55 +0000 (09:32 +0100)]
Add config option for word delimiters

Let the user configure word boundaries other than ' ', only works with
the portable character set.

8 years agoarg.h: remove unused ARGNUM* macros
Hiltjo Posthuma [Sun, 8 Nov 2015 22:37:47 +0000 (23:37 +0100)]
arg.h: remove unused ARGNUM* macros

8 years agounboolify dmenu
Hiltjo Posthuma [Sun, 8 Nov 2015 22:03:34 +0000 (23:03 +0100)]
unboolify dmenu

8 years agoMakefile: package config.def.h on make dist
Hiltjo Posthuma [Sun, 8 Nov 2015 15:46:34 +0000 (16:46 +0100)]
Makefile: package config.def.h on make dist

8 years agoremove .hgtags file
Hiltjo Posthuma [Sun, 8 Nov 2015 15:44:41 +0000 (16:44 +0100)]
remove .hgtags file

8 years agodmenu.1: clarify monitor numbers are starting from 0 (first mon)
Hiltjo Posthuma [Sat, 7 Nov 2015 11:53:00 +0000 (12:53 +0100)]
dmenu.1: clarify monitor numbers are starting from 0 (first mon)

8 years agofix: multimon: always spawn client on first monitor if specified with -m 0
Hiltjo Posthuma [Sat, 7 Nov 2015 11:43:00 +0000 (12:43 +0100)]
fix: multimon: always spawn client on first monitor if specified with -m 0

This was always broken.

Reproduce:
focus client on second monitor, spawn dmenu with -m 0.

Result:
Old wrong behaviour: dmenu spawns on second monitor (focused client).
Now: dmenu spawns on specified monitor (first).

8 years agodrw: cleanup drw_text, prevent gcc warning false-positive of unused var
Hiltjo Posthuma [Tue, 20 Oct 2015 20:56:57 +0000 (22:56 +0200)]
drw: cleanup drw_text, prevent gcc warning false-positive of unused var

... we don't allow passing text is NULL anymore either, for that behaviour
just use drw_rect() (it is used in dwm).

8 years agodrw: simplify drw_font_xcreate and prevent a potential unneeded allocation
Hiltjo Posthuma [Tue, 20 Oct 2015 20:55:39 +0000 (22:55 +0200)]
drw: simplify drw_font_xcreate and prevent a potential unneeded allocation

8 years agodrw: a valid (non-NULL) Drw and Fnt context must be passed
Hiltjo Posthuma [Tue, 20 Oct 2015 20:53:55 +0000 (22:53 +0200)]
drw: a valid (non-NULL) Drw and Fnt context must be passed

don't do these checks on this level. However for resource drw_*_free
we will allow it.

8 years agoadd sbase-style ecalloc(), calloc: or die
Hiltjo Posthuma [Tue, 20 Oct 2015 20:51:57 +0000 (22:51 +0200)]
add sbase-style ecalloc(), calloc: or die

... remove intermediary variables

9 years agofree schemes as array
Hiltjo Posthuma [Sun, 18 Oct 2015 16:37:20 +0000 (18:37 +0200)]
free schemes as array

this makes it slightly easier to add custom schemes aswell

9 years agofix input text matching
Quentin Rameau [Sun, 4 Oct 2015 12:47:52 +0000 (14:47 +0200)]
fix input text matching

just compare the size of the input string

9 years agofix incorrect ordering of match results
Davide Del Zompo [Sun, 4 Oct 2015 12:01:22 +0000 (14:01 +0200)]
fix incorrect ordering of match results

look for exact matches comparing the user input against the item text

9 years agofix paste from clipboard (ctrl+shift+y)
Hiltjo Posthuma [Sun, 4 Oct 2015 10:32:07 +0000 (12:32 +0200)]
fix paste from clipboard (ctrl+shift+y)

from Joshua Lloret on the ML:

"attached is a small patch to enable pasting from clipboard, as well as primary.

It seems like there was already code in there to allow this, but since there was never any case to match the upper case 'Y', that inline if would always evaluate to false."

9 years agominor style fix
Hiltjo Posthuma [Sun, 27 Sep 2015 22:38:17 +0000 (00:38 +0200)]
minor style fix

9 years agoRemove function prototypes and reorder functions accordingly
FRIGN [Sun, 27 Sep 2015 22:19:36 +0000 (00:19 +0200)]
Remove function prototypes and reorder functions accordingly

9 years agoUntypedef struct item
FRIGN [Sun, 27 Sep 2015 22:15:03 +0000 (00:15 +0200)]
Untypedef struct item

Adds clarity. Typedefs for structs are definitely a discussion matter,
but there's no reason to hide a simple data-structure behind a
meaningless typedef.

9 years agoFix the conversion from microseconds to nanoseconds
Quentin Rameau [Sun, 27 Sep 2015 22:18:35 +0000 (00:18 +0200)]
Fix the conversion from microseconds to nanoseconds

9 years agoReplace deprecated usleep() with nanosleep()
Quentin Rameau [Sun, 27 Sep 2015 22:06:05 +0000 (00:06 +0200)]
Replace deprecated usleep() with nanosleep()

9 years agoconfig.mk: use -std=c99
Hiltjo Posthuma [Sun, 27 Sep 2015 22:02:28 +0000 (00:02 +0200)]
config.mk: use -std=c99

9 years agodmenu: style improvements
Hiltjo Posthuma [Sun, 27 Sep 2015 21:57:39 +0000 (23:57 +0200)]
dmenu: style improvements

- move main to bottom, usage above main.
- dont use variable names with function prototypes.
- space before if, for, while, etc: 'if(' -> 'if ('.

this makes the code-style more consistent

9 years agodrw style improvements
Hiltjo Posthuma [Sun, 27 Sep 2015 21:56:02 +0000 (23:56 +0200)]
drw style improvements

this makes the code-style more consistent aswell.

9 years agoseparate program-specific c99 bool and X11
Hiltjo Posthuma [Sun, 27 Sep 2015 21:02:33 +0000 (23:02 +0200)]
separate program-specific c99 bool and X11

True, False are X11-specific, make sure to use c99 stdbool for
program-specific things.

... also remove left-over vim mode string in config.