| 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 789 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   800       // none. The comment in desktop_native_widget_aura.cc suggests that this |   800       // none. The comment in desktop_native_widget_aura.cc suggests that this | 
|   801       // is rare. |   801       // is rare. | 
|   802       NOTIMPLEMENTED(); |   802       NOTIMPLEMENTED(); | 
|   803   } |   803   } | 
|   804 } |   804 } | 
|   805  |   805  | 
|   806 void DesktopWindowTreeHostX11::FlashFrame(bool flash_frame) { |   806 void DesktopWindowTreeHostX11::FlashFrame(bool flash_frame) { | 
|   807   if (urgency_hint_set_ == flash_frame) |   807   if (urgency_hint_set_ == flash_frame) | 
|   808     return; |   808     return; | 
|   809  |   809  | 
|   810   XWMHints* hints = XGetWMHints(xdisplay_, xwindow_); |   810   gfx::XScopedPtr<XWMHints> hints(XGetWMHints(xdisplay_, xwindow_)); | 
|   811   if (!hints) { |   811   if (!hints) { | 
|   812     // The window hasn't had its hints set yet. |   812     // The window hasn't had its hints set yet. | 
|   813     hints = XAllocWMHints(); |   813     hints.reset(XAllocWMHints()); | 
|   814   } |   814   } | 
|   815  |   815  | 
|   816   if (flash_frame) |   816   if (flash_frame) | 
|   817     hints->flags |= XUrgencyHint; |   817     hints->flags |= XUrgencyHint; | 
|   818   else |   818   else | 
|   819     hints->flags &= ~XUrgencyHint; |   819     hints->flags &= ~XUrgencyHint; | 
|   820  |   820  | 
|   821   XSetWMHints(xdisplay_, xwindow_, hints); |   821   XSetWMHints(xdisplay_, xwindow_, hints.get()); | 
|   822   XFree(hints); |  | 
|   823  |   822  | 
|   824   urgency_hint_set_ = flash_frame; |   823   urgency_hint_set_ = flash_frame; | 
|   825 } |   824 } | 
|   826  |   825  | 
|   827 void DesktopWindowTreeHostX11::OnRootViewLayout() { |   826 void DesktopWindowTreeHostX11::OnRootViewLayout() { | 
|   828   UpdateMinAndMaxSize(); |   827   UpdateMinAndMaxSize(); | 
|   829 } |   828 } | 
|   830  |   829  | 
|   831 void DesktopWindowTreeHostX11::OnNativeWidgetFocus() { |   830 void DesktopWindowTreeHostX11::OnNativeWidgetFocus() { | 
|   832   native_widget_delegate_->AsWidget()->GetInputMethod()->OnFocus(); |   831   native_widget_delegate_->AsWidget()->GetInputMethod()->OnFocus(); | 
| (...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1528   SkAutoLockPixels locker(bitmap); |  1527   SkAutoLockPixels locker(bitmap); | 
|  1529  |  1528  | 
|  1530   for (int y = 0; y < height; ++y) |  1529   for (int y = 0; y < height; ++y) | 
|  1531     for (int x = 0; x < width; ++x) |  1530     for (int x = 0; x < width; ++x) | 
|  1532       data->push_back(bitmap.getColor(x, y)); |  1531       data->push_back(bitmap.getColor(x, y)); | 
|  1533 } |  1532 } | 
|  1534  |  1533  | 
|  1535 Visual* DesktopWindowTreeHostX11::GetARGBVisual() { |  1534 Visual* DesktopWindowTreeHostX11::GetARGBVisual() { | 
|  1536   XVisualInfo visual_template; |  1535   XVisualInfo visual_template; | 
|  1537   visual_template.screen = 0; |  1536   visual_template.screen = 0; | 
|  1538   Visual* to_return = NULL; |  | 
|  1539  |  1537  | 
|  1540   int visuals_len; |  1538   int visuals_len; | 
|  1541   XVisualInfo* visual_list = XGetVisualInfo(xdisplay_, |  1539   gfx::XScopedPtr<XVisualInfo[]> visual_list(XGetVisualInfo( | 
|  1542                                             VisualScreenMask, |  1540       xdisplay_, VisualScreenMask, &visual_template, &visuals_len)); | 
|  1543                                             &visual_template, &visuals_len); |  | 
|  1544   for (int i = 0; i < visuals_len; ++i) { |  1541   for (int i = 0; i < visuals_len; ++i) { | 
|  1545     // Why support only 8888 ARGB? Because it's all that GTK+ supports. In |  1542     // Why support only 8888 ARGB? Because it's all that GTK+ supports. In | 
|  1546     // gdkvisual-x11.cc, they look for this specific visual and use it for all |  1543     // gdkvisual-x11.cc, they look for this specific visual and use it for all | 
|  1547     // their alpha channel using needs. |  1544     // their alpha channel using needs. | 
|  1548     // |  1545     // | 
|  1549     // TODO(erg): While the following does find a valid visual, some GL drivers |  1546     // TODO(erg): While the following does find a valid visual, some GL drivers | 
|  1550     // don't believe that this has an alpha channel. According to marcheu@, |  1547     // don't believe that this has an alpha channel. According to marcheu@, | 
|  1551     // this should work on open source driver though. (It doesn't work with |  1548     // this should work on open source driver though. (It doesn't work with | 
|  1552     // NVidia's binaries currently.) http://crbug.com/369209 |  1549     // NVidia's binaries currently.) http://crbug.com/369209 | 
|  1553     if (visual_list[i].depth == 32 && |  1550     const XVisualInfo& info = visual_list[i]; | 
|  1554         visual_list[i].visual->red_mask == 0xff0000 && |  1551     if (info.depth == 32 && info.visual->red_mask == 0xff0000 && | 
|  1555         visual_list[i].visual->green_mask == 0x00ff00 && |  1552         info.visual->green_mask == 0x00ff00 && | 
|  1556         visual_list[i].visual->blue_mask == 0x0000ff) { |  1553         info.visual->blue_mask == 0x0000ff) { | 
|  1557       to_return = visual_list[i].visual; |  1554       return info.visual; | 
|  1558       break; |  | 
|  1559     } |  1555     } | 
|  1560   } |  1556   } | 
|  1561  |  1557  | 
|  1562   if (visual_list) |  1558   return nullptr; | 
|  1563     XFree(visual_list); |  | 
|  1564  |  | 
|  1565   return to_return; |  | 
|  1566 } |  1559 } | 
|  1567  |  1560  | 
|  1568 std::list<XID>& DesktopWindowTreeHostX11::open_windows() { |  1561 std::list<XID>& DesktopWindowTreeHostX11::open_windows() { | 
|  1569   if (!open_windows_) |  1562   if (!open_windows_) | 
|  1570     open_windows_ = new std::list<XID>(); |  1563     open_windows_ = new std::list<XID>(); | 
|  1571   return *open_windows_; |  1564   return *open_windows_; | 
|  1572 } |  1565 } | 
|  1573  |  1566  | 
|  1574 void DesktopWindowTreeHostX11::MapWindow(ui::WindowShowState show_state) { |  1567 void DesktopWindowTreeHostX11::MapWindow(ui::WindowShowState show_state) { | 
|  1575   if (show_state != ui::SHOW_STATE_DEFAULT && |  1568   if (show_state != ui::SHOW_STATE_DEFAULT && | 
| (...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1986   if (linux_ui) { |  1979   if (linux_ui) { | 
|  1987     ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(window); |  1980     ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(window); | 
|  1988     if (native_theme) |  1981     if (native_theme) | 
|  1989       return native_theme; |  1982       return native_theme; | 
|  1990   } |  1983   } | 
|  1991  |  1984  | 
|  1992   return ui::NativeTheme::instance(); |  1985   return ui::NativeTheme::instance(); | 
|  1993 } |  1986 } | 
|  1994  |  1987  | 
|  1995 }  // namespace views |  1988 }  // namespace views | 
| OLD | NEW |