Program Listing for File bounce_keys.h

Return to documentation for file (include/miral/miral/bounce_keys.h)

/*
 * Copyright © Canonical Ltd.
 *
 * This program is free software: you can redistribute it and/or modify it
 * under the terms of the GNU General Public License version 2 or 3 as
 * published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef MIRAL_BOUNCE_KEYS_H
#define MIRAL_BOUNCE_KEYS_H

#include <mir_toolkit/events/event.h>

#include <chrono>
#include <functional>
#include <memory>

namespace mir { class Server; }

namespace miral
{
namespace live_config { class Store; }
class BounceKeys
{
public:
    static auto enabled() -> BounceKeys;

    static auto disabled() -> BounceKeys;

    explicit BounceKeys(live_config::Store& config_store);

    void operator()(mir::Server&);

    BounceKeys& enable();

    BounceKeys& disable();

    BounceKeys& delay(std::chrono::milliseconds);

    BounceKeys& on_press_rejected(std::function<void(MirKeyboardEvent const*)>&&);

private:
    struct Self;
    BounceKeys(std::shared_ptr<Self> self);
    std::shared_ptr<Self> const self;
};
}

#endif // MIRAL_BOUNCE_KEYS_H