diff options
| author | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2014-03-12 23:56:15 +0100 |
|---|---|---|
| committer | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2014-03-12 23:56:15 +0100 |
| commit | ffd6e6cb369521f4e5231dbdfff85158d63f1e22 (patch) | |
| tree | 02af9690367228eb5ebf2b5155453de2c7e80b4c /plugins/unityshell | |
| parent | 8b03fb9cff19353a48aaf42ea2840a66fe8df82a (diff) | |
| parent | ac6a6bf484a8072fc00227e7bea30f44a79f1854 (diff) | |
Merge with trunk
(bzr r3702.5.5)
Diffstat (limited to 'plugins/unityshell')
| -rw-r--r-- | plugins/unityshell/CMakeLists.txt | 6 | ||||
| -rw-r--r-- | plugins/unityshell/src/nux-text-entry-accessible.cpp | 27 | ||||
| -rw-r--r-- | plugins/unityshell/src/unity-text-input-accessible.cpp | 90 | ||||
| -rw-r--r-- | plugins/unityshell/src/unity-text-input-accessible.h | 57 | ||||
| -rw-r--r-- | plugins/unityshell/src/unitya11y.cpp | 5 | ||||
| -rw-r--r-- | plugins/unityshell/src/unityshell.cpp | 57 | ||||
| -rw-r--r-- | plugins/unityshell/src/unityshell.h | 7 | ||||
| -rw-r--r-- | plugins/unityshell/unityshell.xml.in | 20 |
8 files changed, 245 insertions, 24 deletions
diff --git a/plugins/unityshell/CMakeLists.txt b/plugins/unityshell/CMakeLists.txt index 5fa3917b1..43e46e4bc 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" ) @@ -26,6 +26,8 @@ add_dependencies(unityshell decorations-lib hud-lib launcher-lib + pam + lockscreen-lib panel-lib shortcuts-lib shutdown-lib @@ -39,6 +41,8 @@ target_link_libraries(unityshell decorations-lib hud-lib launcher-lib + pam + lockscreen-lib panel-lib shortcuts-lib shutdown-lib 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::TextEntry*>(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/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 <http://www.gnu.org/licenses/>. + * + * Authored by: Andrea Azzarone <andrea.azzarone@canonical.com> + */ + +#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<TextInput*>(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<TextInput*>(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 <http://www.gnu.org/licenses/>. + * + * Authored by: Andrea Azzarone <andrea.azzarone@canonical.com> + */ + +#ifndef UNITY_TEXT_INPUT_ACCESSIBLE_H +#define UNITY_TEXT_INPUT_ACCESSIBLE_H + +#include <atk/atk.h> + +#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 diff --git a/plugins/unityshell/src/unitya11y.cpp b/plugins/unityshell/src/unitya11y.cpp index 50a72a380..346c915ae 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 "SessionButton.h" #include "unity-launcher-accessible.h" #include "unity-launcher-icon-accessible.h" @@ -54,6 +55,7 @@ #include "unity-quicklist-accessible.h" #include "unity-quicklist-menu-item-accessible.h" #include "unity-switcher-accessible.h" +#include "unity-text-input-accessible.h" #include "unity-session-button-accessible.h" using namespace unity; @@ -187,6 +189,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); diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index 88e4caa62..7d3b7a305 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -339,12 +339,14 @@ 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)); 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)); @@ -2004,6 +2006,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); @@ -2013,7 +2018,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()) { @@ -2435,7 +2441,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; } @@ -2522,7 +2529,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; } @@ -2573,6 +2584,15 @@ 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(); @@ -2801,6 +2821,24 @@ bool UnityWindow::glPaint(const GLWindowPaintAttrib& attrib, GLWindowPaintAttrib wAttrib = attrib; + 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 + // 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; + } + } + if (mMinimizeHandler) { mask |= mMinimizeHandler->getPaintMask (); @@ -2829,7 +2867,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; @@ -3481,6 +3519,12 @@ 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<lockscreen::Type>(optionGetLockScreenType()); + break; + case UnityshellOptions::PanelFirstMenu: + UpdateActivateIndicatorsKey(); + break; default: break; } @@ -3624,9 +3668,14 @@ void UnityScreen::initLauncher() // Setup Session Controller auto manager = std::make_shared<session::GnomeManager>(); + session_dbus_manager_ = std::make_shared<session::DBusManager>(manager); session_controller_ = std::make_shared<session::Controller>(manager); AddChild(session_controller_.get()); + // Setup Lockscreen Controller + lockscreen_controller_ = std::make_shared<lockscreen::Controller>(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 * that must not be considered when drawing an overlay */ diff --git a/plugins/unityshell/src/unityshell.h b/plugins/unityshell/src/unityshell.h index f45464ccc..274118a5d 100644 --- a/plugins/unityshell/src/unityshell.h +++ b/plugins/unityshell/src/unityshell.h @@ -58,6 +58,8 @@ #include "FontSettings.h" #include "ShortcutController.h" #include "LauncherController.h" +#include "LockScreenController.h" +#include "LockScreenSettings.h" #include "PanelController.h" #include "PanelStyle.h" #include "UScreen.h" @@ -65,6 +67,7 @@ #include "ScreenIntrospection.h" #include "SwitcherController.h" #include "SessionController.h" +#include "SessionDBusManager.h" #include "SpreadFilter.h" #include "UBusWrapper.h" #include "UnityshellPrivate.h" @@ -297,6 +300,7 @@ private: unsigned XModifiersToNux(unsigned input) const; void UpdateCloseWindowKey(CompAction::KeyBinding const&); + void UpdateActivateIndicatorsKey(); bool getMipmap () override { return false; } @@ -313,6 +317,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<nux::WindowThread> wt; @@ -328,7 +333,9 @@ 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> lockscreen_controller_; debug::DebugDBusInterface debugger_; std::unique_ptr<BGHash> bghash_; spread::Filter::Ptr spread_filter_; diff --git a/plugins/unityshell/unityshell.xml.in b/plugins/unityshell/unityshell.xml.in index 0104c6efb..fd7e4ec6f 100644 --- a/plugins/unityshell/unityshell.xml.in +++ b/plugins/unityshell/unityshell.xml.in @@ -146,6 +146,26 @@ <_long>Enables possibility to display an overlay showing available mouse and keyboard shortcuts.</_long> <default>true</default> </option> + + <option name="lock_screen_type" type="int"> + <_short>Lockscreen</_short> + <_long>Set how Unity should handle lockscreen.</_long> + <min>0</min> + <max>2</max> + <default>2</default> + <desc> + <value>0</value> + <_name>None</_name> + </desc> + <desc> + <value>1</value> + <_name>Lightdm</_name> + </desc> + <desc> + <value>2</value> + <_name>Unity</_name> + </desc> + </option> </group> <group> |
