From 80722b2de9e24617450c1727b4aa619ca5f8709d Mon Sep 17 00:00:00 2001 From: "sidor@chromium.org" Date: Sat, 10 Sep 2011 07:54:50 +0000 Subject: Fixing the bug, that caused UI to hang after unsupported device was inserted. In the idle.h new synchronous method was added - IsWorkstationInLockedState. BUG=chromium-os:20261 TEST=None Review URL: http://codereview.chromium.org/7864022 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@100582 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/idle_linux.cc | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'chrome/browser/idle_linux.cc') diff --git a/chrome/browser/idle_linux.cc b/chrome/browser/idle_linux.cc index eba7958..dacde8b 100644 --- a/chrome/browser/idle_linux.cc +++ b/chrome/browser/idle_linux.cc @@ -64,16 +64,10 @@ bool ScreensaverWindowExists() { } void CalculateIdleState(unsigned int idle_threshold, IdleCallback notify) { - // Usually the screensaver is used to lock the screen, so we do not need to - // check if the workstation is locked. - gdk_error_trap_push(); - bool result = ScreensaverWindowExists(); - bool got_error = gdk_error_trap_pop(); - if (result && !got_error) { + if (CheckIdleStateIsLocked()) { notify.Run(IDLE_STATE_LOCKED); return; } - browser::IdleQueryLinux idle_query; unsigned int idle_time = idle_query.IdleTime(); if (idle_time >= idle_threshold) @@ -81,3 +75,12 @@ void CalculateIdleState(unsigned int idle_threshold, IdleCallback notify) { else notify.Run(IDLE_STATE_ACTIVE); } + +bool CheckIdleStateIsLocked() { + // Usually the screensaver is used to lock the screen, so we do not need to + // check if the workstation is locked. + gdk_error_trap_push(); + bool result = ScreensaverWindowExists(); + bool got_error = gdk_error_trap_pop(); + return result && !got_error; +} -- cgit v1.1