OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 30 matching lines...) Expand all Loading... |
41 // X11/extensions/Xrandr.h). GDK provides a gdk_screen_get_monitor_geometry() | 41 // X11/extensions/Xrandr.h). GDK provides a gdk_screen_get_monitor_geometry() |
42 // function, but it appears to return stale data after the screen is resized. | 42 // function, but it appears to return stale data after the screen is resized. |
43 WebScreenInfo WebScreenInfoFactory::screenInfo(Display* display, int screenNumbe
r) | 43 WebScreenInfo WebScreenInfoFactory::screenInfo(Display* display, int screenNumbe
r) |
44 { | 44 { |
45 // XDisplayWidth() and XDisplayHeight() return cached values. To ensure that | 45 // XDisplayWidth() and XDisplayHeight() return cached values. To ensure that |
46 // we return the correct dimensions after the screen is resized, query the | 46 // we return the correct dimensions after the screen is resized, query the |
47 // root window's geometry each time. | 47 // root window's geometry each time. |
48 Window root = RootWindow(display, screenNumber); | 48 Window root = RootWindow(display, screenNumber); |
49 Window rootRet; | 49 Window rootRet; |
50 int x, y; | 50 int x, y; |
51 unsigned int width, height, border, depth; | 51 unsigned width, height, border, depth; |
52 XGetGeometry( | 52 XGetGeometry( |
53 display, root, &rootRet, &x, &y, &width, &height, &border, &depth); | 53 display, root, &rootRet, &x, &y, &width, &height, &border, &depth); |
54 | 54 |
55 WebScreenInfo results; | 55 WebScreenInfo results; |
56 | 56 |
57 // FIXME: Initialize the device scale factor. | 57 // FIXME: Initialize the device scale factor. |
58 // FIXME: Not all screens use 8bpp. | 58 // FIXME: Not all screens use 8bpp. |
59 results.depthPerComponent = 8; | 59 results.depthPerComponent = 8; |
60 results.depth = depth; | 60 results.depth = depth; |
61 results.isMonochrome = depth == 1; | 61 results.isMonochrome = depth == 1; |
62 results.rect = WebRect(x, y, width, height); | 62 results.rect = WebRect(x, y, width, height); |
63 // FIXME: Query the _NET_WORKAREA property from EWMH. | 63 // FIXME: Query the _NET_WORKAREA property from EWMH. |
64 results.availableRect = results.rect; | 64 results.availableRect = results.rect; |
65 | 65 |
66 return results; | 66 return results; |
67 } | 67 } |
68 | 68 |
69 } // namespace blink | 69 } // namespace blink |
OLD | NEW |