OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/views/widget/desktop_aura/x11_window_event_filter.h" | 5 #include "ui/views/widget/desktop_aura/x11_window_event_filter.h" |
6 | 6 |
7 #include <X11/extensions/XInput.h> | 7 #include <X11/extensions/XInput.h> |
8 #include <X11/extensions/XInput2.h> | 8 #include <X11/extensions/XInput2.h> |
9 #include <X11/Xatom.h> | 9 #include <X11/Xatom.h> |
10 #include <X11/Xlib.h> | 10 #include <X11/Xlib.h> |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
144 event->StopPropagation(); | 144 event->StopPropagation(); |
145 } | 145 } |
146 } | 146 } |
147 | 147 |
148 void X11WindowEventFilter::OnClickedMaximizeButton(ui::MouseEvent* event) { | 148 void X11WindowEventFilter::OnClickedMaximizeButton(ui::MouseEvent* event) { |
149 aura::Window* target = static_cast<aura::Window*>(event->target()); | 149 aura::Window* target = static_cast<aura::Window*>(event->target()); |
150 views::Widget* widget = views::Widget::GetWidgetForNativeView(target); | 150 views::Widget* widget = views::Widget::GetWidgetForNativeView(target); |
151 if (!widget) | 151 if (!widget) |
152 return; | 152 return; |
153 | 153 |
154 gfx::Screen* screen = gfx::Screen::GetNativeScreen(); | 154 gfx::Screen* screen = gfx::Screen::GetScreen(); |
155 gfx::Rect display_work_area = | 155 gfx::Rect display_work_area = |
156 screen->GetDisplayNearestWindow(target).work_area(); | 156 screen->GetDisplayNearestWindow(target).work_area(); |
oshima
2016/01/19 20:44:31
inline?
scottmg
2016/01/19 21:55:58
Done.
| |
157 gfx::Rect bounds = widget->GetWindowBoundsInScreen(); | 157 gfx::Rect bounds = widget->GetWindowBoundsInScreen(); |
158 if (event->IsMiddleMouseButton()) { | 158 if (event->IsMiddleMouseButton()) { |
159 bounds.set_y(display_work_area.y()); | 159 bounds.set_y(display_work_area.y()); |
160 bounds.set_height(display_work_area.height()); | 160 bounds.set_height(display_work_area.height()); |
161 widget->SetBounds(bounds); | 161 widget->SetBounds(bounds); |
162 event->StopPropagation(); | 162 event->StopPropagation(); |
163 } else if (event->IsRightMouseButton()) { | 163 } else if (event->IsRightMouseButton()) { |
164 bounds.set_x(display_work_area.x()); | 164 bounds.set_x(display_work_area.x()); |
165 bounds.set_width(display_work_area.width()); | 165 bounds.set_width(display_work_area.width()); |
166 widget->SetBounds(bounds); | 166 widget->SetBounds(bounds); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
231 event.xclient.data.l[4] = 0; | 231 event.xclient.data.l[4] = 0; |
232 | 232 |
233 XSendEvent(xdisplay_, x_root_window_, False, | 233 XSendEvent(xdisplay_, x_root_window_, False, |
234 SubstructureRedirectMask | SubstructureNotifyMask, | 234 SubstructureRedirectMask | SubstructureNotifyMask, |
235 &event); | 235 &event); |
236 | 236 |
237 return true; | 237 return true; |
238 } | 238 } |
239 | 239 |
240 } // namespace views | 240 } // namespace views |
OLD | NEW |