Commit graph

2237 commits

Author SHA1 Message Date
Chloé Vulquin
daa0308932 keybind: allow keybinding "-"
Updates #1811
2024-05-14 16:30:49 +02:00
tokyo4j
1c8d347a61 desktop: show/hide top layer more smartly
Before this commit, `top` layers were hidden whenever there is a
fullscreen window in the corresponding output.

With this commit, `top` layers are hidden only when there is a fullscreen
window without other windows above it in the corresponding output.

A caveat is that `bottom` layer is still always hidden by a fullscreen
window.
2024-05-14 15:57:27 +02:00
Consolatis
6fe3df34ca CI: add atof() to banned list 2024-05-13 11:06:04 +02:00
Johan Malm
b41af54a1b build: bump version to 0.7.2 2024-05-10 21:11:21 +01:00
Johan Malm
4d6e3dd90b NEWS.md: update for 0.7.2 2024-05-10 21:07:05 +01:00
tokyo4j
cafdcd8e19 seat: prevent Chromium from crashing when active keyboard is gone
Chromium (and slurp) expect wl_keyboard.keymap event to be sent before
wl_keyboard.modifiers event. Normally, wl_keyboard.keymap event is sent
on the client first obtains wl_keyboard with wl_seat.get_keyboard
request.
However, after the active (especially virtual) keyboard is destroyed,
wlroots doesn't respond to wl_seat.get_keyboard request with
wl_keyboard.keymap event since there's no active keyboard on the seat.

Therefore, if we run commands like "sleep 2; wtype hello; chromium", the
active keyboard is destroyed when wtype finishes and
wl_keyboard.modifiers event is sent to Chromium when Chromium first maps
the surface and the keyboard focus is moved to it, then Chromium crashes.

With slurp, fcitx5 and multi-monitor setup, a similar thing happens.
When slurp first creates the layer-shell surfaces, the focus moves to it
(without wl_keyboard.enter though), and fcitx5 is transiently deactivated
and it destroys the virtual keyboard. Then when slurp maps those
surfaces, the focus moves between them again and wl_keyboard.modifiers
event is sent, thus slurp crashes.

So with this commit, when the active keyboard on the seat is destroyed,
the keyboard from the keyboard group is set to the seat instead so
wlroots can respond to wl_seat.get_keyboard request with
wl_keyboard.keymap.
2024-05-08 20:39:09 +01:00
Franz Berger
097ac44eda view: fix top-layer not showing when there's a minimized full-screen view 2024-05-08 21:33:49 +02:00
01micko
d30fbbeafa rc.xml.all: s/y/height/ in WindowRule ReSizeTo comment 2024-05-08 07:16:05 +01:00
Consolatis
abd8e971c6 osd: prevent handling cursor actions in preview mode
Fixes: #1640

Co-Authored-By: tokyo4j <hrak1529@gmail.com>
2024-05-05 21:05:32 +01:00
Consolatis
c4d12bf5d9 xwayland: prevent shaded views from getting mouse events
Fixes: #1753
2024-05-05 21:04:55 +01:00
tokyo4j
95dc4ac4b5 menu: reset parser state in menu_finish()
This fixes use-after-free in `fill_item()` on Reconfigure with
invalid `menu.xml` like below:

<openbox_menu>
  <menu id="root-menu">
    <item id="rofi-run" label="Run command">
      <action name="Execute" command="rofi-run" />
    </item>
  </menu>
</openbox_menu>
2024-05-05 12:49:39 +02:00
Consolatis
8d4f295440 cursor: reload cursor on Reconfigure
This gives instant feedback when changing cursor theme or size.
It only works for server side cursors or clients using the
cursor-shape protocol.

Fixes: #1619
2024-05-04 21:28:10 +01:00
tokyo4j
4b6efb7307 cursor: implement <menu><ignoreButtonReleasePeriod>
Addresses UX degradation introduced by commit 1d3ed457.

This prevents clicks with small movement with the intention of opening
the menu from unexpectedly closing the menu or selecting a menu item.
2024-05-01 19:08:07 +09:00
Tomi Ollila
96d5d80be2 docs: refer labwc-actions(5), not labwc-action(5) 2024-04-29 22:59:42 +02:00
tokyo4j
f6328d7d45 view: update top layer visibility on map
Steam's Big Picture Mode window requests fullscreen before mapping.
2024-04-29 14:39:05 +02:00
tokyo4j
2603dbf396 ssd: don't update ssd if view width is too small
Clients can ignore the requsted geometry and negative widths could be
passed to `wlr_scene_rect_set_size()` in `ssd_titlebar_update()` or in
`ssd_border_update()`.
2024-04-28 10:20:24 +02:00
tokyo4j
c224e1e05a view: set LAB_MIN_VIEW_WIDTH equal to total width of buttons
This fixes pixman error due to a negative width passed to
`wlr_scene_rect_set_size()` in `ssd_titlebar_update()`.
2024-04-28 10:20:24 +02:00
Johan Malm
5be28d8b56 .editorconfig: set max_line_length=80 for *.md 2024-04-27 22:09:16 +01:00
Johan Malm
06ca80ffb7 .editorconfig: set max_line_length=74 for commit-messages
...so that "git log" shows things nicely even when it is indented.
2024-04-27 22:09:16 +01:00
Tomi Ollila
2e2cf54c00 docs: Fixed some typos, 80 column lines (where possible) 2024-04-26 22:15:39 +01:00
Weblate
32929e8ab5 Translation updates from weblate
Co-authored-by: Jouni Järvinen <jounijarvis@gmail.com>
Co-authored-by: Weblate <noreply@weblate.org>
Co-authored-by: Yannis Drougas <drougas@gmail.com>
Translate-URL: https://translate.lxqt-project.org/projects/labwc/labwc/el/
Translate-URL: https://translate.lxqt-project.org/projects/labwc/labwc/fi/
Translation: Labwc/labwc
2024-04-24 21:25:53 +01:00
tokyo4j
1d3ed45704 cursor: do action/close menu in successive press & release
In OpenBox, when cursor button is pressed to open menu, a subsequent
cursor button release can perform actions or close the menu.
This commit makes labwc follow that behavior.

Fixes: #1750
2024-04-24 20:53:02 +09:00
Standreas
ca0299d259 NEWS.md: fix typos
Closes: #1748 [via git-merge-pr]
2024-04-23 08:32:59 -04:00
Johan Malm
48d787ed99
NEWS.md: interim update 2024-04-22 20:10:40 +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
tokyo4j
b0ba585ff8 overlay: allow to draw both/either of filled/outlined rectangle
Filled/outlined rectangles shown as snapping overlay are now enabled/disabled
independently with `snapping.overlay.[region|edge].bg.enabled` and
`snapping.overlay.[region|edge].border.enabled`.

To keep the default behavior, `*.bg.enabled` is yes and `*.border.enabled` is
no for hardware-based renderers, while `*.bg.enabled` is no and
`*.border.enabled` is yes for software-based (pixman) renderer.

Users can now use a filled rectangle as an overlay even with pixman renderer.
However, this may severely impact performance when used with translucent
`snapping.overlay.[region|edge].bg.color`.

This commit includes a refactor to use substruct `theme_snapping_overlay`
inside `theme` in order to pass it to `create_overlay_rect()` in a cleaner way.

Breaking changes is:
- `snapping.overlay.[region|edge].fill` is now removed.
2024-04-22 19:22:23 +01:00
tokyo4j
34290ef629 overlay: s/preview/overlay/
Replace "preview" in rc.xml and themerc with "overlay" since "preview" sounds
like it shows the window content.

Breaking changes are:
- `snapping.preview.*` in themerc is now replaced with `snapping.overlay`.
- `<snapping><preview>` in rc.xml is now replaced with `<snapping><overlay>`.
2024-04-22 19:22:23 +01:00
Consolatis
3f10857496 Fix pid lookup for the Kill action
Before this patch, labwc would happily kill itself when the user
called the `Kill` action when any xwayland view had focus.

The reason this happened was that wlroots creates the xwayland
wayland client via socketpair() and thus a lookup of the pid
of the socket connection would return the pid of labwc itself.

This patch fixes that by implementing different pid lookup
mechanisms based on the view implementation backend.

Fixes: #1739
2024-04-22 19:11:57 +01:00
Tobias Bengfort
a109e6e3e8 add .scd to editorconfig 2024-04-21 22:18:00 +01:00
tokyo4j
bc0174d849 workspaces: react to Reconfigure
Changes in `<desktops><names>` or `<desktop><number="" prefix="">` required
restarting labwc to take effect.

This commit adds `workspaces_reconfigure()` to update `server->workspaces` on
Reconfigure.
2024-04-22 05:44:52 +09:00
Hiroaki Yamamoto
d64e3915a3
Fix some header includes detected by clangd
There were some missing headers like <stddef.h> for `NULL`, <wayland-util.h>
for `wl_link` and <stdbool.h> for `true`/`false`.

Also this commit fixes that `labwc.h` and `ime.h` included each other.
2024-04-21 21:58:57 +02:00
Consolatis
d67345564e window-rules: add ignoreConfigureRequest
This allows to ignore X11 client side configure requests
like positioning and resizing and can be used to fight
some X11 applications that persist to have their windows
spawn at specific places and sizes.

Fixes: #1446
2024-04-21 20:31:55 +01:00
Johan Malm
48e6c0009c server: refactor to avoid *g_server
No functional change intended.
2024-04-21 16:54:17 +02:00
Tobias Bengfort
858e1c65cf window-rules: implement type filter
Co-Authored-By: Grigory Kirillov <txgk@bk.ru>
2024-04-20 15:29:41 +02:00
Hiroaki Yamamoto
9be18f3009
IME: prevent virtual keyboard from unintentionally releasing modifiers (#1721)
When Fcitx5 is activated, it creates a virtual keyboard to send keycodes to
applications, then creates a keyboard grab to capture keycodes the user typed.

Before this commit, we set keyboard grab's modifiers to that of currently
active keyboard, which is the virtual keyboard created in the case described
above. However, since the modifiers of the virtual keyboard is empty at first,
we actually set empty modifiers, even when the user is pressing modifiers.
Then, Fcitx5 assumes no modifiers is pressed and redirect the modifier state
back to the compositor via the virtual keyboard. As a result, when the focus
is switched between windows by workspace-switcher, the workspace-switcher is
immediately terminated.

To fix this issue, with this commit, the modifier state of the currently active
keyboard is not set to the keyboard grab if the keyboard is a virtual keyboard
created by the same input-method client.

Fcitx5's commit below is also required to fix the issue.
b2924bd361
2024-04-18 21:57:03 +01:00
John Lindgren
1e514c7550 add .clang-format (with a disclaimer)
.clang-format gets picked up nowadays by some IDEs (tested Qt Creator)
for auto-formatting aids. With the large caveat that it's not 100%
accurate to labwc's preferred coding style, I've found that this config
gets it right 90% of the time, which is enough to be helpful.

I added a prominent disclaimer comment to the top of the file to warn
people away from relying completely on clang-format. This isn't meant
to replace manual attention to formatting details (or to replace
./scripts/check) but I think it doesn't hurt.
2024-04-18 21:52:38 +01:00
John Lindgren
069e22f2b6 exclude IDE settings in .gitignore
.cache/ is created by Visual Studio Code
*.user are files created by Qt Creator
2024-04-18 21:51:25 +01:00
John Lindgren
a8f98cb90b common/buf: rename buf->buf to buf->data 2024-04-18 07:00:23 +01:00
John Lindgren
fccc6a2922 common/buf: use string_null_or_empty() 2024-04-18 07:00:23 +01:00
John Lindgren
0573f16693 common: remove buf_init(), add BUF_INIT and buf_move()
Add a BUF_INIT macro, which makes it easier to initialize a struct buf
to an empty string (without a heap allocation).

Add buf_move() to move the contents of one struct buf to another (the
source is reset to BUF_INIT, analogous to C++ move-assignment).

Use buf_reset() instead of directly calling `free(s->buf)` since the
internal buf may not always be allocated by malloc() now.
2024-04-18 07:00:23 +01:00
Consolatis
343918dee0 treewide: properly clear the buffer
Before this patch, the OSD would repeat the last buffer
content in case the new buffer content would be empty.

This was mostly happening for the `title` OSD field that is intended
to be empty when it matches the app_id / WM_CLASS of the application.
Due to only buffer.len being reset but its internal allocations being
untouched, buffer.buf would still carry the old data.

This patch fixes it by also overwriting the first byte in the buffer
allocation with '\0' via the new `buf_clear()` function.

Do the same for buf_expand_shell_variables() although that one should
have been fine before as it always writes new data to the buffer.
2024-04-18 07:00:23 +01:00
Andrew J. Hesford
b4f3ffc27e session: sort directory entries in environment.d 2024-04-16 13:21:55 +02:00
tokyo4j
8096df19ba osd: add theme settings for window-switcher preview
Adds theme settings like:
osd.window-switcher.preview.border.width: 2
osd.window-switcher.preview.border.color: #ffffff,#00a2ff,#ffffff
2024-04-16 09:58:34 +02:00
tokyo4j
2c0e76417f graphic-helpers: prevent multi-rect edges from overlapping
Multi-rect edges overlapping is problematic with translucent colors.
2024-04-15 12:50:29 +02:00
tokyo4j
3b13f4cdcd overlay: add theme settings for colors and border width
adds theme settings like:
snapping.overlay.[region|edge].bg.color: #8080b380
snapping.overlay.[region|edge].border.color: #ffffff,#000000,#ffffff
snapping.overlay.[region|edge].border.width: 1
2024-04-15 12:33:40 +02:00
tokyo4j
50fd65416f overlay: add theme setting snapping.preview.[region|edge].fill
This settings allows user to choose whether to draw a filled rectangle
or an outlined rectangle as the preview for window snapping.
2024-04-15 12:33:40 +02:00
tokyo4j
be491e0e4c overlay: add inactivate_overlay() as refactoring
This change brings a subtle behavioral change that region overlay is hidden
immediately when the timer for edge overlay starts.
2024-04-15 12:33:40 +02:00
tokyo4j
7c2fa5f8e2 overlay: remove checks already done in wlroots side 2024-04-15 12:33:40 +02:00
tokyo4j
62091ccc58 doc: enhance documentation on fallback values for OSD style 2024-04-14 14:44:43 +01:00
tokyo4j
3c4c0a6643 themerc: fix default value of osd.bg.color 2024-04-14 14:44:43 +01:00