1
0
Fork 0
mirror of https://github.com/Cloudef/bemenu synced 2024-05-09 09:06:43 +02:00
Commit Graph

488 Commits

Author SHA1 Message Date
Jari Vetoniemi e128c21ebb bump version to 0.6.10 2022-07-06 17:11:27 +09:00
Daniel Lublin 4c6592ac60 Don't alternate colors by default (let ALTERNATE color be same as ITEM) 2022-07-06 17:10:36 +09:00
Daniel Lublin c04a3c7220 Add options to set cursor bg/fg color 2022-07-05 10:10:26 +09:00
Jari Vetoniemi bd97e05138 bump version to 0.6.9 2022-07-05 10:07:58 +09:00
Joan Bruguera ef1055ecce Fix pointer enter event without further motion
If the pointer suddenly enters a window but moves no further, we may only get
a POINTER_EVENT_ENTER but no further POINTER_EVENT_MOTION events, so we also
need to handle this event to properly update the selected item.

The issue can be reproduced by moving the mouse programatically, e.g. on Sway:
    swaymsg seat - cursor set 200 200
2022-07-05 10:06:57 +09:00
Joan Bruguera 04b0d83d56 Fix Wayland event loop order to avoid missed renders
After the changes of the previous commit, the event loop flow on Wayland is:
    1. Render windows if window->render_pending is set
    2. Wait for events [NOTE: this includes the frame callback]
    3. Schedule render if menu->dirty is set
    4. Handle events (return from render) and repeat

This can still miss renders since the menu->dirty flag is set in step (4),
but the menu->dirty flag is checked in step (3). So if the event loop only
does a single iteration (quite unusual as most user actions cause multiple
events), we can get stuck on step (2) for a while.

In order to avoid this problem, this changes the event loop order to:
    1. Schedule render if menu->dirty is set
    2. Wait for events [NOTE: this includes the frame callback]
    3. Render windows if window->render_pending is set
    4. Handle events (return from render) and repeat

Script (for Sway) to reproduce the issue / verify the fix:
    #!/usr/bin/env sh
    mousesety() { swaymsg seat - cursor set 200 "$1" >/dev/null; sleep 0.2; }
    { while true; do mousesety 200; mousesety 300; mousesety 400; done } &
    trap 'kill $!' EXIT
    export BEMENU_BACKEND=wayland BEMENU_OPTS='--list 40 --hb #0000FF'
    yes | head -30 | bemenu

Fixes: #274
Fixes: #275
2022-07-05 10:06:57 +09:00
Jari Vetoniemi 7d2c189865 bump version to 0.6.8 2022-06-30 09:41:18 +09:00
Joan Bruguera c7a5812352 Fix missed renders on Wayland on temporally close events
Despite the fix in the previous commit (3d7e47c4e6), the following command:
    { echo one; echo two; } | BEMENU_BACKEND=wayland bemenu --grab
Will likely still show the 'Loading...' text after all items are available.

A related problem (also on Wayland) is that when pressing two keys (for the
filter) almost simultaneously, sometimes only one of the keys will be rendered.
The other key will only be shown on the next render. For example:
    - Filter shows "s"
    - User presses the "o" and "n" keys simultaneously
    - Filter shows "so" ["n" appears to have been lost]
    - User presses the "g" key
    - Filter shows "song" [now the "n" has been rendered]

Both problems have the same root cause: If two events that cause a render happen
"close enough" to each other, often the second event will not cause a render.

As far as I can tell, the cause is that the "dirty && render_pending" render
check should not check the dirty flag at all, just "render_pending".

With "dirty && render_pending", if two events happen in close succession:
- On the first event, generally dirty==true, render_pending==true, a render
  will happen, the frame callback will be set, and both flags will be cleared.
- For the second event, generally dirty==true and render_pending==false.
  dirty will be unset and nothing will happen.
- When the frame triggers, render_pending is set, but no render will happen
  because dirty==false

With just "render_pending" (the change in this commit):
- On the first event, generally dirty==true, render_pending==false, the frame
  callback will be set, and dirty will be cleared.
- For the second event, generally dirty==true and render_pending==false.
  dirty will be unset and nothing will happen.
- When the frame triggers, render_pending is set, then a render will be done.
2022-06-30 09:40:08 +09:00
Joan Bruguera 6e74133876 Fix first render on Wayland after loading items with --grab
Currently, on the Wayland backend, the following command:
    { echo one; sleep 1; echo two; } | BEMENU_BACKEND=wayland bemenu --grab
Will keep showing the 'Loading...' text even after all items are available.
The items will only be shown after some input, e.g. a key press, happens.

This was a regression introduced by 5a095705d2
(versions 0.6.5+). A dirty flag was added to avoid unnecessary redraws,
however, this flag is not reset between the renders before/after the items are
loaded, so the bm_menu_render call after the items are loaded is ignored
(on Wayland, which is the only renderer that currently uses the dirty flag).

Fix the issue by setting the dirty flag when the filter changes, so it will be
reset when changing from "Loading..." to empty and cause a redraw.
2022-06-30 09:40:08 +09:00
Barbaross 8c1c29c0b9 Add option to define a border and border color 2022-06-29 15:13:09 +09:00
Barbaross 84bccc02a0 Add option to specify horizontal padding in single line mode 2022-06-03 09:20:10 +09:00
Barbaross a8ef2457cb Add option to specify alternating entry background/foreground colors 2022-06-03 08:08:38 +09:00
Barbaross 9a76681b2c Add option to specify cursor width 2022-06-03 08:08:21 +09:00
Michael Hsu 81b509155c Fix `--ch` cursor height option parsing 2022-03-11 17:56:04 +09:00
Jari Vetoniemi c3a662d096 bump version to 0.6.7 2022-02-22 09:01:04 +09:00
Julian Orth bb094fda23 wayland: map keymaps with MAP_PRIVATE
MAP_PRIVATE is required in version 7 which is used since 81195da1.
2022-02-22 08:59:40 +09:00
Julian Orth 0e43f5fb75 wayland: bind to zwlr_layer_shell_v1 version 2
zwlr_layer_shell_v1_destroy is not available in version 1 of the
interface.
2022-02-22 08:59:40 +09:00
Jari Vetoniemi b8eba1f464 make: do not copy man pages if no scdoc installed 2022-02-19 09:38:02 +09:00
Jari Vetoniemi f22725b0f9 ci: install scdoc on osx 2022-02-19 09:38:02 +09:00
Jari Vetoniemi f1b59a9757 ci: sort the install tree output 2022-02-19 09:38:02 +09:00
Jari Vetoniemi 930ec70852 ci: install on osx as well 2022-02-19 09:38:02 +09:00
Jari Vetoniemi ccaeda7a84 ci: print install tree 2022-02-19 09:38:02 +09:00
Jari Vetoniemi 81f10dfed7 ci: add symbol validation
checks for missing public symbols, leaked symbols and that plugins only
contains the register_plugin symbol.
2022-02-19 09:38:02 +09:00
Jari Vetoniemi 9817071f3a menu: make bm_menu_item_is_selected internal 2022-02-19 09:38:02 +09:00
Jari Vetoniemi b427e0d35e internal: remove util.h include 2022-02-19 09:38:02 +09:00
Jari Vetoniemi d201c48421 get rid of all the internal symbols 2022-02-19 08:00:26 +09:00
Jari Vetoniemi f64abda7e0 bump version to 0.6.6 2022-02-19 07:42:23 +09:00
Jari Vetoniemi 9143f513c3 make: make scdoc optional (no manpage) 2022-02-19 07:41:23 +09:00
Jari Vetoniemi 7f39f19ae4 make: hide all symbols by default 2022-02-19 07:41:23 +09:00
Jari Vetoniemi c13e28f4b5 menu: make all run functions part of public API
also remove the unused unicode arguments
2022-02-19 07:41:23 +09:00
Zach DeCook 2f416efd5e makefile: Add uninstall target 2022-02-10 04:24:22 +09:00
Jari Vetoniemi 710f675bdc ci: generate release notes on release 2022-02-09 00:39:45 +09:00
Jari Vetoniemi ea43fb4293 bump version to 0.6.5 2022-02-09 00:35:08 +09:00
Stacy Harper 76b3c25014 Avoid by zero divisions 2022-02-08 22:23:02 +09:00
Stacy Harper 5a095705d2 Optimize redrawing
We add a dirty flag on the menu to track if the menu actually need a
redraw. With it, we will not redraw if the touch is hold on the same
entry by example.
2022-02-08 22:23:02 +09:00
Stacy Harper 9b8da12467 Add a feedback for touchscreen support
The idea is to write "Scroll up…", "Scroll down…" when the finger
touching bemenu will trigger a page scroll on release.
2022-02-08 22:23:02 +09:00
Stacy Harper a111aa2afa mouse and touch support on wayland 2022-02-08 22:23:02 +09:00
Jari Vetoniemi 391bf16c85 flatpak: build the action branch 2022-02-08 21:41:16 +09:00
Jari Vetoniemi 7f6aff52ee makefile: add install-docs rule 2022-02-08 21:41:16 +09:00
Maxim Karasev 9cac33857d Update manpage to use scdoc, document margin and width-factor
This also adds scdoc as a dependency.

scdoc is almost as easy as markdown and therefore it's much nicer to
write and maintain manpages making use of it instead of plain roff.
2021-12-29 17:22:10 +09:00
Maxim Karasev 43255bbbe8 Add relative width option
It works on Wayland and X11 and acts as a complement to margin. Exact
behavior is as follows:
- If width factor is 0, width minus margin is used.
- If width multiplied by factor is greater than width minus margin,
  width minus is used. (so margin may be used to make sure that bemenu
  is at least N pixels away from the view border)
- Otherwise width multiplied by factor is used.

I think it's fine to disable warnings about floating point numbers
comparision. We don't do any arithmetics on them anyway, so we can't
suffer from inaccuracy.
2021-12-29 17:22:10 +09:00
Jari Vetoniemi 192736c554 bump version to 0.6.4 2021-12-03 17:04:37 +09:00
jjtt a6f362eda7 Instruction for installing dependencies 2021-11-24 05:14:22 +09:00
Andrei E d593ab27b6 Close clipboard file 2021-11-04 09:01:29 +09:00
Andrei E e1a016b8a0 Adapt code style 2021-11-04 09:01:29 +09:00
Andrei E d6c58f5ea7 Document clipboard dependencies 2021-11-04 09:01:29 +09:00
Andrei E 0c9cfd029c Document paste functionality 2021-11-04 09:01:29 +09:00
Andrei E 00efc974d7 Add paste functionality 2021-11-04 09:01:29 +09:00
lunacb cd41b1b52c add missing newline 2021-11-03 17:57:18 +09:00
lunacb 21ff4e47da fixed indentation 2021-11-03 17:57:18 +09:00