Repository: godotengine/godot
File: editor/project_manager/project_list.cpp (C++)

Code before:
			} else {
				_last_clicked = clicked_project.path;
				select_project(clicked_index);
			}

			emit_signal(SNAME(SIGNAL_SELECTION_CHANGED));

			// Do not allow opening a project more than once using a single project manager instance.
			// Opening the same project in several editor instances at once can lead to various issues.
			if (!mb->is_command_or_control_pressed() && mb->is_double_click() && !project_opening_initiated) {
				emit_signal(SNAME(SIGNAL_PROJECT_ASK_OPEN));
			}
		} else if (mb->get_button_index() == MouseButton::RIGHT) {
			if (!project_context_menu) {
				project_context_menu = memnew(PopupMenu);
				project_context_menu->add_item(TTRC("Open in Editor"), ProjectManager::MENU_EDIT);
				project_context_menu->add_item(TTRC("Run Project"), ProjectManager::MENU_RUN);
				project_context_menu->add_separator();
				project_context_menu->add_item(TTRC("Show in File Manager"), ProjectManager::MENU_SHOW_IN_FILE_MANAGER);
				project_context_menu->add_item(TTRC("Copy Path"), ProjectManager::MENU_COPY_PATH);
				project_context_menu->add_separator();
				project_context_menu->add_item(TTRC("Rename"), ProjectManager::MENU_RENAME);
				project_context_menu->add_item(TTRC("Duplicate"), ProjectManager::MENU_DUPLICATE);
				project_context_menu->add_item(TTRC("Remove from Project List"), ProjectManager::MENU_REMOVE);
				add_child(project_context_menu);
				project_context_menu->connect("id_pressed", callable_mp(this, &ProjectList::_menu_option));
			}
			select_project(clicked_index);

			for (int id : Vector<int>{ ProjectManager::MENU_EDIT, ProjectManager::MENU_RUN, ProjectManager::MENU_SHOW_IN_FILE_MANAGER, ProjectManager::MENU_RENAME, ProjectManager::MENU_DUPLICATE }) {
				project_context_menu->set_item_disabled(project_context_menu->get_item_index(id), clicked_project.missing);
			}

			project_context_menu->set_position(p_hb->get_screen_position() + mb->get_position());
			project_context_menu->reset_size();
			project_context_menu->popup();
		}
	}
}

void ProjectList::_on_favorite_pressed(Node *p_hb) {
	ProjectListItemControl *control = Object::cast_to<ProjectListItemControl>(p_hb);

	int index = control->get_index();
	Item item = _projects.write[index]; // Take copy

	item.favorite = !item.favorite;

	_config.set_value(item.path, "favorite", item.favorite);
	save_config();


Review comment (suggestion):
```suggestion
				project_context_menu->connect(SceneStringName(id_pressed), callable_mp(this, &ProjectList::_menu_option));
```

Code after:
}

void ProjectList::_list_item_input(const Ref<InputEvent> &p_ev, Control *p_hb) {
	Ref<InputEventMouseButton> mb = p_ev;
	int clicked_index = p_hb->get_index();
	const Item &clicked_project = _projects[clicked_index];

	if (mb.is_valid() && mb->is_pressed()) {
		if (mb->get_button_index() == MouseButton::LEFT) {
			if (mb->is_shift_pressed() && _selected_project_paths.size() > 0 && !_last_clicked.is_empty() && clicked_project.path != _last_clicked) {
				int anchor_index = -1;
				for (int i = 0; i < _projects.size(); ++i) {
					const Item &p = _projects[i];
					if (p.path == _last_clicked) {
						anchor_index = p.control->get_index();
						break;
					}
				}
				CRASH_COND(anchor_index == -1);
				_select_project_range(anchor_index, clicked_index);

			} else if (mb->is_command_or_control_pressed()) {
				_toggle_project(clicked_index);

			} else {
				_last_clicked = clicked_project.path;
				select_project(clicked_index);
			}

			emit_signal(SNAME(SIGNAL_SELECTION_CHANGED));

			// Do not allow opening a project more than once using a single project manager instance.
			// Opening the same project in several editor instances at once can lead to various issues.
			if (!mb->is_command_or_control_pressed() && mb->is_double_click() && !project_opening_initiated) {
				emit_signal(SNAME(SIGNAL_PROJECT_ASK_OPEN));
			}
		} else if (mb->get_button_index() == MouseButton::RIGHT) {
			_open_menu(mb->get_position(), p_hb);
		}
	}
}

void ProjectList::_on_favorite_pressed(Node *p_hb) {
	ProjectListItemControl *control = Object::cast_to<ProjectListItemControl>(p_hb);

	int index = control->get_index();
	Item item = _projects.write[index]; // Take copy

	item.favorite = !item.favorite;

	_config.set_value(item.path, "favorite", item.favorite);