Commit graph

1333 commits

Author SHA1 Message Date
John Lindgren
7233495c3a output: Call do_output_layout_change() at end of new_output_notify().
This fixes an issue with the wlr_output_cursor not being properly
initialized on new outputs, because wlr_output_layout.events.change
is triggered too soon, before the wlr_output_cursor exists.
2022-09-21 07:33:00 +02:00
Consolatis
dcedfee5d1 src/menu.c: Clamp separator width
Reported-by: @Flrian
2022-09-20 21:06:31 +01:00
Johan Malm
ffb2efe733 src/keyboard.c: reflow comment to shorten line 2022-09-20 20:52:48 +01:00
Johan Malm
e1467b9aac src/keyboard.c: stored handled keys as bound when window-cycling
...and changing TTY
2022-09-20 20:52:48 +01:00
Johan Malm
a363f73e02 Revert "keyboard: cancel repeat when handling key-bind"
This reverts commit e62bb51bfb.

Fixes #510
2022-09-20 20:52:48 +01:00
Consolatis
87fe6878a3
Merge pull request #552 from jlindgren90/xmalloc
common: Add more friendly memory utilities
2022-09-19 05:43:55 +02:00
John Lindgren
8f585362c1 common: Expand comment for znew/znew_n() 2022-09-18 17:30:53 -04:00
John Lindgren
a54d378e6c common: Add znew/znew_n() macros 2022-09-18 15:25:19 -04:00
John Lindgren
898a583522 keyboard: Fix SIGSEGV that showed up in out-of-memory fuzzing
Stack trace:

    #0  xkb_keymap_ref (keymap=keymap@entry=0x0) at ../libxkbcommon/src/keymap.c:61
    #1  0x00007f53a344ab99 in wlr_keyboard_set_keymap (kb=kb@entry=0x5571af8cb9a0, keymap=keymap@entry=0x0)
        at ../types/wlr_keyboard.c:174
    #2  0x00005571ade057e0 in keyboard_init (seat=0x7ffca0389680) at ../src/keyboard.c:229
    #3  seat_init (server=0x7ffca0389570) at ../src/seat.c:307
    #4  server_init (server=0x7ffca0389570) at ../src/server.c:308
2022-09-18 06:05:16 +02:00
John Lindgren
da57483961 action: Fix warning about freeing a (const char *) 2022-09-17 10:57:30 -04:00
John Lindgren
cb40cdc36c common: Add additional memory utilities (xzalloc() etc.) 2022-09-17 10:57:30 -04:00
John Lindgren
b89f7bfc0d action: Allow explicit None action without warning 2022-09-16 22:06:29 +01:00
Consolatis
e30fce6c34 cursor: Use enum for server set cursor names
This mainly prevents having to use strcmp() on every mouse move.
2022-09-16 21:30:40 +01:00
Consolatis
f491942858 cursor: Move cursor specific function definitions into cursor.h 2022-09-16 21:30:40 +01:00
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