OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "views/widget/native_widget_gtk.h" | 5 #include "views/widget/native_widget_gtk.h" |
6 | 6 |
7 #include <gdk/gdk.h> | 7 #include <gdk/gdk.h> |
8 #include <gdk/gdkx.h> | 8 #include <gdk/gdkx.h> |
9 #include <X11/extensions/shape.h> | 9 #include <X11/extensions/shape.h> |
10 #include <X11/Xatom.h> | 10 #include <X11/Xatom.h> |
(...skipping 1148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1159 | 1159 |
1160 void NativeWidgetGtk::EnableClose(bool enable) { | 1160 void NativeWidgetGtk::EnableClose(bool enable) { |
1161 gtk_window_set_deletable(GetNativeWindow(), enable); | 1161 gtk_window_set_deletable(GetNativeWindow(), enable); |
1162 } | 1162 } |
1163 | 1163 |
1164 void NativeWidgetGtk::Show() { | 1164 void NativeWidgetGtk::Show() { |
1165 if (widget_) { | 1165 if (widget_) { |
1166 gtk_widget_show(widget_); | 1166 gtk_widget_show(widget_); |
1167 if (widget_->window) | 1167 if (widget_->window) |
1168 gdk_window_raise(widget_->window); | 1168 gdk_window_raise(widget_->window); |
1169 delegate_->OnNativeWidgetVisibilityChanged(true); | 1169 // See Hide() for the reason why we're not calling |
| 1170 // OnNativeWidgetVisibilityChange. |
1170 } | 1171 } |
1171 } | 1172 } |
1172 | 1173 |
1173 void NativeWidgetGtk::Hide() { | 1174 void NativeWidgetGtk::Hide() { |
1174 if (widget_) { | 1175 if (widget_) { |
1175 gtk_widget_hide(widget_); | 1176 gtk_widget_hide(widget_); |
1176 if (widget_->window) | 1177 if (widget_->window) |
1177 gdk_window_lower(widget_->window); | 1178 gdk_window_lower(widget_->window); |
1178 delegate_->OnNativeWidgetVisibilityChanged(false); | 1179 // We're not calling OnNativeWidgetVisibilityChanged because it |
| 1180 // breaks the ability to refocus to FindBar. NativeControlGtk |
| 1181 // detaches the underlying gtk widget for optimization purpose |
| 1182 // when it becomes invisible, which in turn breaks SetNativeFocus |
| 1183 // because there is no gtk attached to NativeControlGtk. I'm not |
| 1184 // fixing that part because |
| 1185 // a) This is views/gtk only issue, which will be gone soon. |
| 1186 // b) Alternative fix, which we can modify animator to show it |
| 1187 // immediately, won't be necessary for non gtk implementation. |
1179 } | 1188 } |
1180 } | 1189 } |
1181 | 1190 |
1182 void NativeWidgetGtk::ShowMaximizedWithBounds( | 1191 void NativeWidgetGtk::ShowMaximizedWithBounds( |
1183 const gfx::Rect& restored_bounds) { | 1192 const gfx::Rect& restored_bounds) { |
1184 // TODO: when we add maximization support update this. | 1193 // TODO: when we add maximization support update this. |
1185 Show(); | 1194 Show(); |
1186 } | 1195 } |
1187 | 1196 |
1188 void NativeWidgetGtk::ShowWithWindowState(ui::WindowShowState show_state) { | 1197 void NativeWidgetGtk::ShowWithWindowState(ui::WindowShowState show_state) { |
(...skipping 1073 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2262 button_pressed = event->type == GDK_BUTTON_PRESS || | 2271 button_pressed = event->type == GDK_BUTTON_PRESS || |
2263 event->type == GDK_2BUTTON_PRESS || | 2272 event->type == GDK_2BUTTON_PRESS || |
2264 event->type == GDK_3BUTTON_PRESS; | 2273 event->type == GDK_3BUTTON_PRESS; |
2265 gdk_event_free(event); | 2274 gdk_event_free(event); |
2266 } | 2275 } |
2267 return button_pressed; | 2276 return button_pressed; |
2268 } | 2277 } |
2269 | 2278 |
2270 } // namespace internal | 2279 } // namespace internal |
2271 } // namespace views | 2280 } // namespace views |
OLD | NEW |