A custom mouse cursor for my custom rack

A custom mouse cursor for my custom rack:

2 Likes

That’s pretty cool! Forked vcv? Does it work on all platforms?

I run my own version for a long time to prevent GPU performance issues. I don’t know (and I don’t care) about other platforms than Windows.

I added glfwSetCursor() using standard cursors in ModuleWidget.cpp

void ModuleWidget::onDragStart(const DragStartEvent& e) {
	if (e.button == GLFW_MOUSE_BUTTON_LEFT) {
		// HACK Disable FramebufferWidget redrawing subpixels while dragging
		//APP->window->fbDirtyOnSubpixelChange() = false;
		if (!settings::lockModules) {
			glfwSetCursor(APP->window->win, glfwCreateStandardCursor(GLFW_HAND_CURSOR));
		}

		// Clear dragRack so dragging in not enabled until mouse is moved a bit.
		internal->dragRackPos = math::Vec(NAN, NAN);

		// Prepare initial position of modules for history.
		APP->scene->rack->updateModuleOldPositions();
	}
}

void ModuleWidget::onDragEnd(const DragEndEvent& e) {
	if (e.button == GLFW_MOUSE_BUTTON_LEFT) {
		APP->window->fbDirtyOnSubpixelChange() = true;
		
		glfwSetCursor(APP->window->win, NULL);

		// The next time the module is dragged, it should always move immediately
		internal->dragEnabled = true;

		history::ComplexAction* h = APP->scene->rack->getModuleDragAction();
		if (!h->isEmpty())
			APP->history->push(h);
		else
			delete h;
	}
}
3 Likes

If someone wants to compile and run my personal fork of the Rack V 2.1.2, feel free to do so:

1 Like