Skip to content

Commit

Permalink
Fix segfault when clicking on a non-View
Browse files Browse the repository at this point in the history
  • Loading branch information
serebit committed Oct 13, 2023
1 parent b49aeea commit 16b4b7b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/input/cursor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,15 +136,15 @@ static void cursor_button_notify(wl_listener* listener, void* data) {
double sx, sy;
wlr_surface* surface = NULL;
Surface* magpie_surface = server.surface_at(cursor.cursor->x, cursor.cursor->y, &surface, &sx, &sy);
auto* magpie_view = dynamic_cast<View*>(magpie_surface);

if (event->state == WLR_BUTTON_RELEASED) {
/* If you released any buttons, we exit interactive move/resize mode. */
if (cursor.mode != MAGPIE_CURSOR_PASSTHROUGH) {
cursor.reset_mode();
}
} else if (magpie_view != nullptr) {
} else if (typeid(magpie_surface) == typeid(View*)) {
/* Focus that client if the button was _pressed_ */
server.focus_view(*magpie_view, surface);
server.focus_view(*static_cast<View*>(magpie_surface), surface);
}
}

Expand Down

0 comments on commit 16b4b7b

Please sign in to comment.