Commit Graph

610 Commits

Author SHA1 Message Date
Jari Vetoniemi
6f0fd2ea4c Bump version to 0.6.23 2024-07-19 13:12:27 +09:00
Jari Vetoniemi
4675e216b0 cairo: fix 1px margin when no border radius
fixes #415
2024-07-19 13:12:27 +09:00
Jari Vetoniemi
8cddd28e19 menu: reversed page up / page down on up list mode 2024-07-19 13:12:27 +09:00
Jari Vetoniemi
84ac270459 cairo: limit indices 2024-07-19 13:12:27 +09:00
Jari Vetoniemi
2271b3f9b7 cairo: cleanups 2024-07-19 12:46:13 +09:00
Willow Barraco
6c7c6b847b Disable cairo antialiasing with Wayland fractional scaling 2024-07-14 16:10:43 +09:00
Jari Vetoniemi
bd62fb33dd Bump version to 0.6.22 2024-07-08 08:51:20 +09:00
ldev
1201340675 set antialiasing to DEFAULT 2024-07-08 02:23:25 +09:00
ldev
33f22999cb fix formatting in bm_cairo_rounded_path 2024-07-08 02:23:25 +09:00
ldev
064981e71e round max_height to the closesd line in total_height calculations so that it doesn't show half lines 2024-07-08 02:23:25 +09:00
ldev
43444936bf changed border size calculation for non rounded borders to match rounded ones 2024-07-08 02:23:25 +09:00
ldev
90d8b2ca66 renamed bm_cairo_draw_rounded_path to bm_cairo_rounded_path
because it is not actualy drawing and now it is also used for clip
2024-07-08 02:23:25 +09:00
ldev
b701a9231e border fixes
fixed border with corner radius not clipping bg
fixed corners being too thick
fixed border looking weird when height/width is less than corner radius
2024-07-08 02:23:25 +09:00
Joan Bruguera Micó
498be46bbc wayland: Fix seat resource release logic
The existing logic leads to leaks in several scenarios:

1. Neither `wl_pointer_destroy` nor `wl_touch_destroy` are ever called,
   so pointer and touch objects are never released.

2. The logic for `wl_keyboard_destroy` is not solid as seats can lose
   the `WL_SEAT_CAPABILITY_POINTER` capability without losing the
   `WL_SEAT_CAPABILITY_KEYBOARD`. Thus it's possible for the calls to
   `wl_seat_get_keyboard` and `wl_keyboard_destroy` to be unbalanced.

3. Those resources were not released in the renderer destructor.

This reworks the seat resource release logic in a systematic way to
ensure that seat resources are always released.
2024-07-08 02:22:31 +09:00
Joan Bruguera Micó
8a79713a34 wayland: Free struct window and struct surf_output objects
Make sure that we release the memory used by each `wl_list` node that
was previously allocated with `calloc`.

I'm not sure if freeing the memory of the nodes without removing it
from the `wl_list` first could cause any problem so prefer removing it
from the list before releasing the memory.
2024-07-08 02:22:31 +09:00
Joan Bruguera Micó
96d206a815 wayland: Free all resources allocated from registry_handle_global
The following resources were not being released:
- `wl_seat`
- `wl_output`
- `wp_fractional_scale_manager_v1`
- `wp_viewporter`
2024-07-08 02:22:31 +09:00
Joan Bruguera Micó
5d5fd16f76 Fix Pango-Cairo context leak
We own the Pango-Cairo context and must release it.
2024-07-08 02:22:31 +09:00
Joan Bruguera Micó
6f63f3f197 Fix transposed calloc arguments warning
GCC 14 added a new warning (included in `-Wextra`) when calling
`calloc` with `sizeof` in the first argument and the number of
elements in the second argument. See:
https://gcc.gnu.org/onlinedocs/gcc-14.1.0/gcc/Warning-Options.html#index-Wcalloc-transposed-args

Note that this is just a coding style warning.
2024-07-08 02:22:31 +09:00
Joan Bruguera Micó
fa84d4b2d6 Fix out-of-bounds read when parsing --list argument
When running bemenu like:
    env BEMENU_OPTS="--list 3" bemenu

Valgrind will report an out-of-bounds read:
    Invalid read of size 1
       at 0x10BC91: do_getopt.part.0 (common.c:366)
       by 0x10C635: do_getopt (common.c:340)
       by 0x10C635: parse_args (common.c:556)
       by 0x10B535: main (bemenu.c:55)
     Address 0x4ac13e2 is 0 bytes after a block of size 2 alloc'd
       at 0x4849BF3: calloc (vg_replace_malloc.c:1675)
       by 0x10C533: cstrcopy (common.c:120)
       by 0x10C533: tokenize_quoted_to_argv (common.c:146)
       by 0x10C60C: parse_args (common.c:555)
       by 0x10B535: main (bemenu.c:55)

The problem is that the parsing code for `--list` will blindly compare
a character past the number of lines to parse for e.g. `--list '3 up'`
but the end of the string may come right after the number of lines.

In my system Valgrind does not find the error when running bemenu like
`bemenu --list 3` even though the logic is equally questionable.

Fix it by checking that there is more after the number of lines.
2024-07-08 02:22:31 +09:00
ldev
5bc8a6caaa removed another unused variable (displayed) in curses renderer 2024-06-16 21:57:55 +09:00
ldev
9fc92189a1 removed unused varible scroll_count in lib/menu.c 2024-06-16 21:57:55 +09:00
ldev
c1326672d9 changed offset between filter and title so they don't overlap, removed
random rect that causes filter with opacity to behave weird
2024-06-16 21:57:16 +09:00
Peter Hofmann
75122a023a Clipboard: Don't use "text/plain"
On X11, not all programs offer this target, e.g. some terminals like
XTerm. The target "UTF8_STRING" has worked fine for many years and it is
what dmenu uses.

On Wayland, wl-paste supports the special type "text", which attempts to
autodetect a suitable type (in case there is no exact match for
"text/plain").
2024-06-16 15:50:52 +09:00
Peter Hofmann
5b462ad76d Clipboard: Switch C-y and C-Y
First, this behavior now matches that of dmenu. People switching over
from dmenu might be used to this.

I would argue, though, that it is more comfortable in general anyway:

The "primary" selection is often easier to access, you can just select
some text and be done with it, no need to reach for C-c (or even C-S-c
in terminals). Some programs like XTerm can't even put text into the
"clipboard" selection without special configuration. It thus makes sense
to make this selection available with a hotkey that's easier to reach (I
find C-y to be much more comfortable than C-Y). Only in rare
circumstances do I need to access the "clipboard" selection.

In practice, this change is *probably* not a (very) breaking change for
users, because you very often have to select some text first using a
mouse (thus putting it into the "primary" selection) before you can put
it into the "clipboard" selection using something like C-c. This means
that pasting from "primary" almost acts as a "magic" hotkey that does
"the right thing".
2024-06-16 15:50:52 +09:00
Peter Hofmann
62154d8e7b Clipboard: Make both selections available and fix inconsistencies
Previously, C-y pasted the "primary" selection on X11 and the
"clipboard" selection on Wayland. That's inconsistent and confusing,
especially when you're switching back and forth between the two.

This commit does two things:

1.  It makes C-y always paste the "clipboard" selection.
2.  It adds a key bind C-Y to paste the "primary" selection.

I suspect that most bemenu users are on Wayland, so this commit tries to
not break things for them. It does, however, change the behavior on X11.
2024-06-16 15:50:52 +09:00
Jari Vetoniemi
1c3eeb09d5 nix: update default.nix
* reduce src fileset to avoid unneccessary rebuilds
* test symbol visibility
2024-04-02 19:07:45 +09:00
Jari Vetoniemi
d58c9dc365 Bump version to 0.6.21 2024-03-13 11:28:12 +09:00
Andrei E
c0c608cad7 Move SIGCHLD to client launch 2024-03-09 23:46:46 +09:00
Andrei E
9a7b736dd9 Remove SIGCHLD handler
SIG_DFL on SIGCHLD prevents proper functioning of pclose, which the new version of the pasting functionality requires.

Closes Cloudef#385

Ref: https://stackoverflow.com/questions/54189212/popen-returns-1-unexpectedly
2024-03-09 23:46:46 +09:00
Jari Vetoniemi
fab01c9906 Bump version to 0.6.20 2024-03-07 17:51:45 +09:00
Julian Orth
6bcffe408c wayland: bind to zwlr_layer_shell_v1 version 3
zwlr_layer_shell_v1_destroy is not available in version 2 of the
interface.
2024-03-07 17:41:43 +09:00
Colin
cf72e2aa44 document vim bindings 2024-02-26 22:10:08 +09:00
Anskrevy
52b23d8fb5 Fix use after free in wayland.c 2024-02-17 14:24:11 +09:00
ldev
34259c5da7 removed workaround for bug and added extra case for XKB_KEY_ISO_Left_Tab 2024-02-08 11:13:54 +09:00
Anskrevy
a3f19bab9b Fix mouse press being ignored on x11 2024-02-05 12:52:51 +09:00
Jari Vetoniemi
6c531b4d2a Bump version to 0.6.19 2024-02-02 21:05:50 +09:00
Jari Vetoniemi
d93acb0e84 Revert "wayland: force window->scale = 1, if BEMENU_SCALE"
This reverts commit aac7d73afc.
2024-02-02 21:04:56 +09:00
Jari Vetoniemi
e77ca88c83 Bump version to 0.6.18 2024-02-02 18:41:37 +09:00
Jari Vetoniemi
aac7d73afc wayland: force window->scale = 1, if BEMENU_SCALE
BEMENU_SCALE is global override for whatever buffer scaling mechanism
there might be
2024-02-02 18:37:00 +09:00
Jari Vetoniemi
291d58a849 wayland: put fractional scaling behind env var
seems to fail on hyprland at least for now
2024-02-02 18:35:21 +09:00
Willow Barraco
877ca82cc1 Reapply "implement wayland fractional scaling"
This reverts commit 943d74600e.

This fix the BEMENU_SCALE that was left unused when fractionnal scale
support was detected.

This is rebased over origin/master.
2024-02-02 18:13:22 +09:00
Jari Vetoniemi
3156dac7d4 wayland: cairo/wl scale are different concepts
Sepearate BEMENU_SCALE from wayland's buffer scale
2024-02-02 17:22:01 +09:00
Jari Vetoniemi
826b8953ed wayland: unused parameter 2024-02-02 14:58:52 +09:00
Jari Vetoniemi
80d904c534 wayland: set buffer scale before everything else 2024-02-02 14:57:30 +09:00
Jari Vetoniemi
943d74600e Revert "implement wayland fractional scaling"
This reverts commit b1439df42c.
2024-02-02 14:40:40 +09:00
Jari Vetoniemi
36bb77b9ac wayland: use the correct scale render operates on 2024-02-02 14:35:33 +09:00
Jari Vetoniemi
af9fa0d105 wayland: remove unneccessary commit and roundtrip 2024-02-02 14:34:42 +09:00
Jari Vetoniemi
7a65abf52b x11: allow backend to be forced 2024-02-02 14:34:42 +09:00
Jari Vetoniemi
55e5aec8d5 Add flake.nix, make default.nix callPackageable 2024-02-02 14:34:42 +09:00
Willow Barraco
b1439df42c implement wayland fractional scaling 2024-02-02 13:26:28 +09:00