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 631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 if (View::get_use_acceleration_when_possible()) { | 651 if (View::get_use_acceleration_when_possible()) { |
652 if (ui::Compositor::compositor_factory()) { | 652 gint width, height; |
653 compositor_ = (*ui::Compositor::compositor_factory())(this); | 653 gdk_drawable_get_size(window_contents_->window, &width, &height); |
654 } else { | 654 compositor_ = ui::Compositor::Create(this, |
655 gint width, height; | 655 GDK_WINDOW_XID(window_contents_->window), |
656 gdk_drawable_get_size(window_contents_->window, &width, &height); | 656 gfx::Size(width, height)); |
657 compositor_ = ui::Compositor::Create(this, | |
658 GDK_WINDOW_XID(window_contents_->window), | |
659 gfx::Size(width, height)); | |
660 } | |
661 if (compositor_.get()) { | 657 if (compositor_.get()) { |
662 View* root_view = delegate_->AsWidget()->GetRootView(); | 658 View* root_view = delegate_->AsWidget()->GetRootView(); |
663 root_view->SetPaintToLayer(true); | 659 root_view->SetPaintToLayer(true); |
664 compositor_->SetRootLayer(root_view->layer()); | 660 compositor_->SetRootLayer(root_view->layer()); |
665 root_view->SetFillsBoundsOpaquely(!transparent_); | 661 root_view->SetFillsBoundsOpaquely(!transparent_); |
666 } | 662 } |
667 } | 663 } |
668 | 664 |
669 delegate_->OnNativeWidgetCreated(); | 665 delegate_->OnNativeWidgetCreated(); |
670 | 666 |
(...skipping 1537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2208 button_pressed = event->type == GDK_BUTTON_PRESS || | 2204 button_pressed = event->type == GDK_BUTTON_PRESS || |
2209 event->type == GDK_2BUTTON_PRESS || | 2205 event->type == GDK_2BUTTON_PRESS || |
2210 event->type == GDK_3BUTTON_PRESS; | 2206 event->type == GDK_3BUTTON_PRESS; |
2211 gdk_event_free(event); | 2207 gdk_event_free(event); |
2212 } | 2208 } |
2213 return button_pressed; | 2209 return button_pressed; |
2214 } | 2210 } |
2215 | 2211 |
2216 } // namespace internal | 2212 } // namespace internal |
2217 } // namespace views | 2213 } // namespace views |
OLD | NEW |