2024-03-07 04:19:38 +01:00
|
|
|
#include <iostream>
|
2024-03-07 17:36:26 +01:00
|
|
|
#include <hyprcursor/hyprcursor.hpp>
|
2024-03-07 04:19:38 +01:00
|
|
|
|
|
|
|
int main(int argc, char** argv) {
|
2024-03-11 22:04:49 +01:00
|
|
|
Hyprcursor::CHyprcursorManager mgr(nullptr);
|
2024-03-07 04:19:38 +01:00
|
|
|
|
2024-03-21 16:21:43 +01:00
|
|
|
if (!mgr.valid()) {
|
|
|
|
std::cout << "mgr is invalid\n";
|
|
|
|
return 1;
|
|
|
|
}
|
2024-03-11 22:06:13 +01:00
|
|
|
|
2024-03-21 16:21:43 +01:00
|
|
|
Hyprcursor::SCursorStyleInfo style{.size = 48};
|
2024-03-07 15:50:48 +01:00
|
|
|
// preload size 48 for testing
|
2024-03-11 22:06:13 +01:00
|
|
|
if (!mgr.loadThemeStyle(style)) {
|
2024-03-07 15:50:48 +01:00
|
|
|
std::cout << "failed loading style\n";
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
// get cursor for left_ptr
|
2024-03-11 22:06:13 +01:00
|
|
|
const auto SHAPEDATA = mgr.getShape("left_ptr", style);
|
2024-03-07 17:01:45 +01:00
|
|
|
|
2024-03-07 17:21:04 +01:00
|
|
|
if (SHAPEDATA.images.empty()) {
|
|
|
|
std::cout << "no images\n";
|
2024-03-07 17:01:45 +01:00
|
|
|
return 1;
|
2024-03-07 17:21:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
std::cout << "hyprcursor returned " << SHAPEDATA.images.size() << " images\n";
|
2024-03-07 04:19:38 +01:00
|
|
|
|
|
|
|
// save to disk
|
2024-03-07 17:01:45 +01:00
|
|
|
const auto RET = cairo_surface_write_to_png(SHAPEDATA.images[0].surface, "/tmp/arrow.png");
|
2024-03-07 04:19:38 +01:00
|
|
|
|
|
|
|
std::cout << "Cairo returned for write: " << RET << "\n";
|
|
|
|
|
2024-03-11 22:06:13 +01:00
|
|
|
mgr.cursorSurfaceStyleDone(style);
|
|
|
|
|
2024-03-07 16:10:45 +01:00
|
|
|
if (RET)
|
|
|
|
return 1;
|
|
|
|
|
2024-03-07 04:19:38 +01:00
|
|
|
return !mgr.valid();
|
|
|
|
}
|