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/desktop_window_tree_host_x11.h" | 5 #include "ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h" |
6 | 6 |
7 #include <X11/extensions/shape.h> | 7 #include <X11/extensions/shape.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/Xregion.h> | 10 #include <X11/Xregion.h> |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
198 return window_shape_; | 198 return window_shape_; |
199 } | 199 } |
200 | 200 |
201 void DesktopWindowTreeHostX11::HandleNativeWidgetActivationChanged( | 201 void DesktopWindowTreeHostX11::HandleNativeWidgetActivationChanged( |
202 bool active) { | 202 bool active) { |
203 if (active) { | 203 if (active) { |
204 FlashFrame(false); | 204 FlashFrame(false); |
205 OnHostActivated(); | 205 OnHostActivated(); |
206 open_windows().remove(xwindow_); | 206 open_windows().remove(xwindow_); |
207 open_windows().insert(open_windows().begin(), xwindow_); | 207 open_windows().insert(open_windows().begin(), xwindow_); |
208 } else { | |
209 ReleaseCapture(); | |
208 } | 210 } |
209 | 211 |
210 desktop_native_widget_aura_->HandleActivationChanged(active); | 212 desktop_native_widget_aura_->HandleActivationChanged(active); |
211 | 213 |
212 native_widget_delegate_->AsWidget()->GetRootView()->SchedulePaint(); | 214 native_widget_delegate_->AsWidget()->GetRootView()->SchedulePaint(); |
213 } | 215 } |
214 | 216 |
215 void DesktopWindowTreeHostX11::AddObserver( | 217 void DesktopWindowTreeHostX11::AddObserver( |
216 views::DesktopWindowTreeHostObserverX11* observer) { | 218 views::DesktopWindowTreeHostObserverX11* observer) { |
217 observer_list_.AddObserver(observer); | 219 observer_list_.AddObserver(observer); |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
306 FROM_HERE, | 308 FROM_HERE, |
307 base::Bind(&DesktopWindowTreeHostX11::CloseNow, | 309 base::Bind(&DesktopWindowTreeHostX11::CloseNow, |
308 close_widget_factory_.GetWeakPtr())); | 310 close_widget_factory_.GetWeakPtr())); |
309 } | 311 } |
310 } | 312 } |
311 | 313 |
312 void DesktopWindowTreeHostX11::CloseNow() { | 314 void DesktopWindowTreeHostX11::CloseNow() { |
313 if (xwindow_ == None) | 315 if (xwindow_ == None) |
314 return; | 316 return; |
315 | 317 |
316 x11_capture_.reset(); | 318 ReleaseCapture(); |
317 native_widget_delegate_->OnNativeWidgetDestroying(); | 319 native_widget_delegate_->OnNativeWidgetDestroying(); |
318 | 320 |
319 // If we have children, close them. Use a copy for iteration because they'll | 321 // If we have children, close them. Use a copy for iteration because they'll |
320 // remove themselves. | 322 // remove themselves. |
321 std::set<DesktopWindowTreeHostX11*> window_children_copy = window_children_; | 323 std::set<DesktopWindowTreeHostX11*> window_children_copy = window_children_; |
322 for (std::set<DesktopWindowTreeHostX11*>::iterator it = | 324 for (std::set<DesktopWindowTreeHostX11*>::iterator it = |
323 window_children_copy.begin(); it != window_children_copy.end(); | 325 window_children_copy.begin(); it != window_children_copy.end(); |
324 ++it) { | 326 ++it) { |
325 (*it)->CloseNow(); | 327 (*it)->CloseNow(); |
326 } | 328 } |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
503 if (!window_mapped_) | 505 if (!window_mapped_) |
504 return; | 506 return; |
505 | 507 |
506 X11DesktopHandler::get()->ActivateWindow(xwindow_); | 508 X11DesktopHandler::get()->ActivateWindow(xwindow_); |
507 } | 509 } |
508 | 510 |
509 void DesktopWindowTreeHostX11::Deactivate() { | 511 void DesktopWindowTreeHostX11::Deactivate() { |
510 if (!IsActive()) | 512 if (!IsActive()) |
511 return; | 513 return; |
512 | 514 |
513 x11_capture_.reset(); | 515 ReleaseCapture(); |
514 X11DesktopHandler::get()->DeactivateWindow(xwindow_); | 516 X11DesktopHandler::get()->DeactivateWindow(xwindow_); |
515 } | 517 } |
516 | 518 |
517 bool DesktopWindowTreeHostX11::IsActive() const { | 519 bool DesktopWindowTreeHostX11::IsActive() const { |
518 return X11DesktopHandler::get()->IsActiveWindow(xwindow_); | 520 return X11DesktopHandler::get()->IsActiveWindow(xwindow_); |
519 } | 521 } |
520 | 522 |
521 void DesktopWindowTreeHostX11::Maximize() { | 523 void DesktopWindowTreeHostX11::Maximize() { |
522 // When we are in the process of requesting to maximize a window, we can | 524 // When we are in the process of requesting to maximize a window, we can |
523 // accurately keep track of our restored bounds instead of relying on the | 525 // accurately keep track of our restored bounds instead of relying on the |
524 // heuristics that are in the PropertyNotify and ConfigureNotify handlers. | 526 // heuristics that are in the PropertyNotify and ConfigureNotify handlers. |
525 restored_bounds_ = bounds_; | 527 restored_bounds_ = bounds_; |
526 | 528 |
527 SetWMSpecState(true, | 529 SetWMSpecState(true, |
528 atom_cache_.GetAtom("_NET_WM_STATE_MAXIMIZED_VERT"), | 530 atom_cache_.GetAtom("_NET_WM_STATE_MAXIMIZED_VERT"), |
529 atom_cache_.GetAtom("_NET_WM_STATE_MAXIMIZED_HORZ")); | 531 atom_cache_.GetAtom("_NET_WM_STATE_MAXIMIZED_HORZ")); |
530 if (IsMinimized()) | 532 if (IsMinimized()) |
531 ShowWindowWithState(ui::SHOW_STATE_NORMAL); | 533 ShowWindowWithState(ui::SHOW_STATE_NORMAL); |
532 } | 534 } |
533 | 535 |
534 void DesktopWindowTreeHostX11::Minimize() { | 536 void DesktopWindowTreeHostX11::Minimize() { |
535 x11_capture_.reset(); | 537 ReleaseCapture(); |
536 XIconifyWindow(xdisplay_, xwindow_, 0); | 538 XIconifyWindow(xdisplay_, xwindow_, 0); |
537 } | 539 } |
538 | 540 |
539 void DesktopWindowTreeHostX11::Restore() { | 541 void DesktopWindowTreeHostX11::Restore() { |
540 SetWMSpecState(false, | 542 SetWMSpecState(false, |
541 atom_cache_.GetAtom("_NET_WM_STATE_MAXIMIZED_VERT"), | 543 atom_cache_.GetAtom("_NET_WM_STATE_MAXIMIZED_VERT"), |
542 atom_cache_.GetAtom("_NET_WM_STATE_MAXIMIZED_HORZ")); | 544 atom_cache_.GetAtom("_NET_WM_STATE_MAXIMIZED_HORZ")); |
543 if (IsMinimized()) | 545 if (IsMinimized()) |
544 ShowWindowWithState(ui::SHOW_STATE_NORMAL); | 546 ShowWindowWithState(ui::SHOW_STATE_NORMAL); |
545 } | 547 } |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
814 } | 816 } |
815 | 817 |
816 XSetWMNormalHints(xdisplay_, xwindow_, &hints); | 818 XSetWMNormalHints(xdisplay_, xwindow_, &hints); |
817 } | 819 } |
818 | 820 |
819 void DesktopWindowTreeHostX11::OnNativeWidgetFocus() { | 821 void DesktopWindowTreeHostX11::OnNativeWidgetFocus() { |
820 native_widget_delegate_->AsWidget()->GetInputMethod()->OnFocus(); | 822 native_widget_delegate_->AsWidget()->GetInputMethod()->OnFocus(); |
821 } | 823 } |
822 | 824 |
823 void DesktopWindowTreeHostX11::OnNativeWidgetBlur() { | 825 void DesktopWindowTreeHostX11::OnNativeWidgetBlur() { |
824 if (xwindow_) { | 826 if (xwindow_) |
825 x11_capture_.reset(); | |
sadrul
2014/07/14 16:58:00
Can you explain this change?
pkotwicz
2014/07/14 18:25:20
This line in particular made it pointless to grab
| |
826 native_widget_delegate_->AsWidget()->GetInputMethod()->OnBlur(); | 827 native_widget_delegate_->AsWidget()->GetInputMethod()->OnBlur(); |
827 } | |
828 } | 828 } |
829 | 829 |
830 bool DesktopWindowTreeHostX11::IsAnimatingClosed() const { | 830 bool DesktopWindowTreeHostX11::IsAnimatingClosed() const { |
831 return false; | 831 return false; |
832 } | 832 } |
833 | 833 |
834 //////////////////////////////////////////////////////////////////////////////// | 834 //////////////////////////////////////////////////////////////////////////////// |
835 // DesktopWindowTreeHostX11, aura::WindowTreeHost implementation: | 835 // DesktopWindowTreeHostX11, aura::WindowTreeHost implementation: |
836 | 836 |
837 ui::EventSource* DesktopWindowTreeHostX11::GetEventSource() { | 837 ui::EventSource* DesktopWindowTreeHostX11::GetEventSource() { |
(...skipping 976 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1814 if (linux_ui) { | 1814 if (linux_ui) { |
1815 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(window); | 1815 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(window); |
1816 if (native_theme) | 1816 if (native_theme) |
1817 return native_theme; | 1817 return native_theme; |
1818 } | 1818 } |
1819 | 1819 |
1820 return ui::NativeTheme::instance(); | 1820 return ui::NativeTheme::instance(); |
1821 } | 1821 } |
1822 | 1822 |
1823 } // namespace views | 1823 } // namespace views |
OLD | NEW |