| 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 30 matching lines...) Expand all Loading... |
| 41 #include "ui/events/event_utils.h" | 41 #include "ui/events/event_utils.h" |
| 42 #include "ui/events/null_event_targeter.h" | 42 #include "ui/events/null_event_targeter.h" |
| 43 #include "ui/events/platform/platform_event_source.h" | 43 #include "ui/events/platform/platform_event_source.h" |
| 44 #include "ui/events/platform/x11/x11_event_source.h" | 44 #include "ui/events/platform/x11/x11_event_source.h" |
| 45 #include "ui/gfx/geometry/insets.h" | 45 #include "ui/gfx/geometry/insets.h" |
| 46 #include "ui/gfx/geometry/size_conversions.h" | 46 #include "ui/gfx/geometry/size_conversions.h" |
| 47 #include "ui/gfx/image/image_skia.h" | 47 #include "ui/gfx/image/image_skia.h" |
| 48 #include "ui/gfx/image/image_skia_rep.h" | 48 #include "ui/gfx/image/image_skia_rep.h" |
| 49 #include "ui/gfx/path.h" | 49 #include "ui/gfx/path.h" |
| 50 #include "ui/gfx/path_x11.h" | 50 #include "ui/gfx/path_x11.h" |
| 51 #include "ui/gfx/x/x11_atom_cache.h" |
| 51 #include "ui/views/corewm/tooltip_aura.h" | 52 #include "ui/views/corewm/tooltip_aura.h" |
| 52 #include "ui/views/linux_ui/linux_ui.h" | 53 #include "ui/views/linux_ui/linux_ui.h" |
| 53 #include "ui/views/views_delegate.h" | 54 #include "ui/views/views_delegate.h" |
| 54 #include "ui/views/views_switches.h" | 55 #include "ui/views/views_switches.h" |
| 55 #include "ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.h" | 56 #include "ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.h" |
| 56 #include "ui/views/widget/desktop_aura/desktop_native_cursor_manager.h" | 57 #include "ui/views/widget/desktop_aura/desktop_native_cursor_manager.h" |
| 57 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" | 58 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" |
| 58 #include "ui/views/widget/desktop_aura/desktop_window_tree_host_observer_x11.h" | 59 #include "ui/views/widget/desktop_aura/desktop_window_tree_host_observer_x11.h" |
| 59 #include "ui/views/widget/desktop_aura/x11_desktop_handler.h" | 60 #include "ui/views/widget/desktop_aura/x11_desktop_handler.h" |
| 60 #include "ui/views/widget/desktop_aura/x11_desktop_window_move_client.h" | 61 #include "ui/views/widget/desktop_aura/x11_desktop_window_move_client.h" |
| (...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 724 return; | 725 return; |
| 725 | 726 |
| 726 BeforeActivationStateChanged(); | 727 BeforeActivationStateChanged(); |
| 727 | 728 |
| 728 ignore_keyboard_input_ = false; | 729 ignore_keyboard_input_ = false; |
| 729 | 730 |
| 730 // wmii says that it supports _NET_ACTIVE_WINDOW but does not. | 731 // wmii says that it supports _NET_ACTIVE_WINDOW but does not. |
| 731 // https://code.google.com/p/wmii/issues/detail?id=266 | 732 // https://code.google.com/p/wmii/issues/detail?id=266 |
| 732 static bool wm_supports_active_window = | 733 static bool wm_supports_active_window = |
| 733 ui::GuessWindowManager() != ui::WM_WMII && | 734 ui::GuessWindowManager() != ui::WM_WMII && |
| 734 ui::WmSupportsHint(ui::GetAtom("_NET_ACTIVE_WINDOW")); | 735 ui::WmSupportsHint(gfx::GetAtom("_NET_ACTIVE_WINDOW")); |
| 735 | 736 |
| 736 Time timestamp = ui::X11EventSource::GetInstance()->GetTimestamp(); | 737 Time timestamp = ui::X11EventSource::GetInstance()->GetTimestamp(); |
| 737 | 738 |
| 738 if (wm_supports_active_window) { | 739 if (wm_supports_active_window) { |
| 739 XEvent xclient; | 740 XEvent xclient; |
| 740 memset(&xclient, 0, sizeof(xclient)); | 741 memset(&xclient, 0, sizeof(xclient)); |
| 741 xclient.type = ClientMessage; | 742 xclient.type = ClientMessage; |
| 742 xclient.xclient.window = xwindow_; | 743 xclient.xclient.window = xwindow_; |
| 743 xclient.xclient.message_type = ui::GetAtom("_NET_ACTIVE_WINDOW"); | 744 xclient.xclient.message_type = gfx::GetAtom("_NET_ACTIVE_WINDOW"); |
| 744 xclient.xclient.format = 32; | 745 xclient.xclient.format = 32; |
| 745 xclient.xclient.data.l[0] = 1; // Specified we are an app. | 746 xclient.xclient.data.l[0] = 1; // Specified we are an app. |
| 746 xclient.xclient.data.l[1] = timestamp; | 747 xclient.xclient.data.l[1] = timestamp; |
| 747 // TODO(thomasanderson): if another chrome window is active, specify that in | 748 // TODO(thomasanderson): if another chrome window is active, specify that in |
| 748 // data.l[2]. The EWMH spec claims this may make the WM more likely to | 749 // data.l[2]. The EWMH spec claims this may make the WM more likely to |
| 749 // service our _NET_ACTIVE_WINDOW request. | 750 // service our _NET_ACTIVE_WINDOW request. |
| 750 xclient.xclient.data.l[2] = None; | 751 xclient.xclient.data.l[2] = None; |
| 751 xclient.xclient.data.l[3] = 0; | 752 xclient.xclient.data.l[3] = 0; |
| 752 xclient.xclient.data.l[4] = 0; | 753 xclient.xclient.data.l[4] = 0; |
| 753 | 754 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 790 | 791 |
| 791 // |has_window_focus_| and |has_pointer_focus_| are mutually exclusive. | 792 // |has_window_focus_| and |has_pointer_focus_| are mutually exclusive. |
| 792 DCHECK(!has_window_focus_ || !has_pointer_focus_); | 793 DCHECK(!has_window_focus_ || !has_pointer_focus_); |
| 793 | 794 |
| 794 return is_active; | 795 return is_active; |
| 795 } | 796 } |
| 796 | 797 |
| 797 void DesktopWindowTreeHostX11::Maximize() { | 798 void DesktopWindowTreeHostX11::Maximize() { |
| 798 if (HasWMSpecProperty("_NET_WM_STATE_FULLSCREEN")) { | 799 if (HasWMSpecProperty("_NET_WM_STATE_FULLSCREEN")) { |
| 799 // Unfullscreen the window if it is fullscreen. | 800 // Unfullscreen the window if it is fullscreen. |
| 800 SetWMSpecState(false, ui::GetAtom("_NET_WM_STATE_FULLSCREEN"), None); | 801 SetWMSpecState(false, gfx::GetAtom("_NET_WM_STATE_FULLSCREEN"), None); |
| 801 | 802 |
| 802 // Resize the window so that it does not have the same size as a monitor. | 803 // Resize the window so that it does not have the same size as a monitor. |
| 803 // (Otherwise, some window managers immediately put the window back in | 804 // (Otherwise, some window managers immediately put the window back in |
| 804 // fullscreen mode). | 805 // fullscreen mode). |
| 805 gfx::Rect adjusted_bounds_in_pixels(bounds_in_pixels_.origin(), | 806 gfx::Rect adjusted_bounds_in_pixels(bounds_in_pixels_.origin(), |
| 806 AdjustSize(bounds_in_pixels_.size())); | 807 AdjustSize(bounds_in_pixels_.size())); |
| 807 if (adjusted_bounds_in_pixels != bounds_in_pixels_) | 808 if (adjusted_bounds_in_pixels != bounds_in_pixels_) |
| 808 SetBoundsInPixels(adjusted_bounds_in_pixels); | 809 SetBoundsInPixels(adjusted_bounds_in_pixels); |
| 809 } | 810 } |
| 810 | 811 |
| 811 // Some WMs do not respect maximization hints on unmapped windows, so we | 812 // Some WMs do not respect maximization hints on unmapped windows, so we |
| 812 // save this one for later too. | 813 // save this one for later too. |
| 813 should_maximize_after_map_ = !IsVisible(); | 814 should_maximize_after_map_ = !IsVisible(); |
| 814 | 815 |
| 815 // When we are in the process of requesting to maximize a window, we can | 816 // When we are in the process of requesting to maximize a window, we can |
| 816 // accurately keep track of our restored bounds instead of relying on the | 817 // accurately keep track of our restored bounds instead of relying on the |
| 817 // heuristics that are in the PropertyNotify and ConfigureNotify handlers. | 818 // heuristics that are in the PropertyNotify and ConfigureNotify handlers. |
| 818 restored_bounds_in_pixels_ = bounds_in_pixels_; | 819 restored_bounds_in_pixels_ = bounds_in_pixels_; |
| 819 | 820 |
| 820 SetWMSpecState(true, ui::GetAtom("_NET_WM_STATE_MAXIMIZED_VERT"), | 821 SetWMSpecState(true, gfx::GetAtom("_NET_WM_STATE_MAXIMIZED_VERT"), |
| 821 ui::GetAtom("_NET_WM_STATE_MAXIMIZED_HORZ")); | 822 gfx::GetAtom("_NET_WM_STATE_MAXIMIZED_HORZ")); |
| 822 if (IsMinimized()) | 823 if (IsMinimized()) |
| 823 ShowWindowWithState(ui::SHOW_STATE_NORMAL); | 824 ShowWindowWithState(ui::SHOW_STATE_NORMAL); |
| 824 } | 825 } |
| 825 | 826 |
| 826 void DesktopWindowTreeHostX11::Minimize() { | 827 void DesktopWindowTreeHostX11::Minimize() { |
| 827 ReleaseCapture(); | 828 ReleaseCapture(); |
| 828 XIconifyWindow(xdisplay_, xwindow_, 0); | 829 XIconifyWindow(xdisplay_, xwindow_, 0); |
| 829 } | 830 } |
| 830 | 831 |
| 831 void DesktopWindowTreeHostX11::Restore() { | 832 void DesktopWindowTreeHostX11::Restore() { |
| 832 should_maximize_after_map_ = false; | 833 should_maximize_after_map_ = false; |
| 833 SetWMSpecState(false, ui::GetAtom("_NET_WM_STATE_MAXIMIZED_VERT"), | 834 SetWMSpecState(false, gfx::GetAtom("_NET_WM_STATE_MAXIMIZED_VERT"), |
| 834 ui::GetAtom("_NET_WM_STATE_MAXIMIZED_HORZ")); | 835 gfx::GetAtom("_NET_WM_STATE_MAXIMIZED_HORZ")); |
| 835 if (IsMinimized()) | 836 if (IsMinimized()) |
| 836 ShowWindowWithState(ui::SHOW_STATE_NORMAL); | 837 ShowWindowWithState(ui::SHOW_STATE_NORMAL); |
| 837 } | 838 } |
| 838 | 839 |
| 839 bool DesktopWindowTreeHostX11::IsMaximized() const { | 840 bool DesktopWindowTreeHostX11::IsMaximized() const { |
| 840 return (HasWMSpecProperty("_NET_WM_STATE_MAXIMIZED_VERT") && | 841 return (HasWMSpecProperty("_NET_WM_STATE_MAXIMIZED_VERT") && |
| 841 HasWMSpecProperty("_NET_WM_STATE_MAXIMIZED_HORZ")); | 842 HasWMSpecProperty("_NET_WM_STATE_MAXIMIZED_HORZ")); |
| 842 } | 843 } |
| 843 | 844 |
| 844 bool DesktopWindowTreeHostX11::IsMinimized() const { | 845 bool DesktopWindowTreeHostX11::IsMinimized() const { |
| 845 return HasWMSpecProperty("_NET_WM_STATE_HIDDEN"); | 846 return HasWMSpecProperty("_NET_WM_STATE_HIDDEN"); |
| 846 } | 847 } |
| 847 | 848 |
| 848 bool DesktopWindowTreeHostX11::HasCapture() const { | 849 bool DesktopWindowTreeHostX11::HasCapture() const { |
| 849 return g_current_capture == this; | 850 return g_current_capture == this; |
| 850 } | 851 } |
| 851 | 852 |
| 852 void DesktopWindowTreeHostX11::SetAlwaysOnTop(bool always_on_top) { | 853 void DesktopWindowTreeHostX11::SetAlwaysOnTop(bool always_on_top) { |
| 853 is_always_on_top_ = always_on_top; | 854 is_always_on_top_ = always_on_top; |
| 854 SetWMSpecState(always_on_top, ui::GetAtom("_NET_WM_STATE_ABOVE"), None); | 855 SetWMSpecState(always_on_top, gfx::GetAtom("_NET_WM_STATE_ABOVE"), None); |
| 855 } | 856 } |
| 856 | 857 |
| 857 bool DesktopWindowTreeHostX11::IsAlwaysOnTop() const { | 858 bool DesktopWindowTreeHostX11::IsAlwaysOnTop() const { |
| 858 return is_always_on_top_; | 859 return is_always_on_top_; |
| 859 } | 860 } |
| 860 | 861 |
| 861 void DesktopWindowTreeHostX11::SetVisibleOnAllWorkspaces(bool always_visible) { | 862 void DesktopWindowTreeHostX11::SetVisibleOnAllWorkspaces(bool always_visible) { |
| 862 SetWMSpecState(always_visible, ui::GetAtom("_NET_WM_STATE_STICKY"), None); | 863 SetWMSpecState(always_visible, gfx::GetAtom("_NET_WM_STATE_STICKY"), None); |
| 863 | 864 |
| 864 int new_desktop = 0; | 865 int new_desktop = 0; |
| 865 if (always_visible) { | 866 if (always_visible) { |
| 866 new_desktop = kAllDesktops; | 867 new_desktop = kAllDesktops; |
| 867 } else { | 868 } else { |
| 868 if (!ui::GetCurrentDesktop(&new_desktop)) | 869 if (!ui::GetCurrentDesktop(&new_desktop)) |
| 869 return; | 870 return; |
| 870 } | 871 } |
| 871 | 872 |
| 872 workspace_ = base::IntToString(kAllDesktops); | 873 workspace_ = base::IntToString(kAllDesktops); |
| 873 XEvent xevent; | 874 XEvent xevent; |
| 874 memset (&xevent, 0, sizeof (xevent)); | 875 memset (&xevent, 0, sizeof (xevent)); |
| 875 xevent.type = ClientMessage; | 876 xevent.type = ClientMessage; |
| 876 xevent.xclient.window = xwindow_; | 877 xevent.xclient.window = xwindow_; |
| 877 xevent.xclient.message_type = ui::GetAtom("_NET_WM_DESKTOP"); | 878 xevent.xclient.message_type = gfx::GetAtom("_NET_WM_DESKTOP"); |
| 878 xevent.xclient.format = 32; | 879 xevent.xclient.format = 32; |
| 879 xevent.xclient.data.l[0] = new_desktop; | 880 xevent.xclient.data.l[0] = new_desktop; |
| 880 xevent.xclient.data.l[1] = 0; | 881 xevent.xclient.data.l[1] = 0; |
| 881 xevent.xclient.data.l[2] = 0; | 882 xevent.xclient.data.l[2] = 0; |
| 882 xevent.xclient.data.l[3] = 0; | 883 xevent.xclient.data.l[3] = 0; |
| 883 xevent.xclient.data.l[4] = 0; | 884 xevent.xclient.data.l[4] = 0; |
| 884 XSendEvent(xdisplay_, x_root_window_, False, | 885 XSendEvent(xdisplay_, x_root_window_, False, |
| 885 SubstructureRedirectMask | SubstructureNotifyMask, | 886 SubstructureRedirectMask | SubstructureNotifyMask, |
| 886 &xevent); | 887 &xevent); |
| 887 } | 888 } |
| 888 | 889 |
| 889 bool DesktopWindowTreeHostX11::IsVisibleOnAllWorkspaces() const { | 890 bool DesktopWindowTreeHostX11::IsVisibleOnAllWorkspaces() const { |
| 890 // We don't need a check for _NET_WM_STATE_STICKY because that would specify | 891 // We don't need a check for _NET_WM_STATE_STICKY because that would specify |
| 891 // that the window remain in a fixed position even if the viewport scrolls. | 892 // that the window remain in a fixed position even if the viewport scrolls. |
| 892 // This is different from the type of workspace that's associated with | 893 // This is different from the type of workspace that's associated with |
| 893 // _NET_WM_DESKTOP. | 894 // _NET_WM_DESKTOP. |
| 894 return GetWorkspace() == base::IntToString(kAllDesktops); | 895 return GetWorkspace() == base::IntToString(kAllDesktops); |
| 895 } | 896 } |
| 896 | 897 |
| 897 bool DesktopWindowTreeHostX11::SetWindowTitle(const base::string16& title) { | 898 bool DesktopWindowTreeHostX11::SetWindowTitle(const base::string16& title) { |
| 898 if (window_title_ == title) | 899 if (window_title_ == title) |
| 899 return false; | 900 return false; |
| 900 window_title_ = title; | 901 window_title_ = title; |
| 901 std::string utf8str = base::UTF16ToUTF8(title); | 902 std::string utf8str = base::UTF16ToUTF8(title); |
| 902 XChangeProperty(xdisplay_, xwindow_, ui::GetAtom("_NET_WM_NAME"), | 903 XChangeProperty(xdisplay_, xwindow_, gfx::GetAtom("_NET_WM_NAME"), |
| 903 ui::GetAtom("UTF8_STRING"), 8, PropModeReplace, | 904 gfx::GetAtom("UTF8_STRING"), 8, PropModeReplace, |
| 904 reinterpret_cast<const unsigned char*>(utf8str.c_str()), | 905 reinterpret_cast<const unsigned char*>(utf8str.c_str()), |
| 905 utf8str.size()); | 906 utf8str.size()); |
| 906 XTextProperty xtp; | 907 XTextProperty xtp; |
| 907 char* c_utf8_str = const_cast<char*>(utf8str.c_str()); | 908 char* c_utf8_str = const_cast<char*>(utf8str.c_str()); |
| 908 if (Xutf8TextListToTextProperty(xdisplay_, &c_utf8_str, 1, | 909 if (Xutf8TextListToTextProperty(xdisplay_, &c_utf8_str, 1, |
| 909 XUTF8StringStyle, &xtp) == Success) { | 910 XUTF8StringStyle, &xtp) == Success) { |
| 910 XSetWMName(xdisplay_, xwindow_, &xtp); | 911 XSetWMName(xdisplay_, xwindow_, &xtp); |
| 911 XFree(xtp.value); | 912 XFree(xtp.value); |
| 912 } | 913 } |
| 913 return true; | 914 return true; |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 990 | 991 |
| 991 // Work around a bug where if we try to unfullscreen, metacity immediately | 992 // Work around a bug where if we try to unfullscreen, metacity immediately |
| 992 // fullscreens us again. This is a little flickery and not necessary if | 993 // fullscreens us again. This is a little flickery and not necessary if |
| 993 // there's a gnome-panel, but it's not easy to detect whether there's a | 994 // there's a gnome-panel, but it's not easy to detect whether there's a |
| 994 // panel or not. | 995 // panel or not. |
| 995 bool unmaximize_and_remaximize = !fullscreen && IsMaximized() && | 996 bool unmaximize_and_remaximize = !fullscreen && IsMaximized() && |
| 996 ui::GuessWindowManager() == ui::WM_METACITY; | 997 ui::GuessWindowManager() == ui::WM_METACITY; |
| 997 | 998 |
| 998 if (unmaximize_and_remaximize) | 999 if (unmaximize_and_remaximize) |
| 999 Restore(); | 1000 Restore(); |
| 1000 SetWMSpecState(fullscreen, ui::GetAtom("_NET_WM_STATE_FULLSCREEN"), None); | 1001 SetWMSpecState(fullscreen, gfx::GetAtom("_NET_WM_STATE_FULLSCREEN"), None); |
| 1001 if (unmaximize_and_remaximize) | 1002 if (unmaximize_and_remaximize) |
| 1002 Maximize(); | 1003 Maximize(); |
| 1003 | 1004 |
| 1004 // Try to guess the size we will have after the switch to/from fullscreen: | 1005 // Try to guess the size we will have after the switch to/from fullscreen: |
| 1005 // - (may) avoid transient states | 1006 // - (may) avoid transient states |
| 1006 // - works around Flash content which expects to have the size updated | 1007 // - works around Flash content which expects to have the size updated |
| 1007 // synchronously. | 1008 // synchronously. |
| 1008 // See https://crbug.com/361408 | 1009 // See https://crbug.com/361408 |
| 1009 if (fullscreen) { | 1010 if (fullscreen) { |
| 1010 restored_bounds_in_pixels_ = bounds_in_pixels_; | 1011 restored_bounds_in_pixels_ = bounds_in_pixels_; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 1035 // XChangeProperty() expects "cardinality" to be long. | 1036 // XChangeProperty() expects "cardinality" to be long. |
| 1036 | 1037 |
| 1037 // Scale opacity to [0 .. 255] range. | 1038 // Scale opacity to [0 .. 255] range. |
| 1038 unsigned long opacity_8bit = | 1039 unsigned long opacity_8bit = |
| 1039 static_cast<unsigned long>(opacity * 255.0f) & 0xFF; | 1040 static_cast<unsigned long>(opacity * 255.0f) & 0xFF; |
| 1040 // Use opacity value for all channels. | 1041 // Use opacity value for all channels. |
| 1041 const unsigned long channel_multiplier = 0x1010101; | 1042 const unsigned long channel_multiplier = 0x1010101; |
| 1042 unsigned long cardinality = opacity_8bit * channel_multiplier; | 1043 unsigned long cardinality = opacity_8bit * channel_multiplier; |
| 1043 | 1044 |
| 1044 if (cardinality == 0xffffffff) { | 1045 if (cardinality == 0xffffffff) { |
| 1045 XDeleteProperty(xdisplay_, xwindow_, ui::GetAtom("_NET_WM_WINDOW_OPACITY")); | 1046 XDeleteProperty(xdisplay_, xwindow_, |
| 1047 gfx::GetAtom("_NET_WM_WINDOW_OPACITY")); |
| 1046 } else { | 1048 } else { |
| 1047 XChangeProperty(xdisplay_, xwindow_, ui::GetAtom("_NET_WM_WINDOW_OPACITY"), | 1049 XChangeProperty(xdisplay_, xwindow_, gfx::GetAtom("_NET_WM_WINDOW_OPACITY"), |
| 1048 XA_CARDINAL, 32, PropModeReplace, | 1050 XA_CARDINAL, 32, PropModeReplace, |
| 1049 reinterpret_cast<unsigned char*>(&cardinality), 1); | 1051 reinterpret_cast<unsigned char*>(&cardinality), 1); |
| 1050 } | 1052 } |
| 1051 } | 1053 } |
| 1052 | 1054 |
| 1053 void DesktopWindowTreeHostX11::SetWindowIcons( | 1055 void DesktopWindowTreeHostX11::SetWindowIcons( |
| 1054 const gfx::ImageSkia& window_icon, const gfx::ImageSkia& app_icon) { | 1056 const gfx::ImageSkia& window_icon, const gfx::ImageSkia& app_icon) { |
| 1055 // TODO(erg): The way we handle icons across different versions of chrome | 1057 // TODO(erg): The way we handle icons across different versions of chrome |
| 1056 // could be substantially improved. The Windows version does its own thing | 1058 // could be substantially improved. The Windows version does its own thing |
| 1057 // and only sometimes comes down this code path. The icon stuff in | 1059 // and only sometimes comes down this code path. The icon stuff in |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1295 unsigned long attribute_mask = CWBackPixmap | CWBitGravity; | 1297 unsigned long attribute_mask = CWBackPixmap | CWBitGravity; |
| 1296 XSetWindowAttributes swa; | 1298 XSetWindowAttributes swa; |
| 1297 memset(&swa, 0, sizeof(swa)); | 1299 memset(&swa, 0, sizeof(swa)); |
| 1298 swa.background_pixmap = None; | 1300 swa.background_pixmap = None; |
| 1299 swa.bit_gravity = NorthWestGravity; | 1301 swa.bit_gravity = NorthWestGravity; |
| 1300 | 1302 |
| 1301 ::Atom window_type; | 1303 ::Atom window_type; |
| 1302 switch (params.type) { | 1304 switch (params.type) { |
| 1303 case Widget::InitParams::TYPE_MENU: | 1305 case Widget::InitParams::TYPE_MENU: |
| 1304 swa.override_redirect = True; | 1306 swa.override_redirect = True; |
| 1305 window_type = ui::GetAtom("_NET_WM_WINDOW_TYPE_MENU"); | 1307 window_type = gfx::GetAtom("_NET_WM_WINDOW_TYPE_MENU"); |
| 1306 break; | 1308 break; |
| 1307 case Widget::InitParams::TYPE_TOOLTIP: | 1309 case Widget::InitParams::TYPE_TOOLTIP: |
| 1308 swa.override_redirect = True; | 1310 swa.override_redirect = True; |
| 1309 window_type = ui::GetAtom("_NET_WM_WINDOW_TYPE_TOOLTIP"); | 1311 window_type = gfx::GetAtom("_NET_WM_WINDOW_TYPE_TOOLTIP"); |
| 1310 break; | 1312 break; |
| 1311 case Widget::InitParams::TYPE_POPUP: | 1313 case Widget::InitParams::TYPE_POPUP: |
| 1312 swa.override_redirect = True; | 1314 swa.override_redirect = True; |
| 1313 window_type = ui::GetAtom("_NET_WM_WINDOW_TYPE_NOTIFICATION"); | 1315 window_type = gfx::GetAtom("_NET_WM_WINDOW_TYPE_NOTIFICATION"); |
| 1314 break; | 1316 break; |
| 1315 case Widget::InitParams::TYPE_DRAG: | 1317 case Widget::InitParams::TYPE_DRAG: |
| 1316 swa.override_redirect = True; | 1318 swa.override_redirect = True; |
| 1317 window_type = ui::GetAtom("_NET_WM_WINDOW_TYPE_DND"); | 1319 window_type = gfx::GetAtom("_NET_WM_WINDOW_TYPE_DND"); |
| 1318 break; | 1320 break; |
| 1319 default: | 1321 default: |
| 1320 window_type = ui::GetAtom("_NET_WM_WINDOW_TYPE_NORMAL"); | 1322 window_type = gfx::GetAtom("_NET_WM_WINDOW_TYPE_NORMAL"); |
| 1321 break; | 1323 break; |
| 1322 } | 1324 } |
| 1323 // An in-activatable window should not interact with the system wm. | 1325 // An in-activatable window should not interact with the system wm. |
| 1324 if (!activatable_) | 1326 if (!activatable_) |
| 1325 swa.override_redirect = True; | 1327 swa.override_redirect = True; |
| 1326 | 1328 |
| 1327 if (swa.override_redirect) | 1329 if (swa.override_redirect) |
| 1328 attribute_mask |= CWOverrideRedirect; | 1330 attribute_mask |= CWOverrideRedirect; |
| 1329 | 1331 |
| 1330 bool enable_transparent_visuals; | 1332 bool enable_transparent_visuals; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1379 xwindow_events_.reset(new ui::XScopedEventSelector(xwindow_, event_mask)); | 1381 xwindow_events_.reset(new ui::XScopedEventSelector(xwindow_, event_mask)); |
| 1380 XFlush(xdisplay_); | 1382 XFlush(xdisplay_); |
| 1381 | 1383 |
| 1382 if (ui::IsXInput2Available()) | 1384 if (ui::IsXInput2Available()) |
| 1383 ui::TouchFactory::GetInstance()->SetupXI2ForXWindow(xwindow_); | 1385 ui::TouchFactory::GetInstance()->SetupXI2ForXWindow(xwindow_); |
| 1384 | 1386 |
| 1385 // TODO(erg): We currently only request window deletion events. We also | 1387 // TODO(erg): We currently only request window deletion events. We also |
| 1386 // should listen for activation events and anything else that GTK+ listens | 1388 // should listen for activation events and anything else that GTK+ listens |
| 1387 // for, and do something useful. | 1389 // for, and do something useful. |
| 1388 ::Atom protocols[2]; | 1390 ::Atom protocols[2]; |
| 1389 protocols[0] = ui::GetAtom("WM_DELETE_WINDOW"); | 1391 protocols[0] = gfx::GetAtom("WM_DELETE_WINDOW"); |
| 1390 protocols[1] = ui::GetAtom("_NET_WM_PING"); | 1392 protocols[1] = gfx::GetAtom("_NET_WM_PING"); |
| 1391 XSetWMProtocols(xdisplay_, xwindow_, protocols, 2); | 1393 XSetWMProtocols(xdisplay_, xwindow_, protocols, 2); |
| 1392 | 1394 |
| 1393 // We need a WM_CLIENT_MACHINE and WM_LOCALE_NAME value so we integrate with | 1395 // We need a WM_CLIENT_MACHINE and WM_LOCALE_NAME value so we integrate with |
| 1394 // the desktop environment. | 1396 // the desktop environment. |
| 1395 XSetWMProperties(xdisplay_, xwindow_, NULL, NULL, NULL, 0, NULL, NULL, NULL); | 1397 XSetWMProperties(xdisplay_, xwindow_, NULL, NULL, NULL, 0, NULL, NULL, NULL); |
| 1396 | 1398 |
| 1397 // Likewise, the X server needs to know this window's pid so it knows which | 1399 // Likewise, the X server needs to know this window's pid so it knows which |
| 1398 // program to kill if the window hangs. | 1400 // program to kill if the window hangs. |
| 1399 // XChangeProperty() expects "pid" to be long. | 1401 // XChangeProperty() expects "pid" to be long. |
| 1400 static_assert(sizeof(long) >= sizeof(pid_t), | 1402 static_assert(sizeof(long) >= sizeof(pid_t), |
| 1401 "pid_t should not be larger than long"); | 1403 "pid_t should not be larger than long"); |
| 1402 long pid = getpid(); | 1404 long pid = getpid(); |
| 1403 XChangeProperty(xdisplay_, xwindow_, ui::GetAtom("_NET_WM_PID"), XA_CARDINAL, | 1405 XChangeProperty(xdisplay_, xwindow_, gfx::GetAtom("_NET_WM_PID"), XA_CARDINAL, |
| 1404 32, PropModeReplace, reinterpret_cast<unsigned char*>(&pid), | 1406 32, PropModeReplace, reinterpret_cast<unsigned char*>(&pid), |
| 1405 1); | 1407 1); |
| 1406 | 1408 |
| 1407 XChangeProperty(xdisplay_, xwindow_, ui::GetAtom("_NET_WM_WINDOW_TYPE"), | 1409 XChangeProperty(xdisplay_, xwindow_, gfx::GetAtom("_NET_WM_WINDOW_TYPE"), |
| 1408 XA_ATOM, 32, PropModeReplace, | 1410 XA_ATOM, 32, PropModeReplace, |
| 1409 reinterpret_cast<unsigned char*>(&window_type), 1); | 1411 reinterpret_cast<unsigned char*>(&window_type), 1); |
| 1410 | 1412 |
| 1411 // List of window state properties (_NET_WM_STATE) to set, if any. | 1413 // List of window state properties (_NET_WM_STATE) to set, if any. |
| 1412 std::vector< ::Atom> state_atom_list; | 1414 std::vector< ::Atom> state_atom_list; |
| 1413 | 1415 |
| 1414 // Remove popup windows from taskbar unless overridden. | 1416 // Remove popup windows from taskbar unless overridden. |
| 1415 if ((params.type == Widget::InitParams::TYPE_POPUP || | 1417 if ((params.type == Widget::InitParams::TYPE_POPUP || |
| 1416 params.type == Widget::InitParams::TYPE_BUBBLE) && | 1418 params.type == Widget::InitParams::TYPE_BUBBLE) && |
| 1417 !params.force_show_in_taskbar) { | 1419 !params.force_show_in_taskbar) { |
| 1418 state_atom_list.push_back(ui::GetAtom("_NET_WM_STATE_SKIP_TASKBAR")); | 1420 state_atom_list.push_back(gfx::GetAtom("_NET_WM_STATE_SKIP_TASKBAR")); |
| 1419 } | 1421 } |
| 1420 | 1422 |
| 1421 // If the window should stay on top of other windows, add the | 1423 // If the window should stay on top of other windows, add the |
| 1422 // _NET_WM_STATE_ABOVE property. | 1424 // _NET_WM_STATE_ABOVE property. |
| 1423 is_always_on_top_ = params.keep_on_top; | 1425 is_always_on_top_ = params.keep_on_top; |
| 1424 if (is_always_on_top_) | 1426 if (is_always_on_top_) |
| 1425 state_atom_list.push_back(ui::GetAtom("_NET_WM_STATE_ABOVE")); | 1427 state_atom_list.push_back(gfx::GetAtom("_NET_WM_STATE_ABOVE")); |
| 1426 | 1428 |
| 1427 workspace_.clear(); | 1429 workspace_.clear(); |
| 1428 if (params.visible_on_all_workspaces) { | 1430 if (params.visible_on_all_workspaces) { |
| 1429 state_atom_list.push_back(ui::GetAtom("_NET_WM_STATE_STICKY")); | 1431 state_atom_list.push_back(gfx::GetAtom("_NET_WM_STATE_STICKY")); |
| 1430 ui::SetIntProperty(xwindow_, "_NET_WM_DESKTOP", "CARDINAL", kAllDesktops); | 1432 ui::SetIntProperty(xwindow_, "_NET_WM_DESKTOP", "CARDINAL", kAllDesktops); |
| 1431 } else if (!params.workspace.empty()) { | 1433 } else if (!params.workspace.empty()) { |
| 1432 int workspace; | 1434 int workspace; |
| 1433 if (base::StringToInt(params.workspace, &workspace)) | 1435 if (base::StringToInt(params.workspace, &workspace)) |
| 1434 ui::SetIntProperty(xwindow_, "_NET_WM_DESKTOP", "CARDINAL", workspace); | 1436 ui::SetIntProperty(xwindow_, "_NET_WM_DESKTOP", "CARDINAL", workspace); |
| 1435 } | 1437 } |
| 1436 | 1438 |
| 1437 // Setting _NET_WM_STATE by sending a message to the root_window (with | 1439 // Setting _NET_WM_STATE by sending a message to the root_window (with |
| 1438 // SetWMSpecState) has no effect here since the window has not yet been | 1440 // SetWMSpecState) has no effect here since the window has not yet been |
| 1439 // mapped. So we manually change the state. | 1441 // mapped. So we manually change the state. |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1514 } | 1516 } |
| 1515 | 1517 |
| 1516 // Do not request a 0x0 window size. It causes an XError. | 1518 // Do not request a 0x0 window size. It causes an XError. |
| 1517 gfx::Size size_in_pixels = requested_size_in_pixels; | 1519 gfx::Size size_in_pixels = requested_size_in_pixels; |
| 1518 size_in_pixels.SetToMax(gfx::Size(1, 1)); | 1520 size_in_pixels.SetToMax(gfx::Size(1, 1)); |
| 1519 return size_in_pixels; | 1521 return size_in_pixels; |
| 1520 } | 1522 } |
| 1521 | 1523 |
| 1522 void DesktopWindowTreeHostX11::OnWMStateUpdated() { | 1524 void DesktopWindowTreeHostX11::OnWMStateUpdated() { |
| 1523 std::vector< ::Atom> atom_list; | 1525 std::vector< ::Atom> atom_list; |
| 1524 // Ignore the return value of ui::GetAtomArrayProperty(). Fluxbox removes the | 1526 // Ignore the return value of gfx::GetAtomArrayProperty(). Fluxbox removes the |
| 1525 // _NET_WM_STATE property when no _NET_WM_STATE atoms are set. | 1527 // _NET_WM_STATE property when no _NET_WM_STATE atoms are set. |
| 1526 ui::GetAtomArrayProperty(xwindow_, "_NET_WM_STATE", &atom_list); | 1528 ui::GetAtomArrayProperty(xwindow_, "_NET_WM_STATE", &atom_list); |
| 1527 | 1529 |
| 1528 bool was_minimized = IsMinimized(); | 1530 bool was_minimized = IsMinimized(); |
| 1529 | 1531 |
| 1530 window_properties_.clear(); | 1532 window_properties_.clear(); |
| 1531 std::copy(atom_list.begin(), atom_list.end(), | 1533 std::copy(atom_list.begin(), atom_list.end(), |
| 1532 inserter(window_properties_, window_properties_.begin())); | 1534 inserter(window_properties_, window_properties_.begin())); |
| 1533 | 1535 |
| 1534 // Propagate the window minimization information to the content window, so | 1536 // Propagate the window minimization information to the content window, so |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1636 const ui::PlatformEvent& event) { | 1638 const ui::PlatformEvent& event) { |
| 1637 if (!IsActive()) | 1639 if (!IsActive()) |
| 1638 return; | 1640 return; |
| 1639 | 1641 |
| 1640 ui::EventType type = ui::EventTypeFromNative(event); | 1642 ui::EventType type = ui::EventTypeFromNative(event); |
| 1641 if (type == ui::ET_MOUSE_PRESSED || | 1643 if (type == ui::ET_MOUSE_PRESSED || |
| 1642 type == ui::ET_KEY_PRESSED || | 1644 type == ui::ET_KEY_PRESSED || |
| 1643 type == ui::ET_TOUCH_PRESSED) { | 1645 type == ui::ET_TOUCH_PRESSED) { |
| 1644 unsigned long wm_user_time_ms = static_cast<unsigned long>( | 1646 unsigned long wm_user_time_ms = static_cast<unsigned long>( |
| 1645 (ui::EventTimeFromNative(event) - base::TimeTicks()).InMilliseconds()); | 1647 (ui::EventTimeFromNative(event) - base::TimeTicks()).InMilliseconds()); |
| 1646 XChangeProperty(xdisplay_, xwindow_, ui::GetAtom("_NET_WM_USER_TIME"), | 1648 XChangeProperty(xdisplay_, xwindow_, gfx::GetAtom("_NET_WM_USER_TIME"), |
| 1647 XA_CARDINAL, 32, PropModeReplace, | 1649 XA_CARDINAL, 32, PropModeReplace, |
| 1648 reinterpret_cast<const unsigned char*>(&wm_user_time_ms), | 1650 reinterpret_cast<const unsigned char*>(&wm_user_time_ms), |
| 1649 1); | 1651 1); |
| 1650 } | 1652 } |
| 1651 } | 1653 } |
| 1652 | 1654 |
| 1653 void DesktopWindowTreeHostX11::SetWMSpecState(bool enabled, | 1655 void DesktopWindowTreeHostX11::SetWMSpecState(bool enabled, |
| 1654 ::Atom state1, | 1656 ::Atom state1, |
| 1655 ::Atom state2) { | 1657 ::Atom state2) { |
| 1656 XEvent xclient; | 1658 XEvent xclient; |
| 1657 memset(&xclient, 0, sizeof(xclient)); | 1659 memset(&xclient, 0, sizeof(xclient)); |
| 1658 xclient.type = ClientMessage; | 1660 xclient.type = ClientMessage; |
| 1659 xclient.xclient.window = xwindow_; | 1661 xclient.xclient.window = xwindow_; |
| 1660 xclient.xclient.message_type = ui::GetAtom("_NET_WM_STATE"); | 1662 xclient.xclient.message_type = gfx::GetAtom("_NET_WM_STATE"); |
| 1661 xclient.xclient.format = 32; | 1663 xclient.xclient.format = 32; |
| 1662 xclient.xclient.data.l[0] = | 1664 xclient.xclient.data.l[0] = |
| 1663 enabled ? k_NET_WM_STATE_ADD : k_NET_WM_STATE_REMOVE; | 1665 enabled ? k_NET_WM_STATE_ADD : k_NET_WM_STATE_REMOVE; |
| 1664 xclient.xclient.data.l[1] = state1; | 1666 xclient.xclient.data.l[1] = state1; |
| 1665 xclient.xclient.data.l[2] = state2; | 1667 xclient.xclient.data.l[2] = state2; |
| 1666 xclient.xclient.data.l[3] = 1; | 1668 xclient.xclient.data.l[3] = 1; |
| 1667 xclient.xclient.data.l[4] = 0; | 1669 xclient.xclient.data.l[4] = 0; |
| 1668 | 1670 |
| 1669 XSendEvent(xdisplay_, x_root_window_, False, | 1671 XSendEvent(xdisplay_, x_root_window_, False, |
| 1670 SubstructureRedirectMask | SubstructureNotifyMask, | 1672 SubstructureRedirectMask | SubstructureNotifyMask, |
| 1671 &xclient); | 1673 &xclient); |
| 1672 } | 1674 } |
| 1673 | 1675 |
| 1674 bool DesktopWindowTreeHostX11::HasWMSpecProperty(const char* property) const { | 1676 bool DesktopWindowTreeHostX11::HasWMSpecProperty(const char* property) const { |
| 1675 return window_properties_.find(ui::GetAtom(property)) != | 1677 return window_properties_.find(gfx::GetAtom(property)) != |
| 1676 window_properties_.end(); | 1678 window_properties_.end(); |
| 1677 } | 1679 } |
| 1678 | 1680 |
| 1679 void DesktopWindowTreeHostX11::SetUseNativeFrame(bool use_native_frame) { | 1681 void DesktopWindowTreeHostX11::SetUseNativeFrame(bool use_native_frame) { |
| 1680 use_native_frame_ = use_native_frame; | 1682 use_native_frame_ = use_native_frame; |
| 1681 ui::SetUseOSWindowFrame(xwindow_, use_native_frame); | 1683 ui::SetUseOSWindowFrame(xwindow_, use_native_frame); |
| 1682 ResetWindowRegion(); | 1684 ResetWindowRegion(); |
| 1683 } | 1685 } |
| 1684 | 1686 |
| 1685 void DesktopWindowTreeHostX11::DispatchMouseEvent(ui::MouseEvent* event) { | 1687 void DesktopWindowTreeHostX11::DispatchMouseEvent(ui::MouseEvent* event) { |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1846 | 1848 |
| 1847 // If SHOW_STATE_INACTIVE, tell the window manager not to focus the window | 1849 // If SHOW_STATE_INACTIVE, tell the window manager not to focus the window |
| 1848 // when mapping. This is done by setting the _NET_WM_USER_TIME to 0. See e.g. | 1850 // when mapping. This is done by setting the _NET_WM_USER_TIME to 0. See e.g. |
| 1849 // http://standards.freedesktop.org/wm-spec/latest/ar01s05.html | 1851 // http://standards.freedesktop.org/wm-spec/latest/ar01s05.html |
| 1850 ignore_keyboard_input_ = show_state == ui::SHOW_STATE_INACTIVE; | 1852 ignore_keyboard_input_ = show_state == ui::SHOW_STATE_INACTIVE; |
| 1851 unsigned long wm_user_time_ms = | 1853 unsigned long wm_user_time_ms = |
| 1852 ignore_keyboard_input_ | 1854 ignore_keyboard_input_ |
| 1853 ? 0 | 1855 ? 0 |
| 1854 : ui::X11EventSource::GetInstance()->GetTimestamp(); | 1856 : ui::X11EventSource::GetInstance()->GetTimestamp(); |
| 1855 if (show_state == ui::SHOW_STATE_INACTIVE || wm_user_time_ms != 0) { | 1857 if (show_state == ui::SHOW_STATE_INACTIVE || wm_user_time_ms != 0) { |
| 1856 XChangeProperty(xdisplay_, xwindow_, ui::GetAtom("_NET_WM_USER_TIME"), | 1858 XChangeProperty(xdisplay_, xwindow_, gfx::GetAtom("_NET_WM_USER_TIME"), |
| 1857 XA_CARDINAL, 32, PropModeReplace, | 1859 XA_CARDINAL, 32, PropModeReplace, |
| 1858 reinterpret_cast<const unsigned char*>(&wm_user_time_ms), | 1860 reinterpret_cast<const unsigned char*>(&wm_user_time_ms), |
| 1859 1); | 1861 1); |
| 1860 } | 1862 } |
| 1861 | 1863 |
| 1862 ui::X11EventSource* event_source = ui::X11EventSource::GetInstance(); | 1864 ui::X11EventSource* event_source = ui::X11EventSource::GetInstance(); |
| 1863 DCHECK(event_source); | 1865 DCHECK(event_source); |
| 1864 | 1866 |
| 1865 UpdateMinAndMaxSize(); | 1867 UpdateMinAndMaxSize(); |
| 1866 | 1868 |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2107 has_pointer_ = false; | 2109 has_pointer_ = false; |
| 2108 has_pointer_grab_ = false; | 2110 has_pointer_grab_ = false; |
| 2109 has_pointer_focus_ = false; | 2111 has_pointer_focus_ = false; |
| 2110 has_window_focus_ = false; | 2112 has_window_focus_ = false; |
| 2111 for (DesktopWindowTreeHostObserverX11& observer : observer_list_) | 2113 for (DesktopWindowTreeHostObserverX11& observer : observer_list_) |
| 2112 observer.OnWindowUnmapped(xwindow_); | 2114 observer.OnWindowUnmapped(xwindow_); |
| 2113 break; | 2115 break; |
| 2114 } | 2116 } |
| 2115 case ClientMessage: { | 2117 case ClientMessage: { |
| 2116 Atom message_type = xev->xclient.message_type; | 2118 Atom message_type = xev->xclient.message_type; |
| 2117 if (message_type == ui::GetAtom("WM_PROTOCOLS")) { | 2119 if (message_type == gfx::GetAtom("WM_PROTOCOLS")) { |
| 2118 Atom protocol = static_cast<Atom>(xev->xclient.data.l[0]); | 2120 Atom protocol = static_cast<Atom>(xev->xclient.data.l[0]); |
| 2119 if (protocol == ui::GetAtom("WM_DELETE_WINDOW")) { | 2121 if (protocol == gfx::GetAtom("WM_DELETE_WINDOW")) { |
| 2120 // We have received a close message from the window manager. | 2122 // We have received a close message from the window manager. |
| 2121 OnHostCloseRequested(); | 2123 OnHostCloseRequested(); |
| 2122 } else if (protocol == ui::GetAtom("_NET_WM_PING")) { | 2124 } else if (protocol == gfx::GetAtom("_NET_WM_PING")) { |
| 2123 XEvent reply_event = *xev; | 2125 XEvent reply_event = *xev; |
| 2124 reply_event.xclient.window = x_root_window_; | 2126 reply_event.xclient.window = x_root_window_; |
| 2125 | 2127 |
| 2126 XSendEvent(xdisplay_, | 2128 XSendEvent(xdisplay_, |
| 2127 reply_event.xclient.window, | 2129 reply_event.xclient.window, |
| 2128 False, | 2130 False, |
| 2129 SubstructureRedirectMask | SubstructureNotifyMask, | 2131 SubstructureRedirectMask | SubstructureNotifyMask, |
| 2130 &reply_event); | 2132 &reply_event); |
| 2131 } | 2133 } |
| 2132 } else if (message_type == ui::GetAtom("XdndEnter")) { | 2134 } else if (message_type == gfx::GetAtom("XdndEnter")) { |
| 2133 drag_drop_client_->OnXdndEnter(xev->xclient); | 2135 drag_drop_client_->OnXdndEnter(xev->xclient); |
| 2134 } else if (message_type == ui::GetAtom("XdndLeave")) { | 2136 } else if (message_type == gfx::GetAtom("XdndLeave")) { |
| 2135 drag_drop_client_->OnXdndLeave(xev->xclient); | 2137 drag_drop_client_->OnXdndLeave(xev->xclient); |
| 2136 } else if (message_type == ui::GetAtom("XdndPosition")) { | 2138 } else if (message_type == gfx::GetAtom("XdndPosition")) { |
| 2137 drag_drop_client_->OnXdndPosition(xev->xclient); | 2139 drag_drop_client_->OnXdndPosition(xev->xclient); |
| 2138 } else if (message_type == ui::GetAtom("XdndStatus")) { | 2140 } else if (message_type == gfx::GetAtom("XdndStatus")) { |
| 2139 drag_drop_client_->OnXdndStatus(xev->xclient); | 2141 drag_drop_client_->OnXdndStatus(xev->xclient); |
| 2140 } else if (message_type == ui::GetAtom("XdndFinished")) { | 2142 } else if (message_type == gfx::GetAtom("XdndFinished")) { |
| 2141 drag_drop_client_->OnXdndFinished(xev->xclient); | 2143 drag_drop_client_->OnXdndFinished(xev->xclient); |
| 2142 } else if (message_type == ui::GetAtom("XdndDrop")) { | 2144 } else if (message_type == gfx::GetAtom("XdndDrop")) { |
| 2143 drag_drop_client_->OnXdndDrop(xev->xclient); | 2145 drag_drop_client_->OnXdndDrop(xev->xclient); |
| 2144 } | 2146 } |
| 2145 break; | 2147 break; |
| 2146 } | 2148 } |
| 2147 case MappingNotify: { | 2149 case MappingNotify: { |
| 2148 switch (xev->xmapping.request) { | 2150 switch (xev->xmapping.request) { |
| 2149 case MappingModifier: | 2151 case MappingModifier: |
| 2150 case MappingKeyboard: | 2152 case MappingKeyboard: |
| 2151 XRefreshKeyboardMapping(&xev->xmapping); | 2153 XRefreshKeyboardMapping(&xev->xmapping); |
| 2152 break; | 2154 break; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 2176 break; | 2178 break; |
| 2177 } | 2179 } |
| 2178 } | 2180 } |
| 2179 | 2181 |
| 2180 ui::MouseEvent mouseev(xev); | 2182 ui::MouseEvent mouseev(xev); |
| 2181 DispatchMouseEvent(&mouseev); | 2183 DispatchMouseEvent(&mouseev); |
| 2182 break; | 2184 break; |
| 2183 } | 2185 } |
| 2184 case PropertyNotify: { | 2186 case PropertyNotify: { |
| 2185 ::Atom changed_atom = xev->xproperty.atom; | 2187 ::Atom changed_atom = xev->xproperty.atom; |
| 2186 if (changed_atom == ui::GetAtom("_NET_WM_STATE")) { | 2188 if (changed_atom == gfx::GetAtom("_NET_WM_STATE")) { |
| 2187 OnWMStateUpdated(); | 2189 OnWMStateUpdated(); |
| 2188 } else if (changed_atom == ui::GetAtom("_NET_FRAME_EXTENTS")) { | 2190 } else if (changed_atom == gfx::GetAtom("_NET_FRAME_EXTENTS")) { |
| 2189 OnFrameExtentsUpdated(); | 2191 OnFrameExtentsUpdated(); |
| 2190 } else if (changed_atom == ui::GetAtom("_NET_WM_DESKTOP")) { | 2192 } else if (changed_atom == gfx::GetAtom("_NET_WM_DESKTOP")) { |
| 2191 if (UpdateWorkspace()) | 2193 if (UpdateWorkspace()) |
| 2192 OnHostWorkspaceChanged(); | 2194 OnHostWorkspaceChanged(); |
| 2193 } | 2195 } |
| 2194 break; | 2196 break; |
| 2195 } | 2197 } |
| 2196 case SelectionNotify: { | 2198 case SelectionNotify: { |
| 2197 drag_drop_client_->OnSelectionNotify(xev->xselection); | 2199 drag_drop_client_->OnSelectionNotify(xev->xselection); |
| 2198 break; | 2200 break; |
| 2199 } | 2201 } |
| 2200 } | 2202 } |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2278 | 2280 |
| 2279 // static | 2281 // static |
| 2280 DesktopWindowTreeHost* DesktopWindowTreeHost::Create( | 2282 DesktopWindowTreeHost* DesktopWindowTreeHost::Create( |
| 2281 internal::NativeWidgetDelegate* native_widget_delegate, | 2283 internal::NativeWidgetDelegate* native_widget_delegate, |
| 2282 DesktopNativeWidgetAura* desktop_native_widget_aura) { | 2284 DesktopNativeWidgetAura* desktop_native_widget_aura) { |
| 2283 return new DesktopWindowTreeHostX11(native_widget_delegate, | 2285 return new DesktopWindowTreeHostX11(native_widget_delegate, |
| 2284 desktop_native_widget_aura); | 2286 desktop_native_widget_aura); |
| 2285 } | 2287 } |
| 2286 | 2288 |
| 2287 } // namespace views | 2289 } // namespace views |
| OLD | NEW |