Commit graph

829 commits

Author SHA1 Message Date
Johan Malm
ab07b68d7e view: adjust views safety following layout change
Refactor view_adjust_for_layout_change() in order to:

- Use view_maximize() - otherwise the unmaximized geometry remains off
  the screen.
- Avoid relying on view_apply_maximized_geometry() to handle missing
  output

Issue #194
2022-01-07 22:01:44 +00:00
Johan Malm
be89478f7a view: fix bug in view_snap_to_edge()
Use view_move() and view_move_resize() correctly.

view_move_resize() should only be used when the view actually changes
width and/or height, otherwise the serials might cause a delay in moving
xdg-shell clients.

Issue #201
2022-01-07 20:53:48 +00:00
Johan Malm
cef9723505 seat: support WLR_{WL,X11}_OUTPUTS >= 2
When running nested in X11 or a wlroots compositor with the respective
environment variables WLR_X11_OUTPUTS or WLR_WL_OUTPUTS set to value >= 2,
cursors need to be mapped to the respective outputs.

Closes issue #196

Suggested-by: @Consolatis
Written-by: @johanmalm
2022-01-06 21:40:10 +00:00
Consolatis
2b82bdcdb7 More robust rc.xml parsing 2022-01-06 19:44:00 +00:00
ARDiDo
dc203a28e9 Prevent views from starting in fullscreen 2022-01-05 17:02:58 -05:00
Johan Malm
3c92cc4dd0 Move action() prototype from labwc.h to action.h 2022-01-05 21:27:47 +00:00
Johan Malm
3bd65c3a20 action.{c,h}: fix coding style 2022-01-05 21:23:01 +00:00
Consolatis
0b45cce648 Rewrite action handling to allow multiple actions at once 2022-01-05 16:22:41 +00:00
Johan Malm
a54ce40e1c wlroots.wrap: add .git to url to avoid redirection warning 2022-01-04 21:27:59 +00:00
Johan Malm
ea705a7303 docs/autostart: remove wlr-randr {--off,--on}
swayidle previously used wlr-randr to enable/disable outputs, but since
commit a837fefc, this re-arranges views so is not to be used in the
context of idle system power management.
2022-01-03 23:32:02 +00:00
Consolatis
f28319be54 config/keybind.c: Don't overwrite the stack 2022-01-03 08:27:22 +00:00
Johan Malm
a47931bba2 desktop: simplify desktop_focus_and_activate_view()
...following view->surface checks in 295d5172
2022-01-02 15:53:05 +00:00
Johan Malm
f7b63f264e cursor.c: fix coding style
Open brace '{' following function definitions go on the next line
2022-01-02 15:51:40 +00:00
Johan Malm
e62bb51bfb keyboard: cancel repeat when handling key-bind
<keybind key="W-d">
  <action name="Execute">
    <command>dmenu_run</command>
  </action>
</keybind>

When using the keybind above (in rc.xml), on the first execution of W-d
all is okay, but the second time, a "d" pressed event is sent to dmenu
resulting in a continuous "ddddddd...") which has to be stopped pressing a
key.

This behaviour started in commit 7e57b7f because release events associated
with keybinds are no longer sent to clients (before that commit, the
release event for the “d” would have been passed to dmenu, thus cancelling
the repeat).

Solves issue #176

Helped-by: @spectrum70
2022-01-02 15:28:35 +00:00
ARDiDo
70845643af fullscreen: ignore decorations and maximize requests while fullscreen 2022-01-02 10:19:48 -05:00
Johan Malm
896102d062 README.md: update acceptance criteria URL 2022-01-01 20:35:36 +00:00
Johan Malm
1c9c4dd128 Update NEWS.md 2022-01-01 20:18:57 +00:00
bi4k8
80315295d2 cursor: support pointer gestures (pinch/swipe) 2022-01-01 19:24:27 +00:00
bi4k8
58f5e8d16a factor keyboard/cursor cleanup into own functions 2022-01-01 19:24:27 +00:00
ARDiDo
0f9374c701 decorations: use view_apply_maximized_geometry instead of view_maximize 2022-01-01 11:50:35 -05:00
John Lindgren
a837fefc80 Adjust views to account for output layout changes
labwc currently doesn't handle output layout changes very well:

 - Windows can end up "lost" completely offscreen
 - Maximized/fullscreen windows can end up spanning multiple outputs

Currently, new_output_notify() and output_destroy_notify() contain logic
to update the cursor and force a repaint when outputs are added or
removed.  This logic in fact needs to run on any output layout change,
so consolidate it into a new function, output_update_for_layout_change().

Then add a second new function, view_adjust_for_layout_change(), which
adjusts window placement to account for the new layout.

The behavior is roughly as follows:

 - Normal windows that end up offscreen are centered on the closest
   output (making use of the existing view_center() logic)
 - Maximized windows are re-maximized on the closest output.  Logic is
   also added to the unmaximize step to check that the original
   unmaximized position is still on-screen.
 - Fullscreen windows are re-fullscreened on the same output if
   possible; otherwise they are un-fullscreened.

Minimized windows don't require any special handling.  Their placement
is adjusted just the same, but invisible to the user until they are
later unminimized.

There is some positioning glitch still with un-fullscreening a window
whose output has been disconnected/disabled; it can end up in an
unexpected position (but at least has the correct size and decoration).
I don't think this is due to a bug in my change per se, but perhaps the
change has exposed a bug elsewhere.

Fixes: #177
2022-01-01 16:20:13 +00:00
Johan Malm
12b05604a2 build: bump version to 0.4.0 2021-12-31 21:05:49 +00:00
ARDiDo
cd50344fdb view.c: re-maximize views when toggling decorations 2021-12-31 17:18:51 +00:00
Joshua Ashton
d5532ace7a xwayland: Implement request_activate
Used by Steam, for example, on the Friends and Chat button.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-12-31 07:36:25 +00:00
Joshua Ashton
5ae921d785 xwayland: Implmement request_minimize
This is used by Steam and other apps with client decorations.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-12-31 07:36:25 +00:00
Joshua Ashton
2d98179b31 xdg: Implement request_minimize
Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-12-31 07:36:25 +00:00
Joshua Ashton
295d5172d4 desktop: Fix activating unmapped views
This can happen sometimes in xwayland, need to guard against this.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-12-31 07:36:25 +00:00
Joshua Ashton
f393dedf3f xwayland: Make styling of wl_signal_add consistent
Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-12-31 07:36:25 +00:00
Joshua Ashton
48d1293845 xdg: Make styling of wl_signal_add consistent
Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-12-31 07:36:25 +00:00
Johan Malm
de1bc48d8e Update NEWS.md 2021-12-29 14:32:18 +00:00
Johan Malm
3194d2c438 interactive: use "grab" cursor when moving
This is consistent with sway and looks better.

Relates to issue #124
2021-12-29 14:28:36 +00:00
Johan Malm
eb582090a7 labwc-environment(5): add XCURSOR_{THEME,SIZE} 2021-12-29 14:25:13 +00:00
Johan Malm
e89a9899d0 labwc-config(5): fix typo 2021-12-29 14:23:51 +00:00
Johan Malm
f292998399 docs/rc.xml.all: only declare one 'Root' context
Multiple <mousebind> can exist within one <context>, so let's keep it
clean.
2021-12-29 14:20:00 +00:00
Johan Malm
c797dbe189 config: de-couple <FollowMouse> and <raiseOnFocus>
Set these two variables indepently of each other as this is cleaner and
more explicit.

In openbox <raiseOnFocus> only applies if <followMouse> is set, but there
is no need to immitate this.
2021-12-29 14:04:41 +00:00
Consolatis
4a20d57b38 src/foreign.c: verify associated view is still valid
Closes #172
2021-12-28 10:14:55 -05:00
Consolatis
4b2a7a28c6 view:c Do not overwrite unmaximized dimensions on fullscreen
Before: window -> maximize -> fullscreen -> unfullscreen would reset pre maximized state
Now: window -> maximize -> fullscreen -> unfullscreen -> unmaximize works as expected
2021-12-28 10:14:40 -05:00
Johan Malm
310c36c86d Fix build on Alpine Linux
Issue #144

Add `#define _POSIX_C_SOURCE 200809L` to avoid the error below:

../src/cursor.c: In function 'cursor_update_focus':
../src/cursor.c:271:2: warning: implicit declaration of function
'clock_gettime' [-Wimplicit-function-declaration]
  271 |  clock_gettime(CLOCK_MONOTONIC, &now);
      |  ^~~~~~~~~~~~~
../src/cursor.c:271:16: error: 'CLOCK_MONOTONIC' undeclared (first use in
this function)
  271 |  clock_gettime(CLOCK_MONOTONIC, &now);
      |                ^~~~~~~~~~~~~~~
../src/cursor.c:271:16: note: each undeclared identifier is reported only
once for each function it appears in
../src/cursor.c: In function 'is_double_click':
../src/cursor.c:486:16: error: 'CLOCK_MONOTONIC' undeclared (first use in
this function)
  486 |  clock_gettime(CLOCK_MONOTONIC, &now);
      |                ^~~~~~~~~~~~~~~
2021-12-28 15:06:33 +00:00
Consolatis
09949e6faf view.c: Remove 'activated' flag when minimizing a view
Before this change a window that had been minimized showed up with states Minimized and Activated.
For foreign-toplevel clients like taskbars that could mean to handle multiple windows at once
having a 'activated' state even though they were clearly minimized.
2021-12-28 09:50:21 -05:00
John Lindgren
455d85e01c Fix use-after-free errors detected by valgrind
Handlers for the "destroy" signal need to unregister themselves from the
signal (using wl_list_remove()) before invoking free().

    Invalid write of size 8
       at 0x487DF27: wl_list_remove (in /usr/lib/libwayland-server.so.0.20.0)
       by 0x4906FF0: wlr_signal_emit_safe (signal.c:32)
       by 0x48EA304: reset_xdg_surface (wlr_xdg_surface.c:430)
       by 0x48EA3D6: UnknownInlinedFun (wlr_xdg_surface.c:464)
       by 0x48EA3D6: xdg_surface_handle_resource_destroy (wlr_xdg_surface.c:282)
       by 0x4877899: ??? (in /usr/lib/libwayland-server.so.0.20.0)
       by 0x487DEBF: ??? (in /usr/lib/libwayland-server.so.0.20.0)
       by 0x487E3DF: ??? (in /usr/lib/libwayland-server.so.0.20.0)
       by 0x487830D: wl_client_destroy (in /usr/lib/libwayland-server.so.0.20.0)
       by 0x48783F6: ??? (in /usr/lib/libwayland-server.so.0.20.0)
       by 0x487B1C9: wl_event_loop_dispatch (in /usr/lib/libwayland-server.so.0.20.0)
       by 0x4878D36: wl_display_run (in /usr/lib/libwayland-server.so.0.20.0)
       by 0x110DAC: main (main.c:81)
     Address 0xc3213d8 is 424 bytes inside a block of size 704 free'd
       at 0x484118B: free (vg_replace_malloc.c:755)
       by 0x4906FDD: wlr_signal_emit_safe (signal.c:29)
       by 0x48EA304: reset_xdg_surface (wlr_xdg_surface.c:430)
       by 0x48EA3D6: UnknownInlinedFun (wlr_xdg_surface.c:464)
       by 0x48EA3D6: xdg_surface_handle_resource_destroy (wlr_xdg_surface.c:282)
       by 0x4877899: ??? (in /usr/lib/libwayland-server.so.0.20.0)
       by 0x487DEBF: ??? (in /usr/lib/libwayland-server.so.0.20.0)
       by 0x487E3DF: ??? (in /usr/lib/libwayland-server.so.0.20.0)
       by 0x487830D: wl_client_destroy (in /usr/lib/libwayland-server.so.0.20.0)
       by 0x48783F6: ??? (in /usr/lib/libwayland-server.so.0.20.0)
       by 0x487B1C9: wl_event_loop_dispatch (in /usr/lib/libwayland-server.so.0.20.0)
       by 0x4878D36: wl_display_run (in /usr/lib/libwayland-server.so.0.20.0)
       by 0x110DAC: main (main.c:81)
     Block was alloc'd at
       at 0x48435FF: calloc (vg_replace_malloc.c:1117)
       by 0x113E22: xdg_surface_new (xdg.c:401)
       by 0x4906FDD: wlr_signal_emit_safe (signal.c:29)
       by 0x48EABE7: handle_xdg_surface_commit (wlr_xdg_surface.c:331)
       by 0x4908FE7: surface_commit_state (wlr_surface.c:457)
       by 0x524DD49: ??? (in /usr/lib/libffi.so.8.1.0)
       by 0x524D266: ??? (in /usr/lib/libffi.so.8.1.0)
       by 0x487D322: ??? (in /usr/lib/libwayland-server.so.0.20.0)
       by 0x48785CB: ??? (in /usr/lib/libwayland-server.so.0.20.0)
       by 0x487B1C9: wl_event_loop_dispatch (in /usr/lib/libwayland-server.so.0.20.0)
       by 0x4878D36: wl_display_run (in /usr/lib/libwayland-server.so.0.20.0)
       by 0x110DAC: main (main.c:81)

    Invalid write of size 8
       at 0x487DF27: wl_list_remove (in /usr/lib/libwayland-server.so.0.20.0)
       by 0x4906FF0: wlr_signal_emit_safe (signal.c:32)
       by 0x48F5529: UnknownInlinedFun (wlr_input_device.c:34)
       by 0x48F5529: wlr_input_device_destroy (wlr_input_device.c:29)
       by 0x48CE4B5: backend_destroy.part.0.lto_priv.0 (backend.c:148)
       by 0x48D2D55: multi_backend_destroy (backend.c:59)
       by 0x48788FE: wl_display_destroy (in /usr/lib/libwayland-server.so.0.20.0)
       by 0x110E71: UnknownInlinedFun (server.c:406)
       by 0x110E71: main (main.c:83)
     Address 0xc466568 is 24 bytes inside a block of size 56 free'd
       at 0x484118B: free (vg_replace_malloc.c:755)
       by 0x4906FDD: wlr_signal_emit_safe (signal.c:29)
       by 0x48F5529: UnknownInlinedFun (wlr_input_device.c:34)
       by 0x48F5529: wlr_input_device_destroy (wlr_input_device.c:29)
       by 0x48CE4B5: backend_destroy.part.0.lto_priv.0 (backend.c:148)
       by 0x48D2D55: multi_backend_destroy (backend.c:59)
       by 0x48788FE: wl_display_destroy (in /usr/lib/libwayland-server.so.0.20.0)
       by 0x110E71: UnknownInlinedFun (server.c:406)
       by 0x110E71: main (main.c:83)
     Block was alloc'd at
       at 0x48435FF: calloc (vg_replace_malloc.c:1117)
       by 0x11590F: new_input_notify (seat.c:137)
       by 0x4906FDD: wlr_signal_emit_safe (signal.c:29)
       by 0x4906FDD: wlr_signal_emit_safe (signal.c:29)
       by 0x48CDCEE: UnknownInlinedFun (events.c:109)
       by 0x48CDCEE: UnknownInlinedFun (events.c:242)
       by 0x48CDCEE: UnknownInlinedFun (backend.c:58)
       by 0x48CDCEE: handle_libinput_readable (backend.c:48)
       by 0x48CE1BE: backend_start.lto_priv.0 (backend.c:114)
       by 0x48D2CE5: multi_backend_start (backend.c:33)
       by 0x110C45: UnknownInlinedFun (server.c:375)
       by 0x110C45: main (main.c:68)
2021-12-27 15:37:26 +00:00
Johan Malm
34a12b3515 Fix coding style 2021-12-26 23:29:01 +00:00
Johan Malm
60149e4fa5 CONTRIBUTING.md: wrap commit messages at 74 characters 2021-12-26 23:14:21 +00:00
Johan Malm
41274db128 Delete .clang-format
The file is not accurate and clang-format cannot describe our coding
style
2021-12-26 23:10:39 +00:00
Johan Malm
837a7f3997 docs/rc.xml.all: update with default mouse-bindings 2021-12-26 23:02:07 +00:00
Johan Malm
be300764b5 build: use wlroots 0.15.0 2021-12-26 22:42:51 +00:00
Johan Malm
6651d45ed4 cursor: add cursor_update_focus()
...and call it from desktop_move_to_front() in order force an enter event
on the surface below the cursor when cycling views.

Inspired by PR #164 - just restructured it a bit.

Suggested-by: @bi4k8
2021-12-26 22:09:41 +00:00
Johan Malm
8d070ab2f4 cursor: fix setting of resize_edges
Only calculate nearest `resize_edges` if not clear from the server-side
deco under the cursor.
2021-12-26 21:35:37 +00:00
bi4k8
6a190797b6 document mouse buttons and newly-supported mouse contexts 2021-12-26 21:31:11 +00:00
bi4k8
5bd4833b87 add mouse bindings for window edges to rc.xml.all 2021-12-26 21:31:11 +00:00
bi4k8
26d3d13a82 move edge resizing from hard-coded to configuration 2021-12-26 21:31:11 +00:00