Program Listing for File application_switcher.h

Return to documentation for file (/home/docs/checkouts/readthedocs.org/user_builds/canonical-mir/checkouts/stable/include/miral/miral/application_switcher.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 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_APPLICATION_SWITCHER_H
#define MIRAL_APPLICATION_SWITCHER_H

#include <miral/toolkit_event.h>
#include <miral/window_manager_tools.h>
#include <memory>
#include <wayland-client.h>
#include <linux/input-event-codes.h>

namespace mir
{
class Server;
}

namespace miral
{

class ApplicationSwitcher
{
public:
    ApplicationSwitcher();
    ~ApplicationSwitcher();

    ApplicationSwitcher(ApplicationSwitcher const&);
    ApplicationSwitcher& operator=(ApplicationSwitcher const&);

    void operator()(wl_display* display);
    void operator()(std::weak_ptr<mir::scene::Session> const& session) const;

    void next_app() const;

    void prev_app() const;

    void next_window() const;

    void prev_window() const;

    void confirm() const;

    void cancel() const;

    void stop() const;

private:
    class Self;
    std::shared_ptr<Self> self;
};

class BasicApplicationSwitcher
{
public:
    struct KeybindConfiguration
    {
        MirInputEventModifier primary_modifier = mir_input_event_modifier_alt;

        MirInputEventModifier reverse_modifier = mir_input_event_modifier_shift;

        int application_key = KEY_TAB;

        int window_key = KEY_GRAVE;
    };

    BasicApplicationSwitcher();

    explicit BasicApplicationSwitcher(KeybindConfiguration const& keybind_configuration);
    ~BasicApplicationSwitcher();

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

private:
    class Self;
    std::shared_ptr<Self> self;
};

}

#endif