b=814200 don't redirect embedder socket window resize requests to Xt client r=stransky a=akeybl
authorKarl Tomlinson <karlt+@karlt.net>
Fri, 04 Jan 2013 12:37:08 +1300
changeset 122559 31a324c5347c
parent 122558 0958aea4dfd2
child 122560 a35a73b033a8
push id2011
push userktomlinson@mozilla.com
push date2013-01-09 01:46 +0000
treeherdermozilla-beta@31a324c5347c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersstransky, akeybl
bugs814200
milestone19.0
b=814200 don't redirect embedder socket window resize requests to Xt client r=stransky a=akeybl
dom/plugins/base/nsPluginNativeWindowGtk2.cpp
widget/gtkxtbin/gtk2xtbin.c
widget/gtkxtbin/gtk2xtbin.h
--- a/dom/plugins/base/nsPluginNativeWindowGtk2.cpp
+++ b/dom/plugins/base/nsPluginNativeWindowGtk2.cpp
@@ -129,25 +129,24 @@ nsresult nsPluginNativeWindowGtk2::CallS
         }
       }
 
       if (!mSocketWidget) {
         return NS_ERROR_FAILURE;
       }
 
       // Make sure to resize and re-place the window if required.
+      SetAllocation();
       // Need to reset "window" each time as nsObjectFrame::DidReflow sets it
       // to the ancestor window.
       if (GTK_IS_XTBIN(mSocketWidget)) {
-        gtk_xtbin_resize(mSocketWidget, width, height);
         // Point the NPWindow structures window to the actual X window
         SetWindow(GTK_XTBIN(mSocketWidget)->xtwindow);
       }
       else { // XEmbed or OOP&Xt
-        SetAllocation();
         SetWindow(gtk_socket_get_id(GTK_SOCKET(mSocketWidget)));
       }
 #ifdef DEBUG
       printf("nsPluginNativeWindowGtk2: call SetWindow with xid=%p\n", (void *)window);
 #endif
     } // NPWindowTypeWindow
     aPluginInstance->SetWindow(this);
   }
--- a/widget/gtkxtbin/gtk2xtbin.c
+++ b/widget/gtkxtbin/gtk2xtbin.c
@@ -232,27 +232,23 @@ gtk_xtbin_realize (GtkWidget *widget)
   allocation.width = w;
   allocation.height = h;
   gtk_widget_size_allocate (widget, &allocation);
 
 #ifdef DEBUG_XTBIN
   printf("initial allocation %d %d %d %d\n", x, y, w, h);
 #endif
 
-  xtbin->width = widget->allocation.width;
-  xtbin->height = widget->allocation.height;
-
   /* use GtkSocket's realize */
   (*GTK_WIDGET_CLASS(parent_class)->realize)(widget);
 
   /* create the Xt client widget */
   xt_client_create(&(xtbin->xtclient), 
        gtk_socket_get_id(GTK_SOCKET(xtbin)), 
-       xtbin->height, 
-       xtbin->width);
+       h, w);
   xtbin->xtwindow = XtWindow(xtbin->xtclient.child_widget);
 
   gdk_flush();
 
   /* now that we have created the xt client, add it to the socket. */
   gtk_socket_add_id(GTK_SOCKET(widget), xtbin->xtwindow);
 }
 
@@ -309,52 +305,16 @@ gtk_xtbin_new (GdkWindow *parent_window,
    * avoiding flicker.
    */
   gtk_widget_realize(GTK_WIDGET(xtbin));
   gdk_window_set_back_pixmap(GTK_WIDGET(xtbin)->window, NULL, FALSE);
 
   return GTK_WIDGET (xtbin);
 }
 
-void
-gtk_xtbin_resize (GtkWidget *widget,
-                  gint       width,
-                  gint       height)
-{
-  Arg args[2];
-  GtkXtBin *xtbin = GTK_XTBIN (widget);
-  GtkAllocation allocation;
-
-#ifdef DEBUG_XTBIN
-  printf("gtk_xtbin_resize %p %d %d\n", (void *)widget, width, height);
-#endif
-
-  xtbin->height = height;
-  xtbin->width  = width;
-
-  /* Avoid BadValue errors in XtSetValues */
-  if (height <= 0 || width <=0) {
-    height = 1;
-    width = 1;
-  }
-  XtSetArg(args[0], XtNheight, height);
-  XtSetArg(args[1], XtNwidth,  width);
-  if (xtbin->xtclient.top_widget)
-    XtSetValues(xtbin->xtclient.top_widget, args, 2);
-
-  /* we need to send a size allocate so the socket knows about the
-     size changes */
-  allocation.x = 0;
-  allocation.y = 0;
-  allocation.width = xtbin->width;
-  allocation.height = xtbin->height;
-
-  gtk_widget_size_allocate(widget, &allocation);
-}
-
 static void
 gtk_xtbin_unrealize (GtkWidget *object)
 {
   GtkXtBin *xtbin;
   GtkWidget *widget;
 
 #ifdef DEBUG_XTBIN
   printf("gtk_xtbin_unrealize()\n");
@@ -575,18 +535,18 @@ xt_client_create ( XtClient* xtclient ,
 #else
   _XtRegisterWindow( embedderid,
                      top_widget);
 #endif
   XtRealizeWidget(child_widget);
 
   /* listen to all Xt events */
   XSelectInput(xtclient->xtdisplay, 
-               XtWindow(top_widget), 
-               0x0FFFFF);
+               embedderid, 
+               XtBuildEventMask(top_widget));
   xt_client_set_info (child_widget, 0);
 
   XtManageChild(child_widget);
   xtclient->child_widget = child_widget;
 
   /* set the event handler */
   XtAddEventHandler(child_widget,
                     0x0FFFFF & ~ResizeRedirectMask,
--- a/widget/gtkxtbin/gtk2xtbin.h
+++ b/widget/gtkxtbin/gtk2xtbin.h
@@ -53,30 +53,26 @@ struct _XtClient {
 
 struct _GtkXtBin
 {
   GtkSocket      gsocket;
   GdkWindow     *parent_window;
   Display       *xtdisplay;        /* Xt Toolkit Display */
 
   Window         xtwindow;         /* Xt Toolkit XWindow */
-  gint           width, height;
   XtClient	 xtclient;         /* Xt Client for XEmbed */
 };
   
 struct _GtkXtBinClass
 {
   GtkSocketClass parent_class;
 };
 
 GTKXTBIN_API(GType)       gtk_xtbin_get_type (void);
 GTKXTBIN_API(GtkWidget *) gtk_xtbin_new (GdkWindow *parent_window, String *f);
-GTKXTBIN_API(void)       gtk_xtbin_resize (GtkWidget *widget,
-                                           gint       width,
-                                           gint       height);
 
 typedef struct _XtTMRec {
     XtTranslations  translations;       /* private to Translation Manager    */
     XtBoundActions  proc_table;         /* procedure bindings for actions    */
     struct _XtStateRec *current_state;  /* Translation Manager state ptr     */
     unsigned long   lastEventTime;
 } XtTMRec, *XtTM;