Commit graph

1319 commits

Author SHA1 Message Date
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
Johan Malm
f37a3ffa86 view: survive setting fullscreen with no outputs
Fixes #608
2022-11-15 05:48:17 +01:00
bi4k8
92a98164c3 src/config/rcxml.c: distinguish no and unknown font places
Currently, the `rc.xml` parser applies font settings in a `<font>` tag with an
unknown value for its `place` attribute to all fonts. This means that whatever
the final unknown-`place` `<font>` tag is in a user's `rc.xml` applies to all
text drawn by labwc.

Instead, only treat `<font>` tags with an empty or missing `place` attribute as
applying globally, and warn when encountering unknown `place` attribute values
(which will help us find font places to support).
2022-11-11 22:45:47 +01:00
bi4k8
9ed800c5a1 keyboard: use 1000/rate msecs for keybind repeat event source delay 2022-11-11 22:19:34 +01:00
John Lindgren
e848bd2f6b xwayland: Better document/assert view/surface association
Each XWayland view is paired with a particular wlr_xwayland_surface and
its lifetime is tied to that surface.  This condition in handle_map():

    if (xsurface != view->xwayland_surface)

could never be true since the view is only registered to receive the
"map" signal from view->xwayland_surface, and no other.  So the code
updating view->xwayland_surface in handle_map() was dead.

So let's clean things up a little:

- Remove the dead code
- Add some comments, and slightly rearrange code to match
- Add/update assert()s in signal handlers for consistency
- Pass xsurface as <data> when calling handle_unmap() and
  handle_destroy() explicitly, to be consistent
2022-11-11 15:56:13 -05:00
bi4k8
00002d67ea fix typo 2022-11-10 20:32:50 +01:00
Arnaud Vallette d'Osia
97dc681c3b src/cursor.c: Use 'handled' for state of consumed cursor actions 2022-11-06 22:03:50 +01:00
Arnaud Vallette d'Osia
bd4a0f15b8 Scroll-Bindings: Add docs 2022-11-06 22:03:50 +01:00
Arnaud Vallette d'Osia
209e09a1f6 Scroll-Bindings: Add default config
By default we switch workspaces when scrolling
on the desktop to match the Openbox behavior.
2022-11-06 22:03:50 +01:00
Arnaudv6
063a26ae9d Scroll-Bindings: Add support for mouse wheel bindings 2022-11-06 22:03:50 +01:00
Johan Malm
e45e2c7e60 Fix coding style 2022-11-03 23:01:52 +01:00
Johan Malm
6a242d5739 checkpatch: ignore += UNNECESSARY_ELSE 2022-11-03 23:01:52 +01:00
Johan Malm
4305f54e37 checkpatch: add scripts/check for batch processing
Co-Authored-By: @Consolatis
2022-11-03 19:20:23 +00:00
Johan Malm
a361bae699 checkpatch: patch to suit labwc coding style
Coding style specific changes include:

- Accept pango, glib and libxml2 CamelCase variables
- Remove "need consistent spacing around '*'" warning
- Do not warn about "structs that should be const"
- Do not warn on braces {} around single statements
- Do not warn about braces {} for single statement blocks
- Do not warn about wanting { on previous line for functions
- Remove check for missing blank line after declaration
- Ignore SPLIT_STRING COMPLEX_MACRO PREFER_KERNEL_TYPES
  LOGICAL_CONTINUATIONS PARENTHESIS_ALIGNMENT OPEN_ENDED_LINE
  MACRO_ARG_REUSE PREFER_FALLTHROUGH ARRAY_SIZE INITIALISED_STATIC

Other changes include:

- Do not complain about missing spelling.txt
- Print filename for each file, but no summary line
2022-11-03 19:20:23 +00:00
Johan Malm
b4b3e1b28d checkpatch: import checkpatch.pl from Linux kernel
https://raw.githubusercontent.com/torvalds/linux/4ce9f970457899defdf68e26e0502c7245002eb3/scripts/checkpatch.pl
2022-11-03 19:20:23 +00:00
Consolatis
1aeae4b57e Chase wlroots: output test assert
This fixes an assert on output test when
running with the headless backend.

To update the wlroots subproject use
meson subprojects update wlroots

Chases wlroots 05454618cd2d49fb3a5f0c560b0d2c455cf32467
xwayland: split headers

Fixes #605
2022-11-03 18:02:07 +00:00
John Lindgren
3b55b31070 keyboard: Implement key repeat for keybindings
It seems that every Wayland client is expected to implement its own
key-repeat logic, rather than doing it server-side as in X11.  This
means that labwc also has to implement its own key-repeat logic for
compositor keybindings.

This is a very simplistic timer-based implementation.  It doesn't
attempt to synthesize accurate timestamps, and may lag depending
on system load, but it appears to get the job done.

v2: Use server->wl_event_loop
v3: Comments and formatting
2022-11-02 21:52:33 +00:00
John Lindgren
b163045fa9 key-state: Prevent array overflow
- Prevent adding the same keycode more than once
- Prevent adding more keycodes than MAX_PRESSED_KEYS
2022-11-02 21:52:33 +00:00
Consolatis
ec8bc6e2d6 src/menu/menu.c: Add comments 2022-11-01 17:54:02 +01:00