Commit e0887d3e authored by Mitsuru Oshima's avatar Mitsuru Oshima Committed by Commit Bot

Add location to start_resize.

CrossOver wants to control where the resize operation starts.
I'm just updating the start_resize because it's not used yet.

Bug: b/74241712
Change-Id: I727bc2589be95912ca3830eff059fca20e660bb2
Reviewed-on: https://chromium-review.googlesource.com/957550
Commit-Queue: Mitsuru Oshima <oshima@chromium.org>
Reviewed-by: default avatarDavid Reveman <reveman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#543577}
parent db79bf6c
......@@ -364,21 +364,14 @@ void ClientControlledShellSurface::OnWindowStateChangeEvent(
state_changed_callback_.Run(current_state, next_state);
}
void ClientControlledShellSurface::StartResize(int component) {
TRACE_EVENT1("exo", "ClientControlledShellSurface::StartResize", "component",
component);
void ClientControlledShellSurface::StartDrag(int component,
const gfx::Point& location) {
TRACE_EVENT2("exo", "ClientControlledShellSurface::StartResize", "component",
component, "location", location.ToString());
if (!widget_ || client_controlled_move_resize_)
if (!widget_ || (client_controlled_move_resize_ && component != HTCAPTION))
return;
AttemptToStartDrag(component, GetMouseLocation());
}
void ClientControlledShellSurface::StartMove(const gfx::Point& location) {
TRACE_EVENT0("exo", "ClientControlledShellSurface::StartMove");
if (!widget_)
return;
AttemptToStartDrag(HTCAPTION, location);
AttemptToStartDrag(component, location);
}
void ClientControlledShellSurface::AttemptToStartDrag(
......
......@@ -150,10 +150,8 @@ class ClientControlledShellSurface
void OnDragStarted(int component);
void OnDragFinished(bool cancel, const gfx::Point& location);
void StartResize(int component);
// Starts the move-by-drag operation.
void StartMove(const gfx::Point& location);
// Starts the drag operation.
void StartDrag(int component, const gfx::Point& location);
// Set if the surface can be maximzied.
void SetCanMaximize(bool can_maximize);
......
......@@ -876,9 +876,8 @@ TEST_F(ClientControlledShellSurfaceTest, ClientIniatedResize) {
surface->Attach(desktop_buffer.get());
shell_surface->SetGeometry(gfx::Rect(window_size));
surface->Commit();
EXPECT_TRUE(shell_surface->GetWidget()->widget_delegate()->CanResize());
shell_surface->StartResize(HTTOP);
shell_surface->StartDrag(HTTOP, gfx::Point(0, 0));
aura::Window* window = shell_surface->GetWidget()->GetNativeWindow();
// Client cannot start drag if mouse isn't pressed.
......@@ -889,7 +888,7 @@ TEST_F(ClientControlledShellSurfaceTest, ClientIniatedResize) {
ui::test::EventGenerator& event_generator = GetEventGenerator();
event_generator.MoveMouseToCenterOf(window);
event_generator.PressLeftButton();
shell_surface->StartResize(HTTOP);
shell_surface->StartDrag(HTTOP, gfx::Point(0, 0));
ASSERT_TRUE(window_state->is_dragged());
event_generator.ReleaseLeftButton();
ASSERT_FALSE(window_state->is_dragged());
......@@ -897,7 +896,7 @@ TEST_F(ClientControlledShellSurfaceTest, ClientIniatedResize) {
// Press pressed outside of the window.
event_generator.MoveMouseTo(gfx::Point(200, 50));
event_generator.PressLeftButton();
shell_surface->StartResize(HTTOP);
shell_surface->StartDrag(HTTOP, gfx::Point(0, 0));
ASSERT_FALSE(window_state->is_dragged());
}
......
......@@ -2126,9 +2126,7 @@ void remote_surface_set_window_type(wl_client* client,
}
}
void remote_surface_resize(wl_client* client,
wl_resource* resource,
uint32_t direction) {
void remote_surface_resize(wl_client* client, wl_resource* resource) {
// DEPRECATED
}
......@@ -2143,8 +2141,8 @@ void remote_surface_start_move(wl_client* client,
wl_resource* resource,
int32_t x,
int32_t y) {
GetUserDataAs<ClientControlledShellSurface>(resource)->StartMove(
gfx::Point(x, y));
GetUserDataAs<ClientControlledShellSurface>(resource)->StartDrag(
HTCAPTION, gfx::Point(x, y));
}
void remote_surface_set_can_maximize(wl_client* client, wl_resource* resource) {
......@@ -2184,9 +2182,11 @@ void remote_surface_set_snapped_to_right(wl_client* client,
void remote_surface_start_resize(wl_client* client,
wl_resource* resource,
uint32_t direction) {
GetUserDataAs<ClientControlledShellSurface>(resource)->StartResize(
Component(direction));
uint32_t direction,
int32_t x,
int32_t y) {
GetUserDataAs<ClientControlledShellSurface>(resource)->StartDrag(
Component(direction), gfx::Point(x, y));
}
const struct zcr_remote_surface_v1_interface remote_surface_implementation = {
......
......@@ -1416,10 +1416,10 @@ zcr_remote_surface_v1_set_window_type(struct zcr_remote_surface_v1 *zcr_remote_s
* surface, e.g. fullscreen or maximized.
*/
static inline void
zcr_remote_surface_v1_resize(struct zcr_remote_surface_v1 *zcr_remote_surface_v1, uint32_t direction)
zcr_remote_surface_v1_resize(struct zcr_remote_surface_v1 *zcr_remote_surface_v1)
{
wl_proxy_marshal((struct wl_proxy *) zcr_remote_surface_v1,
ZCR_REMOTE_SURFACE_V1_RESIZE, direction);
ZCR_REMOTE_SURFACE_V1_RESIZE);
}
/**
......@@ -1545,6 +1545,8 @@ zcr_remote_surface_v1_set_snapped_to_right(struct zcr_remote_surface_v1 *zcr_rem
* @ingroup iface_zcr_remote_surface_v1
*
* Request to start an interactive, user-driven resize of the surface.
* "x" and "y" specifies the starting point of the pointer device
* that initiated the reize.
*
* The compositor responds to this request with a "drag_started"
* event, followed by "bounds_changed" events, and ends the
......@@ -1556,10 +1558,10 @@ zcr_remote_surface_v1_set_snapped_to_right(struct zcr_remote_surface_v1 *zcr_rem
* surface, e.g. fullscreen or maximized, or no drag event is in pregress.
*/
static inline void
zcr_remote_surface_v1_start_resize(struct zcr_remote_surface_v1 *zcr_remote_surface_v1, uint32_t resize_direction)
zcr_remote_surface_v1_start_resize(struct zcr_remote_surface_v1 *zcr_remote_surface_v1, uint32_t resize_direction, int32_t x, int32_t y)
{
wl_proxy_marshal((struct wl_proxy *) zcr_remote_surface_v1,
ZCR_REMOTE_SURFACE_V1_START_RESIZE, resize_direction);
ZCR_REMOTE_SURFACE_V1_START_RESIZE, resize_direction, x, y);
}
#define ZCR_NOTIFICATION_SURFACE_V1_DESTROY 0
......
......@@ -900,12 +900,10 @@ struct zcr_remote_surface_v1_interface {
*
* The compositor may ignore resize requests depending on the state
* of the surface, e.g. fullscreen or maximized.
* @param direction the direction of resize
* @since 9
*/
void (*resize)(struct wl_client *client,
struct wl_resource *resource,
uint32_t direction);
struct wl_resource *resource);
/**
* expand input region for resizing
*
......@@ -1005,7 +1003,8 @@ struct zcr_remote_surface_v1_interface {
* start an interactive resize
*
* Request to start an interactive, user-driven resize of the
* surface.
* surface. "x" and "y" specifies the starting point of the pointer
* device that initiated the reize.
*
* The compositor responds to this request with a "drag_started"
* event, followed by "bounds_changed" events, and ends the resize
......@@ -1021,7 +1020,9 @@ struct zcr_remote_surface_v1_interface {
*/
void (*start_resize)(struct wl_client *client,
struct wl_resource *resource,
uint32_t resize_direction);
uint32_t resize_direction,
int32_t x,
int32_t y);
};
#define ZCR_REMOTE_SURFACE_V1_CLOSE 0
......
......@@ -102,7 +102,7 @@ static const struct wl_message zcr_remote_surface_v1_requests[] = {
{ "move", "5", types + 0 },
{ "set_orientation", "6i", types + 0 },
{ "set_window_type", "7u", types + 0 },
{ "resize", "9u", types + 0 },
{ "resize", "9", types + 0 },
{ "set_resize_outset", "9i", types + 0 },
{ "start_move", "10ii", types + 0 },
{ "set_can_maximize", "10", types + 0 },
......@@ -111,7 +111,7 @@ static const struct wl_message zcr_remote_surface_v1_requests[] = {
{ "set_max_size", "10ii", types + 0 },
{ "set_snapped_to_left", "11", types + 0 },
{ "set_snapped_to_right", "11", types + 0 },
{ "start_resize", "12u", types + 0 },
{ "start_resize", "12uii", types + 0 },
};
static const struct wl_message zcr_remote_surface_v1_events[] = {
......
......@@ -778,6 +778,8 @@
<request name="start_resize" since="12">
<description summary="start an interactive resize">
Request to start an interactive, user-driven resize of the surface.
"x" and "y" specifies the starting point of the pointer device
that initiated the reize.
The compositor responds to this request with a "drag_started"
event, followed by "bounds_changed" events, and ends the
......@@ -789,6 +791,8 @@
surface, e.g. fullscreen or maximized, or no drag event is in pregress.
</description>
<arg name="resize_direction" type="uint" summary="the direction of resize"/>
<arg name="x" type="int"/>
<arg name="y" type="int"/>
</request>
</interface>
......
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