Skip to content

Commit

Permalink
Allow moving windows by their SSDs (no resizing)
Browse files Browse the repository at this point in the history
  • Loading branch information
serebit committed Aug 27, 2024
1 parent b9d8619 commit e796cfc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 7 additions & 0 deletions src/input/cursor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,15 @@ static void cursor_button_notify(wl_listener* listener, void* data) {
cursor.reset_mode();
}
} else if (magpie_surface != nullptr && magpie_surface->is_view()) {
auto view = std::dynamic_pointer_cast<View>(magpie_surface);

/* Focus that client if the button was _pressed_ */
server.focus_view(std::dynamic_pointer_cast<View>(magpie_surface));


if (server.ssd_at(cursor.wlr.x, cursor.wlr.y)) {
view->begin_interactive(MAGPIE_CURSOR_MOVE, 0);
}
} else {
server.focus_view(nullptr);
}
Expand Down
4 changes: 2 additions & 2 deletions src/surface/view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,9 @@ void View::begin_interactive(const CursorMode mode, const uint32_t edges) {
Server& server = get_server();

Cursor& cursor = server.seat->cursor;
wlr_surface* focused_surface = server.seat->wlr->pointer_state.focused_surface;
auto focused_view = server.focused_view.lock();

if (focused_surface == nullptr || get_wlr_surface() != wlr_surface_get_root_surface(focused_surface)) {
if (focused_view == nullptr || get_wlr_surface() != wlr_surface_get_root_surface(focused_view->get_wlr_surface())) {
/* Deny move/resize requests from unfocused clients. */
return;
}
Expand Down

0 comments on commit e796cfc

Please sign in to comment.