Modified: trunk/Source/WebKit/chromium/ChangeLog (87763 => 87764)
--- trunk/Source/WebKit/chromium/ChangeLog 2011-06-01 00:14:56 UTC (rev 87763)
+++ trunk/Source/WebKit/chromium/ChangeLog 2011-06-01 00:43:32 UTC (rev 87764)
@@ -1,3 +1,14 @@
+2011-05-31 Daniel Erat <[email protected]>
+
+ Reviewed by Tony Chang.
+
+ Make WebScreenInfoFactory return fresh screen dimensions.
+ https://bugs.webkit.org/show_bug.cgi?id=61679
+
+ * public/x11/WebScreenInfoFactory.h:
+ * src/x11/WebScreenInfoFactory.cpp:
+ (WebKit::WebScreenInfoFactory::screenInfo):
+
2011-05-31 Cary Clark <[email protected]>
Reviewed by Eric Seidel.
Modified: trunk/Source/WebKit/chromium/public/x11/WebScreenInfoFactory.h (87763 => 87764)
--- trunk/Source/WebKit/chromium/public/x11/WebScreenInfoFactory.h 2011-06-01 00:14:56 UTC (rev 87763)
+++ trunk/Source/WebKit/chromium/public/x11/WebScreenInfoFactory.h 2011-06-01 00:43:32 UTC (rev 87764)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
+ * Copyright (C) 2011 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
Modified: trunk/Source/WebKit/chromium/src/x11/WebScreenInfoFactory.cpp (87763 => 87764)
--- trunk/Source/WebKit/chromium/src/x11/WebScreenInfoFactory.cpp 2011-06-01 00:14:56 UTC (rev 87763)
+++ trunk/Source/WebKit/chromium/src/x11/WebScreenInfoFactory.cpp 2011-06-01 00:43:32 UTC (rev 87764)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
+ * Copyright (C) 2011 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -37,22 +37,29 @@
namespace WebKit {
+// FIXME: Take an X window and use XRandR to find the dimensions of the monitor
+// that it's on (probably using XRRGetScreenInfo() and XRRConfigSizes() from
+// X11/extensions/Xrandr.h). GDK provides a gdk_screen_get_monitor_geometry()
+// function, but it appears to return stale data after the screen is resized.
WebScreenInfo WebScreenInfoFactory::screenInfo(Display* display, int screenNumber)
{
+ // XDisplayWidth() and XDisplayHeight() return cached values. To ensure that
+ // we return the correct dimensions after the screen is resized, query the
+ // root window's geometry each time.
+ Window root = RootWindow(display, screenNumber);
+ Window rootRet;
+ int x, y;
+ unsigned int width, height, border, depth;
+ XGetGeometry(
+ display, root, &rootRet, &x, &y, &width, &height, &border, &depth);
+
WebScreenInfo results;
- // FIXME: not all screens with use 8bpp.
+ // FIXME: Not all screens use 8bpp.
results.depthPerComponent = 8;
-
- int displayWidth = XDisplayWidth(display, screenNumber);
- int displayHeight = XDisplayHeight(display, screenNumber);
- results.depth = XDisplayPlanes(display, screenNumber);
- results.isMonochrome = results.depth == 1;
-
- results.rect = WebRect(0, 0, displayWidth, displayHeight);
-
- // I don't know of a way to query the "maximize" size of the window (e.g.
- // screen size less sidebars etc) since this is something which only the
- // window manager knows.
+ results.depth = depth;
+ results.isMonochrome = depth == 1;
+ results.rect = WebRect(x, y, width, height);
+ // FIXME: Query the _NET_WORKAREA property from EWMH.
results.availableRect = results.rect;
return results;