| 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 656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 667 gtk_window_set_type_hint(GTK_WINDOW(GetNativeView()), | 667 gtk_window_set_type_hint(GTK_WINDOW(GetNativeView()), |
| 668 GDK_WINDOW_TYPE_HINT_MENU); | 668 GDK_WINDOW_TYPE_HINT_MENU); |
| 669 } | 669 } |
| 670 | 670 |
| 671 if (View::get_use_acceleration_when_possible()) { | 671 if (View::get_use_acceleration_when_possible()) { |
| 672 if (Widget::compositor_factory()) { | 672 if (Widget::compositor_factory()) { |
| 673 compositor_ = (*Widget::compositor_factory())(); | 673 compositor_ = (*Widget::compositor_factory())(); |
| 674 } else { | 674 } else { |
| 675 gint width, height; | 675 gint width, height; |
| 676 gdk_drawable_get_size(window_contents_->window, &width, &height); | 676 gdk_drawable_get_size(window_contents_->window, &width, &height); |
| 677 compositor_ = ui::Compositor::Create( | 677 compositor_ = ui::Compositor::Create(this, |
| 678 GDK_WINDOW_XID(window_contents_->window), | 678 GDK_WINDOW_XID(window_contents_->window), |
| 679 gfx::Size(width, height)); | 679 gfx::Size(width, height)); |
| 680 } | 680 } |
| 681 if (compositor_.get()) | 681 if (compositor_.get()) |
| 682 delegate_->AsWidget()->GetRootView()->SetPaintToLayer(true); | 682 delegate_->AsWidget()->GetRootView()->SetPaintToLayer(true); |
| 683 } | 683 } |
| 684 | 684 |
| 685 delegate_->OnNativeWidgetCreated(); | 685 delegate_->OnNativeWidgetCreated(); |
| 686 | 686 |
| 687 if (opacity_ != 255) | 687 if (opacity_ != 255) |
| (...skipping 1109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1797 } | 1797 } |
| 1798 | 1798 |
| 1799 void NativeWidgetGtk::HandleGtkGrabBroke() { | 1799 void NativeWidgetGtk::HandleGtkGrabBroke() { |
| 1800 ReleaseMouseCapture(); | 1800 ReleaseMouseCapture(); |
| 1801 delegate_->OnMouseCaptureLost(); | 1801 delegate_->OnMouseCaptureLost(); |
| 1802 } | 1802 } |
| 1803 | 1803 |
| 1804 //////////////////////////////////////////////////////////////////////////////// | 1804 //////////////////////////////////////////////////////////////////////////////// |
| 1805 // NativeWidgetGtk, private: | 1805 // NativeWidgetGtk, private: |
| 1806 | 1806 |
| 1807 void NativeWidgetGtk::ScheduleCompositorPaint() { |
| 1808 SchedulePaintInRect(gfx::Rect(gfx::Point(), size_)); |
| 1809 } |
| 1810 |
| 1807 void NativeWidgetGtk::DispatchKeyEventPostIME(const KeyEvent& key) { | 1811 void NativeWidgetGtk::DispatchKeyEventPostIME(const KeyEvent& key) { |
| 1808 // Always reset |should_handle_menu_key_release_| unless we are handling a | 1812 // Always reset |should_handle_menu_key_release_| unless we are handling a |
| 1809 // VKEY_MENU key release event. It ensures that VKEY_MENU accelerator can only | 1813 // VKEY_MENU key release event. It ensures that VKEY_MENU accelerator can only |
| 1810 // be activated when handling a VKEY_MENU key release event which is preceded | 1814 // be activated when handling a VKEY_MENU key release event which is preceded |
| 1811 // by an unhandled VKEY_MENU key press event. See also HandleKeyboardEvent(). | 1815 // by an unhandled VKEY_MENU key press event. See also HandleKeyboardEvent(). |
| 1812 if (key.key_code() != ui::VKEY_MENU || key.type() != ui::ET_KEY_RELEASED) | 1816 if (key.key_code() != ui::VKEY_MENU || key.type() != ui::ET_KEY_RELEASED) |
| 1813 should_handle_menu_key_release_ = false; | 1817 should_handle_menu_key_release_ = false; |
| 1814 | 1818 |
| 1815 // Send the key event to View hierarchy first. | 1819 // Send the key event to View hierarchy first. |
| 1816 bool handled = delegate_->OnKeyEvent(key); | 1820 bool handled = delegate_->OnKeyEvent(key); |
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2249 button_pressed = event->type == GDK_BUTTON_PRESS || | 2253 button_pressed = event->type == GDK_BUTTON_PRESS || |
| 2250 event->type == GDK_2BUTTON_PRESS || | 2254 event->type == GDK_2BUTTON_PRESS || |
| 2251 event->type == GDK_3BUTTON_PRESS; | 2255 event->type == GDK_3BUTTON_PRESS; |
| 2252 gdk_event_free(event); | 2256 gdk_event_free(event); |
| 2253 } | 2257 } |
| 2254 return button_pressed; | 2258 return button_pressed; |
| 2255 } | 2259 } |
| 2256 | 2260 |
| 2257 } // namespace internal | 2261 } // namespace internal |
| 2258 } // namespace views | 2262 } // namespace views |
| OLD | NEW |