Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Side by Side Diff: views/widget/native_widget_gtk.cc

Issue 8202026: views: Some more layer change, and add/update some tests for layers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 1178 matching lines...) Expand 10 before | Expand all | Expand 10 after
1189 1189
1190 void NativeWidgetGtk::EnableClose(bool enable) { 1190 void NativeWidgetGtk::EnableClose(bool enable) {
1191 gtk_window_set_deletable(GetNativeWindow(), enable); 1191 gtk_window_set_deletable(GetNativeWindow(), enable);
1192 } 1192 }
1193 1193
1194 void NativeWidgetGtk::Show() { 1194 void NativeWidgetGtk::Show() {
1195 if (widget_) { 1195 if (widget_) {
1196 gtk_widget_show(widget_); 1196 gtk_widget_show(widget_);
1197 if (widget_->window) 1197 if (widget_->window)
1198 gdk_window_raise(widget_->window); 1198 gdk_window_raise(widget_->window);
1199 // See Hide() for the reason why we're not calling
1200 // OnNativeWidgetVisibilityChange.
1201 } 1199 }
1202 } 1200 }
1203 1201
1204 void NativeWidgetGtk::Hide() { 1202 void NativeWidgetGtk::Hide() {
1205 if (widget_) { 1203 if (widget_) {
1206 gtk_widget_hide(widget_); 1204 gtk_widget_hide(widget_);
1207 if (widget_->window) 1205 if (widget_->window)
1208 gdk_window_lower(widget_->window); 1206 gdk_window_lower(widget_->window);
1209 // We're not calling OnNativeWidgetVisibilityChanged because it
1210 // breaks the ability to refocus to FindBar. NativeControlGtk
1211 // detaches the underlying gtk widget for optimization purpose
1212 // when it becomes invisible, which in turn breaks SetNativeFocus
1213 // because there is no gtk attached to NativeControlGtk. I'm not
1214 // fixing that part because
1215 // a) This is views/gtk only issue, which will be gone soon.
1216 // b) Alternative fix, which we can modify animator to show it
1217 // immediately, won't be necessary for non gtk implementation.
1218 } 1207 }
1219 } 1208 }
1220 1209
1221 void NativeWidgetGtk::ShowMaximizedWithBounds( 1210 void NativeWidgetGtk::ShowMaximizedWithBounds(
1222 const gfx::Rect& restored_bounds) { 1211 const gfx::Rect& restored_bounds) {
1223 // TODO: when we add maximization support update this. 1212 // TODO: when we add maximization support update this.
1224 Show(); 1213 Show();
1225 } 1214 }
1226 1215
1227 void NativeWidgetGtk::ShowWithWindowState(ui::WindowShowState show_state) { 1216 void NativeWidgetGtk::ShowWithWindowState(ui::WindowShowState show_state) {
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after
1818 widget_ = window_contents_ = NULL; 1807 widget_ = window_contents_ = NULL;
1819 } 1808 }
1820 1809
1821 void NativeWidgetGtk::OnDestroyed(GObject *where_the_object_was) { 1810 void NativeWidgetGtk::OnDestroyed(GObject *where_the_object_was) {
1822 delegate_->OnNativeWidgetDestroyed(); 1811 delegate_->OnNativeWidgetDestroyed();
1823 if (ownership_ == Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET) 1812 if (ownership_ == Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET)
1824 delete this; 1813 delete this;
1825 } 1814 }
1826 1815
1827 void NativeWidgetGtk::OnShow(GtkWidget* widget) { 1816 void NativeWidgetGtk::OnShow(GtkWidget* widget) {
1817 delegate_->OnNativeWidgetVisibilityChanged(true);
1828 } 1818 }
1829 1819
1830 void NativeWidgetGtk::OnMap(GtkWidget* widget) { 1820 void NativeWidgetGtk::OnMap(GtkWidget* widget) {
1831 #if defined(TOUCH_UI) 1821 #if defined(TOUCH_UI)
1832 // Force an expose event to trigger OnPaint for touch. This is 1822 // Force an expose event to trigger OnPaint for touch. This is
1833 // a workaround for a bug that X Expose event does not trigger 1823 // a workaround for a bug that X Expose event does not trigger
1834 // Gdk's expose signal. This happens when you try to open views menu 1824 // Gdk's expose signal. This happens when you try to open views menu
1835 // while a virtual keyboard gets kicked in or out. This seems to be 1825 // while a virtual keyboard gets kicked in or out. This seems to be
1836 // a bug in message_pump_x.cc as we do get X Expose event but 1826 // a bug in message_pump_x.cc as we do get X Expose event but
1837 // it doesn't trigger gtk's expose signal. We're not going to fix this 1827 // it doesn't trigger gtk's expose signal. We're not going to fix this
1838 // as we're removing gtk and migrating to new compositor. 1828 // as we're removing gtk and migrating to new compositor.
1839 gdk_window_process_all_updates(); 1829 gdk_window_process_all_updates();
1840 #endif 1830 #endif
1841 } 1831 }
1842 1832
1843 void NativeWidgetGtk::OnHide(GtkWidget* widget) { 1833 void NativeWidgetGtk::OnHide(GtkWidget* widget) {
1834 delegate_->OnNativeWidgetVisibilityChanged(false);
1844 } 1835 }
1845 1836
1846 gboolean NativeWidgetGtk::OnWindowStateEvent(GtkWidget* widget, 1837 gboolean NativeWidgetGtk::OnWindowStateEvent(GtkWidget* widget,
1847 GdkEventWindowState* event) { 1838 GdkEventWindowState* event) {
1848 if (GetWidget()->non_client_view() && 1839 if (GetWidget()->non_client_view() &&
1849 !(event->new_window_state & GDK_WINDOW_STATE_WITHDRAWN)) { 1840 !(event->new_window_state & GDK_WINDOW_STATE_WITHDRAWN)) {
1850 SaveWindowPosition(); 1841 SaveWindowPosition();
1851 } 1842 }
1852 window_state_ = event->new_window_state; 1843 window_state_ = event->new_window_state;
1853 return FALSE; 1844 return FALSE;
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
2314 button_pressed = event->type == GDK_BUTTON_PRESS || 2305 button_pressed = event->type == GDK_BUTTON_PRESS ||
2315 event->type == GDK_2BUTTON_PRESS || 2306 event->type == GDK_2BUTTON_PRESS ||
2316 event->type == GDK_3BUTTON_PRESS; 2307 event->type == GDK_3BUTTON_PRESS;
2317 gdk_event_free(event); 2308 gdk_event_free(event);
2318 } 2309 }
2319 return button_pressed; 2310 return button_pressed;
2320 } 2311 }
2321 2312
2322 } // namespace internal 2313 } // namespace internal
2323 } // namespace views 2314 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698