diff --git a/apps/DesktopStreamer/CMakeLists.txt b/apps/DesktopStreamer/CMakeLists.txt index a08ec3a..883fb8c 100644 --- a/apps/DesktopStreamer/CMakeLists.txt +++ b/apps/DesktopStreamer/CMakeLists.txt @@ -35,10 +35,13 @@ if(APPLE) list(APPEND DESKTOPSTREAMER_SOURCES AppNapSuspender.mm) list(APPEND DESKTOPSTREAMER_LINK_LIBRARIES "-framework Foundation") - if(Qt5MacExtras_FOUND) - list(APPEND DESKTOPSTREAMER_SOURCES DesktopWindowsModel.mm) - list(APPEND DESKTOPSTREAMER_LINK_LIBRARIES - Qt5::MacExtras "-framework AppKit") + if(TARGET Qt5::MacExtras) + option(DESKTOPSTREAMER_ENABLE_MULTIWINDOW "Enable support for streaming multiple windows" OFF) + if(DESKTOPSTREAMER_ENABLE_MULTIWINDOW) + list(APPEND DESKTOPSTREAMER_SOURCES DesktopWindowsModel.mm) + list(APPEND DESKTOPSTREAMER_LINK_LIBRARIES + Qt5::MacExtras "-framework AppKit") + endif() endif() if(OSX_VERSION VERSION_LESS 10.9) list(APPEND DESKTOPSTREAMER_LINK_LIBRARIES "-framework ApplicationServices") @@ -52,6 +55,9 @@ endif() common_application(${DESKTOPSTREAMER_APP_NAME} GUI) if(APPLE) + if(TARGET Qt5::MacExtras AND DESKTOPSTREAMER_ENABLE_MULTIWINDOW) + target_compile_definitions(${DESKTOPSTREAMER_APP_NAME} PRIVATE DESKTOPSTREAMER_ENABLE_MULTIWINDOW) + endif() # create a zip for Puppet deployment install(CODE "execute_process(COMMAND zip -r ${DESKTOPSTREAMER_APP_NAME}-${PROJECT_VERSION}.zip ${DESKTOPSTREAMER_APP_NAME}.app diff --git a/apps/DesktopStreamer/MainWindow.cpp b/apps/DesktopStreamer/MainWindow.cpp index ea67b27..1715c5a 100644 --- a/apps/DesktopStreamer/MainWindow.cpp +++ b/apps/DesktopStreamer/MainWindow.cpp @@ -1,5 +1,7 @@ /*********************************************************************/ -/* Copyright (c) 2011 - 2012, The University of Texas at Austin. */ +/* Copyright (c) 2011-2012, The University of Texas at Austin. */ +/* Copyright (c) 2013-2016, EPFL/Blue Brain Project */ +/* Raphael Dumusc */ /* All rights reserved. */ /* */ /* Redistribution and use in source and binary forms, with or */ @@ -57,7 +59,7 @@ typedef __int32 int32_t; # include #endif -#ifdef DEFLECT_USE_QT5MACEXTRAS +#ifdef DESKTOPSTREAMER_ENABLE_MULTIWINDOW # include "DesktopWindowsModel.h" #endif @@ -103,7 +105,7 @@ MainWindow::MainWindow() gethostname( hostname, 256 ); _streamIdLineEdit->setText( QString( "%1" ).arg( hostname )); -#ifdef DEFLECT_USE_QT5MACEXTRAS +#ifdef DESKTOPSTREAMER_ENABLE_MULTIWINDOW _listView->setModel( new DesktopWindowsModel ); // select 'Desktop' item as initial default stream item @@ -195,7 +197,7 @@ void MainWindow::_updateStreams() { const std::string& host = _getStreamHost(); -#ifdef DEFLECT_USE_QT5MACEXTRAS +#ifdef DESKTOPSTREAMER_ENABLE_MULTIWINDOW const QModelIndexList windowIndices = _listView->selectionModel()->selectedIndexes(); @@ -304,7 +306,7 @@ void MainWindow::_shareDesktopUpdate() } } -#ifdef DEFLECT_USE_QT5MACEXTRAS +#ifdef DESKTOPSTREAMER_ENABLE_MULTIWINDOW void MainWindow::_deselect( ConstStreamPtr stream ) { const QPersistentModelIndex& index = stream->getIndex(); diff --git a/apps/DesktopStreamer/MainWindow.h b/apps/DesktopStreamer/MainWindow.h index e8784ba..473cdd1 100644 --- a/apps/DesktopStreamer/MainWindow.h +++ b/apps/DesktopStreamer/MainWindow.h @@ -1,5 +1,7 @@ /*********************************************************************/ -/* Copyright (c) 2011 - 2012, The University of Texas at Austin. */ +/* Copyright (c) 2011-2012, The University of Texas at Austin. */ +/* Copyright (c) 2013-2016, EPFL/Blue Brain Project */ +/* Raphael Dumusc */ /* All rights reserved. */ /* */ /* Redistribution and use in source and binary forms, with or */ diff --git a/apps/DesktopStreamer/Stream.cpp b/apps/DesktopStreamer/Stream.cpp index 5dde175..0a07e0d 100644 --- a/apps/DesktopStreamer/Stream.cpp +++ b/apps/DesktopStreamer/Stream.cpp @@ -41,7 +41,7 @@ #include "MainWindow.h" #ifdef __APPLE__ -# ifdef DEFLECT_USE_QT5MACEXTRAS +# ifdef DESKTOPSTREAMER_ENABLE_MULTIWINDOW # include "DesktopWindowsModel.h" # endif # if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_9 @@ -121,7 +121,7 @@ std::string update() { QPixmap pixmap; -#ifdef DEFLECT_USE_QT5MACEXTRAS +#ifdef DESKTOPSTREAMER_ENABLE_MULTIWINDOW if( !_window.isValid( )) return "Window does not exist anymore"; @@ -145,7 +145,7 @@ std::string update() return "Got no pixmap for desktop or window"; QImage image = pixmap.toImage(); -#ifdef DEFLECT_USE_QT5MACEXTRAS +#ifdef DESKTOPSTREAMER_ENABLE_MULTIWINDOW // render mouse cursor only on active window and full desktop streams if( DesktopWindowsModel::isActive( _pid ) || model->data( _window, Qt::DisplayRole ) == "Desktop" ) @@ -181,7 +181,7 @@ void _sendMouseEvent( const CGEventType type, const CGMouseButton button, CGEventRef event = CGEventCreateMouseEvent( 0, type, point, button ); CGEventSetType( event, type ); -#ifdef DEFLECT_USE_QT5MACEXTRAS +#ifdef DESKTOPSTREAMER_ENABLE_MULTIWINDOW // If the destination app is not active, store the event in a queue and // consume it after it's been activated (next iteration of main run loop) if( !DesktopWindowsModel::isActive( _pid )) @@ -263,7 +263,7 @@ void _sendMouseDoubleClickEvent( const float, const float ) {} const QImage _cursor; QImage _image; const int _pid; -#ifdef DEFLECT_USE_QT5MACEXTRAS +#ifdef __APPLE__ typedef std::queue< CGEventRef > EventQueue; EventQueue _events; #endif diff --git a/apps/DesktopStreamer/main.cpp b/apps/DesktopStreamer/main.cpp index 73f6e5a..de2911e 100644 --- a/apps/DesktopStreamer/main.cpp +++ b/apps/DesktopStreamer/main.cpp @@ -1,5 +1,7 @@ /*********************************************************************/ /* Copyright (c) 2011 - 2012, The University of Texas at Austin. */ +/* Copyright (c) 2013-2016, EPFL/Blue Brain Project */ +/* Raphael Dumusc */ /* All rights reserved. */ /* */ /* Redistribution and use in source and binary forms, with or */ diff --git a/doc/Changelog.md b/doc/Changelog.md index dba56e2..0e4b7d2 100644 --- a/doc/Changelog.md +++ b/doc/Changelog.md @@ -5,13 +5,16 @@ Changelog {#Changelog} ### 0.11.0 (git master) +* [110](https://github.com/BlueBrain/Deflect/pull/110): + DesktopStreamer: Support for streaming multiple windows on OSX disabled by + default, can be enabled with cmake -DDESKTOPSTREAMER_ENABLE_MULTIWINDOW=ON. * [106](https://github.com/BlueBrain/Deflect/pull/106): DesktopStreamer: Rename 'interaction' -> 'remote control', off by default. * [103](https://github.com/BlueBrain/Deflect/pull/103): DesktopStreamer: prevent AppNap of being re-enabled automatically * [102](https://github.com/BlueBrain/Deflect/pull/102): DeflectQt: Continue rendering & streaming after updates for a while to - compensate for running animations, fix spurious missing event handling + compensate for running animations, fix spurious missing event handling * [101](https://github.com/BlueBrain/Deflect/pull/101): DesktopStreamer: windows that are streamed independently are activated (i.e. sent to the foreground) before applying an interaction event. The mouse