Commit Graph

531 Commits

Author SHA1 Message Date
Orestis Floros 33634fbacd
Fix i3bar leak on handle_destroy_notify 2019-10-14 17:34:38 +03:00
Orestis Floros ee30c34b5c
Fix small leak in i3bar's main
If -s is used, the socket_path returned by getenv is never freed.

Also some small rearrangements.
2019-10-14 03:54:48 +03:00
Orestis Floros 98d96c3a2c
reorder_trayclients_cmp: Correct comment 2019-10-11 19:32:58 +03:00
Orestis Floros eda814755a
Make tray icon order deterministic
Fixes #3573
2019-10-11 18:25:22 +03:00
Orestis Floros d5a3b8af02
Introduce trayclient_and_output_from_window
Saves some code repetition
2019-10-11 16:12:48 +03:00
Konst Mayer 94228fd902 Add setting for minimal width of workspace buttons 2019-06-25 13:10:01 +07:00
Ingo Bürk ca82f95812 feat: added support for user-defined border widths in i3bar blocks (#3726)
This change introduces support for four new properties on the i3bar
protocol, namely "border_top", "border_right", "border_bottom"
and "border_left".

If a block is drawn with a border, these values define the width of
the corresponding edge in pixels. They all default to 1 if not
specified to preserve compatibility.

fixes #3722
2019-06-22 22:18:29 +02:00
Ingo Bürk 48af067dfe feat: support transparency (RGBA) in i3bar (#3727)
We introduce a --transparency flag for i3bar in order to enable a mode which
supports the use of RGBA colors.

An important constraint here is that tray icons will always have
a fully transparent background.

fixes #3723
2019-06-22 17:23:21 +02:00
Orestis Floros baf1067087
i3bar: If click events disabled, use whole bar for other events
Fixes #3700
2019-05-13 12:56:04 +03:00
Orestis Floros 8903f29795
child_handle_button: Call only if x >= offset
c2a1b6e9 was a bit overzealous, other actions should be executed if the
button was pressed after the workspace buttons but before the
statusline.

Also, should we allow other actions everywhere in the bar if click
events are disabled by the child?
2019-03-29 16:10:19 +02:00
Orestis Floros c2a1b6e91f
handle_button: Introduce child_handle_button
Also fixes an issue where action would be called if the button press was
on a separator. For example, if a user scrolled on a separator, the
workspace would change.

Applies to --release commands as well.
2019-03-28 21:05:43 +02:00
Orestis Floros 03d2ccdeef
handle_button: Use full render width for calculations
Fixes #3664

Also, click events' width will now always be >= min_width.
2019-03-28 21:05:29 +02:00
Hamish Macdonald 5084a881af Do not assume STDIN_FILENO is available for input from child 2018-10-26 09:31:43 -04:00
Soumya 3745e6f484
Add "modifiers" to events sent by i3bar 2018-10-25 16:02:06 -07:00
Orestis 5d70e2850f
Merge pull request #3475 from Gravemind/fix-i3bar-re-hidden-on-any-modifier
i3bar: Fix i3bar re-hidden by any modifier (#3474)
2018-10-23 18:41:11 +03:00
Orestis Floros e240c118c7
Close & reopen tray selwin when needed
Fixes #1329
Fixes #3317 (duplicate)
Examples where the tray "disappeared":
- Start without a "tray_output", reload config with "tray_output none",
remove "tray_output none" and reload.
- Start with "tray_output primary" (or "tray_output <output>"), disable
the primary output and then reconnect it.

Fixes #2010
Cached in output_for_tray
2018-10-23 16:41:09 +03:00
Gravemind c40c79538e i3bar: Fix i3bar re-hidden by any modifier (#3474)
The bug was introduced in 4.15-next fe6b3b7474
2018-10-23 15:17:30 +02:00
Orestis Floros a65914f338
Fix missing prototypes
i3 will now compile with no warnings when -Wmissing-prototypes is used.
2018-10-13 21:10:10 +03:00
Orestis Floros 2a9522dda4
Enforce strict prototypes
i3 will now compile with no warnings when -Wstrict-prototypes is used.
2018-10-13 21:10:09 +03:00
Alan Barr 7c0994dafc Fixes for undefined behaviour on signed shift (#3453)
Fixes for undefined behaviour on signed shift

Change literal 1 to unsigned to allow safe bitshift of 31.
Caught by cppcheck.

Make 0xFF unsigned to prevent a left shift into signed bit.
Spotted by @orestisf1993
2018-10-13 21:04:40 +03:00
Orestis Floros fed059a2b7
Fix "relative_x" and "width" of click events
Now clicks begin at the start of the "actual" block, offsets and
separators don't trigger click events. The width property is now just
the width of the block, including border.

Fixes #3380.
2018-09-16 14:58:20 +03:00
Orestis Floros 9936d049cf
i3bar: Include sb_hoff_px only when needed
Fixes #3404.
2018-09-15 13:27:18 +03:00
Orestis Floros f4981f97bc
Replace strncpy call with memcpy when result is not NUL-terminated
This fixes a new warning from GCC 8.1, -Wstringop-truncation:
https://gcc.gnu.org/gcc-8/changes.html
https://gcc.gnu.org/onlinedocs/gcc-8.1.0/gcc/Warning-Options.html#index-Wstringop-truncation

Replacing with memcpy is what gcc suggests:
> As another example, the following call to strncpy results in copying
> to d just the characters preceding the terminating NUL, without
> appending the NUL to the end. Assuming the result of strncpy is
> necessarily a NUL-terminated string is a common mistake, and so the
> call is diagnosed. To avoid the warning when the result is not
> expected to be NUL-terminated, call memcpy instead.
>    void copy (char *d, const char *s)
>    {
>      strncpy (d, s, strlen (s));
>    }
2018-05-08 17:05:46 +03:00
Orestis Floros aca7790217
Fix redundant return statements
… at the end of a function with a void return type.

Found using clang-tidy's readability-redundant-control-flow.
2018-04-27 00:09:42 +03:00
Ingo Bürk 3c66f615e2
Merge pull request #3246 from orestisf1993/bar-modifier-3234
i3bar: make modifier behave like floating_modifier
2018-04-17 13:13:18 +02:00
Orestis Floros fe6b3b7474
i3bar: make modifier behave like floating_modifier
Pressed modifiers are determined like in click.c:handle_button_press.

Fixes #3234.
2018-04-17 02:00:03 +03:00
Orestis Floros 0a72f2d535
i3bar: don't reset verbosity when parsing config values
When i3bar is called with the -V flag but there is no 'verbose yes'
directive in the bar {} config, the verbosity config value is reset.

This will introduce the opposite, negligible issue: you can't disable
i3bar's verbosity by deleting the 'verbose yes' directive in the bar {}
config. To fix this we would need an enum for config.verbose.

Closes #3220.
2018-04-16 01:37:18 +03:00
hwangcc23 e26fd91cf8 Add an i3bar flag: --verbose
Fix the issue #3220. (https://github.com/i3/i3/issues/3220)
2018-04-13 23:09:44 +08:00
Michael Stapelberg 145ac532aa i3bar: forward the sync request via IPC, not X11
i3bar’s X11 output is not what our testcases are testing — the state
manipulations which i3bar triggers via IPC messages to i3 are what we are
interested in.
2018-03-30 21:14:51 +02:00
Ingo Bürk dfc330fcb8
Merge pull request #3167 from hwangcc23/fix-3163
Add strip_workspace_name
2018-03-11 16:33:10 +01:00
hwangcc23 2269b2e795 Add strip_workspace_name
See the issue #3163 (https://github.com/i3/i3/issues/3163).

Add strip_workspace_name to strip off the workspace name.
2018-03-11 12:17:42 +08:00
Hritik Vijay 8ee4a4a3e1 Fixed typo 2018-03-10 02:38:47 +05:30
Pallav Agarwal 161db6f17d Add relative coordinates in JSON for i3bar click events (fixes #2767)
Add support for relative coordinates in i3bar click events

Rename {x,y}_rel to relative_{x,y}

Update i3bar-protocol doc to mention the added fields in click events
2017-12-20 22:51:14 +05:30
Orestis Floros 315ff17563 Add '--release' flag for bindsym in the bar block
i3bar's handle_button is modified to also handle XCB_BUTTON_RELEASE
events. During these button release events, only custom commands are
checked to avoid sending multiple workspace ipc messages.

The way this patch is implemented will allow to assign a custom command
for both the press and release of the same button:
bar {
  ...
  bindsym buttonX exec command1
  bindsym --release buttonX exec command2
}

Fixes #3068.
2017-12-08 12:16:22 +02:00
Ingo Bürk 458e2a2e46
Merge pull request #3022 from orestisf1993/i3bar-leaks
Fix i3bar leaks
2017-12-03 19:51:25 +01:00
Orestis Floros 54c79e4b2f i3bar: free output data structures 2017-12-03 20:25:34 +02:00
Ingo Bürk f6f198c3fe
Merge pull request #3058 from d-e-s-o/fix-FREE
do not check for NULL in FREE macro
2017-11-29 08:33:27 +01:00
Daniel Mueller 865bd462b4
do not check for NULL in FREE macro
free(3) is safe to invoke on a NULL pointer, in which case no action is
taken. This change adjusts the FREE macros to omit this unnecessary
check.
2017-11-23 15:41:33 -08:00
Daniel Mueller 222d8210ab
i3bar: replace magic numbers with more meaningful constructs
In i3bar/src/config.c we compare string lengths agains magic numbers.
This change replaces those numbers with the lengths of the strings they
represent.
2017-11-17 06:58:12 -08:00
Michael Stapelberg 0d8b6714e3 Move XCB event handling into xcb_prepare_cb.
Previously, we used ev_check watchers, which are executed at the beginning of an
event loop iteration.

This was problematic if one of the handlers happened to fill the XCB event
queue, e.g. by reading a reply from X11 and an event happened in the meantime.

In that situation, we would hand control to the event loop, entirely ignoring
the pending event. This would manifest itself as a 1-minute hang,
reproducible (sometimes) in the i3 testsuite.

issue #2790 describes an instance of this issue in i3bar, and we fixed that by
changing the watcher priority to run last. Handling events in xcb_prepare_cb has
the same effect, as ev_prepare watchers are run just before the event loop goes
to sleep.
2017-10-23 21:06:13 +02:00
Orestis Floros a05663c59e i3bar: avoid possible va_args leak 2017-10-17 04:28:07 +03:00
Orestis Floros a7bae0341d i3bar: free fontname 2017-10-17 04:28:07 +03:00
Michael Stapelberg 2bff4f1dba Synchronize with i3bar+i3, not just i3. 2017-09-30 13:04:20 +02:00
Orestis Floros 4257107509 i3bar: fix segfault when no status_command is provided
Fixes #2933.
2017-09-26 02:50:10 +03:00
Michael Stapelberg d968d39b27 Replace http:// with https:// where applicable
The testcases will be updated automatically in a separate commit.
2017-09-24 10:19:07 +02:00
Michael Stapelberg 607e97e651 ipc: rename COMMAND to RUN_COMMAND for consistency (#2956)
All other message types are verbs, only our first-ever message COMMAND wasn’t.

While we’re here, also change the message type dictionary into a table with
clickable links to the corresponding reply type.

Authors of downstream IPC libraries are encouraged to keep the old name around
so as to not break existing code, but mark it as deprecated.
2017-09-17 15:25:00 +02:00
Michael Stapelberg 55964fb3be i3bar: ensure get_buffer does not leak memory
This fixes an AddressSanitizer warning which recently popped up.

related to #2907
2017-09-09 06:56:50 +02:00
Michael Stapelberg fdb551f9d5 i3bar: only restart child when command changed (#2866)
this is a follow-up to
98f202dd1b

fixes #2689
2017-08-20 15:30:27 +02:00
Michael Stapelberg 8106ae7923 i3bar: Bugfix: avoid freeze after VisibilityNotify
fixes #2790
2017-08-20 12:16:43 +02:00
Michael Stapelberg 69efe0176e Prevent accidentally introduced fall-through
This was added in commit e82e26a24d
2017-08-19 17:29:31 +02:00