Commit graph

1337 commits

Author SHA1 Message Date
Consolatis
f0666ba5c9 menu: Convert hardcoded item padding to theme vars
Adds two new theme vars:
- menu.items.padding.x
- menu.items.padding.y
2022-12-06 21:08:43 +00:00
Consolatis
3da7cfd8c6 theme: Rename separator_width to separator_line_thickness 2022-12-06 21:08:43 +00:00
Consolatis
ccf68c5950 menu: Add generic menu_init() entry point 2022-12-06 21:08:43 +00:00
Johan Malm
aa4ef94af0 README: restructure and amend project description
- Describe why the projects exists and state some core-dev values
- Merge the two scope sections
- Put video links before screenshot
2022-12-01 19:10:39 +00:00
Johan Malm
05484820e6 CONTRIBUTING.md: describe how to upversion
...and also split 'Debugging' into sub-sections
2022-11-29 19:46:37 +00:00
Johan Malm
2afab5c694 labwc-menu(5): document separator 2022-11-29 19:45:57 +01:00
Consolatis
d616d719eb CI: check codestyle only once 2022-11-28 16:50:50 +01:00
Consolatis
e95779540c docs: add basic README 2022-11-28 12:09:24 +01:00
Consolatis
b839bbe0a9 docs: install example configs 2022-11-28 12:09:24 +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
cfa51ab628 view: Fix SSD margin computation
If `view->ssd_enabled` is false when calling `ssd_create()` then
`ssd_thickness()` returns zeroes which are stored in `ssd->margins`.

The quick fix is just to ensure we set `view->ssd_enabled` before
calling `ssd_create()`. At some point, it might be nice to refactor
so that `ssd_create()` does not reference `view->ssd_enabled`.
2022-11-27 06:47:56 +00:00
Johan Malm
b203758ce1 Fix minor coding style breaches 2022-11-27 04:03:21 +01:00
Johan Malm
dca21fd087 ci: run checkpatch.pl on all .c and .h files 2022-11-27 04:03:21 +01: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
9dd55f0490 view: Hide decorations for fullscreen views
Otherwise the decorations are visible on adjacent outputs.
2022-11-26 18:02:24 +00:00
John Lindgren
d6aea3e58f ssd: Add missing state updates
- Update `ssd.state` in `ssd_create()` to avoid doing unnecessary work in
  the next call to `ssd_update_geometry()`
- Reset `ssd.margin` in `ssd_destroy()` to avoid accidentally using stale
  values
2022-11-26 18:02:24 +00:00
John Lindgren
cb16da5a78 ssd: Eliminate unnecessary temporary variables 2022-11-26 18:02:24 +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
b150e11cd3 view: Enable/disable decorations explicitly
`view_set_decorations()` now calls `ssd_create()` and `ssd_destroy()`
explicitly to enable/disable decorations. As a result, the implicit
enable/disable logic in `ssd_update_geometry()` is no longer needed.
2022-11-26 18:02:24 +00:00
John Lindgren
4906d1833a action: Inline private/action.h into action.c
There is no need for a header since the types defined in it are
used only in action.c.
2022-11-25 22:32:22 +00:00
John Lindgren
4da37c6532 view: Move xdg_surface + xwayland_surface to derived structs
Add xdg_surface_from_view() + xwayland_surface_from_view() accessors
that assert() the view is of the expected type before returning.

Fix a real bug in xdg.c parent_of() that dereferenced
`view->xdg_surface->toplevel` without first checking `view->type`.

The goal of the new accessors is to catch similar bugs in future.
2022-11-25 22:21:17 +00:00
Johan Malm
df7276345f view: create derived structs
...for XDG toplevels and XWayland views to only include applicable
wl_listeners for each type of view.
2022-11-25 14:47:53 +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
e79c95489a view: Add view_set_untiled() 2022-11-22 09:17:33 +01:00
John Lindgren
c67c6691ac view: Rename/move workspaces_send_to() to view_move_to_workspace()
This function semantically belongs in view.c since it
modifies `struct view`.

Also a minor formatting fix in view_toggle_always_on_top().
2022-11-22 09:17:33 +01:00
John Lindgren
0e6d99e0ca action/view: Ensure view arguments are never NULL 2022-11-22 09:17:33 +01:00
Scarcely There
004b817647 ssd: Inactive window button icons now follow theme color
I was making a theme and discovered only the active window button icon
color was taking effect. The pixmaps were being created in both the
active and inactive cases, but inactive pixmaps were never added to
the SSD scene graph.
2022-11-22 02:22:26 +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
9021020f6e interactive: Refactor natural_geometry/tiled state handling
Currently, snapping to a screen edge and then snapping to maximize
results in both the natural_geometry and tiled state of the view
getting messed up. After unmaximize, the view ends up in a weird
state (tiled location but natural/untiled size).

There are also a couple of sketchy things going on in the code:

- interactive_begin() pokes its own values into view->natural_geometry
  to force view_maximize() to set a particular geometry.

- interactive_end() "fixes" view->natural_geometry after calling
  view_maximize() to save the original geometry from the start of the
  interactive move/resize.

To fix all this:

- Adjust/expand the API of view.c so that the interactive.c can
  avoid this "back door" of overwriting view->natural_geometry
  directly.

- Save the natural geometry and the tiled state of the view in
  interactive_begin() when starting to move the view.  When done,
  interactive_end() will update the tiled state if appropriate but
  *not* overwrite the natural geometry.
2022-11-20 20:45:50 +00:00
John Lindgren
636b38561b view: Reuse view_set_decorations() in view_toggle_decorations()
This simply deduplicates some near-identical code.
2022-11-20 19:10:05 +00:00
John Lindgren
2995d0e8e0 view: Fix positioning of initially-maximized XWayland views
map() in xwayland.c called ssd_create() but did not call
view_apply_maximized_geometry() afterward, resulting in the
decorations being displayed off-screen.

Rather than calling view_apply_maximized_geometry() in more places,
let's reuse the existing call in view_set_decorations(), and extend
ssd_update_geometry() to call ssd_create() when needed.
2022-11-20 19:10:05 +00:00
Oğuz Ersen
0b6eca097d nls: add turkish translation 2022-11-20 16:52:42 +00:00
Johan Malm
c1178e0396
Merge pull request #618 from jlindgren90/xwayland-surface
xwayland: Better document/assert view/surface association
2022-11-20 16:50:28 +00:00
Arnaud Vallette d'Osia
8fe2f2a2a8 Update labwc-config.5.scd
Supported mouse actions correction.
2022-11-19 10:42:59 +01:00
Consolatis
5aac35a27a src/config/rcxml.c: Check for modifiers when merging mousebinds
Previously mosuebinds for the same context using the same button
but different modifiers would be merged, e.g. only the last one
would survive the merge. This commit adds the missing check for
keyboard modifiers.

Fixes #630

Reported-by: @lidgnulinux
2022-11-18 12:44:49 +01:00
Jan Beich
1e66ba8fd7 build: drop pixman dependency after 532656ad5b 2022-11-18 10:37:51 +01:00
Johan Malm
029700f0bf build: bump version to 0.6.0 2022-11-17 22:13:55 +00:00
Johan Malm
d98814db88 NEWS.md: update notes on 0.6.0 2022-11-17 22:13:55 +00:00
Johan Malm
52488e1cb8 ci: add hwdata 2022-11-17 22:13:55 +00:00
Johan Malm
3705fa702c wlroots.wrap: use 0.16.0 2022-11-17 22:13:55 +00:00
Johan Malm
573a521cf1 Refuse to start when SUID is detected
This ensures that those surprised by the deprecation of SUID operation
receive an error rather than accidentally having run as root.

swaywm/sway@e572805
2022-11-16 10:40:59 -05:00
bi4k8
1c80dbd6ef update repeat rate of all keyboard input devices, not keyboard group's keyboard
without this patch, reconfiguring keyboard repeat rate/delay at runtime does not work
2022-11-16 06:16:52 +00:00
Johan Malm
11cfc49b12 cursor: combine two variables relating to frame-context
Mouse bindings, unlike key bindings, are made within contexts which
represent what was clicked/dragged.  The context 'Frame' refers to the
entire window frame including both the window decorations (if any) and the
client window itself. It is typically used for alti + left/right click to
move/resize the window.

'Frame' is a special case in that when a button is bound in this
context, the action will not be forwarded to the client, which is what
we describe with the 'consumed_by_frame_context' variable.
2022-11-15 22:23:14 +00:00
Johan Malm
2a9a378176 output: test adaptive sync
Required by https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3637
See also swaywm/sway@07bfeb2

Fixes #516
2022-11-15 21:58:18 +00:00
bi4k8
2b753a98b8 Support smooth scroll and horizontal scroll
note that this changes Scroll mousebinds from taking a "button"
attribute to taking a "direction" attribute
2022-11-15 21:57:36 +00:00
John Lindgren
6164ba73ff cursor: Make update_pressed_surface() no-op except during grabs
This matches Weston behavior more closely and fixes Firefox context
menus.
2022-11-15 21:56:48 +01:00