Skip to content

Commit e796cfc

Browse files
committed
Allow moving windows by their SSDs (no resizing)
1 parent b9d8619 commit e796cfc

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/input/cursor.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,15 @@ static void cursor_button_notify(wl_listener* listener, void* data) {
194194
cursor.reset_mode();
195195
}
196196
} else if (magpie_surface != nullptr && magpie_surface->is_view()) {
197+
auto view = std::dynamic_pointer_cast<View>(magpie_surface);
198+
197199
/* Focus that client if the button was _pressed_ */
198200
server.focus_view(std::dynamic_pointer_cast<View>(magpie_surface));
201+
202+
203+
if (server.ssd_at(cursor.wlr.x, cursor.wlr.y)) {
204+
view->begin_interactive(MAGPIE_CURSOR_MOVE, 0);
205+
}
199206
} else {
200207
server.focus_view(nullptr);
201208
}

src/surface/view.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,9 @@ void View::begin_interactive(const CursorMode mode, const uint32_t edges) {
108108
Server& server = get_server();
109109

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

113-
if (focused_surface == nullptr || get_wlr_surface() != wlr_surface_get_root_surface(focused_surface)) {
113+
if (focused_view == nullptr || get_wlr_surface() != wlr_surface_get_root_surface(focused_view->get_wlr_surface())) {
114114
/* Deny move/resize requests from unfocused clients. */
115115
return;
116116
}

0 commit comments

Comments
 (0)