Commit graph

2775 commits

Author SHA1 Message Date
tokyo4j
1e0a7e2562 src/desktop.c: remove osd_review_restore() call in desktop_cycle_view()
It was a cruft from days when we used to walk scene-nodes to get the next
view to cycle.
2024-12-30 18:07:45 +09:00
Johan Malm
bb982dc0af keyboard: set numlock to off by default
...to avoid surprises on Acer Aspire One laptops where the numeric
keyboard does not physically exist but "overlaps" the qwerty keyboard.

Reported-by: staryvyr on IRC

Note: We do not like changing defaults, but feel that there is a good
reason for this one.
2024-12-29 21:34:41 +00:00
Consolatis
968dc89277 wlr-foreign-toplevel: send initial pre-map state
Fixes: #2460
2024-12-29 13:08:54 +00:00
Consolatis
c772224a54 project wide: adapt to new non-NULL value of view_get_string_prop() 2024-12-29 13:06:30 +00:00
Johan Malm
023427b4f4 view: fix NULL string_prop crash
...when app_id is NULL.

Make sure view_get_string_prop() never returns NULL because it is so easy
to misuse. Same for the respective xwayland/xdg impl methods in case
anyone decides to (incorrectly) call them directly in future.

Fixes: #2453
2024-12-29 13:06:30 +00:00
tokyo4j
bad788ccdd Clear keyboard/pointer focus on Move/Resize, window switcher and menu
The previous revert fixed the problem of stuck modifier keys with
keybinds in Blender, but made Firefox show its menu bar with Alt-*
keybinds. This is fundamentally inevitable due to the limitation of
wayland protocol, but at least for the default Alt-Tab keybind for
window switcher, we can mitigate this problem by clearing the keyboard
focus when the window switcher is activated. This is what KWin does, and
we decided to follow that.

So in this commit, keyboard and pointer focus are temporarily cleared
while Move/Resize, window switcher and menu interactions and restored
after them. We slightly deviate from KWin as KWin doesn't clear the
keyboard focus while Move/Resize, but it solves our existing problem
that Firefox shows its menu bar after dragging it with default Alt-Drag
mousebind, and this is what Mutter does.

We considered other solutions, but they don't work well:
1. Send wl_keyboard.{leave,enter} every time keybinds/mousebinds are
   triggered. This solves the Firefox's menu bar problem, but that
   sounds like a workaround and sending unnecessary events every time is
   not desirable.
2. Send release events for both modifiers and keys even when they are
   bound to keybinds. This is what Mutter is doing, but it looks like an
   implementation issue and violates wayland protocol.
2024-12-29 16:27:34 +09:00
tokyo4j
bd7a533dd6 Revert "keyboard: include pressed modifiers in bound set"
This reverts commit 98bf316ee6.
2024-12-29 16:27:34 +09:00
tokyo4j
5bcc03db05 Revert "keyboard: add window rule to send release-events (#2377)"
This reverts commit 2f8afb2376.
2024-12-29 16:27:34 +09:00
tokyo4j
adccc3ec84 img: fix scaling for rendering large image in non-square rectangle
16dbdc6 caused a regression that the vscode icon (1024x1024) in the
titlebar is cut off with following configuraion:

  window.button.width: 26
  window.button.height: 16
2024-12-28 23:06:38 +00:00
tokyo4j
028e24dc13 src/output.c: remove output_usable_area_scaled() 2024-12-28 23:03:34 +00:00
tokyo4j
66a3beb98b Don't open menu or start window switching while other server interaction
This should make the transition of the server state more predictable and
prevent potential bugs.
2024-12-28 21:28:22 +00:00
tokyo4j
5d3ce3e190 Check input_mode to see whether window switcher is active or not
...rather than "if (server->osd_state.cycle_view){..}".
2024-12-28 21:28:22 +00:00
tokyo4j
398b80b26f Add LAB_INPUT_STATE_WINDOW_SWITCHER 2024-12-28 21:28:22 +00:00
Orfeas
1550eb9c26 action: add WarpCursor action 2024-12-26 10:27:02 +00:00
Johan Malm
af978c7ad7 theme: demote padding.height warning
...from WLR_ERROR to WLR_INFO to avoid 'false' logging when Openbox themes
contain the padding.height settings. Whilst this option is not supported,
the visual appearance is very close to that of Openbox with common themes.

The background to this is that Labwc theme specification has diverged
slightly from that of Openbox with respect to titlebar padding to support
more contemporary looks whilst avoiding breaking changes. For full details
see commit: e16e78e7a4

Suggested-by: @Consolatis
2024-12-24 14:58:25 +09:00
tokyo4j
16dbdc64e5 ssd: rework titlebar button rendering
- fix that icons for normal/hovered/rounded buttons are not placed
  exactly the same position
- fix blurry window button icons in scaled outputs

This commit introduces lab_img and scaled_img_buffer and uses them for
rendering icons in the window titlebar. Now the process of rendering
button icons are split into 2 phases: loading with lab_img_load() and
creating scene-nodes for them with scaled_img_buffer_create(). This
might incur some additional overhead since we no longer preload icon
textures, but the rendering of icon only happens for the first window
as backing buffers are shared and the overhead won't be noticeable.
This commit also simplifies the process of centering icon buffer in the
button, by creating icon buffers in a fixed geometry via
lab_img_render().
2024-12-23 18:11:32 +09:00
tokyo4j
9a3412324d node: add node_scaled_scene_buffer_from_node 2024-12-23 18:11:32 +09:00
Consolatis
8156b91306 ext-workspace protocol integration 2024-12-23 04:14:53 +01:00
Consolatis
acde3b4a8b ext-workspace protocol implementation 2024-12-23 04:14:53 +01:00
tokyo4j
b2a45ac8af cursor: fix focus when menu is closed by clicking its border
Before this commit, the pointer focus is cleared when a menu is closed
by clicking its border. This is because get_cursor_context() returns
type=LAB_SSD_NONE when the cursor is on the menu border and
cursor_update_common() clears the pointer focus. This commit fixes this
by replacing cursor_update_common() with cursor_update_focus(), which
calls get_cursor_context() again after the menu scene-node is hidden.
2024-12-20 00:43:06 +09:00
tokyo4j
e707e16130 layer: update pointer focus on popup destruction
Same as previous commit
2024-12-20 00:43:06 +09:00
tokyo4j
49c23b8948 xdg-popup: update pointer focus on popup destruction
Before this commit, closing a popup didn't move the pointer focus to the
main toplevel until the cursor is moved.
2024-12-20 00:43:06 +09:00
Johan Malm
86c35976ba menu: put menu_tree above overlay layer 2024-12-19 16:01:31 +09:00
tokyo4j
ac7c94db12 menu: slightly slide menus opened with atCursor="no"
This is reland of 2ade6a1e which was reverted with 21bd5b00, but this
prevents the x-position of the menu from being negative and slides menus
opened with Alt-Space too.
2024-12-18 18:43:03 +00:00
Johan Malm
2446c46069 string-helpers.c: add str_starts_with() 2024-12-18 18:32:25 +00:00
tokyo4j
5db953aa89 scaled-scene-buffer: reduce unnecessary renderings
Prior to this commit, a backing buffer with scale 1 was always created for
a scaled_scene_buffer before showing it, and backing buffers for specific
scales were created on output_enter events.

This commit removes this redundant re-renderings by calling
wlr_scene_buffer_set_dest_size() upon scaled_scene_buffer creation just to
receive output_enter events and delaying the first rendering to the first
output_enter event.

I needed to add font_get_buffer_size() to obtain the size of a font buffer
without actually creating it.
2024-12-18 17:21:29 +09:00
Johan Malm
cc838e79ed s/xmlParseMemory/xmlReadMemory/
...as xmlParseMemory() is deprecated
2024-12-17 21:51:47 +00:00
tokyo4j
683f67b761 IME: don't forward key-release without correspinding key-press
After commit e2189903 in wlroots, when ctrl-f is pressed in firefox with
a IME client running, the following key-release event for "f" is not
sent, thus "f" is repeated like "ffffffffff..." in the input box of
firefox. This is because the key-release event for "f" is firstly
forwarded to the IME client and then sent via the virtual keyboard created
by the IME client while the key-press event is sent via physical
keyboard, and with e2189903, key-release events without a corresponding
key-press event on the same keyboard is not emitted to the compositor.

So this commit fixes this problem by not forwarding the key-release event
to the IME client unless the corresponding key-press event was also
forwarded.
2024-12-17 16:38:09 +09:00
Consolatis
5766bec70a cosmic-workspaces: remove workspace_set_hidden() calls
It is a concept that labwc does not support.
2024-12-16 21:28:13 +00:00
Consolatis
b63c8fe411 cosmic-workspaces: add cosmic_ prefix
In preperation for a future ext-workspace integration.
2024-12-16 21:28:13 +00:00
Johan Malm
8863672b1f labwc-config(5): describe how keys are processed
...when matching against keybinds.

Copied from:

63dc609085/src/input/keyboard.c (L215-L238)
2024-12-16 20:56:45 +00:00
Consolatis
63dc609085 cosmic-workspaces: abstract transaction-addon
This allows to use it for a future ext-workspace implementation.
It is also more generalized so can be used for other protocol
implementation in the future in case the protocols require some
kind of transaction management.
2024-12-15 21:06:39 +00:00
Weblate
afe416f04e Translation updates from weblate
Co-authored-by: vTT <vttfreebsd@gmail.com>
Translate-URL: https://translate.lxqt-project.org/projects/labwc/labwc/fr/
Translation: Labwc/labwc
2024-12-15 21:04:19 +00:00
Johan Malm
85118e0af0 README.md: add "lightweight and box-inspired" 2024-12-15 20:56:43 +00:00
tokyo4j
40c7350064 menu: improve algorithm for menu placement with xdg-positioner
This commit delegates the calculation for menu position into wlroots
utilities for xdg_positioner.

Notable functional changes are:
- Slide the menu to fit in the output when it's opened out of the output
  (e.g. top-left window menu is opened when the window is overflowing to
  the left), rather than not updating the menu at all.
- The horizontal alignment of menus is now determined based on the size of
  each (sub)menu alone rather than the total width of entire menu tree.
  This means submenus can now overlap with is parents, but this is no
  longer a problem since we recently added support for menu borders.
- Fixed that pipemenus always follow the alignment of its parent even when
  it overflows from the output.
2024-12-15 11:43:23 +09:00
Johan Malm
08de4f3d6b labwc-actions(5): add missing position option to ShowMenu 2024-12-15 01:07:24 +01:00
Johan Malm
71bf564a66 README.md: add gammastep 2024-12-15 01:02:25 +01:00
Orfeas
f4c270c92f query: extend "monitor" query & add missing docs 2024-12-14 20:28:16 +00:00
tokyo4j
01032ef3bd font: remove arrow character from font buffer
Arrow signs are specific to submenu items, so they would be more natural
to be handled in menu.c rather than accepting "arrow" in
font_buffer_create().

Also I allowed non-positive numbers for max_width in font_buffer_create(),
in which case the natural font width is used as the buffer width.
2024-12-14 20:09:53 +00:00
tokyo4j
10fc656c23 menu: some refactor
- Don't store font/background buffers in menuitem struct since we no
  longer dynamically update buffers of existing menuitems.
- Factor out the duplicated codes for creating menu item scenes for each
  unselected/selected states.
2024-12-14 20:09:53 +00:00
Consolatis
f5d706bae3 CONTRIBUTING.md: update package maintainer list 2024-12-14 07:18:21 +00:00
tokyo4j
daae379433 view: s/scene_node/content_node/ 2024-12-14 12:03:58 +09:00
Johan Malm
c3a1a59a58 build: bump version to 0.8.2 2024-12-13 19:14:37 +00:00
Johan Malm
72fe7a9742 NEWS.md: update for 0.8.2 2024-12-13 19:10:34 +00:00
Johan Malm
2dd31b0a3a docs/environment: remove example MOZ_ENABLE_WAYLAND=1
...because it has not been relevant since before firefox v121 and even
firefox-esr on Debian bullseye is now at v128.

Suggested-by: cry0xen
2024-12-12 20:13:10 +00:00
Andrew J. Hesford
df6081b52c config: only default to xwayland persistence on old wlroots versions
This is a compile-time check, so it will be too conservative if somebody
updates wlroots after building labwc, but that is still better than the
alternatives.
2024-12-12 02:20:33 +01:00
Consolatis
ea58ab0259 scripts: add wl_compcheck.py
Simple utility to allow protocol and version comparison between different
running compositors. This can be used to detect missing protocols or
versions in labwc. See for example this result when running against the
current labwc master and sway 1.10 (nested, results on DRM may differ):

  Protocols missing from labwc @ wayland-0
  ext_transient_seat_manager_v1                   1
  wl_compositor                                   6  (has version 5)
  wp_alpha_modifier_v1                            1
  wp_content_type_manager_v1                      1
  xdg_wm_base                                     5  (has version 3)
  zwp_keyboard_shortcuts_inhibit_manager_v1       1

  Protocols missing from sway @ wayland-1
  wl_drm                                          2
  zcosmic_workspace_manager_v1                    1
2024-12-10 21:05:31 +00:00
Weblate
72b4be45c9 Translation updates from weblate
Co-authored-by: 이정희 <daemul72@gmail.com>
Translate-URL: https://translate.lxqt-project.org/projects/labwc/labwc/ko/
Translation: Labwc/labwc
2024-12-10 21:04:06 +00:00
Johan Malm
2d312cd28b config: temporarily set xwaylandPersistence to 'yes' by default (#2414)
...to avoid a bug that is present in wlroots <0.18.2 and which has the
potential to crash the compositor when performing a drag-and-drop action
at the same time as the XWayland server is shutting down.

This will be reverted when wlroots-0.18.2 can be linked with.

Related-to: #2371
2024-12-08 21:18:38 +00:00
Johan Malm
2348a5a87b labwc-config(5): add <xwaylandPersistence> to "core" section example 2024-12-08 21:18:38 +00:00