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/native_widget_gtk.h" | 5 #include "ui/views/widget/native_widget_gtk.h" |
6 | 6 |
7 #include <X11/Xatom.h> | 7 #include <X11/Xatom.h> |
8 #include <X11/Xlib.h> | 8 #include <X11/Xlib.h> |
9 #include <X11/extensions/shape.h> | 9 #include <X11/extensions/shape.h> |
10 #include <gdk/gdk.h> | 10 #include <gdk/gdk.h> |
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
641 | 641 |
642 // Make container here. | 642 // Make container here. |
643 CreateGtkWidget(modified_params); | 643 CreateGtkWidget(modified_params); |
644 | 644 |
645 if (params.type == Widget::InitParams::TYPE_MENU) { | 645 if (params.type == Widget::InitParams::TYPE_MENU) { |
646 gtk_window_set_destroy_with_parent(GTK_WINDOW(GetNativeView()), TRUE); | 646 gtk_window_set_destroy_with_parent(GTK_WINDOW(GetNativeView()), TRUE); |
647 gtk_window_set_type_hint(GTK_WINDOW(GetNativeView()), | 647 gtk_window_set_type_hint(GTK_WINDOW(GetNativeView()), |
648 GDK_WINDOW_TYPE_HINT_MENU); | 648 GDK_WINDOW_TYPE_HINT_MENU); |
649 } | 649 } |
650 | 650 |
651 // TODO(piman): is this useful? | |
651 if (View::get_use_acceleration_when_possible()) { | 652 if (View::get_use_acceleration_when_possible()) { |
Ben Goodger (Google)
2012/01/28 00:40:13
I bet not, and this could probablybe removed.
piman
2012/01/28 01:50:35
Done.
| |
652 gint width, height; | 653 gint width, height; |
653 gdk_drawable_get_size(window_contents_->window, &width, &height); | 654 gdk_drawable_get_size(window_contents_->window, &width, &height); |
654 compositor_ = ui::Compositor::Create(this, | 655 compositor_ = new ui::Compositor(this, |
655 GDK_WINDOW_XID(window_contents_->window), | 656 GDK_WINDOW_XID(window_contents_->window), |
656 gfx::Size(width, height)); | 657 gfx::Size(width, height)); |
657 if (compositor_.get()) { | 658 View* root_view = delegate_->AsWidget()->GetRootView(); |
658 View* root_view = delegate_->AsWidget()->GetRootView(); | 659 root_view->SetPaintToLayer(true); |
659 root_view->SetPaintToLayer(true); | 660 compositor_->SetRootLayer(root_view->layer()); |
660 compositor_->SetRootLayer(root_view->layer()); | 661 root_view->SetFillsBoundsOpaquely(!transparent_); |
661 root_view->SetFillsBoundsOpaquely(!transparent_); | |
662 } | |
663 } | 662 } |
664 | 663 |
665 delegate_->OnNativeWidgetCreated(); | 664 delegate_->OnNativeWidgetCreated(); |
666 | 665 |
667 if (opacity_ != 255) | 666 if (opacity_ != 255) |
668 SetOpacity(opacity_); | 667 SetOpacity(opacity_); |
669 | 668 |
670 // Make sure we receive our motion events. | 669 // Make sure we receive our motion events. |
671 | 670 |
672 // In general we register most events on the parent of all widgets. At a | 671 // In general we register most events on the parent of all widgets. At a |
(...skipping 1531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2204 button_pressed = event->type == GDK_BUTTON_PRESS || | 2203 button_pressed = event->type == GDK_BUTTON_PRESS || |
2205 event->type == GDK_2BUTTON_PRESS || | 2204 event->type == GDK_2BUTTON_PRESS || |
2206 event->type == GDK_3BUTTON_PRESS; | 2205 event->type == GDK_3BUTTON_PRESS; |
2207 gdk_event_free(event); | 2206 gdk_event_free(event); |
2208 } | 2207 } |
2209 return button_pressed; | 2208 return button_pressed; |
2210 } | 2209 } |
2211 | 2210 |
2212 } // namespace internal | 2211 } // namespace internal |
2213 } // namespace views | 2212 } // namespace views |
OLD | NEW |