Commit graph

1319 commits

Author SHA1 Message Date
John Lindgren
a3fbb52bb0 seat: Fix use-after-free in touch_finish() 2022-09-16 21:41:38 +02:00
John Lindgren
086a887058 keyboard: Fix use-after-free in keyboard_finish() 2022-09-16 21:41:38 +02:00
John Lindgren
bbc6c6bb94 action: Select resize edges for Resize triggered by keybind 2022-09-16 01:42:04 +02:00
John Lindgren
f112fb636e cursor: Split out cursor_button_press() and cursor_button_release() 2022-09-16 01:36:07 +02:00
Johan Malm
84e64b9ce3 config: s/OSD/OnScreenDisplay/ in <theme><font place="OSD">
...to comply with Openbox 3.6 spec [1]

"OSD" is still honoured to maintain backward compatibility.

[1]: http://openbox.org/wiki/Help:Configuration#Theme
2022-09-16 01:15:11 +02:00
John Lindgren
07a83c19f0 config: Add support for font slant and weight 2022-09-15 21:48:05 +01: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
Consolatis
89890b6be9
Merge pull request #533 from jlindgren90/fix-gtk-menus
cursor: Fix GTK3 menus when keeping the button pressed
2022-09-14 06:03:17 +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
a8fbe1aac2 xdg-popup: Check for NULL from wlr_xdg_surface_from_wlr_surface()
Also eliminate struct view_child and replace it with a simple
(struct view *)parent_view field.
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
Consolatis
c8ddb0143c
Merge pull request #540 from jlindgren90/cursor-fixes
cursor: Factor out cursor_update_common() and fix some glitches
2022-09-13 20:55:32 +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
Johan Malm
4ba59f7074 rcxml.c: enable tap be default on non-touch devices
Some trackpads do not honour tap if we only enable it on touch-devices.
2022-09-11 21:26:32 +01: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
9b02021207 cursor: Don't load cursor theme in server_init()
We are already doing that in seat_init() -> cursor_init()
2022-09-11 21:20:00 +01:00
Consolatis
0deaeceb72 cursor: Prevent setting the same cursor image twice
Possibly fixes #512

Reported-by: @Flrian
2022-09-11 13:30:10 +01:00
Consolatis
7af74c88a8 cursor: Prevent resetting cursor icon during Move or Resize
Reported-by: @Flrian
2022-09-11 13:24:27 +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
1483158b26
Merge pull request #531 from jlindgren90/titlebar-fixes
Titlebar fixes
2022-09-09 21:35:30 +01:00
John Lindgren
48fde32e62 ssd: Make ssd_get_part_type() work for corner buttons
Corner buttons (WINDOW_MENU and CLOSE) are one more level down in
the scene-tree (see add_scene_button_corner() in ssd_part.c).

This fixes a minor issue where, when right-clicking on the CLOSE
button, the client-menu would be displayed in the wrong location.
2022-09-09 15:23:13 -04:00
John Lindgren
ebd0a5d526 config: Redefine Title context to include blank areas of Titlebar
... and use Title for the Drag (Move) and DoubleClick (Maximize)
titlebar actions, which are unexpected when the cursor is over one
of the window buttons.
2022-09-09 15:23:13 -04: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
Johan Malm
f47de15f98
Merge pull request #526 from Consolatis/issue/317_gimp_remap
xwayland: Keep view->xwayland_surface and view->surface in sync
2022-09-09 15:32:14 +01:00
John Lindgren
d5e2728c7f interactive: Don't write to view->x/y/w/h directly
Otherwise, the scene-graph isn't updated when calling
view->impl->configure(), and the view ends up in a weird
half-maximized state.
2022-09-08 20:08:03 -04:00
Consolatis
2bbd882df9 cursor: Update cursor focus on scroll events 2022-09-08 01:32:22 +02: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
601a6250b7 cursor: Allow cursor button events to trigger cursor_rebase() 2022-09-08 01:32:22 +02:00
Consolatis
bc4ce1bd5d src/xdg.c: Only call view_moved() when required 2022-09-08 01:32:22 +02: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
John Lindgren
ec2522fec8 cursor: Update SSD hover state in cursor_rebase()
Fixes an issue where the maximize button would remain highlighted
after maximized a window.
2022-09-06 18:22:17 -04:00
John Lindgren
469adc46d6 cursor: Update focus at various additional points
- When XDG and XWayland views are positioned (view_moved()).
- When unmanaged XWayland surfaces are mapped, unmapped, or moved.

Do not update cursor focus during an out-of-surface drag.

Along with the existing call in desktop_move_to_front(), this
should hopefully cover the majority of cases where the cursor focus
could get out-of-date, with the possible exception of layer-shell
surfaces.
2022-09-06 18:22:17 -04:00
Consolatis
a0afd443f5 src/xwayland.c: Keep view->surface in sync 2022-09-06 22:03:17 +02:00
Consolatis
01e832b4a8 src/xwayland.c: Update xsurface on client map request 2022-09-06 22:03:17 +02:00
John Lindgren
2e81cc13d4 xwayland: Don't center views with explicitly specified position 2022-09-06 13:39:22 +02:00
John Lindgren
b8096b1bab view: Call view_moved() immediately after map
At least for XWayland surfaces, handle_commit() is not always
called after map(), and as a result, the scene-graph node is never
positioned.

Not sure 100% if the same can occur with XDG surfaces, but the
extra view_moved() call should be harmless, so add it there too
for consistency.
2022-09-06 13:39:22 +02:00
John Lindgren
05b7afd05a xwayland: Factor out focus_next_surface() from unmanaged_handle_unmap()
- Eliminate multiple "return" paths in unmanaged_handle_unmap(), which
  were a bug waiting to happen.
- Use wl_list_for_each_reverse() rather than wl_list_for_each() to find
  the topmost (most-recently-created) unmanaged surface.
- Only call desktop_focus_topmost_mapped_view() if the unmapped surface
  was actually focused.
2022-09-03 19:31:20 +02:00
Consolatis
d405a2b3c6 CI: Split jobs 2022-09-02 06:11:01 +02:00
Consolatis
7f42dc921c CI: Additionally build without xwayland 2022-09-02 06:11:01 +02:00
John Lindgren
7c6c018f43 cursor: Fix out-of-surface movement for unmanaged surfaces 2022-09-02 05:12:34 +02:00
John Lindgren
f7b1bc1de8 xwayland: Keep unmanaged surfaces stacked on top 2022-09-01 21:07:04 +02:00
Consolatis
9c271d792d src/xwayland-unmanaged.c: Give keyboard focus back to topmost mapped view
Previously, when unmapping and not finding another unmanaged surface
to give keyboard focus to we were not doing anything. With this patch
we will give focus to the topmost mapped view which is the same
behavior that also happens when an usual X11 surface unmaps.

This fixes dmenu when being exited with ESC.

Reported-by: @Flrian
2022-08-30 19:20:58 +01:00
Consolatis
ea6007d34c src/config/rcxml.c: Add support for <devault /> mousebinds
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 <devault />
element is not provided.

Example usage (with a slight spelling error):

  <mouse>
    <default />
    <context name="Root">
      <mousebind button="Right" action="Press">
        <action name="ShowMenu" menu="desktop-menu" />
      </mousebind>
    </context>
  </mouse>

Co-Authored-By: @johanmalm

Fixes #416
2022-08-30 16:39:09 +01:00
Consolatis
3afd666cc4 src/config/rcxml.c: Replace earlier mousebinds by later ones 2022-08-30 16:39:09 +01:00
Consolatis
99237cc232 src/config/mousebind.c: Fix mousebind ordering 2022-08-30 16:39:09 +01:00
Consolatis
7b995788ee src/config/rcxml.c: Merge default mousebinds 2022-08-30 16:39:09 +01:00
Consolatis
ce5e7e153c src/view.c: Fix minimizing the last window
Before this patch, minimizing the last un-minimized window would
not cause it to be set to inactive. This in turn would confuse panels
which depend on the 'active' flag to decide when to either activate or
minimize the clicked on window.

Reported-by: @Flrian
Predicted-by: @johanmalm
2022-08-30 10:44:01 +01:00
Johan Malm
adc1e0876d
Merge pull request #307 from Consolatis/feature/tab_preview
Feature/tab preview: restore functionality after the move to scene-graph
2022-08-28 22:20:53 +01:00
Consolatis
2550c984f8 Move OSD handler for view destruction to osd.c 2022-08-28 20:40:49 +02:00