aboutsummaryrefslogtreecommitdiff
path: root/common
AgeCommit message (Collapse)Author
2018-10-17Fix stringop-overflow warningsNiccolò Scatena
2018-10-16Truncate message, append buffer overflow message if too long.Connor E
Increase buffer size, remove macros. Make variables lowercase. Some more feedback.
2018-10-15common/loop.c: add _POSIX_C_SOURCE for clock_gettime and CLOCK_MONOTONICCole Mickens
2018-10-15Event loop: Fix memmove and remove extraneous declarationRyan Dwyer
2018-10-15Event loop: Free fds and fix race conditionRyan Dwyer
2018-10-15Remove timerfd from loop implementationRyan Dwyer
timerfd doesn't work on the BSDs, so this replaces it with a timespec for the expiry and uses a poll timeout to check the timers when needed.
2018-10-15swaylock: Remove indicator after 3 secondsRyan Dwyer
2018-10-15Move swaybar's event loop to common directory and refactorRyan Dwyer
* The loop functions are now prefixed with `loop_`. * It is now easy to add timers to the loop. * Timers are implemented using pollfd and timerfd, rather than manually checking them when any other event happens to arrive.
2018-09-23swaybg: fix increasingly smaller bg on hotplugBrian Ashworth
render_background_image alters the scale that cairo uses. Depending on the image mode, resolution, and image size, this may cause the surface to be rendered increasingly smaller. By calling cairo_save and cairo_restore, any changes to the cairo settings by the function are not kept as a side effect. The surface that swaybg uses is also now cleared before rendering a frame. This is needed to avoid artifacts on resolution or scale changes with certain combinations of image modes, resolutions, and image sizes. This was also part of the increasingly smaller background visual since it made it so it was not obvious the region being rendered to was smaller and caused an increasing number of smaller images to be appear for each hotplug.
2018-09-22Call pango_cairo_context_set_font_options().Geoff Greer
Call pango_cairo_context_set_font_options() before pango_cairo_update_layout() and pango_cairo_show_layout(). By default, Pango "merges" the Cario font options with its own, which doesn't enable full hinting.
2018-09-22swaybar, swaylock, & tree/container: Set cairo font options to render text ↵Geoff Greer
and lines with subpixel hinting (if available).
2018-09-22Use pango_layout_set_text instead of pango_layout_set_markupRyan Dwyer
2018-09-22Fix pango escaping and refactor escape_markup_textRyan Dwyer
Fixes #2674. The cause of the issue was in get_pango_layout. When we call pango_parse_markup, `text` is the escaped string, and the unescaped string is then computed and written to `buf`. We were then passing the unescaped string to pango_layout_set_markup, but this function needs the escaped string. `buf` is not needed and has been removed. The other part of this PR refactors escape_markup_text to remove the dest_length argument and removes the -1 return value on error. It now assumes that you've allocated dest to the correct length.
2018-09-18swaybar: rewrite protocol determinationIan Fan
This now uses the getline function to receive the header, replacing read_line_buffer, which has been deleted since it is otherwise unused. Furthermore, once the protocol has been determined, the current status is handled immediately to be shown (though this has not been added for the i3bar protocol since it has not yet been rewritten to handle this).
2018-09-08Align titles to baselineRyan Dwyer
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.
2018-09-02prevent ub caused by misaligned stores/loadstaiyu
2018-09-01Allow reload command to exist anywhere in the command stringRyan Dwyer
This fixes a crash if you have commands where reload appears in the middle or at the end, such as `bindsym r mode default, reload`.
2018-08-26Remove layout.cRyan Dwyer
When we have type safety we'll need to have functions for workspace_add_tiling and so on. This means the existing container functions will be just for containers, so they are being moved to container.c. At this point layout.c doesn't contain much else, so I've relocated everything and removed the file. * container_swap and its static functions have been moved to the swap command and made static. * container_recursive_resize has been moved to the resize command and made static. * The following have been moved to container.c: * container_handle_fullscreen_reparent * container_insert_child * container_add_sibling * container_add_child * container_remove_child * container_replace_child * container_split * enum movement_direction and sway_dir_to_wlr have been moved to util.c. Side note: Several commands included layout.h which then included root.h. With layout.h gone, root.h has to be included by those commands.
2018-08-15Use list_find in more places and refactor/fix workspace prev_next functionsRyan Dwyer
The original purpose of this commit is to replace some for loops with list_find. But while doing this I found the workspace_prev_next_impl functions to be difficult to read and also contained a bug, so I refactored them and fixed the bug. To reproduce the bug: * Have two outputs, where the left output has workspaces 1, 2, 3 and the right output has workspaces 4, 5, 6. Make workspace 2 focused_inactive and workspace 4 focused. * Run `workspace prev`. * Previously it would visit the left output, then apply `workspace prev` to workspace 2, which focuses workspace 1. * Now it will focus the rightmost workspace on the left output (workspace 3). The refactoring I made to the workspace functions are: * Added the static keyword. * They now accept an int dir rather than bool, to avoid an unnecessary conversion. * Rather than preparing start and end variables for the purpose of iterating, just iterate everything. * Replace for loops with list_find. * Don't call workspace_output_prev_next_impl (this fixes the bug).
2018-08-12Implement resizing tiled containers via cursorRyan Dwyer
* The OP_RESIZE seat operation has been renamed to OP_RESIZE_FLOATING, and OP_RESIZE_TILING has been introduced. * Similar to the above, seat_begin_resize and handle_resize_motion have been renamed and tiling variants introduced. * resize.c's resize_tiled has to be used, so container_resize_tiled has been introduced in resize.c to allow external code to call it.
2018-08-06ipc-client: fix memory leaks in get_socketpathIan Fan
2018-07-23Address review comments on parse_booleanBrian Ashworth
2018-07-23Remove unneeded constBrian Ashworth
2018-07-23Switch to using a function to parse booleansBrian Ashworth
2018-07-11Move floating windows to front when focusedRyan Dwyer
2018-07-09Update for swaywm/wlroots#1126emersion
2018-07-02utf8_size: fix loop boundaryDominique Martinet
Found through static analysis
2018-07-02get_parent_pid: fix memory leakDominique Martinet
Found through static analysis.
2018-06-02Fix infinite loop in peek_line for EOF blanksBrian Ashworth
2018-06-02Address emersion's feedback on peek_lineBrian Ashworth
2018-06-02Fix condition in peek_lineBrian Ashworth
2018-06-02Address first round of review for generic blocksBrian Ashworth
2018-06-02Support braces on next line for config blocksBrian Ashworth
2018-05-25Clean up container title functionsRyan Dwyer
* Add and use lenient_strcat and lenient_strncat functions * Rename `concatenate_child_titles` function as that's no longer what it does * Rename `container_notify_child_title_changed` because we only need to notify that the tree structure has changed, not titles * Don't notify parents when a child changes its title * Update ancestor titles when changing a container's layout * Eg. create nested tabs and change the inner container to stacking * No need to store tree presentation in both container->name and formatted_title
2018-05-16Change scale from int32_t to double for pangoBrian Ashworth
2018-05-13Fix pango markupemersion
The condition checking if the markup is valid was inverted. This commit also adds better error handling: if the markup cannot be parsed, it fallbacks to plain text.
2018-05-13Fix crash when using pango markup fontHeghedus Razvan
The characters & < > ' " needs to be escaped when using pango markup Signed-off-by: Heghedus Razvan <heghedus.razvan@gmail.com>
2018-04-13Fix gcc string truncation warningsDominique Martinet
2018-04-04R E N D E R I N GDrew DeVault
2018-04-04Add password buffer, refactor rendering/surfacesDrew DeVault
2018-04-04Initial swaylock portDrew DeVault
2018-04-04Move swaybg background rendering into common/Drew DeVault
swaylock will use it too
2018-04-02Fix use-after-free with block hotspotsDrew DeVault
2018-03-29Use statically allocated text bufferDrew DeVault
2018-03-29Start port of swaybar to layer shellDrew DeVault
This starts up the event loop and wayland display and shims out the basic top level rendering concepts. Also includes some changes to incorporate pango into the 1.x codebase properly.
2018-03-29Allow sway IPC clients to fall back to i3 socketDrew DeVault
2018-03-28Address review commentsDrew DeVault
2018-03-28Add solid-color rendering to swaybgDrew DeVault
2018-01-05common/log: finish removing most log functionsDominique Martinet
Keep sway_abort and sway_assert and convert them to use wlr_log functions
2018-01-05sway: change all sway_log to wlr_logDominique Martinet