Changeset 87764 in webkit


Ignore:
Timestamp:
May 31, 2011 5:43:32 PM (13 years ago)
Author:
commit-queue@webkit.org
Message:

2011-05-31 Daniel Erat <derat@chromium.org>

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):
Location:
trunk/Source/WebKit/chromium
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/chromium/ChangeLog

    r87728 r87764  
     12011-05-31  Daniel Erat  <derat@chromium.org>
     2
     3        Reviewed by Tony Chang.
     4
     5        Make WebScreenInfoFactory return fresh screen dimensions.
     6        https://bugs.webkit.org/show_bug.cgi?id=61679
     7
     8        * public/x11/WebScreenInfoFactory.h:
     9        * src/x11/WebScreenInfoFactory.cpp:
     10        (WebKit::WebScreenInfoFactory::screenInfo):
     11
    1122011-05-31  Cary Clark  <caryclark@google.com>
    213
  • trunk/Source/WebKit/chromium/public/x11/WebScreenInfoFactory.h

    r50712 r87764  
    11/*
    2  * Copyright (C) 2009 Google Inc. All rights reserved.
     2 * Copyright (C) 2011 Google Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
  • trunk/Source/WebKit/chromium/src/x11/WebScreenInfoFactory.cpp

    r50750 r87764  
    11/*
    2  * Copyright (C) 2009 Google Inc. All rights reserved.
     2 * Copyright (C) 2011 Google Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    3838namespace WebKit {
    3939
     40// FIXME: Take an X window and use XRandR to find the dimensions of the monitor
     41// that it's on (probably using XRRGetScreenInfo() and XRRConfigSizes() from
     42// X11/extensions/Xrandr.h). GDK provides a gdk_screen_get_monitor_geometry()
     43// function, but it appears to return stale data after the screen is resized.
    4044WebScreenInfo WebScreenInfoFactory::screenInfo(Display* display, int screenNumber)
    4145{
     46    // XDisplayWidth() and XDisplayHeight() return cached values. To ensure that
     47    // we return the correct dimensions after the screen is resized, query the
     48    // root window's geometry each time.
     49    Window root = RootWindow(display, screenNumber);
     50    Window rootRet;
     51    int x, y;
     52    unsigned int width, height, border, depth;
     53    XGetGeometry(
     54        display, root, &rootRet, &x, &y, &width, &height, &border, &depth);
     55
    4256    WebScreenInfo results;
    43     // FIXME: not all screens with use 8bpp.
     57    // FIXME: Not all screens use 8bpp.
    4458    results.depthPerComponent = 8;
    45 
    46     int displayWidth = XDisplayWidth(display, screenNumber);
    47     int displayHeight = XDisplayHeight(display, screenNumber);
    48     results.depth = XDisplayPlanes(display, screenNumber);
    49     results.isMonochrome = results.depth == 1;
    50 
    51     results.rect = WebRect(0, 0, displayWidth, displayHeight);
    52 
    53     // I don't know of a way to query the "maximize" size of the window (e.g.
    54     // screen size less sidebars etc) since this is something which only the
    55     // window manager knows.
     59    results.depth = depth;
     60    results.isMonochrome = depth == 1;
     61    results.rect = WebRect(x, y, width, height);
     62    // FIXME: Query the _NET_WORKAREA property from EWMH.
    5663    results.availableRect = results.rect;
    5764
Note: See TracChangeset for help on using the changeset viewer.