blob: edf9d3dd352f51273ba8b7fd79d977adb6d1ecee [file] [log] [blame]
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
module ws.mojom;
import "ui/base/mojo/ui_base_types.mojom";
import "ui/display/mojo/display.mojom";
import "ui/gfx/geometry/mojo/geometry.mojom";
struct FrameDecorationValues {
gfx.mojom.Insets normal_client_area_insets;
gfx.mojom.Insets maximized_client_area_insets;
// Max width needed to display the buttons on the title bar. The buttons are
// aligned to the trailing edge of the titlebar.
// TODO(sky): this API is very narrow, and assumes a particular config.
uint32 max_title_bar_button_width;
};
// Contains state of a single window.
struct WindowData {
// Unique identifier of the parent. If the client can not see the parent an
// id of 0 is supplied.
uint64 parent_id;
// Unique identifier of the window.
uint64 window_id;
// Id of the transient parent, 0 if there isn't one.
uint64 transient_parent_id;
gfx.mojom.Rect bounds;
ui.mojom.WindowShowState state = ui.mojom.WindowShowState.kDefault;
// Arbitrary key/value pairs. The interpretation of these is left to the
// client. See SetWindowProperty() for more information.
map<string, array<uint8>> properties;
// True if this window is visible. The window may not be drawn on screen (see
// OnWindowParentDrawnStateChanged() for details).
bool visible;
};
struct WsDisplay {
display.mojom.Display display;
FrameDecorationValues frame_decoration_values;
};
// The result of an input event sent to a client app.
enum EventResult {
HANDLED,
UNHANDLED,
};
enum EventTargetingPolicy {
// The target is a valid target for events, but none of its descendants are
// considered.
TARGET_ONLY,
// The target and its descendants are possible targets. This is the default.
TARGET_AND_DESCENDANTS,
// The target is not a valid target, but its descendants are possible targets.
DESCENDANTS_ONLY,
// Neither the target nor its descendants are valid targets.
NONE
};
// Whether a client initiated move loop was started with a mouse event or a
// touch event.
enum MoveLoopSource {
MOUSE,
TOUCH
};
enum OrderDirection {
ABOVE = 1,
BELOW,
};
// TODO(sky): seems like this should not be defined in mus, rather in mash.
// Only thing mus cares about is minimized and that should be expressed
// differently.
enum ShowState {
DEFAULT,
NORMAL,
MINIMIZED,
MAXIMIZED,
INACTIVE,
FULLSCREEN,
};
enum WindowType {
// These constants come from Widget::InitParams. See it for details.
// TODO: see if we can reduce this set. For example, why do we need both
// BUBBLE and POPUP.
WINDOW,
WINDOW_FRAMELESS,
CONTROL,
POPUP,
MENU,
TOOLTIP,
BUBBLE,
DRAG,
UNKNOWN,
};
enum OcclusionState {
// These come from aura::Window::OcclusionState. See it for details.
kUnknown,
kVisible,
kOccluded,
kHidden,
};
// A bitfield of what drag operations are possible.
const uint32 kDropEffectNone = 0;
const uint32 kDropEffectMove = 1;
const uint32 kDropEffectCopy = 2;
const uint32 kDropEffectLink = 4;
// When this flag is set in a call to Embed(), the embedder (i.e. the client
// that is making the call to Embed()) will receive events that are targeted to
// the embedded client. The embedded client will not receive any input events
// from the window server. However, the embedder can choose to dispatch events
// to the embedded client through other mechanism.
// TODO(sad): Provide an API in mus for the embedder to dispatch events to the
// embedded client. https://crbug.com/621085
const uint32 kEmbedFlagEmbedderInterceptsEvents = 0x01;
// When passed to Embed() the embedded client can not change the visibility of
// the window, only the embedder can. Requests by the embedded client to change
// the visibility fail. This flag only effects the window at the embed point,
// the embedded client can always change the visibility of any windows the
// embedded client creates.
const uint32 kEmbedFlagEmbedderControlsVisibility = 0x02;
const int32 kResizeBehaviorNone = 0;
const int32 kResizeBehaviorCanResize = 1;
const int32 kResizeBehaviorCanMaximize = 2;
const int32 kResizeBehaviorCanMinimize = 4;