deskflow/src/lib/base/FunctionEventJob.h
2025-08-18 11:45:21 +01:00

29 lines
694 B
C++

/*
* Deskflow -- mouse and keyboard sharing utility
* SPDX-FileCopyrightText: (C) 2025 Deskflow Developers
* SPDX-FileCopyrightText: (C) 2012 - 2016 Symless Ltd.
* SPDX-FileCopyrightText: (C) 2004 Chris Schoeneman
* SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception
*/
#pragma once
class Event;
//! Use a function as an event job
/*!
An event job class that invokes a function.
*/
class FunctionEventJob
{
public:
//! run() invokes \c func(arg)
explicit FunctionEventJob(void (*func)(const Event &, void *), void *arg = nullptr);
~FunctionEventJob() = default;
void run(const Event &);
private:
void (*m_func)(const Event &, void *);
void *m_arg;
};