aboutsummaryrefslogtreecommitdiffstats
path: root/swaybar/render.c
Commit message (Collapse)AuthorAge
* cairo: Replace <cairo/cairo.h> by <cairo.h>Libravatar Issam E. Maghni2021-05-10
| | | | | | | For full context, read https://gitlab.freedesktop.org/cairo/cairo/-/issues/479 TL;DR, cairo’s pc file adds `/cairo` to CFLAGS. So namespace cairo shouldn’t be used.
* swaybar: use text subpixel antialias only where it would look goodLibravatar Fenveireth2021-03-07
| | | | | | | | | | | | | | | | | | | | | Closes #5605 Text Subpixel antialiasing is : - FreeType makes glyph bitmaps containing coverage percentage for each subpixel, instead of pixel - Then draw by performing the blend for each subpixel, instead of pixel (e.g. dual-source blending in opengl) And there's only one Alpha channel, so this extra coverage data can't leave Cairo to reach the compositor through there. Therefore, it can't work as intended if output text alpha != bar background alpha. Disable it for those cases, enable it elsewhere As for color emojis, they are RGBA bitmaps. If drawn with text alpha=1.0 and background alpha=1.0 (should be completely opaque bar), then with 'CAIRO_OPERATOR_SOURCE' then texels with alpha < 1.0 result in a blend with whatever's behind the bar, instead of the bar background
* Fix #5940Libravatar Mukundan3142021-01-11
| | | | Fallback to focused_statusline instead of statusline on focused output
* swaybar: don't expand separator_block_width if separator is falseLibravatar Ludvig Michaelsson2020-10-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | When swaybar receives the following JSON body [ { "full_text": "foo", "separator": false, "separator_block_width": 0 }, { "full_text": "bar" } ] it should not draw any separator or any space between the two blocks. However, since swaybar calculates that separator_block_width 0 is too small to fit any configured separator, it will override the separator_block_width with some non-zero value. This patch changes that such that the necessary separator_block_width is only expanded if the block has 'separator: true'. This should be in line to what i3 does, as its documentation of the i3bar protocol for separator states that "[...] if you disable the separator line, there will still be a gap after the block, unless you also use separator_block_width".
* Add support for workspace_min_width bar option.Libravatar Tarmack2020-10-11
|
* interpret "subpixel none" as CAIRO_ANTIALIAS_GRAYLibravatar Ian Huang2020-04-20
| | | | | | | | See issue #5228. Currently, WL_OUTPUT_SUBPIXEL_NONE is ignored and CAIRO_ANTIALIAS_SUBPIXEL is still set. This commit checks if subpixel is set to none and if so, calls set_antialias with CAIRO_ANTIALIAS_GRAY. This mirrors the functionality in Mako's [PR261](https://github.com/emersion/mako/pull/261)
* swaybar: fix i3bar relative coordinates when scaling is usedLibravatar Hristo Venev2020-02-10
| | | | | | | | | | | | 24e8ba048aef4751c6fa1d5982ee634f921e6cf6 did not take scaling into account. The hotspot size used pixel coordinates, the absolute coordinates were logical, and the relative coordinates were completely wrong. This commit makes all coordinates use logical values. If `"float_event_coords":true` is sent in the handshake message, coordinates are sent as floating-point values. The "scale" field is an integer containing the scale value.
* parse_color: return success + drop fallback colorLibravatar Brian Ashworth2019-12-28
| | | | | | | | | | | | This is the first in a series of commits to refactor the color handling in sway. This changes parse_color to return whether it was success and no longer uses 0xFFFFFFFF as the fallback color. This also verifies that the string actually contains a valid hexadecimal number along with the length checks. In the process of altering the calls to parse_color, I also took the opportunity to heavily refactor swaybar's ipc_parse_colors function. This allowed for several lines of duplicated code to be removed.
* swaybar: make status block text render in the same way as othersLibravatar xdavidwu2019-09-20
| | | | | | Other components like workspace button, status line (error or plain text) already render text at integer coords. This make status block also render text at integer coords.
* Remove unused variableLibravatar Antonin Décimo2019-08-02
|
* Add margin to short_text handling.Libravatar Dmitri Kourennyi2019-04-04
| | | | | Add a 3xscale margin matching other spacing in swaybar as part of short text width calculations
* Ensure predicted position for short text handling doesn't overflow.Libravatar Dmitri Kourennyi2019-04-04
| | | | | | - Predicted status line can be negative, so corresponding variables should not be unsigned. Changed to double as position is actually calculated as double.
* Implement handling of short_text field of i3 input protocol.Libravatar Dmitri Kourennyi2019-04-04
| | | | | Matches i3bar behavior of setting all blocks to use the short_text if the full text width does not fit.
* Rebase #1636 against current masterLibravatar v44r2019-01-31
|
* Replace wlr_log with sway_logLibravatar M Stoeckl2019-01-21
| | | | | | | | | | | | | This commit mostly duplicates the wlr_log functions, although with a sway_* prefix. (This is very similar to PR #2009.) However, the logging function no longer needs to be replaceable, so sway_log_init's second argument is used to set the exit callback for sway_abort. wlr_log_init is still invoked in sway/main.c This commit makes it easier to remove the wlroots dependency for the helper programs swaymsg, swaybg, swaybar, and swaynag.
* Merge pull request #3344 from RedSoxFan/bar-mouse-bindings-improvedLibravatar Drew DeVault2019-01-13
|\ | | | | Improve mouse button parsing: bar mouse bindings
| * bar_cmd_bind: utilize mouse button helpersLibravatar Brian Ashworth2019-01-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This modifies `bar_cmd_bindsym` to use `get_mouse_bindsym` for parsing mouse buttons. This also introduces `cmd_bar_bindcode`, which will use `get_mouse_bindcode` for parsing mouse buttons. Like sway bindings, the two commands are encapsulated in a single file with shared code. This also modifies swaybar to operate off of event codes rather than x11 button numbers, which allows for any mouse button to be used. This introduces two new IPC properties: - For `get_bar_config`, `event_code` has been added to the `bindings` section and will include to event code for the button. If the event code can be mapped to a x11 button, `input_code` will still be the x11 button number. Otherwise, `input_code` will be `0`. - Likewise for `click_events`, `event` has been added and will include the event code for the button clicked. If the event code can be mapped to a x11 button, `button` will still be the x11 button number. Otherwise, `button` will be `0`.
* | Merge pull request #3397 from RedSoxFan/fix-swaybar-heightLibravatar Drew DeVault2019-01-13
|\ \ | | | | | | swaybar: obey height if given
| * | swaybar: obey height if givenLibravatar Brian Ashworth2019-01-09
| | | | | | | | | | | | | | | If there is a bar height given, use that as the height rather than as a minimum height. This matches i3-gaps behavior.
* | | swaybar: add status_edge_padding commandLibravatar Brian Ashworth2019-01-11
| | | | | | | | | | | | | | | This adds the bar subcommand `status_edge_padding <padding>` to set the padding used when the status line is on the right edge of the bar.
* | | swaybar: add status_padding commandLibravatar Brian Ashworth2019-01-11
| |/ |/| | | | | | | | | Adds the bar subcommand `status_padding <padding>` which allows setting the padding used for swaybar. If `status_padding` is set to `0`, blocks will be able to take up the full height of the bar.
* | swaybar: fix rendering of border and backgroundLibravatar Brian Ashworth2019-01-09
|/ | | | | | | | This fixes the rendering of borders and backgrounds for blocks. This also makes the following changes: * both borders and padding are scaled with the output * both lines and rectangles are rendered without an antialiasing to avoid bleeding outside the desired area
* swaybar: add tray interfaceLibravatar Ian Fan2018-12-31
|
* swaybar: fix sep block width for mixed scalesLibravatar Brian Ashworth2018-12-12
| | | | | | | | | | | | | When there are outputs with mixed scales, it was possible for swaybar to alter `block->separator_block_width` for an output with a higher scale, and use the changed value for a lower scale output. This caused there to be larger than normal separation between blocks on the lower scale outputs. The issue is more obvious the larger the scale difference between the highest scale output and the lowest scale output. This fixes the issue by using a local variable that is originally set to `block->separator_block_width` for rendering, but if it needs to be increased, the local variable is the only thing touched.
* swaybar: handle block->urgentLibravatar Brian Ashworth2018-12-12
| | | | | | | When `block->urgent` is set, use the urgent colors. This matches i3bar's behavior. Previously, swaybar just ignored the property. This also adds in rendering for right borders, which was missing.
* Add relative coordinates in JSON for i3bar click eventsLibravatar Hristo Venev2018-12-04
| | | | Compatibility with i3 commit 161db6f17d734ac9deb0a20e81b78d4b2a92ce68.
* Implement bar gapsLibravatar Brian Ashworth2018-11-28
| | | | | | | | | Adds the bar subcommand `gaps <amount>|<horizontal> <vertical>|<top> <right> <bottom> <left>` to set gaps for swaybar. Due to restrictions on margins for a layer_surface, only the sides that are anchored to an edge of the screen can have gaps. Since there is support for per-side outer gaps for workspaces, those should be able to be used instead for the last side.
* Implement strip_workspace_name.Libravatar Connor E2018-11-17
|
* swaybar: reverse order of workspaces listLibravatar Ian Fan2018-10-25
| | | | | This makes it congruent with its visual appearance, making it easier to reason about.
* swaybar: render with minimum height, nominally text heightLibravatar Ian Fan2018-10-20
|
* swaybar: when hiding bar, save old height to be restored upon reshowLibravatar Ian Fan2018-10-14
| | | | | | | | Previously, when the bar was hidden, the height would be set to 0. This meant that if the bar was empty upon reshow, it would not render since the height was still 0, which made it seem there was a problem. Now, the height is not reset, but the width is, to indicate upon reshow that the layer surface needed reconfiguring.
* swaybar: handle mode/hidden_state changesLibravatar Ian Fan2018-10-14
| | | | | | | | | As well as adding the hidden_state property to the bar config struct, this commit handles barconfig_update events when the mode or hidden_state changes, and uses a new function determine_bar_visibility to hide or show the bar as required, using, respectively, destroy_layer_surface, which is also newly added, and add_layer_surface, which has been changed to allow dynamically adding the surface.
* swaybar: move mode & mode_pango_markup to bar structLibravatar Ian Fan2018-10-14
| | | | | | This distinguishes the binding mode from the distinct config mode, as well as removing mode_pango_markup from the config struct where it should not be present.
* swaybar: add free_hotspots helper functionLibravatar Ian Fan2018-10-14
|
* swaybar: synchronize rendering to output framesLibravatar Ian Fan2018-09-30
|
* swaybar: trim function prototypesLibravatar Ian Fan2018-09-28
|
* swaybar: move i3bar definitions into separate fileLibravatar Ian Fan2018-09-28
|
* swaybar, swaylock, & tree/container: Set cairo font options to render text ↵Libravatar Geoff Greer2018-09-22
| | | | and lines with subpixel hinting (if available).
* swaybar: don't wl_display_roundtrip on each frameLibravatar emersion2018-09-20
| | | | | | | This was the source of numerous bugs, from hotplug events not being received to segfaults because wl_display_roundtrip was making the bar process unplug events while blocking in an iteration over all outputs.
* swaybar: handle hotpluggingLibravatar emersion2018-09-20
| | | | Don't kill and respawn swaybars on hotplug.
* swaybar: rewrite i3bar protocol handlingLibravatar Ian Fan2018-09-18
| | | | | | | | This now correctly handles an incoming json infinite array by shifting most of the heavy listing to the json-c parser, as well as sending multiple statuses at once. It also removes the struct i3bar_protocol_state and moves its members into the status_line struct, allowing the same buffer to be used for both protocols.
* swaybar: only create i3bar block hotspot if click events are enabledLibravatar Ian Fan2018-09-18
|
* i3bar: count references to blocksLibravatar Ian Fan2018-09-12
| | | | | | | | | This prevents blocks from being destroyed before their hotspots are destroyed, in case it is used for a pending click event that fires between the bar receiving a new status, which destroys the block, and the bar rendering the new status, which destroys the hotspot; this problem can be easily produced by scrolling on a block that immediately causes a new status to be sent, with multiple outputs
* Align titles to baselineLibravatar Ryan Dwyer2018-09-08
| | | | | | | | | | | | | This does the following: * Adds a baseline argument to get_text_size (the baseline is the distance from the top of the texture to the baseline). * Stores the baseline in the container when calculating the title height. * Takes the baseline into account when calculating the config's max font height. * When rendering, pads the textures according to the baseline so they line up.
* Fix swaybar block background fill logicLibravatar Jason2018-09-05
| | | Same as #2571 but for 1.0.
* swaybar: Fix scroll handling on workspace buttonsLibravatar minus2018-07-19
| | | | | | | | | | As well as ignoring scroll events on status elements when click_events is enabled. Previously, using the scroll wheel on a workspace button would switch to that workspace instead of scrolling through them. Clicks and scrolling on status elements would always be processed by swaybar, too. So in case you were using scrolling as volume control on a status item, swaybar would additionally scroll through your workspaces.
* make hotspot callback take an x11 button idLibravatar Peter Rice2018-07-16
|
* swaybar/bg: Fix crash on DPMS offLibravatar minus2018-07-14
| | | | | When turning off displays via DPMS, swaybar and swaybg still tried to render, but did not get a valid buffer, causing them to crash.
* Fix swaybar teardown when workspace buttons hiddenLibravatar Brian Ashworth2018-07-06
|
* Implement mode --pango_markupLibravatar Brian Ashworth2018-07-05
|