Commit 306e8326 authored by Jeffrey Kardatzke's avatar Jeffrey Kardatzke Committed by Commit Bot

Enable cursor compositing during screen capture

This allows desktop capture to also include the mouse cursor without
having to induce a separate compositing stage for desktop capture
itself.

Bug: b:38452042
Change-Id: Ibfa75454ef44b8329d643dcfcc94a1b7b65018e4
Reviewed-on: https://chromium-review.googlesource.com/899606
Commit-Queue: Jeffrey Kardatzke <jkardatzke@google.com>
Reviewed-by: default avatarAhmed Fakhry <afakhry@chromium.org>
Reviewed-by: default avatarDan Erat <derat@chromium.org>
Cr-Commit-Position: refs/heads/master@{#534215}
parent eb78b7a5
......@@ -120,7 +120,8 @@ bool CursorWindowController::ShouldEnableCursorCompositing() {
display::DisplayManager* display_manager = Shell::Get()->display_manager();
if ((display_manager->is_multi_mirroring_enabled() &&
display_manager->IsInSoftwareMirrorMode()) ||
display_manager->IsInUnifiedMode()) {
display_manager->IsInUnifiedMode() ||
display_manager->screen_capture_is_active()) {
return true;
}
......
......@@ -6,6 +6,7 @@
#include <utility>
#include "ash/shell.h"
#include "base/bind.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/chromeos/ui/screen_capture_notification_ui_chromeos.h"
......@@ -29,6 +30,7 @@
#include "ui/aura/window_tree_host.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/compositor/dip_util.h"
#include "ui/display/manager/display_manager.h"
#include "ui/gfx/gpu_memory_buffer.h"
namespace {
......@@ -133,6 +135,9 @@ mojom::ScreenCaptureSessionPtr ArcScreenCaptureSession::Initialize(
base::BindRepeating(&ArcScreenCaptureSession::NotificationStop,
weak_ptr_factory_.GetWeakPtr()));
ash::Shell::Get()->display_manager()->inc_screen_capture_active_counter();
ash::Shell::Get()->UpdateCursorCompositingEnabled();
mojom::ScreenCaptureSessionPtr interface_ptr;
binding_.Bind(mojo::MakeRequest(&interface_ptr));
binding_.set_connection_error_handler(
......@@ -147,6 +152,8 @@ void ArcScreenCaptureSession::Close() {
ArcScreenCaptureSession::~ArcScreenCaptureSession() {
desktop_window_->GetHost()->compositor()->RemoveAnimationObserver(this);
ash::Shell::Get()->display_manager()->dec_screen_capture_active_counter();
ash::Shell::Get()->UpdateCursorCompositingEnabled();
}
void ArcScreenCaptureSession::NotificationStop() {
......
......@@ -8,6 +8,7 @@
#include <stddef.h>
#include <stdint.h>
#include <algorithm>
#include <map>
#include <memory>
#include <string>
......@@ -16,6 +17,7 @@
#include "base/callback.h"
#include "base/compiler_specific.h"
#include "base/gtest_prod_util.h"
#include "base/logging.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
......@@ -354,6 +356,17 @@ class DISPLAY_MANAGER_EXPORT DisplayManager
mixed_mirror_mode_params_ = mixed_params;
}
void dec_screen_capture_active_counter() {
DCHECK_GT(screen_capture_active_counter_, 0);
screen_capture_active_counter_--;
}
void inc_screen_capture_active_counter() { ++screen_capture_active_counter_; }
bool screen_capture_is_active() const {
return screen_capture_active_counter_ > 0;
}
// Remove mirroring source and destination displays, so that they will be
// updated when UpdateDisplaysWith() is called.
void ClearMirroringSourceAndDestination();
......@@ -646,6 +659,10 @@ class DISPLAY_MANAGER_EXPORT DisplayManager
bool internal_display_has_accelerometer_ = false;
// Set during screen capture to enable software compositing of mouse cursor,
// this is a counter to enable multiple active sessions at once.
int screen_capture_active_counter_ = 0;
base::Closure created_mirror_window_;
base::ObserverList<DisplayObserver> observers_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment