Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2438)

Unified Diff: ui/views/widget/desktop_aura/x11_window_event_filter.cc

Issue 229783002: linux_aura: Use system configuration for middle clicking the titlebar. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sadrul nits Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/widget/desktop_aura/x11_window_event_filter.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 9cb6834313d55bfa5f575810145ea3fa7b34c289..d6fbfc0fbd637fae65f7819bd45a7c5b19371605 100644
--- a/ui/views/widget/desktop_aura/x11_window_event_filter.cc
+++ b/ui/views/widget/desktop_aura/x11_window_event_filter.cc
@@ -17,6 +17,7 @@
#include "ui/events/event.h"
#include "ui/events/event_utils.h"
#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/native_widget_aura.h"
@@ -107,7 +108,27 @@ void X11WindowEventFilter::OnMouseEvent(ui::MouseEvent* event) {
return;
if (event->IsMiddleMouseButton() && (component == HTCAPTION)) {
- XLowerWindow(xdisplay_, xwindow_);
+ LinuxUI::NonClientMiddleClickAction action =
+ LinuxUI::MIDDLE_CLICK_ACTION_LOWER;
+ LinuxUI* linux_ui = LinuxUI::instance();
+ if (linux_ui)
+ action = linux_ui->GetNonClientMiddleClickAction();
+
+ switch (action) {
+ case LinuxUI::MIDDLE_CLICK_ACTION_NONE:
+ break;
+ case LinuxUI::MIDDLE_CLICK_ACTION_LOWER:
+ XLowerWindow(xdisplay_, xwindow_);
+ break;
+ case LinuxUI::MIDDLE_CLICK_ACTION_MINIMIZE:
+ window_tree_host_->Minimize();
+ break;
+ case LinuxUI::MIDDLE_CLICK_ACTION_TOGGLE_MAXIMIZE:
+ if (target->GetProperty(aura::client::kCanMaximizeKey))
+ ToggleMaximizedState();
+ break;
+ }
+
event->SetHandled();
return;
}
@@ -119,10 +140,7 @@ void X11WindowEventFilter::OnMouseEvent(ui::MouseEvent* event) {
// 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
- window_tree_host_->Maximize();
+ ToggleMaximizedState();
event->SetHandled();
return;
}
@@ -139,6 +157,13 @@ void X11WindowEventFilter::OnMouseEvent(ui::MouseEvent* event) {
}
}
+void X11WindowEventFilter::ToggleMaximizedState() {
+ if (window_tree_host_->IsMaximized())
+ window_tree_host_->Restore();
+ else
+ window_tree_host_->Maximize();
+}
+
bool X11WindowEventFilter::DispatchHostWindowDragMovement(
int hittest,
const gfx::Point& screen_location) {
« no previous file with comments | « ui/views/widget/desktop_aura/x11_window_event_filter.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698