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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 namespace { | 81 namespace { |
82 | 82 |
83 // Constants that are part of EWMH. | 83 // Constants that are part of EWMH. |
84 const int k_NET_WM_STATE_ADD = 1; | 84 const int k_NET_WM_STATE_ADD = 1; |
85 const int k_NET_WM_STATE_REMOVE = 0; | 85 const int k_NET_WM_STATE_REMOVE = 0; |
86 | 86 |
87 // Special value of the _NET_WM_DESKTOP property which indicates that the window | 87 // Special value of the _NET_WM_DESKTOP property which indicates that the window |
88 // should appear on all desktops. | 88 // should appear on all desktops. |
89 const int kAllDesktops = 0xFFFFFFFF; | 89 const int kAllDesktops = 0xFFFFFFFF; |
90 | 90 |
91 const char* kAtomsToCache[] = { | |
92 "UTF8_STRING", | |
93 "WM_DELETE_WINDOW", | |
94 "WM_PROTOCOLS", | |
95 "_NET_ACTIVE_WINDOW", | |
96 "_NET_FRAME_EXTENTS", | |
97 "_NET_WM_CM_S0", | |
98 "_NET_WM_DESKTOP", | |
99 "_NET_WM_ICON", | |
100 "_NET_WM_NAME", | |
101 "_NET_WM_PID", | |
102 "_NET_WM_PING", | |
103 "_NET_WM_STATE", | |
104 "_NET_WM_STATE_ABOVE", | |
105 "_NET_WM_STATE_FULLSCREEN", | |
106 "_NET_WM_STATE_HIDDEN", | |
107 "_NET_WM_STATE_MAXIMIZED_HORZ", | |
108 "_NET_WM_STATE_MAXIMIZED_VERT", | |
109 "_NET_WM_STATE_SKIP_TASKBAR", | |
110 "_NET_WM_STATE_STICKY", | |
111 "_NET_WM_USER_TIME", | |
112 "_NET_WM_WINDOW_OPACITY", | |
113 "_NET_WM_WINDOW_TYPE", | |
114 "_NET_WM_WINDOW_TYPE_DND", | |
115 "_NET_WM_WINDOW_TYPE_MENU", | |
116 "_NET_WM_WINDOW_TYPE_NORMAL", | |
117 "_NET_WM_WINDOW_TYPE_NOTIFICATION", | |
118 "_NET_WM_WINDOW_TYPE_TOOLTIP", | |
119 "XdndActionAsk", | |
120 "XdndActionCopy", | |
121 "XdndActionLink", | |
122 "XdndActionList", | |
123 "XdndActionMove", | |
124 "XdndActionPrivate", | |
125 "XdndAware", | |
126 "XdndDrop", | |
127 "XdndEnter", | |
128 "XdndFinished", | |
129 "XdndLeave", | |
130 "XdndPosition", | |
131 "XdndProxy", // Proxy windows? | |
132 "XdndSelection", | |
133 "XdndStatus", | |
134 "XdndTypeList", | |
135 NULL | |
136 }; | |
137 | |
138 const char kX11WindowRolePopup[] = "popup"; | 91 const char kX11WindowRolePopup[] = "popup"; |
139 const char kX11WindowRoleBubble[] = "bubble"; | 92 const char kX11WindowRoleBubble[] = "bubble"; |
140 | 93 |
141 // Returns the whole path from |window| to the root. | 94 // Returns the whole path from |window| to the root. |
142 std::vector<::Window> GetParentsList(XDisplay* xdisplay, ::Window window) { | 95 std::vector<::Window> GetParentsList(XDisplay* xdisplay, ::Window window) { |
143 ::Window parent_win, root_win; | 96 ::Window parent_win, root_win; |
144 Window* child_windows; | 97 Window* child_windows; |
145 unsigned int num_child_windows; | 98 unsigned int num_child_windows; |
146 std::vector<::Window> result; | 99 std::vector<::Window> result; |
147 | 100 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 | 136 |
184 //////////////////////////////////////////////////////////////////////////////// | 137 //////////////////////////////////////////////////////////////////////////////// |
185 // DesktopWindowTreeHostX11, public: | 138 // DesktopWindowTreeHostX11, public: |
186 | 139 |
187 DesktopWindowTreeHostX11::DesktopWindowTreeHostX11( | 140 DesktopWindowTreeHostX11::DesktopWindowTreeHostX11( |
188 internal::NativeWidgetDelegate* native_widget_delegate, | 141 internal::NativeWidgetDelegate* native_widget_delegate, |
189 DesktopNativeWidgetAura* desktop_native_widget_aura) | 142 DesktopNativeWidgetAura* desktop_native_widget_aura) |
190 : xdisplay_(gfx::GetXDisplay()), | 143 : xdisplay_(gfx::GetXDisplay()), |
191 xwindow_(0), | 144 xwindow_(0), |
192 x_root_window_(DefaultRootWindow(xdisplay_)), | 145 x_root_window_(DefaultRootWindow(xdisplay_)), |
193 atom_cache_(xdisplay_, kAtomsToCache), | |
194 window_mapped_in_server_(false), | 146 window_mapped_in_server_(false), |
195 window_mapped_in_client_(false), | 147 window_mapped_in_client_(false), |
196 is_fullscreen_(false), | 148 is_fullscreen_(false), |
197 is_always_on_top_(false), | 149 is_always_on_top_(false), |
198 use_native_frame_(false), | 150 use_native_frame_(false), |
199 should_maximize_after_map_(false), | 151 should_maximize_after_map_(false), |
200 use_argb_visual_(false), | 152 use_argb_visual_(false), |
201 drag_drop_client_(NULL), | 153 drag_drop_client_(NULL), |
202 native_widget_delegate_(native_widget_delegate), | 154 native_widget_delegate_(native_widget_delegate), |
203 desktop_native_widget_aura_(desktop_native_widget_aura), | 155 desktop_native_widget_aura_(desktop_native_widget_aura), |
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
772 return; | 724 return; |
773 | 725 |
774 BeforeActivationStateChanged(); | 726 BeforeActivationStateChanged(); |
775 | 727 |
776 ignore_keyboard_input_ = false; | 728 ignore_keyboard_input_ = false; |
777 | 729 |
778 // wmii says that it supports _NET_ACTIVE_WINDOW but does not. | 730 // wmii says that it supports _NET_ACTIVE_WINDOW but does not. |
779 // https://code.google.com/p/wmii/issues/detail?id=266 | 731 // https://code.google.com/p/wmii/issues/detail?id=266 |
780 static bool wm_supports_active_window = | 732 static bool wm_supports_active_window = |
781 ui::GuessWindowManager() != ui::WM_WMII && | 733 ui::GuessWindowManager() != ui::WM_WMII && |
782 ui::WmSupportsHint(atom_cache_.GetAtom("_NET_ACTIVE_WINDOW")); | 734 ui::WmSupportsHint(ui::GetAtom("_NET_ACTIVE_WINDOW")); |
783 | 735 |
784 Time timestamp = ui::X11EventSource::GetInstance()->GetTimestamp(); | 736 Time timestamp = ui::X11EventSource::GetInstance()->GetTimestamp(); |
785 | 737 |
786 if (wm_supports_active_window) { | 738 if (wm_supports_active_window) { |
787 XEvent xclient; | 739 XEvent xclient; |
788 memset(&xclient, 0, sizeof(xclient)); | 740 memset(&xclient, 0, sizeof(xclient)); |
789 xclient.type = ClientMessage; | 741 xclient.type = ClientMessage; |
790 xclient.xclient.window = xwindow_; | 742 xclient.xclient.window = xwindow_; |
791 xclient.xclient.message_type = atom_cache_.GetAtom("_NET_ACTIVE_WINDOW"); | 743 xclient.xclient.message_type = ui::GetAtom("_NET_ACTIVE_WINDOW"); |
792 xclient.xclient.format = 32; | 744 xclient.xclient.format = 32; |
793 xclient.xclient.data.l[0] = 1; // Specified we are an app. | 745 xclient.xclient.data.l[0] = 1; // Specified we are an app. |
794 xclient.xclient.data.l[1] = timestamp; | 746 xclient.xclient.data.l[1] = timestamp; |
795 // TODO(thomasanderson): if another chrome window is active, specify that in | 747 // TODO(thomasanderson): if another chrome window is active, specify that in |
796 // data.l[2]. The EWMH spec claims this may make the WM more likely to | 748 // data.l[2]. The EWMH spec claims this may make the WM more likely to |
797 // service our _NET_ACTIVE_WINDOW request. | 749 // service our _NET_ACTIVE_WINDOW request. |
798 xclient.xclient.data.l[2] = None; | 750 xclient.xclient.data.l[2] = None; |
799 xclient.xclient.data.l[3] = 0; | 751 xclient.xclient.data.l[3] = 0; |
800 xclient.xclient.data.l[4] = 0; | 752 xclient.xclient.data.l[4] = 0; |
801 | 753 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
838 | 790 |
839 // |has_window_focus_| and |has_pointer_focus_| are mutually exclusive. | 791 // |has_window_focus_| and |has_pointer_focus_| are mutually exclusive. |
840 DCHECK(!has_window_focus_ || !has_pointer_focus_); | 792 DCHECK(!has_window_focus_ || !has_pointer_focus_); |
841 | 793 |
842 return is_active; | 794 return is_active; |
843 } | 795 } |
844 | 796 |
845 void DesktopWindowTreeHostX11::Maximize() { | 797 void DesktopWindowTreeHostX11::Maximize() { |
846 if (HasWMSpecProperty("_NET_WM_STATE_FULLSCREEN")) { | 798 if (HasWMSpecProperty("_NET_WM_STATE_FULLSCREEN")) { |
847 // Unfullscreen the window if it is fullscreen. | 799 // Unfullscreen the window if it is fullscreen. |
848 SetWMSpecState(false, | 800 SetWMSpecState(false, ui::GetAtom("_NET_WM_STATE_FULLSCREEN"), None); |
849 atom_cache_.GetAtom("_NET_WM_STATE_FULLSCREEN"), | |
850 None); | |
851 | 801 |
852 // Resize the window so that it does not have the same size as a monitor. | 802 // Resize the window so that it does not have the same size as a monitor. |
853 // (Otherwise, some window managers immediately put the window back in | 803 // (Otherwise, some window managers immediately put the window back in |
854 // fullscreen mode). | 804 // fullscreen mode). |
855 gfx::Rect adjusted_bounds_in_pixels(bounds_in_pixels_.origin(), | 805 gfx::Rect adjusted_bounds_in_pixels(bounds_in_pixels_.origin(), |
856 AdjustSize(bounds_in_pixels_.size())); | 806 AdjustSize(bounds_in_pixels_.size())); |
857 if (adjusted_bounds_in_pixels != bounds_in_pixels_) | 807 if (adjusted_bounds_in_pixels != bounds_in_pixels_) |
858 SetBoundsInPixels(adjusted_bounds_in_pixels); | 808 SetBoundsInPixels(adjusted_bounds_in_pixels); |
859 } | 809 } |
860 | 810 |
861 // Some WMs do not respect maximization hints on unmapped windows, so we | 811 // Some WMs do not respect maximization hints on unmapped windows, so we |
862 // save this one for later too. | 812 // save this one for later too. |
863 should_maximize_after_map_ = !IsVisible(); | 813 should_maximize_after_map_ = !IsVisible(); |
864 | 814 |
865 // When we are in the process of requesting to maximize a window, we can | 815 // When we are in the process of requesting to maximize a window, we can |
866 // accurately keep track of our restored bounds instead of relying on the | 816 // accurately keep track of our restored bounds instead of relying on the |
867 // heuristics that are in the PropertyNotify and ConfigureNotify handlers. | 817 // heuristics that are in the PropertyNotify and ConfigureNotify handlers. |
868 restored_bounds_in_pixels_ = bounds_in_pixels_; | 818 restored_bounds_in_pixels_ = bounds_in_pixels_; |
869 | 819 |
870 SetWMSpecState(true, | 820 SetWMSpecState(true, ui::GetAtom("_NET_WM_STATE_MAXIMIZED_VERT"), |
871 atom_cache_.GetAtom("_NET_WM_STATE_MAXIMIZED_VERT"), | 821 ui::GetAtom("_NET_WM_STATE_MAXIMIZED_HORZ")); |
872 atom_cache_.GetAtom("_NET_WM_STATE_MAXIMIZED_HORZ")); | |
873 if (IsMinimized()) | 822 if (IsMinimized()) |
874 ShowWindowWithState(ui::SHOW_STATE_NORMAL); | 823 ShowWindowWithState(ui::SHOW_STATE_NORMAL); |
875 } | 824 } |
876 | 825 |
877 void DesktopWindowTreeHostX11::Minimize() { | 826 void DesktopWindowTreeHostX11::Minimize() { |
878 ReleaseCapture(); | 827 ReleaseCapture(); |
879 XIconifyWindow(xdisplay_, xwindow_, 0); | 828 XIconifyWindow(xdisplay_, xwindow_, 0); |
880 } | 829 } |
881 | 830 |
882 void DesktopWindowTreeHostX11::Restore() { | 831 void DesktopWindowTreeHostX11::Restore() { |
883 should_maximize_after_map_ = false; | 832 should_maximize_after_map_ = false; |
884 SetWMSpecState(false, | 833 SetWMSpecState(false, ui::GetAtom("_NET_WM_STATE_MAXIMIZED_VERT"), |
885 atom_cache_.GetAtom("_NET_WM_STATE_MAXIMIZED_VERT"), | 834 ui::GetAtom("_NET_WM_STATE_MAXIMIZED_HORZ")); |
886 atom_cache_.GetAtom("_NET_WM_STATE_MAXIMIZED_HORZ")); | |
887 if (IsMinimized()) | 835 if (IsMinimized()) |
888 ShowWindowWithState(ui::SHOW_STATE_NORMAL); | 836 ShowWindowWithState(ui::SHOW_STATE_NORMAL); |
889 } | 837 } |
890 | 838 |
891 bool DesktopWindowTreeHostX11::IsMaximized() const { | 839 bool DesktopWindowTreeHostX11::IsMaximized() const { |
892 return (HasWMSpecProperty("_NET_WM_STATE_MAXIMIZED_VERT") && | 840 return (HasWMSpecProperty("_NET_WM_STATE_MAXIMIZED_VERT") && |
893 HasWMSpecProperty("_NET_WM_STATE_MAXIMIZED_HORZ")); | 841 HasWMSpecProperty("_NET_WM_STATE_MAXIMIZED_HORZ")); |
894 } | 842 } |
895 | 843 |
896 bool DesktopWindowTreeHostX11::IsMinimized() const { | 844 bool DesktopWindowTreeHostX11::IsMinimized() const { |
897 return HasWMSpecProperty("_NET_WM_STATE_HIDDEN"); | 845 return HasWMSpecProperty("_NET_WM_STATE_HIDDEN"); |
898 } | 846 } |
899 | 847 |
900 bool DesktopWindowTreeHostX11::HasCapture() const { | 848 bool DesktopWindowTreeHostX11::HasCapture() const { |
901 return g_current_capture == this; | 849 return g_current_capture == this; |
902 } | 850 } |
903 | 851 |
904 void DesktopWindowTreeHostX11::SetAlwaysOnTop(bool always_on_top) { | 852 void DesktopWindowTreeHostX11::SetAlwaysOnTop(bool always_on_top) { |
905 is_always_on_top_ = always_on_top; | 853 is_always_on_top_ = always_on_top; |
906 SetWMSpecState(always_on_top, | 854 SetWMSpecState(always_on_top, ui::GetAtom("_NET_WM_STATE_ABOVE"), None); |
907 atom_cache_.GetAtom("_NET_WM_STATE_ABOVE"), | |
908 None); | |
909 } | 855 } |
910 | 856 |
911 bool DesktopWindowTreeHostX11::IsAlwaysOnTop() const { | 857 bool DesktopWindowTreeHostX11::IsAlwaysOnTop() const { |
912 return is_always_on_top_; | 858 return is_always_on_top_; |
913 } | 859 } |
914 | 860 |
915 void DesktopWindowTreeHostX11::SetVisibleOnAllWorkspaces(bool always_visible) { | 861 void DesktopWindowTreeHostX11::SetVisibleOnAllWorkspaces(bool always_visible) { |
916 SetWMSpecState(always_visible, | 862 SetWMSpecState(always_visible, ui::GetAtom("_NET_WM_STATE_STICKY"), None); |
917 atom_cache_.GetAtom("_NET_WM_STATE_STICKY"), | |
918 None); | |
919 | 863 |
920 int new_desktop = 0; | 864 int new_desktop = 0; |
921 if (always_visible) { | 865 if (always_visible) { |
922 new_desktop = kAllDesktops; | 866 new_desktop = kAllDesktops; |
923 } else { | 867 } else { |
924 if (!ui::GetCurrentDesktop(&new_desktop)) | 868 if (!ui::GetCurrentDesktop(&new_desktop)) |
925 return; | 869 return; |
926 } | 870 } |
927 | 871 |
928 workspace_ = base::IntToString(kAllDesktops); | 872 workspace_ = base::IntToString(kAllDesktops); |
929 XEvent xevent; | 873 XEvent xevent; |
930 memset (&xevent, 0, sizeof (xevent)); | 874 memset (&xevent, 0, sizeof (xevent)); |
931 xevent.type = ClientMessage; | 875 xevent.type = ClientMessage; |
932 xevent.xclient.window = xwindow_; | 876 xevent.xclient.window = xwindow_; |
933 xevent.xclient.message_type = atom_cache_.GetAtom("_NET_WM_DESKTOP"); | 877 xevent.xclient.message_type = ui::GetAtom("_NET_WM_DESKTOP"); |
934 xevent.xclient.format = 32; | 878 xevent.xclient.format = 32; |
935 xevent.xclient.data.l[0] = new_desktop; | 879 xevent.xclient.data.l[0] = new_desktop; |
936 xevent.xclient.data.l[1] = 0; | 880 xevent.xclient.data.l[1] = 0; |
937 xevent.xclient.data.l[2] = 0; | 881 xevent.xclient.data.l[2] = 0; |
938 xevent.xclient.data.l[3] = 0; | 882 xevent.xclient.data.l[3] = 0; |
939 xevent.xclient.data.l[4] = 0; | 883 xevent.xclient.data.l[4] = 0; |
940 XSendEvent(xdisplay_, x_root_window_, False, | 884 XSendEvent(xdisplay_, x_root_window_, False, |
941 SubstructureRedirectMask | SubstructureNotifyMask, | 885 SubstructureRedirectMask | SubstructureNotifyMask, |
942 &xevent); | 886 &xevent); |
943 } | 887 } |
944 | 888 |
945 bool DesktopWindowTreeHostX11::IsVisibleOnAllWorkspaces() const { | 889 bool DesktopWindowTreeHostX11::IsVisibleOnAllWorkspaces() const { |
946 // We don't need a check for _NET_WM_STATE_STICKY because that would specify | 890 // We don't need a check for _NET_WM_STATE_STICKY because that would specify |
947 // that the window remain in a fixed position even if the viewport scrolls. | 891 // that the window remain in a fixed position even if the viewport scrolls. |
948 // This is different from the type of workspace that's associated with | 892 // This is different from the type of workspace that's associated with |
949 // _NET_WM_DESKTOP. | 893 // _NET_WM_DESKTOP. |
950 return GetWorkspace() == base::IntToString(kAllDesktops); | 894 return GetWorkspace() == base::IntToString(kAllDesktops); |
951 } | 895 } |
952 | 896 |
953 bool DesktopWindowTreeHostX11::SetWindowTitle(const base::string16& title) { | 897 bool DesktopWindowTreeHostX11::SetWindowTitle(const base::string16& title) { |
954 if (window_title_ == title) | 898 if (window_title_ == title) |
955 return false; | 899 return false; |
956 window_title_ = title; | 900 window_title_ = title; |
957 std::string utf8str = base::UTF16ToUTF8(title); | 901 std::string utf8str = base::UTF16ToUTF8(title); |
958 XChangeProperty(xdisplay_, | 902 XChangeProperty(xdisplay_, xwindow_, ui::GetAtom("_NET_WM_NAME"), |
959 xwindow_, | 903 ui::GetAtom("UTF8_STRING"), 8, PropModeReplace, |
960 atom_cache_.GetAtom("_NET_WM_NAME"), | |
961 atom_cache_.GetAtom("UTF8_STRING"), | |
962 8, | |
963 PropModeReplace, | |
964 reinterpret_cast<const unsigned char*>(utf8str.c_str()), | 904 reinterpret_cast<const unsigned char*>(utf8str.c_str()), |
965 utf8str.size()); | 905 utf8str.size()); |
966 XTextProperty xtp; | 906 XTextProperty xtp; |
967 char* c_utf8_str = const_cast<char*>(utf8str.c_str()); | 907 char* c_utf8_str = const_cast<char*>(utf8str.c_str()); |
968 if (Xutf8TextListToTextProperty(xdisplay_, &c_utf8_str, 1, | 908 if (Xutf8TextListToTextProperty(xdisplay_, &c_utf8_str, 1, |
969 XUTF8StringStyle, &xtp) == Success) { | 909 XUTF8StringStyle, &xtp) == Success) { |
970 XSetWMName(xdisplay_, xwindow_, &xtp); | 910 XSetWMName(xdisplay_, xwindow_, &xtp); |
971 XFree(xtp.value); | 911 XFree(xtp.value); |
972 } | 912 } |
973 return true; | 913 return true; |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1050 | 990 |
1051 // Work around a bug where if we try to unfullscreen, metacity immediately | 991 // Work around a bug where if we try to unfullscreen, metacity immediately |
1052 // fullscreens us again. This is a little flickery and not necessary if | 992 // fullscreens us again. This is a little flickery and not necessary if |
1053 // there's a gnome-panel, but it's not easy to detect whether there's a | 993 // there's a gnome-panel, but it's not easy to detect whether there's a |
1054 // panel or not. | 994 // panel or not. |
1055 bool unmaximize_and_remaximize = !fullscreen && IsMaximized() && | 995 bool unmaximize_and_remaximize = !fullscreen && IsMaximized() && |
1056 ui::GuessWindowManager() == ui::WM_METACITY; | 996 ui::GuessWindowManager() == ui::WM_METACITY; |
1057 | 997 |
1058 if (unmaximize_and_remaximize) | 998 if (unmaximize_and_remaximize) |
1059 Restore(); | 999 Restore(); |
1060 SetWMSpecState(fullscreen, | 1000 SetWMSpecState(fullscreen, ui::GetAtom("_NET_WM_STATE_FULLSCREEN"), None); |
1061 atom_cache_.GetAtom("_NET_WM_STATE_FULLSCREEN"), | |
1062 None); | |
1063 if (unmaximize_and_remaximize) | 1001 if (unmaximize_and_remaximize) |
1064 Maximize(); | 1002 Maximize(); |
1065 | 1003 |
1066 // Try to guess the size we will have after the switch to/from fullscreen: | 1004 // Try to guess the size we will have after the switch to/from fullscreen: |
1067 // - (may) avoid transient states | 1005 // - (may) avoid transient states |
1068 // - works around Flash content which expects to have the size updated | 1006 // - works around Flash content which expects to have the size updated |
1069 // synchronously. | 1007 // synchronously. |
1070 // See https://crbug.com/361408 | 1008 // See https://crbug.com/361408 |
1071 if (fullscreen) { | 1009 if (fullscreen) { |
1072 restored_bounds_in_pixels_ = bounds_in_pixels_; | 1010 restored_bounds_in_pixels_ = bounds_in_pixels_; |
(...skipping 24 matching lines...) Expand all Loading... |
1097 // XChangeProperty() expects "cardinality" to be long. | 1035 // XChangeProperty() expects "cardinality" to be long. |
1098 | 1036 |
1099 // Scale opacity to [0 .. 255] range. | 1037 // Scale opacity to [0 .. 255] range. |
1100 unsigned long opacity_8bit = | 1038 unsigned long opacity_8bit = |
1101 static_cast<unsigned long>(opacity * 255.0f) & 0xFF; | 1039 static_cast<unsigned long>(opacity * 255.0f) & 0xFF; |
1102 // Use opacity value for all channels. | 1040 // Use opacity value for all channels. |
1103 const unsigned long channel_multiplier = 0x1010101; | 1041 const unsigned long channel_multiplier = 0x1010101; |
1104 unsigned long cardinality = opacity_8bit * channel_multiplier; | 1042 unsigned long cardinality = opacity_8bit * channel_multiplier; |
1105 | 1043 |
1106 if (cardinality == 0xffffffff) { | 1044 if (cardinality == 0xffffffff) { |
1107 XDeleteProperty(xdisplay_, xwindow_, | 1045 XDeleteProperty(xdisplay_, xwindow_, ui::GetAtom("_NET_WM_WINDOW_OPACITY")); |
1108 atom_cache_.GetAtom("_NET_WM_WINDOW_OPACITY")); | |
1109 } else { | 1046 } else { |
1110 XChangeProperty(xdisplay_, xwindow_, | 1047 XChangeProperty(xdisplay_, xwindow_, ui::GetAtom("_NET_WM_WINDOW_OPACITY"), |
1111 atom_cache_.GetAtom("_NET_WM_WINDOW_OPACITY"), | 1048 XA_CARDINAL, 32, PropModeReplace, |
1112 XA_CARDINAL, 32, | |
1113 PropModeReplace, | |
1114 reinterpret_cast<unsigned char*>(&cardinality), 1); | 1049 reinterpret_cast<unsigned char*>(&cardinality), 1); |
1115 } | 1050 } |
1116 } | 1051 } |
1117 | 1052 |
1118 void DesktopWindowTreeHostX11::SetWindowIcons( | 1053 void DesktopWindowTreeHostX11::SetWindowIcons( |
1119 const gfx::ImageSkia& window_icon, const gfx::ImageSkia& app_icon) { | 1054 const gfx::ImageSkia& window_icon, const gfx::ImageSkia& app_icon) { |
1120 // TODO(erg): The way we handle icons across different versions of chrome | 1055 // TODO(erg): The way we handle icons across different versions of chrome |
1121 // could be substantially improved. The Windows version does its own thing | 1056 // could be substantially improved. The Windows version does its own thing |
1122 // and only sometimes comes down this code path. The icon stuff in | 1057 // and only sometimes comes down this code path. The icon stuff in |
1123 // ChromeViewsDelegate is hard coded to use HICONs. Likewise, we're hard | 1058 // ChromeViewsDelegate is hard coded to use HICONs. Likewise, we're hard |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1360 unsigned long attribute_mask = CWBackPixmap | CWBitGravity; | 1295 unsigned long attribute_mask = CWBackPixmap | CWBitGravity; |
1361 XSetWindowAttributes swa; | 1296 XSetWindowAttributes swa; |
1362 memset(&swa, 0, sizeof(swa)); | 1297 memset(&swa, 0, sizeof(swa)); |
1363 swa.background_pixmap = None; | 1298 swa.background_pixmap = None; |
1364 swa.bit_gravity = NorthWestGravity; | 1299 swa.bit_gravity = NorthWestGravity; |
1365 | 1300 |
1366 ::Atom window_type; | 1301 ::Atom window_type; |
1367 switch (params.type) { | 1302 switch (params.type) { |
1368 case Widget::InitParams::TYPE_MENU: | 1303 case Widget::InitParams::TYPE_MENU: |
1369 swa.override_redirect = True; | 1304 swa.override_redirect = True; |
1370 window_type = atom_cache_.GetAtom("_NET_WM_WINDOW_TYPE_MENU"); | 1305 window_type = ui::GetAtom("_NET_WM_WINDOW_TYPE_MENU"); |
1371 break; | 1306 break; |
1372 case Widget::InitParams::TYPE_TOOLTIP: | 1307 case Widget::InitParams::TYPE_TOOLTIP: |
1373 swa.override_redirect = True; | 1308 swa.override_redirect = True; |
1374 window_type = atom_cache_.GetAtom("_NET_WM_WINDOW_TYPE_TOOLTIP"); | 1309 window_type = ui::GetAtom("_NET_WM_WINDOW_TYPE_TOOLTIP"); |
1375 break; | 1310 break; |
1376 case Widget::InitParams::TYPE_POPUP: | 1311 case Widget::InitParams::TYPE_POPUP: |
1377 swa.override_redirect = True; | 1312 swa.override_redirect = True; |
1378 window_type = atom_cache_.GetAtom("_NET_WM_WINDOW_TYPE_NOTIFICATION"); | 1313 window_type = ui::GetAtom("_NET_WM_WINDOW_TYPE_NOTIFICATION"); |
1379 break; | 1314 break; |
1380 case Widget::InitParams::TYPE_DRAG: | 1315 case Widget::InitParams::TYPE_DRAG: |
1381 swa.override_redirect = True; | 1316 swa.override_redirect = True; |
1382 window_type = atom_cache_.GetAtom("_NET_WM_WINDOW_TYPE_DND"); | 1317 window_type = ui::GetAtom("_NET_WM_WINDOW_TYPE_DND"); |
1383 break; | 1318 break; |
1384 default: | 1319 default: |
1385 window_type = atom_cache_.GetAtom("_NET_WM_WINDOW_TYPE_NORMAL"); | 1320 window_type = ui::GetAtom("_NET_WM_WINDOW_TYPE_NORMAL"); |
1386 break; | 1321 break; |
1387 } | 1322 } |
1388 // An in-activatable window should not interact with the system wm. | 1323 // An in-activatable window should not interact with the system wm. |
1389 if (!activatable_) | 1324 if (!activatable_) |
1390 swa.override_redirect = True; | 1325 swa.override_redirect = True; |
1391 | 1326 |
1392 if (swa.override_redirect) | 1327 if (swa.override_redirect) |
1393 attribute_mask |= CWOverrideRedirect; | 1328 attribute_mask |= CWOverrideRedirect; |
1394 | 1329 |
1395 bool enable_transparent_visuals; | 1330 bool enable_transparent_visuals; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1444 xwindow_events_.reset(new ui::XScopedEventSelector(xwindow_, event_mask)); | 1379 xwindow_events_.reset(new ui::XScopedEventSelector(xwindow_, event_mask)); |
1445 XFlush(xdisplay_); | 1380 XFlush(xdisplay_); |
1446 | 1381 |
1447 if (ui::IsXInput2Available()) | 1382 if (ui::IsXInput2Available()) |
1448 ui::TouchFactory::GetInstance()->SetupXI2ForXWindow(xwindow_); | 1383 ui::TouchFactory::GetInstance()->SetupXI2ForXWindow(xwindow_); |
1449 | 1384 |
1450 // TODO(erg): We currently only request window deletion events. We also | 1385 // TODO(erg): We currently only request window deletion events. We also |
1451 // should listen for activation events and anything else that GTK+ listens | 1386 // should listen for activation events and anything else that GTK+ listens |
1452 // for, and do something useful. | 1387 // for, and do something useful. |
1453 ::Atom protocols[2]; | 1388 ::Atom protocols[2]; |
1454 protocols[0] = atom_cache_.GetAtom("WM_DELETE_WINDOW"); | 1389 protocols[0] = ui::GetAtom("WM_DELETE_WINDOW"); |
1455 protocols[1] = atom_cache_.GetAtom("_NET_WM_PING"); | 1390 protocols[1] = ui::GetAtom("_NET_WM_PING"); |
1456 XSetWMProtocols(xdisplay_, xwindow_, protocols, 2); | 1391 XSetWMProtocols(xdisplay_, xwindow_, protocols, 2); |
1457 | 1392 |
1458 // We need a WM_CLIENT_MACHINE and WM_LOCALE_NAME value so we integrate with | 1393 // We need a WM_CLIENT_MACHINE and WM_LOCALE_NAME value so we integrate with |
1459 // the desktop environment. | 1394 // the desktop environment. |
1460 XSetWMProperties(xdisplay_, xwindow_, NULL, NULL, NULL, 0, NULL, NULL, NULL); | 1395 XSetWMProperties(xdisplay_, xwindow_, NULL, NULL, NULL, 0, NULL, NULL, NULL); |
1461 | 1396 |
1462 // Likewise, the X server needs to know this window's pid so it knows which | 1397 // Likewise, the X server needs to know this window's pid so it knows which |
1463 // program to kill if the window hangs. | 1398 // program to kill if the window hangs. |
1464 // XChangeProperty() expects "pid" to be long. | 1399 // XChangeProperty() expects "pid" to be long. |
1465 static_assert(sizeof(long) >= sizeof(pid_t), | 1400 static_assert(sizeof(long) >= sizeof(pid_t), |
1466 "pid_t should not be larger than long"); | 1401 "pid_t should not be larger than long"); |
1467 long pid = getpid(); | 1402 long pid = getpid(); |
1468 XChangeProperty(xdisplay_, | 1403 XChangeProperty(xdisplay_, xwindow_, ui::GetAtom("_NET_WM_PID"), XA_CARDINAL, |
1469 xwindow_, | 1404 32, PropModeReplace, reinterpret_cast<unsigned char*>(&pid), |
1470 atom_cache_.GetAtom("_NET_WM_PID"), | 1405 1); |
1471 XA_CARDINAL, | |
1472 32, | |
1473 PropModeReplace, | |
1474 reinterpret_cast<unsigned char*>(&pid), 1); | |
1475 | 1406 |
1476 XChangeProperty(xdisplay_, | 1407 XChangeProperty(xdisplay_, xwindow_, ui::GetAtom("_NET_WM_WINDOW_TYPE"), |
1477 xwindow_, | 1408 XA_ATOM, 32, PropModeReplace, |
1478 atom_cache_.GetAtom("_NET_WM_WINDOW_TYPE"), | |
1479 XA_ATOM, | |
1480 32, | |
1481 PropModeReplace, | |
1482 reinterpret_cast<unsigned char*>(&window_type), 1); | 1409 reinterpret_cast<unsigned char*>(&window_type), 1); |
1483 | 1410 |
1484 // List of window state properties (_NET_WM_STATE) to set, if any. | 1411 // List of window state properties (_NET_WM_STATE) to set, if any. |
1485 std::vector< ::Atom> state_atom_list; | 1412 std::vector< ::Atom> state_atom_list; |
1486 | 1413 |
1487 // Remove popup windows from taskbar unless overridden. | 1414 // Remove popup windows from taskbar unless overridden. |
1488 if ((params.type == Widget::InitParams::TYPE_POPUP || | 1415 if ((params.type == Widget::InitParams::TYPE_POPUP || |
1489 params.type == Widget::InitParams::TYPE_BUBBLE) && | 1416 params.type == Widget::InitParams::TYPE_BUBBLE) && |
1490 !params.force_show_in_taskbar) { | 1417 !params.force_show_in_taskbar) { |
1491 state_atom_list.push_back( | 1418 state_atom_list.push_back(ui::GetAtom("_NET_WM_STATE_SKIP_TASKBAR")); |
1492 atom_cache_.GetAtom("_NET_WM_STATE_SKIP_TASKBAR")); | |
1493 } | 1419 } |
1494 | 1420 |
1495 // If the window should stay on top of other windows, add the | 1421 // If the window should stay on top of other windows, add the |
1496 // _NET_WM_STATE_ABOVE property. | 1422 // _NET_WM_STATE_ABOVE property. |
1497 is_always_on_top_ = params.keep_on_top; | 1423 is_always_on_top_ = params.keep_on_top; |
1498 if (is_always_on_top_) | 1424 if (is_always_on_top_) |
1499 state_atom_list.push_back(atom_cache_.GetAtom("_NET_WM_STATE_ABOVE")); | 1425 state_atom_list.push_back(ui::GetAtom("_NET_WM_STATE_ABOVE")); |
1500 | 1426 |
1501 workspace_.clear(); | 1427 workspace_.clear(); |
1502 if (params.visible_on_all_workspaces) { | 1428 if (params.visible_on_all_workspaces) { |
1503 state_atom_list.push_back(atom_cache_.GetAtom("_NET_WM_STATE_STICKY")); | 1429 state_atom_list.push_back(ui::GetAtom("_NET_WM_STATE_STICKY")); |
1504 ui::SetIntProperty(xwindow_, "_NET_WM_DESKTOP", "CARDINAL", kAllDesktops); | 1430 ui::SetIntProperty(xwindow_, "_NET_WM_DESKTOP", "CARDINAL", kAllDesktops); |
1505 } else if (!params.workspace.empty()) { | 1431 } else if (!params.workspace.empty()) { |
1506 int workspace; | 1432 int workspace; |
1507 if (base::StringToInt(params.workspace, &workspace)) | 1433 if (base::StringToInt(params.workspace, &workspace)) |
1508 ui::SetIntProperty(xwindow_, "_NET_WM_DESKTOP", "CARDINAL", workspace); | 1434 ui::SetIntProperty(xwindow_, "_NET_WM_DESKTOP", "CARDINAL", workspace); |
1509 } | 1435 } |
1510 | 1436 |
1511 // Setting _NET_WM_STATE by sending a message to the root_window (with | 1437 // Setting _NET_WM_STATE by sending a message to the root_window (with |
1512 // SetWMSpecState) has no effect here since the window has not yet been | 1438 // SetWMSpecState) has no effect here since the window has not yet been |
1513 // mapped. So we manually change the state. | 1439 // mapped. So we manually change the state. |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1710 const ui::PlatformEvent& event) { | 1636 const ui::PlatformEvent& event) { |
1711 if (!IsActive()) | 1637 if (!IsActive()) |
1712 return; | 1638 return; |
1713 | 1639 |
1714 ui::EventType type = ui::EventTypeFromNative(event); | 1640 ui::EventType type = ui::EventTypeFromNative(event); |
1715 if (type == ui::ET_MOUSE_PRESSED || | 1641 if (type == ui::ET_MOUSE_PRESSED || |
1716 type == ui::ET_KEY_PRESSED || | 1642 type == ui::ET_KEY_PRESSED || |
1717 type == ui::ET_TOUCH_PRESSED) { | 1643 type == ui::ET_TOUCH_PRESSED) { |
1718 unsigned long wm_user_time_ms = static_cast<unsigned long>( | 1644 unsigned long wm_user_time_ms = static_cast<unsigned long>( |
1719 (ui::EventTimeFromNative(event) - base::TimeTicks()).InMilliseconds()); | 1645 (ui::EventTimeFromNative(event) - base::TimeTicks()).InMilliseconds()); |
1720 XChangeProperty(xdisplay_, | 1646 XChangeProperty(xdisplay_, xwindow_, ui::GetAtom("_NET_WM_USER_TIME"), |
1721 xwindow_, | 1647 XA_CARDINAL, 32, PropModeReplace, |
1722 atom_cache_.GetAtom("_NET_WM_USER_TIME"), | 1648 reinterpret_cast<const unsigned char*>(&wm_user_time_ms), |
1723 XA_CARDINAL, | |
1724 32, | |
1725 PropModeReplace, | |
1726 reinterpret_cast<const unsigned char *>(&wm_user_time_ms), | |
1727 1); | 1649 1); |
1728 } | 1650 } |
1729 } | 1651 } |
1730 | 1652 |
1731 void DesktopWindowTreeHostX11::SetWMSpecState(bool enabled, | 1653 void DesktopWindowTreeHostX11::SetWMSpecState(bool enabled, |
1732 ::Atom state1, | 1654 ::Atom state1, |
1733 ::Atom state2) { | 1655 ::Atom state2) { |
1734 XEvent xclient; | 1656 XEvent xclient; |
1735 memset(&xclient, 0, sizeof(xclient)); | 1657 memset(&xclient, 0, sizeof(xclient)); |
1736 xclient.type = ClientMessage; | 1658 xclient.type = ClientMessage; |
1737 xclient.xclient.window = xwindow_; | 1659 xclient.xclient.window = xwindow_; |
1738 xclient.xclient.message_type = atom_cache_.GetAtom("_NET_WM_STATE"); | 1660 xclient.xclient.message_type = ui::GetAtom("_NET_WM_STATE"); |
1739 xclient.xclient.format = 32; | 1661 xclient.xclient.format = 32; |
1740 xclient.xclient.data.l[0] = | 1662 xclient.xclient.data.l[0] = |
1741 enabled ? k_NET_WM_STATE_ADD : k_NET_WM_STATE_REMOVE; | 1663 enabled ? k_NET_WM_STATE_ADD : k_NET_WM_STATE_REMOVE; |
1742 xclient.xclient.data.l[1] = state1; | 1664 xclient.xclient.data.l[1] = state1; |
1743 xclient.xclient.data.l[2] = state2; | 1665 xclient.xclient.data.l[2] = state2; |
1744 xclient.xclient.data.l[3] = 1; | 1666 xclient.xclient.data.l[3] = 1; |
1745 xclient.xclient.data.l[4] = 0; | 1667 xclient.xclient.data.l[4] = 0; |
1746 | 1668 |
1747 XSendEvent(xdisplay_, x_root_window_, False, | 1669 XSendEvent(xdisplay_, x_root_window_, False, |
1748 SubstructureRedirectMask | SubstructureNotifyMask, | 1670 SubstructureRedirectMask | SubstructureNotifyMask, |
1749 &xclient); | 1671 &xclient); |
1750 } | 1672 } |
1751 | 1673 |
1752 bool DesktopWindowTreeHostX11::HasWMSpecProperty(const char* property) const { | 1674 bool DesktopWindowTreeHostX11::HasWMSpecProperty(const char* property) const { |
1753 return window_properties_.find(atom_cache_.GetAtom(property)) != | 1675 return window_properties_.find(ui::GetAtom(property)) != |
1754 window_properties_.end(); | 1676 window_properties_.end(); |
1755 } | 1677 } |
1756 | 1678 |
1757 void DesktopWindowTreeHostX11::SetUseNativeFrame(bool use_native_frame) { | 1679 void DesktopWindowTreeHostX11::SetUseNativeFrame(bool use_native_frame) { |
1758 use_native_frame_ = use_native_frame; | 1680 use_native_frame_ = use_native_frame; |
1759 ui::SetUseOSWindowFrame(xwindow_, use_native_frame); | 1681 ui::SetUseOSWindowFrame(xwindow_, use_native_frame); |
1760 ResetWindowRegion(); | 1682 ResetWindowRegion(); |
1761 } | 1683 } |
1762 | 1684 |
1763 void DesktopWindowTreeHostX11::DispatchMouseEvent(ui::MouseEvent* event) { | 1685 void DesktopWindowTreeHostX11::DispatchMouseEvent(ui::MouseEvent* event) { |
1764 // In Windows, the native events sent to chrome are separated into client | 1686 // In Windows, the native events sent to chrome are separated into client |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1924 | 1846 |
1925 // If SHOW_STATE_INACTIVE, tell the window manager not to focus the window | 1847 // If SHOW_STATE_INACTIVE, tell the window manager not to focus the window |
1926 // when mapping. This is done by setting the _NET_WM_USER_TIME to 0. See e.g. | 1848 // when mapping. This is done by setting the _NET_WM_USER_TIME to 0. See e.g. |
1927 // http://standards.freedesktop.org/wm-spec/latest/ar01s05.html | 1849 // http://standards.freedesktop.org/wm-spec/latest/ar01s05.html |
1928 ignore_keyboard_input_ = show_state == ui::SHOW_STATE_INACTIVE; | 1850 ignore_keyboard_input_ = show_state == ui::SHOW_STATE_INACTIVE; |
1929 unsigned long wm_user_time_ms = | 1851 unsigned long wm_user_time_ms = |
1930 ignore_keyboard_input_ | 1852 ignore_keyboard_input_ |
1931 ? 0 | 1853 ? 0 |
1932 : ui::X11EventSource::GetInstance()->GetTimestamp(); | 1854 : ui::X11EventSource::GetInstance()->GetTimestamp(); |
1933 if (show_state == ui::SHOW_STATE_INACTIVE || wm_user_time_ms != 0) { | 1855 if (show_state == ui::SHOW_STATE_INACTIVE || wm_user_time_ms != 0) { |
1934 XChangeProperty( | 1856 XChangeProperty(xdisplay_, xwindow_, ui::GetAtom("_NET_WM_USER_TIME"), |
1935 xdisplay_, xwindow_, atom_cache_.GetAtom("_NET_WM_USER_TIME"), | 1857 XA_CARDINAL, 32, PropModeReplace, |
1936 XA_CARDINAL, 32, PropModeReplace, | 1858 reinterpret_cast<const unsigned char*>(&wm_user_time_ms), |
1937 reinterpret_cast<const unsigned char*>(&wm_user_time_ms), 1); | 1859 1); |
1938 } | 1860 } |
1939 | 1861 |
1940 ui::X11EventSource* event_source = ui::X11EventSource::GetInstance(); | 1862 ui::X11EventSource* event_source = ui::X11EventSource::GetInstance(); |
1941 DCHECK(event_source); | 1863 DCHECK(event_source); |
1942 | 1864 |
1943 UpdateMinAndMaxSize(); | 1865 UpdateMinAndMaxSize(); |
1944 | 1866 |
1945 XMapWindow(xdisplay_, xwindow_); | 1867 XMapWindow(xdisplay_, xwindow_); |
1946 window_mapped_in_client_ = true; | 1868 window_mapped_in_client_ = true; |
1947 } | 1869 } |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2185 has_pointer_ = false; | 2107 has_pointer_ = false; |
2186 has_pointer_grab_ = false; | 2108 has_pointer_grab_ = false; |
2187 has_pointer_focus_ = false; | 2109 has_pointer_focus_ = false; |
2188 has_window_focus_ = false; | 2110 has_window_focus_ = false; |
2189 for (DesktopWindowTreeHostObserverX11& observer : observer_list_) | 2111 for (DesktopWindowTreeHostObserverX11& observer : observer_list_) |
2190 observer.OnWindowUnmapped(xwindow_); | 2112 observer.OnWindowUnmapped(xwindow_); |
2191 break; | 2113 break; |
2192 } | 2114 } |
2193 case ClientMessage: { | 2115 case ClientMessage: { |
2194 Atom message_type = xev->xclient.message_type; | 2116 Atom message_type = xev->xclient.message_type; |
2195 if (message_type == atom_cache_.GetAtom("WM_PROTOCOLS")) { | 2117 if (message_type == ui::GetAtom("WM_PROTOCOLS")) { |
2196 Atom protocol = static_cast<Atom>(xev->xclient.data.l[0]); | 2118 Atom protocol = static_cast<Atom>(xev->xclient.data.l[0]); |
2197 if (protocol == atom_cache_.GetAtom("WM_DELETE_WINDOW")) { | 2119 if (protocol == ui::GetAtom("WM_DELETE_WINDOW")) { |
2198 // We have received a close message from the window manager. | 2120 // We have received a close message from the window manager. |
2199 OnHostCloseRequested(); | 2121 OnHostCloseRequested(); |
2200 } else if (protocol == atom_cache_.GetAtom("_NET_WM_PING")) { | 2122 } else if (protocol == ui::GetAtom("_NET_WM_PING")) { |
2201 XEvent reply_event = *xev; | 2123 XEvent reply_event = *xev; |
2202 reply_event.xclient.window = x_root_window_; | 2124 reply_event.xclient.window = x_root_window_; |
2203 | 2125 |
2204 XSendEvent(xdisplay_, | 2126 XSendEvent(xdisplay_, |
2205 reply_event.xclient.window, | 2127 reply_event.xclient.window, |
2206 False, | 2128 False, |
2207 SubstructureRedirectMask | SubstructureNotifyMask, | 2129 SubstructureRedirectMask | SubstructureNotifyMask, |
2208 &reply_event); | 2130 &reply_event); |
2209 } | 2131 } |
2210 } else if (message_type == atom_cache_.GetAtom("XdndEnter")) { | 2132 } else if (message_type == ui::GetAtom("XdndEnter")) { |
2211 drag_drop_client_->OnXdndEnter(xev->xclient); | 2133 drag_drop_client_->OnXdndEnter(xev->xclient); |
2212 } else if (message_type == atom_cache_.GetAtom("XdndLeave")) { | 2134 } else if (message_type == ui::GetAtom("XdndLeave")) { |
2213 drag_drop_client_->OnXdndLeave(xev->xclient); | 2135 drag_drop_client_->OnXdndLeave(xev->xclient); |
2214 } else if (message_type == atom_cache_.GetAtom("XdndPosition")) { | 2136 } else if (message_type == ui::GetAtom("XdndPosition")) { |
2215 drag_drop_client_->OnXdndPosition(xev->xclient); | 2137 drag_drop_client_->OnXdndPosition(xev->xclient); |
2216 } else if (message_type == atom_cache_.GetAtom("XdndStatus")) { | 2138 } else if (message_type == ui::GetAtom("XdndStatus")) { |
2217 drag_drop_client_->OnXdndStatus(xev->xclient); | 2139 drag_drop_client_->OnXdndStatus(xev->xclient); |
2218 } else if (message_type == atom_cache_.GetAtom("XdndFinished")) { | 2140 } else if (message_type == ui::GetAtom("XdndFinished")) { |
2219 drag_drop_client_->OnXdndFinished(xev->xclient); | 2141 drag_drop_client_->OnXdndFinished(xev->xclient); |
2220 } else if (message_type == atom_cache_.GetAtom("XdndDrop")) { | 2142 } else if (message_type == ui::GetAtom("XdndDrop")) { |
2221 drag_drop_client_->OnXdndDrop(xev->xclient); | 2143 drag_drop_client_->OnXdndDrop(xev->xclient); |
2222 } | 2144 } |
2223 break; | 2145 break; |
2224 } | 2146 } |
2225 case MappingNotify: { | 2147 case MappingNotify: { |
2226 switch (xev->xmapping.request) { | 2148 switch (xev->xmapping.request) { |
2227 case MappingModifier: | 2149 case MappingModifier: |
2228 case MappingKeyboard: | 2150 case MappingKeyboard: |
2229 XRefreshKeyboardMapping(&xev->xmapping); | 2151 XRefreshKeyboardMapping(&xev->xmapping); |
2230 break; | 2152 break; |
(...skipping 23 matching lines...) Expand all Loading... |
2254 break; | 2176 break; |
2255 } | 2177 } |
2256 } | 2178 } |
2257 | 2179 |
2258 ui::MouseEvent mouseev(xev); | 2180 ui::MouseEvent mouseev(xev); |
2259 DispatchMouseEvent(&mouseev); | 2181 DispatchMouseEvent(&mouseev); |
2260 break; | 2182 break; |
2261 } | 2183 } |
2262 case PropertyNotify: { | 2184 case PropertyNotify: { |
2263 ::Atom changed_atom = xev->xproperty.atom; | 2185 ::Atom changed_atom = xev->xproperty.atom; |
2264 if (changed_atom == atom_cache_.GetAtom("_NET_WM_STATE")) { | 2186 if (changed_atom == ui::GetAtom("_NET_WM_STATE")) { |
2265 OnWMStateUpdated(); | 2187 OnWMStateUpdated(); |
2266 } else if (changed_atom == atom_cache_.GetAtom("_NET_FRAME_EXTENTS")) { | 2188 } else if (changed_atom == ui::GetAtom("_NET_FRAME_EXTENTS")) { |
2267 OnFrameExtentsUpdated(); | 2189 OnFrameExtentsUpdated(); |
2268 } else if (changed_atom == atom_cache_.GetAtom("_NET_WM_DESKTOP")) { | 2190 } else if (changed_atom == ui::GetAtom("_NET_WM_DESKTOP")) { |
2269 if (UpdateWorkspace()) | 2191 if (UpdateWorkspace()) |
2270 OnHostWorkspaceChanged(); | 2192 OnHostWorkspaceChanged(); |
2271 } | 2193 } |
2272 break; | 2194 break; |
2273 } | 2195 } |
2274 case SelectionNotify: { | 2196 case SelectionNotify: { |
2275 drag_drop_client_->OnSelectionNotify(xev->xselection); | 2197 drag_drop_client_->OnSelectionNotify(xev->xselection); |
2276 break; | 2198 break; |
2277 } | 2199 } |
2278 } | 2200 } |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2356 | 2278 |
2357 // static | 2279 // static |
2358 DesktopWindowTreeHost* DesktopWindowTreeHost::Create( | 2280 DesktopWindowTreeHost* DesktopWindowTreeHost::Create( |
2359 internal::NativeWidgetDelegate* native_widget_delegate, | 2281 internal::NativeWidgetDelegate* native_widget_delegate, |
2360 DesktopNativeWidgetAura* desktop_native_widget_aura) { | 2282 DesktopNativeWidgetAura* desktop_native_widget_aura) { |
2361 return new DesktopWindowTreeHostX11(native_widget_delegate, | 2283 return new DesktopWindowTreeHostX11(native_widget_delegate, |
2362 desktop_native_widget_aura); | 2284 desktop_native_widget_aura); |
2363 } | 2285 } |
2364 | 2286 |
2365 } // namespace views | 2287 } // namespace views |
OLD | NEW |