13d34f66292ad4d3950d94026d08c3659880d30e2sergeyu@chromium.org/* 23d34f66292ad4d3950d94026d08c3659880d30e2sergeyu@chromium.org * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. 33d34f66292ad4d3950d94026d08c3659880d30e2sergeyu@chromium.org * 43d34f66292ad4d3950d94026d08c3659880d30e2sergeyu@chromium.org * Use of this source code is governed by a BSD-style license 53d34f66292ad4d3950d94026d08c3659880d30e2sergeyu@chromium.org * that can be found in the LICENSE file in the root of the source 63d34f66292ad4d3950d94026d08c3659880d30e2sergeyu@chromium.org * tree. An additional intellectual property rights grant can be found 73d34f66292ad4d3950d94026d08c3659880d30e2sergeyu@chromium.org * in the file PATENTS. All contributing project authors may 83d34f66292ad4d3950d94026d08c3659880d30e2sergeyu@chromium.org * be found in the AUTHORS file in the root of the source tree. 93d34f66292ad4d3950d94026d08c3659880d30e2sergeyu@chromium.org */ 103d34f66292ad4d3950d94026d08c3659880d30e2sergeyu@chromium.org 113d34f66292ad4d3950d94026d08c3659880d30e2sergeyu@chromium.org#ifndef WEBRTC_MODULES_DESKTOP_CAPTURE_MAC_DESKTOP_CONFIGURATION_H_ 123d34f66292ad4d3950d94026d08c3659880d30e2sergeyu@chromium.org#define WEBRTC_MODULES_DESKTOP_CAPTURE_MAC_DESKTOP_CONFIGURATION_H_ 133d34f66292ad4d3950d94026d08c3659880d30e2sergeyu@chromium.org 143d34f66292ad4d3950d94026d08c3659880d30e2sergeyu@chromium.org#include <ApplicationServices/ApplicationServices.h> 153d34f66292ad4d3950d94026d08c3659880d30e2sergeyu@chromium.org#include <Carbon/Carbon.h> 163d34f66292ad4d3950d94026d08c3659880d30e2sergeyu@chromium.org#include <vector> 173d34f66292ad4d3950d94026d08c3659880d30e2sergeyu@chromium.org 183d34f66292ad4d3950d94026d08c3659880d30e2sergeyu@chromium.org#include "webrtc/typedefs.h" 193d34f66292ad4d3950d94026d08c3659880d30e2sergeyu@chromium.org#include "webrtc/modules/desktop_capture/desktop_geometry.h" 203d34f66292ad4d3950d94026d08c3659880d30e2sergeyu@chromium.org 213d34f66292ad4d3950d94026d08c3659880d30e2sergeyu@chromium.orgnamespace webrtc { 223d34f66292ad4d3950d94026d08c3659880d30e2sergeyu@chromium.org 233d34f66292ad4d3950d94026d08c3659880d30e2sergeyu@chromium.org// Describes the configuration of a specific display. 243d34f66292ad4d3950d94026d08c3659880d30e2sergeyu@chromium.orgstruct MacDisplayConfiguration { 253d34f66292ad4d3950d94026d08c3659880d30e2sergeyu@chromium.org MacDisplayConfiguration(); 263d34f66292ad4d3950d94026d08c3659880d30e2sergeyu@chromium.org 273d34f66292ad4d3950d94026d08c3659880d30e2sergeyu@chromium.org // Cocoa identifier for this display. 283d34f66292ad4d3950d94026d08c3659880d30e2sergeyu@chromium.org CGDirectDisplayID id; 293d34f66292ad4d3950d94026d08c3659880d30e2sergeyu@chromium.org 303d34f66292ad4d3950d94026d08c3659880d30e2sergeyu@chromium.org // Bounds of this display in Density-Independent Pixels (DIPs). 313d34f66292ad4d3950d94026d08c3659880d30e2sergeyu@chromium.org DesktopRect bounds; 323d34f66292ad4d3950d94026d08c3659880d30e2sergeyu@chromium.org 333d34f66292ad4d3950d94026d08c3659880d30e2sergeyu@chromium.org // Bounds of this display in physical pixels. 343d34f66292ad4d3950d94026d08c3659880d30e2sergeyu@chromium.org DesktopRect pixel_bounds; 353d34f66292ad4d3950d94026d08c3659880d30e2sergeyu@chromium.org 363d34f66292ad4d3950d94026d08c3659880d30e2sergeyu@chromium.org // Scale factor from DIPs to physical pixels. 373d34f66292ad4d3950d94026d08c3659880d30e2sergeyu@chromium.org float dip_to_pixel_scale; 383d34f66292ad4d3950d94026d08c3659880d30e2sergeyu@chromium.org}; 393d34f66292ad4d3950d94026d08c3659880d30e2sergeyu@chromium.org 403d34f66292ad4d3950d94026d08c3659880d30e2sergeyu@chromium.orgtypedef std::vector<MacDisplayConfiguration> MacDisplayConfigurations; 413d34f66292ad4d3950d94026d08c3659880d30e2sergeyu@chromium.org 423d34f66292ad4d3950d94026d08c3659880d30e2sergeyu@chromium.org// Describes the configuration of the whole desktop. 433d34f66292ad4d3950d94026d08c3659880d30e2sergeyu@chromium.orgstruct MacDesktopConfiguration { 443d34f66292ad4d3950d94026d08c3659880d30e2sergeyu@chromium.org // Used to request bottom-up or top-down coordinates. 453d34f66292ad4d3950d94026d08c3659880d30e2sergeyu@chromium.org enum Origin { BottomLeftOrigin, TopLeftOrigin }; 463d34f66292ad4d3950d94026d08c3659880d30e2sergeyu@chromium.org 473d34f66292ad4d3950d94026d08c3659880d30e2sergeyu@chromium.org MacDesktopConfiguration(); 483d34f66292ad4d3950d94026d08c3659880d30e2sergeyu@chromium.org ~MacDesktopConfiguration(); 493d34f66292ad4d3950d94026d08c3659880d30e2sergeyu@chromium.org 503d34f66292ad4d3950d94026d08c3659880d30e2sergeyu@chromium.org // Returns the desktop & display configurations in Cocoa-style "bottom-up" 513d34f66292ad4d3950d94026d08c3659880d30e2sergeyu@chromium.org // (the origin is the bottom-left of the primary monitor, and coordinates 523d34f66292ad4d3950d94026d08c3659880d30e2sergeyu@chromium.org // increase as you move up the screen) or Carbon-style "top-down" coordinates. 533d34f66292ad4d3950d94026d08c3659880d30e2sergeyu@chromium.org static MacDesktopConfiguration GetCurrent(Origin origin); 543d34f66292ad4d3950d94026d08c3659880d30e2sergeyu@chromium.org 55cf1b51b6fbefbef1ef042f1538b4f92ee933f785jiayl@webrtc.org // Returns true if the given desktop configuration equals this one. 56cf1b51b6fbefbef1ef042f1538b4f92ee933f785jiayl@webrtc.org bool Equals(const MacDesktopConfiguration& other); 57cf1b51b6fbefbef1ef042f1538b4f92ee933f785jiayl@webrtc.org 581af5ea05384e2bebc0a1ae6fc57e8789778b8ef4jiayl@webrtc.org // Returns the pointer to the display configuration with the specified id. 591af5ea05384e2bebc0a1ae6fc57e8789778b8ef4jiayl@webrtc.org const MacDisplayConfiguration* FindDisplayConfigurationById( 601af5ea05384e2bebc0a1ae6fc57e8789778b8ef4jiayl@webrtc.org CGDirectDisplayID id); 611af5ea05384e2bebc0a1ae6fc57e8789778b8ef4jiayl@webrtc.org 623d9ec1fed4a71abfc7fe34ac87ab6d16a705381asergeyu@chromium.org // Bounds of the desktop excluding monitors with DPI settings different from 633d9ec1fed4a71abfc7fe34ac87ab6d16a705381asergeyu@chromium.org // the main monitor. In Density-Independent Pixels (DIPs). 647d055a6e630c343696f82002676e42a3beff380bsergeyu@chromium.org DesktopRect bounds; 653d34f66292ad4d3950d94026d08c3659880d30e2sergeyu@chromium.org 663d9ec1fed4a71abfc7fe34ac87ab6d16a705381asergeyu@chromium.org // Same as bounds, but expressed in physical pixels. 677d055a6e630c343696f82002676e42a3beff380bsergeyu@chromium.org DesktopRect pixel_bounds; 683d34f66292ad4d3950d94026d08c3659880d30e2sergeyu@chromium.org 693d34f66292ad4d3950d94026d08c3659880d30e2sergeyu@chromium.org // Scale factor from DIPs to physical pixels. 703d34f66292ad4d3950d94026d08c3659880d30e2sergeyu@chromium.org float dip_to_pixel_scale; 713d34f66292ad4d3950d94026d08c3659880d30e2sergeyu@chromium.org 723d34f66292ad4d3950d94026d08c3659880d30e2sergeyu@chromium.org // Configurations of the displays making up the desktop area. 733d34f66292ad4d3950d94026d08c3659880d30e2sergeyu@chromium.org MacDisplayConfigurations displays; 743d34f66292ad4d3950d94026d08c3659880d30e2sergeyu@chromium.org}; 753d34f66292ad4d3950d94026d08c3659880d30e2sergeyu@chromium.org 763d34f66292ad4d3950d94026d08c3659880d30e2sergeyu@chromium.org} // namespace webrtc 773d34f66292ad4d3950d94026d08c3659880d30e2sergeyu@chromium.org 783d34f66292ad4d3950d94026d08c3659880d30e2sergeyu@chromium.org#endif // WEBRTC_MODULES_DESKTOP_CAPTURE_MAC_DESKTOP_CONFIGURATION_H_ 79