seat: select drag-and-drop action from keyboard modifiers#3037
Open
coffeejunk wants to merge 1 commit into
Open
seat: select drag-and-drop action from keyboard modifiers#3037coffeejunk wants to merge 1 commit into
coffeejunk wants to merge 1 commit into
Conversation
e908c66 to
f042090
Compare
ammen99
reviewed
Jun 3, 2026
| std::unique_ptr<wf::drag_icon_t> drag_icon; | ||
| // Is dragging active. Note we can have a drag without a drag icon. | ||
| bool drag_active = false; | ||
| // The active drag, valid while drag_active. Its source may be NULL. |
Member
There was a problem hiding this comment.
If we store the active_drag object, then we don't need drag_active at all. The latter should be removed, and all the places that use it can simply compare the active drag against a null pointer (or, if you prefer, you could add a helper function is_drag_active() which does the check). Otherwise lgtm.
The `drag_handle_keyboard_modifiers` implementation in [wlroots](https://gitlab.freedesktop.org/wlroots/wlroots/-/raw/master/types/data_device/wlr_drag.c) is empty, so `ctrl`/`shift` have no effect on a drag. ```c static void drag_handle_keyboard_modifiers(struct wlr_seat_keyboard_grab *grab, const struct wlr_keyboard_modifiers *modifiers) { //struct wlr_keyboard *keyboard = grab->seat->keyboard_state.keyboard; // TODO change the dnd action based on what modifier is pressed on the // keyboard } ``` Separately, it was stated that this should be implemented by the compositor swaywm/sway#8219 (comment) Map the modifiers to `wlr_data_source::compositor_action` on each modifier's event while a drag is active: `ctrl` copies, `shift` moves, `ctrl+shift` asks.
f042090 to
05c2956
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
drag_handle_keyboard_modifiersimplementation in wlroots is empty, soctrl/shifthave no effect on a drag.Separately, it was stated that this should be implemented by the compositor swaywm/sway#8219 (comment)
Map the modifiers to
wlr_data_source::compositor_actionon each modifier's event while a drag is active:ctrlcopies,shiftmoves,ctrl+shiftasks.As an example, Thunar:
Without the patch, dragging a file between two windows while pressing
CTRLmoves it:no-dnd-modifier.mp4
With the patch applied, dragging a file between two windows while pressing
CTRLcopies it:dnd-modifier.mp4