From 42d63de9eec3100ebb2ef50272708c60d6942b8e Mon Sep 17 00:00:00 2001 From: Andrea Azzarone Date: Wed, 8 Jan 2014 16:05:53 +0100 Subject: Integrate the panel view in the lockscreen. (bzr r3611.4.7) --- plugins/unityshell/CMakeLists.txt | 6 ++--- plugins/unityshell/src/unityshell.cpp | 44 +++++++++++++++++++++++++++++++++++ plugins/unityshell/src/unityshell.h | 2 ++ 3 files changed, 49 insertions(+), 3 deletions(-) (limited to 'plugins/unityshell') diff --git a/plugins/unityshell/CMakeLists.txt b/plugins/unityshell/CMakeLists.txt index 401c92cad..0bd61ec67 100644 --- a/plugins/unityshell/CMakeLists.txt +++ b/plugins/unityshell/CMakeLists.txt @@ -13,7 +13,7 @@ endif() compiz_plugin (unityshell PKGDEPS ${UNITY_PLUGIN_DEPS} PLUGINDEPS composite opengl compiztoolbox scale - CFLAGSADD "-DINSTALLPREFIX='\"${CMAKE_INSTALL_PREFIX}\"' -DPKGDATADIR='\"${PKGDATADIR}\"' -I${CMAKE_BINARY_DIR} -I${CMAKE_SOURCE_DIR} ${BOOT_LOGGER_FLAG} -DGETTEXT_PACKAGE='\"unity\"' ${MAINTAINER_CXXFLAGS} -I${CMAKE_SOURCE_DIR}/dash/ -I${CMAKE_SOURCE_DIR}/launcher/ -I${CMAKE_SOURCE_DIR}/hud/ -I${CMAKE_SOURCE_DIR}/panel/ -I${CMAKE_SOURCE_DIR}/shortcuts/ -I${CMAKE_SOURCE_DIR}/shutdown/ -I${CMAKE_SOURCE_DIR}/unity-shared/" + CFLAGSADD "-DINSTALLPREFIX='\"${CMAKE_INSTALL_PREFIX}\"' -DPKGDATADIR='\"${PKGDATADIR}\"' -I${CMAKE_BINARY_DIR} -I${CMAKE_SOURCE_DIR} ${BOOT_LOGGER_FLAG} -DGETTEXT_PACKAGE='\"unity\"' ${MAINTAINER_CXXFLAGS} -I${CMAKE_SOURCE_DIR}/dash/ -I${CMAKE_SOURCE_DIR}/launcher/ -I${CMAKE_SOURCE_DIR}/lockscreen/ -I${CMAKE_SOURCE_DIR}/hud/ -I${CMAKE_SOURCE_DIR}/panel/ -I${CMAKE_SOURCE_DIR}/shortcuts/ -I${CMAKE_SOURCE_DIR}/shutdown/ -I${CMAKE_SOURCE_DIR}/unity-shared/" LIBDIRS "${CMAKE_BINARY_DIR}/UnityCore" ) @@ -21,8 +21,8 @@ if(revert_compiz) set (CMAKE_BUILD_TYPE "" CACHE STRING "Build type (Debug/Release/RelWithDebInfo/MinSizeRe)" FORCE) endif() -add_dependencies(unityshell unity-core-${UNITY_API_VERSION} dash-lib launcher-lib switcher-lib hud-lib panel-lib shortcuts-lib shutdown-lib unity-shared unity-shared-compiz) -target_link_libraries(unityshell unity-core-${UNITY_API_VERSION} launcher-lib dash-lib switcher-lib hud-lib panel-lib shortcuts-lib shutdown-lib unity-shared unity-shared-bamf unity-shared-compiz) +add_dependencies(unityshell unity-core-${UNITY_API_VERSION} dash-lib launcher-lib lockscreen-lib switcher-lib hud-lib panel-lib shortcuts-lib shutdown-lib unity-shared unity-shared-compiz) +target_link_libraries(unityshell unity-core-${UNITY_API_VERSION} launcher-lib lockscreen-lib dash-lib switcher-lib hud-lib panel-lib shortcuts-lib shutdown-lib unity-shared unity-shared-bamf unity-shared-compiz) set_target_properties(unityshell PROPERTIES INSTALL_RPATH "${CACHED_UNITY_PRIVATE_DEPS_LIBRARY_DIRS}" INSTALL_RPATH_USE_LINK_PATH TRUE) diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index 3601ffbb8..46c92b6d6 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -71,6 +71,11 @@ #include "UBusWrapper.h" #include "UScreen.h" +#include +#include +#include + + #include "config.h" /* FIXME: once we get a better method to add the toplevel windows to @@ -3487,6 +3492,45 @@ void UnityScreen::initLauncher() session_controller_ = std::make_shared(manager); AddChild(session_controller_.get()); + // Setup Lockscreen Controller + lockscreen_controller_ = std::make_shared(manager); + manager->lock_requested(); + + { + NihDBusProxy * upstart; + const gchar *upstartsession = g_getenv ("UPSTART_SESSION"); + if (upstartsession != NULL) + { + DBusConnection *conn = dbus_connection_open (upstartsession, NULL); + if (conn != NULL) + { + upstart = nih_dbus_proxy_new (NULL, conn, + NULL, + DBUS_PATH_UPSTART, + NULL, NULL); + if (upstart == NULL) + { + NihError * err = nih_error_get(); + g_warning("Unable to get Upstart proxy: %s", err->message); + nih_free(err); + } + dbus_connection_unref (conn); + } + } + + int event_sent = 0; + event_sent = upstart_emit_event_sync (NULL, upstart, + "desktop-lock", NULL, 0); + if (event_sent != 0) + { + NihError * err = nih_error_get(); + g_warning("Unable to signal for indicator services to stop: %s", err->message); + nih_free(err); + } + + nih_unref (upstart, NULL); + } + launcher_controller_->launcher().size_changed.connect([this] (nux::Area*, int w, int h) { /* The launcher geometry includes 1px used to draw the right margin * that must not be considered when drawing an overlay */ diff --git a/plugins/unityshell/src/unityshell.h b/plugins/unityshell/src/unityshell.h index 56b389b4b..54c095d7a 100644 --- a/plugins/unityshell/src/unityshell.h +++ b/plugins/unityshell/src/unityshell.h @@ -58,6 +58,7 @@ #include "FontSettings.h" #include "ShortcutController.h" #include "LauncherController.h" +#include "LockScreenController.h" #include "PanelController.h" #include "PanelStyle.h" #include "UScreen.h" @@ -301,6 +302,7 @@ private: hud::Controller::Ptr hud_controller_; shortcut::Controller::Ptr shortcut_controller_; session::Controller::Ptr session_controller_; + std::shared_ptr lockscreen_controller_; debug::DebugDBusInterface debugger_; std::unique_ptr bghash_; -- cgit v1.2.3 From 0220eefb0ed59006c784e98d5c852c6b96a6ad3b Mon Sep 17 00:00:00 2001 From: Andrea Azzarone Date: Thu, 23 Jan 2014 13:01:26 +0100 Subject: Unlock screen if the password is correct. Still buggy btw. (bzr r3611.4.14) --- plugins/unityshell/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'plugins/unityshell') diff --git a/plugins/unityshell/CMakeLists.txt b/plugins/unityshell/CMakeLists.txt index 0bd61ec67..e106df948 100644 --- a/plugins/unityshell/CMakeLists.txt +++ b/plugins/unityshell/CMakeLists.txt @@ -21,8 +21,8 @@ if(revert_compiz) set (CMAKE_BUILD_TYPE "" CACHE STRING "Build type (Debug/Release/RelWithDebInfo/MinSizeRe)" FORCE) endif() -add_dependencies(unityshell unity-core-${UNITY_API_VERSION} dash-lib launcher-lib lockscreen-lib switcher-lib hud-lib panel-lib shortcuts-lib shutdown-lib unity-shared unity-shared-compiz) -target_link_libraries(unityshell unity-core-${UNITY_API_VERSION} launcher-lib lockscreen-lib dash-lib switcher-lib hud-lib panel-lib shortcuts-lib shutdown-lib unity-shared unity-shared-bamf unity-shared-compiz) +add_dependencies(unityshell unity-core-${UNITY_API_VERSION} dash-lib launcher-lib pam lockscreen-lib switcher-lib hud-lib panel-lib shortcuts-lib shutdown-lib unity-shared unity-shared-compiz) +target_link_libraries(unityshell unity-core-${UNITY_API_VERSION} launcher-lib pam lockscreen-lib dash-lib switcher-lib hud-lib panel-lib shortcuts-lib shutdown-lib unity-shared unity-shared-bamf unity-shared-compiz) set_target_properties(unityshell PROPERTIES INSTALL_RPATH "${CACHED_UNITY_PRIVATE_DEPS_LIBRARY_DIRS}" INSTALL_RPATH_USE_LINK_PATH TRUE) -- cgit v1.2.3 From 86f7440c2cf154efe22b32c1e36c5ca9d4c616d8 Mon Sep 17 00:00:00 2001 From: Andrea Azzarone Date: Sun, 26 Jan 2014 22:30:38 +0100 Subject: FadeIn/Out the lockscreen. This sould also fix a crash on unlock. (bzr r3611.4.15) --- plugins/unityshell/src/unityshell.cpp | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'plugins/unityshell') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index 7231309f1..d68acb7f1 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -3529,17 +3529,20 @@ void UnityScreen::initLauncher() } } - int event_sent = 0; - event_sent = upstart_emit_event_sync (NULL, upstart, - "desktop-lock", NULL, 0); - if (event_sent != 0) - { - NihError * err = nih_error_get(); - g_warning("Unable to signal for indicator services to stop: %s", err->message); - nih_free(err); - } + if (upstart != NULL) + { + int event_sent = 0; + event_sent = upstart_emit_event_sync (NULL, upstart, + "desktop-lock", NULL, 0); + if (event_sent != 0) + { + NihError * err = nih_error_get(); + g_warning("Unable to signal for indicator services to stop: %s", err->message); + nih_free(err); + } - nih_unref (upstart, NULL); + nih_unref (upstart, NULL); + } } launcher_controller_->launcher().size_changed.connect([this] (nux::Area*, int w, int h) { -- cgit v1.2.3 From cafc7efc45401926cd9ec9d2571753ceb1efc2b0 Mon Sep 17 00:00:00 2001 From: Andrea Azzarone Date: Thu, 30 Jan 2014 19:41:46 +0100 Subject: Allow to disable lockscreen or fallback to lightdm. Add tests. (bzr r3611.4.21) --- plugins/unityshell/src/unityshell.cpp | 4 ++++ plugins/unityshell/src/unityshell.h | 2 ++ plugins/unityshell/unityshell_xml.in | 21 +++++++++++++++++++++ 3 files changed, 27 insertions(+) (limited to 'plugins/unityshell') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index c6bc914d7..a23868343 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -345,6 +345,7 @@ UnityScreen::UnityScreen(CompScreen* screen) optionSetAltTabBiasViewportNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2)); optionSetDisableShowDesktopNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2)); optionSetDisableMouseNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2)); + optionSetLockScreenTypeNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2)); optionSetAltTabForwardAllInitiate(boost::bind(&UnityScreen::altTabForwardAllInitiate, this, _1, _2, _3)); optionSetAltTabForwardInitiate(boost::bind(&UnityScreen::altTabForwardInitiate, this, _1, _2, _3)); @@ -3415,6 +3416,9 @@ void UnityScreen::optionChanged(CompOption* opt, UnityshellOptions::Options num) case UnityshellOptions::EdgePassedDisabledMs: launcher_options->edge_passed_disabled_ms = optionGetEdgePassedDisabledMs(); break; + case UnityshellOptions::LockScreenType: + lockscreen_settings_.lockscreen_type = static_cast(1/*optionGetLockScreenType()*/); + break; default: break; } diff --git a/plugins/unityshell/src/unityshell.h b/plugins/unityshell/src/unityshell.h index 6f8955a21..255b25510 100644 --- a/plugins/unityshell/src/unityshell.h +++ b/plugins/unityshell/src/unityshell.h @@ -59,6 +59,7 @@ #include "ShortcutController.h" #include "LauncherController.h" #include "LockScreenController.h" +#include "LockScreenSettings.h" #include "PanelController.h" #include "PanelStyle.h" #include "UScreen.h" @@ -304,6 +305,7 @@ private: FontSettings font_settings_; internal::FavoriteStoreGSettings favorite_store_; ThumbnailGenerator thumbnail_generator_; + lockscreen::Settings lockscreen_settings_; /* The window thread should be the last thing removed, as c++ does it in reverse order */ std::unique_ptr wt; diff --git a/plugins/unityshell/unityshell_xml.in b/plugins/unityshell/unityshell_xml.in index c4929696f..9a9410c2f 100644 --- a/plugins/unityshell/unityshell_xml.in +++ b/plugins/unityshell/unityshell_xml.in @@ -137,6 +137,27 @@ true + + + -- cgit v1.2.3 From 63eafc58b3ee9f772d3f029bca3466200e27ab11 Mon Sep 17 00:00:00 2001 From: Andrea Azzarone Date: Wed, 5 Feb 2014 14:16:28 +0100 Subject: Disable hud,dash and the shourtcut overlay during lockscreen (bzr r3611.4.24) --- plugins/unityshell/src/unityshell.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'plugins/unityshell') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index a23868343..3065cfc1f 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -1940,6 +1940,9 @@ bool UnityScreen::showLauncherKeyInitiate(CompAction* action, CompAction::State state, CompOption::Vector& options) { + if (lockscreen_controller_->IsLocked()) + return true; + // to receive the Terminate event if (state & CompAction::StateInitKey) action->setState(action->state() | CompAction::StateTermKey); @@ -1949,7 +1952,8 @@ bool UnityScreen::showLauncherKeyInitiate(CompAction* action, launcher_controller_->HandleLauncherKeyPress(when); EnsureSuperKeybindings (); - if (!shortcut_controller_->Visible() && shortcut_controller_->IsEnabled()) + if (!shortcut_controller_->Visible() && + shortcut_controller_->IsEnabled()) { if (shortcut_controller_->Show()) { @@ -2370,7 +2374,8 @@ bool UnityScreen::ShowHud() return false; // early exit if the switcher is open } - if (PluginAdapter::Default().IsTopWindowFullscreenOnMonitorWithMouse()) + if (PluginAdapter::Default().IsTopWindowFullscreenOnMonitorWithMouse() || + lockscreen_controller_->IsLocked()) { return false; } -- cgit v1.2.3 From 465ee167305bcecd206cbbe7fe30920212e4f779 Mon Sep 17 00:00:00 2001 From: Andrea Azzarone Date: Fri, 7 Feb 2014 20:17:24 +0100 Subject: Add UpstartWrapper and proper start/stop unity-panel-service in lockscreen mode. (bzr r3611.4.27) --- plugins/unityshell/src/unityshell.cpp | 44 ----------------------------------- 1 file changed, 44 deletions(-) (limited to 'plugins/unityshell') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index 3065cfc1f..c401c7dac 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -74,11 +74,6 @@ #include "UBusWrapper.h" #include "UScreen.h" -#include -#include -#include - - #include "config.h" /* FIXME: once we get a better method to add the toplevel windows to @@ -3576,45 +3571,6 @@ void UnityScreen::initLauncher() // Setup Lockscreen Controller lockscreen_controller_ = std::make_shared(manager); - manager->lock_requested(); - - { - NihDBusProxy * upstart; - const gchar *upstartsession = g_getenv ("UPSTART_SESSION"); - if (upstartsession != NULL) - { - DBusConnection *conn = dbus_connection_open (upstartsession, NULL); - if (conn != NULL) - { - upstart = nih_dbus_proxy_new (NULL, conn, - NULL, - DBUS_PATH_UPSTART, - NULL, NULL); - if (upstart == NULL) - { - NihError * err = nih_error_get(); - g_warning("Unable to get Upstart proxy: %s", err->message); - nih_free(err); - } - dbus_connection_unref (conn); - } - } - - if (upstart != NULL) - { - int event_sent = 0; - event_sent = upstart_emit_event_sync (NULL, upstart, - "desktop-lock", NULL, 0); - if (event_sent != 0) - { - NihError * err = nih_error_get(); - g_warning("Unable to signal for indicator services to stop: %s", err->message); - nih_free(err); - } - - nih_unref (upstart, NULL); - } - } launcher_controller_->launcher().size_changed.connect([this] (nux::Area*, int w, int h) { /* The launcher geometry includes 1px used to draw the right margin -- cgit v1.2.3 From 9d749cd1e0d8abc95a6599d534183b68a6eb0123 Mon Sep 17 00:00:00 2001 From: Andrea Azzarone Date: Thu, 13 Feb 2014 20:18:27 +0100 Subject: Minor changes. (bzr r3611.4.49) --- plugins/unityshell/src/unityshell.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins/unityshell') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index 20a072e31..e7354e70a 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -3446,7 +3446,7 @@ void UnityScreen::optionChanged(CompOption* opt, UnityshellOptions::Options num) launcher_options->edge_passed_disabled_ms = optionGetEdgePassedDisabledMs(); break; case UnityshellOptions::LockScreenType: - lockscreen_settings_.lockscreen_type = static_cast(1/*optionGetLockScreenType()*/); + lockscreen_settings_.lockscreen_type = static_cast(optionGetLockScreenType()); break; default: break; -- cgit v1.2.3 From 794154b2b3abe00dc684b9c5566bd7b93a67db6a Mon Sep 17 00:00:00 2001 From: Andrea Azzarone Date: Sat, 22 Feb 2014 05:18:18 +0100 Subject: Improve screen reader in the lockscreen. (bzr r3566.5.441) --- .../unityshell/src/nux-text-entry-accessible.cpp | 27 +++++++--------------- plugins/unityshell/src/unitya11y.cpp | 5 ++++ 2 files changed, 13 insertions(+), 19 deletions(-) (limited to 'plugins/unityshell') diff --git a/plugins/unityshell/src/nux-text-entry-accessible.cpp b/plugins/unityshell/src/nux-text-entry-accessible.cpp index e948f2827..bda50a611 100644 --- a/plugins/unityshell/src/nux-text-entry-accessible.cpp +++ b/plugins/unityshell/src/nux-text-entry-accessible.cpp @@ -48,36 +48,19 @@ static AtkStateSet* nux_text_entry_accessible_ref_state_set(AtkObject* obj); G_DEFINE_TYPE(NuxTextEntryAccessible, nux_text_entry_accessible, NUX_TYPE_VIEW_ACCESSIBLE); -#define NUX_TEXT_ENTRY_ACCESSIBLE_GET_PRIVATE(obj) \ - (G_TYPE_INSTANCE_GET_PRIVATE ((obj), NUX_TYPE_TEXT_ENTRY_ACCESSIBLE, \ - NuxTextEntryAccessiblePrivate)) - -struct _NuxTextEntryAccessiblePrivate -{ -}; - - static void nux_text_entry_accessible_class_init(NuxTextEntryAccessibleClass* klass) { - GObjectClass* gobject_class = G_OBJECT_CLASS(klass); AtkObjectClass* atk_class = ATK_OBJECT_CLASS(klass); /* AtkObject */ atk_class->ref_state_set = nux_text_entry_accessible_ref_state_set; atk_class->initialize = nux_text_entry_accessible_initialize; - - g_type_class_add_private(gobject_class, sizeof(NuxTextEntryAccessiblePrivate)); } static void nux_text_entry_accessible_init(NuxTextEntryAccessible* self) -{ - NuxTextEntryAccessiblePrivate* priv = - NUX_TEXT_ENTRY_ACCESSIBLE_GET_PRIVATE(self); - - self->priv = priv; -} +{} AtkObject* nux_text_entry_accessible_new(nux::Object* object) @@ -98,9 +81,15 @@ static void nux_text_entry_accessible_initialize(AtkObject* accessible, gpointer data) { + nux::Object* nux_object = NULL; + nux::TextEntry* text_entry = NULL; + ATK_OBJECT_CLASS(nux_text_entry_accessible_parent_class)->initialize(accessible, data); - atk_object_set_role(accessible, ATK_ROLE_ENTRY); + nux_object = nux_object_accessible_get_object(NUX_OBJECT_ACCESSIBLE(accessible)); + text_entry = dynamic_cast(nux_object); + + atk_object_set_role(accessible, text_entry->PasswordMode() ? ATK_ROLE_PASSWORD_TEXT : ATK_ROLE_ENTRY); } static AtkStateSet* diff --git a/plugins/unityshell/src/unitya11y.cpp b/plugins/unityshell/src/unitya11y.cpp index 5c9dc6d41..159938451 100644 --- a/plugins/unityshell/src/unitya11y.cpp +++ b/plugins/unityshell/src/unitya11y.cpp @@ -42,6 +42,7 @@ #include "QuicklistView.h" #include "QuicklistMenuItem.h" #include "SwitcherView.h" +#include "TextInput.h" #include "unity-launcher-accessible.h" #include "unity-launcher-icon-accessible.h" #include "unity-panel-view-accessible.h" @@ -53,6 +54,7 @@ #include "unity-quicklist-accessible.h" #include "unity-quicklist-menu-item-accessible.h" #include "unity-switcher-accessible.h" +#include "unity-text-input-accessible.h" using namespace unity; using namespace unity::dash; @@ -184,6 +186,9 @@ unity_a11y_create_accessible(nux::Object* object) if (object->Type().IsDerivedFromType(unity::SearchBar::StaticObjectType)) return unity_search_bar_accessible_new(object); + if (object->Type().IsDerivedFromType(unity::TextInput::StaticObjectType)) + return unity_text_input_accessible_new(object); + if (object->Type().IsDerivedFromType(unity::switcher::SwitcherView::StaticObjectType)) return unity_switcher_accessible_new(object); -- cgit v1.2.3 From 0d342de2d49ca9ca2d2c91d263d9bfb03d2f7884 Mon Sep 17 00:00:00 2001 From: Andrea Azzarone Date: Sat, 22 Feb 2014 05:19:40 +0100 Subject: Add missing files. (bzr r3566.5.442) --- .../unityshell/src/unity-text-input-accessible.cpp | 90 ++++++++++++++++++++++ .../unityshell/src/unity-text-input-accessible.h | 57 ++++++++++++++ 2 files changed, 147 insertions(+) create mode 100644 plugins/unityshell/src/unity-text-input-accessible.cpp create mode 100644 plugins/unityshell/src/unity-text-input-accessible.h (limited to 'plugins/unityshell') diff --git a/plugins/unityshell/src/unity-text-input-accessible.cpp b/plugins/unityshell/src/unity-text-input-accessible.cpp new file mode 100644 index 000000000..57d1a490a --- /dev/null +++ b/plugins/unityshell/src/unity-text-input-accessible.cpp @@ -0,0 +1,90 @@ +/* + * Copyright (C) 2014 Canonical Ltd + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 3 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * Authored by: Andrea Azzarone + */ + +#include "unity-text-input-accessible.h" + +#include "unitya11y.h" +#include "TextInput.h" + +using namespace unity; + +/* GObject */ +static void unity_text_input_accessible_class_init(UnityTextInputAccessibleClass* klass); +static void unity_text_input_accessible_init(UnityTextInputAccessible* self); +//static void unity_text_input_accessible_finalize(GObject* object); + +/* AtkObject.h */ +static void unity_text_input_accessible_initialize(AtkObject* accessible, + gpointer data); + +G_DEFINE_TYPE(UnityTextInputAccessible, unity_text_input_accessible, NUX_TYPE_VIEW_ACCESSIBLE) + +static void +unity_text_input_accessible_class_init(UnityTextInputAccessibleClass* klass) +{ + AtkObjectClass* atk_class = ATK_OBJECT_CLASS(klass); + + /* AtkObject */ + atk_class->initialize = unity_text_input_accessible_initialize; +} + +static void +unity_text_input_accessible_init(UnityTextInputAccessible* self) +{} + +AtkObject* +unity_text_input_accessible_new(nux::Object* object) +{ + AtkObject* accessible = NULL; + + g_return_val_if_fail(dynamic_cast(object), NULL); + + accessible = ATK_OBJECT(g_object_new(UNITY_TYPE_TEXT_INPUT_ACCESSIBLE, NULL)); + + atk_object_initialize(accessible, object); + + return accessible; +} + +static void +unity_text_input_accessible_initialize(AtkObject* accessible, + gpointer data) +{ + nux::Object* nux_object = NULL; + TextInput* text_input = NULL; + nux::TextEntry* text_entry = NULL; + + ATK_OBJECT_CLASS(unity_text_input_accessible_parent_class)->initialize(accessible, data); + + accessible->role = ATK_ROLE_PANEL; + + nux_object = nux_object_accessible_get_object(NUX_OBJECT_ACCESSIBLE(accessible)); + text_input = dynamic_cast(nux_object); + + if (text_input == NULL) + return; + + text_entry = text_input->text_entry(); + + if (text_entry != NULL) + { + AtkObject* text_entry_accessible = NULL; + text_entry_accessible = unity_a11y_get_accessible(text_entry); + atk_object_set_name(text_entry_accessible, text_input->input_hint().c_str()); + } +} diff --git a/plugins/unityshell/src/unity-text-input-accessible.h b/plugins/unityshell/src/unity-text-input-accessible.h new file mode 100644 index 000000000..c1ab85636 --- /dev/null +++ b/plugins/unityshell/src/unity-text-input-accessible.h @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2014 Canonical Ltd + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 3 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * Authored by: Andrea Azzarone + */ + +#ifndef UNITY_TEXT_INPUT_ACCESSIBLE_H +#define UNITY_TEXT_INPUT_ACCESSIBLE_H + +#include + +#include "nux-view-accessible.h" + +G_BEGIN_DECLS + +#define UNITY_TYPE_TEXT_INPUT_ACCESSIBLE (unity_text_input_accessible_get_type ()) +#define UNITY_TEXT_INPUT_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_TYPE_TEXT_INPUT_ACCESSIBLE, UnityTextInputAccessible)) +#define UNITY_TEXT_INPUT_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_TYPE_TEXT_INPUT_ACCESSIBLE, UnityTextInputAccessibleClass)) +#define UNITY_IS_TEXT_INPUT_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_TYPE_TEXT_INPUT_ACCESSIBLE)) +#define UNITY_IS_TEXT_INPUT_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_TYPE_TEXT_INPUT_ACCESSIBLE)) +#define UNITY_TEXT_INPUT_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_TYPE_TEXT_INPUT_ACCESSIBLE, UnityTextInputAccessibleClass)) + +typedef struct _UnityTextInputAccessible UnityTextInputAccessible; +typedef struct _UnityTextInputAccessibleClass UnityTextInputAccessibleClass; +typedef struct _UnityTextInputAccessiblePrivate UnityTextInputAccessiblePrivate; + +struct _UnityTextInputAccessible +{ + NuxViewAccessible parent; + + /*< private >*/ + UnityTextInputAccessiblePrivate* priv; +}; + +struct _UnityTextInputAccessibleClass +{ + NuxViewAccessibleClass parent_class; +}; + +GType unity_text_input_accessible_get_type(void); +AtkObject* unity_text_input_accessible_new(nux::Object* object); + +G_END_DECLS + +#endif -- cgit v1.2.3 From 04b4da47db77cfc275f26e05d920196f15ffe516 Mon Sep 17 00:00:00 2001 From: Andrea Azzarone Date: Sat, 22 Feb 2014 06:55:47 +0100 Subject: Correct handle the grab when using the keyboard shortcut to lock the screen. (bzr r3566.5.444) --- plugins/unityshell/src/unityshell.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'plugins/unityshell') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index 5a3395d2c..8ce36bd2e 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -2526,7 +2526,11 @@ bool UnityScreen::LockScreenInitiate(CompAction* action, CompAction::State state, CompOption::Vector& options) { - session_controller_->LockScreen(); + sources_.AddIdle([this] { + session_controller_->LockScreen(); + return false; + }); + return true; } -- cgit v1.2.3 From a3dd99ca41690e1ffc0a3080a346b967b06db5ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Thu, 6 Mar 2014 00:09:07 +0100 Subject: UnityShell: never paint windows when the lockscreen is active In this way also popup windows or tooltips won't be shown on top of the locker (bzr r3695.4.18) --- plugins/unityshell/src/unityshell.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'plugins/unityshell') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index b28fef311..233d13846 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -2808,6 +2808,12 @@ bool UnityWindow::glPaint(const GLWindowPaintAttrib& attrib, } } + if (uScreen->lockscreen_controller_->IsShielded()) + { + mask |= PAINT_WINDOW_NO_CORE_INSTANCE_MASK; + return gWindow->glPaint(attrib, matrix, region, mask); + } + GLWindowPaintAttrib wAttrib = attrib; if (mMinimizeHandler) @@ -2838,7 +2844,7 @@ bool UnityWindow::glPaint(const GLWindowPaintAttrib& attrib, paintInnerGlow(scaled_geo, matrix, attrib, mask); } - if (uScreen->session_controller_ && uScreen->session_controller_->Visible()) + if (uScreen->session_controller_->Visible()) { // Let's darken the other windows if the session dialog is visible wAttrib.brightness *= 0.75f; -- cgit v1.2.3 From 7f58f757c94be114ee9d32a23e63ef04bd096f58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Thu, 6 Mar 2014 03:27:46 +0100 Subject: UnityShell Settings: use "Unity" name instead of "custom lockscreen" (bzr r3695.4.23) --- plugins/unityshell/unityshell_xml.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins/unityshell') diff --git a/plugins/unityshell/unityshell_xml.in b/plugins/unityshell/unityshell_xml.in index 1df71ab87..fd7e4ec6f 100644 --- a/plugins/unityshell/unityshell_xml.in +++ b/plugins/unityshell/unityshell_xml.in @@ -163,7 +163,7 @@ 2 - <_name>Custom lockscreen + <_name>Unity -- cgit v1.2.3 From 2351c070acf0b5951e8f3dfafdd6887485868c0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Thu, 6 Mar 2014 07:09:18 +0100 Subject: UnityWindow: make all windows but menus transparent when in lockscreen mode We need to draw menus or indicator won't show anything, but it seems that we can't just set the mask to PAINT_WINDOW_NO_CORE_INSTANCE_MASK in non-menu windows or the menus won't show anyway... (bzr r3695.4.34) --- plugins/unityshell/src/unityshell.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'plugins/unityshell') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index 233d13846..29cf6515c 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -2808,14 +2808,17 @@ bool UnityWindow::glPaint(const GLWindowPaintAttrib& attrib, } } - if (uScreen->lockscreen_controller_->IsShielded()) + GLWindowPaintAttrib wAttrib = attrib; + + if (window->type() != CompWindowTypePopupMenuMask) { - mask |= PAINT_WINDOW_NO_CORE_INSTANCE_MASK; - return gWindow->glPaint(attrib, matrix, region, mask); + if (uScreen->lockscreen_controller_->IsShielded()) + { + wAttrib.opacity = 0; + return gWindow->glPaint(wAttrib, matrix, region, mask); + } } - GLWindowPaintAttrib wAttrib = attrib; - if (mMinimizeHandler) { mask |= mMinimizeHandler->getPaintMask (); -- cgit v1.2.3 From 187658a8771b8278203fe3d7aa1d9b884ab1093f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Thu, 6 Mar 2014 21:49:14 +0100 Subject: WindowManager: add activate_indicators_key property that matches compiz setting (bzr r3695.4.45) --- plugins/unityshell/src/unityshell.cpp | 14 ++++++++++++++ plugins/unityshell/src/unityshell.h | 1 + 2 files changed, 15 insertions(+) (limited to 'plugins/unityshell') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index 91abfe0bf..105af5ff9 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -338,6 +338,7 @@ UnityScreen::UnityScreen(CompScreen* screen) optionSetShowDesktopKeyInitiate(boost::bind(&UnityScreen::showDesktopKeyInitiate, this, _1, _2, _3)); optionSetPanelFirstMenuInitiate(boost::bind(&UnityScreen::showPanelFirstMenuKeyInitiate, this, _1, _2, _3)); optionSetPanelFirstMenuTerminate(boost::bind(&UnityScreen::showPanelFirstMenuKeyTerminate, this, _1, _2, _3)); + optionSetPanelFirstMenuNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2)); optionSetAutomaximizeValueNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2)); optionSetDashTapDurationNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2)); optionSetAltTabTimeoutNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2)); @@ -2582,9 +2583,19 @@ void UnityScreen::UpdateCloseWindowKey(CompAction::KeyBinding const& keybind) WindowManager::Default().close_window_key = std::make_pair(modifiers, keysym); } +void UnityScreen::UpdateActivateIndicatorsKey() +{ + CompAction::KeyBinding const& keybind = optionGetPanelFirstMenu().key(); + KeySym keysym = XkbKeycodeToKeysym(screen->dpy(), keybind.keycode(), 0, 0); + unsigned modifiers = CompizModifiersToNux(keybind.modifiers()); + + WindowManager::Default().activate_indicators_key = std::make_pair(modifiers, keysym); +} + bool UnityScreen::initPluginActions() { PluginAdapter& adapter = PluginAdapter::Default(); + UpdateActivateIndicatorsKey(); if (CompPlugin* p = CompPlugin::find("core")) { @@ -3502,6 +3513,9 @@ void UnityScreen::optionChanged(CompOption* opt, UnityshellOptions::Options num) case UnityshellOptions::LockScreenType: lockscreen_settings_.lockscreen_type = static_cast(optionGetLockScreenType()); break; + case UnityshellOptions::PanelFirstMenu: + UpdateActivateIndicatorsKey(); + break; default: break; } diff --git a/plugins/unityshell/src/unityshell.h b/plugins/unityshell/src/unityshell.h index 3ea70aeac..612ef6006 100644 --- a/plugins/unityshell/src/unityshell.h +++ b/plugins/unityshell/src/unityshell.h @@ -299,6 +299,7 @@ private: unsigned XModifiersToNux(unsigned input) const; void UpdateCloseWindowKey(CompAction::KeyBinding const&); + void UpdateActivateIndicatorsKey(); bool getMipmap () override { return false; } -- cgit v1.2.3 From 0512da318668606523f6d29eee829e25f56f6ef8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Thu, 6 Mar 2014 22:37:45 +0100 Subject: LockScreen: use settings parameters LockScreenSettings (bzr r3695.4.48) --- plugins/unityshell/src/unityshell.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins/unityshell') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index 105af5ff9..0a1db968b 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -2595,7 +2595,6 @@ void UnityScreen::UpdateActivateIndicatorsKey() bool UnityScreen::initPluginActions() { PluginAdapter& adapter = PluginAdapter::Default(); - UpdateActivateIndicatorsKey(); if (CompPlugin* p = CompPlugin::find("core")) { @@ -3663,6 +3662,7 @@ void UnityScreen::initLauncher() // Setup Lockscreen Controller lockscreen_controller_ = std::make_shared(manager); + UpdateActivateIndicatorsKey(); auto on_launcher_size_changed = [this] (nux::Area* area, int w, int h) { /* The launcher geometry includes 1px used to draw the right margin -- cgit v1.2.3 From 5676f4fbfa1ebf42cab107e368e655bc459fe764 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Fri, 7 Mar 2014 02:37:39 +0100 Subject: UnityWindow: add proper cross-fading when the lockscreen is about to show/hide Also, we override the paint priority making sure that no other plugin might cause a window not to be painted with the opacity we desire (bzr r3695.4.49) --- plugins/unityshell/src/unityshell.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'plugins/unityshell') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index 0a1db968b..8ee2a9bab 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -2822,10 +2822,18 @@ bool UnityWindow::glPaint(const GLWindowPaintAttrib& attrib, if (window->type() != CompWindowTypePopupMenuMask) { - if (uScreen->lockscreen_controller_->IsShielded()) + if (uScreen->lockscreen_controller_->IsLocked()) { - wAttrib.opacity = 0; - return gWindow->glPaint(wAttrib, matrix, region, mask); + // For some reasons PAINT_WINDOW_NO_CORE_INSTANCE_MASK doesn't work here + // (well, it works too much, as it applies to menus too), so we need + // to paint the windows at the proper opacity, overriding any other + // paint plugin (animation, fade?) that might interfere with us. + wAttrib.opacity = COMPIZ_COMPOSITE_OPAQUE * (1.0f - uScreen->lockscreen_controller_->Opacity()); + int old_index = gWindow->glPaintGetCurrentIndex(); + gWindow->glPaintSetCurrentIndex(MAXSHORT); + bool ret = gWindow->glPaint(wAttrib, matrix, region, mask); + gWindow->glPaintSetCurrentIndex(old_index); + return ret; } } -- cgit v1.2.3 From b340d8af7a355dc936a1b1510dbbad515beceac4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Fri, 7 Mar 2014 04:37:43 +0100 Subject: UnityScreen: add session::DBusManager instance (bzr r3695.4.53) --- plugins/unityshell/src/unityshell.cpp | 1 + plugins/unityshell/src/unityshell.h | 2 ++ 2 files changed, 3 insertions(+) (limited to 'plugins/unityshell') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index 8ee2a9bab..85d7734d9 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -3665,6 +3665,7 @@ void UnityScreen::initLauncher() // Setup Session Controller auto manager = std::make_shared(); + session_dbus_manager_ = std::make_shared(manager); session_controller_ = std::make_shared(manager); AddChild(session_controller_.get()); diff --git a/plugins/unityshell/src/unityshell.h b/plugins/unityshell/src/unityshell.h index 612ef6006..a57ce4568 100644 --- a/plugins/unityshell/src/unityshell.h +++ b/plugins/unityshell/src/unityshell.h @@ -67,6 +67,7 @@ #include "ScreenIntrospection.h" #include "SwitcherController.h" #include "SessionController.h" +#include "SessionDBusManager.h" #include "SpreadFilter.h" #include "UBusWrapper.h" #include "UnityshellPrivate.h" @@ -330,6 +331,7 @@ private: switcher::Controller::Ptr switcher_controller_; hud::Controller::Ptr hud_controller_; shortcut::Controller::Ptr shortcut_controller_; + session::DBusManager::Ptr session_dbus_manager_; session::Controller::Ptr session_controller_; std::shared_ptr lockscreen_controller_; debug::DebugDBusInterface debugger_; -- cgit v1.2.3 From e14d4782b425286890e24397470987e90c85e5af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Fri, 7 Mar 2014 20:18:30 +0100 Subject: UnityScreen: allow to paint a menu *only* if an indicator is currently opened This solves a possible secuity flaw that caused any pop-up menu to be drawn also if not an indicator. (bzr r3695.4.61) --- plugins/unityshell/src/unityshell.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'plugins/unityshell') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index 85d7734d9..8c284847b 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -2820,9 +2820,10 @@ bool UnityWindow::glPaint(const GLWindowPaintAttrib& attrib, GLWindowPaintAttrib wAttrib = attrib; - if (window->type() != CompWindowTypePopupMenuMask) + if (uScreen->lockscreen_controller_->IsLocked()) { - if (uScreen->lockscreen_controller_->IsLocked()) + if (window->type() != CompWindowTypePopupMenuMask || + !uScreen->lockscreen_controller_->HasOpenMenu()) { // For some reasons PAINT_WINDOW_NO_CORE_INSTANCE_MASK doesn't work here // (well, it works too much, as it applies to menus too), so we need -- cgit v1.2.3