diff options
author | avayvod@chromium.org <avayvod@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-30 22:20:45 +0000 |
---|---|---|
committer | avayvod@chromium.org <avayvod@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-30 22:20:45 +0000 |
commit | 8f1f425108ab4325eebe4cd2a899a2b89f36d872 (patch) | |
tree | 24198e23024fd2704e9aa88231891b9abefa94ab | |
parent | bab75a0c160652ed8181fe51e38217cf3425ebcf (diff) | |
download | chromium_src-8f1f425108ab4325eebe4cd2a899a2b89f36d872.zip chromium_src-8f1f425108ab4325eebe4cd2a899a2b89f36d872.tar.gz chromium_src-8f1f425108ab4325eebe4cd2a899a2b89f36d872.tar.bz2 |
Put NULL pixmap on GTK windows for login screen.
BUG=cros:4356
TEST=Verify that no window flickers with white background on initial show of login screen.
Review URL: http://codereview.chromium.org/2813040
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@51301 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/chromeos/login/user_controller.cc | 85 | ||||
-rw-r--r-- | chrome/browser/chromeos/login/user_controller.h | 8 |
2 files changed, 55 insertions, 38 deletions
diff --git a/chrome/browser/chromeos/login/user_controller.cc b/chrome/browser/chromeos/login/user_controller.cc index 9187a2d..41634d8 100644 --- a/chrome/browser/chromeos/login/user_controller.cc +++ b/chrome/browser/chromeos/login/user_controller.cc @@ -39,7 +39,7 @@ const int kUserNameGap = 4; // Approximate height of controls window, this constant is used in new user // case to make border window size close to exsisting users. -const int kControlsHeight = 30; +const int kControlsHeight = 26; // Widget that notifies window manager about clicking on itself. // Doesn't send anything if user is selected. @@ -96,6 +96,7 @@ class UserEntryNativeButton : public views::NativeButton { controller_->FocusPasswordField(); } + private: UserController* controller_; DISALLOW_COPY_AND_ASSIGN(UserEntryNativeButton); @@ -132,6 +133,7 @@ class UserEntryTextfield : public views::Textfield { return views::Textfield::SkipDefaultKeyEventProcessing(e); } + private: UserController* controller_; DISALLOW_COPY_AND_ASSIGN(UserEntryTextfield); @@ -201,10 +203,6 @@ UserController::UserController(Delegate* delegate, UserController::~UserController() { controls_window_->Close(); image_window_->Close(); - user_view_ = NULL; - new_user_view_ = NULL; - label_view_ = NULL; - unselected_label_view_ = NULL; border_window_->Close(); label_window_->Close(); unselected_label_window_->Close(); @@ -309,6 +307,29 @@ void UserController::IsActiveChanged(bool active) { } } +void UserController::ConfigureLoginWindow(WidgetGtk* window, + int index, + const gfx::Rect& bounds, + chromeos::WmIpcWindowType type, + views::View* contents_view) { + window->MakeTransparent(); + window->Init(NULL, bounds); + window->SetContentsView(contents_view); + window->SetWidgetDelegate(this); + + std::vector<int> params; + params.push_back(index); + WmIpc::instance()->SetWindowType( + window->GetNativeView(), + type, + ¶ms); + + GdkWindow* gdk_window = window->GetNativeView()->window; + gdk_window_set_back_pixmap(gdk_window, NULL, false); + + window->Show(); +} + WidgetGtk* UserController::CreateControlsWindow(int index, int* height) { views::View* control_view; if (is_guest_) { @@ -339,21 +360,16 @@ WidgetGtk* UserController::CreateControlsWindow(int index, int* height) { layout->AddView(submit_button_); } + *height = kControlsHeight; + if (is_guest_) + *height += kUserImageSize + kUserNameGap; + WidgetGtk* window = new WidgetGtk(WidgetGtk::TYPE_WINDOW); - window->MakeTransparent(); - window->Init(NULL, gfx::Rect()); - window->SetContentsView(control_view); - window->SetWidgetDelegate(this); - std::vector<int> params; - params.push_back(index); - WmIpc::instance()->SetWindowType( - window->GetNativeView(), - WM_IPC_WINDOW_LOGIN_CONTROLS, - ¶ms); - *height = is_guest_ ? kUserImageSize + kControlsHeight - : control_view->GetPreferredSize().height(); - window->SetBounds(gfx::Rect(0, 0, kUserImageSize, *height)); - window->Show(); + ConfigureLoginWindow(window, + index, + gfx::Rect(kUserImageSize, *height), + WM_IPC_WINDOW_LOGIN_CONTROLS, + control_view); return window; } @@ -368,16 +384,11 @@ WidgetGtk* UserController::CreateImageWindow(int index) { } WidgetGtk* window = new ClickNotifyingWidget(WidgetGtk::TYPE_WINDOW, this); - window->Init(NULL, gfx::Rect(user_view_->GetPreferredSize())); - window->SetContentsView(user_view_); - - std::vector<int> params; - params.push_back(index); - WmIpc::instance()->SetWindowType( - window->GetNativeView(), - WM_IPC_WINDOW_LOGIN_IMAGE, - ¶ms); - window->Show(); + ConfigureLoginWindow(window, + index, + gfx::Rect(user_view_->GetPreferredSize()), + WM_IPC_WINDOW_LOGIN_IMAGE, + user_view_); return window; } @@ -396,6 +407,9 @@ void UserController::CreateBorderWindow(int index, views::Background::CreateSolidBackground(kBackgroundColor)); UpdateUserCount(index, total_user_count); + GdkWindow* gdk_window = border_window_->GetNativeView()->window; + gdk_window_set_back_pixmap(gdk_window, NULL, false); + border_window_->Show(); } @@ -432,14 +446,11 @@ WidgetGtk* UserController::CreateLabelWindow(int index, kUserImageSize : kUnselectedSize; int height = label->GetPreferredSize().height(); WidgetGtk* window = new ClickNotifyingWidget(WidgetGtk::TYPE_WINDOW, this); - window->MakeTransparent(); - window->Init(NULL, gfx::Rect(0, 0, width, height)); - window->SetContentsView(label); - - std::vector<int> params; - params.push_back(index); - WmIpc::instance()->SetWindowType(window->GetNativeView(), type, ¶ms); - window->Show(); + ConfigureLoginWindow(window, + index, + gfx::Rect(0, 0, width, height), + type, + label); return window; } diff --git a/chrome/browser/chromeos/login/user_controller.h b/chrome/browser/chromeos/login/user_controller.h index f6c9ccf..d702fcdc 100644 --- a/chrome/browser/chromeos/login/user_controller.h +++ b/chrome/browser/chromeos/login/user_controller.h @@ -139,6 +139,12 @@ class UserController : public views::ButtonListener, // Invoked when the user wants to login. Forwards the call to the delegate. void Login(); + // Performs common setup for login windows. + void ConfigureLoginWindow(views::WidgetGtk* window, + int index, + const gfx::Rect& bounds, + chromeos::WmIpcWindowType type, + views::View* contents_view); views::WidgetGtk* CreateControlsWindow(int index, int* height); views::WidgetGtk* CreateImageWindow(int index); views::WidgetGtk* CreateLabelWindow(int index, WmIpcWindowType type); @@ -187,7 +193,7 @@ class UserController : public views::ButtonListener, // View that shows user image on image window. UserView* user_view_; - // View that that is used for new user login. + // View that is used for new user login. NewUserView* new_user_view_; // Views that show display name of the user. |