Commit graph

46 commits

Author SHA1 Message Date
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
Johan Malm
8c96c65018 ssd: refactor in preparation for making ssd_visible_box() private
Prepare to move code from output/render functions to ssd. We want
rendering functions to just render, not calculate decoration geometry
and such like.
2021-08-22 14:12:05 +01:00
Johan Malm
5f01c49b72 ssd: refactor and position title nearer left hand edge
Put title deco at the end of linked list to render it on top of corner
edges.
2021-08-22 14:06:11 +01:00
Johan Malm
f857aea8f4 ssd: add application title to title bar 2021-08-07 09:35:53 +01:00
Johan Malm
1dc3059707 ssd: add support for interacting with bottom corners 2021-07-26 20:37:36 +01:00
Johan Malm
399322052b ssd: add ssd_interactive_box()
...which is used by desktop_view_at() and ssd_at() to determine which
decoration part is under the cursor.

ssd_interactive_box() allows deocoration parts to extend outside the
visible regions, and therefore supports a wider 'resize-edges' area than
the border itself.
2021-07-26 20:06:52 +01:00
Johan Malm
e50bb45890 Move corner textures from ssd.c to theme.c
It makes more sense to just keep one set of corner textures for server
side view decorations, rather than storing a set for each view. This also
keeps the code simpler when when changing theme parameters.
2021-07-16 17:07:00 +01:00
Johan Malm
fdfb12b2ce Added support for rounded corners 2021-03-27 21:04:12 +00:00
Johan Malm
2a48f2801b Create a linked list of SSD for each view 2021-03-21 21:46:16 +00:00
Johan Malm
fc76100fd5 Add ssd.h 2021-03-21 20:54:55 +00:00