Commit graph

736 commits

Author SHA1 Message Date
Consolatis
b7c9d0e055 Chase wlroots: prep work: ssd to tree 2022-06-07 07:13:37 +01:00
Consolatis
65a5315e42 Chase wlroots: prep work: menu to tree 2022-06-07 07:13:37 +01:00
Consolatis
3f65a2ff77 Chase wlroots: wlr_scene is now a tree node
Chases wlroots 9eb71146ae56c509ee33c7e8a662549592aad870
wlr_scene: Refactor wlr_scene (the root element) to encase a wlr_scene_tree
2022-06-07 07:13:37 +01:00
Johan Malm
fb1af5f68e view: when centering, top/left align if view is bigger than usable area 2022-06-06 20:46:29 +02:00
Johan Malm
0f22613952 view: take into account top-margin for xwayland views
...in order to center accurately.
2022-06-06 20:46:29 +02:00
Johan Malm
d1e16c5030 view: center correctly with scale != 1
Fixes issue #376
2022-06-06 20:46:29 +02:00
Johan Malm
71f8aca66b xwayland-unmanaged: wl_list_remove() missing listeners on destroy 2022-06-05 23:34:04 +02:00
Johan Malm
cbc80c196c xwayland-unmanaged: remove excessive logging 2022-06-05 23:34:04 +02:00
Joshua Ashton
538fa1f244 xwayland-unmanaged: Fix set_geometry using container_of of wrong member
Fixes a segfault with starting Steam.
2022-06-05 21:54:26 +01:00
Johan Malm
2a14e8271b xwayland-unmanaged: fix typo 2022-06-05 09:55:25 +01:00
Johan Malm
9dcabbcfdd xwayland-unmanaged: prepare for handling more events
Sway handles some xwayland events that labwc still does not. This commit
just starts to rig up some handlers for these with log messages if they
are caught.

  - set_geometry: try to handle, but cannot find an application that uses
    it, so is untested.
  - request_activate - just log caught event
  - override_redirect - just log caught event
2022-06-05 09:45:58 +01:00
Johan Malm
96315def57 xwayland-unmanaged: put all surfaces under server->unmanaged_tree
...in order to render all unmanaged surfaces above views just like sway
does it:

e5728052b5/sway/desktop/render.c (L1148)

Fixes issue #367
2022-06-05 08:35:03 +01:00
Consolatis
39cdba36a8 src/config/keybind.c: fix keybind insertion order
This restores the intended behavior of keybinds set by `<default />`
to be overwritten by manually configured keybinds which come later in
the config.

In `src/keyboard.c`, `handle_keybinding()` is going backwards through
the list of keybindings and breaks after the first match.

`wl_list_insert(&list_node, item)` will insert the new item *after* the
list_node so if its called multiple times with the same list_node as
fist argument the result will be a reversed list. Using `list_node.prev`
instead will result in a non-reversed list.
2022-06-03 22:54:32 +01:00
Consolatis
986ab70780 Prevent missing direction arguments to segfault labwc
Reported-by: @Flrian
2022-06-03 19:07:13 +01:00
Consolatis
b7907cc2da theme: implement osd.border.color and osd.border.width
http://openbox.org/wiki/Help:Themes#osd.border.color
http://openbox.org/wiki/Help:Themes#osd.border.width
2022-06-01 17:55:36 +01:00
Consolatis
ccfcd04625 Revert "Fix dynamic output based scaling for menu and SSD"
As it turns out the reason for the workaround was a bug
in wlroots which got fixed in the meantime.

So to keep things simple just revert the workaround and
depend on the wlroots fix instead.

To update the wlroots subproject use
meson subprojects update wlroots

This reverts commit e87aa19066.
2022-05-30 21:27:33 +02:00
Johan Malm
62ae87bbd9 xwayland: call foreign-toplevel-destroy on unmap
Some xwayland clients leave unmapped child views around, typically when a
dialog window is closed. Although handle_destroy() is not called for
these, we have to call foreign-toplevel-destroy to avoid panels and the
like incorrecly showing them.
2022-05-30 21:08:54 +02:00
Consolatis
1e29d0606d Chase wlroots: xdg_popup.geometry
To update the wlroots subproject use
meson subprojects update wlroots

https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3514
2022-05-30 17:54:26 +01:00
Jelle De Loecker
61675b521c xwayland-unmanaged: focus parent surface on unmap
Re-focus on parent surface if it is available

Fixes #352 relating to JetBrains and Intellij focus issues
2022-05-30 16:14:32 +01:00
Consolatis
e87aa19066 Fix dynamic output based scaling for menu and SSD
wlr_scene_buffers need an additional wlr_scene_buffer_set_source_box()
to be scaled correctly by wlroots based on the output scale.

With this commit the buffers are now scaled correctly but, especially
on higher scale factors, may be a bit blurry.

In the future we likely want a dynamic font label generator based
on the maximal scale of all the outputs the specific buffer is currently on.

Some inspiration for that could be
https://github.com/Nefsen402/sway/blob/scene-graph/sway/sway_text_buffer.c

Fixes #348
2022-05-29 22:10:00 +02:00
Consolatis
78dc2ea7fe src/theme.c: Clean up corner buffers on finish 2022-05-26 22:19:56 +01:00
Consolatis
ae9314c65e src/osd.c: Free buf.buf as its malloc'd in buf_init() 2022-05-26 22:19:56 +01:00
Consolatis
bda48da68d Deal with font_buffer_create() failures 2022-05-26 22:19:56 +01:00
Consolatis
163179dda1 Chase wlroots: wlr_scene_surface
To update the wlroots subproject use
meson subprojects update wlroots
2022-05-26 06:48:00 +01:00
Consolatis
3699a2a7f6 desktop_node_and_view_at(): handle layer surfaces
+ Replace some tabs with spaces in include/node.h

Fixes: #278
2022-05-25 21:48:28 +01:00
Consolatis
499df78531 src/cursor.c: Ignore out-of-surface movement for surfaces without views 2022-05-25 21:32:48 +01:00
Consolatis
b24b9d2d23 src/cursor.c: Ensure we send a release event for out-of-surface scrolling 2022-05-25 21:32:48 +01:00
Johan Malm
81810db3b6 cursor: offset xdg invisible border when dragging outside view
Note: view->padding was deleted in commit b279550 as the wlroots
scene-graph xdg-surface commit handler offsets the CSD invisible border.
If view->padding still existed, we could have used that, but considering
that this is probably the only place where this offset will now be
needed (because we're generating surface local coordinates), it's simpler
to just do it locally.

Related to issue #340

Written-by: @Consolatis
2022-05-24 17:49:21 +01:00
Consolatis
6dd290afc9 src/cursor.c: Fix branch condition for out-of-view selecting/dragging
Instead of using the stored view for comparison use the actual surface.

Before this patch, there were situations where the branch intended for
out-of-window text selection / scrollbar dragging was used even though
the cursor never left the surface.

Partly fixes #340
2022-05-24 17:35:32 +01:00
Johan Malm
9df491c544 resistance.c: init flags in resistance_resize_apply() too 2022-05-18 20:53:46 +01:00
Johan Malm
87a64b64fa resistance.c: initialize 'flags' to zero
Failure to initialize this variable sometimes causes windows to stick to
edges during move/resize.

Issues #331 and #309 may be related to this
2022-05-18 16:52:49 +01:00
Consolatis
d8a877749e Chase wlroots xdg_shell version
To update the wlroots subproject use
meson subprojects update wlroots
2022-05-18 14:04:22 +02:00
Consolatis
fbbe273155 src/xwayland.c: keep SSD state on unmap/map cycle
Move SSD related map() work into the !view->been_mapped branch,
similar to src/xdg.c.

Without this patch following series of events restores the initial
state of the SSD when activating the view:
- spawn xcalc
- observe it shows the SSD
- toggleDecorations to hide the SSD (via keybinding or window menu)
- minimize xcalc (via some panel or A-Space)
- activate xcalc (via some panel or A-Tab)
- observe the SSD is back visible
2022-05-17 17:34:26 +01:00
Johan Malm
5944813566 menu: support <action name="Execute"> option <execute>
<exectue> is a deprecated name for <command>.
See: http://openbox.org/wiki/Help:Actions#Action_syntax

But some openbox3 menu generators still use it, for example
https://wiki.archlinux.org/title/xdg-menu - so let's support it for
backward compatibility.
2022-05-06 21:55:46 +01:00
Johan Malm
9554be0ce7 menu: avoid logging on <item label="" icon="">
Labwc does not support menu icons, but we should not log errors if a
menu file contains icons as in the example below:

<item label="" icon="">
  <action name="Execute">
    <command></command>
  </action>
</item>
2022-05-06 21:52:46 +01:00
Johan Malm
81f216b6a2 xwayland: handle set_override_redirect events
This is needed to allow X11 applications to create surfaces as
non-override_redirect and then change them to override_redirect later

Without this gitk-menus and rofi are treated as xwayland-views with
associated server-side-decoration and forced positioning.
2022-05-03 20:45:30 +01:00
01micko
cbed8acf01 nls: add native language support
- adds labwc.pot and po files for de, es, it and sv
- added notes in NEWS.md and CONTRIBUTING.md
- addresses #269
- conditional upon `msgfmt` being installed
- can be disabled at build time
2022-05-02 10:33:42 +01:00
Consolatis
e75af14d3d src/output.c: Make sure we are always using the correct scene_node
Also make sure we are only applying layout specific changes
once the output specific ones were committed successfully.

Fixes #312
Reported-By: @fakeczg
2022-05-02 09:54:01 +01:00
Johan Malm
60966f5fde src/ssd/ssd.c: remove superfluous WLR_ERROR log message 2022-04-28 22:33:56 +01:00
Johan Malm
bacabdc4a1 xdg-shell: set fallback geometry if width/height == 0 on unmaximize 2022-04-28 22:29:10 +01:00
Johan Malm
a1cf5b3e96 xdg-shell: set view position before view_maximize()
...on first map so that view->unmaximized_geometry is known even if an
xdg-shell application started in maximized mode.

Fixes issue #305
Reported-by: @01micko
2022-04-28 22:29:10 +01:00
yizixiao
8b45ff6829 cursor.c:func is_double_click add check view 2022-04-28 22:05:39 +01:00
Johan Malm
420ff8c8d9 server.c: remove redundant TODO comment 2022-04-26 21:58:23 +01:00
Johan Malm
76a85ae87d view: do not crash on missing output
We should survive all outputs being disabled
2022-04-26 21:55:04 +01:00
Johan Malm
b94f3b1af0 src/common/dirs.c: add missing slash
Change "opt/share/themes" to "/opt/share/themes"
2022-04-26 21:50:24 +01:00
Consolatis
519375a7f8 Revert "config: support <mouse><default />"
This reverts commit 3d337857b7.

Revert for now until we have some infrastructure in place to
selectively replace default {key,mouse}binds with custom ones.

Fixes #304
Reported-by: @01micko
2022-04-26 19:56:06 +02:00
Johan Malm
bb2a98645b layer: handle output_destroy.notify without crash
Steps to reproduce crash:
- run nested with two outputs (e.g. WLR_WL_OUTPUTS=2 ./build/labwc)
- start panel on one output (e.g. waybar)
- close that output

Backtrace pointed to output_destroy_notify() at ../src/layers.c:92

Reported-by: @Consolatis
2022-04-24 22:24:47 +01:00
Consolatis
73930f7e0f view: Refactor view destruction some more 2022-04-23 08:59:06 +01:00
Johan Malm
f925fe5893 theme: change window.label.text.justify default to center
It just looks better :)
2022-04-22 17:54:20 +01:00
Johan Malm
3d337857b7 config: support <mouse><default />
This loads default mousebinds and provides a way to keep config files
simpler whilst allowing user specific binds.

Note that if no rc.xml is found, or if no <mouse><mousebind> entries
exist, the same default mousebinds will be loaded even if the <default />
element is not provided.

Example usage:

  <mouse>
    <default />
    <context name="Root">
      <mousebind button="Right" action="Press">
        <action name="Execute" command="my-menu-application" />
      </mousebind>
    </context>
  </mouse>
2022-04-22 17:52:01 +01:00