Commit graph

269 commits

Author SHA1 Message Date
bi4k8
0fb33066e9 support wlr-output-power-management
Backport of c23397f362
2022-06-14 05:25:04 +02:00
Johan Malm
03c6f23d6d 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.

Backport of 81f216b6a2
2022-06-03 19:35:07 +01:00
Consolatis
cc0e2769d9 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
Fixes #347

Backport of 6dd290afc9
2022-05-29 19:52:14 +01:00
John Lindgren
a50d27c770 cursor: Fix "jumping opposite edges" issue when resizing.
Commit ec68806354 ("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:30:20 +01:00
Consolatis
a52feadaa7 Restore Drag mouse bindings and proper double click
Fixes #258 and #259

Reported-by: @ahmadraniri1994
Reported-by: @01micko
Suggested-by: bi4k8 <bi4k8@github>
2022-02-27 22:18:41 +00:00
Johan Malm
ce38d2dbd6 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-02-26 20:23:55 +00:00
Consolatis
00b2925461 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-02-26 20:22:49 +00:00
ARDiDo
7c437eac2f OSD: Use separate OSD texture for each output 2022-02-09 21:57:32 +00:00
ARDiDo
049b84409e OSD: Scale OSD to the largest output scale 2022-02-09 21:57:32 +00:00
Consolatis
413811f3a2 Use proper enum argument type for desktop_surface_and_view_at 2022-01-30 21:23:15 +00:00
Consolatis
7ecae4afce Move is_button() into src/ssd.c and make it public 2022-01-30 21:23:15 +00:00
Consolatis
b7b1e8064f Add WindowMenu button 2022-01-26 06:17:41 +00:00
Consolatis
759b26b5c1 Add window menu 2022-01-26 06:17:41 +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
Liam Middlebrook
875b258602 output: Add option to preview the contents of the current cycle_view
Add the 'cycleViewPreview.core' option to rc.xml to enable previews of
the selected view when cycling between windows. Default this option to
be disabled to match current behavior.
2022-01-23 16:02:54 +00:00
Consolatis
f0a3f365e5 Centralize freeing of action lists
Reduces some code duplication and makes it easier to extend struct action
2022-01-23 10:36:04 -05:00
Consolatis
87f4a60e38 Allow mouse movements to trigger SnapToEdge 2022-01-08 10:30:03 +00:00
ARDiDo
5935a78fb4 mouse: add support for drag mouse event 2022-01-07 22:05:07 +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
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
Consolatis
f28319be54 config/keybind.c: Don't overwrite the stack 2022-01-03 08:27:22 +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
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
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
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
2d98179b31 xdg: Implement request_minimize
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
Consolatis
fa18f347e5 config/rcxml: Allow multiple <action>s inside of a <mousebind>
Issue arises when using the default config from docs/rc.xml.all.
Without this patch only the last action defined inside a <mousebind>
will have an effect.

Without a config or when defining the same <mousebind> multiple times
with each containing only a single <action> the issue does not exist.
2021-12-23 09:53:11 -05:00
Consolatis
80f012602f Implement foreign toplevel close 2021-12-23 09:29:08 -05:00
Johan Malm
7e57b7fcf5 keyboard: absolve release event if press was bound
When key press events are handled by compositor keybindings, do not
forward the corresponding release events to clients.
2021-12-22 10:37:25 -05:00
bi4k8
a3796fa6f3 implement libinput tapButtonMap setting
this is a standard libinput setting that was not previously exposed
2021-12-12 19:00:58 -05:00
ARDiDo
859495a8be Config: add OSD font configuration 2021-12-06 17:44:28 -05: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
bi4k8
7b7178ebfa move windows to back of cycle when they are minimized 2021-12-06 09:59:06 -05:00
Joshua Ashton
d568c60003 action: If we have a view that is an activator, use that instead of the current focus window
If we don't switch focus, we want the close button to close the window associated with it, not the current focus window.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-12-03 18:13:30 +00:00
Joshua Ashton
3e973c92ab interactive: Fix crash if a window is destroyed while moving it
Need to clean this up if it's our grabbed window!

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-12-03 18:11:31 +00:00
bi4k8
0be4625c1c implement foreign toplevel activate 2021-12-03 06:43:34 +00:00
bi4k8
d84103d669 define ssd_part_contains to define the mouse context subset relation 2021-12-02 17:58:31 +00:00
bi4k8
b008917895 implement handling for Client, Frame, and Root/Desktop (conflated for now) mouse contexts 2021-12-02 17:58:31 +00:00
bi4k8
031ced85ef implement Resize as an action
this requires action() to know the resize edges to use, so thread them through
2021-12-01 22:45:20 +00:00
bi4k8
8eab1e8132 parse and respect modifiers for mouse bindings 2021-12-01 15:11:21 -05:00
bi4k8
c34a2fc976 make parse_modifiers public 2021-12-01 15:11:21 -05:00
Johan Malm
afa299c080 cursor.c: rebase cursor when exiting interactive mode
cursor_rebase() sets the cursor icon and sends a motion-event to the
surface below the cursor. It is made public in anticipation of using it
in various view_* functions.
2021-11-28 22:14:23 +00:00
Johan Malm
1c831bc051 interactive.c: set move/resize cursor
Fixes issue #124
2021-11-28 21:47:24 +00:00
Johan Malm
d50c2f2eac Fix minor style violations 2021-11-26 19:27:50 +00:00
Johan Malm
bca57213a0 Remove min/max macros
...and replace with a local MAX macro, because:

- They contain a ({}) construct which is a GNU extension and that's
  against Drew's coding style
- min() is not used anyway
- MAX() clashes with cairo's macro, so best to not add this in labwc.h
2021-11-26 19:16:00 +00:00