mirror of
https://github.com/hyprwm/hyprpicker.git
synced 2024-11-17 00:25:57 +01:00
core: fix segfault when cursor_shape is not supported (#76)
Co-authored-by: alcubierre-drive <alcubierre-drive>
This commit is contained in:
parent
36d974181d
commit
67e0f34e27
1 changed files with 11 additions and 6 deletions
|
@ -82,7 +82,9 @@ void Events::handleCapabilities(void* data, wl_seat* wl_seat, uint32_t capabilit
|
||||||
if (capabilities & WL_SEAT_CAPABILITY_POINTER) {
|
if (capabilities & WL_SEAT_CAPABILITY_POINTER) {
|
||||||
const auto POINTER = wl_seat_get_pointer(wl_seat);
|
const auto POINTER = wl_seat_get_pointer(wl_seat);
|
||||||
wl_pointer_add_listener(POINTER, &pointerListener, wl_seat);
|
wl_pointer_add_listener(POINTER, &pointerListener, wl_seat);
|
||||||
g_pHyprpicker->m_pCursorShapeDevice = wp_cursor_shape_manager_v1_get_pointer(g_pHyprpicker->m_pCursorShape, POINTER);
|
g_pHyprpicker->m_pCursorShapeDevice = (g_pHyprpicker->m_pCursorShape) ?
|
||||||
|
wp_cursor_shape_manager_v1_get_pointer(g_pHyprpicker->m_pCursorShape, POINTER) :
|
||||||
|
nullptr;
|
||||||
} else {
|
} else {
|
||||||
Debug::log(CRIT, "Hyprpicker cannot work without a pointer!");
|
Debug::log(CRIT, "Hyprpicker cannot work without a pointer!");
|
||||||
g_pHyprpicker->finish(1);
|
g_pHyprpicker->finish(1);
|
||||||
|
@ -103,11 +105,14 @@ void Events::handlePointerEnter(void* data, struct wl_pointer* wl_pointer, uint3
|
||||||
if (!ls->pCursorImg)
|
if (!ls->pCursorImg)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// wl_surface_set_buffer_scale(ls->pCursorSurface, ls->m_pMonitor->scale);
|
if (g_pHyprpicker->m_pCursorShapeDevice) {
|
||||||
// wl_surface_attach(ls->pCursorSurface, wl_cursor_image_get_buffer(ls->pCursorImg), 0, 0);
|
|
||||||
// wl_pointer_set_cursor(wl_pointer, serial, ls->pCursorSurface, ls->pCursorImg->hotspot_x / ls->m_pMonitor->scale, ls->pCursorImg->hotspot_y / ls->m_pMonitor->scale);
|
|
||||||
// wl_surface_commit(ls->pCursorSurface);
|
|
||||||
wp_cursor_shape_device_v1_set_shape(g_pHyprpicker->m_pCursorShapeDevice, serial, WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_CROSSHAIR);
|
wp_cursor_shape_device_v1_set_shape(g_pHyprpicker->m_pCursorShapeDevice, serial, WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_CROSSHAIR);
|
||||||
|
} else {
|
||||||
|
wl_surface_set_buffer_scale(ls->pCursorSurface, ls->m_pMonitor->scale);
|
||||||
|
wl_surface_attach(ls->pCursorSurface, wl_cursor_image_get_buffer(ls->pCursorImg), 0, 0);
|
||||||
|
wl_pointer_set_cursor(wl_pointer, serial, ls->pCursorSurface, ls->pCursorImg->hotspot_x / ls->m_pMonitor->scale, ls->pCursorImg->hotspot_y / ls->m_pMonitor->scale);
|
||||||
|
wl_surface_commit(ls->pCursorSurface);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue