Commit graph

201 commits

Author SHA1 Message Date
Johan Malm
3c92cc4dd0 Move action() prototype from labwc.h to action.h 2022-01-05 21:27:47 +00:00
Consolatis
0b45cce648 Rewrite action handling to allow multiple actions at once 2022-01-05 16:22:41 +00:00
Johan Malm
f7b63f264e cursor.c: fix coding style
Open brace '{' following function definitions go on the next line
2022-01-02 15:51:40 +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
Johan Malm
310c36c86d Fix build on Alpine Linux
Issue #144

Add `#define _POSIX_C_SOURCE 200809L` to avoid the error below:

../src/cursor.c: In function 'cursor_update_focus':
../src/cursor.c:271:2: warning: implicit declaration of function
'clock_gettime' [-Wimplicit-function-declaration]
  271 |  clock_gettime(CLOCK_MONOTONIC, &now);
      |  ^~~~~~~~~~~~~
../src/cursor.c:271:16: error: 'CLOCK_MONOTONIC' undeclared (first use in
this function)
  271 |  clock_gettime(CLOCK_MONOTONIC, &now);
      |                ^~~~~~~~~~~~~~~
../src/cursor.c:271:16: note: each undeclared identifier is reported only
once for each function it appears in
../src/cursor.c: In function 'is_double_click':
../src/cursor.c:486:16: error: 'CLOCK_MONOTONIC' undeclared (first use in
this function)
  486 |  clock_gettime(CLOCK_MONOTONIC, &now);
      |                ^~~~~~~~~~~~~~~
2021-12-28 15:06:33 +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
8d070ab2f4 cursor: fix setting of resize_edges
Only calculate nearest `resize_edges` if not clear from the server-side
deco under the cursor.
2021-12-26 21:35:37 +00:00
bi4k8
26d3d13a82 move edge resizing from hard-coded to configuration 2021-12-26 21:31:11 +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
2cb055b94a cursor.c: fix switch statement indentation 2021-12-03 23:17:12 +00: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
f9f9d809c8 cursor: Clear grabbed_view when switching from MOVE/GRAB
Better not to leave a dangling pointer to screw us over later.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-12-03 18:11:31 +00:00
bi4k8
a9f11c5fc7 move window raise/focus on click from hard-coded logic to default mouse binding 2021-12-03 06:46:43 +00:00
bi4k8
3a3b484898 replace hard-coded ShowMenu on root button press with mouse binding trigger 2021-12-03 06:46:43 +00:00
bi4k8
24215a3085 correctly detect when cursor is over titlebar
this was broken when we added ssd_part_types other than NONE that are not decoration
2021-12-03 06:42:04 +00:00
bi4k8
54e99cd240 forward click events to layer surfaces
this was broken when we moved to swallowing mouse events that triggered "Frame"-context mouse bindings. layer surfaces don't run mouse binding logic, so they need mouse events unconditionally forwarded.
2021-12-02 18:53:15 +00:00
bi4k8
a94fb3b225 fix interaction between Move action and click bindings
in order to allow the Move action to be bound to "press" on mouse binding contexts that also have "click" bindings, we should not short-circuit event processing when the input_mode is not passthrough (the "normal" mode). doing so seems to have been intended to prevent mouse bindings from being triggered during move/resize/menu interactions, but this does not seem to occur in practice. instead, `cursor_button`'s early return in this case caused the "release" side of "click" bindings to be ignored if their "press" side began an action that changes input_mode (e.g. Move).

the cleaner way to fix this interaction would be to use "drag" rather than "press" for Move bindings, but implementing "drag" is more complexity than I want to include in this changeset.

this change is its own commit to make it easy to bisect for, in case it causes regressions.
2021-12-02 17:58:31 +00:00
bi4k8
d8bbb751d2 handle mouse release bindings on root window 2021-12-02 17:58:31 +00:00
bi4k8
347e6115e3 swallow mouse events only when bindings on Frame mouse contexts are triggered 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
ef49d2c843 be stricter about what counts as a double-click 2021-12-01 07:57:33 +00:00
Johan Malm
9eaa5a92a1 cursor: support XCURSOR_THEME and XCURSOR_SIZE
Use environment variables XCURSOR_THEME and XCURSOR_SIZE to set cursor
theme and size respectively. Default size is 24.

Find icons themes with the command below or similar:

    find /usr/share/icons/ -type d -name "cursors"
2021-11-28 22:50:37 +00: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
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
ARDiDo
aa9720f627 Add support for basic idle and idle inhibitor protocols 2021-11-22 21:58:07 +00:00
ARDiDo
6b948c7106 mousebind: add support for more contexts and mouse events 2021-11-02 18:14:50 +00:00
ARDiDo
91a9f1dec9 resistance: remove bool, add resistance.h + license 2021-10-26 21:15:13 +01:00
ARDiDo
4d5b4be608 resistance: improve readability 2021-10-26 21:15:13 +01:00
ARDiDo
ac58ab10a7 resize resistance support 2021-10-26 21:15:13 +01:00
ARDiDo
a24e17dea7 Improve expandibility 2021-10-26 21:15:13 +01:00
Johan Malm
b1beab473c cursor: do not crash on layer popup/subsurfaces 2021-10-21 20:37:30 +01:00
Johan Malm
40da2f34a5 view: check view->impl functions exist before using
Avoids segfault when using disappearing notification in Thunderbird
2021-10-18 19:35:41 +01:00
Joshua Ashton
95f583ba6b cursor: Don't trigger cursor modifiers if we have a constraint
We are probably playing a game and we don't want to be resizing the window when trying to duck/jump whatever.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-10-17 23:23:39 +01:00
Joshua Ashton
398cad692d cursor: Fix modifier button check
Previously any modifier would trigger this due to &ing the wrong value.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-10-17 23:23:39 +01:00
Joshua Ashton
7e4e579c37 cursor: Handle absolute motion for relative_pointer
Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-10-17 23:21:27 +01:00
ARDiDo
f5072151a9 add pointer constraints 2021-10-17 22:32:25 +01:00
Joshua Ashton
1db6c54e59 cursor: Handle min size better
Less janky than just returning if one extent reaches max, and also uses the new min_size function for xwayland hint support.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-10-17 19:49:05 +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
6a00166cff Merge branch 'master' of https://github.com/johanmalm/labwc 2021-10-04 06:24:34 +01:00
ARDiDo
6bf3bb97f5 implement basic drag and drop 2021-10-03 21:50:29 +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
d2375b025d Fix coding style 2021-09-24 22:04:03 +01:00
Johan Malm
ebb632419b *.c: add SPDX-License-Identifier 2021-09-24 21:45:48 +01:00
Johan Malm
0413d7fa9a cursor: make cursor_motion() static 2021-09-24 20:53:22 +01:00
Johan Malm
cce3c8cda0 src/: fix coding style 2021-09-21 22:05:56 +01:00