Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright 2009, Google Inc. | 2 * Copyright 2009, Google Inc. |
| 3 * All rights reserved. | 3 * All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 466 obj->in_plugin()); | 466 obj->in_plugin()); |
| 467 obj->client()->AddEventToQueue(event); | 467 obj->client()->AddEventToQueue(event); |
| 468 if (event.type() == Event::TYPE_MOUSEUP && obj->in_plugin() && | 468 if (event.type() == Event::TYPE_MOUSEUP && obj->in_plugin() && |
| 469 obj->got_double_click_[button_event->button - 1]) { | 469 obj->got_double_click_[button_event->button - 1]) { |
| 470 obj->got_double_click_[button_event->button - 1] = false; | 470 obj->got_double_click_[button_event->button - 1] = false; |
| 471 event.set_type(Event::TYPE_DBLCLICK); | 471 event.set_type(Event::TYPE_DBLCLICK); |
| 472 obj->client()->AddEventToQueue(event); | 472 obj->client()->AddEventToQueue(event); |
| 473 } | 473 } |
| 474 if (event.in_plugin() && event.type() == Event::TYPE_MOUSEDOWN && | 474 if (event.in_plugin() && event.type() == Event::TYPE_MOUSEDOWN && |
| 475 obj->HitFullscreenClickRegion(event.x(), event.y())) { | 475 obj->HitFullscreenClickRegion(event.x(), event.y())) { |
| 476 obj->RequestFullscreenDisplay(); | 476 obj->RequestFullscreenDisplay(button_event->time); |
| 477 } | 477 } |
| 478 return TRUE; | 478 return TRUE; |
| 479 } | 479 } |
| 480 | 480 |
| 481 static gboolean GtkHandleKey(GtkWidget *widget, | 481 static gboolean GtkHandleKey(GtkWidget *widget, |
| 482 GdkEventKey *key_event, | 482 GdkEventKey *key_event, |
| 483 PluginObject *obj) { | 483 PluginObject *obj) { |
| 484 Event::Type type; | 484 Event::Type type; |
| 485 switch (key_event->type) { | 485 switch (key_event->type) { |
| 486 case GDK_KEY_PRESS: | 486 case GDK_KEY_PRESS: |
| (...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 903 CancelFullscreenDisplay(); | 903 CancelFullscreenDisplay(); |
| 904 return TRUE; | 904 return TRUE; |
| 905 } | 905 } |
| 906 | 906 |
| 907 bool PluginObject::GetDisplayMode(int id, o3d::DisplayMode *mode) { | 907 bool PluginObject::GetDisplayMode(int id, o3d::DisplayMode *mode) { |
| 908 return renderer()->GetDisplayMode(id, mode); | 908 return renderer()->GetDisplayMode(id, mode); |
| 909 } | 909 } |
| 910 | 910 |
| 911 // TODO: Where should this really live? It's platform-specific, but in | 911 // TODO: Where should this really live? It's platform-specific, but in |
| 912 // PluginObject, which mainly lives in cross/o3d_glue.h+cc. | 912 // PluginObject, which mainly lives in cross/o3d_glue.h+cc. |
| 913 bool PluginObject::RequestFullscreenDisplay() { | 913 bool PluginObject::RequestFullscreenDisplay(guint32 timestamp) { |
| 914 if (fullscreen_ || fullscreen_pending_) { | 914 if (fullscreen_ || fullscreen_pending_) { |
| 915 return false; | 915 return false; |
| 916 } | 916 } |
| 917 if (!g_xembed_support) { | 917 if (!g_xembed_support) { |
| 918 // I tested every Linux browser I could that worked with our plugin and not | 918 // I tested every Linux browser I could that worked with our plugin and not |
| 919 // a single one lacked XEmbed/Gtk2 support, so I don't think that case is | 919 // a single one lacked XEmbed/Gtk2 support, so I don't think that case is |
| 920 // worth implementing. | 920 // worth implementing. |
| 921 DLOG(ERROR) << "Fullscreen not supported without XEmbed/Gtk2; please use a " | 921 DLOG(ERROR) << "Fullscreen not supported without XEmbed/Gtk2; please use a " |
| 922 "modern web browser"; | 922 "modern web browser"; |
| 923 return false; | 923 return false; |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 946 gtk_window_set_default_size(window, width, height); | 946 gtk_window_set_default_size(window, width, height); |
| 947 // This is probably superfluous since we have already set an appropriate | 947 // This is probably superfluous since we have already set an appropriate |
| 948 // size, but let's do it anyway. It could still be relevant for some window | 948 // size, but let's do it anyway. It could still be relevant for some window |
| 949 // managers. | 949 // managers. |
| 950 gtk_window_fullscreen(window); | 950 gtk_window_fullscreen(window); |
| 951 g_signal_connect(window, "configure-event", | 951 g_signal_connect(window, "configure-event", |
| 952 G_CALLBACK(GtkConfigureEventCallback), this); | 952 G_CALLBACK(GtkConfigureEventCallback), this); |
| 953 g_signal_connect(window, "delete-event", | 953 g_signal_connect(window, "delete-event", |
| 954 G_CALLBACK(GtkDeleteEventCallback), this); | 954 G_CALLBACK(GtkDeleteEventCallback), this); |
| 955 gtk_fullscreen_container_ = widget; | 955 gtk_fullscreen_container_ = widget; |
| 956 gtk_widget_show(widget); | 956 // The timestamp here is optional. Presumably it is used by the window manager |
| 957 // for obscure policy decisions (e.g., UI races). | |
|
piman
2010/02/22 22:41:53
FYI the timestamp is most likely used to properly
| |
| 958 gtk_window_present_with_time(window, timestamp); | |
| 959 // Explicitly set focus, otherwise we may not get it depending on the window | |
| 960 // manager's policy for present. | |
| 961 gdk_window_focus(widget->window, timestamp); | |
| 957 // We defer switching to the new window until it gets displayed and assigned | 962 // We defer switching to the new window until it gets displayed and assigned |
| 958 // it's final dimensions in the configure-event. | 963 // it's final dimensions in the configure-event. |
| 959 fullscreen_pending_ = true; | 964 fullscreen_pending_ = true; |
| 960 return true; | 965 return true; |
| 961 } | 966 } |
| 962 | 967 |
| 963 void PluginObject::CancelFullscreenDisplay() { | 968 void PluginObject::CancelFullscreenDisplay() { |
| 964 if (!fullscreen_) { | 969 if (!fullscreen_) { |
| 965 return; | 970 return; |
| 966 } | 971 } |
| 967 o3d::DisplayWindowLinux default_display; | 972 o3d::DisplayWindowLinux default_display; |
| 968 default_display.set_display(display_); | 973 default_display.set_display(display_); |
| 969 default_display.set_window(drawable_); | 974 default_display.set_window(drawable_); |
| 970 if (!renderer()->CancelFullscreen(default_display, | 975 if (!renderer()->CancelFullscreen(default_display, |
| 971 prev_width_, | 976 prev_width_, |
| 972 prev_height_)) { | 977 prev_height_)) { |
| 973 return; | 978 return; |
| 974 } | 979 } |
| 975 renderer()->Resize(prev_width_, prev_height_); | 980 renderer()->Resize(prev_width_, prev_height_); |
| 976 client()->SendResizeEvent(renderer()->width(), renderer()->height(), | 981 client()->SendResizeEvent(renderer()->width(), renderer()->height(), |
| 977 false); | 982 false); |
| 978 SetGtkEventSource(gtk_container_); | 983 SetGtkEventSource(gtk_container_); |
| 979 gtk_widget_destroy(gtk_fullscreen_container_); | 984 gtk_widget_destroy(gtk_fullscreen_container_); |
| 980 gtk_fullscreen_container_ = NULL; | 985 gtk_fullscreen_container_ = NULL; |
| 981 fullscreen_window_ = 0; | 986 fullscreen_window_ = 0; |
| 982 fullscreen_ = false; | 987 fullscreen_ = false; |
| 983 } | 988 } |
| 984 } // namespace _o3d | 989 } // namespace _o3d |
| 985 } // namespace glue | 990 } // namespace glue |
| OLD | NEW |