From f6bfd75b703aa199d2ef7e956d5ec7422a507d85 Mon Sep 17 00:00:00 2001 From: Automerge Date: Thu, 10 May 2012 09:10:01 +0000 Subject: [PATCH] [merge from 6.7] Send VView size instead of window size (#7931) svn changeset:23703/svn branch:6.8 --- .../vaadin/terminal/gwt/client/ui/VView.java | 33 ++++++++++++------- 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/src/com/vaadin/terminal/gwt/client/ui/VView.java b/src/com/vaadin/terminal/gwt/client/ui/VView.java index c03652f259..8f8a6ab4b3 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VView.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VView.java @@ -61,11 +61,12 @@ public class VView extends SimplePanel implements Container, ResizeHandler, private ShortcutActionHandler actionHandler; - /** stored width for IE resize optimization */ - private int width; + /** stored size for IE resize optimization */ + private int windowWidth; + private int windowHeight; - /** stored height for IE resize optimization */ - private int height; + private int viewWidth; + private int viewHeight; private ApplicationConnection connection; @@ -134,15 +135,15 @@ public class VView extends SimplePanel implements Container, ResizeHandler, */ protected void windowSizeMaybeChanged(int newWidth, int newHeight) { boolean changed = false; - if (width != newWidth) { - width = newWidth; + if (windowWidth != newWidth) { + windowWidth = newWidth; changed = true; - VConsole.log("New window width: " + width); + VConsole.log("New window width: " + windowWidth); } - if (height != newHeight) { - height = newHeight; + if (windowHeight != newHeight) { + windowHeight = newHeight; changed = true; - VConsole.log("New window height: " + height); + VConsole.log("New window height: " + windowHeight); } if (changed) { VConsole.log("Running layout functions due to window resize"); @@ -492,8 +493,16 @@ public class VView extends SimplePanel implements Container, ResizeHandler, * Send new dimensions to the server. */ private void sendClientResized() { - connection.updateVariable(id, "height", height, false); - connection.updateVariable(id, "width", width, immediate); + int newViewHeight = getElement().getClientHeight(); + int newViewWidth = getElement().getClientWidth(); + + // Send the view dimensions if they have changed + if (newViewHeight != viewHeight || newViewWidth != viewWidth) { + viewHeight = newViewHeight; + viewWidth = newViewWidth; + connection.updateVariable(id, "height", newViewHeight, false); + connection.updateVariable(id, "width", newViewWidth, immediate); + } } public native static void goTo(String url) -- 2.39.5