Program Listing for File floating_window_manager.h

↰ Return to documentation for file (/home/docs/checkouts/readthedocs.org/user_builds/canonical-mir-documentation/checkouts/2.30/include/miral/miral/floating_window_manager.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_FLOATING_WINDOW_MANAGER_H
#define MIRAL_FLOATING_WINDOW_MANAGER_H

#include <miral/canonical_window_manager.h>
#include <miral/window_manager_tools.h>
#include <mir_toolkit/events/enums.h>

namespace miral
{
class FloatingWindowManager : public CanonicalWindowManagerPolicy
{
public:
    explicit FloatingWindowManager(WindowManagerTools const& tools);
    FloatingWindowManager(
        WindowManagerTools const& tools,
        FocusStealing focus_stealing,
        MirInputEventModifier pointer_drag_modifier);
    ~FloatingWindowManager() override;

    void handle_window_ready(WindowInfo& window_info) override;

    bool handle_keyboard_event(MirKeyboardEvent const* event) override;

    bool handle_touch_event(MirTouchEvent const* event) override;

    bool handle_pointer_event(MirPointerEvent const* event) override;

    void handle_request_move(WindowInfo& window_info, MirInputEvent const* input_event) override;

    void handle_request_resize(WindowInfo& window_info, MirInputEvent const* input_event, MirResizeEdge edge) override;

    void advise_focus_gained(WindowInfo const& window_info) override;

    void advise_new_window(WindowInfo const& window_info) override;

protected:
    bool begin_pointer_move(WindowInfo const& window_info, MirInputEvent const* input_event);
    bool begin_pointer_resize(
        WindowInfo const& window_info,
        MirInputEvent const* input_event,
        MirResizeEdge const& edge);

    bool begin_touch_move(WindowInfo const& window_info, MirInputEvent const* input_event);
    bool begin_touch_resize(WindowInfo const& window_info, MirInputEvent const* input_event, MirResizeEdge const& edge);

private:
    struct Impl;
    std::unique_ptr<Impl> const self;
};
}

#endif //MIRAL_FLOATING_WINDOW_MANAGER_H