#include <X11/Xatom.h>
#include <X11/Xlib.h>
+#include "ui/aura/client/aura_constants.h"
#include "ui/aura/root_window.h"
#include "ui/aura/window.h"
#include "ui/aura/window_delegate.h"
#include "ui/events/event.h"
#include "ui/events/event_utils.h"
#include "ui/gfx/x/x11_types.h"
-#include "ui/views/widget/desktop_aura/desktop_root_window_host.h"
+#include "ui/views/widget/desktop_aura/desktop_window_tree_host.h"
#include "ui/views/widget/native_widget_aura.h"
namespace {
X11WindowEventFilter::X11WindowEventFilter(
aura::RootWindow* root_window,
- DesktopWindowTreeHost* root_window_host)
+ DesktopWindowTreeHost* window_tree_host)
: xdisplay_(gfx::GetXDisplay()),
xwindow_(root_window->host()->GetAcceleratedWidget()),
x_root_window_(DefaultRootWindow(xdisplay_)),
atom_cache_(xdisplay_, kAtomsToCache),
- root_window_host_(root_window_host),
+ window_tree_host_(window_tree_host),
is_active_(false) {
}
if (component == HTCLIENT)
return;
- if (event->flags() & ui::EF_IS_DOUBLE_CLICK && component == HTCAPTION) {
- // Our event is a double click in the caption area. We are responsible for
- // dispatching this as a minimize/maximize on X11 (Windows converts this to
- // min/max events for us).
- if (root_window_host_->IsMaximized())
- root_window_host_->Restore();
+ if (event->flags() & ui::EF_IS_DOUBLE_CLICK &&
+ component == HTCAPTION &&
+ target->GetProperty(aura::client::kCanMaximizeKey)) {
+ // Our event is a double click in the caption area in a window that can be
+ // maximized. We are responsible for dispatching this as a minimize/
+ // maximize on X11 (Windows converts this to min/max events for us).
+ if (window_tree_host_->IsMaximized())
+ window_tree_host_->Restore();
else
- root_window_host_->Maximize();
+ window_tree_host_->Maximize();
event->SetHandled();
return;
}
if (event->native_event()) {
const gfx::Point x_root_location =
ui::EventSystemLocationFromNative(event->native_event());
- if (DispatchHostWindowDragMovement(component, x_root_location))
+ if ((component == HTCAPTION ||
+ target->GetProperty(aura::client::kCanResizeKey)) &&
+ DispatchHostWindowDragMovement(component, x_root_location)) {
event->StopPropagation();
+ }
}
}