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 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
740 } | 740 } |
741 if (obj->gtk_fullscreen_container_) { | 741 if (obj->gtk_fullscreen_container_) { |
742 gtk_widget_destroy(obj->gtk_fullscreen_container_); | 742 gtk_widget_destroy(obj->gtk_fullscreen_container_); |
743 gtk_widget_unref(obj->gtk_fullscreen_container_); | 743 gtk_widget_unref(obj->gtk_fullscreen_container_); |
744 obj->gtk_container_ = NULL; | 744 obj->gtk_container_ = NULL; |
745 } | 745 } |
746 obj->gtk_event_source_ = NULL; | 746 obj->gtk_event_source_ = NULL; |
747 obj->event_handler_id_ = 0; | 747 obj->event_handler_id_ = 0; |
748 obj->window_ = 0; | 748 obj->window_ = 0; |
749 obj->drawable_ = 0; | 749 obj->drawable_ = 0; |
750 obj->display_ = NULL; | |
751 | 750 |
752 obj->TearDown(); | 751 obj->TearDown(); |
753 NPN_ReleaseObject(obj); | 752 NPN_ReleaseObject(obj); |
754 instance->pdata = NULL; | 753 instance->pdata = NULL; |
755 } | 754 } |
756 | 755 |
757 return NPERR_NO_ERROR; | 756 return NPERR_NO_ERROR; |
758 } | 757 } |
759 | 758 |
760 NPError NPP_SetWindow(NPP instance, NPWindow *window) { | 759 NPError NPP_SetWindow(NPP instance, NPWindow *window) { |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
800 XtAppAddTimeOut(obj->xt_app_context_, 10, LinuxTimer, obj); | 799 XtAppAddTimeOut(obj->xt_app_context_, 10, LinuxTimer, obj); |
801 } | 800 } |
802 | 801 |
803 // Create and assign the graphics context. | 802 // Create and assign the graphics context. |
804 o3d::DisplayWindowLinux default_display; | 803 o3d::DisplayWindowLinux default_display; |
805 default_display.set_display(display); | 804 default_display.set_display(display); |
806 default_display.set_window(drawable); | 805 default_display.set_window(drawable); |
807 | 806 |
808 obj->CreateRenderer(default_display); | 807 obj->CreateRenderer(default_display); |
809 obj->client()->Init(); | 808 obj->client()->Init(); |
810 obj->display_ = display; | 809 obj->SetDisplay(display); |
811 obj->window_ = xwindow; | 810 obj->window_ = xwindow; |
812 obj->drawable_ = drawable; | 811 obj->drawable_ = drawable; |
813 } | 812 } |
814 obj->Resize(window->width, window->height); | 813 obj->Resize(window->width, window->height); |
815 | 814 |
816 return NPERR_NO_ERROR; | 815 return NPERR_NO_ERROR; |
817 } | 816 } |
818 | 817 |
819 // Called when the browser has finished attempting to stream data to | 818 // Called when the browser has finished attempting to stream data to |
820 // a file as requested. If fname == NULL the attempt was not successful. | 819 // a file as requested. If fname == NULL the attempt was not successful. |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
856 G_CALLBACK(GtkEventCallback), this); | 855 G_CALLBACK(GtkEventCallback), this); |
857 } | 856 } |
858 } | 857 } |
859 | 858 |
860 gboolean PluginObject::OnGtkConfigure(GtkWidget *widget, | 859 gboolean PluginObject::OnGtkConfigure(GtkWidget *widget, |
861 GdkEventConfigure *configure_event) { | 860 GdkEventConfigure *configure_event) { |
862 DLOG_ASSERT(widget == gtk_fullscreen_container_); | 861 DLOG_ASSERT(widget == gtk_fullscreen_container_); |
863 if (fullscreen_pending_) { | 862 if (fullscreen_pending_) { |
864 // Our fullscreen window has been placed and sized. Switch to it. | 863 // Our fullscreen window has been placed and sized. Switch to it. |
865 fullscreen_pending_ = false; | 864 fullscreen_pending_ = false; |
866 Window fullscreen_window = | 865 fullscreen_window_ = GDK_WINDOW_XID(gtk_fullscreen_container_->window); |
867 GDK_WINDOW_XID(gtk_fullscreen_container_->window); | |
868 DisplayWindowLinux display; | 866 DisplayWindowLinux display; |
869 display.set_display(display_); | 867 display.set_display(display_); |
870 display.set_window(fullscreen_window); | 868 display.set_window(fullscreen_window_); |
871 prev_width_ = renderer()->width(); | 869 prev_width_ = renderer()->width(); |
872 prev_height_ = renderer()->height(); | 870 prev_height_ = renderer()->height(); |
873 if (!renderer()->GoFullscreen(display, fullscreen_region_mode_id_)) { | 871 if (!renderer()->GoFullscreen(display, fullscreen_region_mode_id_)) { |
874 gtk_widget_destroy(gtk_fullscreen_container_); | 872 gtk_widget_destroy(gtk_fullscreen_container_); |
875 gtk_fullscreen_container_ = NULL; | 873 gtk_fullscreen_container_ = NULL; |
| 874 fullscreen_window_ = 0; |
876 // The return value is for whether we handled the event, not whether it | 875 // The return value is for whether we handled the event, not whether it |
877 // was successful, so return TRUE event for error. | 876 // was successful, so return TRUE event for error. |
878 return TRUE; | 877 return TRUE; |
879 } | 878 } |
880 SetGtkEventSource(gtk_fullscreen_container_); | 879 SetGtkEventSource(gtk_fullscreen_container_); |
881 } | 880 } |
882 renderer()->Resize(configure_event->width, configure_event->height); | 881 renderer()->Resize(configure_event->width, configure_event->height); |
883 client()->SendResizeEvent(renderer()->width(), renderer()->height(), | 882 client()->SendResizeEvent(renderer()->width(), renderer()->height(), |
884 true); | 883 true); |
885 fullscreen_ = true; | 884 fullscreen_ = true; |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
957 prev_height_)) { | 956 prev_height_)) { |
958 return; | 957 return; |
959 } | 958 } |
960 renderer()->Resize(prev_width_, prev_height_); | 959 renderer()->Resize(prev_width_, prev_height_); |
961 client()->SendResizeEvent(renderer()->width(), renderer()->height(), | 960 client()->SendResizeEvent(renderer()->width(), renderer()->height(), |
962 false); | 961 false); |
963 SetGtkEventSource(gtk_container_); | 962 SetGtkEventSource(gtk_container_); |
964 gtk_widget_destroy(gtk_fullscreen_container_); | 963 gtk_widget_destroy(gtk_fullscreen_container_); |
965 gtk_widget_unref(gtk_fullscreen_container_); | 964 gtk_widget_unref(gtk_fullscreen_container_); |
966 gtk_fullscreen_container_ = NULL; | 965 gtk_fullscreen_container_ = NULL; |
| 966 fullscreen_window_ = 0; |
967 fullscreen_ = false; | 967 fullscreen_ = false; |
968 } | 968 } |
969 } // namespace _o3d | 969 } // namespace _o3d |
970 } // namespace glue | 970 } // namespace glue |
OLD | NEW |