~alan-griffiths/miral/update-tasks

« back to all changes in this revision

Viewing changes to include/miral/window_management_policy_addendum3.h

  • Committer: Tarmac
  • Author(s): Alan Griffiths
  • Date: 2017-07-28 11:45:49 UTC
  • mfrom: (566.1.22 miral1)
  • Revision ID: tarmac-20170728114549-jvwca31sn5p6dcqp
[libmiral, miral-shell] handle display reconfiguration better and allow shells to customize maximized placements.

Approved by Gerry Boland, mir-ci-bot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright © 2017 Canonical Ltd.
 
3
 *
 
4
 * This program is free software: you can redistribute it and/or modify it
 
5
 * under the terms of the GNU General Public License version 3,
 
6
 * as published by the Free Software Foundation.
 
7
 *
 
8
 * This program is distributed in the hope that it will be useful,
 
9
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
11
 * GNU General Public License for more details.
 
12
 *
 
13
 * You should have received a copy of the GNU General Public License
 
14
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
15
 *
 
16
 * Authored by: Alan Griffiths <alan@octopull.co.uk>
 
17
 */
 
18
 
 
19
#ifndef MIRAL_WINDOW_MANAGEMENT_POLICY_ADDENDUM3_H
 
20
#define MIRAL_WINDOW_MANAGEMENT_POLICY_ADDENDUM3_H
 
21
 
 
22
#include <mir_toolkit/client_types.h>
 
23
 
 
24
#include <mir/geometry/rectangles.h>
 
25
#include <mir_toolkit/mir_version_number.h>
 
26
 
 
27
namespace miral
 
28
{
 
29
using namespace mir::geometry;
 
30
struct WindowInfo;
 
31
 
 
32
/**
 
33
 *  Handle additional client requests.
 
34
 *
 
35
 *  \note This interface is intended to be implemented by a WindowManagementPolicy
 
36
 *  implementation, we can't add these functions directly to that interface without
 
37
 *  breaking ABI (the vtab could be incompatible).
 
38
 *  When initializing the window manager this interface will be detected by
 
39
 *  dynamic_cast and registered accordingly.
 
40
 */
 
41
class WindowManagementPolicyAddendum3
 
42
{
 
43
public:
 
44
    /** Confirm (and optionally adjust) the placement of a window on the display.
 
45
     * Called when (re)placing fullscreen, maximized, horizontally maximised and
 
46
     * vertically maximized windows to allow adjustment for decorations.
 
47
     *
 
48
     * @param window_info   the window
 
49
     * @param new_placement the suggested placement
 
50
     *
 
51
     * @return the confirmed placement of the window
 
52
     */
 
53
    virtual auto confirm_placement_on_display(
 
54
        WindowInfo const& window_info,
 
55
        MirWindowState new_state,
 
56
        Rectangle const& new_placement) -> Rectangle = 0;
 
57
 
 
58
    virtual ~WindowManagementPolicyAddendum3() = default;
 
59
    WindowManagementPolicyAddendum3() = default;
 
60
    WindowManagementPolicyAddendum3(WindowManagementPolicyAddendum3 const&) = delete;
 
61
    WindowManagementPolicyAddendum3& operator=(WindowManagementPolicyAddendum3 const&) = delete;
 
62
};
 
63
#if MIRAL_VERSION >= MIR_VERSION_NUMBER(2, 0, 0)
 
64
#error "We've presumably broken ABI - please roll this interface into WindowManagementPolicy"
 
65
#endif
 
66
}
 
67
 
 
68
#endif //MIRAL_WINDOW_MANAGEMENT_POLICY_ADDENDUM3_H