Commit graph

221 commits

Author SHA1 Message Date
Consolatis
f491942858 cursor: Move cursor specific function definitions into cursor.h 2022-09-16 21:30:40 +01:00
John Lindgren
bbc6c6bb94 action: Select resize edges for Resize triggered by keybind 2022-09-16 01:42:04 +02:00
John Lindgren
1fafb89cba cursor: Store view + resize edges for move/resize in press event
v2: Restore previous behavior for keybinds
2022-09-15 06:13:27 +02:00
John Lindgren
429c388333 cursor: Add struct cursor_context and clean up code
v2:
 - Add surface to cursor_context, rename c -> ctx
 - Factor out determine_resize_edges()
2022-09-15 03:12:38 +02:00
John Lindgren
e18f7a32ba cursor: Allow leave/enter events within the same XDG toplevel
Attempting to open a GTK3 menu and activate a menu item in it,
using a single mouse motion (press-move-release), was broken due
to GTK apparently expecting to receive leave/enter events when the
cursor enters the menu (XDG popup).

To fix the issue, allow leave/enter events when the cursor is
moved between an XDG toplevel and popups of the same.

v2:
 - Use (struct view *) as proxy for toplevel in comparisons
 - Update seat->pressed.surface when entering/leaving popups
v3:
 - Go back to using get_toplevel() rather than (struct view *)
2022-09-13 15:57:20 -04:00
John Lindgren
b8c3fdaef9 seat: Listen for destroy signal of pressed.surface 2022-09-13 15:57:20 -04:00
John Lindgren
6c6e406507 cursor: Factor out cursor_update_common() and fix some glitches
Fix a couple of glitches seen when exiting interactive move/resize:

 - Cursor briefly set to left_ptr rather than the correct cursor image
 - Cursor not updated if the view being moved/resized is destroyed

Also make sure to exit interactive mode if the view is going fullscreen
(labwc gets very confused otherwise).

Code changes in detail:

 - Factor out set_server_cursor() which will set the correct cursor
   image for non-client areas (either XCURSOR_DEFAULT or one of the
   resize cursors).
 - Unify the logic from cursor_rebase() and process_cursor_motion by
   factoring out cursor_update_common().  This corrects some logic
   discrepancies between the two, which should be a good thing(TM).
 - Remove the extra cursor_set(XCURSOR_DEFAULT) from interactive_end()
   and instead rely on cursor_update_focus() to do the right thing.
 - Simplify cursor_button() by just calling interactive_end() when we
   want to exit interactive mode.
 - Call cursor_update_focus() from view_destroy() if the view had mouse
   focus or was being interactively moved/resized.

v2: Eliminate force_reenter parameters and figure out automatically
    when we need to re-enter the surface.
v3: Rename wlseat -> wlr_seat.
v4: Simplify client/server cursor logic.
2022-09-13 13:29:36 -04:00
Consolatis
baf555edd0 cursor: Handle missing cursor theme
Temporary fix for #246

This should be reverted once wlroots MR !3651 is merged.
2022-09-11 21:20:00 +01:00
Consolatis
c0f0e0c46e cursor: Allow re-enter for cursor_update_focus()
This allows forcing an application to re-set their desired cursor image.
2022-09-11 13:24:27 +01:00
Johan Malm
62e9bb7236
Merge pull request #523 from jlindgren90/unmanaged-cursor-focus
cursor: Update focus when unmanaged surfaces are mapped/unmapped
2022-09-09 15:48:14 +01:00
Consolatis
f057235a1f cursor: Make cursor_rebase() private
Also allow to re-use node, surface, sx and sy.
2022-09-08 01:32:22 +02:00
Consolatis
a0afd443f5 src/xwayland.c: Keep view->surface in sync 2022-09-06 22:03:17 +02:00
John Lindgren
7c6c018f43 cursor: Fix out-of-surface movement for unmanaged surfaces 2022-09-02 05:12:34 +02:00
Consolatis
2550c984f8 Move OSD handler for view destruction to osd.c 2022-08-28 20:40:49 +02:00
Consolatis
ca3c83aafc src/osd.c: Integrate preview outline into OSD state 2022-08-28 20:40:44 +02:00
Consolatis
15a5b710db alt-tab preview: restore functionality after move to scene-graph 2022-08-28 20:40:36 +02:00
Consolatis
296e58079f Prepare OSD for reimplementation of the preview feature 2022-08-28 20:40:29 +02:00
John Lindgren
b7c4ba825a view/ssd: Refactor and fix visual indication for active windows
Partially fixes #494.

Co-Authored-by: Consolatis
2022-08-27 06:58:20 +01:00
Consolatis
36b2a93a69 Disconnect view from destroying output
Fixes #497

Reported-by @Flrian
2022-08-24 20:24:19 +01:00
Consolatis
b39020213a src/osd.c: Add preview outlines 2022-08-20 22:40:31 +01:00
Johan Malm
52d1e32b59 view: view_move() s/double/int/ for x and y 2022-08-18 19:50:25 +01:00
Consolatis
921c877f79 src/cursor.c: Keep sending motion events for out-of-layer-surface
Previously, motion events for a cursor which had been pressed on a surface
and then moved out of the surface were only sent for XDG and X11 surfaces.

This patch includes layer surfaces as well.

Fixes #483
2022-08-16 19:31:16 +01:00
John Lindgren
5d0faa2333 xwayland: Process unmanaged client configure requests more quickly
This is a similar fix to 065c37d3f5 but for unmanaged windows.  The issue
could be seen for example when moving the undocked Search Tool window in
Audacious.  For unmanaged windows, we don't track any pending move/resizes,
so just process all client configure requests immediately.
2022-07-23 20:37:59 +02:00
Consolatis
819404c43b xwayland: (Re)set seat when xwayland is ready
For some reason wlroots will reset the seat assigned to xwayland
to NULL whenever Xwayland terminates. This patch restores the seat
whenever Xwayland is ready again.

Fixes #166
Fixes #444

Thanks @droc12345 for figuring out the actual issue.
2022-07-21 03:57:42 +02:00
John Lindgren
065c37d3f5 xwayland: Process move-only client configure requests more quickly
For a move-only client configure request, treat it similarly to
view_move() by updating the scene-graph immediately, rather than waiting
for handle_commit().  Move-and-resize requests are handled the same as
before.

This (mostly?) fixes the glitchiness that was noticeable when dragging
an undecorated XWayland window (e.g. Audacious in Winamp mode).

Also:

- Reduce some code duplication in handle_request_configure() by
  simply calling configure(), as suggested by @johanmalm in #428.
- Factor out common logic after a move and/or resize into view_moved().
2022-07-18 22:06:12 +01:00
John Lindgren
80792d446f (Partly) fix handling of client-initiated configure requests
- Add missing call to wlr_scene_node_set_position() in
  unmanaged_handle_commit() -- this fixes moving unmanaged XWayland
  windows.

- Update view->pending_move_resize when we receive a configure request
  for a managed XWayland surface -- this fixes moving managed but
  undecorated XWayland windows.

- Also update view->pending_move_resize when we move a surface while a
  configure request is already pending -- this fixes a discrepancy
  between displayed and actual position for XWayland windows that try to
  set their own initial position, but then get overridden by labwc's
  positioning.

Moving undecorated XWayland windows is still really glitchy -- it appears
that an XWayland window gets sent incorrect mouse motion coordinates when
there is a pending configure request moving the window itself.
2022-07-03 12:59:36 +01:00
Consolatis
5585977f72 Rename unmaximized_geometry to natural_geometry 2022-07-02 16:21:32 +01:00
Consolatis
3a4b55886d src/view.c: Convert SnapToEdge to use view_apply_xxx_geometry framework 2022-07-02 12:43:23 +01:00
Consolatis
f4aa6118e9 src/layers.c: Adjust views based on usable_area changes 2022-06-30 20:41:54 +01:00
Consus
ca56357b5f workspaces: Allow switching/sending to the last used workspace
Actions GoToDesktop and SendToDesktop now support the new direction
called "last" that corresponds to the last used workspace (see Openbox
help[1] for reference).

[1]: http://openbox.org/wiki/Help:Actions#GoToDesktop
2022-06-18 18:34:58 +02:00
Joshua Ashton
505b1edb98 Allow leasing desktop displays
Apps such as Gamescope eventually want to offer a DRM lease option to use planes and handle all of getting to the screen themselves.

This implements logic to allow leasing of desktop displays
2022-06-16 20:42:17 +01:00
Consolatis
d557623c34 workspaces: Add workspaces.{c,h} 2022-06-15 22:26:21 +02:00
Consolatis
37ca5c28c1 include/labwc.h desktop_cycle_view: Clarify signature 2022-06-15 16:14:02 +01:00
Consolatis
a0d1003f28 src/keyboard.c: Make any_modifier_pressed() global 2022-06-15 16:14:02 +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
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
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
73930f7e0f view: Refactor view destruction some more 2022-04-23 08:59:06 +01:00
Joshua Ashton
d0b9680d00 view: Refactor view destruction
Consolidates all of the view destruction code for xwl + xdg into one function.

Fixes several notable bugs along the way:
  - Fixes a crash when alt tabbing when a selected view gets destroyed.
  - Fixes the OSD not updating to reflect a view has been destroyed.
2022-04-22 01:58:52 +02:00
Johan Malm
b27955050f xdg-shell: remove view->padding
With the wlroots scene-graph API, the padding variable is no longer
needed for windows with Client Side Decoration (CSD).
2022-04-21 20:21:36 +01:00
Johan Malm
48c9e6fda0 osd: show alt-tab switcher center-aligned on all outputs
Fixes issue #283
2022-04-20 17:45:10 +01:00
Consolatis
6b4d9b9383 Add ToggleAlwaysOnTop action 2022-04-09 17:18:39 +01:00
Johan Malm
5b34c81768 Fix trivial coding style breaches 2022-04-04 20:53:36 +01:00
John Lindgren
8e1f115486 cursor: Fix "jumping opposite edges" issue when resizing
Commit 08c537e ("xwayland: Honor size increments from
WM_SIZE_HINTS") adjusted only the window width/height according
to the size hints.  If resizing from the top or left edge of the
window, we also need to adjust the window position to keep the
bottom or right edge from jumping around.
2022-04-04 17:28:52 +01:00
Joshua Ashton
57a937bdf2 output: Implement drm_lease_v1
Needed for VR to work properly.
2022-03-28 21:13:51 +01:00
bi4k8
4c3bae0794 implement touch support
this is mostly plumbing; the most interesting logic is in touch_get_coords
2022-03-21 21:06:41 +00:00
Consolatis
64f7b9dd2b Restore Drag mouse bindings and proper double click
Fixes #258 and #259

Reported-by: @ahmadraniri1994
Reported-by: @01micko
Suggested-by: bi4k8 <bi4k8@github>
2022-03-21 18:08:04 +00:00
Johan Malm
97846ae45b 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.

Fixes #162 and #225
Inspired by PR #164 - just restructured it a bit.

Suggested-by: @bi4k8
Co-authored-by: Consolatis <35009135+Consolatis@users.noreply.github.com>
2022-03-21 17:57:20 +00:00
Consolatis
befe66d93f cursor.c: Keep sending adjusted motion events while button is pressed
This allows to keep dragging a scrollbar or selecting text even when
moving outside of the window. Fixes #241
2022-03-21 17:56:48 +00:00