| Index: ui/views/widget/desktop_aura/x11_window_event_filter.cc
|
| diff --git a/ui/views/widget/desktop_aura/x11_window_event_filter.cc b/ui/views/widget/desktop_aura/x11_window_event_filter.cc
|
| index b8a4c388be27a76e4a366cf11d697d3dbaea235c..dbfbad394b84ad9b4e3ad177dfceb34262895399 100644
|
| --- a/ui/views/widget/desktop_aura/x11_window_event_filter.cc
|
| +++ b/ui/views/widget/desktop_aura/x11_window_event_filter.cc
|
| @@ -14,6 +14,7 @@
|
| #include "ui/aura/window_delegate.h"
|
| #include "ui/aura/window_tree_host.h"
|
| #include "ui/base/hit_test.h"
|
| +#include "ui/base/x/x11_util.h"
|
| #include "ui/display/display.h"
|
| #include "ui/display/screen.h"
|
| #include "ui/events/event.h"
|
| @@ -21,38 +22,16 @@
|
| #include "ui/gfx/x/x11_types.h"
|
| #include "ui/views/linux_ui/linux_ui.h"
|
| #include "ui/views/widget/desktop_aura/desktop_window_tree_host.h"
|
| +#include "ui/views/widget/desktop_aura/x11_pointer_grab.h"
|
| #include "ui/views/widget/native_widget_aura.h"
|
| #include "ui/views/widget/widget.h"
|
|
|
| -namespace {
|
| -
|
| -// These constants are defined in the Extended Window Manager Hints
|
| -// standard...and aren't in any header that I can find.
|
| -const int k_NET_WM_MOVERESIZE_SIZE_TOPLEFT = 0;
|
| -const int k_NET_WM_MOVERESIZE_SIZE_TOP = 1;
|
| -const int k_NET_WM_MOVERESIZE_SIZE_TOPRIGHT = 2;
|
| -const int k_NET_WM_MOVERESIZE_SIZE_RIGHT = 3;
|
| -const int k_NET_WM_MOVERESIZE_SIZE_BOTTOMRIGHT = 4;
|
| -const int k_NET_WM_MOVERESIZE_SIZE_BOTTOM = 5;
|
| -const int k_NET_WM_MOVERESIZE_SIZE_BOTTOMLEFT = 6;
|
| -const int k_NET_WM_MOVERESIZE_SIZE_LEFT = 7;
|
| -const int k_NET_WM_MOVERESIZE_MOVE = 8;
|
| -
|
| -const char* kAtomsToCache[] = {
|
| - "_NET_WM_MOVERESIZE",
|
| - NULL
|
| -};
|
| -
|
| -} // namespace
|
| -
|
| namespace views {
|
|
|
| X11WindowEventFilter::X11WindowEventFilter(
|
| DesktopWindowTreeHost* window_tree_host)
|
| : xdisplay_(gfx::GetXDisplay()),
|
| xwindow_(window_tree_host->AsWindowTreeHost()->GetAcceleratedWidget()),
|
| - x_root_window_(DefaultRootWindow(xdisplay_)),
|
| - atom_cache_(xdisplay_, kAtomsToCache),
|
| window_tree_host_(window_tree_host),
|
| click_component_(HTNOWHERE) {
|
| }
|
| @@ -177,34 +156,34 @@ void X11WindowEventFilter::ToggleMaximizedState() {
|
| bool X11WindowEventFilter::DispatchHostWindowDragMovement(
|
| int hittest,
|
| const gfx::Point& screen_location) {
|
| - int direction = -1;
|
| + ui::NetWmMoveResize direction = ui::NetWmMoveResize::CANCEL;
|
| switch (hittest) {
|
| case HTBOTTOM:
|
| - direction = k_NET_WM_MOVERESIZE_SIZE_BOTTOM;
|
| + direction = ui::NetWmMoveResize::SIZE_BOTTOM;
|
| break;
|
| case HTBOTTOMLEFT:
|
| - direction = k_NET_WM_MOVERESIZE_SIZE_BOTTOMLEFT;
|
| + direction = ui::NetWmMoveResize::SIZE_BOTTOMLEFT;
|
| break;
|
| case HTBOTTOMRIGHT:
|
| - direction = k_NET_WM_MOVERESIZE_SIZE_BOTTOMRIGHT;
|
| + direction = ui::NetWmMoveResize::SIZE_BOTTOMRIGHT;
|
| break;
|
| case HTCAPTION:
|
| - direction = k_NET_WM_MOVERESIZE_MOVE;
|
| + direction = ui::NetWmMoveResize::MOVE;
|
| break;
|
| case HTLEFT:
|
| - direction = k_NET_WM_MOVERESIZE_SIZE_LEFT;
|
| + direction = ui::NetWmMoveResize::SIZE_LEFT;
|
| break;
|
| case HTRIGHT:
|
| - direction = k_NET_WM_MOVERESIZE_SIZE_RIGHT;
|
| + direction = ui::NetWmMoveResize::SIZE_RIGHT;
|
| break;
|
| case HTTOP:
|
| - direction = k_NET_WM_MOVERESIZE_SIZE_TOP;
|
| + direction = ui::NetWmMoveResize::SIZE_TOP;
|
| break;
|
| case HTTOPLEFT:
|
| - direction = k_NET_WM_MOVERESIZE_SIZE_TOPLEFT;
|
| + direction = ui::NetWmMoveResize::SIZE_TOPLEFT;
|
| break;
|
| case HTTOPRIGHT:
|
| - direction = k_NET_WM_MOVERESIZE_SIZE_TOPRIGHT;
|
| + direction = ui::NetWmMoveResize::SIZE_TOPRIGHT;
|
| break;
|
| default:
|
| return false;
|
| @@ -214,24 +193,8 @@ bool X11WindowEventFilter::DispatchHostWindowDragMovement(
|
| // because what we're about to do is tell the window manager
|
| // that it's now responsible for moving the window around; it immediately
|
| // grabs when it receives the event below.
|
| - XUngrabPointer(xdisplay_, CurrentTime);
|
| -
|
| - XEvent event;
|
| - memset(&event, 0, sizeof(event));
|
| - event.xclient.type = ClientMessage;
|
| - event.xclient.display = xdisplay_;
|
| - event.xclient.window = xwindow_;
|
| - event.xclient.message_type = atom_cache_.GetAtom("_NET_WM_MOVERESIZE");
|
| - event.xclient.format = 32;
|
| - event.xclient.data.l[0] = screen_location.x();
|
| - event.xclient.data.l[1] = screen_location.y();
|
| - event.xclient.data.l[2] = direction;
|
| - event.xclient.data.l[3] = 0;
|
| - event.xclient.data.l[4] = 0;
|
| -
|
| - XSendEvent(xdisplay_, x_root_window_, False,
|
| - SubstructureRedirectMask | SubstructureNotifyMask,
|
| - &event);
|
| + UngrabPointer();
|
| + MoveResizeWindowManaged(xwindow_, screen_location, direction);
|
|
|
| return true;
|
| }
|
|
|