Commit 297f6595 authored by Eliot Courtney's avatar Eliot Courtney Committed by Commit Bot

Add PIP wayland-protocol extension and window state.

BUG=b:69370942

Change-Id: I1f0c2b8deb6f505a19185a7af5e4b0949ba6f293
Reviewed-on: https://chromium-review.googlesource.com/1021061
Commit-Queue: Eliot Courtney <edcourtney@chromium.org>
Reviewed-by: default avatarDavid Reveman <reveman@chromium.org>
Reviewed-by: default avatarOliver Chang <ochang@chromium.org>
Reviewed-by: default avatarMitsuru Oshima <oshima@chromium.org>
Cr-Commit-Position: refs/heads/master@{#553993}
parent 56d99045
...@@ -67,7 +67,8 @@ ActiveWindowStateType GetActiveWindowState() { ...@@ -67,7 +67,8 @@ ActiveWindowStateType GetActiveWindowState() {
case mojom::WindowStateType::MINIMIZED: case mojom::WindowStateType::MINIMIZED:
case mojom::WindowStateType::INACTIVE: case mojom::WindowStateType::INACTIVE:
case mojom::WindowStateType::AUTO_POSITIONED: case mojom::WindowStateType::AUTO_POSITIONED:
// TODO: We probably want to recorde PINNED state. case mojom::WindowStateType::PIP:
// TODO: We probably want to record PIP state.
active_window_state_type = ACTIVE_WINDOW_STATE_TYPE_OTHER; active_window_state_type = ACTIVE_WINDOW_STATE_TYPE_OTHER;
break; break;
} }
......
...@@ -36,6 +36,7 @@ ui::WindowShowState ToWindowShowState(mojom::WindowStateType type) { ...@@ -36,6 +36,7 @@ ui::WindowShowState ToWindowShowState(mojom::WindowStateType type) {
case mojom::WindowStateType::RIGHT_SNAPPED: case mojom::WindowStateType::RIGHT_SNAPPED:
case mojom::WindowStateType::LEFT_SNAPPED: case mojom::WindowStateType::LEFT_SNAPPED:
case mojom::WindowStateType::AUTO_POSITIONED: case mojom::WindowStateType::AUTO_POSITIONED:
case mojom::WindowStateType::PIP:
return ui::SHOW_STATE_NORMAL; return ui::SHOW_STATE_NORMAL;
case mojom::WindowStateType::MINIMIZED: case mojom::WindowStateType::MINIMIZED:
...@@ -76,7 +77,8 @@ bool IsValidWindowStateType(int64_t value) { ...@@ -76,7 +77,8 @@ bool IsValidWindowStateType(int64_t value) {
value == int64_t(mojom::WindowStateType::RIGHT_SNAPPED) || value == int64_t(mojom::WindowStateType::RIGHT_SNAPPED) ||
value == int64_t(mojom::WindowStateType::AUTO_POSITIONED) || value == int64_t(mojom::WindowStateType::AUTO_POSITIONED) ||
value == int64_t(mojom::WindowStateType::PINNED) || value == int64_t(mojom::WindowStateType::PINNED) ||
value == int64_t(mojom::WindowStateType::TRUSTED_PINNED); value == int64_t(mojom::WindowStateType::TRUSTED_PINNED) ||
value == int64_t(mojom::WindowStateType::PIP);
} }
} // namespace ash } // namespace ash
...@@ -32,6 +32,9 @@ enum WindowStateType { ...@@ -32,6 +32,9 @@ enum WindowStateType {
// pinned one should be hidden. // pinned one should be hidden.
PINNED, PINNED,
TRUSTED_PINNED, TRUSTED_PINNED,
// A window in Picture-in-Picture mode (PIP).
PIP,
}; };
// The window's extended state. Maps to ash::aura::kWindowStateTypeKey. // The window's extended state. Maps to ash::aura::kWindowStateTypeKey.
......
...@@ -556,6 +556,7 @@ void DefaultState::UpdateBoundsFromState( ...@@ -556,6 +556,7 @@ void DefaultState::UpdateBoundsFromState(
break; break;
case mojom::WindowStateType::INACTIVE: case mojom::WindowStateType::INACTIVE:
case mojom::WindowStateType::AUTO_POSITIONED: case mojom::WindowStateType::AUTO_POSITIONED:
case mojom::WindowStateType::PIP:
return; return;
} }
......
...@@ -305,6 +305,11 @@ void ClientControlledShellSurface::SetSnappedToRight() { ...@@ -305,6 +305,11 @@ void ClientControlledShellSurface::SetSnappedToRight() {
pending_window_state_ = ash::mojom::WindowStateType::RIGHT_SNAPPED; pending_window_state_ = ash::mojom::WindowStateType::RIGHT_SNAPPED;
} }
void ClientControlledShellSurface::SetPip() {
TRACE_EVENT0("exo", "ClientControlledShellSurface::SetPip");
pending_window_state_ = ash::mojom::WindowStateType::PIP;
}
void ClientControlledShellSurface::SetPinned(ash::mojom::WindowPinType type) { void ClientControlledShellSurface::SetPinned(ash::mojom::WindowPinType type) {
TRACE_EVENT1("exo", "ClientControlledShellSurface::SetPinned", "type", TRACE_EVENT1("exo", "ClientControlledShellSurface::SetPinned", "type",
static_cast<int>(type)); static_cast<int>(type));
......
...@@ -77,6 +77,9 @@ class ClientControlledShellSurface ...@@ -77,6 +77,9 @@ class ClientControlledShellSurface
// Called when the client was snapped to right. // Called when the client was snapped to right.
void SetSnappedToRight(); void SetSnappedToRight();
// Called when the client was set to PIP.
void SetPip();
// Set the callback to run when the surface state changed. // Set the callback to run when the surface state changed.
using StateChangedCallback = using StateChangedCallback =
base::RepeatingCallback<void(ash::mojom::WindowStateType old_state_type, base::RepeatingCallback<void(ash::mojom::WindowStateType old_state_type,
......
...@@ -2294,6 +2294,10 @@ void remote_surface_set_orientation_lock(wl_client* client, ...@@ -2294,6 +2294,10 @@ void remote_surface_set_orientation_lock(wl_client* client,
OrientationLock(orientation_lock)); OrientationLock(orientation_lock));
} }
void remote_surface_pip(wl_client* client, wl_resource* resource) {
GetUserDataAs<ClientControlledShellSurface>(resource)->SetPip();
}
const struct zcr_remote_surface_v1_interface remote_surface_implementation = { const struct zcr_remote_surface_v1_interface remote_surface_implementation = {
remote_surface_destroy, remote_surface_destroy,
remote_surface_set_app_id, remote_surface_set_app_id,
...@@ -2334,7 +2338,8 @@ const struct zcr_remote_surface_v1_interface remote_surface_implementation = { ...@@ -2334,7 +2338,8 @@ const struct zcr_remote_surface_v1_interface remote_surface_implementation = {
remote_surface_set_frame, remote_surface_set_frame,
remote_surface_set_frame_buttons, remote_surface_set_frame_buttons,
remote_surface_set_extra_title, remote_surface_set_extra_title,
remote_surface_set_orientation_lock}; remote_surface_set_orientation_lock,
remote_surface_pip};
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// notification_surface_interface: // notification_surface_interface:
...@@ -2595,6 +2600,9 @@ void HandleRemoteSurfaceStateChangedCallback( ...@@ -2595,6 +2600,9 @@ void HandleRemoteSurfaceStateChangedCallback(
case ash::mojom::WindowStateType::RIGHT_SNAPPED: case ash::mojom::WindowStateType::RIGHT_SNAPPED:
state_type = ZCR_REMOTE_SHELL_V1_STATE_TYPE_RIGHT_SNAPPED; state_type = ZCR_REMOTE_SHELL_V1_STATE_TYPE_RIGHT_SNAPPED;
break; break;
case ash::mojom::WindowStateType::PIP:
state_type = ZCR_REMOTE_SHELL_V1_STATE_TYPE_PIP;
break;
default: default:
break; break;
} }
...@@ -2761,7 +2769,7 @@ const struct zcr_remote_shell_v1_interface remote_shell_implementation = { ...@@ -2761,7 +2769,7 @@ const struct zcr_remote_shell_v1_interface remote_shell_implementation = {
remote_shell_destroy, remote_shell_get_remote_surface, remote_shell_destroy, remote_shell_get_remote_surface,
remote_shell_get_notification_surface}; remote_shell_get_notification_surface};
const uint32_t remote_shell_version = 14; const uint32_t remote_shell_version = 15;
void bind_remote_shell(wl_client* client, void bind_remote_shell(wl_client* client,
void* data, void* data,
......
...@@ -204,6 +204,10 @@ enum zcr_remote_shell_v1_state_type { ...@@ -204,6 +204,10 @@ enum zcr_remote_shell_v1_state_type {
* right snapped window state * right snapped window state
*/ */
ZCR_REMOTE_SHELL_V1_STATE_TYPE_RIGHT_SNAPPED = 10, ZCR_REMOTE_SHELL_V1_STATE_TYPE_RIGHT_SNAPPED = 10,
/**
* pip window state
*/
ZCR_REMOTE_SHELL_V1_STATE_TYPE_PIP = 11,
}; };
#endif /* ZCR_REMOTE_SHELL_V1_STATE_TYPE_ENUM */ #endif /* ZCR_REMOTE_SHELL_V1_STATE_TYPE_ENUM */
...@@ -891,6 +895,7 @@ zcr_remote_surface_v1_add_listener(struct zcr_remote_surface_v1 *zcr_remote_surf ...@@ -891,6 +895,7 @@ zcr_remote_surface_v1_add_listener(struct zcr_remote_surface_v1 *zcr_remote_surf
#define ZCR_REMOTE_SURFACE_V1_SET_FRAME_BUTTONS 37 #define ZCR_REMOTE_SURFACE_V1_SET_FRAME_BUTTONS 37
#define ZCR_REMOTE_SURFACE_V1_SET_EXTRA_TITLE 38 #define ZCR_REMOTE_SURFACE_V1_SET_EXTRA_TITLE 38
#define ZCR_REMOTE_SURFACE_V1_SET_ORIENTATION_LOCK 39 #define ZCR_REMOTE_SURFACE_V1_SET_ORIENTATION_LOCK 39
#define ZCR_REMOTE_SURFACE_V1_PIP 40
/** /**
* @ingroup iface_zcr_remote_surface_v1 * @ingroup iface_zcr_remote_surface_v1
...@@ -1081,6 +1086,10 @@ zcr_remote_surface_v1_add_listener(struct zcr_remote_surface_v1 *zcr_remote_surf ...@@ -1081,6 +1086,10 @@ zcr_remote_surface_v1_add_listener(struct zcr_remote_surface_v1 *zcr_remote_surf
* @ingroup iface_zcr_remote_surface_v1 * @ingroup iface_zcr_remote_surface_v1
*/ */
#define ZCR_REMOTE_SURFACE_V1_SET_ORIENTATION_LOCK_SINCE_VERSION 14 #define ZCR_REMOTE_SURFACE_V1_SET_ORIENTATION_LOCK_SINCE_VERSION 14
/**
* @ingroup iface_zcr_remote_surface_v1
*/
#define ZCR_REMOTE_SURFACE_V1_PIP_SINCE_VERSION 15
/** @ingroup iface_zcr_remote_surface_v1 */ /** @ingroup iface_zcr_remote_surface_v1 */
static inline void static inline void
...@@ -1756,6 +1765,18 @@ zcr_remote_surface_v1_set_orientation_lock(struct zcr_remote_surface_v1 *zcr_rem ...@@ -1756,6 +1765,18 @@ zcr_remote_surface_v1_set_orientation_lock(struct zcr_remote_surface_v1 *zcr_rem
ZCR_REMOTE_SURFACE_V1_SET_ORIENTATION_LOCK, orientation_lock); ZCR_REMOTE_SURFACE_V1_SET_ORIENTATION_LOCK, orientation_lock);
} }
/**
* @ingroup iface_zcr_remote_surface_v1
*
* Request that surface is set to Picture-in-Picture (PIP).
*/
static inline void
zcr_remote_surface_v1_pip(struct zcr_remote_surface_v1 *zcr_remote_surface_v1)
{
wl_proxy_marshal((struct wl_proxy *) zcr_remote_surface_v1,
ZCR_REMOTE_SURFACE_V1_PIP);
}
#define ZCR_NOTIFICATION_SURFACE_V1_DESTROY 0 #define ZCR_NOTIFICATION_SURFACE_V1_DESTROY 0
......
...@@ -207,6 +207,10 @@ enum zcr_remote_shell_v1_state_type { ...@@ -207,6 +207,10 @@ enum zcr_remote_shell_v1_state_type {
* right snapped window state * right snapped window state
*/ */
ZCR_REMOTE_SHELL_V1_STATE_TYPE_RIGHT_SNAPPED = 10, ZCR_REMOTE_SHELL_V1_STATE_TYPE_RIGHT_SNAPPED = 10,
/**
* pip window state
*/
ZCR_REMOTE_SHELL_V1_STATE_TYPE_PIP = 11,
}; };
#endif /* ZCR_REMOTE_SHELL_V1_STATE_TYPE_ENUM */ #endif /* ZCR_REMOTE_SHELL_V1_STATE_TYPE_ENUM */
...@@ -1188,6 +1192,14 @@ struct zcr_remote_surface_v1_interface { ...@@ -1188,6 +1192,14 @@ struct zcr_remote_surface_v1_interface {
void (*set_orientation_lock)(struct wl_client *client, void (*set_orientation_lock)(struct wl_client *client,
struct wl_resource *resource, struct wl_resource *resource,
uint32_t orientation_lock); uint32_t orientation_lock);
/**
* set pip for a remote surface
*
* Request that surface is set to Picture-in-Picture (PIP).
* @since 15
*/
void (*pip)(struct wl_client *client,
struct wl_resource *resource);
}; };
#define ZCR_REMOTE_SURFACE_V1_CLOSE 0 #define ZCR_REMOTE_SURFACE_V1_CLOSE 0
...@@ -1387,6 +1399,10 @@ struct zcr_remote_surface_v1_interface { ...@@ -1387,6 +1399,10 @@ struct zcr_remote_surface_v1_interface {
* @ingroup iface_zcr_remote_surface_v1 * @ingroup iface_zcr_remote_surface_v1
*/ */
#define ZCR_REMOTE_SURFACE_V1_SET_ORIENTATION_LOCK_SINCE_VERSION 14 #define ZCR_REMOTE_SURFACE_V1_SET_ORIENTATION_LOCK_SINCE_VERSION 14
/**
* @ingroup iface_zcr_remote_surface_v1
*/
#define ZCR_REMOTE_SURFACE_V1_PIP_SINCE_VERSION 15
/** /**
* @ingroup iface_zcr_remote_surface_v1 * @ingroup iface_zcr_remote_surface_v1
......
...@@ -70,7 +70,7 @@ static const struct wl_message zcr_remote_shell_v1_events[] = { ...@@ -70,7 +70,7 @@ static const struct wl_message zcr_remote_shell_v1_events[] = {
}; };
WL_EXPORT const struct wl_interface zcr_remote_shell_v1_interface = { WL_EXPORT const struct wl_interface zcr_remote_shell_v1_interface = {
"zcr_remote_shell_v1", 14, "zcr_remote_shell_v1", 15,
3, zcr_remote_shell_v1_requests, 3, zcr_remote_shell_v1_requests,
5, zcr_remote_shell_v1_events, 5, zcr_remote_shell_v1_events,
}; };
...@@ -116,6 +116,7 @@ static const struct wl_message zcr_remote_surface_v1_requests[] = { ...@@ -116,6 +116,7 @@ static const struct wl_message zcr_remote_surface_v1_requests[] = {
{ "set_frame_buttons", "13uu", types + 0 }, { "set_frame_buttons", "13uu", types + 0 },
{ "set_extra_title", "13s", types + 0 }, { "set_extra_title", "13s", types + 0 },
{ "set_orientation_lock", "14u", types + 0 }, { "set_orientation_lock", "14u", types + 0 },
{ "pip", "15", types + 0 },
}; };
static const struct wl_message zcr_remote_surface_v1_events[] = { static const struct wl_message zcr_remote_surface_v1_events[] = {
...@@ -129,8 +130,8 @@ static const struct wl_message zcr_remote_surface_v1_events[] = { ...@@ -129,8 +130,8 @@ static const struct wl_message zcr_remote_surface_v1_events[] = {
}; };
WL_EXPORT const struct wl_interface zcr_remote_surface_v1_interface = { WL_EXPORT const struct wl_interface zcr_remote_surface_v1_interface = {
"zcr_remote_surface_v1", 14, "zcr_remote_surface_v1", 15,
40, zcr_remote_surface_v1_requests, 41, zcr_remote_surface_v1_requests,
7, zcr_remote_surface_v1_events, 7, zcr_remote_surface_v1_events,
}; };
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
reset. reset.
</description> </description>
<interface name="zcr_remote_shell_v1" version="14"> <interface name="zcr_remote_shell_v1" version="15">
<description summary="remote_shell"> <description summary="remote_shell">
The global interface that allows clients to turn a wl_surface into a The global interface that allows clients to turn a wl_surface into a
"real window" which is remotely managed but can be stacked, activated "real window" which is remotely managed but can be stacked, activated
...@@ -68,6 +68,7 @@ ...@@ -68,6 +68,7 @@
<entry name="resizing" value="8" summary="resizing window state"/> <entry name="resizing" value="8" summary="resizing window state"/>
<entry name="left_snapped" value="9" summary="left snapped window state"/> <entry name="left_snapped" value="9" summary="left snapped window state"/>
<entry name="right_snapped" value="10" summary="right snapped window state"/> <entry name="right_snapped" value="10" summary="right snapped window state"/>
<entry name="pip" value="11" summary="pip window state"/>
</enum> </enum>
<enum name="error"> <enum name="error">
...@@ -183,7 +184,7 @@ ...@@ -183,7 +184,7 @@
</event> </event>
</interface> </interface>
<interface name="zcr_remote_surface_v1" version="14"> <interface name="zcr_remote_surface_v1" version="15">
<description summary="A desktop window"> <description summary="A desktop window">
An interface that may be implemented by a wl_surface, for An interface that may be implemented by a wl_surface, for
implementations that provide a desktop-style user interface implementations that provide a desktop-style user interface
...@@ -883,6 +884,14 @@ ...@@ -883,6 +884,14 @@
<arg name="orientation_lock" type="uint" summary="the orientation lock"/> <arg name="orientation_lock" type="uint" summary="the orientation lock"/>
</request> </request>
<!-- Version 15 additions -->
<request name="pip" since="15">
<description summary="set pip for a remote surface">
Request that surface is set to Picture-in-Picture (PIP).
</description>
</request>
</interface> </interface>
<interface name="zcr_notification_surface_v1" version="1"> <interface name="zcr_notification_surface_v1" version="1">
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment