diff options
| -rw-r--r-- | lockscreen/KylinLockScreenShield.cpp | 38 | ||||
| -rw-r--r-- | lockscreen/KylinLockScreenShield.h | 6 | ||||
| -rw-r--r-- | lockscreen/KylinUserPromptView.cpp | 40 | ||||
| -rw-r--r-- | lockscreen/KylinUserPromptView.h | 7 | ||||
| -rw-r--r-- | resources/login.png | bin | 1807 -> 1576 bytes | |||
| -rw-r--r-- | unity-shared/TextInput.cpp | 8 |
6 files changed, 29 insertions, 70 deletions
diff --git a/lockscreen/KylinLockScreenShield.cpp b/lockscreen/KylinLockScreenShield.cpp index baea23c7b..0108fb862 100644 --- a/lockscreen/KylinLockScreenShield.cpp +++ b/lockscreen/KylinLockScreenShield.cpp @@ -27,7 +27,6 @@ #include "CofView.h" #include "LockScreenPanel.h" #include "LockScreenSettings.h" -//#include "UserPromptView.h" #include "KylinUserPromptView.h" #include "unity-shared/UScreen.h" #include "unity-shared/UnitySettings.h" @@ -48,7 +47,6 @@ KylinShield::KylinShield(session::Manager::Ptr const& session_manager, int monitor_num, bool is_primary) : AbstractShield(session_manager, nullptr, accelerators, prompt_view, monitor_num, is_primary) , bg_settings_(std::make_shared<BackgroundSettings>()) - , panel_view_(nullptr) , cof_view_(nullptr) { UpdateScale(); @@ -59,19 +57,14 @@ KylinShield::KylinShield(session::Manager::Ptr const& session_manager, unity::Settings::Instance().dpi_changed.connect(sigc::mem_fun(this, &KylinShield::UpdateScale)); geometry_changed.connect([this] (nux::Area*, nux::Geometry&) { UpdateBackgroundTexture();}); - monitor.changed.connect([this] (int monitor) { + monitor.changed.connect([this] (int) { UpdateScale(); - - if (panel_view_) - panel_view_->monitor = monitor; - UpdateBackgroundTexture(); }); primary.changed.connect([this] (bool is_primary) { regrab_conn_->disconnect(); is_primary ? ShowPrimaryView() : ShowSecondaryView(); - if (panel_view_) panel_view_->SetInputEventSensitivity(is_primary); QueueRelayout(); QueueDraw(); }); @@ -152,7 +145,6 @@ void KylinShield::ShowPrimaryView() { prompt_view_->scale = scale(); prompt_layout_->AddView(prompt_view_.GetPointer()); - prompt_layout_->AddSpace(0, 10); } GrabScreen(false); @@ -170,13 +162,12 @@ void KylinShield::ShowPrimaryView() if (prompt_view_) { prompt_view_->scale = scale(); - prompt_layout_->AddSpace(0, 10); prompt_layout_->AddView(prompt_view_.GetPointer()); } // 10 is just a random number to center the prompt view. main_layout->AddSpace(0, 10); - main_layout->AddLayout(prompt_layout_.GetPointer()); + main_layout->AddLayout(prompt_layout_.GetPointer(), 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FIX); main_layout->AddSpace(0, 10); } @@ -207,20 +198,6 @@ nux::Area* KylinShield::FindKeyFocusArea(unsigned etype, unsigned long keysym, u { grab_key.emit(modifiers, keysym); - if (accelerators_) - { - if (etype == nux::EVENT_KEY_DOWN) - { - if (accelerators_->HandleKeyPress(keysym, modifiers)) - return panel_view_; - } - else if (etype == nux::EVENT_KEY_UP) - { - if (accelerators_->HandleKeyRelease(keysym, modifiers)) - return panel_view_; - } - } - if (prompt_view_) { auto* focus_view = prompt_view_->focus_view(); @@ -248,16 +225,5 @@ nux::Area* KylinShield::FindAreaUnderMouse(nux::Point const& mouse, nux::NuxEven return area; } -bool KylinShield::IsIndicatorOpen() const -{ - return panel_view_ ? panel_view_->active() : false; -} - -void KylinShield::ActivatePanel() -{ - if (panel_view_) - panel_view_->ActivatePanel(); -} - } } diff --git a/lockscreen/KylinLockScreenShield.h b/lockscreen/KylinLockScreenShield.h index b588e640e..cd18c1ef3 100644 --- a/lockscreen/KylinLockScreenShield.h +++ b/lockscreen/KylinLockScreenShield.h @@ -32,7 +32,6 @@ namespace lockscreen class BackgroundSettings; class UserAuthenticator; class AbstractUserPromptView; -class Panel; class CofView; class KylinShield : public AbstractShield @@ -44,8 +43,8 @@ public: int monitor, bool is_primary); bool HasGrab() const override; - bool IsIndicatorOpen() const override; - void ActivatePanel() override; + bool IsIndicatorOpen() const override { return false;} + void ActivatePanel() override {} protected: bool AcceptKeyNavFocus() override; @@ -67,7 +66,6 @@ private: connection::Wrapper panel_active_conn_; connection::Wrapper regrab_conn_; glib::Source::UniquePtr regrab_timeout_; - Panel* panel_view_; CofView* cof_view_; }; diff --git a/lockscreen/KylinUserPromptView.cpp b/lockscreen/KylinUserPromptView.cpp index 97fc834dc..ecdd15f22 100644 --- a/lockscreen/KylinUserPromptView.cpp +++ b/lockscreen/KylinUserPromptView.cpp @@ -43,15 +43,15 @@ namespace lockscreen { namespace { -const RawPixel PADDING = 10_em; -const RawPixel LAYOUT_MARGIN = 20_em; -const RawPixel MSG_LAYOUT_MARGIN = 15_em; -const RawPixel PROMPT_LAYOUT_MARGIN = 5_em; -const RawPixel SWITCH_ICON_HEIGHT = 32_em; -const RawPixel SWITCH_ICON_WIDTH = 100_em; -const RawPixel AVATAR_SIZE = 128_em; -const RawPixel TEXT_INPUT_HEIGHT = 36_em; -const RawPixel TEXT_INPUT_WIDTH = 320_em; +const RawPixel LAYOUT_MARGIN = 20_em; +const RawPixel MSG_LAYOUT_MARGIN = 15_em; +const RawPixel MSG_LAYOUT_PADDING = 33_em; +const RawPixel PROMPT_LAYOUT_MARGIN = 5_em; +const RawPixel SWITCH_ICON_HEIGHT = 32_em; +const RawPixel SWITCH_ICON_WIDTH = 100_em; +const RawPixel AVATAR_SIZE = 128_em; +const RawPixel TEXT_INPUT_HEIGHT = 36_em; +const RawPixel TEXT_INPUT_WIDTH = 320_em; const int PROMPT_FONT_SIZE = 14; std::string SanitizeMessage(std::string const& message) @@ -82,6 +82,8 @@ KylinUserPromptView::KylinUserPromptView(session::Manager::Ptr const& session_ma , username_(nullptr) , msg_layout_(nullptr) , prompt_layout_(nullptr) + , SwitchIcon_(nullptr) + , Avatar_(nullptr) { user_authenticator_.echo_on_requested.connect([this](std::string const& message, PromiseAuthCodePtr const& promise){ AddPrompt(message, true, promise); @@ -125,18 +127,18 @@ void KylinUserPromptView::ResetLayout() nux::Layout* switch_layout = new nux::HLayout(); TextureCache& cache = TextureCache::GetDefault(); - SwitchIcon_ = new IconTexture(cache.FindTexture("switch_user.png", SWITCH_ICON_WIDTH, SWITCH_ICON_HEIGHT)); + SwitchIcon_ = new IconTexture(cache.FindTexture("switch_user.png", SWITCH_ICON_WIDTH.CP(scale), SWITCH_ICON_HEIGHT.CP(scale))); switch_layout->AddView(SwitchIcon_); SwitchIcon_->mouse_click.connect([this](int x, int y, unsigned long button_flags, unsigned long key_flags) { session_manager_->SwitchToGreeter(); }); - switch_layout->SetMaximumSize(SWITCH_ICON_WIDTH, SWITCH_ICON_HEIGHT); + switch_layout->SetMaximumSize(SWITCH_ICON_WIDTH.CP(scale), SWITCH_ICON_HEIGHT.CP(scale)); GetLayout()->AddLayout(switch_layout); } - Avatar_ = new IconTexture(LoadUserIcon(AVATAR_SIZE)); - Avatar_->SetMinimumWidth(AVATAR_SIZE); - Avatar_->SetMaximumWidth(AVATAR_SIZE); + Avatar_ = new IconTexture(LoadUserIcon(AVATAR_SIZE.CP(scale))); + Avatar_->SetMinimumWidth(AVATAR_SIZE.CP(scale)); + Avatar_->SetMaximumWidth(AVATAR_SIZE.CP(scale)); GetLayout()->AddView(Avatar_); nux::Layout* prompt_layout = new nux::VLayout(); @@ -151,7 +153,7 @@ void KylinUserPromptView::ResetLayout() msg_layout_ = new nux::VLayout(); msg_layout_->SetVerticalInternalMargin(MSG_LAYOUT_MARGIN.CP(scale)); - msg_layout_->SetTopAndBottomPadding(33, 0); + msg_layout_->SetTopAndBottomPadding(MSG_LAYOUT_PADDING.CP(scale), 0); prompt_layout->AddLayout(msg_layout_); prompt_layout_ = new nux::VLayout(); @@ -172,12 +174,6 @@ void KylinUserPromptView::UpdateSize() SetMaximumWidth(width); SetMinimumHeight(height); - if (nux::Layout* layout = GetLayout()) - { - layout->SetLeftAndRightPadding(PADDING.CP(scale)); - layout->SetTopAndBottomPadding(PADDING.CP(scale)); - } - if (username_) username_->SetScale(scale); @@ -347,7 +343,7 @@ void KylinUserPromptView::AddMessage(std::string const& message, nux::Color cons QueueDraw(); } -nux::ObjectPtr<nux::BaseTexture> KylinUserPromptView::LoadUserIcon(const RawPixel user_icon_size) +nux::ObjectPtr<nux::BaseTexture> KylinUserPromptView::LoadUserIcon(int user_icon_size) { glib::Error error; glib::Object<GdkPixbuf> pixbuf(gdk_pixbuf_new_from_file_at_size(session_manager_->UserIconFile().c_str(), user_icon_size, user_icon_size, &error)); diff --git a/lockscreen/KylinUserPromptView.h b/lockscreen/KylinUserPromptView.h index c3e917c68..c02bd0670 100644 --- a/lockscreen/KylinUserPromptView.h +++ b/lockscreen/KylinUserPromptView.h @@ -58,7 +58,7 @@ protected: void ResetLayout(); void UpdateSize(); bool InspectKeyEvent(unsigned int eventType, unsigned int key_sym, const char* character); - nux::ObjectPtr<nux::BaseTexture> LoadUserIcon(const RawPixel icon_size); + nux::ObjectPtr<nux::BaseTexture> LoadUserIcon(int icon_size); private: session::Manager::Ptr session_manager_; @@ -67,11 +67,10 @@ private: nux::VLayout* msg_layout_; nux::VLayout* prompt_layout_; std::deque<TextInput*> focus_queue_; - - nux::Geometry cached_focused_geo_; - IconTexture* SwitchIcon_; IconTexture* Avatar_; + + nux::Geometry cached_focused_geo_; }; } diff --git a/resources/login.png b/resources/login.png Binary files differindex 57bf24a41..c845a49db 100644 --- a/resources/login.png +++ b/resources/login.png diff --git a/unity-shared/TextInput.cpp b/unity-shared/TextInput.cpp index 82f416a39..70d16ae32 100644 --- a/unity-shared/TextInput.cpp +++ b/unity-shared/TextInput.cpp @@ -54,8 +54,8 @@ const RawPixel TOOLTIP_Y_OFFSET = 3_em; const RawPixel TOOLTIP_OFFSET = 10_em; const RawPixel DEFAULT_ICON_SIZE = 22_em; -const RawPixel LOGIN_ICON_WIDTH = 32_em; -const RawPixel LOGIN_ICON_HEIGHT = 62_em; +const RawPixel LOGIN_ICON_WIDTH = 62_em; +const RawPixel LOGIN_ICON_HEIGHT = 36_em; std::string WARNING_ICON = "dialog-warning-symbolic"; // Fonts @@ -272,12 +272,12 @@ nux::ObjectPtr<nux::BaseTexture> TextInput::LoadActivatorIcon(int icon_size) nux::CairoGraphics cg(CAIRO_FORMAT_ARGB32, gdk_pixbuf_get_width(pixbuf), gdk_pixbuf_get_height(pixbuf)); cairo_t* cr = cg.GetInternalContext(); cairo_text_extents_t et; - const std::string login = _("login"); + const std::string login = _("Login"); double x, y; gdk_cairo_set_source_pixbuf(cr, pixbuf, 0, 0); cairo_paint(cr); - cairo_select_font_face(cr, "Sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD); + cairo_select_font_face(cr, "Ubuntu", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD); cairo_set_font_size(cr, 18); cairo_set_source_rgba(cr, 1.0f, 1.0f, 1.0f, 1.0f); |
