Commit graph

87 commits

Author SHA1 Message Date
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
Johan Malm
62d93d54c5 rcxml: refactor mousebind implementation 2021-09-06 21:54:00 +01:00
alex
92891b4dfa change mousebind code to use already existing enums
Also added an #include statement to ssd.h so it would compile without
depending on other headers to be #included before it
2021-09-01 07:05:37 +01:00
alex
36f5b49f2a Implemented <doubleClickTime> in rc.xml 2021-09-01 07:05:37 +01:00
alex
dfdb4e4b0e First implemenation of <mouse> in rc.xml
Can successfully parse the following XML and and implement the action:

<mouse>
    <context name="TitleBar">
        <mousebind button="Left" action="DoubleClick">
            <action name="ToggleMaximize"/>
        </mousebind>
    </context>
</mouse>

The XML parsing code for this looks A LOT different than the already
existing XML parsing code. It may have to be reworked
2021-09-01 07:05:37 +01:00
Johan Malm
a9042e3cde Fix coding style following 824282dd 2021-08-25 19:59:49 +01:00
Daniel Barlow
39b1d92f9b implement input_inhibit protocol, needed for swaylock
this is in "it appears to work" state, though I blindly copy-pasted a little
more code than I'm happy with, so might benefit from a review
2021-08-22 21:30:42 +01:00
Daniel Barlow
804384368c add support for primary selection 2021-08-18 23:42:56 +01:00
Johan Malm
f857aea8f4 ssd: add application title to title bar 2021-08-07 09:35:53 +01:00
Johan Malm
9cf0608aba foreign: handle minimize request 2021-08-05 13:00:34 +01:00
Johan Malm
6a5deb628e cursor: handle double click on title 2021-08-02 17:30:34 +01:00
Johan Malm
526ab1ae75 view: add view_toggle_maximize() 2021-08-02 16:49:41 +01:00
Johan Malm
fc542e6da1 cursor: simplify process_cursor_motion()
...by using wlr_xcursor_get_resize_name() instead of handling each
'resize_edge' case.
2021-07-30 14:26:54 +01:00
Johan Malm
399322052b ssd: add ssd_interactive_box()
...which is used by desktop_view_at() and ssd_at() to determine which
decoration part is under the cursor.

ssd_interactive_box() allows deocoration parts to extend outside the
visible regions, and therefore supports a wider 'resize-edges' area than
the border itself.
2021-07-26 20:06:52 +01:00
Johan Malm
82e47ac1f5 Remove src/common/log.c
Use wlr_log() instead
2021-07-23 21:15:55 +01:00