From 542cae9df7c420e33d05fb33d579f253ae6d1ea4 Mon Sep 17 00:00:00 2001 From: Karl Tomlinson Date: Fri, 4 Jan 2013 12:37:08 +1300 Subject: [PATCH] b=814200 don't redirect embedder socket window resize requests to Xt client r=stransky --HG-- extra : rebase_source : 936d2fb8dbed72c064b158a106dde582b091454b --- dom/plugins/base/nsPluginNativeWindowGtk2.cpp | 3 +- widget/gtkxtbin/gtk2xtbin.c | 46 ++----------------- widget/gtkxtbin/gtk2xtbin.h | 4 -- 3 files changed, 4 insertions(+), 49 deletions(-) diff --git a/dom/plugins/base/nsPluginNativeWindowGtk2.cpp b/dom/plugins/base/nsPluginNativeWindowGtk2.cpp index e53a11a1388..38e13eecf5e 100644 --- a/dom/plugins/base/nsPluginNativeWindowGtk2.cpp +++ b/dom/plugins/base/nsPluginNativeWindowGtk2.cpp @@ -134,15 +134,14 @@ nsresult nsPluginNativeWindowGtk2::CallSetWindow(nsRefPtr } // 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 diff --git a/widget/gtkxtbin/gtk2xtbin.c b/widget/gtkxtbin/gtk2xtbin.c index 24ff0b61fc5..a25a32708ae 100644 --- a/widget/gtkxtbin/gtk2xtbin.c +++ b/widget/gtkxtbin/gtk2xtbin.c @@ -237,17 +237,13 @@ gtk_xtbin_realize (GtkWidget *widget) 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(); @@ -314,42 +310,6 @@ gtk_xtbin_new (GdkWindow *parent_window, String * f) 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) { @@ -582,8 +542,8 @@ xt_client_create ( XtClient* xtclient , /* 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); diff --git a/widget/gtkxtbin/gtk2xtbin.h b/widget/gtkxtbin/gtk2xtbin.h index f7e3ce09719..ec75d98e85a 100644 --- a/widget/gtkxtbin/gtk2xtbin.h +++ b/widget/gtkxtbin/gtk2xtbin.h @@ -58,7 +58,6 @@ struct _GtkXtBin Display *xtdisplay; /* Xt Toolkit Display */ Window xtwindow; /* Xt Toolkit XWindow */ - gint width, height; XtClient xtclient; /* Xt Client for XEmbed */ }; @@ -69,9 +68,6 @@ struct _GtkXtBinClass 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 */