Commit graph

88 commits

Author SHA1 Message Date
Consolatis
89ad0b808f s/wl_list_insert(list.prev...)/wl_list_append(list...)/ 2022-10-05 19:50:36 +01:00
Consolatis
92976f30d0 src/osd.c: Ensure destroying views are not used as preview anchors 2022-09-27 17:35:10 +01:00
Consolatis
c83c1beace src/osd.c: Prevent showing invalid windows
This might happen when closing the last
application "to tray" like VLC, Discord or Steam.

Reported-by: @Flrian
2022-09-27 17:35:10 +01:00
Johan Malm
d424514e24 Fix minor coding-style violations
...based on https://github.com/johanmalm/checkpatch.pl
2022-09-22 22:39:44 +01: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
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
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
John Lindgren
79d9cfcda6 desktop: Cycle first to topmost view if not already focused
The topmost view may not always be the focused view; for example,
when Audacious's main window is focused but the floating Search
Tool window remains on top of it.  In that case the floating window
(not the main window) should be the first view selected in the
window switcher.
2022-09-07 00:27:03 +02:00
Consolatis
15a5b710db alt-tab preview: restore functionality after move to scene-graph 2022-08-28 20:40:36 +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
f4aa6118e9 src/layers.c: Adjust views based on usable_area changes 2022-06-30 20:41:54 +01:00
Consolatis
8c5157a098 workspaces: Wire up workspaces 2022-06-15 22:26:21 +02:00
Consolatis
ca9226a7a6 src/ssd: Convert button node descriptors to struct ssd_button
This allows for way easier button hover detection and future
features like toggling rounded corner buttons on maximize.
2022-06-09 22:04:35 +01:00
Consolatis
f1ada7e407 src/ssd: Use LAB_SSD_PART_CORNER_x for rounded corner backgrounds
This matches the behavior of the surrounding borders and will usually
cause resizing instead of triggering the button itself. This effect
is only really visible when using a border width settings of > 1.

Fixes #379
2022-06-09 22:04:35 +01:00
Consolatis
2ed7a10779 Chase wlroots: every scene_node parent is now a tree
Chases wlroots ccd0f85c2a36308e35b153c7f9653abac7659af3
wlr_scene: Only allow parenting on a wlr_scene_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
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
Johan Malm
48c9e6fda0 osd: show alt-tab switcher center-aligned on all outputs
Fixes issue #283
2022-04-20 17:45:10 +01: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
8444ba4075 Convert menu to node_descriptors 2022-03-03 17:49:54 +00:00
Johan Malm
30298228e3 Rename node-descriptor.c to node.c
...in anticipation of adding helpers like node_view_from_node()
2022-03-02 21:07:04 +00:00
Consolatis
51e02e2afa src/desktop.c: Fix label error
Fixes "a label can only be part of a statement
and a declaration is not a statement".
2022-03-02 20:43:59 +00:00
Johan Malm
bd9ac3478a Remove src/damage.c 2022-03-01 20:54:52 +00:00
Johan Malm
cec0c5cee6 desktop.c: set *view_area right for layer-popup 2022-02-26 23:30:02 +00:00
Johan Malm
2891ff245e Add node-descriptor for wlr_scene_nodes
Support identification of wlr_scene_node role to enable simplification
of codebase including the avoidance of iterating over lists of
layer-surface, menuitems, and so on.

Use node-descriptors for xdg toplevels and popups
2022-02-26 22:35:51 +00:00
Consolatis
a2523081e2 Handle 'lost' unmanaged xsurfaces + improve cursor handling 2022-02-23 21:47:01 +00:00
Consolatis
5862b65f89 Convert SSD to scene nodes 2022-02-23 21:47:01 +00:00
Consolatis
f2d40a8d69 Scene Menu 2022-02-23 21:47:01 +00:00
Consolatis
7ea733761b Use view->scene_tree as toplevel for view + some legwork:
desktop.c move_to_front() calls wlr_scene_node_raise_to_top
desktop.c, ssd/include.h add LAB_SSD_{OSD, MENU, LAYER_SURFACE} enums
desktop.c desktop_surface_and_view_at() -> desktop_node_and_view_at()
cursor.c reenable cursor_rebase()
cursor.c reenable button click on layer surface
2022-02-23 21:47:01 +00:00
Johan Malm
532656ad5b Use wlroots scene-graph API
Move xdg-shell and xwayland-shell surfaces to new API

Also render alt-tab on-screen-display by converting cairo-surface to
wlr_buffer
2022-02-23 21:46:48 +00:00
Consolatis
413811f3a2 Use proper enum argument type for desktop_surface_and_view_at 2022-01-30 21:23:15 +00:00
Johan Malm
2652522a70 cursor: revert 6651d; remove cursor_update_focus()
...to ensure new windows receive keyboard focus even if the cursor is
over an existing window.

Fix issue #210
2022-01-24 17:51:54 +00:00
Johan Malm
4964ecd80c desktop: correctly forward cursor motion-event to layer-popup surfaces
...in preference to views and other layer surfaces (except those in the
OVERLAY layer which always go first)

Fixes issue #207 where a BOTTOM layer popup lost mouse focus when a
terminal was behind it.
2022-01-10 18:08:27 +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
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
Johan Malm
34a12b3515 Fix coding style 2021-12-26 23:29:01 +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
238062a859 desktop: rename functions to increase consistency
...from
- desktop_raise_view()
- desktop_move_view_to_end_of_cycle()

to
- desktop_move_to_front()
- desktop_move_to_back()
2021-12-06 21:23:49 +00:00
Johan Malm
10884ca2e9 desktop: simplify desktop_move_view_to_end_of_cycle() 2021-12-06 21:07:08 +00:00
bi4k8
7b7178ebfa move windows to back of cycle when they are minimized 2021-12-06 09:59:06 -05:00
bi4k8
347e6115e3 swallow mouse events only when bindings on Frame mouse contexts are triggered 2021-12-02 17:58:31 +00:00
Johan Malm
d50c2f2eac Fix minor style violations 2021-11-26 19:27:50 +00:00
John Lindgren
c01d1f124c Basic support for Move action
- Add Move as a default mouse binding for a Titlebar Press action
- Remove the hard-coded handling in cursor_button()

Example config snippet:

    <mouse>
      <context name="Titlebar">
        <mousebind button="Left" action="Press">
          <action name="Focus"/>
          <action name="Raise"/>
          <action name="Move"/>
        </mousebind>
      </context>
    </mouse>
2021-11-26 18:25:04 +00:00
Johan Malm
08a54bd3f5 desktop: use correct coordinates layer_surface_at()
Use output coordinates rather than layout coordinates in order to
correctly handle pointer button event on multi-output setup.
2021-10-20 20:57:12 +01:00
Joshua Ashton
846ccb9eb9 action: Implement shift to go backwards in OSD
Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-10-18 17:28:34 +01:00
Johan Malm
4d44659c08 desktop: remove deprecated functions
- set_activated()
- desktop_set_focus_view_only()
2021-10-16 19:53:00 +01:00
Johan Malm
9a290feeea desktop: simplify interface for view raise/focus
Split desktop_focus_view() into the following two functions:
  - desktop_focus_and_activate_view()
  - desktop_raise_view()

Always call view_set_activated() rather than using the private
set_activated(). This keeps the code cleaner and ensures
wlr_foreign_toplevel_handle_v1_set_activated() is called.
2021-10-16 19:44:54 +01:00
Johan Malm
1e4598cdce s/desktop_view_at()/desktop_surface_and_view_at()/
Make is clearer what the function does.
2021-09-25 10:04:37 +01:00
Johan Malm
23f28e5082 desktop: desktop_view_at() set *surface correnctly
Bug introduced in 23107
2021-09-25 09:40:23 +01:00