Merge lp:~unity-team/unity/x-sru5 into lp:unity/7.4

Proposed by Marco Trevisan (Treviño)
Status: Merged
Approved by: Andrea Azzarone
Approved revision: no longer in the source branch.
Merged at revision: 4115
Proposed branch: lp:~unity-team/unity/x-sru5
Merge into: lp:unity/7.4
Diff against target: 12627 lines (+4713/-1916)
190 files modified
AUTHORS (+2/-0)
CMakeLists.txt (+9/-98)
ChangeLog (+663/-0)
UnityCore/CMakeLists.txt (+2/-1)
UnityCore/DBusIndicators.cpp (+1/-1)
UnityCore/GLibDBusProxy.cpp (+12/-8)
UnityCore/GLibDBusProxy.h (+2/-2)
UnityCore/GLibSignal-inl.h (+10/-2)
UnityCore/GLibSignal.cpp (+75/-29)
UnityCore/GLibSignal.h (+16/-11)
UnityCore/GnomeSessionManager.cpp (+127/-39)
UnityCore/GnomeSessionManager.h (+1/-0)
UnityCore/GnomeSessionManagerImpl.h (+4/-0)
UnityCore/SessionManager.h (+1/-0)
UnityCore/Variant.cpp (+30/-0)
UnityCore/Variant.h (+1/-0)
config.h.cmake (+3/-2)
dash/ResultRendererTile.cpp (+1/-1)
data/CMakeLists.txt (+37/-1)
data/com.canonical.Unity.gschema.xml (+5/-0)
data/unity7.conf.in (+2/-19)
debian/changelog (+78/-0)
debian/control (+2/-1)
debian/rules (+3/-0)
debian/unity.install (+3/-0)
debian/unity.migrations (+1/-0)
decorations/DecoratedWindow.cpp (+2/-9)
decorations/DecorationsForceQuitDialog.cpp (+4/-2)
decorations/DecorationsMenuLayout.cpp (+35/-37)
decorations/DecorationsMenuLayout.h (+3/-2)
decorations/DecorationsPriv.h (+0/-1)
decorations/DecorationsWindowButton.cpp (+2/-1)
launcher/EdgeBarrierController.cpp (+32/-117)
launcher/EdgeBarrierControllerPrivate.h (+1/-6)
launcher/FileManagerLauncherIcon.cpp (+30/-0)
launcher/FileManagerLauncherIcon.h (+8/-0)
launcher/Launcher.cpp (+36/-32)
launcher/Launcher.h (+1/-0)
launcher/LauncherOptions.cpp (+22/-22)
launcher/StorageLauncherIcon.cpp (+7/-12)
launcher/Tooltip.cpp (+6/-6)
launcher/Tooltip.h (+1/-2)
lockscreen/BackgroundSettings.cpp (+18/-13)
lockscreen/KylinLockScreenShield.cpp (+1/-19)
lockscreen/KylinLockScreenShield.h (+0/-3)
lockscreen/KylinUserPromptView.cpp (+15/-15)
lockscreen/KylinUserPromptView.h (+2/-3)
lockscreen/LockScreenAbstractPromptView.h (+5/-3)
lockscreen/LockScreenBaseShield.cpp (+14/-7)
lockscreen/LockScreenBaseShield.h (+4/-6)
lockscreen/LockScreenController.cpp (+91/-38)
lockscreen/LockScreenController.h (+12/-2)
lockscreen/LockScreenPanel.cpp (+26/-57)
lockscreen/LockScreenPanel.h (+5/-9)
lockscreen/LockScreenPromptFactory.cpp (+4/-3)
lockscreen/LockScreenPromptFactory.h (+3/-1)
lockscreen/LockScreenShield.cpp (+8/-17)
lockscreen/LockScreenShield.h (+4/-3)
lockscreen/LockScreenShieldFactory.cpp (+2/-2)
lockscreen/LockScreenShieldFactory.h (+3/-3)
lockscreen/SuspendInhibitorManager.cpp (+2/-0)
lockscreen/SuspendInhibitorManager.h (+1/-0)
lockscreen/UserAuthenticator.h (+2/-0)
lockscreen/UserAuthenticatorPam.cpp (+41/-33)
lockscreen/UserAuthenticatorPam.h (+9/-8)
lockscreen/UserPromptView.cpp (+51/-15)
lockscreen/UserPromptView.h (+7/-4)
panel/PanelController.cpp (+1/-2)
panel/PanelIndicatorEntryView.cpp (+10/-0)
panel/PanelMenuView.cpp (+1/-7)
panel/PanelMenuView.h (+0/-2)
panel/PanelView.cpp (+14/-121)
panel/PanelView.h (+4/-12)
plugins/unityshell/src/unityshell.cpp (+117/-95)
plugins/unityshell/src/unityshell.h (+9/-2)
plugins/unityshell/unityshell.xml.in (+0/-6)
services/CMakeLists.txt (+1/-1)
services/panel-main.c (+36/-0)
services/panel-service.c (+86/-10)
services/panel-service.h (+2/-0)
services/unity-panel-service-lockscreen.conf.in (+3/-1)
services/unity-panel-service-lockscreen.service.in (+7/-0)
services/unity-panel-service.conf.in (+3/-1)
shutdown/StandaloneSession.cpp (+1/-0)
tests/CMakeLists.txt (+473/-292)
tests/MockCategories.h (+24/-14)
tests/MockResults.h (+32/-7)
tests/autopilot/unity/tests/test_dash.py (+4/-4)
tests/data/external.gschema.xml (+7/-1)
tests/test-gestures/CMakeLists.txt (+5/-3)
tests/test-gestures/test_gesture_broker.cpp (+3/-3)
tests/test_action_handle.cpp (+12/-12)
tests/test_animation_utils.cpp (+4/-4)
tests/test_application_launcher_icon.cpp (+4/-4)
tests/test_bamf_application.cpp (+28/-3)
tests/test_categories.cpp (+3/-3)
tests/test_connection_manager.cpp (+10/-10)
tests/test_dashview.cpp (+1/-1)
tests/test_dashview_impl.cpp (+3/-3)
tests/test_dbus_indicators.cpp (+4/-4)
tests/test_decorations_input_mixer.cpp (+7/-7)
tests/test_decorations_widgets.cpp (+5/-5)
tests/test_delta_tracker.cpp (+6/-6)
tests/test_desktop_launcher_icon.cpp (+1/-1)
tests/test_device_launcher_section.cpp (+1/-1)
tests/test_edge_barrier_controller.cpp (+2/-0)
tests/test_favorite_store_gsettings.cpp (+5/-5)
tests/test_favorite_store_private.cpp (+4/-4)
tests/test_file_manager_launcher_icon.cpp (+202/-0)
tests/test_filter_widgets.cpp (+1/-1)
tests/test_glib_dbus_object.cpp (+2/-2)
tests/test_glib_dbus_server.cpp (+17/-17)
tests/test_glib_object.cpp (+10/-10)
tests/test_glib_signals.cpp (+201/-63)
tests/test_glib_source.cpp (+45/-45)
tests/test_glib_variant.cpp (+9/-9)
tests/test_gnome_session_manager.cpp (+10/-3)
tests/test_grabhandle.cpp (+2/-2)
tests/test_gsettings_scopes.cpp (+32/-32)
tests/test_hud_button.cpp (+2/-2)
tests/test_hud_private.cpp (+6/-6)
tests/test_hud_view.cpp (+1/-1)
tests/test_icon_loader.cpp (+32/-32)
tests/test_indicator.cpp (+6/-6)
tests/test_indicator_appmenu.cpp (+3/-3)
tests/test_indicator_entry.cpp (+3/-3)
tests/test_indicators.cpp (+11/-11)
tests/test_introspection_data.cpp (+40/-40)
tests/test_keyboard_util.cpp (+8/-0)
tests/test_launcher_controller.cpp (+14/-11)
tests/test_launcher_model.cpp (+6/-6)
tests/test_layout_system.cpp (+9/-9)
tests/test_lockscreen_controller.cpp (+9/-7)
tests/test_mock_session_manager.h (+1/-0)
tests/test_panel_controller.cpp (+5/-3)
tests/test_panel_indicator_entry_dropdown_view.cpp (+10/-10)
tests/test_panel_view.cpp (+2/-0)
tests/test_pointer_barrier.cpp (+2/-2)
tests/test_previews.cpp (+2/-2)
tests/test_previews_application.cpp (+2/-2)
tests/test_previews_generic.cpp (+1/-1)
tests/test_previews_movie.cpp (+1/-1)
tests/test_previews_music.cpp (+1/-1)
tests/test_previews_music_payment.cpp (+1/-1)
tests/test_previews_payment.cpp (+1/-0)
tests/test_previews_social.cpp (+1/-1)
tests/test_quicklist_view.cpp (+1/-1)
tests/test_results.cpp (+10/-10)
tests/test_scope.cpp (+6/-6)
tests/test_scope_view.cpp (+12/-12)
tests/test_session_view.cpp (+4/-4)
tests/test_shortcut_model.cpp (+4/-4)
tests/test_shortcut_view.cpp (+3/-3)
tests/test_showdesktop_handler.cpp (+13/-5)
tests/test_switcher_controller_slow.cpp (+5/-5)
tests/test_tabiterator.cpp (+0/-6)
tests/test_texture_cache.cpp (+2/-2)
tests/test_thumbnail_generator.cpp (+5/-5)
tests/test_trash_launcher_icon.cpp (+6/-6)
tests/test_ubus.cpp (+6/-6)
tests/test_unity_window_style.cpp (+3/-3)
tests/test_volume_launcher_icon.cpp (+4/-4)
tools/CMakeLists.txt (+13/-3)
tools/compiz-profile-selector.in (+49/-0)
tools/compiz_config_profile_setter.c (+228/-0)
tools/migration-scripts/06_unity_set_lowgfx_mode_settings_v1 (+95/-0)
tools/unity.cmake (+23/-7)
tools/upstart-prestart-check (+17/-0)
unity-shared/BGHash.cpp (+22/-59)
unity-shared/BGHash.h (+3/-4)
unity-shared/BackgroundEffectHelper.cpp (+3/-4)
unity-shared/CMakeLists.txt (+1/-0)
unity-shared/DashStyle.cpp (+2/-2)
unity-shared/GnomeFileManager.cpp (+4/-2)
unity-shared/InputMonitor.cpp (+423/-0)
unity-shared/InputMonitor.h (+67/-0)
unity-shared/MenuManager.cpp (+157/-1)
unity-shared/MenuManager.h (+4/-0)
unity-shared/SigcSlotHash.h (+70/-0)
unity-shared/StandaloneWindowManager.cpp (+3/-0)
unity-shared/StandaloneWindowManager.h (+1/-0)
unity-shared/ThumbnailGenerator.cpp (+1/-1)
unity-shared/UScreen.cpp (+9/-0)
unity-shared/UScreen.h (+2/-0)
unity-shared/UnitySettings.cpp (+147/-14)
unity-shared/UnitySettings.h (+1/-1)
unity-shared/UpstartWrapper.cpp (+11/-6)
unity-shared/WindowManager.h (+1/-0)
unity-shared/XWindowManager.cpp (+6/-0)
unity-shared/XWindowManager.h (+1/-0)
To merge this branch: bzr merge lp:~unity-team/unity/x-sru5
Reviewer Review Type Date Requested Status
Andrea Azzarone (community) Approve
Review via email: mp+326916@code.launchpad.net

Commit message

Releasing unity SRU 5 as unity-7.4.5

Description of the change

Backported upstream commits with no changes (a part from revision 4143 which is an half-backport of the upstream 4193, minus the systemd bits)

To post a comment you must log in.
Revision history for this message
Andrea Azzarone (azzar1) wrote :

LGTM now thanks!

review: Approve
Revision history for this message
Andrea Azzarone (azzar1) :
review: Needs Fixing
Revision history for this message
Andrea Azzarone (azzar1) wrote :

Works fine now!

review: Approve
Revision history for this message
Amr Ibrahim (amribrahim1987) wrote :

Ping!
SRU into Xenial.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'AUTHORS'
--- AUTHORS 2016-05-14 23:01:37 +0000
+++ AUTHORS 2017-12-01 18:43:57 +0000
@@ -4,6 +4,7 @@
4 alanbell@ubuntu.com4 alanbell@ubuntu.com
5 Alan Pope <alan.pope@canonical.com>5 Alan Pope <alan.pope@canonical.com>
6 Albert Astals <albert.astals@canonical.com>6 Albert Astals <albert.astals@canonical.com>
7 Alberto Milone <alberto.milone@canonical.com>
7 Alejandro Piñeiro <apinheiro@igalia.com>8 Alejandro Piñeiro <apinheiro@igalia.com>
8 Alexander Fougner <fougner89@gmail.com>9 Alexander Fougner <fougner89@gmail.com>
9 Alexandre Abreu <alexandre.abreu@canonical.com>10 Alexandre Abreu <alexandre.abreu@canonical.com>
@@ -80,6 +81,7 @@
80 jokerdino@bvm128.zdom.org81 jokerdino@bvm128.zdom.org
81 Jonas Schwabe82 Jonas Schwabe
82 Jussi Pakkanen <jussi.pakkanen@canonical.com>83 Jussi Pakkanen <jussi.pakkanen@canonical.com>
84 Kai-Heng Feng <kai.heng.feng@canonical.com>
83 Ken VanDine <ken.vandine@canonical.com>85 Ken VanDine <ken.vandine@canonical.com>
84 Kevin DuBois <kevin.dubois@canonical.com>86 Kevin DuBois <kevin.dubois@canonical.com>
85 Koichi Akabe <vbkaisetsu@gmail.com>87 Koichi Akabe <vbkaisetsu@gmail.com>
8688
=== modified file 'CMakeLists.txt'
--- CMakeLists.txt 2016-08-01 08:37:57 +0000
+++ CMakeLists.txt 2017-12-01 18:43:57 +0000
@@ -11,7 +11,7 @@
11set (PROJECT_NAME "unity")11set (PROJECT_NAME "unity")
12set (UNITY_MAJOR 7)12set (UNITY_MAJOR 7)
13set (UNITY_MINOR 4)13set (UNITY_MINOR 4)
14set (UNITY_MICRO 0)14set (UNITY_MICRO 5)
15set (UNITY_VERSION "${UNITY_MAJOR}.${UNITY_MINOR}.${UNITY_MICRO}")15set (UNITY_VERSION "${UNITY_MAJOR}.${UNITY_MINOR}.${UNITY_MICRO}")
16set (UNITY_API_VERSION "6.0")16set (UNITY_API_VERSION "6.0")
17set (UNITY_COMPONENTS_VERSION "6")17set (UNITY_COMPONENTS_VERSION "6")
@@ -158,14 +158,15 @@
158#158#
159set (VERSION "${UNITY_VERSION}")159set (VERSION "${UNITY_VERSION}")
160set (PREFIXPATH "${CMAKE_INSTALL_PREFIX}")160set (PREFIXPATH "${CMAKE_INSTALL_PREFIX}")
161set (UNITYLIBDIR "${CMAKE_INSTALL_FULL_LIBDIR}/${PROJECT_NAME}")161set (UNITY_LIBDIR "${CMAKE_INSTALL_FULL_LIBDIR}/${PROJECT_NAME}")
162set (UNITYDATADIR "${CMAKE_INSTALL_FULL_DATADIR}/${PROJECT_NAME}")162set (UNITY_DATADIR "${CMAKE_INSTALL_FULL_DATADIR}/${PROJECT_NAME}")
163set (PKGDATADIR "${UNITYDATADIR}/icons")163set (UNITY_INSTALL_LIBDIR "${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}")
164set (PKGDATADIR "${UNITY_DATADIR}/icons")
164set (SOURCEDATADIR "${CMAKE_CURRENT_SOURCE_DIR}/resources")165set (SOURCEDATADIR "${CMAKE_CURRENT_SOURCE_DIR}/resources")
165set (BUILDDIR "${CMAKE_BINARY_DIR}")166set (BUILDDIR "${CMAKE_BINARY_DIR}")
166set (TESTDATADIR "${CMAKE_CURRENT_SOURCE_DIR}/tests/data")167set (TESTDATADIR "${CMAKE_CURRENT_SOURCE_DIR}/tests/data")
167set (LOCALE_DIR "${CMAKE_INSTALL_FULL_LOCALEDIR}")168set (LOCALE_DIR "${CMAKE_INSTALL_FULL_LOCALEDIR}")
168# specify the domain directly rather than refering to a variable 169# specify the domain directly rather than refering to a variable
169# like ${PROJECT_NAME} to no confuse dh_translations170# like ${PROJECT_NAME} to no confuse dh_translations
170set (GETTEXT_PACKAGE "unity")171set (GETTEXT_PACKAGE "unity")
171172
@@ -182,7 +183,6 @@
182#183#
183# i18n184# i18n
184#185#
185
186find_package (Gettext REQUIRED)186find_package (Gettext REQUIRED)
187187
188set (COMPIZ_I18N_DIR ${CMAKE_SOURCE_DIR}/po)188set (COMPIZ_I18N_DIR ${CMAKE_SOURCE_DIR}/po)
@@ -203,7 +203,7 @@
203203
204#204#
205# Enable or disable boot logging205# Enable or disable boot logging
206# 206#
207option (BOOT_LOGGER "Enable startup performance logging" OFF)207option (BOOT_LOGGER "Enable startup performance logging" OFF)
208if (BOOT_LOGGER)208if (BOOT_LOGGER)
209 SET (BOOT_LOGGER_FLAG "-DENABLE_LOGGER")209 SET (BOOT_LOGGER_FLAG "-DENABLE_LOGGER")
@@ -248,7 +248,7 @@
248 libnotify248 libnotify
249 libstartup-notification-1.0249 libstartup-notification-1.0
250 nux-4.0>=4.0.5250 nux-4.0>=4.0.5
251 sigc++-2.0251 sigc++-2.0>=2.4.0
252 unity-misc>=0.4.0252 unity-misc>=0.4.0
253 xpathselect=1.4253 xpathselect=1.4
254 zeitgeist-2.0254 zeitgeist-2.0
@@ -259,7 +259,7 @@
259if(ENABLE_X_SUPPORT)259if(ENABLE_X_SUPPORT)
260 set(UNITY_PLUGIN_DEPS260 set(UNITY_PLUGIN_DEPS
261 ${UNITY_PLUGIN_DEPS}261 ${UNITY_PLUGIN_DEPS}
262 compiz>=0.9.9262 compiz>=0.9.11
263 libgeis263 libgeis
264 x11264 x11
265 xfixes265 xfixes
@@ -304,56 +304,7 @@
304add_subdirectory(gnome)304add_subdirectory(gnome)
305305
306if (ENABLE_UNIT_TESTS)306if (ENABLE_UNIT_TESTS)
307 # Check for google test and build it locally
308 set (
309 GMOCK_ROOT_DIR
310 "/usr/src/gmock"
311 CACHE
312 PATH
313 "Path to Google mock srcs"
314 )
315
316 set (
317 GMOCK_INCLUDE_DIR
318 "/usr/include/gmock/include"
319 CACHE
320 PATH
321 "Path to Google mock include"
322 )
323
324 set(
325 GTEST_ROOT_DIR
326 "${GMOCK_ROOT_DIR}/gtest" # Default value, adjustable by user with e.g., ccmake
327 CACHE
328 PATH
329 "Path to Google test srcs"
330 )
331
332 set(
333 GTEST_INCLUDE_DIR
334 "${GMOCK_ROOT_DIR}/gtest/include"
335 CACHE
336 PATH
337 "Path to Google tests include"
338 )
339
340 if (GTEST_INCLUDE_DIR AND GMOCK_INCLUDE_DIR)
341 include_directories (
342 ${GMOCK_INCLUDE_DIR}
343 ${GTEST_INCLUDE_DIR}
344 )
345 add_subdirectory(
346 ${GMOCK_ROOT_DIR}
347 "${CMAKE_CURRENT_BINARY_DIR}/gmock"
348 )
349 elseif (GTEST_INCLUDE_DIR AND NOT GMOCK_INCLUDE_DIR)
350 include_directories (
351 ${GTEST_INCLUDE_DIR}
352 )
353 endif(GTEST_INCLUDE_DIR AND GMOCK_INCLUDE_DIR)
354
355 add_subdirectory(tests)307 add_subdirectory(tests)
356
357else (ENABLE_UNIT_TESTS)308else (ENABLE_UNIT_TESTS)
358 set (MISSING_TESTS_MSG "-- Tests disabled, compile with -DENABLE_UNIT_TESTS=ON")309 set (MISSING_TESTS_MSG "-- Tests disabled, compile with -DENABLE_UNIT_TESTS=ON")
359 add_custom_target (check COMMAND echo ${MISSING_TESTS_MSG})310 add_custom_target (check COMMAND echo ${MISSING_TESTS_MSG})
@@ -361,46 +312,11 @@
361 add_custom_target (gcheck COMMAND echo ${MISSING_TESTS_MSG})312 add_custom_target (gcheck COMMAND echo ${MISSING_TESTS_MSG})
362endif (ENABLE_UNIT_TESTS)313endif (ENABLE_UNIT_TESTS)
363314
364#
365# GSettings Schema
366#
367SET (UNITY_SCHEMAS "com.canonical.Unity.gschema.xml")
368SET (UNITY_TEST_SCHEMAS "external.gschema.xml")
369
370# Have an option to not install the schema into where GLib is
371option (GSETTINGS_LOCALINSTALL "Install GSettings Schemas locally instead of to the GLib prefix" OFF)
372if (GSETTINGS_LOCALINSTALL)
373 SET (GSETTINGS_DIR "${CMAKE_INSTALL_DATADIR}/glib-2.0/schemas/")
374else (GSETTINGS_LOCALINSTALL)
375 execute_process (COMMAND ${PKG_CONFIG_EXECUTABLE} glib-2.0 --variable prefix OUTPUT_VARIABLE _glib_prefix OUTPUT_STRIP_TRAILING_WHITESPACE)
376 SET (GSETTINGS_DIR "${_glib_prefix}/share/glib-2.0/schemas/")
377endif (GSETTINGS_LOCALINSTALL)
378
379# Run the validator and error if it fails
380execute_process (COMMAND ${PKG_CONFIG_EXECUTABLE} gio-2.0 --variable glib_compile_schemas OUTPUT_VARIABLE _glib_comple_schemas OUTPUT_STRIP_TRAILING_WHITESPACE)
381execute_process (COMMAND ${_glib_comple_schemas} --dry-run --schema-file=${CMAKE_CURRENT_SOURCE_DIR}/${UNITY_SCHEMAS} ERROR_VARIABLE _schemas_invalid OUTPUT_STRIP_TRAILING_WHITESPACE)
382
383if (_schemas_invalid)
384 message (SEND_ERROR "Schema validation error: ${_schemas_invalid}")
385endif (_schemas_invalid)
386
387# Actually install and recomple schemas
388message (STATUS "GSettings schemas will be installed into ${GSETTINGS_DIR}")
389install (FILES ${UNITY_SCHEMAS} DESTINATION ${GSETTINGS_DIR} OPTIONAL)
390install (CODE "message (STATUS \"Compiling GSettings schemas\")")
391install (CODE "execute_process (COMMAND ${_glib_comple_schemas} ${GSETTINGS_DIR})")
392
393# Resources315# Resources
394install (FILES resources/dash-widgets.json DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/themes)316install (FILES resources/dash-widgets.json DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/themes)
395file (GLOB _datafiles "${CMAKE_CURRENT_SOURCE_DIR}/resources/*")317file (GLOB _datafiles "${CMAKE_CURRENT_SOURCE_DIR}/resources/*")
396install (FILES ${_datafiles} DESTINATION ${PKGDATADIR})318install (FILES ${_datafiles} DESTINATION ${PKGDATADIR})
397319
398
399# For testing
400configure_file (${CMAKE_SOURCE_DIR}/${UNITY_SCHEMAS} ${CMAKE_BINARY_DIR}/settings/${UNITY_SCHEMAS})
401configure_file (${CMAKE_SOURCE_DIR}/tests/data/${UNITY_TEST_SCHEMAS} ${CMAKE_BINARY_DIR}/settings/${UNITY_TEST_SCHEMAS})
402execute_process (COMMAND ${_glib_comple_schemas} ${CMAKE_BINARY_DIR}/settings)
403
404#320#
405# docs321# docs
406#322#
@@ -426,8 +342,3 @@
426342
427endif (DOXYGEN_FOUND STREQUAL "YES")343endif (DOXYGEN_FOUND STREQUAL "YES")
428344
429#
430# Upstart
431#
432configure_file(unity7.conf.in ${CMAKE_CURRENT_BINARY_DIR}/unity7.conf)
433install(FILES ${CMAKE_CURRENT_BINARY_DIR}/unity7.conf DESTINATION ${CMAKE_INSTALL_DATADIR}/upstart/sessions)
434345
=== modified file 'ChangeLog'
--- ChangeLog 2016-05-14 23:01:37 +0000
+++ ChangeLog 2017-12-01 18:43:57 +0000
@@ -1,3 +1,666 @@
12017-11-16 Marco Trevisan (Treviño) <mail@3v1n0.net>
2
3 tools: add migration script to set the default values for unity-lowgfx profile
4
5 Compiz migration scripts are tricky and non always functional, this is safer
6 and known to work.
7
82017-10-10 Andrea Azzarone <azzaronea@gmail.com>
9
10 Avoid to show multiple "Authentication Failure" messages.
11
122017-09-25 Andrea Azzarone <azzaronea@gmail.com>
13
14 Wait until the color buffer is cleared before suspending.
15
162017-09-25 Andrea Azzarone <azzaronea@gmail.com>
17
18 Refactor the way UserAuthenticator is created and passed around. Handle failures to create new threads and fallback to a "Switch to greeter..." button in case of failure.
19
202017-09-25 Marco Trevisan (Treviño) <mail@3v1n0.net>
21
22 Tests: split unit tests in single binaries, enable unstable tests
23
24 Use CMake foo, for getting the best for running tests in single mode
25 and generating smart targets for them
26
272016-11-30 Marco Trevisan (Treviño) <mail@3v1n0.net>
28
29 CMakeLists.txt: add support to compile with GTest 1.8
30
312017-07-21 Marco Trevisan (Treviño) <mail@3v1n0.net>
32
33 PanelController: ensure we disconnect from signals on destruction
34
35 It's just about using the magic of deriving from sigc::trackable.
36 Since UScreen might be late in signaling screen changes it could fail
37
382017-07-21 Marco Trevisan (Treviño) <mail@3v1n0.net>
39
40 compiz-profile-selector: use initctl properly (it won't pull env var from current config)
41
422017-07-18 Marco Trevisan (Treviño) <mail@3v1n0.net>
43
44 unity.cmake: avoid setting not existing profiles when gfx tests fail
45
462017-07-18 Marco Trevisan (Treviño) <mail@3v1n0.net>
47
48 compiz-profile-selector: use ligther syntax for updating env variables
49
50 And fixes badly set variables in systemd too
51
522017-07-17 Marco Trevisan (Treviño) <mail@3v1n0.net>
53
54 tests: add org.compiz 'current-profile' to external gsettings
55
562017-07-17 Marco Trevisan (Treviño) <mail@3v1n0.net>
57
58 Launcher: disable or reduce most icon effects on lowgfx
59
602017-07-17 Marco Trevisan (Treviño) <mail@3v1n0.net>
61
62 UnitySettings: listen to compiz profile status in order to set low_gfx value
63
64 Instead of changing this value back and forth multiple times, just wait
65 this to be really changed in compiz, and update our internal variable
66 accordingly.
67 Also take care of the gsettings unity's lowgfx value only if the user has
68 set it.
69
70 This fixes an infinite loop when starting compiz in a lowgfx environment.
71
722017-07-17 Marco Trevisan (Treviño) <mail@3v1n0.net>
73
74 UnitySettings: use glib::Signal blocking for ignoring setting changes
75
762017-07-17 Marco Trevisan (Treviño) <mail@3v1n0.net>
77
78 GLibSignal: allow to block, unblock signals
79
80 Added support also to SignalManager, changed a bit the interface
81
822017-07-07 Andrea Azzarone <azzaronea@gmail.com>
83
84 Lockscreen: always draw the background-color in the lockscreen
85
86 This is to avoid showing a transparent background if the background file is missing.
87
882017-07-07 Marco Trevisan (Treviño) <mail@3v1n0.net>
89
90 compiz-profile-selector: don't try to update systemd in upstart session
91
922017-07-03 Marco Trevisan (Treviño) <mail@3v1n0.net>
93
94 BGHash, UnityScreen: get desktop averageColor from compiz
95
96 compiz now supports getting this value, let's use it instead of
97 doing this again here.
98
992017-06-09 Andrea Azzarone <azzaronea@gmail.com>
100
101 Use g_mkdir_with_parents instead of mkdir.
102
1032017-04-25 Marco Trevisan (Treviño) <mail@3v1n0.net>
104
105 compiz-profile-setter: tool to update the current profile and use in systemd and Unity settings
106
107 Added a compiz-profile-setter tool that allows to change compiz profile, so we use
108 this to set the right profile when starting unity and when the gsettings key has changed.
109
110 So we can just toggle lowgfx profile on the fly by just doing
111 gsettings set com.canonical.Unity lowgfx true|false
112
1132017-04-25 Eleni Maria Stea <elenimaria.stea@canonical.com>
114
115 removes lowgfx option from ccsm, reads the "lowgfx" gsetting (lp:~hikiko/unity-control-center/unity-control-center.lowgfx)
116
1172017-07-05 Marco Trevisan (Treviño) <mail@3v1n0.net>
118
119 Unity: Move scripts to tools, using cmake to generate proper paths
120
1212016-09-01 Marco Trevisan (Treviño) <mail@3v1n0.net>
122
123 CMake: move data and setting files in proper folder, define shared libdir variables
124
1252017-04-25 Nick Dedekind <nick.dedekind@canonical.com>
126
127 Fixed tooltip scaling issues.
128
1292017-04-25 Marco Trevisan (Treviño) <mail@3v1n0.net>
130
131 Panel: ensure the menu-manager tracker is updated to match monitor
132
133 Also always use an unique name for panel depending on monitor
134
1352017-03-01 Marco Trevisan (Treviño) <mail@3v1n0.net>
136
137 InputMonitor: don't try to deference an invalid Nux display
138
1392017-03-01 Marco Trevisan (Treviño) <mail@3v1n0.net>
140
141 UnityWindow: safely check validity of UnityWindow from scaled one
142
1432017-02-22 Marco Trevisan (Treviño) <mail@3v1n0.net>
144
145 BackgroundSettings: use gnome-bg to generate textures with proper scaling
146
147 When using non-user background, we ensure that the texture size matches
148 the screen size, and also we now generate the background using an high
149 quality pixmap, instead of stretching a non-scaled one.
150
1512017-01-25 Marco Trevisan (Treviño) <mail@3v1n0.net>
152
153 GnomeSessionManager: add gcancellable to instance and use it for calls with temporary proxies
154
155 This fixes various crashes when the session manager is destroyed while a temporary proxy
156 call is still in progress, and the callback is called afterwards.
157
1582017-01-09 Andrea Azzarone <azzaronea@gmail.com>
159
160 Keep the screen locked if rebooting with autologin.
161
1622017-01-09 Andrea Azzarone <azzaronea@gmail.com>
163
164 Round gtk scaling factor to closest integer.
165
1662017-01-09 Eleni Maria Stea <elenimaria.stea@canonical.com>
167
168 shouldn't create blur rectangles when there's no blur, skips the blur rects processing in low gfx.
169
1702016-11-30 Kai-Heng Feng <kai.heng.feng@canonical.com>
171
172 UnitySettings: If scale-factor is not set, find and set right scale for HiDPI displays.
173
1742016-11-30 Marco Trevisan (Treviño) <mail@3v1n0.net>
175
176 UnityScreen: toggle gestures recognition on lock
177
1782016-11-11 Marco Trevisan (Treviño) <mail@3v1n0.net>
179
180 LauncherOptions: use track_obj to manage option changes
181
1822016-11-11 Marco Trevisan (Treviño) <mail@3v1n0.net>
183
184 LockScreenController: use input monitor to get the events to switch monitor
185
186 In this way we can safely switch the monitor also on button click (after closing a menu)
187 or when moving over the panel (that wasn't properly handled before).
188
1892016-11-11 Marco Trevisan (Treviño) <mail@3v1n0.net>
190
191 LockScreenController: use InputMonitor to get all the events and hide the Blank Window
192
193 When the blank window is shown now we use the XI2 events to figure out if we can hide it
194 in this way it will be possible to show the screensaver when something is grabbing the
195 screen and we don't need to grab the screen anymore to get the events.
196
1972016-11-07 Andrea Azzarone <azzaronea@gmail.com>
198
199 GnomeSession: Retrieve the session id using dbus if c2 is not set
200
2012016-11-07 Andrea Azzarone <azzaronea@gmail.com>
202
203 Correctly position the force quit dialog when scaling is different than 1.0
204
2052016-11-07 Andrea Azzarone <azzaronea@gmail.com>
206
207 Properly handle the file manager copy dialog in FileManagerLauncherIcon and in StorageLauncherIcon.
208
2092016-11-07 Marco Trevisan (Treviño) <mail@3v1n0.net>
210
211 LockScreenController: ignore icon_paths_changed signal in menumanager for Lockscreen
212
2132016-09-01 Marco Trevisan (Treviño) <mail@3v1n0.net>
214
215 PanelService: don't allow to deactivate menus if they've been opened too shortly
216
217 This could be caused by some random events while doing fast scrubbing.
218
2192016-09-01 Marco Trevisan (Treviño) <mail@3v1n0.net>
220
221 PanelView: scale gradient refinement properly
222
2232016-09-01 Marco Trevisan (Treviño) <mail@3v1n0.net>
224
225 MenuManager: add support for mouse trackers with triangle algorithm support
226
227 It allows to register pointer trackers with menu entries selection by using the triangle
228 technique which prevents menus items from being opened on quick menu scrubbing
229
230 Then use use menu::Manager pointer tracker for entries activation in PanelView, LockScreenPanel and DecorationsMenuLayout
231
2322016-09-01 Marco Trevisan (Treviño) <mail@3v1n0.net>
233
234 LockScreenPanel: use InputMonitor events instead of mouse polling for menu scrubbing
235
2362016-09-01 Marco Trevisan (Treviño) <mail@3v1n0.net>
237
238 PanelView: use InputMonitor to track menu events
239
2402016-09-01 Marco Trevisan (Treviño) <mail@3v1n0.net>
241
242 DecorationsMenuLayout: use input monitor for menu scrubbing
243
2442016-09-01 Marco Trevisan (Treviño) <mail@3v1n0.net>
245
246 EdgeBarrierController: use InputMonitor to get the barrier events instead of relying on its implementation
247
248 Also disable the input barrier if we don't really need it
249
2502016-09-01 Marco Trevisan (Treviño) <mail@3v1n0.net>
251
252 InputMonitor: add an unity class that monitors XInput2 events and converts them to XEvent
253
254 Clients of this class can register event handlers, and when an interested event will hit
255 our event filter function (that is set only if we have handlers), then we notify them
256 with a standard XEvent struct, converted from the XIDeviceEvent cookie.
257
258 The nice thing of this monitor is that it always reports events, despite the X grabs.
259
2602016-09-06 Bileto Bot <ci-train-bot@canonical.com>
261
262 Releasing 7.4.0+16.04.20160906-0ubuntu1
263
2642016-09-06 Bileto Bot <ci-train-bot@canonical.com>
265
266 * SwitcherView: always disable animations when in lowgfx mode (LP:
267 #1602784)
268 * When locked discard damages from windows below lockscreen. (LP:
269 #1605180)
270 * DecoratedWindow: display unmaximize button if the window is
271 vertically or horizontally maximized (LP: #1608480)
272 * Make sure the switcher detail view is properly scaled. Also scale
273 the xy_offset to make sure the switcher and launcher do not overlap.
274 (LP: #1605256)
275 * Close session dialog on first ESC. (LP: #1521116)
276 * Filter out scrolling envents for FilterExpanderLabel. (LP: #1604632)
277 * Disable menu discovery animation if MenusDiscoveryDuration is 0.
278 (LP: #942962)
279 * Redraw fake decorations on window resize. (LP: #940470)
280 * Use compiz::Window::serverNext instead of compiz::Window::next in
281 IsWindowObscured as the latter can be outdated just after
282 scale/spread terminates. (LP: #1614116)
283 * DecoratedWindow: avoid deferencing an invalid shadow texture ptr,
284 and split functions (LP: #1608464)
285 * DecoratedWindow: display unmaximize button if the window is
286 vertically or horizontally maximized (LP: #1608480)
287 * DecorationsForceQuitDialog: make CSS selectors work with gtk 3.20
288 * UserAuthenticatorPam: ensure pam_handle_ is null initialized and
289 don't proceed if not set (LP: #1611668)
290 * DecorationStyle: set css name for Gtk 3.20
291 * OverlayRenderer: properly decorate launcher/panel when the launcher
292 is at the bottom (LP: #1611694)
293 * OverlayRenderer: don't use rotated textures, just rotate them at
294 rendering time
295 * SpreadWidgets: add container for spread filter and new spread
296 decorations (LP: #1283314)
297 * WindowButton: properly partially unmaximize a window when
298 middle/left clicking in the restore button (LP: #1616136)
299
3002016-09-07 Marco Trevisan (Treviño) <mail@3v1n0.net>
301
302 debian/changelog: no bug #1616031 is not sadly fixed here
303
3042016-08-19 Andrea Azzarone <azzaronea@gmail.com>
305
306 Use compiz::Window::serverNext instead of compiz::Window::next in IsWindowObscured as the latter can be outdated just after scale/spread terminates.
307
3082016-09-01 Marco Trevisan (Treviño) <mail@3v1n0.net>
309
310 WindowButton: properly partially unmaximize a window when middle/left clicking in the restore button
311
3122016-09-01 Andrea Azzarone <azzaronea@gmail.com>
313
314 Redraw fake decorations on window resize.
315
3162016-09-01 Andrea Azzarone <azzaronea@gmail.com>
317
318 Disable menu discovery animation if MenusDiscoveryDuration is 0.
319
3202016-08-23 Marco Trevisan (Treviño) <mail@3v1n0.net>
321
322 debian/changelog: add bug #1616031 as fixed too
323
3242016-08-17 Marco Trevisan (Treviño) <mail@3v1n0.net>
325
326 SpreadWidgets: add container for spread filter and new spread decorations
327
328 Now when windows are spread, launcher and panel aren't "naked" anymore
329
3302016-08-17 Marco Trevisan (Treviño) <mail@3v1n0.net>
331
332 OverlayRenderer: don't use rotated textures, just rotate them at rendering time
333
334 So removing duplicated data, since we can do this at code level
335
3362016-08-17 Marco Trevisan (Treviño) <mail@3v1n0.net>
337
338 OverlayRenderer: properly decorate launcher/panel when the launcher is at the bottom
339
3402016-08-17 Andrea Azzarone <azzaronea@gmail.com>
341
342 Filter out scrolling envents for FilterExpanderLabel.
343
3442016-08-17 Marco Trevisan (Treviño) <mail@3v1n0.net>
345
346 DecorationStyle: set css name for Gtk 3.20
347
3482016-08-17 Marco Trevisan (Treviño) <mail@3v1n0.net>
349
350 UserAuthenticatorPam: ensure pam_handle_ is null initialized and don't proceed if not set
351
3522016-08-17 Andrea Azzarone <azzaronea@gmail.com>
353
354 Close session dialog on first ESC.
355
3562016-08-17 Andrea Azzarone <azzaronea@gmail.com>
357
358 Make sure the switcher detail view is properly scaled. Also scale the xy_offset to make sure the switcher and launcher do not overlap.
359
3602016-08-06 Marco Trevisan (Treviño) <mail@3v1n0.net>
361
362 DecorationsForceQuitDialog: make CSS selectors work with gtk 3.20
363
3642016-08-06 Marco Trevisan (Treviño) <mail@3v1n0.net>
365
366 DecoratedWindow: display unmaximize button if the window is vertically or horizontally maximized
367
3682016-08-06 Marco Trevisan (Treviño) <mail@3v1n0.net>
369
370 DecoratedWindow: avoid deferencing an invalid shadow texture ptr, and split functions
371
3722016-07-27 Andrea Azzarone <azzaronea@gmail.com>
373
374 When locked discard damages from windows below lockscreen.
375
3762016-07-14 Marco Trevisan (Treviño) <mail@3v1n0.net>
377
378 SwitcherView: always disable animations when in lowgfx mode
379
3802016-08-01 Bileto Bot <ci-train-bot@canonical.com>
381
382 Releasing 7.4.0+16.04.20160801.2-0ubuntu1
383
3842016-08-01 Bileto Bot <ci-train-bot@canonical.com>
385
386 * FileManagerLauncherIcon: Don't trust the Quirk::VISIBLE in the ctor.
387 (LP: #1599133)
388 * [TrashLauncherIcon] Create GFileMonitor in an idle to avoid blocking
389 calls. (LP: #1602720)
390 * [LockSceen] Remove numlock warning. (LP: #1526322)
391 * Make sure initiate and terminate callbacks are not empty before
392 calling them. (LP: #1605012)
393 * Properly destroy close_button_ to properly disconnect lambda. (LP:
394 #1605010)
395 * Use the standard notification-device-eject in the "device eject"
396 notification. This allows us to scale it properly on high-dpi
397 setups. (LP: #1605231)
398 * Add tools to enforce unityshell plugin for the current profile and
399 add "move" and "resize" plugins as requirements. (LP: #1506023, LP:
400 #1605007, LP: #1604657)
401 * Unity script: use result from unity_support_test to check the right
402 COMPIZ_CONFIG_PROFILE to use (LP: #1602377)
403 * LockScreenAcceleratorController: ensure callbacks are valid before
404 calling them (LP: #1605012)
405 * DecoratedWindow: Added shadows for shaped windows (LP: 1608418)
406 * DecoratedWindow: Cleanup shadows for shaped windows, reduce
407 recomputation (LP: #1608418)
408 * UnityWindowView: don't try to deference close_button_ if its' null
409
4102016-08-01 Marco Trevisan (Treviño) <mail@3v1n0.net>
411
412 DecoratedWindow: split shadow quads computation based on shaped window state
413
414 And reset textures on change
415
4162016-08-01 Marco Trevisan (Treviño) <mail@3v1n0.net>
417
418 CompizUtils: add add flag to decoration utils for shaped windows
419
4202016-08-01 Marco Trevisan (Treviño) <mail@3v1n0.net>
421
422 DecoratedWindow: avoid deferencing an invalid shadow texture ptr, and split functions
423
4242016-08-01 Marco Trevisan (Treviño) <mail@3v1n0.net>
425
426 UnityWindowView: don't try to deference close_button_ if its' null
427
428 It could happen when manually triggering a signal
429
4302016-08-01 Marco Trevisan (Treviño) <mail@3v1n0.net>
431
432 DecoratedWindow: Cleanup shadows for shaped windows, reduce recomputation
433
4342016-07-27 Eleni Maria Stea <elenimaria.stea@canonical.com>
435
436 DecoratedWindow: Added shadows for shaped windows
437
4382016-07-27 Marco Trevisan (Treviño) <mail@3v1n0.net>
439
440 LockScreenAcceleratorController: ensure callbacks are valid before calling them
441
4422016-08-01 Marco Trevisan (Treviño) <mail@3v1n0.net>
443
444 Add tools to enforce unityshell plugin for the current profile and add "move" and "resize" plugins as requirements.
445
4462016-07-27 Andrea Azzarone <azzaronea@gmail.com>
447
448 Use the standard notification-device-eject in the "device eject" notification. This allows us to scale it properly on high-dpi setups.
449
4502016-07-27 Andrea Azzarone <azzaronea@gmail.com>
451
452 Properly destroy close_button_ to properly disconnect lambda.
453
4542016-07-27 Andrea Azzarone <azzaronea@gmail.com>
455
456 Make sure initiate and terminate callbacks are not empty before calling them.
457
4582016-07-27 Andrea Azzarone <azzaronea@gmail.com>
459
460 [LockSceen] Remove numlock warning.
461
4622016-07-14 Marco Trevisan (Treviño) <mail@3v1n0.net>
463
464 Unity script: use result from unity_support_test to check the right COMPIZ_CONFIG_PROFILE to use
465
4662016-07-14 Andrea Azzarone <azzaronea@gmail.com>
467
468 [TrashLauncherIcon] Create GFileMonitor in an idle to avoid blocking calls.
469
4702016-07-14 Andrea Azzarone <azzaronea@gmail.com>
471
472 FileManagerLauncherIcon: Don't trust the Quirk::VISIBLE in the ctor.
473
474 Make sure a window is valid/mapped before considering it a manager storage window.
475
4762016-07-15 Bileto Bot <ci-train-bot@canonical.com>
477
478 Releasing 7.4.0+16.04.20160715-0ubuntu1
479
4802016-07-15 Bileto Bot <ci-train-bot@canonical.com>
481
482 * PanelView: Don't draw it if the geo doesn't intersect the monitor
483 geo (as in ezoom)
484 * speeds up the showdesktop plugin in lowgfx mode
485 * Add whitelist for auto-repated keys. (LP: #1586491)
486 * Fix scale window activation if in show desktop mode. (LP: #1582056)
487 * Order matters in the rendering. Draw launcher shadow after the
488 background in all cases. (LP: #1586374)
489 * Fallback to volume name if no other identifier is available. (LP:
490 #1103593)
491 * Do not trigger screensaver on session inactive. (LP: #1587507)
492 * Use SwitcherController::SetDetail instead of detail=... (LP:
493 #1587618)
494 * UnitySettings: Add an option to enable/disable pam account checking.
495 (LP: #1460649)
496 * Lockscreen: Make sure warning and errors are properly shown to the
497 user (LP: #1593696)
498 * Add missing header to fix compilation error with -Duse_pch=OFF.
499 * Filter out fullscreen window in show desktop mode. (LP: #1597706)
500 * Make sure file manager icon is not removed when unpinned. (LP:
501 #1578792)
502 * Properly calculate the intersection geometry in PanelView::Draw.
503 This is needed to properly call SyncGeometries and to avoid problems
504 such as lp:1595698. (LP: #1595698)
505 * UnitySettings: Add dconf keys for disabling multitouch gestures (LP:
506 #1589520)
507 * LockScreenAcceleratorController: use key::Grabber to handle allowed
508 bindings (LP: #1438754)
509 * LockScreenAcceleratorController: check if a setting key is available
510 instead of crashing
511 * ApplicationLauncherIcon: ensure quirks are properly set on icon
512 initialization
513 * Views: Toggle animators durations based on low-gfx setting (LP:
514 #1598770)
515 * unity7.conf: use different compiz profile based on
516 unity_support_test result (LP: #1598770)
517
5182016-07-05 Marco Trevisan (Treviño) <mail@3v1n0.net>
519
520 unity7.conf: use different compiz profile based on unity_support_test result
521
5222016-07-05 Marco Trevisan (Treviño) <mail@3v1n0.net>
523
524 Views: Toggle animators durations based on low-gfx setting
525
526 Disable animations based on low_gfx setting (now ported to nux::Property)
527
5282016-07-05 Eleni Maria Stea <elenimaria.stea@canonical.com>
529
530 speeds up the showdesktop plugin in lowgfx mode
531
5322016-07-05 Marco Trevisan (Treviño) <mail@3v1n0.net>
533
534 ApplicationLauncherIcon: ensure quirks are properly set on icon initialization
535
5362016-07-05 Marco Trevisan (Treviño) <mail@3v1n0.net>
537
538 LockScreenAcceleratorController: check if a setting key is available instead of crashing
539
5402016-07-05 Andrea Azzarone <azzaronea@gmail.com>
541
542 Properly calculate the intersection geometry in PanelView::Draw. This is needed to properly call SyncGeometries and to avoid problems such as lp:1595698.
543
5442016-07-05 Andrea Azzarone <azzaronea@gmail.com>
545
546 Make sure file manager icon is not removed when unpinned.
547
5482016-06-30 Andrea Azzarone <azzaronea@gmail.com>
549
550 Filter out fullscreen window in show desktop mode.
551
5522016-06-30 Andrea Azzarone <azzaronea@gmail.com>
553
554 Add missing header to fix compilation error with -Duse_pch=OFF.
555
5562016-06-29 Marco Trevisan (Treviño) <mail@3v1n0.net>
557
558 debian/changelog: fix author
559
5602016-06-28 Andrea Azzarone <azzaronea@gmail.com>
561
562 Lockscreen: Make sure warning and errors are properly shown to the user
563
5642016-06-28 Andrea Azzarone <azzaronea@gmail.com>
565
566 UnitySettings: Add an option to enable/disable pam account checking.
567
5682016-06-21 Marco Trevisan (Treviño) <mail@3v1n0.net>
569
570 LockScreenAcceleratorController: use key::Grabber to handle allowed bindings This makes U-S-D to handle key events, without having to add some extra custom code inside the lockscreen. It's all just about whitelisting the wanted values.
571
5722016-06-06 Alberto Milone <alberto.milone@canonical.com>
573
574 UnitySettings: Add dconf keys for disabling multitouch gestures
575
5762016-06-06 Andrea Azzarone <azzaronea@gmail.com>
577
578 Use SwitcherController::SetDetail instead of detail=...
579
5802016-06-06 Andrea Azzarone <azzaronea@gmail.com>
581
582 Do not trigger screensaver on session inactive.
583
5842016-06-02 Andrea Azzarone <azzaronea@gmail.com>
585
586 Fallback to volume name if no other identifier is available.
587
5882016-06-02 Andrea Azzarone <azzaronea@gmail.com>
589
590 Order matters in the rendering. Draw launcher shadow after the background in all cases.
591
5922016-06-02 Andrea Azzarone <azzaronea@gmail.com>
593
594 Fix scale window activation if in show desktop mode.
595
5962016-06-02 Andrea Azzarone <azzaronea@gmail.com>
597
598 Add whitelist for auto-repated keys.
599
6002016-05-25 Eleni Maria Stea <elenimaria.stea@canonical.com>
601
602 PanelView: Don't draw it if the geo doesn't intersect the monitor geo (as in ezoom) added check to see if the panel geometry intersects the geometry of the monitor the panel belongs to. If there's no intersection there's no need to draw it (return). If there is intersection we should only draw the intersection area (clip the non visible parts).
603
6042016-05-26 CI Train Bot <ci-train-bot@canonical.com>
605
606 Releasing 7.4.0+16.04.20160526.1-0ubuntu1
607
6082016-05-26 handsome_feng <445865575@qq.com>
609
610 Releasing unity SRU1 for Xenial Fixes: #1525685, #1553165, #1562348, #1562847, #1570843, #1572241, #1573897, #1574689, #1575527, #1580211, #1580212
611
6122016-05-26 Marco Trevisan (Treviño) <mail@3v1n0.net>
613
614 debian/changelog: set proper version manually
615
6162016-05-17 handsome_feng <445865575@qq.com>
617
618 Change the x_offset of expo when launcher position changed.
619
6202016-05-17 Marco Trevisan (Treviño) <mail@3v1n0.net>
621
622 DashStyle: ensure LazyLoadTexture disconnects from signals on destruction
623
6242016-05-17 Marco Trevisan (Treviño) <mail@3v1n0.net>
625
626 SwitcherController: don't try to get a window from empty selections
627
6282016-05-17 Marco Trevisan (Treviño) <mail@3v1n0.net>
629
630 UnityScreen, UnityWindow: cleanup a little the code, and ensure overridden CompositeWindow functions get actually called There would be still a lot to do in this scenario, but still a start...F
631
6322016-05-17 Marco Trevisan (Treviño) <mail@3v1n0.net>
633
634 SwitcherView: close the mouse-selected application on middle-click
635
6362016-05-17 Andrea Azzarone <azzaronea@gmail.com>
637
638 Do not reset the shortcut for icons that have their own shortcut.
639
6402016-05-17 Andrea Azzarone <azzaronea@gmail.com>
641
642 Fallback to background class in case no background is specified for title bars and top panel.
643
6442016-05-17 Andrea Azzarone <azzaronea@gmail.com>
645
646 Properly calculate array indexes to avoid crashes.
647
6482016-05-17 Andrea Azzarone <azzaronea@gmail.com>
649
650 GnomeKeyGrabber: do not activate an action if it's a repeated one.
651
6522016-05-17 Andrea Azzarone <azzaronea@gmail.com>
653
654 Update ExpoLauncherIcon in case the quicklist is used to switch vp.
655
6562016-05-17 Andrea Azzarone <azzaronea@gmail.com>
657
658 Properly remove SoftwareCenterLauncherIcon in case of failure.
659
6602016-05-15 Marco Trevisan (Treviño) <mail@3v1n0.net>
661
662 Releasing Unity 7.4.0
663
12016-04-15 CI Train Bot <ci-train-bot@canonical.com>6642016-04-15 CI Train Bot <ci-train-bot@canonical.com>
2665
3 Releasing 7.4.0+16.04.20160415-0ubuntu1666 Releasing 7.4.0+16.04.20160415-0ubuntu1
4667
=== modified file 'UnityCore/CMakeLists.txt'
--- UnityCore/CMakeLists.txt 2016-02-09 01:26:22 +0000
+++ UnityCore/CMakeLists.txt 2017-12-01 18:43:57 +0000
@@ -145,7 +145,8 @@
145set_target_properties(${CORE_LIB_NAME} PROPERTIES145set_target_properties(${CORE_LIB_NAME} PROPERTIES
146 VERSION ${CORE_LIB_LT_CURRENT}.${CORE_LIB_LT_REV}.${CORE_LIB_LT_AGE}146 VERSION ${CORE_LIB_LT_CURRENT}.${CORE_LIB_LT_REV}.${CORE_LIB_LT_AGE}
147 SOVERSION ${CORE_LIB_LT_CURRENT}147 SOVERSION ${CORE_LIB_LT_CURRENT}
148 INSTALL_RPATH "${PRIVATE_CORE_DEPS_LIBRARY_DIRS}")148 INSTALL_RPATH "${PRIVATE_CORE_DEPS_LIBRARY_DIRS}"
149 BUILD_WITH_INSTALL_RPATH TRUE)
149add_pch(pch/unitycore_pch.hh ${CORE_LIB_NAME})150add_pch(pch/unitycore_pch.hh ${CORE_LIB_NAME})
150151
151install (TARGETS ${CORE_LIB_NAME}152install (TARGETS ${CORE_LIB_NAME}
152153
=== modified file 'UnityCore/DBusIndicators.cpp'
--- UnityCore/DBusIndicators.cpp 2016-02-09 01:26:22 +0000
+++ UnityCore/DBusIndicators.cpp 2017-12-01 18:43:57 +0000
@@ -123,7 +123,7 @@
123123
124 // This is obviously hackish, but this part of the code is mostly hackish...124 // This is obviously hackish, but this part of the code is mostly hackish...
125 // Let's attempt to run it from where we expect it to be125 // Let's attempt to run it from where we expect it to be
126 std::string cmd = UNITYLIBDIR"/" + std::string("unity-panel-service");126 std::string cmd = UNITY_LIBDIR"/" + std::string("unity-panel-service");
127 LOG_WARN(logger) << "Couldn't load panel from installed services, "127 LOG_WARN(logger) << "Couldn't load panel from installed services, "
128 << "so trying to load panel from known location: " << cmd;128 << "so trying to load panel from known location: " << cmd;
129129
130130
=== modified file 'UnityCore/GLibDBusProxy.cpp'
--- UnityCore/GLibDBusProxy.cpp 2015-11-24 16:40:03 +0000
+++ UnityCore/GLibDBusProxy.cpp 2017-12-01 18:43:57 +0000
@@ -609,7 +609,7 @@
609 return nullptr;609 return nullptr;
610}610}
611611
612void DBusProxy::GetProperty(std::string const& name, ReplyCallback const& callback)612void DBusProxy::GetProperty(std::string const& name, ReplyCallback const& callback, GCancellable *cancellable)
613{613{
614 if (!callback)614 if (!callback)
615 return;615 return;
@@ -620,7 +620,8 @@
620 pimpl->name_.c_str(), pimpl->object_path_.c_str(),620 pimpl->name_.c_str(), pimpl->object_path_.c_str(),
621 "org.freedesktop.DBus.Properties",621 "org.freedesktop.DBus.Properties",
622 "Get", g_variant_new ("(ss)", pimpl->interface_name_.c_str(), name.c_str()),622 "Get", g_variant_new ("(ss)", pimpl->interface_name_.c_str(), name.c_str()),
623 G_VARIANT_TYPE("(v)"), G_DBUS_CALL_FLAGS_NONE, -1, pimpl->cancellable_,623 G_VARIANT_TYPE("(v)"), G_DBUS_CALL_FLAGS_NONE, -1,
624 cancellable ? cancellable : pimpl->cancellable_,
624 [] (GObject *source, GAsyncResult *res, gpointer user_data) {625 [] (GObject *source, GAsyncResult *res, gpointer user_data) {
625 glib::Error err;626 glib::Error err;
626 std::unique_ptr<ReplyCallback> callback(static_cast<ReplyCallback*>(user_data));627 std::unique_ptr<ReplyCallback> callback(static_cast<ReplyCallback*>(user_data));
@@ -641,15 +642,16 @@
641 else642 else
642 {643 {
643 // This will get the property as soon as we have a connection644 // This will get the property as soon as we have a connection
645 glib::Object<GCancellable> canc(cancellable, AddRef());
644 auto conn = std::make_shared<sigc::connection>();646 auto conn = std::make_shared<sigc::connection>();
645 *conn = connected.connect([this, conn, name, callback] {647 *conn = connected.connect([this, conn, name, callback, canc] {
646 GetProperty(name, callback);648 GetProperty(name, callback, canc);
647 conn->disconnect();649 conn->disconnect();
648 });650 });
649 }651 }
650}652}
651653
652void DBusProxy::SetProperty(std::string const& name, GVariant* value)654void DBusProxy::SetProperty(std::string const& name, GVariant* value, GCancellable *cancellable)
653{655{
654 if (IsConnected())656 if (IsConnected())
655 {657 {
@@ -657,7 +659,8 @@
657 pimpl->name_.c_str(), pimpl->object_path_.c_str(),659 pimpl->name_.c_str(), pimpl->object_path_.c_str(),
658 "org.freedesktop.DBus.Properties",660 "org.freedesktop.DBus.Properties",
659 "Set", g_variant_new ("(ssv)", pimpl->interface_name_.c_str(), name.c_str(), value),661 "Set", g_variant_new ("(ssv)", pimpl->interface_name_.c_str(), name.c_str(), value),
660 nullptr, G_DBUS_CALL_FLAGS_NONE, -1, pimpl->cancellable_,662 nullptr, G_DBUS_CALL_FLAGS_NONE, -1,
663 cancellable ? cancellable : pimpl->cancellable_,
661 [] (GObject *source, GAsyncResult *res, gpointer user_data) {664 [] (GObject *source, GAsyncResult *res, gpointer user_data) {
662 glib::Error err;665 glib::Error err;
663 Variant result(g_dbus_connection_call_finish(G_DBUS_CONNECTION(source), res, &err), StealRef());666 Variant result(g_dbus_connection_call_finish(G_DBUS_CONNECTION(source), res, &err), StealRef());
@@ -670,9 +673,10 @@
670 else673 else
671 {674 {
672 // This will set the property as soon as we have a connection675 // This will set the property as soon as we have a connection
676 glib::Object<GCancellable> canc(cancellable, AddRef());
673 auto conn = std::make_shared<sigc::connection>();677 auto conn = std::make_shared<sigc::connection>();
674 *conn = connected.connect([this, conn, name, value] {678 *conn = connected.connect([this, conn, name, value, canc] {
675 SetProperty(name, value);679 SetProperty(name, value, canc);
676 conn->disconnect();680 conn->disconnect();
677 });681 });
678 }682 }
679683
=== modified file 'UnityCore/GLibDBusProxy.h'
--- UnityCore/GLibDBusProxy.h 2014-10-10 11:35:40 +0000
+++ UnityCore/GLibDBusProxy.h 2017-12-01 18:43:57 +0000
@@ -74,8 +74,8 @@
74 bool IsConnected() const;74 bool IsConnected() const;
7575
76 Variant GetProperty(std::string const& property_name) const;76 Variant GetProperty(std::string const& property_name) const;
77 void GetProperty(std::string const& property_name, ReplyCallback const&);77 void GetProperty(std::string const& property_name, ReplyCallback const&, GCancellable *cancellable = nullptr);
78 void SetProperty(std::string const& property_name, GVariant* value);78 void SetProperty(std::string const& property_name, GVariant* value, GCancellable *cancellable = nullptr);
7979
80 void Connect(std::string const& signal_name, ReplyCallback const& callback);80 void Connect(std::string const& signal_name, ReplyCallback const& callback);
81 void DisconnectSignal(std::string const& signal_name = "");81 void DisconnectSignal(std::string const& signal_name = "");
8282
=== modified file 'UnityCore/GLibSignal-inl.h'
--- UnityCore/GLibSignal-inl.h 2014-10-15 05:16:46 +0000
+++ UnityCore/GLibSignal-inl.h 2017-12-01 18:43:57 +0000
@@ -34,11 +34,11 @@
34}34}
3535
36template <typename R, typename G, typename... Ts>36template <typename R, typename G, typename... Ts>
37void Signal<R, G, Ts...>::Connect(G object, std::string const& signal_name,37bool Signal<R, G, Ts...>::Connect(G object, std::string const& signal_name,
38 SignalCallback const& callback)38 SignalCallback const& callback)
39{39{
40 if (!callback || !G_IS_OBJECT(object) || signal_name.empty())40 if (!callback || !G_IS_OBJECT(object) || signal_name.empty())
41 return;41 return false;
4242
43 Disconnect();43 Disconnect();
4444
@@ -47,6 +47,8 @@
47 callback_ = callback;47 callback_ = callback;
48 connection_id_ = g_signal_connect(object_, signal_name.c_str(), G_CALLBACK(Callback), this);48 connection_id_ = g_signal_connect(object_, signal_name.c_str(), G_CALLBACK(Callback), this);
49 g_object_add_weak_pointer(object_, reinterpret_cast<gpointer*>(&object_));49 g_object_add_weak_pointer(object_, reinterpret_cast<gpointer*>(&object_));
50
51 return true;
50}52}
5153
52template <typename R, typename G, typename... Ts>54template <typename R, typename G, typename... Ts>
@@ -59,6 +61,12 @@
59 return R();61 return R();
60}62}
6163
64template <typename R, typename G, typename... Ts>
65SignalBase::Ptr SignalManager::Add(G object, std::string const& signal_name, typename Signal<R, G, Ts...>::SignalCallback const& callback)
66{
67 return Add(std::make_shared<Signal<R, G, Ts...>>(object, signal_name, callback));
68}
69
62}70}
63}71}
6472
6573
=== modified file 'UnityCore/GLibSignal.cpp'
--- UnityCore/GLibSignal.cpp 2012-08-15 16:58:14 +0000
+++ UnityCore/GLibSignal.cpp 2017-12-01 18:43:57 +0000
@@ -35,16 +35,46 @@
35 Disconnect();35 Disconnect();
36}36}
3737
38void SignalBase::Disconnect()38bool SignalBase::Disconnect()
39{39{
40 bool disconnected = false;
41
40 if (connection_id_ && G_IS_OBJECT(object_))42 if (connection_id_ && G_IS_OBJECT(object_))
41 {43 {
42 g_signal_handler_disconnect(object_, connection_id_);44 g_signal_handler_disconnect(object_, connection_id_);
43 g_object_remove_weak_pointer(object_, reinterpret_cast<gpointer*>(&object_));45 g_object_remove_weak_pointer(object_, reinterpret_cast<gpointer*>(&object_));
46 disconnected = true;
44 }47 }
4548
46 object_ = nullptr;49 object_ = nullptr;
47 connection_id_ = 0;50 connection_id_ = 0;
51 return disconnected;
52}
53
54bool SignalBase::Block() const
55{
56 bool blocked = false;
57
58 if (connection_id_ && G_IS_OBJECT(object_))
59 {
60 g_signal_handler_block(object_, connection_id_);
61 blocked = true;
62 }
63
64 return blocked;
65}
66
67bool SignalBase::Unblock() const
68{
69 bool unblocked = false;
70
71 if (connection_id_ && G_IS_OBJECT(object_))
72 {
73 g_signal_handler_unblock(object_, connection_id_);
74 unblocked = true;
75 }
76
77 return unblocked;
48}78}
4979
50GObject* SignalBase::object() const80GObject* SignalBase::object() const
@@ -75,57 +105,73 @@
75// was too messy to try and write a copy constructor/operator that would steal105// was too messy to try and write a copy constructor/operator that would steal
76// from "other" and make the new one the owner. Not only did it create106// from "other" and make the new one the owner. Not only did it create
77// opportunity for random bugs, it also made the API bad.107// opportunity for random bugs, it also made the API bad.
78void SignalManager::Add(SignalBase* signal)108SignalBase::Ptr SignalManager::Add(SignalBase* signal)
79{109{
80 Add(SignalBase::Ptr(signal));110 return Add(SignalBase::Ptr(signal));
81}111}
82112
83void SignalManager::Add(SignalBase::Ptr const& signal)113SignalBase::Ptr SignalManager::Add(SignalBase::Ptr const& signal)
84{114{
85 connections_.push_back(signal);115 connections_.push_back(signal);
86 g_object_weak_ref(signal->object(), (GWeakNotify)&OnObjectDestroyed, this);116 g_object_weak_ref(signal->object(), (GWeakNotify)&OnObjectDestroyed, this);
87}117 return signal;
88
89void SignalManager::OnObjectDestroyed(SignalManager* self, GObject* old_obj)
90{
91 for (auto it = self->connections_.begin(); it != self->connections_.end();)
92 {
93 auto const& signal = *it;
94
95 // When an object has been destroyed, the signal member is nullified,
96 // so at this point we can be sure that removing signal with a null object,
97 // means removing invalid signals.
98 if (!signal->object())
99 {
100 it = self->connections_.erase(it);
101 }
102 else
103 {
104 ++it;
105 }
106 }
107}118}
108119
109// This uses void* to keep in line with the g_signal* functions120// This uses void* to keep in line with the g_signal* functions
110// (it allows you to pass in a GObject without casting up).121// (it allows you to pass in a GObject without casting up).
111void SignalManager::Disconnect(void* object, std::string const& signal_name)122bool SignalManager::ForeachMatchedSignal(void* object, std::string const& signal_name, std::function<void(SignalBase::Ptr const&)> action, bool erase_after)
112{123{
113 bool all_signals = signal_name.empty();124 bool action_performed = false;
125 bool all_objects = (object == reinterpret_cast<void*>(std::numeric_limits<uintptr_t>::max()));
126 bool all_signals = all_objects || signal_name.empty();
114127
115 for (auto it = connections_.begin(); it != connections_.end();)128 for (auto it = connections_.begin(); it != connections_.end();)
116 {129 {
117 auto const& signal = *it;130 auto const& signal = *it;
118131
119 if (signal->object() == object && (all_signals || signal->name() == signal_name))132 if ((all_objects || signal->object() == object) && (all_signals || signal->name() == signal_name))
120 {133 {
121 g_object_weak_unref(signal->object(), (GWeakNotify)&OnObjectDestroyed, this);134 if (action)
122 it = connections_.erase(it);135 {
136 action_performed = true;
137 action(signal);
138 }
139
140 it = erase_after ? connections_.erase(it) : ++it;
123 }141 }
124 else142 else
125 {143 {
126 ++it;144 ++it;
127 }145 }
128 }146 }
147
148 return action_performed;
149}
150
151void SignalManager::OnObjectDestroyed(SignalManager* self, GObject* old_obj)
152{
153 self->ForeachMatchedSignal(nullptr, "", nullptr, /*erase_after*/ true);
154}
155
156bool SignalManager::Block(void* object, std::string const& signal_name)
157{
158 return ForeachMatchedSignal(object, signal_name, [this] (SignalBase::Ptr const& signal) {
159 signal->Block();
160 });
161}
162
163bool SignalManager::Unblock(void* object, std::string const& signal_name)
164{
165 return ForeachMatchedSignal(object, signal_name, [this] (SignalBase::Ptr const& signal) {
166 signal->Unblock();
167 });
168}
169
170bool SignalManager::Disconnect(void* object, std::string const& signal_name)
171{
172 return ForeachMatchedSignal(object, signal_name, [this] (SignalBase::Ptr const& signal) {
173 g_object_weak_unref(signal->object(), (GWeakNotify)&OnObjectDestroyed, this);
174 }, true);
129}175}
130176
131}177}
132178
=== modified file 'UnityCore/GLibSignal.h'
--- UnityCore/GLibSignal.h 2012-08-15 16:58:14 +0000
+++ UnityCore/GLibSignal.h 2017-12-01 18:43:57 +0000
@@ -21,6 +21,7 @@
21#ifndef UNITY_GLIB_SIGNAL_H21#ifndef UNITY_GLIB_SIGNAL_H
22#define UNITY_GLIB_SIGNAL_H22#define UNITY_GLIB_SIGNAL_H
2323
24#include <limits>
24#include <string>25#include <string>
25#include <vector>26#include <vector>
26#include <memory>27#include <memory>
@@ -39,7 +40,10 @@
3940
40 virtual ~SignalBase();41 virtual ~SignalBase();
4142
42 void Disconnect();43 bool Disconnect();
44
45 bool Block() const;
46 bool Unblock() const;
4347
44 GObject* object() const;48 GObject* object() const;
45 std::string const& name() const;49 std::string const& name() const;
@@ -71,9 +75,9 @@
71#endif75#endif
7276
73 inline Signal() {};77 inline Signal() {};
74 inline Signal(G object, std::string const& signal_name, SignalCallback const& callback);78 inline Signal(G object, std::string const& signal_name, SignalCallback const&);
7579
76 inline void Connect(G Object, std::string const& signal_name, SignalCallback const& callback);80 inline bool Connect(G Object, std::string const& signal_name, SignalCallback const&);
7781
78private:82private:
79 static R Callback(G Object, Ts... vs, Signal* self);83 static R Callback(G Object, Ts... vs, Signal* self);
@@ -86,17 +90,18 @@
86public:90public:
87 SignalManager();91 SignalManager();
88 ~SignalManager();92 ~SignalManager();
89 void Add(SignalBase* signal);93 SignalBase::Ptr Add(SignalBase* signal);
90 void Add(SignalBase::Ptr const& signal);94 SignalBase::Ptr Add(SignalBase::Ptr const& signal);
91 template <typename R, typename G, typename... Ts>95 template <typename R, typename G, typename... Ts>
92 void Add(G object, std::string const& signal_name, typename Signal<R, G, Ts...>::SignalCallback const& callback)96 SignalBase::Ptr Add(G object, std::string const& signal_name, typename Signal<R, G, Ts...>::SignalCallback const&);
93 {97
94 Add(std::make_shared<Signal<R, G, Ts...>>(object, signal_name, callback));98 bool Block(void* object = (void*) std::numeric_limits<uintptr_t>::max(), std::string const& signal_name = "");
95 }99 bool Unblock(void* object = (void*) std::numeric_limits<uintptr_t>::max(), std::string const& signal_name = "");
96100
97 void Disconnect(void* object, std::string const& signal_name = "");101 bool Disconnect(void* object, std::string const& signal_name = "");
98102
99private:103private:
104 bool ForeachMatchedSignal(void* object, std::string const& signal_name, std::function<void(SignalBase::Ptr const&)> action, bool erase_after = false);
100 static void OnObjectDestroyed(SignalManager* self, GObject* old_obj);105 static void OnObjectDestroyed(SignalManager* self, GObject* old_obj);
101106
102protected:107protected:
103108
=== modified file 'UnityCore/GnomeSessionManager.cpp'
--- UnityCore/GnomeSessionManager.cpp 2016-06-06 14:28:04 +0000
+++ UnityCore/GnomeSessionManager.cpp 2017-12-01 18:43:57 +0000
@@ -77,6 +77,8 @@
7777
78const std::string GNOME_LOCKDOWN_OPTIONS = "org.gnome.desktop.lockdown";78const std::string GNOME_LOCKDOWN_OPTIONS = "org.gnome.desktop.lockdown";
79const std::string DISABLE_LOCKSCREEN_KEY = "disable-lock-screen";79const std::string DISABLE_LOCKSCREEN_KEY = "disable-lock-screen";
80
81GDBusProxyFlags DEFAULT_CALL_FLAGS = static_cast<GDBusProxyFlags>(G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES|G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS|G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START_AT_CONSTRUCTION);
80}82}
8183
82GnomeManager::Impl::Impl(GnomeManager* manager, bool test_mode)84GnomeManager::Impl::Impl(GnomeManager* manager, bool test_mode)
@@ -99,38 +101,45 @@
99 });101 });
100102
101 {103 {
102 const char* session_id = test_mode_ ? "id0" : g_getenv("XDG_SESSION_ID");104 std::string session_id = test_mode_ ? "id0" : glib::gchar_to_string(g_getenv("XDG_SESSION_ID"));
103105
104 login_proxy_ = std::make_shared<glib::DBusProxy>(test_mode_ ? testing::DBUS_NAME : "org.freedesktop.login1",106 if (!session_id.empty())
105 "/org/freedesktop/login1/session/" + glib::gchar_to_string(session_id),107 {
106 "org.freedesktop.login1.Session",108 CallLogindMethod("GetSession", g_variant_new("(s)", session_id.c_str()), [this, session_id] (GVariant* variant, glib::Error const& err) {
107 test_mode_ ? G_BUS_TYPE_SESSION : G_BUS_TYPE_SYSTEM,109 std::string session_path;
108 G_DBUS_PROXY_FLAGS_GET_INVALIDATED_PROPERTIES);110
109111 if (!err && variant)
110 login_proxy_->Connect("Lock", [this](GVariant*){112 session_path = glib::Variant(variant).GetObjectPath();
111 manager_->PromptLockScreen();113
112 });114 if (session_path.empty())
113115 session_path = "/org/freedesktop/login1/session/" + session_id;
114 login_proxy_->Connect("Unlock", [this](GVariant*){116
115 manager_->unlock_requested.emit();117 SetupLogin1Proxy(session_path);
116 });118 });
117119 }
118 login_proxy_->ConnectProperty("Active", [this] (GVariant* variant) {120 else
119 bool active = glib::Variant(variant).GetBool();121 {
120 manager_->is_session_active.changed.emit(active);122 auto proxy = std::make_shared<glib::DBusProxy>("org.freedesktop.login1",
121 if (active)123 "/org/freedesktop/login1/user/self",
122 manager_->screensaver_requested.emit(false);124 "org.freedesktop.login1.User",
123 });125 G_BUS_TYPE_SYSTEM);
124126
125 manager_->is_session_active.SetGetterFunction([this] {127 proxy->GetProperty("Display", [this, proxy] (GVariant *variant) {
126 return login_proxy_->GetProperty("Active").GetBool();128 if (!variant || g_variant_n_children(variant) < 2)
127 });129 return;
130
131 glib::Variant tmp(g_variant_get_child_value(variant, 1), glib::StealRef());
132 SetupLogin1Proxy(tmp.GetObjectPath());
133 }, cancellable_);
134 }
128 }135 }
129136
130 {137 {
131 presence_proxy_ = std::make_shared<glib::DBusProxy>(test_mode_ ? testing::DBUS_NAME : "org.gnome.SessionManager",138 presence_proxy_ = std::make_shared<glib::DBusProxy>(test_mode_ ? testing::DBUS_NAME : "org.gnome.SessionManager",
132 "/org/gnome/SessionManager/Presence",139 "/org/gnome/SessionManager/Presence",
133 "org.gnome.SessionManager.Presence");140 "org.gnome.SessionManager.Presence",
141 G_BUS_TYPE_SESSION,
142 G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES);
134143
135 presence_proxy_->Connect("StatusChanged", [this](GVariant* variant) {144 presence_proxy_->Connect("StatusChanged", [this](GVariant* variant) {
136 enum class PresenceStatus : unsigned145 enum class PresenceStatus : unsigned
@@ -166,7 +175,8 @@
166 dm_seat_proxy_ = std::make_shared<glib::DBusProxy>("org.freedesktop.Accounts",175 dm_seat_proxy_ = std::make_shared<glib::DBusProxy>("org.freedesktop.Accounts",
167 ("/org/freedesktop/Accounts/User" + std::to_string(getuid())).c_str(),176 ("/org/freedesktop/Accounts/User" + std::to_string(getuid())).c_str(),
168 "org.freedesktop.Accounts.User",177 "org.freedesktop.Accounts.User",
169 G_BUS_TYPE_SYSTEM);178 G_BUS_TYPE_SYSTEM,
179 G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS);
170 }180 }
171181
172 CallLogindMethod("CanHibernate", nullptr, [this] (GVariant* variant, glib::Error const& err) {182 CallLogindMethod("CanHibernate", nullptr, [this] (GVariant* variant, glib::Error const& err) {
@@ -216,6 +226,34 @@
216 ClosedDialog();226 ClosedDialog();
217}227}
218228
229void GnomeManager::Impl::SetupLogin1Proxy(std::string const& session_path)
230{
231 login_proxy_ = std::make_shared<glib::DBusProxy>(test_mode_ ? testing::DBUS_NAME : "org.freedesktop.login1",
232 session_path,
233 "org.freedesktop.login1.Session",
234 test_mode_ ? G_BUS_TYPE_SESSION : G_BUS_TYPE_SYSTEM,
235 G_DBUS_PROXY_FLAGS_GET_INVALIDATED_PROPERTIES);
236
237 login_proxy_->Connect("Lock", [this](GVariant*){
238 manager_->PromptLockScreen();
239 });
240
241 login_proxy_->Connect("Unlock", [this](GVariant*){
242 manager_->unlock_requested.emit();
243 });
244
245 login_proxy_->ConnectProperty("Active", [this] (GVariant* variant) {
246 bool active = glib::Variant(variant).GetBool();
247 manager_->is_session_active.changed.emit(active);
248 if (active)
249 manager_->screensaver_requested.emit(false);
250 });
251
252 manager_->is_session_active.SetGetterFunction([this] {
253 return login_proxy_->GetProperty("Active").GetBool();
254 });
255}
256
219bool GnomeManager::Impl::InteractiveMode()257bool GnomeManager::Impl::InteractiveMode()
220{258{
221 bool schema_found = false;259 bool schema_found = false;
@@ -374,7 +412,8 @@
374 glib::DBusProxy::CallFinishedCallback const& cb)412 glib::DBusProxy::CallFinishedCallback const& cb)
375{413{
376 auto proxy = std::make_shared<glib::DBusProxy>(test_mode_ ? testing::DBUS_NAME : "org.gnome.SessionManager",414 auto proxy = std::make_shared<glib::DBusProxy>(test_mode_ ? testing::DBUS_NAME : "org.gnome.SessionManager",
377 "/org/gnome/SessionManager", "org.gnome.SessionManager");415 "/org/gnome/SessionManager", "org.gnome.SessionManager",
416 G_BUS_TYPE_SESSION, DEFAULT_CALL_FLAGS);
378417
379 // By passing the proxy to the lambda we ensure that it will be smartly handled418 // By passing the proxy to the lambda we ensure that it will be smartly handled
380 proxy->CallBegin(method, parameters, [proxy, cb] (GVariant* ret, glib::Error const& e) {419 proxy->CallBegin(method, parameters, [proxy, cb] (GVariant* ret, glib::Error const& e) {
@@ -385,14 +424,15 @@
385424
386 if (cb)425 if (cb)
387 cb(ret, e);426 cb(ret, e);
388 });427 }, cancellable_);
389}428}
390429
391void GnomeManager::Impl::CallUPowerMethod(std::string const& method, glib::DBusProxy::ReplyCallback const& cb)430void GnomeManager::Impl::CallUPowerMethod(std::string const& method, glib::DBusProxy::ReplyCallback const& cb)
392{431{
393 auto proxy = std::make_shared<glib::DBusProxy>(test_mode_ ? testing::DBUS_NAME : "org.freedesktop.UPower",432 auto proxy = std::make_shared<glib::DBusProxy>(test_mode_ ? testing::DBUS_NAME : "org.freedesktop.UPower",
394 "/org/freedesktop/UPower", "org.freedesktop.UPower",433 "/org/freedesktop/UPower", "org.freedesktop.UPower",
395 test_mode_ ? G_BUS_TYPE_SESSION : G_BUS_TYPE_SYSTEM);434 test_mode_ ? G_BUS_TYPE_SESSION : G_BUS_TYPE_SYSTEM,
435 DEFAULT_CALL_FLAGS);
396436
397 proxy->CallBegin(method, nullptr, [proxy, cb] (GVariant *ret, glib::Error const& e) {437 proxy->CallBegin(method, nullptr, [proxy, cb] (GVariant *ret, glib::Error const& e) {
398 if (e)438 if (e)
@@ -403,7 +443,7 @@
403 {443 {
404 cb(ret);444 cb(ret);
405 }445 }
406 });446 }, cancellable_);
407}447}
408448
409void GnomeManager::Impl::CallLogindMethod(std::string const& method, GVariant* parameters, glib::DBusProxy::CallFinishedCallback const& cb)449void GnomeManager::Impl::CallLogindMethod(std::string const& method, GVariant* parameters, glib::DBusProxy::CallFinishedCallback const& cb)
@@ -411,7 +451,8 @@
411 auto proxy = std::make_shared<glib::DBusProxy>(test_mode_ ? testing::DBUS_NAME : "org.freedesktop.login1",451 auto proxy = std::make_shared<glib::DBusProxy>(test_mode_ ? testing::DBUS_NAME : "org.freedesktop.login1",
412 "/org/freedesktop/login1",452 "/org/freedesktop/login1",
413 "org.freedesktop.login1.Manager",453 "org.freedesktop.login1.Manager",
414 test_mode_ ? G_BUS_TYPE_SESSION : G_BUS_TYPE_SYSTEM);454 test_mode_ ? G_BUS_TYPE_SESSION : G_BUS_TYPE_SYSTEM,
455 DEFAULT_CALL_FLAGS);
415456
416 // By passing the proxy to the lambda we ensure that it will be smartly handled457 // By passing the proxy to the lambda we ensure that it will be smartly handled
417 proxy->CallBegin(method, parameters, [proxy, cb, method] (GVariant* ret, glib::Error const& e) {458 proxy->CallBegin(method, parameters, [proxy, cb, method] (GVariant* ret, glib::Error const& e) {
@@ -424,7 +465,7 @@
424 {465 {
425 cb(ret, e);466 cb(ret, e);
426 }467 }
427 });468 }, cancellable_);
428}469}
429470
430void GnomeManager::Impl::CallConsoleKitMethod(std::string const& method, GVariant* parameters)471void GnomeManager::Impl::CallConsoleKitMethod(std::string const& method, GVariant* parameters)
@@ -432,7 +473,8 @@
432 auto proxy = std::make_shared<glib::DBusProxy>(test_mode_ ? testing::DBUS_NAME : "org.freedesktop.ConsoleKit",473 auto proxy = std::make_shared<glib::DBusProxy>(test_mode_ ? testing::DBUS_NAME : "org.freedesktop.ConsoleKit",
433 "/org/freedesktop/ConsoleKit/Manager",474 "/org/freedesktop/ConsoleKit/Manager",
434 "org.freedesktop.ConsoleKit.Manager",475 "org.freedesktop.ConsoleKit.Manager",
435 test_mode_ ? G_BUS_TYPE_SESSION : G_BUS_TYPE_SYSTEM);476 test_mode_ ? G_BUS_TYPE_SESSION : G_BUS_TYPE_SYSTEM,
477 DEFAULT_CALL_FLAGS);
436478
437 // By passing the proxy to the lambda we ensure that it will be smartly handled479 // By passing the proxy to the lambda we ensure that it will be smartly handled
438 proxy->CallBegin(method, parameters, [this, proxy] (GVariant*, glib::Error const& e) {480 proxy->CallBegin(method, parameters, [this, proxy] (GVariant*, glib::Error const& e) {
@@ -440,7 +482,7 @@
440 {482 {
441 LOG_ERROR(logger) << "Fallback call failed: " << e.Message();483 LOG_ERROR(logger) << "Fallback call failed: " << e.Message();
442 }484 }
443 });485 }, cancellable_);
444}486}
445487
446void GnomeManager::Impl::CallDisplayManagerSeatMethod(std::string const& method, GVariant* parameters)488void GnomeManager::Impl::CallDisplayManagerSeatMethod(std::string const& method, GVariant* parameters)
@@ -450,13 +492,14 @@
450 auto proxy = std::make_shared<glib::DBusProxy>(test_mode_ ? testing::DBUS_NAME : "org.freedesktop.DisplayManager",492 auto proxy = std::make_shared<glib::DBusProxy>(test_mode_ ? testing::DBUS_NAME : "org.freedesktop.DisplayManager",
451 glib::gchar_to_string(xdg_seat_path),493 glib::gchar_to_string(xdg_seat_path),
452 "org.freedesktop.DisplayManager.Seat",494 "org.freedesktop.DisplayManager.Seat",
453 test_mode_ ? G_BUS_TYPE_SESSION : G_BUS_TYPE_SYSTEM);495 test_mode_ ? G_BUS_TYPE_SESSION : G_BUS_TYPE_SYSTEM,
496 DEFAULT_CALL_FLAGS);
454 proxy->CallBegin(method, parameters, [this, proxy] (GVariant*, glib::Error const& e) {497 proxy->CallBegin(method, parameters, [this, proxy] (GVariant*, glib::Error const& e) {
455 if (e)498 if (e)
456 {499 {
457 LOG_ERROR(logger) << "DisplayManager Seat call failed: " << e.Message();500 LOG_ERROR(logger) << "DisplayManager Seat call failed: " << e.Message();
458 }501 }
459 });502 }, cancellable_);
460}503}
461504
462void GnomeManager::Impl::LockScreen(bool prompt)505void GnomeManager::Impl::LockScreen(bool prompt)
@@ -509,7 +552,7 @@
509 glib::Variant inhibitors(g_dbus_connection_call_sync(bus, test_mode_ ? testing::DBUS_NAME.c_str() : "org.gnome.SessionManager",552 glib::Variant inhibitors(g_dbus_connection_call_sync(bus, test_mode_ ? testing::DBUS_NAME.c_str() : "org.gnome.SessionManager",
510 "/org/gnome/SessionManager", "org.gnome.SessionManager",553 "/org/gnome/SessionManager", "org.gnome.SessionManager",
511 "IsInhibited", g_variant_new("(u)", Inhibited::LOGOUT), nullptr,554 "IsInhibited", g_variant_new("(u)", Inhibited::LOGOUT), nullptr,
512 G_DBUS_CALL_FLAGS_NONE, 500, nullptr, &error));555 G_DBUS_CALL_FLAGS_NONE, 500, cancellable_, &error));
513556
514 if (error)557 if (error)
515 {558 {
@@ -532,13 +575,53 @@
532 auto group = getgrnam(group_name.c_str());575 auto group = getgrnam(group_name.c_str());
533576
534 if (group && group->gr_mem)577 if (group && group->gr_mem)
578 {
535 for (int i = 0; group->gr_mem[i]; ++i)579 for (int i = 0; group->gr_mem[i]; ++i)
580 {
536 if (g_strcmp0(group->gr_mem[i], user_name.c_str()) == 0)581 if (g_strcmp0(group->gr_mem[i], user_name.c_str()) == 0)
537 return true;582 return true;
583 }
584 }
538585
539 return false;586 return false;
540}587}
541588
589bool GnomeManager::Impl::AutomaticLogin()
590{
591 glib::Error error;
592 glib::Object<GDBusConnection> bus(g_bus_get_sync(G_BUS_TYPE_SYSTEM, nullptr, &error));
593
594 if (error)
595 {
596 LOG_ERROR(logger) << "Impossible to get the system bus to know if auto-login is enabled: " << error;
597 return false;
598 }
599
600 glib::Variant user_path(g_dbus_connection_call_sync(bus, "org.freedesktop.Accounts",
601 "/org/freedesktop/Accounts", "org.freedesktop.Accounts",
602 "FindUserByName", g_variant_new("(s)",g_get_user_name()), nullptr,
603 G_DBUS_CALL_FLAGS_NONE, 500, cancellable_, &error));
604
605 if (error)
606 {
607 LOG_ERROR(logger) << "Impossible to get the user path: " << error;
608 return false;
609 }
610
611 glib::Variant autologin(g_dbus_connection_call_sync(bus, "org.freedesktop.Accounts",
612 user_path.GetObjectPath().c_str(), "org.freedesktop.DBus.Properties",
613 "Get", g_variant_new("(ss)", "org.freedesktop.Accounts.User", "AutomaticLogin"), nullptr,
614 G_DBUS_CALL_FLAGS_NONE, 500, cancellable_, &error));
615
616 if (error)
617 {
618 LOG_ERROR(logger) << "Impossible to get the AutomaticLogin property: " << error;
619 return false;
620 }
621
622 return autologin.GetBool();
623}
624
542// Public implementation625// Public implementation
543626
544GnomeManager::GnomeManager()627GnomeManager::GnomeManager()
@@ -577,6 +660,11 @@
577 impl_->UserIconFile(callback);660 impl_->UserIconFile(callback);
578}661}
579662
663bool GnomeManager::AutomaticLogin() const
664{
665 return impl_->AutomaticLogin();
666}
667
580void GnomeManager::ScreenSaverActivate()668void GnomeManager::ScreenSaverActivate()
581{669{
582 screensaver_requested.emit(true);670 screensaver_requested.emit(true);
583671
=== modified file 'UnityCore/GnomeSessionManager.h'
--- UnityCore/GnomeSessionManager.h 2015-12-03 05:57:00 +0000
+++ UnityCore/GnomeSessionManager.h 2017-12-01 18:43:57 +0000
@@ -37,6 +37,7 @@
37 std::string UserName() const;37 std::string UserName() const;
38 std::string HostName() const;38 std::string HostName() const;
39 void UserIconFile(std::function<void(std::string const&)> const&) const;39 void UserIconFile(std::function<void(std::string const&)> const&) const;
40 bool AutomaticLogin() const;
4041
41 void ScreenSaverActivate();42 void ScreenSaverActivate();
42 void ScreenSaverDeactivate();43 void ScreenSaverDeactivate();
4344
=== modified file 'UnityCore/GnomeSessionManagerImpl.h'
--- UnityCore/GnomeSessionManagerImpl.h 2015-12-03 05:57:00 +0000
+++ UnityCore/GnomeSessionManagerImpl.h 2017-12-01 18:43:57 +0000
@@ -46,6 +46,8 @@
46 Impl(GnomeManager* parent, bool test_mode = false);46 Impl(GnomeManager* parent, bool test_mode = false);
47 ~Impl();47 ~Impl();
4848
49 void SetupLogin1Proxy(std::string const& session_path);
50
49 void ConfirmLogout();51 void ConfirmLogout();
50 void ConfirmReboot();52 void ConfirmReboot();
51 void ConfirmShutdown();53 void ConfirmShutdown();
@@ -67,6 +69,7 @@
67 void UpdateHaveOtherOpenSessions();69 void UpdateHaveOtherOpenSessions();
6870
69 bool IsUserInGroup(std::string const& user_name, std::string const& group_name);71 bool IsUserInGroup(std::string const& user_name, std::string const& group_name);
72 bool AutomaticLogin();
7073
71 GnomeManager* manager_;74 GnomeManager* manager_;
72 bool test_mode_;75 bool test_mode_;
@@ -82,6 +85,7 @@
82 glib::DBusProxy::Ptr dm_proxy_;85 glib::DBusProxy::Ptr dm_proxy_;
83 glib::DBusProxy::Ptr dm_seat_proxy_;86 glib::DBusProxy::Ptr dm_seat_proxy_;
8487
88 glib::Cancellable cancellable_;
85 int open_sessions_;89 int open_sessions_;
86};90};
8791
8892
=== modified file 'UnityCore/SessionManager.h'
--- UnityCore/SessionManager.h 2016-03-31 09:51:33 +0000
+++ UnityCore/SessionManager.h 2017-12-01 18:43:57 +0000
@@ -46,6 +46,7 @@
46 virtual std::string UserName() const = 0;46 virtual std::string UserName() const = 0;
47 virtual std::string HostName() const = 0;47 virtual std::string HostName() const = 0;
48 virtual void UserIconFile(std::function<void(std::string const&)> const&) const = 0;48 virtual void UserIconFile(std::function<void(std::string const&)> const&) const = 0;
49 virtual bool AutomaticLogin() const = 0;
4950
50 virtual void ScreenSaverActivate() = 0;51 virtual void ScreenSaverActivate() = 0;
51 virtual void ScreenSaverDeactivate() = 0;52 virtual void ScreenSaverDeactivate() = 0;
5253
=== modified file 'UnityCore/Variant.cpp'
--- UnityCore/Variant.cpp 2013-11-19 20:28:13 +0000
+++ UnityCore/Variant.cpp 2017-12-01 18:43:57 +0000
@@ -174,6 +174,36 @@
174 return result ? result : "";174 return result ? result : "";
175}175}
176176
177std::string Variant::GetObjectPath() const
178{
179 const gchar *result = nullptr;
180
181 if (!variant_)
182 return "";
183
184 if (g_variant_is_of_type(variant_, G_VARIANT_TYPE_OBJECT_PATH))
185 {
186 // g_variant_get_string doesn't duplicate the string
187 result = g_variant_get_string(variant_, nullptr);
188 }
189 else if (g_variant_is_of_type(variant_, G_VARIANT_TYPE("(o)")))
190 {
191 // As we're using the '&' prefix we don't need to free the string!
192 g_variant_get(variant_, "(&o)", &result);
193 }
194 else
195 {
196 auto const& variant = get_variant(variant_);
197 if (variant)
198 return variant.GetObjectPath();
199
200 LOG_ERROR(logger) << "You're trying to extract a 'o' from a variant which is of type '"
201 << g_variant_type_peek_string(g_variant_get_type(variant_)) << "'";
202 }
203
204 return result ? result : "";
205}
206
177template <typename TYPE, typename GTYPE>207template <typename TYPE, typename GTYPE>
178TYPE get_numeric_value(GVariant *variant_, const char *type_str, const char *fallback_type_str)208TYPE get_numeric_value(GVariant *variant_, const char *type_str, const char *fallback_type_str)
179{209{
180210
=== modified file 'UnityCore/Variant.h'
--- UnityCore/Variant.h 2013-11-19 20:28:13 +0000
+++ UnityCore/Variant.h 2017-12-01 18:43:57 +0000
@@ -68,6 +68,7 @@
68 ~Variant();68 ~Variant();
6969
70 std::string GetString() const;70 std::string GetString() const;
71 std::string GetObjectPath() const;
71 unsigned char GetByte() const;72 unsigned char GetByte() const;
72 int16_t GetInt16() const;73 int16_t GetInt16() const;
73 uint16_t GetUInt16() const;74 uint16_t GetUInt16() const;
7475
=== modified file 'config.h.cmake'
--- config.h.cmake 2016-02-09 01:26:22 +0000
+++ config.h.cmake 2017-12-01 18:43:57 +0000
@@ -2,8 +2,9 @@
2#define CONFIG_H2#define CONFIG_H
33
4#cmakedefine PREFIXPATH "@PREFIXPATH@"4#cmakedefine PREFIXPATH "@PREFIXPATH@"
5#cmakedefine UNITYDATADIR "@UNITYDATADIR@"5#cmakedefine UNITY_DATADIR "@UNITY_DATADIR@"
6#cmakedefine UNITYLIBDIR "@UNITYLIBDIR@"6#cmakedefine UNITY_LIBDIR "@UNITY_LIBDIR@"
7#cmakedefine UNITY_INSTALL_LIBDIR "@UNITY_INSTALL_LIBDIR@"
7#cmakedefine PKGDATADIR "@PKGDATADIR@"8#cmakedefine PKGDATADIR "@PKGDATADIR@"
8#cmakedefine LOCALE_DIR "@LOCALE_DIR@"9#cmakedefine LOCALE_DIR "@LOCALE_DIR@"
9#cmakedefine VERSION "@VERSION@"10#cmakedefine VERSION "@VERSION@"
1011
=== modified file 'dash/ResultRendererTile.cpp'
--- dash/ResultRendererTile.cpp 2016-02-09 18:16:51 +0000
+++ dash/ResultRendererTile.cpp 2017-12-01 18:43:57 +0000
@@ -273,7 +273,7 @@
273 std::string const& icon_hint = row.icon_hint;273 std::string const& icon_hint = row.icon_hint;
274 std::string const& icon_name = !icon_hint.empty() ? icon_hint : DEFAULT_GICON;274 std::string const& icon_name = !icon_hint.empty() ? icon_hint : DEFAULT_GICON;
275275
276 glib::Object<GIcon> icon(g_icon_new_for_string(icon_name.c_str(), NULL));276 glib::Object<GIcon> icon(g_icon_new_for_string(icon_name.c_str(), nullptr));
277 TextureContainer* container = row.renderer<TextureContainer*>();277 TextureContainer* container = row.renderer<TextureContainer*>();
278278
279 if (container)279 if (container)
280280
=== modified file 'data/CMakeLists.txt'
--- data/CMakeLists.txt 2014-05-27 07:53:19 +0000
+++ data/CMakeLists.txt 2017-12-01 18:43:57 +0000
@@ -1,1 +1,37 @@
1add_subdirectory(pam)
2\ No newline at end of file1\ No newline at end of file
2add_subdirectory(pam)
3
4# GSettings Schema
5SET (UNITY_SCHEMAS "com.canonical.Unity.gschema.xml")
6SET (UNITY_TEST_SCHEMAS "external.gschema.xml")
7
8# Have an option to not install the schema into where GLib is
9option (GSETTINGS_LOCALINSTALL "Install GSettings Schemas locally instead of to the GLib prefix" OFF)
10if (GSETTINGS_LOCALINSTALL)
11 SET (GSETTINGS_DIR "${CMAKE_INSTALL_DATADIR}/glib-2.0/schemas/")
12else (GSETTINGS_LOCALINSTALL)
13 execute_process (COMMAND ${PKG_CONFIG_EXECUTABLE} glib-2.0 --variable prefix OUTPUT_VARIABLE _glib_prefix OUTPUT_STRIP_TRAILING_WHITESPACE)
14 SET (GSETTINGS_DIR "${_glib_prefix}/share/glib-2.0/schemas/")
15endif (GSETTINGS_LOCALINSTALL)
16
17# Run the validator and error if it fails
18execute_process (COMMAND ${PKG_CONFIG_EXECUTABLE} gio-2.0 --variable glib_compile_schemas OUTPUT_VARIABLE _glib_comple_schemas OUTPUT_STRIP_TRAILING_WHITESPACE)
19execute_process (COMMAND ${_glib_comple_schemas} --dry-run --schema-file=${CMAKE_CURRENT_SOURCE_DIR}/${UNITY_SCHEMAS} ERROR_VARIABLE _schemas_invalid OUTPUT_STRIP_TRAILING_WHITESPACE)
20
21if (_schemas_invalid)
22 message (SEND_ERROR "Schema validation error: ${_schemas_invalid}")
23endif (_schemas_invalid)
24
25# Actually install and recomple schemas
26message (STATUS "GSettings schemas will be installed into ${GSETTINGS_DIR}")
27install (FILES ${UNITY_SCHEMAS} DESTINATION ${GSETTINGS_DIR} OPTIONAL)
28install (CODE "message (STATUS \"Compiling GSettings schemas\")")
29install (CODE "execute_process (COMMAND ${_glib_comple_schemas} ${GSETTINGS_DIR})")
30
31# Settings for testing
32configure_file (${CMAKE_SOURCE_DIR}/data/${UNITY_SCHEMAS} ${CMAKE_BINARY_DIR}/settings/${UNITY_SCHEMAS})
33configure_file (${CMAKE_SOURCE_DIR}/tests/data/${UNITY_TEST_SCHEMAS} ${CMAKE_BINARY_DIR}/settings/${UNITY_TEST_SCHEMAS})
34execute_process (COMMAND ${_glib_comple_schemas} ${CMAKE_BINARY_DIR}/settings)
35
36# Upstart
37configure_file(unity7.conf.in ${CMAKE_CURRENT_BINARY_DIR}/unity7.conf)
38install(FILES ${CMAKE_CURRENT_BINARY_DIR}/unity7.conf DESTINATION ${CMAKE_INSTALL_DATADIR}/upstart/sessions)
339
=== renamed file 'com.canonical.Unity.gschema.xml' => 'data/com.canonical.Unity.gschema.xml'
--- com.canonical.Unity.gschema.xml 2016-06-28 16:23:15 +0000
+++ data/com.canonical.Unity.gschema.xml 2017-12-01 18:43:57 +0000
@@ -100,6 +100,11 @@
100 when authenticating. Only do this if you have account100 when authenticating. Only do this if you have account
101 configured properly on your system.</description>101 configured properly on your system.</description>
102 </key>102 </key>
103 <key type="b" name="lowgfx">
104 <default>false</default>
105 <summary>Enable/Disable Low Graphics Mode</summary>
106 <description>Whether Unity runs in Low Graphics Mode.</description>
107 </key>
103 </schema>108 </schema>
104 <schema path="/com/canonical/unity/interface/" id="com.canonical.Unity.Interface" gettext-domain="unity">109 <schema path="/com/canonical/unity/interface/" id="com.canonical.Unity.Interface" gettext-domain="unity">
105 <key type="d" name="text-scale-factor">110 <key type="d" name="text-scale-factor">
106111
=== renamed file 'unity7.conf.in' => 'data/unity7.conf.in'
--- unity7.conf.in 2016-08-01 08:37:57 +0000
+++ data/unity7.conf.in 2017-12-01 18:43:57 +0000
@@ -5,25 +5,8 @@
5stop on desktop-end5stop on desktop-end
66
7pre-start script7pre-start script
8 # If gnome-session is going to start compiz,8 @UNITY_LIBDIR@/upstart-prestart-check
9 # we don't want to be the ones doing it.9 @UNITY_LIBDIR@/compiz-profile-selector
10
11 if grep -q compiz /usr/share/gnome-session/sessions/ubuntu.session ; then
12 echo "GNOME Session is starting Compiz"
13 stop ; exit 0
14 fi
15
16 compiz_profile="ubuntu"
17
18 if ! /usr/lib/nux/unity_support_test -p; then
19 compiz_profile="ubuntu-lowgfx"
20 fi
21
22 echo "Using compiz profile '$compiz_profile'"
23 initctl set-env -g COMPIZ_CONFIG_PROFILE="$compiz_profile"
24 export COMPIZ_CONFIG_PROFILE="$compiz_profile"
25
26 ${CMAKE_INSTALL_FULL_LIBDIR}/unity/unity-active-plugins-safety-check
27end script10end script
2811
29respawn12respawn
3013
=== modified file 'debian/changelog'
--- debian/changelog 2016-09-06 23:17:39 +0000
+++ debian/changelog 2017-12-01 18:43:57 +0000
@@ -1,3 +1,81 @@
1unity (7.4.5+16.04) UNRELEASED; urgency=medium
2
3 [ Marco Trevisan (Treviño) ]
4 * InputMonitor: add an unity class that monitors XInput2 events and
5 converts them to XEvent
6 * EdgeBarrierController: use InputMonitor to get the barrier events
7 instead of relying on its implementation
8 * DecorationsMenuLayout: use input monitor for menu scrubbing (LP:
9 #1614597)
10 * PanelView: use InputMonitor to track menu events
11 * LockScreenPanel: use InputMonitor events instead of mouse polling
12 for menu scrubbing
13 * MenuManager: add support for mouse trackers with triangle algorithm
14 support (LP: #1618405)
15 * PanelView: scale gradient refinement properly
16 * PanelService: don't allow to deactivate menus if they've been opened
17 too shortly
18 * LockScreenController: ignore icon_paths_changed signal in
19 menumanager for Lockscreen
20 * LockScreenController: use InputMonitor to get all the events and
21 hide the Blank Window (LP: #1321075)
22 * LockScreenController: use input monitor to get the events to switch
23 monitor (LP: #1316862)
24 * LauncherOptions: use track_obj to manage option changes (LP:
25 #1622995)
26 * UnityScreen: toggle gestures recognition on lock (LP: #1645507)
27 * GnomeSessionManager: add gcancellable to instance and use it for
28 calls with temporary proxies
29 * BackgroundSettings: use gnome-bg to generate textures with proper
30 scaling (LP: #1666359)
31 * UnityWindow: safely check validity of UnityWindow from scaled one
32 (LP: #1659847)
33 * Panel: ensure the menu-manager tracker is updated to match monitor
34 (LP: #1671432)
35 * compiz-profile-setter: tool to update the current profile and use in
36 systemd and Unity settings (LP: #1668950)
37 * BGHash, UnityScreen: get desktop averageColor from compiz
38 * Launcher: disable or reduce most icon effects on lowgfx (LP:
39 #1700859)
40 * PanelController: ensure we disconnect from signals on destruction
41 (LP: #1504870)
42 * tools: add migration script to set the default values for unity-
43 lowgfx profile
44
45 [ Andrea Azzarone ]
46 * Properly handle the file manager copy dialog in
47 FileManagerLauncherIcon and in StorageLauncherIcon. (LP: #1575452,
48 LP: #1609845)
49 * Correctly position the force quit dialog when scaling is different
50 than 1.0 (LP: #1637991)
51 * GnomeSession: Retrieve the session id using dbus if $XDG_SESSION_ID
52 is not set
53 * Round gtk scaling factor to closest integer. (LP: #1649736)
54 * Keep the screen locked if rebooting with autologin. (LP: #1600389)
55 * Use g_mkdir_with_parents instead of mkdir.
56 * Lockscreen: always draw the background-color in the lockscreen (LP:
57 #1702701)
58 * Refactor the way UserAuthenticator is created and passed around.
59 Handle failures to create new threads and fallback to a "Switch to
60 greeter..." button in case of failure. (LP: #1311316)
61 * Wait until the color buffer is cleared before suspending. (LP:
62 #1532508)
63
64 [ Kai-Heng Feng ]
65 * UnitySettings: If scale-factor is not set, find and set right scale
66 for HiDPI displays.
67
68 [ Eleni Maria Stea ]
69 * shouldn't create blur rectangles when there's no blur, skips the
70 blur rects processing in low gfx.
71 * removes lowgfx option from ccsm, reads the "lowgfx" gsetting (LP:
72 #1668950)
73
74 [ Nick Dedekind ]
75 * Fixed tooltip scaling issues. (LP: #1673950)
76
77 -- Marco Trevisan (Treviño) <marco@ubuntu.com> Tue, 04 Jul 2017 18:12:47 +0200
78
1unity (7.4.0+16.04.20160906-0ubuntu1) xenial; urgency=medium79unity (7.4.0+16.04.20160906-0ubuntu1) xenial; urgency=medium
280
3 [ Marco Trevisan (Treviño) ]81 [ Marco Trevisan (Treviño) ]
482
=== modified file 'debian/control'
--- debian/control 2016-08-01 08:37:57 +0000
+++ debian/control 2017-12-01 18:43:57 +0000
@@ -3,9 +3,10 @@
3Priority: optional3Priority: optional
4Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>4Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
5Build-Depends: cmake,5Build-Depends: cmake,
6 compiz-dev (>= 1:0.9.12.2),6 compiz-dev (>= 1:0.9.12.3+16.04.20170704),
7 debhelper (>= 9.0.0~),7 debhelper (>= 9.0.0~),
8 dbus-test-runner,8 dbus-test-runner,
9 dbus-x11,
9 dh-migrations,10 dh-migrations,
10 dh-translations (>= 94),11 dh-translations (>= 94),
11 dh-python,12 dh-python,
1213
=== modified file 'debian/rules'
--- debian/rules 2016-02-09 12:21:08 +0000
+++ debian/rules 2017-12-01 18:43:57 +0000
@@ -6,6 +6,7 @@
6DEB_HOST_ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH)6DEB_HOST_ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH)
7DEB_HOST_GNU_TYPE := $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)7DEB_HOST_GNU_TYPE := $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
8gles2_architectures := armel armhf8gles2_architectures := armel armhf
9disable_tests_archs := powerpc
910
10DEB_VERSION := $(shell dpkg-parsechangelog | egrep '^Version:' | cut -f 2 -d ' ')11DEB_VERSION := $(shell dpkg-parsechangelog | egrep '^Version:' | cut -f 2 -d ' ')
1112
@@ -53,8 +54,10 @@
5354
54override_dh_auto_test:55override_dh_auto_test:
55ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))56ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
57ifneq ($(DEB_HOST_ARCH),$(findstring $(DEB_HOST_ARCH), $(disable_tests_archs)))
56 make -C obj-$(DEB_HOST_GNU_TYPE) check-headless58 make -C obj-$(DEB_HOST_GNU_TYPE) check-headless
57endif59endif
60endif
5861
59%:62%:
60 dh $@ --with translations,quilt,python2,python3,migrations --parallel63 dh $@ --with translations,quilt,python2,python3,migrations --parallel
6164
=== modified file 'debian/unity.install'
--- debian/unity.install 2016-08-01 08:37:57 +0000
+++ debian/unity.install 2017-12-01 18:43:57 +0000
@@ -2,6 +2,9 @@
2usr/bin2usr/bin
3usr/lib/*/compiz/libunity*.so3usr/lib/*/compiz/libunity*.so
4usr/lib/*/unity/unity-active-plugins-safety-check4usr/lib/*/unity/unity-active-plugins-safety-check
5usr/lib/*/unity/compiz-config-profile-setter
6usr/lib/*/unity/compiz-profile-selector
7usr/lib/*/unity/*-prestart-check
5usr/share/man/*/unity.18usr/share/man/*/unity.1
6usr/share/compiz9usr/share/compiz
7usr/share/locale10usr/share/locale
811
=== modified file 'debian/unity.migrations'
--- debian/unity.migrations 2016-02-22 20:34:21 +0000
+++ debian/unity.migrations 2017-12-01 18:43:57 +0000
@@ -2,3 +2,4 @@
2tools/migration-scripts/02_unity_setup_text_scale_factor2tools/migration-scripts/02_unity_setup_text_scale_factor
3tools/migration-scripts/03_unity_first_run_stamp_move3tools/migration-scripts/03_unity_first_run_stamp_move
4tools/migration-scripts/04_unity_update_software_center_desktop_file4tools/migration-scripts/04_unity_update_software_center_desktop_file
5tools/migration-scripts/06_unity_set_lowgfx_mode_settings_v1
56
=== modified file 'decorations/DecoratedWindow.cpp'
--- decorations/DecoratedWindow.cpp 2016-08-06 16:24:45 +0000
+++ decorations/DecoratedWindow.cpp 2017-12-01 18:43:57 +0000
@@ -37,7 +37,6 @@
37{37{
38namespace38namespace
39{39{
40const std::string MENUS_PANEL_NAME = "WindowLIM";
41const int SHADOW_BLUR_MARGIN_FACTOR = 2;40const int SHADOW_BLUR_MARGIN_FACTOR = 2;
42}41}
4342
@@ -55,7 +54,6 @@
55 , deco_elements_(cu::DecorationElement::NONE)54 , deco_elements_(cu::DecorationElement::NONE)
56 , last_mwm_decor_(win_->mwmDecor())55 , last_mwm_decor_(win_->mwmDecor())
57 , last_actions_(win_->actions())56 , last_actions_(win_->actions())
58 , panel_id_(MENUS_PANEL_NAME + std::to_string(win_->id()))
59 , cv_(Settings::Instance().em())57 , cv_(Settings::Instance().em())
60{58{
61 active.changed.connect([this] (bool active) {59 active.changed.connect([this] (bool active) {
@@ -932,18 +930,13 @@
932 sliding_layout->mouse_owner = grab_edge_->mouse_owner();930 sliding_layout->mouse_owner = grab_edge_->mouse_owner();
933}931}
934932
935inline std::string const& Window::Impl::GetMenusPanelID() const
936{
937 return panel_id_;
938}
939
940void Window::Impl::UnsetAppMenu()933void Window::Impl::UnsetAppMenu()
941{934{
942 if (!menus_)935 if (!menus_)
943 return;936 return;
944937
945 auto const& indicators = manager_->impl_->menu_manager_->Indicators();938 auto const& indicators = manager_->impl_->menu_manager_->Indicators();
946 indicators->SyncGeometries(GetMenusPanelID(), indicator::EntryLocationMap());939 indicators->SyncGeometries(menus_->MenubarId(), indicator::EntryLocationMap());
947 sliding_layout_->SetInputItem(nullptr);940 sliding_layout_->SetInputItem(nullptr);
948 grab_mouse_changed_->disconnect();941 grab_mouse_changed_->disconnect();
949}942}
@@ -956,7 +949,7 @@
956 auto const& indicators = manager_->impl_->menu_manager_->Indicators();949 auto const& indicators = manager_->impl_->menu_manager_->Indicators();
957 indicator::EntryLocationMap map;950 indicator::EntryLocationMap map;
958 menus_->ChildrenGeometries(map);951 menus_->ChildrenGeometries(map);
959 indicators->SyncGeometries(GetMenusPanelID(), map);952 indicators->SyncGeometries(menus_->MenubarId(), map);
960}953}
961954
962bool Window::Impl::ActivateMenu(std::string const& entry_id)955bool Window::Impl::ActivateMenu(std::string const& entry_id)
963956
=== modified file 'decorations/DecorationsForceQuitDialog.cpp'
--- decorations/DecorationsForceQuitDialog.cpp 2016-08-06 16:24:55 +0000
+++ decorations/DecorationsForceQuitDialog.cpp 2017-12-01 18:43:57 +0000
@@ -478,9 +478,11 @@
478478
479 void UpdateDialogPosition()479 void UpdateDialogPosition()
480 {480 {
481 gint scale = gtk_widget_get_scale_factor(dialog_);
482 scale = std::max<gint>(1, scale);
481 auto const& win_geo = win_->inputRect();483 auto const& win_geo = win_->inputRect();
482 nux::Size walloc(gtk_widget_get_allocated_width(dialog_), gtk_widget_get_allocated_height(dialog_));484 nux::Size walloc(gtk_widget_get_allocated_width(dialog_) * scale, gtk_widget_get_allocated_height(dialog_) * scale);
483 gtk_window_move(GTK_WINDOW(dialog_), win_geo.centerX() - walloc.width/2, win_geo.centerY() - walloc.height/2);485 gtk_window_move(GTK_WINDOW(dialog_), (win_geo.centerX() - walloc.width/2) / scale, (win_geo.centerY() - walloc.height/2) / scale);
484 }486 }
485487
486 ForceQuitDialog* parent_;488 ForceQuitDialog* parent_;
487489
=== modified file 'decorations/DecorationsMenuLayout.cpp'
--- decorations/DecorationsMenuLayout.cpp 2015-02-03 10:04:17 +0000
+++ decorations/DecorationsMenuLayout.cpp 2017-12-01 18:43:57 +0000
@@ -25,6 +25,10 @@
25{25{
26namespace decoration26namespace decoration
27{27{
28namespace
29{
30const std::string MENUS_PANEL_NAME = "WindowLIM";
31}
2832
29using namespace indicator;33using namespace indicator;
3034
@@ -33,8 +37,8 @@
33 , show_now(false)37 , show_now(false)
34 , menu_manager_(menu)38 , menu_manager_(menu)
35 , win_(win)39 , win_(win)
36 , last_pointer_(-1, -1)
37 , dropdown_(std::make_shared<MenuDropdown>(menu_manager_->Indicators(), win))40 , dropdown_(std::make_shared<MenuDropdown>(menu_manager_->Indicators(), win))
41 , menubar_id_(MENUS_PANEL_NAME + std::to_string(win_->id()))
38{42{
39 visible = false;43 visible = false;
40}44}
@@ -91,6 +95,11 @@
91 Relayout();95 Relayout();
92}96}
9397
98std::string const& MenuLayout::MenubarId() const
99{
100 return menubar_id_;
101}
102
94bool MenuLayout::ActivateMenu(std::string const& entry_id)103bool MenuLayout::ActivateMenu(std::string const& entry_id)
95{104{
96 MenuEntry::Ptr target;105 MenuEntry::Ptr target;
@@ -117,16 +126,29 @@
117 if (!activated)126 if (!activated)
118 activated = dropdown_->ActivateChild(target);127 activated = dropdown_->ActivateChild(target);
119128
120 if (activated)
121 {
122 // Since this generally happens on keyboard activation we need to avoid that
123 // the mouse position would interfere with this
124 last_pointer_.set(pointerX, pointerY);
125 }
126
127 return activated;129 return activated;
128}130}
129131
132bool MenuLayout::ActivateMenu(CompPoint const& pos)
133{
134 if (!Geometry().contains(pos))
135 return false;
136
137 for (auto const& item : items_)
138 {
139 if (!item->visible() || !item->sensitive())
140 continue;
141
142 if (item->Geometry().contains(pos))
143 {
144 std::static_pointer_cast<MenuEntry>(item)->ShowMenu(1);
145 return true;
146 }
147 }
148
149 return false;
150}
151
130void MenuLayout::OnEntryMouseOwnershipChanged(bool owner)152void MenuLayout::OnEntryMouseOwnershipChanged(bool owner)
131{153{
132 mouse_owner = owner;154 mouse_owner = owner;
@@ -154,39 +176,15 @@
154{176{
155 active = actived;177 active = actived;
156178
157 if (active && !pointer_tracker_ && items_.size() > 1)179 if (active && items_.size() > 1)
158 {180 {
159 pointer_tracker_.reset(new glib::Timeout(16));181 menu_manager_->RegisterTracker(menubar_id_, (sigc::track_obj([this] (int x, int y, double speed) {
160 pointer_tracker_->Run([this] {182 ActivateMenu(CompPoint(x, y));
161 Window win;183 }, *this)));
162 int i, x, y;
163 unsigned int ui;
164
165 XQueryPointer(screen->dpy(), screen->root(), &win, &win, &x, &y, &i, &i, &ui);
166
167 if (last_pointer_.x() != x || last_pointer_.y() != y)
168 {
169 last_pointer_.set(x, y);
170
171 for (auto const& item : items_)
172 {
173 if (!item->visible() || !item->sensitive())
174 continue;
175
176 if (item->Geometry().contains(last_pointer_))
177 {
178 std::static_pointer_cast<MenuEntry>(item)->ShowMenu(1);
179 break;
180 }
181 }
182 }
183
184 return true;
185 });
186 }184 }
187 else if (!active)185 else if (!active)
188 {186 {
189 pointer_tracker_.reset();187 menu_manager_->UnregisterTracker(menubar_id_);
190 }188 }
191}189}
192190
193191
=== modified file 'decorations/DecorationsMenuLayout.h'
--- decorations/DecorationsMenuLayout.h 2014-02-13 03:01:30 +0000
+++ decorations/DecorationsMenuLayout.h 2017-12-01 18:43:57 +0000
@@ -42,7 +42,9 @@
4242
43 void Setup();43 void Setup();
44 bool ActivateMenu(std::string const& entry_id);44 bool ActivateMenu(std::string const& entry_id);
45 bool ActivateMenu(CompPoint const&);
45 void ChildrenGeometries(indicator::EntryLocationMap&) const;46 void ChildrenGeometries(indicator::EntryLocationMap&) const;
47 std::string const& MenubarId() const;
4648
47protected:49protected:
48 void DoRelayout() override;50 void DoRelayout() override;
@@ -55,10 +57,9 @@
5557
56 menu::Manager::Ptr menu_manager_;58 menu::Manager::Ptr menu_manager_;
57 CompWindow* win_;59 CompWindow* win_;
58 CompPoint last_pointer_;
59 glib::Source::UniquePtr pointer_tracker_;
60 glib::Source::UniquePtr show_now_timeout_;60 glib::Source::UniquePtr show_now_timeout_;
61 std::shared_ptr<MenuDropdown> dropdown_;61 std::shared_ptr<MenuDropdown> dropdown_;
62 std::string menubar_id_;
62};63};
6364
64} // decoration namespace65} // decoration namespace
6566
=== modified file 'decorations/DecorationsPriv.h'
--- decorations/DecorationsPriv.h 2016-08-06 16:24:45 +0000
+++ decorations/DecorationsPriv.h 2017-12-01 18:43:57 +0000
@@ -162,7 +162,6 @@
162 connection::Wrapper dpi_changed_;162 connection::Wrapper dpi_changed_;
163 connection::Wrapper grab_mouse_changed_;163 connection::Wrapper grab_mouse_changed_;
164 std::string last_title_;164 std::string last_title_;
165 std::string panel_id_;
166 std::vector<cu::SimpleTextureQuad> bg_textures_;165 std::vector<cu::SimpleTextureQuad> bg_textures_;
167 cu::PixmapTexture::Ptr shaped_shadow_pixmap_;166 cu::PixmapTexture::Ptr shaped_shadow_pixmap_;
168 std::shared_ptr<ForceQuitDialog> force_quit_;167 std::shared_ptr<ForceQuitDialog> force_quit_;
169168
=== modified file 'decorations/DecorationsWindowButton.cpp'
--- decorations/DecorationsWindowButton.cpp 2016-08-06 16:24:45 +0000
+++ decorations/DecorationsWindowButton.cpp 2017-12-01 18:43:57 +0000
@@ -45,7 +45,8 @@
4545
46void WindowButton::UpdateTexture()46void WindowButton::UpdateTexture()
47{47{
48 SetTexture(DataPool::Get()->ButtonTexture(scale(), type(), GetCurrentState()));48 if (auto tex = DataPool::Get()->ButtonTexture(scale(), type(), GetCurrentState()))
49 SetTexture(tex);
49}50}
5051
51WidgetState WindowButton::GetCurrentState() const52WidgetState WindowButton::GetCurrentState() const
5253
=== modified file 'launcher/EdgeBarrierController.cpp'
--- launcher/EdgeBarrierController.cpp 2015-12-23 09:29:24 +0000
+++ launcher/EdgeBarrierController.cpp 2017-12-01 18:43:57 +0000
@@ -25,6 +25,7 @@
25#include <NuxCore/Logger.h>25#include <NuxCore/Logger.h>
26#include "unity-shared/UnitySettings.h"26#include "unity-shared/UnitySettings.h"
27#include "unity-shared/UScreen.h"27#include "unity-shared/UScreen.h"
28#include "unity-shared/InputMonitor.h"
28#include "UnityCore/GLibSource.h"29#include "UnityCore/GLibSource.h"
2930
30namespace unity31namespace unity
@@ -36,50 +37,10 @@
36{37{
37 int const Y_BREAK_BUFFER = 20;38 int const Y_BREAK_BUFFER = 20;
38 int const X_BREAK_BUFFER = 20;39 int const X_BREAK_BUFFER = 20;
39 int const MAJOR = 2;
40 int const MINOR = 3;
41}
42
43DECLARE_LOGGER(logger, "unity.edge_barrier_controller");
44
45int GetXI2OpCode()
46{
47 Display *dpy = nux::GetGraphicsDisplay()->GetX11Display();
48
49 int opcode, event_base, error_base;
50 if (!XQueryExtension(dpy, "XFIXES",
51 &opcode,
52 &event_base,
53 &error_base))
54 {
55 LOG_ERROR(logger) << "Missing XFixes";
56 return -1;
57 }
58
59 if (!XQueryExtension (dpy, "XInputExtension",
60 &opcode,
61 &event_base,
62 &error_base))
63 {
64 LOG_ERROR(logger) << "Missing XInput";
65 return -1;
66 }
67
68 int maj = MAJOR;
69 int min = MINOR;
70
71 if (XIQueryVersion(dpy, &maj, &min) == BadRequest)
72 {
73 LOG_ERROR(logger) << "Need XInput version 2.3";
74 return -1;
75 }
76
77 return opcode;
78}40}
7941
80EdgeBarrierController::Impl::Impl(EdgeBarrierController *parent)42EdgeBarrierController::Impl::Impl(EdgeBarrierController *parent)
81 : xi2_opcode_(-1)43 : edge_overcome_pressure_(0)
82 , edge_overcome_pressure_(0)
83 , parent_(parent)44 , parent_(parent)
84{45{
85 UScreen *uscreen = UScreen::GetDefault();46 UScreen *uscreen = UScreen::GetDefault();
@@ -119,8 +80,6 @@
119 options->option_changed.connect(sigc::mem_fun(this, &EdgeBarrierController::Impl::OnOptionsChanged));80 options->option_changed.connect(sigc::mem_fun(this, &EdgeBarrierController::Impl::OnOptionsChanged));
120 SetupBarriers(UScreen::GetDefault()->GetMonitors());81 SetupBarriers(UScreen::GetDefault()->GetMonitors());
121 });82 });
122
123 xi2_opcode_ = GetXI2OpCode();
124}83}
12584
126EdgeBarrierController::Impl::~Impl()85EdgeBarrierController::Impl::~Impl()
@@ -202,36 +161,30 @@
202 }161 }
203}162}
204163
205void SetupXI2Events()
206{
207 Display *dpy = nux::GetGraphicsDisplay()->GetX11Display();
208
209 unsigned char mask_bits[XIMaskLen (XI_LASTEVENT)] = { 0 };
210 XIEventMask mask = { XIAllMasterDevices, sizeof (mask_bits), mask_bits };
211
212 XISetMask(mask.mask, XI_BarrierHit);
213 XISetMask(mask.mask, XI_BarrierLeave);
214 XISelectEvents (dpy, DefaultRootWindow(dpy), &mask, 1);
215}
216
217void EdgeBarrierController::Impl::SetupBarriers(std::vector<nux::Geometry> const& layout)164void EdgeBarrierController::Impl::SetupBarriers(std::vector<nux::Geometry> const& layout)
218{165{
219 if (parent_->force_disable())166 if (parent_->force_disable())
220 return;167 return;
221168
169 size_t monitors_size = layout.size();
170 auto launcher_position = Settings::Instance().launcher_position();
222 bool edge_resist = parent_->sticky_edges();171 bool edge_resist = parent_->sticky_edges();
223 auto launcher_position = Settings::Instance().launcher_position();172 bool needs_barrier = edge_resist && monitors_size > 1;
224173 bool needs_vertical_barrier = needs_barrier;
225 for (unsigned i = 0; i < layout.size(); i++)174
175 if (parent_->options()->hide_mode() != launcher::LauncherHideMode::LAUNCHER_HIDE_NEVER)
176 needs_vertical_barrier = true;
177
178 for (unsigned i = 0; i < layout.size(); ++i)
226 {179 {
227 auto vertical_barrier = vertical_barriers_[i];180 auto const& vertical_barrier = vertical_barriers_[i];
228 auto horizontal_barrier = horizontal_barriers_[i];181 auto const& horizontal_barrier = horizontal_barriers_[i];
229 auto monitor = layout[i];182 auto const& monitor = layout[i];
230183
231 vertical_barrier->DestroyBarrier();184 vertical_barrier->DestroyBarrier();
232 horizontal_barrier->DestroyBarrier();185 horizontal_barrier->DestroyBarrier();
233186
234 if (edge_resist)187 if (needs_barrier)
235 {188 {
236 horizontal_barrier->x1 = monitor.x;189 horizontal_barrier->x1 = monitor.x;
237 horizontal_barrier->x2 = monitor.x + monitor.width;190 horizontal_barrier->x2 = monitor.x + monitor.width;
@@ -246,7 +199,7 @@
246 horizontal_barrier->ConstructBarrier();199 horizontal_barrier->ConstructBarrier();
247 }200 }
248201
249 if (!edge_resist && parent_->options()->hide_mode() == launcher::LauncherHideMode::LAUNCHER_HIDE_NEVER)202 if (!needs_vertical_barrier)
250 continue;203 continue;
251204
252 if (launcher_position == LauncherPosition::LEFT)205 if (launcher_position == LauncherPosition::LEFT)
@@ -273,8 +226,10 @@
273 vertical_barrier->ConstructBarrier();226 vertical_barrier->ConstructBarrier();
274 }227 }
275228
276 SetupXI2Events();229 if (needs_barrier || needs_vertical_barrier)
277 AddEventFilter();230 input::Monitor::Get().RegisterClient(input::Events::BARRIER, sigc::mem_fun(this, &Impl::HandleEvent));
231 else
232 input::Monitor::Get().UnregisterClient(sigc::mem_fun(this, &Impl::HandleEvent));
278233
279 float decay_responsiveness_mult = ((parent_->options()->edge_responsiveness() - 1) * .3f) + 1;234 float decay_responsiveness_mult = ((parent_->options()->edge_responsiveness() - 1) * .3f) + 1;
280 decaymulator_.rate_of_decay = parent_->options()->edge_decay_rate() * decay_responsiveness_mult;235 decaymulator_.rate_of_decay = parent_->options()->edge_decay_rate() * decay_responsiveness_mult;
@@ -283,65 +238,25 @@
283 edge_overcome_pressure_ = parent_->options()->edge_overcome_pressure() * overcome_responsiveness_mult;238 edge_overcome_pressure_ = parent_->options()->edge_overcome_pressure() * overcome_responsiveness_mult;
284}239}
285240
286void EdgeBarrierController::Impl::AddEventFilter()241void EdgeBarrierController::Impl::HandleEvent(XEvent const& xevent)
287{242{
288 // Remove an old one, if it exists243 if (xevent.xcookie.evtype != XI_BarrierHit)
289 nux::GetGraphicsDisplay()->RemoveEventFilter(this);244 return;
290245
291 nux::GraphicsDisplay::EventFilterArg event_filter;246 auto* barrier_event = reinterpret_cast<XIBarrierEvent*>(xevent.xcookie.data);
292 event_filter.filter = &HandleEventCB;247 PointerBarrierWrapper::Ptr const& wrapper = FindBarrierEventOwner(barrier_event);
293 event_filter.data = this;248
294249 if (wrapper)
295 nux::GetGraphicsDisplay()->AddEventFilter(event_filter);250 wrapper->HandleBarrierEvent(barrier_event);
296}
297
298bool EdgeBarrierController::Impl::HandleEvent(XEvent xevent)
299{
300 Display *dpy = nux::GetGraphicsDisplay()->GetX11Display();
301 XGenericEventCookie *cookie = &xevent.xcookie;
302 bool ret = false;
303
304 switch (cookie->evtype)
305 {
306 case (XI_BarrierHit):
307 {
308 if (XGetEventData(dpy, cookie))
309 {
310 XIBarrierEvent* barrier_event = (XIBarrierEvent*)cookie->data;
311 PointerBarrierWrapper::Ptr wrapper = FindBarrierEventOwner(barrier_event);
312
313 if (wrapper)
314 ret = wrapper->HandleBarrierEvent(barrier_event);
315 }
316
317 XFreeEventData(dpy, cookie);
318 break;
319 }
320 default:
321 break;
322 }
323
324 return ret;
325}
326
327bool EdgeBarrierController::Impl::HandleEventCB(XEvent xevent, void* data)
328{
329 auto edge_barrier_controller = static_cast<EdgeBarrierController::Impl*>(data);
330 int const xi2_opcode = edge_barrier_controller->xi2_opcode_;
331
332 if (xevent.type != GenericEvent || xevent.xcookie.extension != xi2_opcode)
333 return false;
334
335 return edge_barrier_controller->HandleEvent(xevent);
336}251}
337252
338PointerBarrierWrapper::Ptr EdgeBarrierController::Impl::FindBarrierEventOwner(XIBarrierEvent* barrier_event)253PointerBarrierWrapper::Ptr EdgeBarrierController::Impl::FindBarrierEventOwner(XIBarrierEvent* barrier_event)
339{254{
340 for (auto barrier : vertical_barriers_)255 for (auto const& barrier : vertical_barriers_)
341 if (barrier->OwnsBarrierEvent(barrier_event->barrier))256 if (barrier->OwnsBarrierEvent(barrier_event->barrier))
342 return barrier;257 return barrier;
343258
344 for (auto barrier : horizontal_barriers_)259 for (auto const& barrier : horizontal_barriers_)
345 if (barrier->OwnsBarrierEvent(barrier_event->barrier))260 if (barrier->OwnsBarrierEvent(barrier_event->barrier))
346 return barrier;261 return barrier;
347262
348263
=== modified file 'launcher/EdgeBarrierControllerPrivate.h'
--- launcher/EdgeBarrierControllerPrivate.h 2015-12-23 09:29:24 +0000
+++ launcher/EdgeBarrierControllerPrivate.h 2017-12-01 18:43:57 +0000
@@ -53,12 +53,8 @@
53 bool EventIsInsideYBreakZone(BarrierEvent::Ptr const& event);53 bool EventIsInsideYBreakZone(BarrierEvent::Ptr const& event);
54 bool EventIsInsideXBreakZone(BarrierEvent::Ptr const& event);54 bool EventIsInsideXBreakZone(BarrierEvent::Ptr const& event);
5555
56 void AddEventFilter();
57
58 PointerBarrierWrapper::Ptr FindBarrierEventOwner(XIBarrierEvent* barrier_event);56 PointerBarrierWrapper::Ptr FindBarrierEventOwner(XIBarrierEvent* barrier_event);
5957 void HandleEvent(XEvent const&);
60 static bool HandleEventCB(XEvent event, void* data);
61 bool HandleEvent(XEvent event);
6258
63 std::vector<PointerBarrierWrapper::Ptr> vertical_barriers_;59 std::vector<PointerBarrierWrapper::Ptr> vertical_barriers_;
64 std::vector<PointerBarrierWrapper::Ptr> horizontal_barriers_;60 std::vector<PointerBarrierWrapper::Ptr> horizontal_barriers_;
@@ -68,7 +64,6 @@
6864
69 Decaymulator decaymulator_;65 Decaymulator decaymulator_;
70 glib::Source::UniquePtr release_timeout_;66 glib::Source::UniquePtr release_timeout_;
71 int xi2_opcode_;
72 float edge_overcome_pressure_;67 float edge_overcome_pressure_;
73 EdgeBarrierController* parent_;68 EdgeBarrierController* parent_;
74};69};
7570
=== modified file 'launcher/FileManagerLauncherIcon.cpp'
--- launcher/FileManagerLauncherIcon.cpp 2016-07-14 10:04:31 +0000
+++ launcher/FileManagerLauncherIcon.cpp 2017-12-01 18:43:57 +0000
@@ -49,6 +49,11 @@
49 SetQuirk(Quirk::VISIBLE, false);49 SetQuirk(Quirk::VISIBLE, false);
50 SkipQuirkAnimation(Quirk::VISIBLE);50 SkipQuirkAnimation(Quirk::VISIBLE);
5151
52 signals_conn_.Add(app_->window_opened.connect([this](ApplicationWindowPtr const& win) {
53 signals_conn_.Add(win->monitor.changed.connect([this] (int) { UpdateStorageWindows(); }));
54 UpdateStorageWindows();
55 }));
56
52 signals_conn_.Add(app_->desktop_file.changed.connect([this](std::string const& desktop_file) {57 signals_conn_.Add(app_->desktop_file.changed.connect([this](std::string const& desktop_file) {
53 LOG_DEBUG(logger) << tooltip_text() << " desktop_file now " << desktop_file;58 LOG_DEBUG(logger) << tooltip_text() << " desktop_file now " << desktop_file;
54 UpdateDesktopFile();59 UpdateDesktopFile();
@@ -134,5 +139,30 @@
134 return StorageLauncherIcon::OnShouldHighlightOnDrag(dnd_data);139 return StorageLauncherIcon::OnShouldHighlightOnDrag(dnd_data);
135}140}
136141
142bool FileManagerLauncherIcon::IsUserVisible() const
143{
144 return ApplicationLauncherIcon::IsUserVisible();
145}
146
147WindowList FileManagerLauncherIcon::WindowsOnViewport()
148{
149 WindowFilterMask filter = 0;
150 filter |= WindowFilter::MAPPED;
151 filter |= WindowFilter::ON_CURRENT_DESKTOP;
152 filter |= WindowFilter::ON_ALL_MONITORS;
153
154 return WindowedLauncherIcon::GetWindows(filter);
155}
156
157WindowList FileManagerLauncherIcon::WindowsForMonitor(int monitor)
158{
159 WindowFilterMask filter = 0;
160 filter |= WindowFilter::MAPPED;
161 filter |= WindowFilter::ON_CURRENT_DESKTOP;
162
163 return WindowedLauncherIcon::GetWindows(filter, monitor);
164}
165
166
137} // namespace launcher167} // namespace launcher
138} // namespace unity168} // namespace unity
139169
=== modified file 'launcher/FileManagerLauncherIcon.h'
--- launcher/FileManagerLauncherIcon.h 2015-12-09 12:02:48 +0000
+++ launcher/FileManagerLauncherIcon.h 2017-12-01 18:43:57 +0000
@@ -32,8 +32,16 @@
32class FileManagerLauncherIcon : public ApplicationLauncherIcon, public StorageLauncherIcon32class FileManagerLauncherIcon : public ApplicationLauncherIcon, public StorageLauncherIcon
33{33{
34public:34public:
35 typedef nux::ObjectPtr<FileManagerLauncherIcon> Ptr;
36
35 FileManagerLauncherIcon(ApplicationPtr const&, DeviceLauncherSection::Ptr const&, FileManager::Ptr const& = nullptr);37 FileManagerLauncherIcon(ApplicationPtr const&, DeviceLauncherSection::Ptr const&, FileManager::Ptr const& = nullptr);
3638
39 bool IsUserVisible() const override;
40
41protected:
42 WindowList WindowsOnViewport() override;
43 WindowList WindowsForMonitor(int monitor) override;
44
37private:45private:
38 WindowList GetManagedWindows() const override;46 WindowList GetManagedWindows() const override;
39 WindowList GetStorageWindows() const override;47 WindowList GetStorageWindows() const override;
4048
=== modified file 'launcher/Launcher.cpp'
--- launcher/Launcher.cpp 2016-07-05 10:22:42 +0000
+++ launcher/Launcher.cpp 2017-12-01 18:43:57 +0000
@@ -138,13 +138,6 @@
138 , drag_action_(nux::DNDACTION_NONE)138 , drag_action_(nux::DNDACTION_NONE)
139 , bg_effect_helper_(this)139 , bg_effect_helper_(this)
140 , launcher_position_(unity::Settings::Instance().launcher_position())140 , launcher_position_(unity::Settings::Instance().launcher_position())
141 , auto_hide_animation_(Settings::Instance().low_gfx ? 0 : ANIM_DURATION_SHORT)
142 , hover_animation_(Settings::Instance().low_gfx ? ANIM_DURATION_SHORT_SHORT : ANIM_DURATION)
143 , drag_over_animation_(Settings::Instance().low_gfx ? 0 : ANIM_DURATION_LONG)
144 , drag_out_animation_(Settings::Instance().low_gfx ? 0 : ANIM_DURATION_SHORT)
145 , drag_icon_animation_(Settings::Instance().low_gfx ? 0 : ANIM_DURATION_SHORT)
146 , dnd_hide_animation_(Settings::Instance().low_gfx ? 0 : ANIM_DURATION * 3)
147 , dash_showing_animation_(Settings::Instance().low_gfx ? 0 : ANIM_DURATION_DASH_SHOWING)
148 , cv_(Settings::Instance().em(monitor))141 , cv_(Settings::Instance().em(monitor))
149{142{
150 icon_renderer_->monitor = monitor();143 icon_renderer_->monitor = monitor();
@@ -199,17 +192,9 @@
199 });192 });
200193
201 Settings::Instance().dpi_changed.connect(sigc::mem_fun(this, &Launcher::OnDPIChanged));194 Settings::Instance().dpi_changed.connect(sigc::mem_fun(this, &Launcher::OnDPIChanged));
202 Settings::Instance().low_gfx.changed.connect(sigc::track_obj([this] (bool low_gfx) {195 Settings::Instance().low_gfx.changed.connect(sigc::hide(sigc::mem_fun(this, &Launcher::UpdateAnimations)));
203 auto_hide_animation_.SetDuration(low_gfx ? 0 : ANIM_DURATION_SHORT);
204 hover_animation_.SetDuration(low_gfx ? ANIM_DURATION_SHORT_SHORT : ANIM_DURATION);
205 drag_over_animation_.SetDuration(low_gfx ? 0 : ANIM_DURATION_LONG);
206 drag_out_animation_.SetDuration(low_gfx ? 0 : ANIM_DURATION_SHORT);
207 drag_icon_animation_.SetDuration(low_gfx ? 0 : ANIM_DURATION_SHORT);
208 dnd_hide_animation_.SetDuration(low_gfx ? 0 : ANIM_DURATION * 3);
209 dash_showing_animation_.SetDuration(low_gfx ? 0 : ANIM_DURATION_DASH_SHOWING);
210 QueueDraw();
211 }, *this));
212196
197 UpdateAnimations();
213 auto_hide_animation_.updated.connect(redraw_cb);198 auto_hide_animation_.updated.connect(redraw_cb);
214 hover_animation_.updated.connect(redraw_cb);199 hover_animation_.updated.connect(redraw_cb);
215 drag_over_animation_.updated.connect(redraw_cb);200 drag_over_animation_.updated.connect(redraw_cb);
@@ -1356,13 +1341,29 @@
1356 SetLauncherMinimizeWindow(options->minimize_window_on_click);1341 SetLauncherMinimizeWindow(options->minimize_window_on_click);
1357 OnMonitorChanged(monitor);1342 OnMonitorChanged(monitor);
13581343
1344 UpdateAnimations();
1345 ConfigureBarrier();
1346 QueueDraw();
1347}
1348
1349void Launcher::UpdateAnimations()
1350{
1351 bool low_gfx = Settings::Instance().low_gfx();
1352
1353 auto_hide_animation_.SetDuration(low_gfx ? 0 : ANIM_DURATION_SHORT);
1354 hover_animation_.SetDuration(low_gfx ? 0 : ANIM_DURATION);
1355 drag_over_animation_.SetDuration(low_gfx ? 0 : ANIM_DURATION_LONG);
1356 drag_out_animation_.SetDuration(low_gfx ? 0 : ANIM_DURATION_SHORT);
1357 drag_icon_animation_.SetDuration(low_gfx ? 0 : ANIM_DURATION_SHORT);
1358 dnd_hide_animation_.SetDuration(low_gfx ? 0 : ANIM_DURATION * 3);
1359 dash_showing_animation_.SetDuration(low_gfx ? 0 : ANIM_DURATION_DASH_SHOWING);
1360
1359 if (model_)1361 if (model_)
1360 {1362 {
1361 for (auto const& icon : *model_)1363 for (auto const& icon : *model_)
1362 SetupIconAnimations(icon);1364 SetupIconAnimations(icon);
1363 }1365 }
13641366
1365 ConfigureBarrier();
1366 QueueDraw();1367 QueueDraw();
1367}1368}
13681369
@@ -1739,23 +1740,26 @@
17391740
1740void Launcher::SetupIconAnimations(AbstractLauncherIcon::Ptr const& icon)1741void Launcher::SetupIconAnimations(AbstractLauncherIcon::Ptr const& icon)
1741{1742{
1742 icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::VISIBLE, ANIM_DURATION_SHORT, monitor());1743 bool display = monitor();
1743 icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::RUNNING, ANIM_DURATION_SHORT, monitor());1744 bool low_gfx = Settings::Instance().low_gfx();
1744 icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::ACTIVE, ANIM_DURATION_SHORT, monitor());1745
1745 icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::STARTING, (ANIM_DURATION_LONG * MAX_STARTING_BLINKS * STARTING_BLINK_LAMBDA * 2), monitor());1746 icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::VISIBLE, low_gfx ? 0 : ANIM_DURATION_SHORT, display);
1746 icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::PULSE_ONCE, (ANIM_DURATION_LONG * PULSE_BLINK_LAMBDA * 2), monitor());1747 icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::RUNNING, low_gfx ? 0 : ANIM_DURATION_SHORT, display);
1747 icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::PRESENTED, ANIM_DURATION, monitor());1748 icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::ACTIVE, low_gfx ? 0 : ANIM_DURATION_SHORT, display);
1748 icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::UNFOLDED, ANIM_DURATION, monitor());1749 icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::STARTING, (ANIM_DURATION_LONG * MAX_STARTING_BLINKS * STARTING_BLINK_LAMBDA * 2), display);
1749 icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::SHIMMER, ANIM_DURATION_LONG, monitor());1750 icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::PULSE_ONCE, (ANIM_DURATION_LONG * PULSE_BLINK_LAMBDA * 2), display);
1750 icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::CENTER_SAVED, ANIM_DURATION, monitor());1751 icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::PRESENTED, low_gfx ? 0 : ANIM_DURATION, display);
1751 icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::PROGRESS, ANIM_DURATION, monitor());1752 icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::UNFOLDED, low_gfx ? 0 : ANIM_DURATION, display);
1752 icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::DESAT, ANIM_DURATION_SHORT_SHORT, monitor());1753 icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::SHIMMER, low_gfx ? ANIM_DURATION_SHORT_SHORT : ANIM_DURATION_LONG, display);
1753 icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::GLOW, ANIM_DURATION_SHORT, monitor());1754 icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::CENTER_SAVED, low_gfx ? ANIM_DURATION_SHORT_SHORT : ANIM_DURATION, display);
1755 icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::PROGRESS, low_gfx ? ANIM_DURATION_SHORT_SHORT : ANIM_DURATION, display);
1756 icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::DESAT, low_gfx ? 0 : ANIM_DURATION_SHORT_SHORT, display);
1757 icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::GLOW, low_gfx ? 0 : ANIM_DURATION_SHORT, display);
17541758
1755 if (options()->urgent_animation() == URGENT_ANIMATION_WIGGLE)1759 if (options()->urgent_animation() == URGENT_ANIMATION_WIGGLE)
1756 icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::URGENT, (ANIM_DURATION_SHORT * WIGGLE_CYCLES), monitor());1760 icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::URGENT, (ANIM_DURATION_SHORT * WIGGLE_CYCLES), display);
1757 else1761 else
1758 icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::URGENT, (ANIM_DURATION_LONG * URGENT_BLINKS * 2), monitor());1762 icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::URGENT, (ANIM_DURATION_LONG * URGENT_BLINKS * 2), display);
1759}1763}
17601764
1761void Launcher::SetModel(LauncherModel::Ptr model)1765void Launcher::SetModel(LauncherModel::Ptr model)
17621766
=== modified file 'launcher/Launcher.h'
--- launcher/Launcher.h 2016-03-30 18:18:07 +0000
+++ launcher/Launcher.h 2017-12-01 18:43:57 +0000
@@ -195,6 +195,7 @@
195 void OnOptionsChanged(Options::Ptr options);195 void OnOptionsChanged(Options::Ptr options);
196 void OnOptionChanged();196 void OnOptionChanged();
197 void UpdateOptions(Options::Ptr options);197 void UpdateOptions(Options::Ptr options);
198 void UpdateAnimations();
198199
199#ifdef NUX_GESTURES_SUPPORT200#ifdef NUX_GESTURES_SUPPORT
200 void OnDragStart(const nux::GestureEvent &event);201 void OnDragStart(const nux::GestureEvent &event);
201202
=== modified file 'launcher/LauncherOptions.cpp'
--- launcher/LauncherOptions.cpp 2014-03-17 20:58:25 +0000
+++ launcher/LauncherOptions.cpp 2017-12-01 18:43:57 +0000
@@ -49,31 +49,31 @@
49 , scroll_inactive_icons(false)49 , scroll_inactive_icons(false)
50 , minimize_window_on_click(false)50 , minimize_window_on_click(false)
51{51{
52 auto changed_lambda = [this] {52 auto changed_cb = sigc::track_obj(sigc::hide([this] {
53 changed_idle_.reset(new glib::Idle(glib::Source::Priority::HIGH));53 changed_idle_.reset(new glib::Idle(glib::Source::Priority::HIGH));
54 changed_idle_->Run([this] { option_changed.emit(); return false; });54 changed_idle_->Run([this] { option_changed.emit(); return false; });
55 };55 }), *this);
5656
57 auto_hide_animation.changed.connect(sigc::hide(changed_lambda));57 auto_hide_animation.changed.connect(changed_cb);
58 background_alpha.changed.connect(sigc::hide(changed_lambda));58 background_alpha.changed.connect(changed_cb);
59 background_color.changed.connect(sigc::hide(changed_lambda));59 background_color.changed.connect(changed_cb);
60 backlight_mode.changed.connect(sigc::hide(changed_lambda));60 backlight_mode.changed.connect(changed_cb);
61 edge_decay_rate.changed.connect(sigc::hide(changed_lambda));61 edge_decay_rate.changed.connect(changed_cb);
62 edge_overcome_pressure.changed.connect(sigc::hide(changed_lambda));62 edge_overcome_pressure.changed.connect(changed_cb);
63 edge_responsiveness.changed.connect(sigc::hide(changed_lambda));63 edge_responsiveness.changed.connect(changed_cb);
64 edge_reveal_pressure.changed.connect(sigc::hide(changed_lambda));64 edge_reveal_pressure.changed.connect(changed_cb);
65 edge_stop_velocity.changed.connect(sigc::hide(changed_lambda));65 edge_stop_velocity.changed.connect(changed_cb);
66 edge_passed_disabled_ms.changed.connect(sigc::hide(changed_lambda));66 edge_passed_disabled_ms.changed.connect(changed_cb);
67 hide_mode.changed.connect(sigc::hide(changed_lambda));67 hide_mode.changed.connect(changed_cb);
68 icon_size.changed.connect(sigc::hide(changed_lambda));68 icon_size.changed.connect(changed_cb);
69 launch_animation.changed.connect(sigc::hide(changed_lambda));69 launch_animation.changed.connect(changed_cb);
70 reveal_trigger.changed.connect(sigc::hide(changed_lambda));70 reveal_trigger.changed.connect(changed_cb);
71 tile_size.changed.connect(sigc::hide(changed_lambda));71 tile_size.changed.connect(changed_cb);
72 super_tap_duration.changed.connect(sigc::hide(changed_lambda));72 super_tap_duration.changed.connect(changed_cb);
73 urgent_animation.changed.connect(sigc::hide(changed_lambda));73 urgent_animation.changed.connect(changed_cb);
74 edge_resist.changed.connect(sigc::hide(changed_lambda));74 edge_resist.changed.connect(changed_cb);
75 scroll_inactive_icons.changed.connect(sigc::hide(changed_lambda));75 scroll_inactive_icons.changed.connect(changed_cb);
76 minimize_window_on_click.changed.connect(sigc::hide(changed_lambda));76 minimize_window_on_click.changed.connect(changed_cb);
77}77}
7878
79}79}
8080
=== modified file 'launcher/StorageLauncherIcon.cpp'
--- launcher/StorageLauncherIcon.cpp 2015-12-08 14:31:30 +0000
+++ launcher/StorageLauncherIcon.cpp 2017-12-01 18:43:57 +0000
@@ -36,7 +36,7 @@
36 bool active = false;36 bool active = false;
37 bool urgent = false;37 bool urgent = false;
38 bool check_visibility = (GetIconType() == IconType::APPLICATION);38 bool check_visibility = (GetIconType() == IconType::APPLICATION);
39 bool visible = IsSticky();39 bool visible = false;
4040
41 managed_windows_ = GetStorageWindows();41 managed_windows_ = GetStorageWindows();
42 windows_connections_.Clear();42 windows_connections_.Clear();
@@ -54,13 +54,8 @@
54 if (!urgent && win->urgent())54 if (!urgent && win->urgent())
55 urgent = true;55 urgent = true;
5656
57 if (check_visibility)57 if (check_visibility && !visible)
58 {58 visible = true;
59 windows_connections_.Add(win->visible.changed.connect([this] (bool) { OnWindowStateChanged(); }));
60
61 if (!visible && win->visible())
62 visible = true;
63 }
64 }59 }
6560
66 SetQuirk(Quirk::RUNNING, !managed_windows_.empty());61 SetQuirk(Quirk::RUNNING, !managed_windows_.empty());
@@ -68,7 +63,7 @@
68 SetQuirk(Quirk::URGENT, urgent);63 SetQuirk(Quirk::URGENT, urgent);
6964
70 if (check_visibility)65 if (check_visibility)
71 SetQuirk(Quirk::VISIBLE, visible);66 SetQuirk(Quirk::VISIBLE, visible || IsSticky());
7267
73 EnsureWindowsLocation();68 EnsureWindowsLocation();
74}69}
@@ -83,7 +78,7 @@
83 bool active = false;78 bool active = false;
84 bool urgent = false;79 bool urgent = false;
85 bool check_visibility = (GetIconType() == IconType::APPLICATION);80 bool check_visibility = (GetIconType() == IconType::APPLICATION);
86 bool visible = IsSticky();81 bool visible = false;
8782
88 for (auto const& win : managed_windows_)83 for (auto const& win : managed_windows_)
89 {84 {
@@ -93,7 +88,7 @@
93 if (!urgent && win->urgent())88 if (!urgent && win->urgent())
94 urgent = true;89 urgent = true;
9590
96 if (check_visibility && !visible && win->visible())91 if (check_visibility && !visible)
97 visible = true;92 visible = true;
98 }93 }
9994
@@ -101,7 +96,7 @@
101 SetQuirk(Quirk::URGENT, urgent);96 SetQuirk(Quirk::URGENT, urgent);
10297
103 if (check_visibility)98 if (check_visibility)
104 SetQuirk(Quirk::VISIBLE, visible);99 SetQuirk(Quirk::VISIBLE, visible || IsSticky());
105}100}
106101
107bool StorageLauncherIcon::OnShouldHighlightOnDrag(DndData const& dnd_data)102bool StorageLauncherIcon::OnShouldHighlightOnDrag(DndData const& dnd_data)
108103
=== modified file 'launcher/Tooltip.cpp'
--- launcher/Tooltip.cpp 2016-01-29 03:45:34 +0000
+++ launcher/Tooltip.cpp 2017-12-01 18:43:57 +0000
@@ -124,13 +124,13 @@
124 {124 {
125 int size = 0;125 int size = 0;
126 int max = GetBaseWidth() - ROTATED_ANCHOR_WIDTH.CP(cv_) - 2 * CORNER_RADIUS.CP(cv_) - 2 * _padding.CP(cv_);126 int max = GetBaseWidth() - ROTATED_ANCHOR_WIDTH.CP(cv_) - 2 * CORNER_RADIUS.CP(cv_) - 2 * _padding.CP(cv_);
127 if (_left_size.CP(cv_) > max)127 if (_left_size > max)
128 {128 {
129 size = max;129 size = max;
130 }130 }
131 else if (_left_size.CP(cv_) > 0)131 else if (_left_size > 0)
132 {132 {
133 size = _left_size.CP(cv_);133 size = _left_size;
134 }134 }
135 x = _anchorX - (ROTATED_ANCHOR_WIDTH.CP(cv_) / 2) - size - CORNER_RADIUS.CP(cv_) - _padding.CP(cv_);135 x = _anchorX - (ROTATED_ANCHOR_WIDTH.CP(cv_) / 2) - size - CORNER_RADIUS.CP(cv_) - _padding.CP(cv_);
136 }136 }
@@ -222,7 +222,7 @@
222 if (Settings::Instance().launcher_position() == LauncherPosition::LEFT)222 if (Settings::Instance().launcher_position() == LauncherPosition::LEFT)
223 _bottom_space->SetMinMaxSize(1, space_height + 1);223 _bottom_space->SetMinMaxSize(1, space_height + 1);
224 else224 else
225 _bottom_space->SetMinMaxSize(1, space_height + ROTATED_ANCHOR_HEIGHT + 1);225 _bottom_space->SetMinMaxSize(1, space_height + ROTATED_ANCHOR_HEIGHT.CP(cv_) + 1);
226226
227 CairoBaseWindow::PreLayoutManagement();227 CairoBaseWindow::PreLayoutManagement();
228}228}
@@ -653,7 +653,7 @@
653 height / dpi_scale,653 height / dpi_scale,
654 anchor_width,654 anchor_width,
655 anchor_height,655 anchor_height,
656 _left_size,656 _left_size / dpi_scale,
657 CORNER_RADIUS,657 CORNER_RADIUS,
658 blur_coef,658 blur_coef,
659 shadow_color,659 shadow_color,
@@ -669,7 +669,7 @@
669 CORNER_RADIUS, // radius,669 CORNER_RADIUS, // radius,
670 anchor_width, // anchor_width,670 anchor_width, // anchor_width,
671 anchor_height, // anchor_height,671 anchor_height, // anchor_height,
672 _left_size, // left_size,672 _left_size / dpi_scale, // left_size,
673 true, // negative,673 true, // negative,
674 false, // outline,674 false, // outline,
675 1.0, // line_width,675 1.0, // line_width,
676676
=== modified file 'launcher/Tooltip.h'
--- launcher/Tooltip.h 2015-12-17 01:08:54 +0000
+++ launcher/Tooltip.h 2017-12-01 18:43:57 +0000
@@ -78,7 +78,7 @@
7878
79 int _anchorX;79 int _anchorX;
80 int _anchorY;80 int _anchorY;
81 RawPixel _left_size; // size of the segment from point 10 to 11, used when launcher at bottom.81 int _left_size; // size of the segment from point 10 to 11, used when launcher at bottom.
82 RawPixel _padding;82 RawPixel _padding;
8383
84 nux::HLayout* _hlayout;84 nux::HLayout* _hlayout;
@@ -94,4 +94,3 @@
94}94}
9595
96#endif // TOOLTIP_H96#endif // TOOLTIP_H
97
9897
=== modified file 'lockscreen/BackgroundSettings.cpp'
--- lockscreen/BackgroundSettings.cpp 2014-07-29 12:05:47 +0000
+++ lockscreen/BackgroundSettings.cpp 2017-12-01 18:43:57 +0000
@@ -53,24 +53,33 @@
53 auto& settings = Settings::Instance();53 auto& settings = Settings::Instance();
5454
55 nux::CairoGraphics cairo_graphics(CAIRO_FORMAT_ARGB32, geo.width, geo.height);55 nux::CairoGraphics cairo_graphics(CAIRO_FORMAT_ARGB32, geo.width, geo.height);
56 cairo_surface_set_device_scale(cairo_graphics.GetSurface(), scale, scale);
57 cairo_t* c = cairo_graphics.GetInternalContext();56 cairo_t* c = cairo_graphics.GetInternalContext();
5857
58 glib::Object<GnomeBG> gnome_bg;
59 double s_width = geo.width / scale;59 double s_width = geo.width / scale;
60 double s_height = geo.height / scale;60 double s_height = geo.height / scale;
61 cairo_surface_t* bg_surface = nullptr;61 cairo_surface_t* bg_surface = nullptr;
6262
63 if (settings.use_user_background())63 if (settings.use_user_background())
64 {64 {
65 bg_surface = gnome_bg_create_surface(gnome_bg_, gdk_get_default_root_window(), s_width, s_height, FALSE);65 gnome_bg = gnome_bg_;
66 }66 }
67 else if (!settings.background().empty())67 else if (!settings.background().empty())
68 {68 {
69 glib::Object<GdkPixbuf> pixbuf(gdk_pixbuf_new_from_file_at_scale(settings.background().c_str(), s_width, s_height, FALSE, NULL));69 gnome_bg = gnome_bg_new();
7070 gnome_bg_set_filename(gnome_bg, settings.background().c_str());
71 if (pixbuf)71 gnome_bg_set_placement(gnome_bg, G_DESKTOP_BACKGROUND_STYLE_ZOOM);
72 bg_surface = gdk_cairo_surface_create_from_pixbuf(pixbuf, 0, NULL);72 }
73 }73
74 if (gnome_bg)
75 {
76 auto *root_window = gdk_get_default_root_window();
77 bg_surface = gnome_bg_create_surface(gnome_bg, root_window, geo.width, geo.height, FALSE);
78 }
79
80 auto const& bg_color = settings.background_color();
81 cairo_set_source_rgb(c, bg_color.red, bg_color.green, bg_color.blue);
82 cairo_paint(c);
7483
75 if (bg_surface)84 if (bg_surface)
76 {85 {
@@ -78,12 +87,8 @@
78 cairo_paint(c);87 cairo_paint(c);
79 cairo_surface_destroy(bg_surface);88 cairo_surface_destroy(bg_surface);
80 }89 }
81 else90
82 {91 cairo_surface_set_device_scale(cairo_graphics.GetSurface(), scale, scale);
83 auto const& bg_color = settings.background_color();
84 cairo_set_source_rgb(c, bg_color.red, bg_color.green, bg_color.blue);
85 cairo_paint(c);
86 }
8792
88 if (!settings.logo().empty())93 if (!settings.logo().empty())
89 {94 {
9095
=== modified file 'lockscreen/KylinLockScreenShield.cpp'
--- lockscreen/KylinLockScreenShield.cpp 2015-12-07 03:09:28 +0000
+++ lockscreen/KylinLockScreenShield.cpp 2017-12-01 18:43:57 +0000
@@ -37,7 +37,7 @@
37 Accelerators::Ptr const& accelerators,37 Accelerators::Ptr const& accelerators,
38 nux::ObjectPtr<AbstractUserPromptView> const& prompt_view,38 nux::ObjectPtr<AbstractUserPromptView> const& prompt_view,
39 int monitor_num, bool is_primary)39 int monitor_num, bool is_primary)
40 : BaseShield(session_manager, nullptr, accelerators, prompt_view, monitor_num, is_primary)40 : BaseShield(session_manager, accelerators, prompt_view, monitor_num, is_primary)
41{41{
42 is_primary ? ShowPrimaryView() : ShowSecondaryView();42 is_primary ? ShowPrimaryView() : ShowSecondaryView();
43 EnableInputWindow(true);43 EnableInputWindow(true);
@@ -77,23 +77,5 @@
77 main_layout->AddSpace(0, 10);77 main_layout->AddSpace(0, 10);
78}78}
7979
80nux::Area* KylinShield::FindKeyFocusArea(unsigned etype, unsigned long keysym, unsigned long modifiers)
81{
82 if (primary)
83 {
84 grab_key.emit(modifiers, keysym);
85
86 if (prompt_view_)
87 {
88 auto* focus_view = prompt_view_->focus_view();
89
90 if (focus_view && focus_view->GetInputEventSensitivity())
91 return focus_view;
92 }
93 }
94
95 return nullptr;
96}
97
98}80}
99}81}
10082
=== modified file 'lockscreen/KylinLockScreenShield.h'
--- lockscreen/KylinLockScreenShield.h 2015-12-07 03:09:28 +0000
+++ lockscreen/KylinLockScreenShield.h 2017-12-01 18:43:57 +0000
@@ -41,9 +41,6 @@
41 nux::ObjectPtr<AbstractUserPromptView> const&,41 nux::ObjectPtr<AbstractUserPromptView> const&,
42 int monitor, bool is_primary);42 int monitor, bool is_primary);
4343
44protected:
45 nux::Area* FindKeyFocusArea(unsigned int, unsigned long, unsigned long) override;
46
47private:44private:
48 void ShowPrimaryView() override;45 void ShowPrimaryView() override;
49};46};
5047
=== modified file 'lockscreen/KylinUserPromptView.cpp'
--- lockscreen/KylinUserPromptView.cpp 2016-03-31 05:57:11 +0000
+++ lockscreen/KylinUserPromptView.cpp 2017-12-01 18:43:57 +0000
@@ -79,9 +79,9 @@
7979
80}80}
8181
82KylinUserPromptView::KylinUserPromptView(session::Manager::Ptr const& session_manager)82KylinUserPromptView::KylinUserPromptView(session::Manager::Ptr const& session_manager,
83 : AbstractUserPromptView(session_manager)83 UserAuthenticator::Ptr const& user_authenticator)
84 , session_manager_(session_manager)84 : AbstractUserPromptView(session_manager, user_authenticator)
85 , username_(nullptr)85 , username_(nullptr)
86 , msg_layout_(nullptr)86 , msg_layout_(nullptr)
87 , prompt_layout_(nullptr)87 , prompt_layout_(nullptr)
@@ -90,25 +90,25 @@
90 , avatar_(nullptr)90 , avatar_(nullptr)
91 , avatar_icon_file("")91 , avatar_icon_file("")
92{92{
93 user_authenticator_.echo_on_requested.connect([this](std::string const& message, PromiseAuthCodePtr const& promise){93 user_authenticator_->echo_on_requested.connect(sigc::track_obj([this](std::string const& message, PromiseAuthCodePtr const& promise){
94 AddPrompt(message, true, promise);94 AddPrompt(message, true, promise);
95 });95 }, *this));
9696
97 user_authenticator_.echo_off_requested.connect([this](std::string const& message, PromiseAuthCodePtr const& promise){97 user_authenticator_->echo_off_requested.connect(sigc::track_obj([this](std::string const& message, PromiseAuthCodePtr const& promise){
98 AddPrompt(message, false, promise);98 AddPrompt(message, false, promise);
99 });99 }, *this));
100100
101 user_authenticator_.message_requested.connect([this](std::string const& message){101 user_authenticator_->message_requested.connect(sigc::track_obj([this](std::string const& message){
102 AddMessage(message, nux::color::White);102 AddMessage(message, nux::color::White);
103 });103 }, *this));
104104
105 user_authenticator_.error_requested.connect([this](std::string const& message){105 user_authenticator_->error_requested.connect(sigc::track_obj([this](std::string const& message){
106 AddMessage(message, nux::color::Red);106 AddMessage(message, nux::color::Red);
107 });107 }, *this));
108108
109 user_authenticator_.clear_prompts.connect([this](){109 user_authenticator_->clear_prompts.connect(sigc::track_obj([this](){
110 ResetLayout();110 ResetLayout();
111 });111 }, *this));
112112
113 scale.changed.connect(sigc::hide(sigc::mem_fun(this, &KylinUserPromptView::UpdateSize)));113 scale.changed.connect(sigc::hide(sigc::mem_fun(this, &KylinUserPromptView::UpdateSize)));
114114
@@ -121,7 +121,7 @@
121 ResetLayout();121 ResetLayout();
122122
123 TextureCache::GetDefault().themed_invalidated.connect(sigc::mem_fun(this, &KylinUserPromptView::ResetLayout));123 TextureCache::GetDefault().themed_invalidated.connect(sigc::mem_fun(this, &KylinUserPromptView::ResetLayout));
124 user_authenticator_.AuthenticateStart(session_manager_->UserName(),124 user_authenticator_->AuthenticateStart(session_manager_->UserName(),
125 sigc::mem_fun(this, &KylinUserPromptView::AuthenticationCb));125 sigc::mem_fun(this, &KylinUserPromptView::AuthenticationCb));
126}126}
127127
@@ -244,7 +244,7 @@
244 {244 {
245 AddMessage(_("Invalid password, please try again"), nux::color::Red);245 AddMessage(_("Invalid password, please try again"), nux::color::Red);
246246
247 user_authenticator_.AuthenticateStart(session_manager_->UserName(),247 user_authenticator_->AuthenticateStart(session_manager_->UserName(),
248 sigc::mem_fun(this, &KylinUserPromptView::AuthenticationCb));248 sigc::mem_fun(this, &KylinUserPromptView::AuthenticationCb));
249 }249 }
250}250}
251251
=== modified file 'lockscreen/KylinUserPromptView.h'
--- lockscreen/KylinUserPromptView.h 2016-03-16 10:47:16 +0000
+++ lockscreen/KylinUserPromptView.h 2017-12-01 18:43:57 +0000
@@ -44,7 +44,8 @@
44class KylinUserPromptView : public AbstractUserPromptView44class KylinUserPromptView : public AbstractUserPromptView
45{45{
46public:46public:
47 KylinUserPromptView(session::Manager::Ptr const& session_manager);47 KylinUserPromptView(session::Manager::Ptr const& session_manager,
48 UserAuthenticator::Ptr const& user_authenticator);
4849
49 nux::View* focus_view();50 nux::View* focus_view();
5051
@@ -62,8 +63,6 @@
62 nux::ObjectPtr<nux::BaseTexture> LoadUserIcon(std::string const& icon_file, int icon_size);63 nux::ObjectPtr<nux::BaseTexture> LoadUserIcon(std::string const& icon_file, int icon_size);
6364
64private:65private:
65 session::Manager::Ptr session_manager_;
66 UserAuthenticatorPam user_authenticator_;
67 StaticCairoText* username_;66 StaticCairoText* username_;
68 nux::VLayout* msg_layout_;67 nux::VLayout* msg_layout_;
69 nux::VLayout* prompt_layout_;68 nux::VLayout* prompt_layout_;
7069
=== modified file 'lockscreen/LockScreenAbstractPromptView.h'
--- lockscreen/LockScreenAbstractPromptView.h 2016-03-31 09:51:33 +0000
+++ lockscreen/LockScreenAbstractPromptView.h 2017-12-01 18:43:57 +0000
@@ -29,7 +29,7 @@
29#include <Nux/VLayout.h>29#include <Nux/VLayout.h>
30#include "UnityCore/SessionManager.h"30#include "UnityCore/SessionManager.h"
3131
32#include "UserAuthenticatorPam.h"32#include "UserAuthenticator.h"
33#include "unity-shared/IMTextEntry.h"33#include "unity-shared/IMTextEntry.h"
3434
35namespace nux35namespace nux
@@ -48,10 +48,12 @@
48class AbstractUserPromptView : public nux::View48class AbstractUserPromptView : public nux::View
49{49{
50public:50public:
51 AbstractUserPromptView(session::Manager::Ptr const& session_manager)51 AbstractUserPromptView(session::Manager::Ptr const& session_manager,
52 UserAuthenticator::Ptr const& user_authenticator)
52 : nux::View(NUX_TRACKER_LOCATION)53 : nux::View(NUX_TRACKER_LOCATION)
53 , scale(1.0)54 , scale(1.0)
54 , session_manager_(session_manager)55 , session_manager_(session_manager)
56 , user_authenticator_(user_authenticator)
55 {}57 {}
5658
57 nux::Property<double> scale;59 nux::Property<double> scale;
@@ -64,7 +66,7 @@
6466
65protected:67protected:
66 session::Manager::Ptr session_manager_;68 session::Manager::Ptr session_manager_;
67 UserAuthenticatorPam user_authenticator_;69 UserAuthenticator::Ptr user_authenticator_;
68 std::shared_ptr<nux::AbstractPaintLayer> bg_layer_;70 std::shared_ptr<nux::AbstractPaintLayer> bg_layer_;
69 StaticCairoText* username_;71 StaticCairoText* username_;
70 nux::VLayout* msg_layout_;72 nux::VLayout* msg_layout_;
7173
=== modified file 'lockscreen/LockScreenBaseShield.cpp'
--- lockscreen/LockScreenBaseShield.cpp 2015-12-03 14:13:10 +0000
+++ lockscreen/LockScreenBaseShield.cpp 2017-12-01 18:43:57 +0000
@@ -38,7 +38,6 @@
38}38}
3939
40BaseShield::BaseShield(session::Manager::Ptr const& session,40BaseShield::BaseShield(session::Manager::Ptr const& session,
41 indicator::Indicators::Ptr const& indicators,
42 Accelerators::Ptr const& accelerators,41 Accelerators::Ptr const& accelerators,
43 nux::ObjectPtr<AbstractUserPromptView> const& prompt_view,42 nux::ObjectPtr<AbstractUserPromptView> const& prompt_view,
44 int monitor_num, bool is_primary)43 int monitor_num, bool is_primary)
@@ -47,7 +46,6 @@
47 , monitor(monitor_num)46 , monitor(monitor_num)
48 , scale(1.0)47 , scale(1.0)
49 , session_manager_(session)48 , session_manager_(session)
50 , indicators_(indicators)
51 , accelerators_(accelerators)49 , accelerators_(accelerators)
52 , prompt_view_(prompt_view)50 , prompt_view_(prompt_view)
53 , bg_settings_(std::make_shared<BackgroundSettings>())51 , bg_settings_(std::make_shared<BackgroundSettings>())
@@ -83,11 +81,6 @@
83 background_layer_.reset();81 background_layer_.reset();
84 UpdateBackgroundTexture();82 UpdateBackgroundTexture();
85 });83 });
86
87 mouse_move.connect([this] (int x, int y, int, int, unsigned long, unsigned long) {
88 auto const& abs_geo = GetAbsoluteGeometry();
89 grab_motion.emit(abs_geo.x + x, abs_geo.y + y);
90 });
91}84}
9285
93bool BaseShield::HasGrab() const86bool BaseShield::HasGrab() const
@@ -96,6 +89,19 @@
96 return (wc.GetPointerGrabArea() == this && wc.GetKeyboardGrabArea() == this);89 return (wc.GetPointerGrabArea() == this && wc.GetKeyboardGrabArea() == this);
97}90}
9891
92nux::Area* BaseShield::FindKeyFocusArea(unsigned etype, unsigned long keysym, unsigned long modifiers)
93{
94 if (primary && prompt_view_)
95 {
96 auto* focus_view = prompt_view_->focus_view();
97
98 if (focus_view && focus_view->GetInputEventSensitivity())
99 return focus_view;
100 }
101
102 return nullptr;
103}
104
99nux::Area* BaseShield::FindAreaUnderMouse(nux::Point const& mouse, nux::NuxEventType event_type)105nux::Area* BaseShield::FindAreaUnderMouse(nux::Point const& mouse, nux::NuxEventType event_type)
100{106{
101 nux::Area* area = BaseWindow::FindAreaUnderMouse(mouse, event_type);107 nux::Area* area = BaseWindow::FindAreaUnderMouse(mouse, event_type);
@@ -139,6 +145,7 @@
139 {145 {
140 auto background_texture = bg_settings_->GetBackgroundTexture(monitor);146 auto background_texture = bg_settings_->GetBackgroundTexture(monitor);
141 background_layer_.reset(new nux::TextureLayer(background_texture->GetDeviceTexture(), nux::TexCoordXForm(), nux::color::White, true));147 background_layer_.reset(new nux::TextureLayer(background_texture->GetDeviceTexture(), nux::TexCoordXForm(), nux::color::White, true));
148 background_layer_->SetGeometry(monitor_geo);
142 SetBackgroundLayer(background_layer_.get());149 SetBackgroundLayer(background_layer_.get());
143 }150 }
144}151}
145152
=== modified file 'lockscreen/LockScreenBaseShield.h'
--- lockscreen/LockScreenBaseShield.h 2016-03-31 09:51:33 +0000
+++ lockscreen/LockScreenBaseShield.h 2017-12-01 18:43:57 +0000
@@ -21,8 +21,8 @@
21#define UNITY_LOCKSCREEN_BASE_SHIELD_H21#define UNITY_LOCKSCREEN_BASE_SHIELD_H
2222
23#include <NuxCore/Property.h>23#include <NuxCore/Property.h>
24#include "UnityCore/ConnectionManager.h"
24#include "UnityCore/SessionManager.h"25#include "UnityCore/SessionManager.h"
25#include "UnityCore/Indicators.h"
26#include "UnityCore/GLibSource.h"26#include "UnityCore/GLibSource.h"
27#include "unity-shared/MockableBaseWindow.h"27#include "unity-shared/MockableBaseWindow.h"
2828
@@ -39,8 +39,8 @@
39class BaseShield : public MockableBaseWindow39class BaseShield : public MockableBaseWindow
40{40{
41public:41public:
42 BaseShield(session::Manager::Ptr const&, indicator::Indicators::Ptr const&,42 BaseShield(session::Manager::Ptr const&, Accelerators::Ptr const&,
43 Accelerators::Ptr const&, nux::ObjectPtr<AbstractUserPromptView> const&,43 nux::ObjectPtr<AbstractUserPromptView> const&,
44 int monitor_num, bool is_primary);44 int monitor_num, bool is_primary);
4545
46 nux::Property<bool> primary;46 nux::Property<bool> primary;
@@ -54,14 +54,13 @@
5454
55 sigc::signal<void> grabbed;55 sigc::signal<void> grabbed;
56 sigc::signal<void> grab_failed;56 sigc::signal<void> grab_failed;
57 sigc::signal<void, int, int> grab_motion;
58 sigc::signal<void, unsigned long, unsigned long> grab_key;
5957
60protected:58protected:
61 virtual bool AcceptKeyNavFocus() { return false; }59 virtual bool AcceptKeyNavFocus() { return false; }
62 virtual void ShowPrimaryView() = 0;60 virtual void ShowPrimaryView() = 0;
63 virtual void ShowSecondaryView();61 virtual void ShowSecondaryView();
6462
63 nux::Area* FindKeyFocusArea(unsigned int, unsigned long, unsigned long) override;
65 nux::Area* FindAreaUnderMouse(nux::Point const& mouse, nux::NuxEventType event_type) override;64 nux::Area* FindAreaUnderMouse(nux::Point const& mouse, nux::NuxEventType event_type) override;
6665
67 void GrabScreen(bool cancel_on_failure);66 void GrabScreen(bool cancel_on_failure);
@@ -69,7 +68,6 @@
69 void UpdateScale();68 void UpdateScale();
7069
71 session::Manager::Ptr session_manager_;70 session::Manager::Ptr session_manager_;
72 indicator::Indicators::Ptr indicators_;
73 Accelerators::Ptr accelerators_;71 Accelerators::Ptr accelerators_;
74 nux::ObjectPtr<AbstractUserPromptView> prompt_view_;72 nux::ObjectPtr<AbstractUserPromptView> prompt_view_;
75 std::shared_ptr<BackgroundSettings> bg_settings_;73 std::shared_ptr<BackgroundSettings> bg_settings_;
7674
=== modified file 'lockscreen/LockScreenController.cpp'
--- lockscreen/LockScreenController.cpp 2016-07-05 10:22:42 +0000
+++ lockscreen/LockScreenController.cpp 2017-12-01 18:43:57 +0000
@@ -27,7 +27,9 @@
27#include "LockScreenPromptFactory.h"27#include "LockScreenPromptFactory.h"
28#include "LockScreenShield.h"28#include "LockScreenShield.h"
29#include "LockScreenSettings.h"29#include "LockScreenSettings.h"
30#include "UserAuthenticatorPam.h"
30#include "unity-shared/AnimationUtils.h"31#include "unity-shared/AnimationUtils.h"
32#include "unity-shared/InputMonitor.h"
31#include "unity-shared/UnitySettings.h"33#include "unity-shared/UnitySettings.h"
32#include "unity-shared/UScreen.h"34#include "unity-shared/UScreen.h"
33#include "unity-shared/WindowManager.h"35#include "unity-shared/WindowManager.h"
@@ -66,10 +68,13 @@
66 , upstart_wrapper_(upstart_wrapper)68 , upstart_wrapper_(upstart_wrapper)
67 , shield_factory_(shield_factory)69 , shield_factory_(shield_factory)
68 , suspend_inhibitor_manager_(std::make_shared<SuspendInhibitorManager>())70 , suspend_inhibitor_manager_(std::make_shared<SuspendInhibitorManager>())
71 , user_authenticator_(std::make_shared<UserAuthenticatorPam>())
69 , fade_animator_(unity::Settings::Instance().low_gfx() ? 0 : LOCK_FADE_DURATION)72 , fade_animator_(unity::Settings::Instance().low_gfx() ? 0 : LOCK_FADE_DURATION)
70 , blank_window_animator_(IDLE_FADE_DURATION)73 , blank_window_animator_(IDLE_FADE_DURATION)
71 , test_mode_(test_mode)74 , test_mode_(test_mode)
72 , prompt_activation_(false)75 , prompt_activation_(false)
76 , is_paint_inhibited_(false)
77 , buffer_cleared_(true)
73{78{
74 auto* uscreen = UScreen::GetDefault();79 auto* uscreen = UScreen::GetDefault();
75 uscreen_connection_ = uscreen->changed.connect([this] (int, std::vector<nux::Geometry> const& monitors) {80 uscreen_connection_ = uscreen->changed.connect([this] (int, std::vector<nux::Geometry> const& monitors) {
@@ -87,7 +92,13 @@
87 suspend_inhibitor_manager_->connected.connect(sigc::mem_fun(this, &Controller::SyncInhibitor));92 suspend_inhibitor_manager_->connected.connect(sigc::mem_fun(this, &Controller::SyncInhibitor));
88 suspend_inhibitor_manager_->about_to_suspend.connect([this] () {93 suspend_inhibitor_manager_->about_to_suspend.connect([this] () {
89 if (Settings::Instance().lock_on_suspend())94 if (Settings::Instance().lock_on_suspend())
95 {
96 InhibitPaint();
90 session_manager_->PromptLockScreen();97 session_manager_->PromptLockScreen();
98 }
99 });
100 suspend_inhibitor_manager_->resumed.connect([this] () {
101 UninhibitPaint();
91 });102 });
92103
93 Settings::Instance().lock_on_suspend.changed.connect(sigc::hide(sigc::mem_fun(this, &Controller::SyncInhibitor)));104 Settings::Instance().lock_on_suspend.changed.connect(sigc::hide(sigc::mem_fun(this, &Controller::SyncInhibitor)));
@@ -117,6 +128,8 @@
117128
118 if (animation::GetDirection(fade_animator_) == animation::Direction::BACKWARD)129 if (animation::GetDirection(fade_animator_) == animation::Direction::BACKWARD)
119 {130 {
131 auto events_cb = sigc::track_obj(sigc::mem_fun(this, &Controller::OnLockScreenInputEvent), *primary_shield_);
132 input::Monitor::Get().UnregisterClient(events_cb);
120 primary_shield_connections_.Clear();133 primary_shield_connections_.Clear();
121 uscreen_connection_->block();134 uscreen_connection_->block();
122 hidden_window_connection_->block();135 hidden_window_connection_->block();
@@ -130,7 +143,7 @@
130143
131 upstart_wrapper_->Emit("desktop-unlock");144 upstart_wrapper_->Emit("desktop-unlock");
132 accelerator_controller_.reset();145 accelerator_controller_.reset();
133 indicators_.reset();146 menu_manager_.reset();
134 }147 }
135 else if (!prompt_activation_)148 else if (!prompt_activation_)
136 {149 {
@@ -195,6 +208,20 @@
195 break;208 break;
196 }209 }
197 }210 }
211}
212
213void Controller::OnLockScreenInputEvent(XEvent const& event)
214{
215 switch (event.type)
216 {
217 case MotionNotify:
218 case ButtonPress:
219 if (primary_shield_->IsIndicatorOpen())
220 break;
221 case ButtonRelease:
222 OnPrimaryShieldMotion(event.xmotion.x_root, event.xmotion.y_root);
223 break;
224 }
198225
199 ResetPostLockScreenSaver();226 ResetPostLockScreenSaver();
200}227}
@@ -206,11 +233,8 @@
206233
207 primary_shield_connections_.Clear();234 primary_shield_connections_.Clear();
208235
209 auto move_cb = sigc::mem_fun(this, &Controller::OnPrimaryShieldMotion);236 auto events_cb = sigc::track_obj(sigc::mem_fun(this, &Controller::OnLockScreenInputEvent), *primary_shield_);
210 primary_shield_connections_.Add(primary_shield_->grab_motion.connect(move_cb));237 input::Monitor::Get().RegisterClient(input::Events::INPUT, events_cb);
211
212 auto key_cb = sigc::hide(sigc::hide(sigc::mem_fun(this, &Controller::ResetPostLockScreenSaver)));
213 primary_shield_connections_.Add(primary_shield_->grab_key.connect(key_cb));
214238
215 if (!session_manager_->is_locked())239 if (!session_manager_->is_locked())
216 {240 {
@@ -241,7 +265,7 @@
241265
242 if (!prompt_view)266 if (!prompt_view)
243 {267 {
244 prompt_view = test_mode_ ? nux::ObjectPtr<AbstractUserPromptView>() : PromptFactory::CreatePrompt(session_manager_);268 prompt_view = test_mode_ ? nux::ObjectPtr<AbstractUserPromptView>() : PromptFactory::CreatePrompt(session_manager_, user_authenticator_);
245 prompt_view_ = prompt_view.GetPointer();269 prompt_view_ = prompt_view.GetPointer();
246 }270 }
247271
@@ -252,7 +276,7 @@
252276
253 if (i >= shields_size)277 if (i >= shields_size)
254 {278 {
255 shield = shield_factory_->CreateShield(session_manager_, indicators_, accelerator_controller_->GetAccelerators(), prompt_view, i, i == primary);279 shield = shield_factory_->CreateShield(session_manager_, menu_manager_, accelerator_controller_->GetAccelerators(), prompt_view, i, i == primary);
256 is_new = true;280 is_new = true;
257 }281 }
258282
@@ -314,10 +338,19 @@
314 blank_window_->ShowWindow(false);338 blank_window_->ShowWindow(false);
315 animation::SetValue(blank_window_animator_, animation::Direction::BACKWARD);339 animation::SetValue(blank_window_animator_, animation::Direction::BACKWARD);
316340
341 if (prompt_activation_)
342 BlankWindowGrabEnable(false);
343
317 blank_window_.Release();344 blank_window_.Release();
318 lockscreen_delay_timeout_.reset();345 lockscreen_delay_timeout_.reset();
319}346}
320347
348void Controller::OnBlankWindowInputEvent(XEvent const&)
349{
350 if (!lockscreen_timeout_)
351 HideBlankWindow();
352}
353
321void Controller::BlankWindowGrabEnable(bool grab)354void Controller::BlankWindowGrabEnable(bool grab)
322{355{
323 if (!blank_window_)356 if (!blank_window_)
@@ -325,41 +358,29 @@
325358
326 if (grab)359 if (grab)
327 {360 {
328 for (auto const& shield : shields_)361 if (!primary_shield_.IsValid())
329 {362 {
330 shield->UnGrabPointer();363 blank_window_->EnableInputWindow(true);
331 shield->UnGrabKeyboard();364 blank_window_->GrabPointer();
365 blank_window_->GrabKeyboard();
332 }366 }
333367
334 blank_window_->EnableInputWindow(true);368 input::Monitor::Get().RegisterClient(input::Events::INPUT, sigc::mem_fun(this, &Controller::OnBlankWindowInputEvent));
335 blank_window_->GrabPointer();
336 blank_window_->GrabKeyboard();
337 nux::GetWindowCompositor().SetAlwaysOnFrontWindow(blank_window_.GetPointer());369 nux::GetWindowCompositor().SetAlwaysOnFrontWindow(blank_window_.GetPointer());
338
339 blank_window_->mouse_move.connect([this](int, int, int dx, int dy, unsigned long, unsigned long) {
340 if ((dx || dy) && !lockscreen_timeout_) HideBlankWindow();
341 });
342 blank_window_->key_down.connect([this] (unsigned long et, unsigned long k, unsigned long s, const char* c, unsigned short kc) {
343 if (prompt_view_.GetPointer() && prompt_view_->focus_view())
344 prompt_view_->focus_view()->key_down.emit(et, k, s, c, kc);
345 if (!lockscreen_timeout_) HideBlankWindow();
346 });
347 blank_window_->mouse_down.connect([this] (int, int, unsigned long, unsigned long) {
348 if (!lockscreen_timeout_) HideBlankWindow();
349 });
350 }370 }
351 else371 else
352 {372 {
353 blank_window_->UnGrabPointer();373 input::Monitor::Get().UnregisterClient(sigc::mem_fun(this, &Controller::OnBlankWindowInputEvent));
354 blank_window_->UnGrabKeyboard();374
355375 if (primary_shield_.IsValid())
356 for (auto const& shield : shields_)376 {
357 {377 primary_shield_->GrabPointer();
358 if (!shield->primary())378 primary_shield_->GrabKeyboard();
359 continue;379 }
360380 else
361 shield->GrabPointer();381 {
362 shield->GrabKeyboard();382 blank_window_->UnGrabPointer();
383 blank_window_->UnGrabKeyboard();
363 }384 }
364 }385 }
365}386}
@@ -382,6 +403,7 @@
382 if (prompt)403 if (prompt)
383 {404 {
384 EnsureBlankWindow();405 EnsureBlankWindow();
406 BlankWindowGrabEnable(true);
385 blank_window_->SetOpacity(1.0);407 blank_window_->SetOpacity(1.0);
386 }408 }
387409
@@ -462,7 +484,8 @@
462484
463void Controller::LockScreen()485void Controller::LockScreen()
464{486{
465 indicators_ = std::make_shared<indicator::LockScreenDBusIndicators>();487 menu_manager_ = std::make_shared<menu::Manager>(std::make_shared<indicator::LockScreenDBusIndicators>(), key_grabber_);
488 menu_manager_->Indicators()->icon_paths_changed.clear(); // Ignore custom icon themes for lockscreen, see bug #1635625
466 upstart_wrapper_->Emit("desktop-lock");489 upstart_wrapper_->Emit("desktop-lock");
467490
468 accelerator_controller_ = std::make_shared<AcceleratorController>(key_grabber_);491 accelerator_controller_ = std::make_shared<AcceleratorController>(key_grabber_);
@@ -536,6 +559,36 @@
536 return primary_shield_.IsValid() ? primary_shield_->IsIndicatorOpen() : false;559 return primary_shield_.IsValid() ? primary_shield_->IsIndicatorOpen() : false;
537}560}
538561
562void Controller::InhibitPaint()
563{
564 buffer_cleared_ = false;
565 is_paint_inhibited_ = true;
566}
567
568void Controller::UninhibitPaint()
569{
570 if (!is_paint_inhibited_)
571 return;
572
573 buffer_cleared_ = true;
574 is_paint_inhibited_ = false;
575 SyncInhibitor();
576}
577
578bool Controller::IsPaintInhibited() const
579{
580 return is_paint_inhibited_;
581}
582
583void Controller::MarkBufferHasCleared()
584{
585 if (buffer_cleared_)
586 return;
587
588 buffer_cleared_ = true;
589 SyncInhibitor();
590}
591
539void Controller::SyncInhibitor()592void Controller::SyncInhibitor()
540{593{
541 bool locked = IsLocked() && primary_shield_.IsValid() && primary_shield_->GetOpacity() == 1.0f;594 bool locked = IsLocked() && primary_shield_.IsValid() && primary_shield_->GetOpacity() == 1.0f;
@@ -546,7 +599,7 @@
546599
547 if (inhibit)600 if (inhibit)
548 suspend_inhibitor_manager_->Inhibit("Unity needs to lock the screen");601 suspend_inhibitor_manager_->Inhibit("Unity needs to lock the screen");
549 else602 else if (buffer_cleared_)
550 suspend_inhibitor_manager_->Uninhibit();603 suspend_inhibitor_manager_->Uninhibit();
551}604}
552605
553606
=== modified file 'lockscreen/LockScreenController.h'
--- lockscreen/LockScreenController.h 2016-06-21 14:44:00 +0000
+++ lockscreen/LockScreenController.h 2017-12-01 18:43:57 +0000
@@ -29,8 +29,8 @@
29#include "LockScreenAcceleratorController.h"29#include "LockScreenAcceleratorController.h"
30#include "SuspendInhibitorManager.h"30#include "SuspendInhibitorManager.h"
31#include "ScreenSaverDBusManager.h"31#include "ScreenSaverDBusManager.h"
32#include "UserAuthenticator.h"
32#include "unity-shared/BackgroundEffectHelper.h"33#include "unity-shared/BackgroundEffectHelper.h"
33#include "unity-shared/KeyGrabber.h"
34#include "unity-shared/UpstartWrapper.h"34#include "unity-shared/UpstartWrapper.h"
3535
36namespace unity36namespace unity
@@ -54,6 +54,8 @@
5454
55 bool IsLocked() const;55 bool IsLocked() const;
56 bool HasOpenMenu() const;56 bool HasOpenMenu() const;
57 bool IsPaintInhibited() const;
58 void MarkBufferHasCleared();
5759
58private:60private:
59 friend class TestLockScreenController;61 friend class TestLockScreenController;
@@ -77,6 +79,11 @@
77 void OnPresenceStatusChanged(bool idle);79 void OnPresenceStatusChanged(bool idle);
78 void OnScreenSaverActivationRequest(bool activate);80 void OnScreenSaverActivationRequest(bool activate);
79 void OnPrimaryShieldMotion(int x, int y);81 void OnPrimaryShieldMotion(int x, int y);
82 void OnLockScreenInputEvent(XEvent const&);
83 void OnBlankWindowInputEvent(XEvent const&);
84
85 void InhibitPaint();
86 void UninhibitPaint();
8087
81 std::vector<nux::ObjectPtr<BaseShield>> shields_;88 std::vector<nux::ObjectPtr<BaseShield>> shields_;
82 nux::ObjectWeakPtr<BaseShield> primary_shield_;89 nux::ObjectWeakPtr<BaseShield> primary_shield_;
@@ -85,12 +92,13 @@
8592
86 DBusManager::Ptr dbus_manager_;93 DBusManager::Ptr dbus_manager_;
87 session::Manager::Ptr session_manager_;94 session::Manager::Ptr session_manager_;
95 menu::Manager::Ptr menu_manager_;
88 key::Grabber::Ptr key_grabber_;96 key::Grabber::Ptr key_grabber_;
89 indicator::Indicators::Ptr indicators_;
90 AcceleratorController::Ptr accelerator_controller_;97 AcceleratorController::Ptr accelerator_controller_;
91 UpstartWrapper::Ptr upstart_wrapper_;98 UpstartWrapper::Ptr upstart_wrapper_;
92 ShieldFactoryInterface::Ptr shield_factory_;99 ShieldFactoryInterface::Ptr shield_factory_;
93 SuspendInhibitorManager::Ptr suspend_inhibitor_manager_;100 SuspendInhibitorManager::Ptr suspend_inhibitor_manager_;
101 UserAuthenticator::Ptr user_authenticator_;
94102
95 nux::animation::AnimateValue<double> fade_animator_;103 nux::animation::AnimateValue<double> fade_animator_;
96 nux::animation::AnimateValue<double> blank_window_animator_;104 nux::animation::AnimateValue<double> blank_window_animator_;
@@ -98,6 +106,8 @@
98 bool test_mode_;106 bool test_mode_;
99 bool prompt_activation_;107 bool prompt_activation_;
100 BlurType old_blur_type_;108 BlurType old_blur_type_;
109 bool is_paint_inhibited_;
110 bool buffer_cleared_;
101111
102 connection::Wrapper uscreen_connection_;112 connection::Wrapper uscreen_connection_;
103 connection::Wrapper hidden_window_connection_;113 connection::Wrapper hidden_window_connection_;
104114
=== modified file 'lockscreen/LockScreenPanel.cpp'
--- lockscreen/LockScreenPanel.cpp 2015-11-05 14:55:54 +0000
+++ lockscreen/LockScreenPanel.cpp 2017-12-01 18:43:57 +0000
@@ -24,7 +24,7 @@
2424
25#include "LockScreenSettings.h"25#include "LockScreenSettings.h"
26#include "panel/PanelIndicatorsView.h"26#include "panel/PanelIndicatorsView.h"
27#include "unity-shared/CairoTexture.h"27#include "unity-shared/InputMonitor.h"
28#include "unity-shared/StaticCairoText.h"28#include "unity-shared/StaticCairoText.h"
29#include "unity-shared/PanelStyle.h"29#include "unity-shared/PanelStyle.h"
30#include "unity-shared/RawPixel.h"30#include "unity-shared/RawPixel.h"
@@ -38,24 +38,24 @@
38namespace38namespace
39{39{
40const RawPixel PADDING = 5_em;40const RawPixel PADDING = 5_em;
41const nux::Color BG_COLOR(0.1, 0.1, 0.1, 0.4);
41}42}
4243
43using namespace indicator;44using namespace indicator;
44using namespace panel;45using namespace panel;
4546
46Panel::Panel(int monitor_, Indicators::Ptr const& indicators, session::Manager::Ptr const& session_manager)47Panel::Panel(int monitor_, menu::Manager::Ptr const& menu_manager, session::Manager::Ptr const& session_manager)
47 : nux::View(NUX_TRACKER_LOCATION)48 : nux::View(NUX_TRACKER_LOCATION)
48 , active(false)49 , active(false)
49 , monitor(monitor_)50 , monitor(monitor_)
50 , indicators_(indicators)51 , menu_manager_(menu_manager)
51 , needs_geo_sync_(true)52 , needs_geo_sync_(true)
52{53{
53 double scale = unity::Settings::Instance().em(monitor)->DPIScale();54 double scale = unity::Settings::Instance().em(monitor)->DPIScale();
54 auto* layout = new nux::HLayout();55 auto* layout = new nux::HLayout();
55 layout->SetLeftAndRightPadding(PADDING.CP(scale), 0);56 layout->SetLeftAndRightPadding(PADDING.CP(scale), 0);
56 SetLayout(layout);57 SetLayout(layout);
5758 UpdateSize();
58 BuildTexture();
5959
60 // Add setting60 // Add setting
61 auto *hostname = new StaticCairoText(session_manager->HostName());61 auto *hostname = new StaticCairoText(session_manager->HostName());
@@ -72,34 +72,33 @@
72 indicators_view_->on_indicator_updated.connect(sigc::mem_fun(this, &Panel::OnIndicatorViewUpdated));72 indicators_view_->on_indicator_updated.connect(sigc::mem_fun(this, &Panel::OnIndicatorViewUpdated));
73 layout->AddView(indicators_view_, 1, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL);73 layout->AddView(indicators_view_, 1, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL);
7474
75 for (auto const& indicator : indicators_->GetIndicators())75 auto indicators = menu_manager_->Indicators();
76 menu_manager_->RegisterTracker(GetPanelName(), (sigc::track_obj([this] (int x, int y, double speed) {
77 indicators_view_->ActivateEntryAt(x, y);
78 }, *this)));
79
80 for (auto const& indicator : indicators->GetIndicators())
76 AddIndicator(indicator);81 AddIndicator(indicator);
7782
78 indicators_->on_object_added.connect(sigc::mem_fun(this, &Panel::AddIndicator));83 indicators->on_object_added.connect(sigc::mem_fun(this, &Panel::AddIndicator));
79 indicators_->on_object_removed.connect(sigc::mem_fun(this, &Panel::RemoveIndicator));84 indicators->on_object_removed.connect(sigc::mem_fun(this, &Panel::RemoveIndicator));
80 indicators_->on_entry_show_menu.connect(sigc::mem_fun(this, &Panel::OnEntryShowMenu));85 indicators->on_entry_show_menu.connect(sigc::mem_fun(this, &Panel::OnEntryShowMenu));
81 indicators_->on_entry_activated.connect(sigc::mem_fun(this, &Panel::OnEntryActivated));86 indicators->on_entry_activated.connect(sigc::mem_fun(this, &Panel::OnEntryActivated));
82 indicators_->on_entry_activate_request.connect(sigc::mem_fun(this, &Panel::OnEntryActivateRequest));87 indicators->on_entry_activate_request.connect(sigc::mem_fun(this, &Panel::OnEntryActivateRequest));
8388
84 monitor.changed.connect([this, hostname] (int monitor) {89 monitor.changed.connect([this, hostname] (int monitor) {
85 double scale = unity::Settings::Instance().em(monitor)->DPIScale();90 double scale = unity::Settings::Instance().em(monitor)->DPIScale();
86 hostname->SetScale(scale);91 hostname->SetScale(scale);
87 static_cast<nux::HLayout*>(GetLayout())->SetLeftAndRightPadding(PADDING.CP(scale), 0);92 static_cast<nux::HLayout*>(GetLayout())->SetLeftAndRightPadding(PADDING.CP(scale), 0);
88 indicators_view_->SetMonitor(monitor);93 indicators_view_->SetMonitor(monitor);
89 BuildTexture();94 UpdateSize();
90 QueueRelayout();95 QueueRelayout();
91 });96 });
92}97}
9398
94void Panel::BuildTexture()99void Panel::UpdateSize()
95{100{
96 int height = panel::Style::Instance().PanelHeight(monitor);101 int height = panel::Style::Instance().PanelHeight(monitor);
97 nux::CairoGraphics context(CAIRO_FORMAT_ARGB32, 1, height);
98 auto* cr = context.GetInternalContext();
99 cairo_set_source_rgb(cr, 0.1, 0.1, 0.1);
100 cairo_paint_with_alpha(cr, 0.4);
101 bg_texture_ = texture_ptr_from_cairo_graphics(context);
102
103 view_layout_->SetMinimumHeight(height);102 view_layout_->SetMinimumHeight(height);
104 view_layout_->SetMaximumHeight(height);103 view_layout_->SetMaximumHeight(height);
105}104}
@@ -150,7 +149,7 @@
150149
151std::string Panel::GetPanelName() const150std::string Panel::GetPanelName() const
152{151{
153 return "LockScreenPanel";152 return "LockScreenPanel" + std::to_string(reinterpret_cast<uintptr_t>(this));
154}153}
155154
156void Panel::OnIndicatorViewUpdated()155void Panel::OnIndicatorViewUpdated()
@@ -165,12 +164,7 @@
165 if (!GetInputEventSensitivity())164 if (!GetInputEventSensitivity())
166 return;165 return;
167166
168 if (!active)167 active = true;
169 {
170 // This is ugly... But Nux fault!
171 WindowManager::Default().UnGrabMousePointer(CurrentTime, button, x, y);
172 active = true;
173 }
174}168}
175169
176void Panel::OnEntryActivateRequest(std::string const& entry_id)170void Panel::OnEntryActivateRequest(std::string const& entry_id)
@@ -184,36 +178,16 @@
184 if (!GetInputEventSensitivity() || (!panel.empty() && panel != GetPanelName()))178 if (!GetInputEventSensitivity() || (!panel.empty() && panel != GetPanelName()))
185 return;179 return;
186180
187 bool active = !entry_id.empty();181 bool valid_entry = !entry_id.empty();
188182
189 if (active && !WindowManager::Default().IsScreenGrabbed())183 if (valid_entry && !WindowManager::Default().IsScreenGrabbed())
190 {184 {
191 // The menu didn't grab the keyboard, let's take it back.185 // The menu didn't grab the keyboard, let's take it back.
192 nux::GetWindowCompositor().GrabKeyboardAdd(static_cast<nux::BaseWindow*>(GetTopLevelViewWindow()));186 nux::GetWindowCompositor().GrabKeyboardAdd(static_cast<nux::BaseWindow*>(GetTopLevelViewWindow()));
193 }187 }
194188
195 if (active && !track_menu_pointer_timeout_)189 if (!valid_entry)
196 {190 active = valid_entry;
197 track_menu_pointer_timeout_.reset(new glib::Timeout(16));
198 track_menu_pointer_timeout_->Run([this] {
199 nux::Point const& mouse = nux::GetGraphicsDisplay()->GetMouseScreenCoord();
200 if (tracked_pointer_pos_ != mouse)
201 {
202 if (GetAbsoluteGeometry().IsPointInside(mouse.x, mouse.y))
203 indicators_view_->ActivateEntryAt(mouse.x, mouse.y);
204
205 tracked_pointer_pos_ = mouse;
206 }
207
208 return true;
209 });
210 }
211 else if (!active)
212 {
213 track_menu_pointer_timeout_.reset();
214 tracked_pointer_pos_ = {-1, -1};
215 this->active = false;
216 }
217}191}
218192
219void Panel::Draw(nux::GraphicsEngine& graphics_engine, bool force_draw)193void Panel::Draw(nux::GraphicsEngine& graphics_engine, bool force_draw)
@@ -227,12 +201,7 @@
227 graphics_engine.PushClippingRectangle(geo);201 graphics_engine.PushClippingRectangle(geo);
228 nux::GetPainter().PaintBackground(graphics_engine, geo);202 nux::GetPainter().PaintBackground(graphics_engine, geo);
229203
230 nux::TexCoordXForm texxform;204 graphics_engine.QRP_Color(geo.x, geo.y, geo.width, geo.height, BG_COLOR);
231 texxform.SetWrap(nux::TEXWRAP_REPEAT, nux::TEXWRAP_CLAMP);
232 graphics_engine.QRP_1Tex(geo.x, geo.y, geo.width, geo.height,
233 bg_texture_->GetDeviceTexture(), texxform,
234 nux::color::White);
235
236 view_layout_->ProcessDraw(graphics_engine, force_draw);205 view_layout_->ProcessDraw(graphics_engine, force_draw);
237206
238 graphics_engine.PopClippingRectangle();207 graphics_engine.PopClippingRectangle();
@@ -242,7 +211,7 @@
242 {211 {
243 EntryLocationMap locations;212 EntryLocationMap locations;
244 indicators_view_->GetGeometryForSync(locations);213 indicators_view_->GetGeometryForSync(locations);
245 indicators_->SyncGeometries(GetPanelName(), locations);214 menu_manager_->Indicators()->SyncGeometries(GetPanelName(), locations);
246 needs_geo_sync_ = false;215 needs_geo_sync_ = false;
247 }216 }
248}217}
249218
=== modified file 'lockscreen/LockScreenPanel.h'
--- lockscreen/LockScreenPanel.h 2016-03-31 09:51:33 +0000
+++ lockscreen/LockScreenPanel.h 2017-12-01 18:43:57 +0000
@@ -22,9 +22,9 @@
2222
23#include <Nux/Nux.h>23#include <Nux/Nux.h>
24#include <Nux/View.h>24#include <Nux/View.h>
25#include "UnityCore/Indicators.h"
26#include "UnityCore/GLibSource.h"25#include "UnityCore/GLibSource.h"
27#include "UnityCore/SessionManager.h"26#include "UnityCore/SessionManager.h"
27#include "unity-shared/MenuManager.h"
2828
29namespace unity29namespace unity
30{30{
@@ -39,7 +39,7 @@
39class Panel : public nux::View39class Panel : public nux::View
40{40{
41public:41public:
42 Panel(int monitor, indicator::Indicators::Ptr const&, session::Manager::Ptr const&);42 Panel(int monitor, menu::Manager::Ptr const&, session::Manager::Ptr const&);
4343
44 nux::Property<bool> active;44 nux::Property<bool> active;
45 nux::Property<int> monitor;45 nux::Property<int> monitor;
@@ -55,20 +55,16 @@
55 void AddIndicator(indicator::Indicator::Ptr const&);55 void AddIndicator(indicator::Indicator::Ptr const&);
56 void RemoveIndicator(indicator::Indicator::Ptr const&);56 void RemoveIndicator(indicator::Indicator::Ptr const&);
57 void OnIndicatorViewUpdated();57 void OnIndicatorViewUpdated();
58 void OnEntryActivated(std::string const& panel, std::string const& entry_id, nux::Rect const& geo);58 void OnEntryActivated(std::string const& panel, std::string const& entry_id, nux::Rect const&);
59 void OnEntryShowMenu(std::string const& entry_id, unsigned xid, int x, int y, unsigned button);59 void OnEntryShowMenu(std::string const& entry_id, unsigned xid, int x, int y, unsigned button);
60 void OnEntryActivateRequest(std::string const& entry_id);60 void OnEntryActivateRequest(std::string const& entry_id);
6161
62 void BuildTexture();62 void UpdateSize();
63 std::string GetPanelName() const;63 std::string GetPanelName() const;
6464
65 indicator::Indicators::Ptr indicators_;65 menu::Manager::Ptr menu_manager_;
66 panel::PanelIndicatorsView* indicators_view_;66 panel::PanelIndicatorsView* indicators_view_;
67 nux::ObjectPtr<nux::BaseTexture> bg_texture_;
68
69 bool needs_geo_sync_;67 bool needs_geo_sync_;
70 nux::Point tracked_pointer_pos_;
71 glib::Source::UniquePtr track_menu_pointer_timeout_;
72};68};
7369
74} // lockscreen namespace70} // lockscreen namespace
7571
=== modified file 'lockscreen/LockScreenPromptFactory.cpp'
--- lockscreen/LockScreenPromptFactory.cpp 2015-12-04 08:17:46 +0000
+++ lockscreen/LockScreenPromptFactory.cpp 2017-12-01 18:43:57 +0000
@@ -26,14 +26,15 @@
26{26{
27namespace lockscreen27namespace lockscreen
28{28{
29nux::ObjectPtr<AbstractUserPromptView> PromptFactory::CreatePrompt(session::Manager::Ptr const& sm)29nux::ObjectPtr<AbstractUserPromptView> PromptFactory::CreatePrompt(session::Manager::Ptr const& sm,
30 UserAuthenticator::Ptr const& ua)
30{31{
31 nux::ObjectPtr<AbstractUserPromptView> prompt;32 nux::ObjectPtr<AbstractUserPromptView> prompt;
3233
33 if (unity::Settings::Instance().desktop_type() == DesktopType::UBUNTUKYLIN)34 if (unity::Settings::Instance().desktop_type() == DesktopType::UBUNTUKYLIN)
34 prompt = new KylinUserPromptView(sm);35 prompt = new KylinUserPromptView(sm, ua);
35 else36 else
36 prompt = new UserPromptView(sm);37 prompt = new UserPromptView(sm, ua);
3738
38 return prompt;39 return prompt;
39}40}
4041
=== modified file 'lockscreen/LockScreenPromptFactory.h'
--- lockscreen/LockScreenPromptFactory.h 2016-03-31 09:51:33 +0000
+++ lockscreen/LockScreenPromptFactory.h 2017-12-01 18:43:57 +0000
@@ -22,6 +22,7 @@
2222
23#include <NuxCore/NuxCore.h>23#include <NuxCore/NuxCore.h>
24#include "UnityCore/SessionManager.h"24#include "UnityCore/SessionManager.h"
25#include "UserAuthenticator.h"
2526
26namespace unity27namespace unity
27{28{
@@ -33,7 +34,8 @@
3334
34struct PromptFactory35struct PromptFactory
35{36{
36 static nux::ObjectPtr<AbstractUserPromptView> CreatePrompt(session::Manager::Ptr const&);37 static nux::ObjectPtr<AbstractUserPromptView> CreatePrompt(session::Manager::Ptr const&,
38 UserAuthenticator::Ptr const&);
37};39};
3840
39}41}
4042
=== modified file 'lockscreen/LockScreenShield.cpp'
--- lockscreen/LockScreenShield.cpp 2015-12-03 14:13:10 +0000
+++ lockscreen/LockScreenShield.cpp 2017-12-01 18:43:57 +0000
@@ -32,11 +32,12 @@
32{32{
3333
34Shield::Shield(session::Manager::Ptr const& session_manager,34Shield::Shield(session::Manager::Ptr const& session_manager,
35 indicator::Indicators::Ptr const& indicators,35 menu::Manager::Ptr const& menu_manager,
36 Accelerators::Ptr const& accelerators,36 Accelerators::Ptr const& accelerators,
37 nux::ObjectPtr<AbstractUserPromptView> const& prompt_view,37 nux::ObjectPtr<AbstractUserPromptView> const& prompt_view,
38 int monitor_num, bool is_primary)38 int monitor_num, bool is_primary)
39 : BaseShield(session_manager, indicators, accelerators, prompt_view, monitor_num, is_primary)39 : BaseShield(session_manager, accelerators, prompt_view, monitor_num, is_primary)
40 , menu_manager_(menu_manager)
40 , panel_view_(nullptr)41 , panel_view_(nullptr)
41{42{
42 is_primary ? ShowPrimaryView() : ShowSecondaryView();43 is_primary ? ShowPrimaryView() : ShowSecondaryView();
@@ -91,11 +92,11 @@
9192
92Panel* Shield::CreatePanel()93Panel* Shield::CreatePanel()
93{94{
94 if (!indicators_ || !session_manager_)95 if (!menu_manager_ || !session_manager_)
95 return nullptr;96 return nullptr;
9697
97 panel_view_ = new Panel(monitor, indicators_, session_manager_);98 panel_view_ = new Panel(monitor, menu_manager_, session_manager_);
98 panel_active_conn_ = panel_view_->active.changed.connect([this] (bool active) {99 panel_view_->active.changed.connect(sigc::track_obj([this] (bool active) {
99 if (primary())100 if (primary())
100 {101 {
101 if (active)102 if (active)
@@ -109,7 +110,7 @@
109 GrabScreen(false);110 GrabScreen(false);
110 }111 }
111 }112 }
112 });113 }, *this));
113114
114 return panel_view_;115 return panel_view_;
115}116}
@@ -118,8 +119,6 @@
118{119{
119 if (primary)120 if (primary)
120 {121 {
121 grab_key.emit(modifiers, keysym);
122
123 if (accelerators_)122 if (accelerators_)
124 {123 {
125 if (etype == nux::EVENT_KEY_DOWN)124 if (etype == nux::EVENT_KEY_DOWN)
@@ -133,17 +132,9 @@
133 return panel_view_;132 return panel_view_;
134 }133 }
135 }134 }
136
137 if (prompt_view_)
138 {
139 auto* focus_view = prompt_view_->focus_view();
140
141 if (focus_view && focus_view->GetInputEventSensitivity())
142 return focus_view;
143 }
144 }135 }
145136
146 return nullptr;137 return BaseShield::FindKeyFocusArea(etype, keysym, modifiers);
147}138}
148139
149bool Shield::IsIndicatorOpen() const140bool Shield::IsIndicatorOpen() const
150141
=== modified file 'lockscreen/LockScreenShield.h'
--- lockscreen/LockScreenShield.h 2015-12-03 14:13:10 +0000
+++ lockscreen/LockScreenShield.h 2017-12-01 18:43:57 +0000
@@ -20,8 +20,9 @@
20#ifndef UNITY_LOCKSCREEN_SHIELD_H20#ifndef UNITY_LOCKSCREEN_SHIELD_H
21#define UNITY_LOCKSCREEN_SHIELD_H21#define UNITY_LOCKSCREEN_SHIELD_H
2222
23#include <UnityCore/ConnectionManager.h>
24#include "LockScreenBaseShield.h"23#include "LockScreenBaseShield.h"
24#include "unity-shared/MenuManager.h"
25
2526
26namespace unity27namespace unity
27{28{
@@ -35,7 +36,7 @@
35{36{
36public:37public:
37 Shield(session::Manager::Ptr const&,38 Shield(session::Manager::Ptr const&,
38 indicator::Indicators::Ptr const&,39 menu::Manager::Ptr const&,
39 Accelerators::Ptr const&,40 Accelerators::Ptr const&,
40 nux::ObjectPtr<AbstractUserPromptView> const&,41 nux::ObjectPtr<AbstractUserPromptView> const&,
41 int monitor, bool is_primary);42 int monitor, bool is_primary);
@@ -50,7 +51,7 @@
50 void ShowPrimaryView() override;51 void ShowPrimaryView() override;
51 Panel* CreatePanel();52 Panel* CreatePanel();
5253
53 connection::Wrapper panel_active_conn_;54 menu::Manager::Ptr menu_manager_;
54 Panel* panel_view_;55 Panel* panel_view_;
55};56};
5657
5758
=== modified file 'lockscreen/LockScreenShieldFactory.cpp'
--- lockscreen/LockScreenShieldFactory.cpp 2015-12-04 08:17:46 +0000
+++ lockscreen/LockScreenShieldFactory.cpp 2017-12-01 18:43:57 +0000
@@ -28,7 +28,7 @@
28{28{
2929
30nux::ObjectPtr<BaseShield> ShieldFactory::CreateShield(session::Manager::Ptr const& session_manager,30nux::ObjectPtr<BaseShield> ShieldFactory::CreateShield(session::Manager::Ptr const& session_manager,
31 indicator::Indicators::Ptr const& indicators,31 menu::Manager::Ptr const& menu_manager,
32 Accelerators::Ptr const& accelerators,32 Accelerators::Ptr const& accelerators,
33 nux::ObjectPtr<AbstractUserPromptView> const& prompt_view,33 nux::ObjectPtr<AbstractUserPromptView> const& prompt_view,
34 int monitor, bool is_primary)34 int monitor, bool is_primary)
@@ -38,7 +38,7 @@
38 if (Settings::Instance().desktop_type() == DesktopType::UBUNTUKYLIN)38 if (Settings::Instance().desktop_type() == DesktopType::UBUNTUKYLIN)
39 shield = new KylinShield(session_manager, accelerators, prompt_view, monitor, is_primary);39 shield = new KylinShield(session_manager, accelerators, prompt_view, monitor, is_primary);
40 else40 else
41 shield = new Shield(session_manager, indicators, accelerators, prompt_view, monitor, is_primary);41 shield = new Shield(session_manager, menu_manager, accelerators, prompt_view, monitor, is_primary);
4242
43 return shield;43 return shield;
44}44}
4545
=== modified file 'lockscreen/LockScreenShieldFactory.h'
--- lockscreen/LockScreenShieldFactory.h 2016-03-31 09:51:33 +0000
+++ lockscreen/LockScreenShieldFactory.h 2017-12-01 18:43:57 +0000
@@ -22,7 +22,7 @@
2222
23#include <NuxCore/NuxCore.h>23#include <NuxCore/NuxCore.h>
24#include "UnityCore/SessionManager.h"24#include "UnityCore/SessionManager.h"
25#include "UnityCore/Indicators.h"25#include "unity-shared/MenuManager.h"
26#include "LockScreenAccelerators.h"26#include "LockScreenAccelerators.h"
2727
28namespace unity28namespace unity
@@ -41,7 +41,7 @@
41 virtual ~ShieldFactoryInterface() = default;41 virtual ~ShieldFactoryInterface() = default;
4242
43 virtual nux::ObjectPtr<BaseShield> CreateShield(session::Manager::Ptr const&,43 virtual nux::ObjectPtr<BaseShield> CreateShield(session::Manager::Ptr const&,
44 indicator::Indicators::Ptr const&,44 menu::Manager::Ptr const&,
45 Accelerators::Ptr const&,45 Accelerators::Ptr const&,
46 nux::ObjectPtr<AbstractUserPromptView> const&,46 nux::ObjectPtr<AbstractUserPromptView> const&,
47 int monitor, bool is_primary) = 0;47 int monitor, bool is_primary) = 0;
@@ -50,7 +50,7 @@
50struct ShieldFactory : ShieldFactoryInterface50struct ShieldFactory : ShieldFactoryInterface
51{51{
52 nux::ObjectPtr<BaseShield> CreateShield(session::Manager::Ptr const&,52 nux::ObjectPtr<BaseShield> CreateShield(session::Manager::Ptr const&,
53 indicator::Indicators::Ptr const&,53 menu::Manager::Ptr const&,
54 Accelerators::Ptr const&,54 Accelerators::Ptr const&,
55 nux::ObjectPtr<AbstractUserPromptView> const&,55 nux::ObjectPtr<AbstractUserPromptView> const&,
56 int monitor, bool is_primary) override;56 int monitor, bool is_primary) override;
5757
=== modified file 'lockscreen/SuspendInhibitorManager.cpp'
--- lockscreen/SuspendInhibitorManager.cpp 2016-03-31 09:59:30 +0000
+++ lockscreen/SuspendInhibitorManager.cpp 2017-12-01 18:43:57 +0000
@@ -60,6 +60,8 @@
60 lm_proxy_->Connect("PrepareForSleep", [this] (GVariant* variant) {60 lm_proxy_->Connect("PrepareForSleep", [this] (GVariant* variant) {
61 if (glib::Variant(variant).GetBool())61 if (glib::Variant(variant).GetBool())
62 parent_->about_to_suspend.emit();62 parent_->about_to_suspend.emit();
63 else
64 parent_->resumed.emit();
63 });65 });
6466
65 lm_proxy_->connected.connect(sigc::mem_fun(&parent->connected, &decltype(parent->connected)::emit));67 lm_proxy_->connected.connect(sigc::mem_fun(&parent->connected, &decltype(parent->connected)::emit));
6668
=== modified file 'lockscreen/SuspendInhibitorManager.h'
--- lockscreen/SuspendInhibitorManager.h 2016-03-31 09:59:30 +0000
+++ lockscreen/SuspendInhibitorManager.h 2017-12-01 18:43:57 +0000
@@ -42,6 +42,7 @@
4242
43 sigc::signal<void> connected;43 sigc::signal<void> connected;
44 sigc::signal<void> about_to_suspend;44 sigc::signal<void> about_to_suspend;
45 sigc::signal<void> resumed;
4546
46private:47private:
47 class Impl;48 class Impl;
4849
=== modified file 'lockscreen/UserAuthenticator.h'
--- lockscreen/UserAuthenticator.h 2014-03-05 04:09:13 +0000
+++ lockscreen/UserAuthenticator.h 2017-12-01 18:43:57 +0000
@@ -36,6 +36,7 @@
36class UserAuthenticator36class UserAuthenticator
37{37{
38public:38public:
39 typedef std::shared_ptr<UserAuthenticator> Ptr;
39 typedef std::function<void(bool)> AuthenticateEndCallback;40 typedef std::function<void(bool)> AuthenticateEndCallback;
4041
41 virtual ~UserAuthenticator() = default;42 virtual ~UserAuthenticator() = default;
@@ -43,6 +44,7 @@
43 // Authenticate the user in a background thread.44 // Authenticate the user in a background thread.
44 virtual bool AuthenticateStart(std::string const& username, AuthenticateEndCallback const&) = 0;45 virtual bool AuthenticateStart(std::string const& username, AuthenticateEndCallback const&) = 0;
4546
47 sigc::signal<void> start_failed;
46 sigc::signal<void, std::string, PromiseAuthCodePtr const&> echo_on_requested;48 sigc::signal<void, std::string, PromiseAuthCodePtr const&> echo_on_requested;
47 sigc::signal<void, std::string, PromiseAuthCodePtr const&> echo_off_requested;49 sigc::signal<void, std::string, PromiseAuthCodePtr const&> echo_off_requested;
48 sigc::signal<void, std::string> message_requested;50 sigc::signal<void, std::string> message_requested;
4951
=== modified file 'lockscreen/UserAuthenticatorPam.cpp'
--- lockscreen/UserAuthenticatorPam.cpp 2016-08-17 14:01:39 +0000
+++ lockscreen/UserAuthenticatorPam.cpp 2017-12-01 18:43:57 +0000
@@ -23,6 +23,7 @@
2323
24#include "UserAuthenticatorPam.h"24#include "UserAuthenticatorPam.h"
25#include "unity-shared/UnitySettings.h"25#include "unity-shared/UnitySettings.h"
26#include "UnityCore/GLibWrapper.h"
2627
27#include <cstring>28#include <cstring>
28#include <security/pam_appl.h>29#include <security/pam_appl.h>
@@ -36,42 +37,49 @@
36bool UserAuthenticatorPam::AuthenticateStart(std::string const& username,37bool UserAuthenticatorPam::AuthenticateStart(std::string const& username,
37 AuthenticateEndCallback const& authenticate_cb)38 AuthenticateEndCallback const& authenticate_cb)
38{39{
40 if (pam_handle_)
41 return false;
42
39 first_prompt_ = true;43 first_prompt_ = true;
40 username_ = username;44 username_ = username;
41 authenticate_cb_ = authenticate_cb;45 authenticate_cb_ = authenticate_cb;
42 pam_handle_ = nullptr;46
4347 glib::Error error;
44 if (!InitPam() || !pam_handle_)48 g_thread_try_new(nullptr, AuthenticationThreadFunc, this, &error);
45 return false;49
4650 return !error;
47 glib::Object<GTask> task(g_task_new(nullptr, cancellable_, [] (GObject*, GAsyncResult*, gpointer data) {51}
48 auto self = static_cast<UserAuthenticatorPam*>(data);52
49 pam_end(self->pam_handle_, self->status_);53gpointer UserAuthenticatorPam::AuthenticationThreadFunc(gpointer data)
50 self->authenticate_cb_(self->status_ == PAM_SUCCESS);54{
51 }, this));55 auto self = static_cast<UserAuthenticatorPam*>(data);
5256
53 g_task_set_task_data(task, this, nullptr);57 if (!self->InitPam() || !self->pam_handle_)
5458 {
55 g_task_run_in_thread(task, [] (GTask* task, gpointer, gpointer data, GCancellable*) {59 self->pam_handle_ = nullptr;
56 auto self = static_cast<UserAuthenticatorPam*>(data);60 self->source_manager_.AddTimeout(0, [self] { self->start_failed.emit(); return false; });
5761 return nullptr;
58 self->status_ = pam_authenticate(self->pam_handle_, 0);62 }
5963
60 if (self->status_ == PAM_SUCCESS)64 self->status_ = pam_authenticate(self->pam_handle_, 0);
61 {65
62 int status2 = pam_acct_mgmt(self->pam_handle_, 0);66 if (self->status_ == PAM_SUCCESS)
6367 {
64 if (status2 == PAM_NEW_AUTHTOK_REQD)68 int status2 = pam_acct_mgmt(self->pam_handle_, 0);
65 status2 = pam_chauthtok(self->pam_handle_, PAM_CHANGE_EXPIRED_AUTHTOK);69
6670 if (status2 == PAM_NEW_AUTHTOK_REQD)
67 if (unity::Settings::Instance().pam_check_account_type())71 status2 = pam_chauthtok(self->pam_handle_, PAM_CHANGE_EXPIRED_AUTHTOK);
68 self->status_ = status2;72
6973 if (unity::Settings::Instance().pam_check_account_type())
70 pam_setcred(self->pam_handle_, PAM_REINITIALIZE_CRED);74 self->status_ = status2;
71 }75
72 });76 pam_setcred(self->pam_handle_, PAM_REINITIALIZE_CRED);
7377 }
74 return true;78
79 pam_end(self->pam_handle_, self->status_);
80 self->pam_handle_ = nullptr;
81 self->source_manager_.AddTimeout(0, [self] { self->authenticate_cb_(self->status_ == PAM_SUCCESS); return false; });
82 return nullptr;
75}83}
7684
77bool UserAuthenticatorPam::InitPam()85bool UserAuthenticatorPam::InitPam()
7886
=== modified file 'lockscreen/UserAuthenticatorPam.h'
--- lockscreen/UserAuthenticatorPam.h 2014-03-05 04:09:13 +0000
+++ lockscreen/UserAuthenticatorPam.h 2017-12-01 18:43:57 +0000
@@ -20,8 +20,6 @@
20#ifndef UNITY_USER_AUTHENTICATOR_PAM_H20#ifndef UNITY_USER_AUTHENTICATOR_PAM_H
21#define UNITY_USER_AUTHENTICATOR_PAM_H21#define UNITY_USER_AUTHENTICATOR_PAM_H
2222
23#include <boost/noncopyable.hpp>
24#include <UnityCore/GLibWrapper.h>
25#include <UnityCore/GLibSource.h>23#include <UnityCore/GLibSource.h>
2624
27#include "UserAuthenticator.h"25#include "UserAuthenticator.h"
@@ -36,13 +34,17 @@
36namespace lockscreen34namespace lockscreen
37{35{
3836
39class UserAuthenticatorPam : public UserAuthenticator, private boost::noncopyable37class UserAuthenticatorPam : public UserAuthenticator
40{38{
41public:39public:
40 UserAuthenticatorPam() = default;
42 bool AuthenticateStart(std::string const& username, AuthenticateEndCallback const&) override;41 bool AuthenticateStart(std::string const& username, AuthenticateEndCallback const&) override;
4342
44private:43private:
45 // TODO (andy) move to pimpl44 UserAuthenticatorPam(UserAuthenticatorPam const&) = delete;
45 UserAuthenticatorPam& operator=(UserAuthenticatorPam const&) = delete;
46
47 static gpointer AuthenticationThreadFunc(gpointer);
46 bool InitPam();48 bool InitPam();
4749
48 static int ConversationFunction(int num_msg,50 static int ConversationFunction(int num_msg,
@@ -53,10 +55,9 @@
53 std::string username_;55 std::string username_;
54 AuthenticateEndCallback authenticate_cb_;56 AuthenticateEndCallback authenticate_cb_;
5557
56 int status_;58 int status_ = 0;
57 bool first_prompt_;59 bool first_prompt_ = true;
58 pam_handle* pam_handle_;60 pam_handle* pam_handle_ = nullptr;
59 glib::Cancellable cancellable_;
60 glib::SourceManager source_manager_;61 glib::SourceManager source_manager_;
61};62};
6263
6364
=== modified file 'lockscreen/UserPromptView.cpp'
--- lockscreen/UserPromptView.cpp 2016-06-28 16:23:27 +0000
+++ lockscreen/UserPromptView.cpp 2017-12-01 18:43:57 +0000
@@ -23,6 +23,7 @@
23#include <glib/gi18n-lib.h>23#include <glib/gi18n-lib.h>
2424
25#include <boost/algorithm/string/trim.hpp>25#include <boost/algorithm/string/trim.hpp>
26#include <NuxCore/Logger.h>
26#include <Nux/VLayout.h>27#include <Nux/VLayout.h>
2728
28#include "LockScreenSettings.h"29#include "LockScreenSettings.h"
@@ -38,6 +39,9 @@
38{39{
39namespace40namespace
40{41{
42
43DECLARE_LOGGER(logger, "unity.lockscreen");
44
41const RawPixel PADDING = 10_em;45const RawPixel PADDING = 10_em;
42const RawPixel LAYOUT_MARGIN = 10_em;46const RawPixel LAYOUT_MARGIN = 10_em;
43const RawPixel MSG_LAYOUT_MARGIN = 15_em;47const RawPixel MSG_LAYOUT_MARGIN = 15_em;
@@ -101,41 +105,46 @@
101105
102}106}
103107
104UserPromptView::UserPromptView(session::Manager::Ptr const& session_manager)108UserPromptView::UserPromptView(session::Manager::Ptr const& session_manager,
105 : AbstractUserPromptView(session_manager)109 UserAuthenticator::Ptr const& user_authenticator)
106 , session_manager_(session_manager)110 : AbstractUserPromptView(session_manager, user_authenticator)
107 , username_(nullptr)111 , username_(nullptr)
108 , msg_layout_(nullptr)112 , msg_layout_(nullptr)
109 , prompt_layout_(nullptr)113 , prompt_layout_(nullptr)
110 , button_layout_(nullptr)114 , button_layout_(nullptr)
111 , prompted_(false)115 , prompted_(false)
112 , unacknowledged_messages_(false)116 , unacknowledged_messages_(false)
117 , num_retry_auth_(0)
113{118{
114 user_authenticator_.echo_on_requested.connect([this](std::string const& message, PromiseAuthCodePtr const& promise){119 user_authenticator_->start_failed.connect(sigc::track_obj([this](){
120 HandleAuthenticationStartFailure();
121 }, *this));
122
123 user_authenticator_->echo_on_requested.connect(sigc::track_obj([this](std::string const& message, PromiseAuthCodePtr const& promise){
115 prompted_ = true;124 prompted_ = true;
116 unacknowledged_messages_ = false;125 unacknowledged_messages_ = false;
117 AddPrompt(message, /* visible */ true, promise);126 AddPrompt(message, /* visible */ true, promise);
118 });127 }, *this));
119128
120 user_authenticator_.echo_off_requested.connect([this](std::string const& message, PromiseAuthCodePtr const& promise){129 user_authenticator_->echo_off_requested.connect(sigc::track_obj([this](std::string const& message, PromiseAuthCodePtr const& promise){
121 prompted_ = true;130 prompted_ = true;
122 unacknowledged_messages_ = false;131 unacknowledged_messages_ = false;
123 AddPrompt(message, /* visible */ false, promise);132 AddPrompt(message, /* visible */ false, promise);
124 });133 }, *this));
125134
126 user_authenticator_.message_requested.connect([this](std::string const& message){135 user_authenticator_->message_requested.connect(sigc::track_obj([this](std::string const& message){
127 unacknowledged_messages_ = true;136 unacknowledged_messages_ = true;
128 AddMessage(message, nux::color::White);137 AddMessage(message, nux::color::White);
129 });138 }, *this));
130139
131 user_authenticator_.error_requested.connect([this](std::string const& message){140 user_authenticator_->error_requested.connect(sigc::track_obj([this](std::string const& message){
132 unacknowledged_messages_ = true;141 unacknowledged_messages_ = true;
133 AddMessage(message, nux::color::Red);142 AddMessage(message, nux::color::Red);
134 });143 }, *this));
135144
136 user_authenticator_.clear_prompts.connect([this](){145 user_authenticator_->clear_prompts.connect(sigc::track_obj([this](){
137 ResetLayout();146 ResetLayout();
138 });147 }, *this));
139148
140 scale.changed.connect(sigc::hide(sigc::mem_fun(this, &UserPromptView::UpdateSize)));149 scale.changed.connect(sigc::hide(sigc::mem_fun(this, &UserPromptView::UpdateSize)));
141150
@@ -469,13 +478,40 @@
469 prompted_ = false;478 prompted_ = false;
470 unacknowledged_messages_ = false;479 unacknowledged_messages_ = false;
471480
472 user_authenticator_.AuthenticateStart(session_manager_->UserName(),481 if(!user_authenticator_->AuthenticateStart(session_manager_->UserName(),
473 sigc::mem_fun(this, &UserPromptView::AuthenticationCb));482 sigc::mem_fun(this, &UserPromptView::AuthenticationCb)))
483 {
484 HandleAuthenticationStartFailure();
485 }
474}486}
475487
476void UserPromptView::DoUnlock()488void UserPromptView::DoUnlock()
477{489{
478 session_manager_->unlock_requested.emit();490 session_manager_->unlock_requested.emit();
491 num_retry_auth_ = 0;
492}
493
494void UserPromptView::HandleAuthenticationStartFailure()
495{
496 ++num_retry_auth_;
497
498 if (num_retry_auth_ <= 5)
499 {
500 LOG_WARNING(logger) << "Failed to start the authentication process. Retrying for " << num_retry_auth_ << " time.";
501 source_manager_.AddTimeout(100, [this] {
502 StartAuthentication();
503 return false;
504 });
505 }
506 else
507 {
508 AddMessage(_("Authentication failure"), nux::color::Red);
509 AddButton(_("Switch to greeter…"), [this] {
510 session_manager_->SwitchToGreeter();
511 });
512
513 GetLayout()->AddLayout(button_layout_);
514 }
479}515}
480516
481}517}
482518
=== modified file 'lockscreen/UserPromptView.h'
--- lockscreen/UserPromptView.h 2016-06-28 16:23:27 +0000
+++ lockscreen/UserPromptView.h 2017-12-01 18:43:57 +0000
@@ -25,10 +25,10 @@
2525
26#include <Nux/Nux.h>26#include <Nux/Nux.h>
27#include <Nux/View.h>27#include <Nux/View.h>
28#include "UnityCore/GLibSource.h"
28#include "UnityCore/SessionManager.h"29#include "UnityCore/SessionManager.h"
2930
30#include "LockScreenAbstractPromptView.h"31#include "LockScreenAbstractPromptView.h"
31#include "UserAuthenticatorPam.h"
32#include "unity-shared/IMTextEntry.h"32#include "unity-shared/IMTextEntry.h"
3333
34namespace nux34namespace nux
@@ -48,7 +48,8 @@
48class UserPromptView : public AbstractUserPromptView48class UserPromptView : public AbstractUserPromptView
49{49{
50public:50public:
51 UserPromptView(session::Manager::Ptr const& session_manager);51 UserPromptView(session::Manager::Ptr const& session_manager,
52 UserAuthenticator::Ptr const& user_authenticator);
5253
53 nux::View* focus_view();54 nux::View* focus_view();
5455
@@ -70,9 +71,8 @@
70 void ShowAuthenticated(bool successful);71 void ShowAuthenticated(bool successful);
71 void StartAuthentication();72 void StartAuthentication();
72 void DoUnlock();73 void DoUnlock();
74 void HandleAuthenticationStartFailure();
7375
74 session::Manager::Ptr session_manager_;
75 UserAuthenticatorPam user_authenticator_;
76 std::shared_ptr<nux::AbstractPaintLayer> bg_layer_;76 std::shared_ptr<nux::AbstractPaintLayer> bg_layer_;
77 StaticCairoText* username_;77 StaticCairoText* username_;
78 nux::VLayout* msg_layout_;78 nux::VLayout* msg_layout_;
@@ -84,6 +84,9 @@
8484
85 bool prompted_;85 bool prompted_;
86 bool unacknowledged_messages_;86 bool unacknowledged_messages_;
87 int num_retry_auth_ = 0;
88
89 glib::SourceManager source_manager_;
87};90};
8891
89}92}
9093
=== modified file 'panel/PanelController.cpp'
--- panel/PanelController.cpp 2014-07-30 00:49:35 +0000
+++ panel/PanelController.cpp 2017-12-01 18:43:57 +0000
@@ -33,9 +33,8 @@
3333
34const char* window_title = "unity-panel";34const char* window_title = "unity-panel";
3535
36class Controller::Impl36struct Controller::Impl : sigc::trackable
37{37{
38public:
39 Impl(Controller*, menu::Manager::Ptr const&, ui::EdgeBarrierController::Ptr const&);38 Impl(Controller*, menu::Manager::Ptr const&, ui::EdgeBarrierController::Ptr const&);
40 ~Impl();39 ~Impl();
4140
4241
=== modified file 'panel/PanelIndicatorEntryView.cpp'
--- panel/PanelIndicatorEntryView.cpp 2016-02-17 13:14:37 +0000
+++ panel/PanelIndicatorEntryView.cpp 2017-12-01 18:43:57 +0000
@@ -33,6 +33,8 @@
33#include "unity-shared/RawPixel.h"33#include "unity-shared/RawPixel.h"
34#include "unity-shared/WindowManager.h"34#include "unity-shared/WindowManager.h"
35#include "unity-shared/ThemeSettings.h"35#include "unity-shared/ThemeSettings.h"
36#include "unity-shared/UBusWrapper.h"
37#include "unity-shared/UBusMessages.h"
36#include "unity-shared/UnitySettings.h"38#include "unity-shared/UnitySettings.h"
3739
38namespace unity40namespace unity
@@ -117,6 +119,9 @@
117 }119 }
118 else120 else
119 {121 {
122 if (overlay_showing_)
123 UBusManager::SendMessage(UBUS_OVERLAY_CLOSE_REQUEST);
124
120 WindowManager& wm = WindowManager::Default();125 WindowManager& wm = WindowManager::Default();
121126
122 if (wm.IsExpoActive())127 if (wm.IsExpoActive())
@@ -140,6 +145,11 @@
140 wm.TerminateScale();145 wm.TerminateScale();
141 }146 }
142147
148 // This is ugly... But Nux fault!
149 auto const& abs_geo = GetAbsoluteGeometry();
150 guint64 timestamp = nux::GetGraphicsDisplay()->GetCurrentEvent().x11_timestamp;
151 WindowManager::Default().UnGrabMousePointer(timestamp, button, abs_geo.x, abs_geo.y);
152
143 Activate(button);153 Activate(button);
144 }154 }
145 }155 }
146156
=== modified file 'panel/PanelMenuView.cpp'
--- panel/PanelMenuView.cpp 2016-09-01 23:56:04 +0000
+++ panel/PanelMenuView.cpp 2017-12-01 18:43:57 +0000
@@ -102,7 +102,6 @@
102 , ignore_menu_visibility_(false)102 , ignore_menu_visibility_(false)
103 , integrated_menus_(menu_manager_->integrated_menus())103 , integrated_menus_(menu_manager_->integrated_menus())
104 , always_show_menus_(menu_manager_->always_show_menus())104 , always_show_menus_(menu_manager_->always_show_menus())
105 , ignore_leave_events_(false)
106 , desktop_name_(get_current_desktop())105 , desktop_name_(get_current_desktop())
107{106{
108 if (ApplicationWindowPtr const& win = ApplicationManager::Default().GetActiveWindow())107 if (ApplicationWindowPtr const& win = ApplicationManager::Default().GetActiveWindow())
@@ -1814,14 +1813,9 @@
1814 }1813 }
1815}1814}
18161815
1817void PanelMenuView::IgnoreLeaveEvents(bool ignore)
1818{
1819 ignore_leave_events_ = ignore;
1820}
1821
1822void PanelMenuView::OnPanelViewMouseLeave(int x, int y, unsigned long mouse_button_state, unsigned long special_keys_state)1816void PanelMenuView::OnPanelViewMouseLeave(int x, int y, unsigned long mouse_button_state, unsigned long special_keys_state)
1823{1817{
1824 if (always_show_menus_ || ignore_leave_events_)1818 if (always_show_menus_)
1825 return;1819 return;
18261820
1827 if (is_inside_)1821 if (is_inside_)
18281822
=== modified file 'panel/PanelMenuView.h'
--- panel/PanelMenuView.h 2015-11-05 14:54:13 +0000
+++ panel/PanelMenuView.h 2017-12-01 18:43:57 +0000
@@ -56,7 +56,6 @@
56 bool HasKeyActivableMenus() const;56 bool HasKeyActivableMenus() const;
5757
58 void NotifyAllMenusClosed();58 void NotifyAllMenusClosed();
59 void IgnoreLeaveEvents(bool);
6059
61 virtual void AddIndicator(indicator::Indicator::Ptr const& indicator);60 virtual void AddIndicator(indicator::Indicator::Ptr const& indicator);
6261
@@ -192,7 +191,6 @@
192 bool ignore_menu_visibility_;191 bool ignore_menu_visibility_;
193 bool integrated_menus_;192 bool integrated_menus_;
194 bool always_show_menus_;193 bool always_show_menus_;
195 bool ignore_leave_events_;
196194
197 nux::Geometry monitor_geo_;195 nux::Geometry monitor_geo_;
198 const std::string desktop_name_;196 const std::string desktop_name_;
199197
=== modified file 'panel/PanelView.cpp'
--- panel/PanelView.cpp 2016-08-17 14:02:12 +0000
+++ panel/PanelView.cpp 2017-12-01 18:43:57 +0000
@@ -42,7 +42,8 @@
42namespace42namespace
43{43{
44const RawPixel TRIANGLE_THRESHOLD = 5_em;44const RawPixel TRIANGLE_THRESHOLD = 5_em;
45const int refine_gradient_midpoint = 959;45const double SCRUB_VELOCITY_THRESHOLD = 0.05;
46const RawPixel REFINE_GRADIENT_MIDPOINT = 959;
46}47}
4748
4849
@@ -51,7 +52,8 @@
51PanelView::PanelView(MockableBaseWindow* parent, menu::Manager::Ptr const& menus, NUX_FILE_LINE_DECL)52PanelView::PanelView(MockableBaseWindow* parent, menu::Manager::Ptr const& menus, NUX_FILE_LINE_DECL)
52 : View(NUX_FILE_LINE_PARAM)53 : View(NUX_FILE_LINE_PARAM)
53 , parent_(parent)54 , parent_(parent)
54 , remote_(menus->Indicators())55 , menus_(menus)
56 , remote_(menus_->Indicators())
55 , is_dirty_(true)57 , is_dirty_(true)
56 , opacity_maximized_toggle_(false)58 , opacity_maximized_toggle_(false)
57 , needs_geo_sync_(false)59 , needs_geo_sync_(false)
@@ -113,10 +115,9 @@
113115
114 remote_->on_object_added.connect(sigc::mem_fun(this, &PanelView::OnObjectAdded));116 remote_->on_object_added.connect(sigc::mem_fun(this, &PanelView::OnObjectAdded));
115 remote_->on_object_removed.connect(sigc::mem_fun(this, &PanelView::OnObjectRemoved));117 remote_->on_object_removed.connect(sigc::mem_fun(this, &PanelView::OnObjectRemoved));
116 remote_->on_entry_activated.connect(sigc::mem_fun(this, &PanelView::OnEntryActivated));
117 remote_->on_entry_show_menu.connect(sigc::mem_fun(this, &PanelView::OnEntryShowMenu));
118 menus->key_activate_entry.connect(sigc::mem_fun(this, &PanelView::ActivateEntry));118 menus->key_activate_entry.connect(sigc::mem_fun(this, &PanelView::ActivateEntry));
119 menus->open_first.connect(sigc::mem_fun(this, &PanelView::ActivateFirstSensitive));119 menus->open_first.connect(sigc::mem_fun(this, &PanelView::ActivateFirstSensitive));
120 menus->RegisterTracker(GetPanelName(), sigc::mem_fun(this, &PanelView::OnMenuPointerMoved));
120121
121 ubus_manager_.RegisterInterest(UBUS_OVERLAY_HIDDEN, sigc::mem_fun(this, &PanelView::OnOverlayHidden));122 ubus_manager_.RegisterInterest(UBUS_OVERLAY_HIDDEN, sigc::mem_fun(this, &PanelView::OnOverlayHidden));
122 ubus_manager_.RegisterInterest(UBUS_OVERLAY_SHOWN, sigc::mem_fun(this, &PanelView::OnOverlayShown));123 ubus_manager_.RegisterInterest(UBUS_OVERLAY_SHOWN, sigc::mem_fun(this, &PanelView::OnOverlayShown));
@@ -134,7 +135,7 @@
134PanelView::~PanelView()135PanelView::~PanelView()
135{136{
136 indicator::EntryLocationMap locations;137 indicator::EntryLocationMap locations;
137 remote_->SyncGeometries(GetName() + std::to_string(monitor_), locations);138 remote_->SyncGeometries(GetPanelName(), locations);
138}139}
139140
140void PanelView::LoadTextures()141void PanelView::LoadTextures()
@@ -374,7 +375,7 @@
374 GfxContext.GetRenderStates().SetBlend(true, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);375 GfxContext.GetRenderStates().SetBlend(true, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
375 nux::TexCoordXForm refine_texxform;376 nux::TexCoordXForm refine_texxform;
376377
377 int refine_x_pos = geo.x + (stored_dash_width_ - refine_gradient_midpoint);378 int refine_x_pos = geo.x + (stored_dash_width_ - REFINE_GRADIENT_MIDPOINT.CP(Settings::Instance().em(monitor_)));
378379
379 if (Settings::Instance().launcher_position() == LauncherPosition::LEFT)380 if (Settings::Instance().launcher_position() == LauncherPosition::LEFT)
380 refine_x_pos += unity::Settings::Instance().LauncherSize(monitor_);381 refine_x_pos += unity::Settings::Instance().LauncherSize(monitor_);
@@ -473,7 +474,7 @@
473474
474 nux::Geometry refine_geo = geo;475 nux::Geometry refine_geo = geo;
475476
476 int refine_x_pos = geo.x + (stored_dash_width_ - refine_gradient_midpoint);477 int refine_x_pos = geo.x + (stored_dash_width_ - REFINE_GRADIENT_MIDPOINT.CP(Settings::Instance().em(monitor_)));
477 if (Settings::Instance().launcher_position() == LauncherPosition::LEFT)478 if (Settings::Instance().launcher_position() == LauncherPosition::LEFT)
478 refine_x_pos += unity::Settings::Instance().LauncherSize(monitor_);479 refine_x_pos += unity::Settings::Instance().LauncherSize(monitor_);
479480
@@ -627,7 +628,7 @@
627 QueueDraw();628 QueueDraw();
628}629}
629630
630void PanelView::OnMenuPointerMoved(int x, int y)631void PanelView::OnMenuPointerMoved(int x, int y, double speed)
631{632{
632 nux::Geometry const& geo = GetAbsoluteGeometry();633 nux::Geometry const& geo = GetAbsoluteGeometry();
633634
@@ -648,116 +649,6 @@
648 }649 }
649}650}
650651
651static bool PointInTriangle(nux::Point const& p, nux::Point const& t0, nux::Point const& t1, nux::Point const& t2)
652{
653 int s = t0.y * t2.x - t0.x * t2.y + (t2.y - t0.y) * p.x + (t0.x - t2.x) * p.y;
654 int t = t0.x * t1.y - t0.y * t1.x + (t0.y - t1.y) * p.x + (t1.x - t0.x) * p.y;
655
656 if ((s < 0) != (t < 0))
657 return false;
658
659 int A = -t1.y * t2.x + t0.y * (t2.x - t1.x) + t0.x * (t1.y - t2.y) + t1.x * t2.y;
660 if (A < 0)
661 {
662 s = -s;
663 t = -t;
664 A = -A;
665 }
666
667 return s > 0 && t > 0 && (s + t) < A;
668}
669
670static double GetMouseVelocity(nux::Point const& p0, nux::Point const& p1, util::Timer &timer)
671{
672 int dx, dy;
673 double speed;
674 auto millis = timer.ElapsedMicroSeconds();
675
676 if (millis == 0)
677 return 1;
678
679 dx = p0.x - p1.x;
680 dy = p0.y - p1.y;
681
682 speed = sqrt(dx * dx + dy * dy) / millis * 1000;
683
684 return speed;
685}
686
687bool PanelView::TrackMenuPointer()
688{
689 nux::Point const& mouse = nux::GetGraphicsDisplay()->GetMouseScreenCoord();
690 double speed = GetMouseVelocity(mouse, tracked_pointer_pos_, mouse_tracker_timer_);
691
692 mouse_tracker_timer_.Reset();
693 tracked_pointer_pos_ = mouse;
694
695 double scale = Settings::Instance().em(monitor_)->DPIScale();
696 if (speed > 0 && PointInTriangle(mouse,
697 nux::Point(triangle_top_corner_.x, std::max(triangle_top_corner_.y - TRIANGLE_THRESHOLD.CP(scale), 0)),
698 nux::Point(menu_geo_.x, menu_geo_.y),
699 nux::Point(menu_geo_.x + menu_geo_.width, menu_geo_.y)))
700 {
701 return true;
702 }
703
704 if (mouse != triangle_top_corner_)
705 {
706 triangle_top_corner_ = mouse;
707 OnMenuPointerMoved(mouse.x, mouse.y);
708 }
709
710 return true;
711}
712
713void PanelView::OnEntryActivated(std::string const& panel, std::string const& entry_id, nux::Rect const& menu_geo)
714{
715 if (!panel.empty() && panel != GetPanelName())
716 return;
717
718 menu_geo_ = menu_geo;
719
720 bool active = !entry_id.empty();
721 if (active && !track_menu_pointer_timeout_)
722 {
723 //
724 // Track menus being scrubbed at 60Hz (about every 16 millisec)
725 // It might sound ugly, but it's far nicer (and more responsive) than the
726 // code it replaces which used to capture motion events in another process
727 // (unity-panel-service) and send them to us over dbus.
728 // NOTE: The reason why we have to use a timer instead of tracking motion
729 // events is because the motion events will never be delivered to this
730 // process. All the motion events will go to unity-panel-service while
731 // scrubbing because the active panel menu has (needs) the pointer grab.
732 //
733 mouse_tracker_timer_.Reset();
734 triangle_top_corner_ = nux::GetGraphicsDisplay()->GetMouseScreenCoord();
735 track_menu_pointer_timeout_.reset(new glib::Timeout(16));
736 track_menu_pointer_timeout_->Run(sigc::mem_fun(this, &PanelView::TrackMenuPointer));
737 }
738 else if (!active)
739 {
740 track_menu_pointer_timeout_.reset();
741 menu_view_->NotifyAllMenusClosed();
742 tracked_pointer_pos_ = {-1, -1};
743 }
744
745 if (overlay_is_open_)
746 ubus_manager_.SendMessage(UBUS_OVERLAY_CLOSE_REQUEST);
747}
748
749void PanelView::OnEntryShowMenu(std::string const& entry_id, unsigned xid,
750 int x, int y, unsigned button)
751{
752 if (!track_menu_pointer_timeout_)
753 {
754 // This is ugly... But Nux fault!
755 menu_view_->IgnoreLeaveEvents(true);
756 WindowManager::Default().UnGrabMousePointer(CurrentTime, button, x, y);
757 menu_view_->IgnoreLeaveEvents(false);
758 }
759}
760
761bool PanelView::ActivateFirstSensitive()652bool PanelView::ActivateFirstSensitive()
762{653{
763 if (!IsActive())654 if (!IsActive())
@@ -768,7 +659,6 @@
768 {659 {
769 // Since this only happens on keyboard events, we need to prevent that the660 // Since this only happens on keyboard events, we need to prevent that the
770 // pointer tracker would select another entry.661 // pointer tracker would select another entry.
771 tracked_pointer_pos_ = nux::GetGraphicsDisplay()->GetMouseScreenCoord();
772 return true;662 return true;
773 }663 }
774664
@@ -785,7 +675,6 @@
785 {675 {
786 // Since this only happens on keyboard events, we need to prevent that the676 // Since this only happens on keyboard events, we need to prevent that the
787 // pointer tracker would select another entry.677 // pointer tracker would select another entry.
788 tracked_pointer_pos_ = nux::GetGraphicsDisplay()->GetMouseScreenCoord();
789 return true;678 return true;
790 }679 }
791680
@@ -847,7 +736,7 @@
847736
848std::string PanelView::GetPanelName() const737std::string PanelView::GetPanelName() const
849{738{
850 return GetName() + std::to_string(monitor_);739 return GetName() + std::to_string(reinterpret_cast<uintptr_t>(this)) + '_' + std::to_string(monitor_);
851}740}
852741
853void PanelView::SyncGeometries()742void PanelView::SyncGeometries()
@@ -863,9 +752,13 @@
863752
864void PanelView::SetMonitor(int monitor)753void PanelView::SetMonitor(int monitor)
865{754{
755 auto mouse_tracker_cb = sigc::mem_fun(this, &PanelView::OnMenuPointerMoved);
756 menus_->UnregisterTracker(GetPanelName(), mouse_tracker_cb);
757
866 monitor_ = monitor;758 monitor_ = monitor;
867 menu_view_->SetMonitor(monitor);759 menu_view_->SetMonitor(monitor);
868 indicators_->SetMonitor(monitor);760 indicators_->SetMonitor(monitor);
761 menus_->RegisterTracker(GetPanelName(), mouse_tracker_cb);
869 Resize();762 Resize();
870763
871 if (WindowManager::Default().IsScaleActive())764 if (WindowManager::Default().IsScaleActive())
872765
=== modified file 'panel/PanelView.h'
--- panel/PanelView.h 2016-03-30 18:18:07 +0000
+++ panel/PanelView.h 2017-12-01 18:43:57 +0000
@@ -35,7 +35,6 @@
35#include "unity-shared/Introspectable.h"35#include "unity-shared/Introspectable.h"
36#include "unity-shared/MenuManager.h"36#include "unity-shared/MenuManager.h"
37#include "unity-shared/MockableBaseWindow.h"37#include "unity-shared/MockableBaseWindow.h"
38#include "unity-shared/Timer.h"
39#include "PanelMenuView.h"38#include "PanelMenuView.h"
40#include "PanelTray.h"39#include "PanelTray.h"
41#include "PanelIndicatorsView.h"40#include "PanelIndicatorsView.h"
@@ -88,9 +87,6 @@
88 void OnObjectAdded(indicator::Indicator::Ptr const& proxy);87 void OnObjectAdded(indicator::Indicator::Ptr const& proxy);
89 void OnObjectRemoved(indicator::Indicator::Ptr const& proxy);88 void OnObjectRemoved(indicator::Indicator::Ptr const& proxy);
90 void OnIndicatorViewUpdated();89 void OnIndicatorViewUpdated();
91 void OnMenuPointerMoved(int x, int y);
92 void OnEntryActivated(std::string const& panel, std::string const& entry_id, nux::Rect const& geo);
93 void OnEntryShowMenu(std::string const& entry_id, unsigned xid, int x, int y, unsigned button);
9490
95private:91private:
96 std::string GetPanelName() const;92 std::string GetPanelName() const;
@@ -100,6 +96,8 @@
100 void OnSpreadInitiate();96 void OnSpreadInitiate();
101 void OnSpreadTerminate();97 void OnSpreadTerminate();
102 void OnLowGfxChanged();98 void OnLowGfxChanged();
99 void OnMenuPointerMoved(int x, int y, double speed);
100 void OnActiveEntryEvent(XEvent const&);
103 void EnableOverlayMode(bool);101 void EnableOverlayMode(bool);
104 void LoadTextures();102 void LoadTextures();
105103
@@ -109,11 +107,11 @@
109 bool IsTransparent();107 bool IsTransparent();
110 void UpdateBackground();108 void UpdateBackground();
111 void ForceUpdateBackground();109 void ForceUpdateBackground();
112 bool TrackMenuPointer();
113 void SyncGeometries();110 void SyncGeometries();
114 void AddPanelView(PanelIndicatorsView* child, unsigned int stretchFactor);111 void AddPanelView(PanelIndicatorsView* child, unsigned int stretchFactor);
115112
116 MockableBaseWindow* parent_;113 MockableBaseWindow* parent_;
114 menu::Manager::Ptr menus_;
117 indicator::Indicators::Ptr remote_;115 indicator::Indicators::Ptr remote_;
118116
119 // No ownership is taken for these views, that is done by the AddChild method.117 // No ownership is taken for these views, that is done by the AddChild method.
@@ -133,10 +131,6 @@
133 BaseTexturePtr bg_refine_single_column_tex_;131 BaseTexturePtr bg_refine_single_column_tex_;
134 std::unique_ptr<nux::AbstractPaintLayer> bg_refine_single_column_layer_;132 std::unique_ptr<nux::AbstractPaintLayer> bg_refine_single_column_layer_;
135133
136 std::string active_overlay_;
137 nux::Point tracked_pointer_pos_, triangle_top_corner_;
138 util::Timer mouse_tracker_timer_;
139
140 bool is_dirty_;134 bool is_dirty_;
141 bool opacity_maximized_toggle_;135 bool opacity_maximized_toggle_;
142 bool needs_geo_sync_;136 bool needs_geo_sync_;
@@ -144,15 +138,13 @@
144 float opacity_;138 float opacity_;
145 int monitor_;139 int monitor_;
146 int stored_dash_width_;140 int stored_dash_width_;
147141 std::string active_overlay_;
148 nux::Geometry menu_geo_;
149142
150 connection::Manager on_indicator_updated_connections_;143 connection::Manager on_indicator_updated_connections_;
151 connection::Manager maximized_opacity_toggle_connections_;144 connection::Manager maximized_opacity_toggle_connections_;
152 BackgroundEffectHelper bg_effect_helper_;145 BackgroundEffectHelper bg_effect_helper_;
153 nux::ObjectPtr<nux::IOpenGLBaseTexture> bg_blur_texture_;146 nux::ObjectPtr<nux::IOpenGLBaseTexture> bg_blur_texture_;
154 UBusManager ubus_manager_;147 UBusManager ubus_manager_;
155 glib::Source::UniquePtr track_menu_pointer_timeout_;
156};148};
157149
158} // namespace panel150} // namespace panel
159151
=== modified file 'plugins/unityshell/src/unityshell.cpp'
--- plugins/unityshell/src/unityshell.cpp 2016-09-01 23:56:16 +0000
+++ plugins/unityshell/src/unityshell.cpp 2017-12-01 18:43:57 +0000
@@ -197,6 +197,7 @@
197 , menus_(std::make_shared<menu::Manager>(std::make_shared<indicator::DBusIndicators>(), std::make_shared<key::GnomeGrabber>()))197 , menus_(std::make_shared<menu::Manager>(std::make_shared<indicator::DBusIndicators>(), std::make_shared<key::GnomeGrabber>()))
198 , deco_manager_(std::make_shared<decoration::Manager>(menus_))198 , deco_manager_(std::make_shared<decoration::Manager>(menus_))
199 , debugger_(this)199 , debugger_(this)
200 , session_(std::make_shared<session::GnomeManager>())
200 , needsRelayout(false)201 , needsRelayout(false)
201 , super_keypressed_(false)202 , super_keypressed_(false)
202 , newFocusedWindow(nullptr)203 , newFocusedWindow(nullptr)
@@ -291,23 +292,22 @@
291 }292 }
292 }293 }
293294
294 //In case of software rendering then enable lowgfx mode.295 //In case of software rendering then enable lowgfx mode.
296 std::string lowgfx_env = glib::gchar_to_string(getenv("UNITY_LOW_GFX_MODE"));
295 std::string renderer = ANSI_TO_TCHAR(NUX_REINTERPRET_CAST(const char *, glGetString(GL_RENDERER)));297 std::string renderer = ANSI_TO_TCHAR(NUX_REINTERPRET_CAST(const char *, glGetString(GL_RENDERER)));
296
297 if (renderer.find("Software Rasterizer") != std::string::npos ||298 if (renderer.find("Software Rasterizer") != std::string::npos ||
298 renderer.find("Mesa X11") != std::string::npos ||299 renderer.find("Mesa X11") != std::string::npos ||
299 renderer.find("llvmpipe") != std::string::npos ||300 renderer.find("llvmpipe") != std::string::npos ||
300 renderer.find("softpipe") != std::string::npos ||301 renderer.find("softpipe") != std::string::npos ||
301 (getenv("UNITY_LOW_GFX_MODE") != NULL && atoi(getenv("UNITY_LOW_GFX_MODE")) == 1) ||302 atoi(lowgfx_env.c_str()) == 1)
302 optionGetLowGraphicsMode())
303 {
304 unity_settings_.low_gfx = true;
305 }
306
307 if (getenv("UNITY_LOW_GFX_MODE") != NULL && atoi(getenv("UNITY_LOW_GFX_MODE")) == 0)
308 {303 {
309 unity_settings_.low_gfx = false;304 if (lowgfx_env.empty() || atoi(lowgfx_env.c_str()) != 0)
305 unity_settings_.supports_3d = false;
310 }306 }
307
308 Settings::Instance().low_gfx.changed.connect(sigc::track_obj([this] (bool low_gfx) {
309 BackgroundEffectHelper::blur_type = low_gfx ? BLUR_NONE : (unity::BlurType) optionGetDashBlurExperimental();
310 }, *this));
311#endif311#endif
312312
313 if (!failed)313 if (!failed)
@@ -383,7 +383,6 @@
383 optionSetAutohideAnimationNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));383 optionSetAutohideAnimationNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));
384 optionSetDashBlurExperimentalNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));384 optionSetDashBlurExperimentalNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));
385 optionSetShortcutOverlayNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));385 optionSetShortcutOverlayNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));
386 optionSetLowGraphicsModeNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));
387 optionSetShowLauncherInitiate(boost::bind(&UnityScreen::showLauncherKeyInitiate, this, _1, _2, _3));386 optionSetShowLauncherInitiate(boost::bind(&UnityScreen::showLauncherKeyInitiate, this, _1, _2, _3));
388 optionSetShowLauncherTerminate(boost::bind(&UnityScreen::showLauncherKeyTerminate, this, _1, _2, _3));387 optionSetShowLauncherTerminate(boost::bind(&UnityScreen::showLauncherKeyTerminate, this, _1, _2, _3));
389 optionSetKeyboardFocusInitiate(boost::bind(&UnityScreen::setKeyboardFocusKeyInitiate, this, _1, _2, _3));388 optionSetKeyboardFocusInitiate(boost::bind(&UnityScreen::setKeyboardFocusKeyInitiate, this, _1, _2, _3));
@@ -477,9 +476,10 @@
477476
478 Introspectable::AddChild(deco_manager_.get());477 Introspectable::AddChild(deco_manager_.get());
479 auto const& deco_style = decoration::Style::Get();478 auto const& deco_style = decoration::Style::Get();
480 auto deco_style_cb = sigc::hide(sigc::mem_fun(this, &UnityScreen::OnDecorationStyleChanged));479 auto deco_style_cb = sigc::hide(sigc::mem_fun(this, &UnityScreen::UpdateDecorationStyle));
481 deco_style->theme.changed.connect(deco_style_cb);480 deco_style->theme.changed.connect(deco_style_cb);
482 deco_style->title_font.changed.connect(deco_style_cb);481 deco_style->title_font.changed.connect(deco_style_cb);
482 UpdateDecorationStyle();
483483
484 minimize_speed_controller_.DurationChanged.connect(484 minimize_speed_controller_.DurationChanged.connect(
485 sigc::mem_fun(this, &UnityScreen::OnMinimizeDurationChanged)485 sigc::mem_fun(this, &UnityScreen::OnMinimizeDurationChanged)
@@ -515,7 +515,10 @@
515 unity_a11y_finalize();515 unity_a11y_finalize();
516 QuicklistManager::Destroy();516 QuicklistManager::Destroy();
517 decoration::DataPool::Reset();517 decoration::DataPool::Reset();
518 SaveLockStamp(false);518
519 if (!session_->AutomaticLogin())
520 SaveLockStamp(false);
521
519 reset_glib_logging();522 reset_glib_logging();
520523
521 screen->addSupportedAtomsSetEnabled(this, false);524 screen->addSupportedAtomsSetEnabled(this, false);
@@ -583,12 +586,14 @@
583586
584 for (auto const& swin : sScreen->getWindows())587 for (auto const& swin : sScreen->getWindows())
585 {588 {
586 if (filtered_windows.find(swin->window->id()) != filtered_windows.end())589 if (!swin->window || filtered_windows.find(swin->window->id()) != filtered_windows.end())
587 continue;590 continue;
588591
589 auto* uwin = UnityWindow::get(swin->window);592 if (UnityWindow* uwin = UnityWindow::get(swin->window))
590 uwin->OnTerminateSpread();593 {
591 fake_decorated_windows_.erase(uwin);594 uwin->OnTerminateSpread();
595 fake_decorated_windows_.erase(uwin);
596 }
592 }597 }
593598
594 for (auto xid : filtered_windows)599 for (auto xid : filtered_windows)
@@ -602,6 +607,9 @@
602607
603 for (auto const& swin : sScreen->getWindows())608 for (auto const& swin : sScreen->getWindows())
604 {609 {
610 if (!swin->window)
611 continue;
612
605 auto* uwin = UnityWindow::get(swin->window);613 auto* uwin = UnityWindow::get(swin->window);
606 fake_decorated_windows_.insert(uwin);614 fake_decorated_windows_.insert(uwin);
607 uwin->OnInitiateSpread();615 uwin->OnInitiateSpread();
@@ -613,7 +621,13 @@
613 spread_widgets_.reset();621 spread_widgets_.reset();
614622
615 for (auto const& swin : sScreen->getWindows())623 for (auto const& swin : sScreen->getWindows())
616 UnityWindow::get(swin->window)->OnTerminateSpread();624 {
625 if (!swin->window)
626 continue;
627
628 if (UnityWindow* uwin = UnityWindow::get(swin->window))
629 uwin->OnTerminateSpread();
630 }
617631
618 fake_decorated_windows_.clear();632 fake_decorated_windows_.clear();
619}633}
@@ -845,17 +859,28 @@
845 wy = y + (last_bound.height - height) / 2;859 wy = y + (last_bound.height - height) / 2;
846}860}
847861
848void UnityScreen::OnDecorationStyleChanged()862void UnityScreen::UpdateDecorationStyle()
849{863{
850 for (UnityWindow* uwin : fake_decorated_windows_)864 for (UnityWindow* uwin : fake_decorated_windows_)
851 uwin->CleanupCachedTextures();865 uwin->CleanupCachedTextures();
852866
853 auto const& style = decoration::Style::Get();867 if (optionGetOverrideDecorationTheme())
854 deco_manager_->shadow_offset = style->ShadowOffset();868 {
855 deco_manager_->active_shadow_color = style->ActiveShadowColor();869 deco_manager_->active_shadow_color = NuxColorFromCompizColor(optionGetActiveShadowColor());
856 deco_manager_->active_shadow_radius = style->ActiveShadowRadius();870 deco_manager_->inactive_shadow_color = NuxColorFromCompizColor(optionGetInactiveShadowColor());
857 deco_manager_->inactive_shadow_color = style->InactiveShadowColor();871 deco_manager_->active_shadow_radius = optionGetActiveShadowRadius();
858 deco_manager_->inactive_shadow_radius = style->InactiveShadowRadius();872 deco_manager_->inactive_shadow_radius = optionGetInactiveShadowRadius();
873 deco_manager_->shadow_offset = nux::Point(optionGetShadowXOffset(), optionGetShadowYOffset());
874 }
875 else
876 {
877 auto const& style = decoration::Style::Get();
878 deco_manager_->shadow_offset = style->ShadowOffset();
879 deco_manager_->active_shadow_color = style->ActiveShadowColor();
880 deco_manager_->active_shadow_radius = style->ActiveShadowRadius();
881 deco_manager_->inactive_shadow_color = style->InactiveShadowColor();
882 deco_manager_->inactive_shadow_radius = style->InactiveShadowRadius();
883 }
859}884}
860885
861void UnityScreen::DamageBlurUpdateRegion(nux::Geometry const& blur_update)886void UnityScreen::DamageBlurUpdateRegion(nux::Geometry const& blur_update)
@@ -863,7 +888,7 @@
863 cScreen->damageRegion(CompRegionFromNuxGeo(blur_update));888 cScreen->damageRegion(CompRegionFromNuxGeo(blur_update));
864}889}
865890
866void UnityScreen::paintDisplay()891void UnityScreen::paintOutput()
867{892{
868 CompOutput *output = last_output_;893 CompOutput *output = last_output_;
869894
@@ -1471,6 +1496,13 @@
1471 CompOutput* output,1496 CompOutput* output,
1472 unsigned int mask)1497 unsigned int mask)
1473{1498{
1499 if (G_UNLIKELY(lockscreen_controller_->IsPaintInhibited()))
1500 {
1501 CHECKGL(glClearColor(0.0f, 0.0f, 0.0f, 1.0f));
1502 CHECKGL(glClear(GL_COLOR_BUFFER_BIT));
1503 return true;
1504 }
1505
1474 bool ret;1506 bool ret;
14751507
1476 /*1508 /*
@@ -1504,7 +1536,7 @@
1504 doShellRepaint = false;1536 doShellRepaint = false;
15051537
1506 if (doShellRepaint)1538 if (doShellRepaint)
1507 paintDisplay();1539 paintOutput();
15081540
1509 return ret;1541 return ret;
1510}1542}
@@ -1667,6 +1699,11 @@
16671699
1668void UnityScreen::donePaint()1700void UnityScreen::donePaint()
1669{1701{
1702 if (G_UNLIKELY(lockscreen_controller_->IsPaintInhibited()))
1703 {
1704 lockscreen_controller_->MarkBufferHasCleared();
1705 }
1706
1670 /*1707 /*
1671 * It's only safe to clear the draw list if drawing actually occurred1708 * It's only safe to clear the draw list if drawing actually occurred
1672 * (i.e. the shell was not obscured behind a fullscreen window).1709 * (i.e. the shell was not obscured behind a fullscreen window).
@@ -2042,13 +2079,6 @@
2042 case MapRequest:2079 case MapRequest:
2043 ShowdesktopHandler::InhibitLeaveShowdesktopMode (event->xmaprequest.window);2080 ShowdesktopHandler::InhibitLeaveShowdesktopMode (event->xmaprequest.window);
2044 break;2081 break;
2045 case PropertyNotify:
2046 if (bghash_ && event->xproperty.window == GDK_ROOT_WINDOW() &&
2047 event->xproperty.atom == bghash_->ColorAtomId())
2048 {
2049 bghash_->RefreshColor();
2050 }
2051 break;
2052 default:2082 default:
2053 if (screen->shapeEvent() + ShapeNotify == event->type)2083 if (screen->shapeEvent() + ShapeNotify == event->type)
2054 {2084 {
@@ -3104,18 +3134,18 @@
31043134
3105 if (uScreen->doShellRepaint && window == uScreen->onboard_)3135 if (uScreen->doShellRepaint && window == uScreen->onboard_)
3106 {3136 {
3107 uScreen->paintDisplay();3137 uScreen->paintOutput();
3108 }3138 }
3109 else if (uScreen->doShellRepaint &&3139 else if (uScreen->doShellRepaint &&
3110 window == uScreen->firstWindowAboveShell &&3140 window == uScreen->firstWindowAboveShell &&
3111 !uScreen->forcePaintOnTop() &&3141 !uScreen->forcePaintOnTop() &&
3112 !uScreen->fullscreenRegion.contains(window->geometry()))3142 !uScreen->fullscreenRegion.contains(window->geometry()))
3113 {3143 {
3114 uScreen->paintDisplay();3144 uScreen->paintOutput();
3115 }3145 }
3116 else if (locked && CanBypassLockScreen())3146 else if (locked && CanBypassLockScreen())
3117 {3147 {
3118 uScreen->paintDisplay();3148 uScreen->paintOutput();
3119 }3149 }
31203150
3121 enum class DrawPanelShadow3151 enum class DrawPanelShadow
@@ -3598,43 +3628,16 @@
3598 break;3628 break;
3599 }3629 }
3600 case UnityshellOptions::OverrideDecorationTheme:3630 case UnityshellOptions::OverrideDecorationTheme:
3601 if (optionGetOverrideDecorationTheme())
3602 {
3603 deco_manager_->active_shadow_color = NuxColorFromCompizColor(optionGetActiveShadowColor());
3604 deco_manager_->inactive_shadow_color = NuxColorFromCompizColor(optionGetInactiveShadowColor());
3605 deco_manager_->active_shadow_radius = optionGetActiveShadowRadius();
3606 deco_manager_->inactive_shadow_radius = optionGetInactiveShadowRadius();
3607 deco_manager_->shadow_offset = nux::Point(optionGetShadowXOffset(), optionGetShadowYOffset());
3608 }
3609 else
3610 {
3611 OnDecorationStyleChanged();
3612 }
3613 break;
3614 case UnityshellOptions::ActiveShadowColor:3631 case UnityshellOptions::ActiveShadowColor:
3615 if (optionGetOverrideDecorationTheme())3632 case UnityshellOptions::ActiveShadowRadius:
3616 deco_manager_->active_shadow_color = NuxColorFromCompizColor(optionGetActiveShadowColor());
3617 break;
3618 case UnityshellOptions::InactiveShadowColor:3633 case UnityshellOptions::InactiveShadowColor:
3619 if (optionGetOverrideDecorationTheme())
3620 deco_manager_->inactive_shadow_color = NuxColorFromCompizColor(optionGetInactiveShadowColor());
3621 break;
3622 case UnityshellOptions::ActiveShadowRadius:
3623 if (optionGetOverrideDecorationTheme())
3624 deco_manager_->active_shadow_radius = optionGetActiveShadowRadius();
3625 break;
3626 case UnityshellOptions::InactiveShadowRadius:3634 case UnityshellOptions::InactiveShadowRadius:
3627 if (optionGetOverrideDecorationTheme())
3628 deco_manager_->inactive_shadow_radius = optionGetInactiveShadowRadius();
3629 break;
3630 case UnityshellOptions::ShadowXOffset:3635 case UnityshellOptions::ShadowXOffset:
3631 if (optionGetOverrideDecorationTheme())
3632 deco_manager_->shadow_offset = nux::Point(optionGetShadowXOffset(), optionGetShadowYOffset());
3633 break;
3634 case UnityshellOptions::ShadowYOffset:3636 case UnityshellOptions::ShadowYOffset:
3635 if (optionGetOverrideDecorationTheme())3637 {
3636 deco_manager_->shadow_offset = nux::Point(optionGetShadowXOffset(), optionGetShadowYOffset());3638 UpdateDecorationStyle();
3637 break;3639 break;
3640 }
3638 case UnityshellOptions::LauncherHideMode:3641 case UnityshellOptions::LauncherHideMode:
3639 {3642 {
3640 launcher_options->hide_mode = (launcher::LauncherHideMode) optionGetLauncherHideMode();3643 launcher_options->hide_mode = (launcher::LauncherHideMode) optionGetLauncherHideMode();
@@ -3736,14 +3739,6 @@
3736 case UnityshellOptions::ShortcutOverlay:3739 case UnityshellOptions::ShortcutOverlay:
3737 shortcut_controller_->SetEnabled(optionGetShortcutOverlay());3740 shortcut_controller_->SetEnabled(optionGetShortcutOverlay());
3738 break;3741 break;
3739 case UnityshellOptions::LowGraphicsMode:
3740 if (optionGetLowGraphicsMode())
3741 BackgroundEffectHelper::blur_type = BLUR_NONE;
3742 else
3743 BackgroundEffectHelper::blur_type = (unity::BlurType)optionGetDashBlurExperimental();
3744
3745 unity::Settings::Instance().low_gfx = optionGetLowGraphicsMode();
3746 break;
3747 case UnityshellOptions::DecayRate:3742 case UnityshellOptions::DecayRate:
3748 launcher_options->edge_decay_rate = optionGetDecayRate() * 100;3743 launcher_options->edge_decay_rate = optionGetDecayRate() * 100;
3749 break;3744 break;
@@ -3843,6 +3838,12 @@
3843 ScheduleRelayout(500);3838 ScheduleRelayout(500);
3844}3839}
38453840
3841void UnityScreen::averageColorChangeNotify(const unsigned short *color)
3842{
3843 bghash_->UpdateColor(color, nux::animation::Animation::State::Running);
3844 screen->averageColorChangeNotify (color);
3845}
3846
3846bool UnityScreen::layoutSlotsAndAssignWindows()3847bool UnityScreen::layoutSlotsAndAssignWindows()
3847{3848{
3848 auto const& scaled_windows = sScreen->getWindows();3849 auto const& scaled_windows = sScreen->getWindows();
@@ -3855,7 +3856,7 @@
38553856
3856 for (ScaleWindow *sw : scaled_windows)3857 for (ScaleWindow *sw : scaled_windows)
3857 {3858 {
3858 if (sw->window->outputDevice() == static_cast<int>(output.id()))3859 if (sw->window && sw->window->outputDevice() == static_cast<int>(output.id()))
3859 {3860 {
3860 UnityWindow::get(sw->window)->deco_win_->scaled = true;3861 UnityWindow::get(sw->window)->deco_win_->scaled = true;
3861 layout_windows.emplace_back(std::make_shared<LayoutWindow>(sw->window->id()));3862 layout_windows.emplace_back(std::make_shared<LayoutWindow>(sw->window->id()));
@@ -3983,6 +3984,8 @@
39833984
3984 // We disable the edge barriers, to avoid blocking the mouse pointer during lockscreen3985 // We disable the edge barriers, to avoid blocking the mouse pointer during lockscreen
3985 edge_barriers_->force_disable = true;3986 edge_barriers_->force_disable = true;
3987
3988 UpdateGesturesSupport();
3986}3989}
39873990
3988void UnityScreen::OnScreenUnlocked()3991void UnityScreen::OnScreenUnlocked()
@@ -3999,19 +4002,36 @@
3999 screen->addAction(&action);4002 screen->addAction(&action);
40004003
4001 edge_barriers_->force_disable = false;4004 edge_barriers_->force_disable = false;
4005
4006 UpdateGesturesSupport();
4007}
4008
4009std::string UnityScreen::GetLockStampFile() const
4010{
4011 std::string cache_dir;
4012
4013 if (session_->AutomaticLogin())
4014 cache_dir = DesktopUtilities::GetUserCacheDirectory();
4015 else
4016 cache_dir = DesktopUtilities::GetUserRuntimeDirectory();
4017
4018 if (cache_dir.empty())
4019 return std::string();
4020
4021 return cache_dir+local::LOCKED_STAMP;
4002}4022}
40034023
4004void UnityScreen::SaveLockStamp(bool save)4024void UnityScreen::SaveLockStamp(bool save)
4005{4025{
4006 auto const& cache_dir = DesktopUtilities::GetUserRuntimeDirectory();4026 std::string file_path = GetLockStampFile();
40074027
4008 if (cache_dir.empty())4028 if (file_path.empty())
4009 return;4029 return;
40104030
4011 if (save)4031 if (save)
4012 {4032 {
4013 glib::Error error;4033 glib::Error error;
4014 g_file_set_contents((cache_dir+local::LOCKED_STAMP).c_str(), "", 0, &error);4034 g_file_set_contents(file_path.c_str(), "", 0, &error);
40154035
4016 if (error)4036 if (error)
4017 {4037 {
@@ -4020,7 +4040,7 @@
4020 }4040 }
4021 else4041 else
4022 {4042 {
4023 if (g_unlink((cache_dir+local::LOCKED_STAMP).c_str()) < 0)4043 if (g_unlink(file_path.c_str()) < 0)
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches

to all changes: