| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/widget_gtk.h" | 5 #include "views/widget/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 | 10 |
| (...skipping 890 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 901 (key.GetFlags() & ~Event::EF_ALT_DOWN) == 0) { | 901 (key.GetFlags() & ~Event::EF_ALT_DOWN) == 0) { |
| 902 // Trigger VKEY_MENU when only this key is pressed and released, and both | 902 // Trigger VKEY_MENU when only this key is pressed and released, and both |
| 903 // press and release events are not handled by others. | 903 // press and release events are not handled by others. |
| 904 Accelerator accelerator(app::VKEY_MENU, false, false, false); | 904 Accelerator accelerator(app::VKEY_MENU, false, false, false); |
| 905 handled = focus_manager_->ProcessAccelerator(accelerator); | 905 handled = focus_manager_->ProcessAccelerator(accelerator); |
| 906 } | 906 } |
| 907 | 907 |
| 908 return handled; | 908 return handled; |
| 909 } | 909 } |
| 910 | 910 |
| 911 //////////////////////////////////////////////////////////////////////////////// | |
| 912 // WidgetGtk, protected: | |
| 913 | |
| 914 // static | 911 // static |
| 915 int WidgetGtk::GetFlagsForEventButton(const GdkEventButton& event) { | 912 int WidgetGtk::GetFlagsForEventButton(const GdkEventButton& event) { |
| 916 int flags = Event::GetFlagsFromGdkState(event.state); | 913 int flags = Event::GetFlagsFromGdkState(event.state); |
| 917 switch (event.button) { | 914 switch (event.button) { |
| 918 case 1: | 915 case 1: |
| 919 flags |= Event::EF_LEFT_BUTTON_DOWN; | 916 flags |= Event::EF_LEFT_BUTTON_DOWN; |
| 920 break; | 917 break; |
| 921 case 2: | 918 case 2: |
| 922 flags |= Event::EF_MIDDLE_BUTTON_DOWN; | 919 flags |= Event::EF_MIDDLE_BUTTON_DOWN; |
| 923 break; | 920 break; |
| 924 case 3: | 921 case 3: |
| 925 flags |= Event::EF_RIGHT_BUTTON_DOWN; | 922 flags |= Event::EF_RIGHT_BUTTON_DOWN; |
| 926 break; | 923 break; |
| 927 default: | 924 default: |
| 928 // We only deal with 1-3. | 925 // We only deal with 1-3. |
| 929 break; | 926 break; |
| 930 } | 927 } |
| 931 if (event.type == GDK_2BUTTON_PRESS) | 928 if (event.type == GDK_2BUTTON_PRESS) |
| 932 flags |= MouseEvent::EF_IS_DOUBLE_CLICK; | 929 flags |= MouseEvent::EF_IS_DOUBLE_CLICK; |
| 933 return flags; | 930 return flags; |
| 934 } | 931 } |
| 935 | 932 |
| 933 //////////////////////////////////////////////////////////////////////////////// |
| 934 // WidgetGtk, protected: |
| 935 |
| 936 void WidgetGtk::OnSizeRequest(GtkWidget* widget, GtkRequisition* requisition) { | 936 void WidgetGtk::OnSizeRequest(GtkWidget* widget, GtkRequisition* requisition) { |
| 937 // Do only return the preferred size for child windows. GtkWindow interprets | 937 // Do only return the preferred size for child windows. GtkWindow interprets |
| 938 // the requisition as a minimum size for top level windows, returning a | 938 // the requisition as a minimum size for top level windows, returning a |
| 939 // preferred size for these would prevents us from setting smaller window | 939 // preferred size for these would prevents us from setting smaller window |
| 940 // sizes. | 940 // sizes. |
| 941 if (type_ == TYPE_CHILD) { | 941 if (type_ == TYPE_CHILD) { |
| 942 gfx::Size size(root_view_->GetPreferredSize()); | 942 gfx::Size size(root_view_->GetPreferredSize()); |
| 943 requisition->width = size.width(); | 943 requisition->width = size.width(); |
| 944 requisition->height = size.height(); | 944 requisition->height = size.height(); |
| 945 } | 945 } |
| (...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1655 GtkWindow* window = GTK_WINDOW(element->data); | 1655 GtkWindow* window = GTK_WINDOW(element->data); |
| 1656 DCHECK(window); | 1656 DCHECK(window); |
| 1657 RootView *root_view = FindRootView(window); | 1657 RootView *root_view = FindRootView(window); |
| 1658 if (root_view) | 1658 if (root_view) |
| 1659 root_view->NotifyLocaleChanged(); | 1659 root_view->NotifyLocaleChanged(); |
| 1660 } | 1660 } |
| 1661 g_list_free(window_list); | 1661 g_list_free(window_list); |
| 1662 } | 1662 } |
| 1663 | 1663 |
| 1664 } // namespace views | 1664 } // namespace views |
| OLD | NEW |