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 1954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1965 // region, it wouldn't get painted. | 1965 // region, it wouldn't get painted. |
1966 if (child_) { | 1966 if (child_) { |
1967 window_contents_ = widget_ = gtk_views_fixed_new(); | 1967 window_contents_ = widget_ = gtk_views_fixed_new(); |
1968 gtk_widget_set_name(widget_, "views-gtkwidget-child-fixed"); | 1968 gtk_widget_set_name(widget_, "views-gtkwidget-child-fixed"); |
1969 if (!is_double_buffered_) | 1969 if (!is_double_buffered_) |
1970 GTK_WIDGET_UNSET_FLAGS(widget_, GTK_DOUBLE_BUFFERED); | 1970 GTK_WIDGET_UNSET_FLAGS(widget_, GTK_DOUBLE_BUFFERED); |
1971 gtk_fixed_set_has_window(GTK_FIXED(widget_), true); | 1971 gtk_fixed_set_has_window(GTK_FIXED(widget_), true); |
1972 if (!params.parent && !null_parent_) { | 1972 if (!params.parent && !null_parent_) { |
1973 GtkWidget* popup = gtk_window_new(GTK_WINDOW_POPUP); | 1973 GtkWidget* popup = gtk_window_new(GTK_WINDOW_POPUP); |
1974 null_parent_ = gtk_fixed_new(); | 1974 null_parent_ = gtk_fixed_new(); |
1975 gtk_widget_set_name(widget_, "views-gtkwidget-null-parent"); | 1975 gtk_widget_set_name(null_parent_, "views-gtkwidget-null-parent"); |
1976 gtk_container_add(GTK_CONTAINER(popup), null_parent_); | 1976 gtk_container_add(GTK_CONTAINER(popup), null_parent_); |
1977 gtk_widget_realize(null_parent_); | 1977 gtk_widget_realize(null_parent_); |
1978 } | 1978 } |
1979 if (transparent_) { | 1979 if (transparent_) { |
1980 // transparency has to be configured before widget is realized. | 1980 // transparency has to be configured before widget is realized. |
1981 DCHECK(params.parent) << | 1981 DCHECK(params.parent) << |
1982 "Transparent widget must have parent when initialized"; | 1982 "Transparent widget must have parent when initialized"; |
1983 ConfigureWidgetForTransparentBackground(params.parent); | 1983 ConfigureWidgetForTransparentBackground(params.parent); |
1984 } | 1984 } |
1985 gtk_container_add( | 1985 gtk_container_add( |
(...skipping 13 matching lines...) Expand all Loading... |
1999 // seen in | 1999 // seen in |
2000 // http://code.google.com/p/chromium-os/issues/detail?id=5987 | 2000 // http://code.google.com/p/chromium-os/issues/detail?id=5987 |
2001 | 2001 |
2002 // This can't be done without a parent present, or stale data | 2002 // This can't be done without a parent present, or stale data |
2003 // might show up on the screen as seen in | 2003 // might show up on the screen as seen in |
2004 // http://code.google.com/p/chromium/issues/detail?id=53870 | 2004 // http://code.google.com/p/chromium/issues/detail?id=53870 |
2005 GtkAllocation alloc = | 2005 GtkAllocation alloc = |
2006 { 0, 0, params.bounds.width(), params.bounds.height() }; | 2006 { 0, 0, params.bounds.width(), params.bounds.height() }; |
2007 gtk_widget_size_allocate(widget_, &alloc); | 2007 gtk_widget_size_allocate(widget_, &alloc); |
2008 } | 2008 } |
| 2009 if (params.type == Widget::InitParams::TYPE_CONTROL) { |
| 2010 // Controls are initially visible. |
| 2011 gtk_widget_show(widget_); |
| 2012 } |
2009 } else { | 2013 } else { |
2010 Widget::InitParams::Type type = params.type; | 2014 Widget::InitParams::Type type = params.type; |
2011 if (type == Widget::InitParams::TYPE_BUBBLE && | 2015 if (type == Widget::InitParams::TYPE_BUBBLE && |
2012 params.delegate->AsBubbleDelegate() && | 2016 params.delegate->AsBubbleDelegate() && |
2013 params.delegate->AsBubbleDelegate()->use_focusless()) { | 2017 params.delegate->AsBubbleDelegate()->use_focusless()) { |
2014 // Handles focusless bubble type, which are bubbles that should | 2018 // Handles focusless bubble type, which are bubbles that should |
2015 // act like popups rather than gtk windows. They do not get focus | 2019 // act like popups rather than gtk windows. They do not get focus |
2016 // and are not controlled by window manager placement. | 2020 // and are not controlled by window manager placement. |
2017 type = Widget::InitParams::TYPE_POPUP; | 2021 type = Widget::InitParams::TYPE_POPUP; |
2018 } | 2022 } |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2312 button_pressed = event->type == GDK_BUTTON_PRESS || | 2316 button_pressed = event->type == GDK_BUTTON_PRESS || |
2313 event->type == GDK_2BUTTON_PRESS || | 2317 event->type == GDK_2BUTTON_PRESS || |
2314 event->type == GDK_3BUTTON_PRESS; | 2318 event->type == GDK_3BUTTON_PRESS; |
2315 gdk_event_free(event); | 2319 gdk_event_free(event); |
2316 } | 2320 } |
2317 return button_pressed; | 2321 return button_pressed; |
2318 } | 2322 } |
2319 | 2323 |
2320 } // namespace internal | 2324 } // namespace internal |
2321 } // namespace views | 2325 } // namespace views |
OLD | NEW |