Commit graph

59 commits

Author SHA1 Message Date
tokyo4j
a745f91169 ssd: support window icons
The default `titleLayout` is updated to `icon:iconify,max,close` which
replaces the window menu button with the window icon.

When the icon file is not found or could not be loaded, the window menu
icon as before is shown.

The icon theme can be selected with `<theme><icon>`.

This commit adds libsfdo as an optional dependency. `-Dicon=disabled` can
be passsed to `meson setup` command in order to disable window icon, in
which case the window icon is always replaced with a window menu button.
2024-09-25 18:04:09 +09:00
tokyo4j
25f5cdd3a6 Refactor the logic of placing client-menu with ShowMenu action
Before this commit, we assumed `ShowMenu` action is not bound to any
buttons other than window menu button and always place the client-menu
under the window-menu button when atCursor="no". Also, it was going to be
difficult to distinguish whether the action is executed from the window
menu button or the window icon, which will be added soon.

This commit fixes it to open the menu under the actually-clicked button by
passing `cursor_context` to `actions_run()`, with some refactoring:
- `seat->pressed.resize_edges` is removed and it's calculated from the
  cursor position and `seat->pressed.type` just before running Resize
  action. This slightly changes the existing logic to determine the
  resizing edges with Alt-Right + Drag mousebinding, but
  `seat->pressed.type` is still stored on button press so it doesn't bring
  back the issue #543.
- `seat->pressed.toplevel` is removed and `get_toplevel()` in
  `update_pressed_surface()` may be called more often, but its overhead
  will be negligible.
2024-09-21 18:07:34 +01:00
Jens Peters
824b0fa4e3 theme: add button padding and spacing (#2127)
While at it, separate corner width from button
width. Both are independed and having them
separately improves readability.
2024-09-10 22:14:30 +01:00
Andrew J. Hesford
b7bccc8026 ssd: add optional omnipresent button 2024-08-24 05:42:38 +02:00
Andrew J. Hesford
186a07be9b ssd: add optional shade button 2024-08-24 05:42:38 +02:00
tokyo4j
9f2eae672c ssd: fix incorrect cursor shape on titlebar corner without buttons
Before this commit, the backgrounds of titlebar corners were tagged as
LAB_SSD_PART_CORNER_TOP_{LEFT,RIGHT}, so the cursor shape on titlebar
corners without buttons were north-west or north-east.

This commit fixes it by tagging those backgrounds as
LAB_SSD_TITLEBAR_CORNER_{LEFT,RIGHT}.
2024-08-23 20:34:03 +02:00
Tobias Bengfort
39ff873d5b ssd: apply title layout 2024-08-20 23:04:10 +02:00
Consus
e4afa10fe4
theme: allow to set window button size (#1965)
This commit introduces new option "window.button.width". Despite the name
it currently affects both width and height.
2024-07-20 09:33:57 +01:00
Simon Long
ed1b631492 Add All context for mouse events 2024-05-19 22:17:04 +01:00
Tobias Bengfort
41a3b68846 decorations: add SetDecorations action 2024-05-19 19:03:42 +01:00
Tobias Bengfort
a0debda142 decorations: refactor view_set_decorations 2024-05-19 19:03:42 +01:00
David Turner
ce0d2c2966
ssd: add window drop-shadows (#1648)
Add optional drop-shadows to windows using server-side decoration.
Shadows can be enabled/disabled rc.xml and their appearance configured
in themerc.  The default is no shadows to preserve current behaviour.

The shadows are drawn in fixed corner and edge buffers shared between
all windows, the edges are scaled to size depending on the size of each
window.  Two sets of buffers are used to give the different appearances
for active and inactive windows.  I use separate corner/edge buffers for
a few reasons:

- It avoids needing to store a separate large shadow buffer per window
- It avoids needing to redraw the shadows when the window is being
  resized
- Compositing the shadows onto the desktop should be faster as there are
  overall fewer pixels to blend, and scaling up the edge buffers only
  requires reading a tiny buffer which is then replicated.
2024-04-22 19:27:53 +01:00
Consolatis
e05bedb140 feat: add Shade/Unshade/ToggleShade actions
This builds on the work of @Consolatis in #1018.

Co-authored-by: Consolatis <35009135+Consolatis@users.noreply.github.com>
Co-authored-by: Andrew J. Hesford <ajh@sideband.org>
2024-01-15 21:37:36 +00:00
Consolatis
e8ec8ea7ff src/ssd: use view->ssd_titlebar_hidden for ssd_thickness calculations
Before this patch we were using the internal .enabled flag of the titlebar
tree node. This failed due to ssd_thickness() not having view->ssd assigned
when initially called. Instead of assigning view->ssd within ssd_create()
we just always use the view boolean flag directly. This fixes an issue
where a border-only view that has been snapped to an edge or region would
have a gap in the size of the titlebar on top after a Reconfigure.

Fixes #1083
2023-09-21 22:21:19 +01:00
Consolatis
72936ccb3e src/ssd: fix tiling via keybind when maximized
The previous PR introduced an issue with tiling based actions
like SnapToEdge and SnapToRegion using outdated SSD margin
values when called via keybind while maximized. That resulted
in wrong offsets for the tiled windows.

This commit restores the functionality by forcing a re-calculation
of the SSD margin when changing the maximized state.

Thanks to @Flrian for reporting the issue via IRC.
2023-08-25 15:54:22 +02:00
Johan Malm
a89bcc3c60 cursor: prevent press on layer-subsurface from cancelling popup grab
Fixes: #1030
2023-08-15 20:25:58 +01:00
Consolatis
e39744f1d3 Add keepBorder <theme> option and enable it by default
With the new keepBorder option enabled, the
ToggleDecorations action now has 3 states:

- the first time only disables the titlebar
- the second time disables the whole SSD
- the third time enables the whole SSD again

When the keepBorder action is disabled, the old 2-state
behavior is restored, e.g. the ToggleDecorations action
only toggles between on and off.

Fixes #813
2023-08-10 16:09:20 +02:00
Consolatis
235a8ad9bc ToggleKeybinds per window 2023-07-06 06:02:28 +01:00
Johan Malm
3a9dcd54a7 Move border-struct to common/border.h for sharing 2023-06-26 06:04:07 +01:00
Tomi Ollila
7ad5200f2e includes: identifier consistency in include guards
Made all header files to have LABWC_ prefix in include guard identifers.

Converted from __LABWC_ in 35 include/ files.
Converted from __LAB_ in 5 include/ files.
Added LABWC prefix to 3 include/ files.
Added include guards to 3 include/ files.

The double underscores were removed since according to C standard
those "are always reserved for any use".
2023-05-13 22:29:21 +01:00
Consolatis
9d7386effd include/ssd.h: prefix defines with SSD_ 2023-01-06 18:32:36 +01:00
John Lindgren
b67eccc99a ssd: Move implementation details from ssd.h to ssd-internal.h
- Move private structs and functions to `ssd-internal.h`
- Add `ssd_button_get_type()` and `ssd_button_get_view()`
2022-11-27 15:09:45 +00:00
John Lindgren
1e8b0414fe ssd: Allocate struct ssd and struct ssd_hover_state separately
- Store a pointer to the `struct view` in `struct ssd`
- Pass `struct ssd *` instead of `struct view *` to ssd functions
- Add `ssd_get_margin()` convenience function
2022-11-27 06:48:41 +00:00
John Lindgren
74fb769758 ssd: Add debug helpers 2022-11-26 21:24:46 +00:00
John Lindgren
957d9e5926 ssd: Cosmetic cleanups
- Minimize includes in `ssd.h`
- Avoid repetitive `view->ssd.margin` pattern
- Use `struct ssd *` or `const struct ssd *` rather than `struct view *`
  where convenient

Part of the motivation is to make it easier to separate `struct ssd`
from `struct view` in a future commit.
2022-11-26 21:24:46 +00:00
John Lindgren
4e7891eb8d ssd: Simplify ssd_create()
- Add `active` argument for consistency with `ssd_set_active()`
- `assert()` that `ssd_create()` is not called twice without an
  `ssd_destroy()` in between
2022-11-26 18:02:24 +00:00
John Lindgren
ac9228e7f8 view: Add view_reload_ssd()
Gather related logic from `reload_config_and_theme()` in `server.c` and
`ssd_reload()` in `ssd.c` into a new function, `view_reload_ssd()`.

Also drop the `view->mapped` check since we want to update any view that
has SSD nodes created, mapped or not.
2022-11-26 18:02:24 +00:00
John Lindgren
56f8837ca6 view/ssd: Move ssd->enabled to view->ssd_enabled 2022-11-22 09:17:33 +01:00
John Lindgren
c536ee9d96 view/ssd: Move view->margin to view->ssd.margin 2022-11-22 09:17:33 +01:00
John Lindgren
f08e931a29 include: Break out view.h from labwc.h
IMHO it encourages better design (by making dependencies more obvious)
to have source file/header file pairs like view.c/view.h, rather than a
monolithic header like labwc.h with everything in it.

I don't think we need to break up all of labwc.h at once, but maybe we
can start pulling it apart bit by bit as it's convenient.

Also:

- Move "struct border" to ssd.h so that view.h can use it without pulling
  in all of labwc.h.
- Add a missing required #include within scaled_font_buffer.h (forward
  declaration of "struct font" is not enough).
2022-11-21 21:42:37 +00:00
John Lindgren
b7c4ba825a view/ssd: Refactor and fix visual indication for active windows
Partially fixes #494.

Co-Authored-by: Consolatis
2022-08-27 06:58:20 +01:00
Consolatis
09915b8f43 src/ssd/ssd.c: Keep view->margin in sync when toggling decorations
Fixes #409
2022-06-30 06:45:18 +01:00
Consolatis
05ae654547 Convert SSD title to scaled font buffer 2022-06-14 22:03:08 +01:00
Consolatis
ca9226a7a6 src/ssd: Convert button node descriptors to struct ssd_button
This allows for way easier button hover detection and future
features like toggling rounded corner buttons on maximize.
2022-06-09 22:04:35 +01:00
Consolatis
f1ada7e407 src/ssd: Use LAB_SSD_PART_CORNER_x for rounded corner backgrounds
This matches the behavior of the surrounding borders and will usually
cause resizing instead of triggering the button itself. This effect
is only really visible when using a border width settings of > 1.

Fixes #379
2022-06-09 22:04:35 +01:00
Consolatis
2ed7a10779 Chase wlroots: every scene_node parent is now a tree
Chases wlroots ccd0f85c2a36308e35b153c7f9653abac7659af3
wlr_scene: Only allow parenting on a wlr_scene_tree
2022-06-07 07:13:37 +01:00
Consolatis
3171aba0e2 ssd: dynamically adjust resize extents based on usable_area
Fixes #265
2022-03-12 15:32:44 +00:00
Consolatis
e4f1f9a975 ssd: use dynamic titlebar height based on font size and padding 2022-03-12 15:32:44 +00:00
Johan Malm
6b8c10dcd4 view: show fullscreen views above top-layer
See https://github.com/LBCrion/sfwbar/issues/24
2022-03-07 21:20:44 +00:00
Consolatis
4c981b845f include/ssd.h remove unnecessary struct definition
Instead, just tag the struct so we can reference it.
2022-02-25 21:52:10 +00:00
Consolatis
a2523081e2 Handle 'lost' unmanaged xsurfaces + improve cursor handling 2022-02-23 21:47:01 +00:00
Consolatis
5862b65f89 Convert SSD to scene nodes 2022-02-23 21:47:01 +00:00
Consolatis
7ea733761b Use view->scene_tree as toplevel for view + some legwork:
desktop.c move_to_front() calls wlr_scene_node_raise_to_top
desktop.c, ssd/include.h add LAB_SSD_{OSD, MENU, LAYER_SURFACE} enums
desktop.c desktop_surface_and_view_at() -> desktop_node_and_view_at()
cursor.c reenable cursor_rebase()
cursor.c reenable button click on layer surface
2022-02-23 21:47:01 +00:00
Consolatis
413811f3a2 Use proper enum argument type for desktop_surface_and_view_at 2022-01-30 21:23:15 +00:00
Consolatis
7ecae4afce Move is_button() into src/ssd.c and make it public 2022-01-30 21:23:15 +00:00
Consolatis
b7b1e8064f Add WindowMenu button 2022-01-26 06:17:41 +00:00
bi4k8
d84103d669 define ssd_part_contains to define the mouse context subset relation 2021-12-02 17:58:31 +00:00
bi4k8
b008917895 implement handling for Client, Frame, and Root/Desktop (conflated for now) mouse contexts 2021-12-02 17:58:31 +00:00
Johan Malm
e227de1346 Add SPDX identifiers 2021-11-13 21:56:53 +00:00
alex
92891b4dfa change mousebind code to use already existing enums
Also added an #include statement to ssd.h so it would compile without
depending on other headers to be #included before it
2021-09-01 07:05:37 +01:00