зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1221659 - Make fullscreen transition on Linux take the designed time. r=roc
--HG-- extra : source : 6188bec8397bc87d1b3b5820adf66fc424a0bc20
This commit is contained in:
Родитель
95d58839d3
Коммит
de0658cc13
|
@ -10,6 +10,7 @@
|
||||||
#include "mozilla/MiscEvents.h"
|
#include "mozilla/MiscEvents.h"
|
||||||
#include "mozilla/MouseEvents.h"
|
#include "mozilla/MouseEvents.h"
|
||||||
#include "mozilla/TextEvents.h"
|
#include "mozilla/TextEvents.h"
|
||||||
|
#include "mozilla/TimeStamp.h"
|
||||||
#include "mozilla/TouchEvents.h"
|
#include "mozilla/TouchEvents.h"
|
||||||
#include "mozilla/UniquePtrExtensions.h"
|
#include "mozilla/UniquePtrExtensions.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
@ -4911,8 +4912,8 @@ public:
|
||||||
uint16_t aDuration, nsIRunnable* aCallback,
|
uint16_t aDuration, nsIRunnable* aCallback,
|
||||||
FullscreenTransitionWindow* aWindow)
|
FullscreenTransitionWindow* aWindow)
|
||||||
: mStage(aStage)
|
: mStage(aStage)
|
||||||
, mStep(0)
|
, mStartTime(TimeStamp::Now())
|
||||||
, mTotalSteps(aDuration / sInterval)
|
, mDuration(TimeDuration::FromMilliseconds(aDuration))
|
||||||
, mCallback(aCallback)
|
, mCallback(aCallback)
|
||||||
, mWindow(aWindow) { }
|
, mWindow(aWindow) { }
|
||||||
|
|
||||||
|
@ -4921,7 +4922,8 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
nsIWidget::FullscreenTransitionStage mStage;
|
nsIWidget::FullscreenTransitionStage mStage;
|
||||||
uint16_t mStep, mTotalSteps;
|
TimeStamp mStartTime;
|
||||||
|
TimeDuration mDuration;
|
||||||
nsCOMPtr<nsIRunnable> mCallback;
|
nsCOMPtr<nsIRunnable> mCallback;
|
||||||
RefPtr<FullscreenTransitionWindow> mWindow;
|
RefPtr<FullscreenTransitionWindow> mWindow;
|
||||||
};
|
};
|
||||||
|
@ -4929,15 +4931,19 @@ private:
|
||||||
/* static */ gboolean
|
/* static */ gboolean
|
||||||
FullscreenTransitionData::TimeoutCallback(gpointer aData)
|
FullscreenTransitionData::TimeoutCallback(gpointer aData)
|
||||||
{
|
{
|
||||||
|
bool finishing = false;
|
||||||
auto data = static_cast<FullscreenTransitionData*>(aData);
|
auto data = static_cast<FullscreenTransitionData*>(aData);
|
||||||
data->mStep++;
|
gdouble opacity = (TimeStamp::Now() - data->mStartTime) / data->mDuration;
|
||||||
gdouble opacity = data->mStep / gdouble(data->mTotalSteps);
|
if (opacity >= 1.0) {
|
||||||
|
opacity = 1.0;
|
||||||
|
finishing = true;
|
||||||
|
}
|
||||||
if (data->mStage == nsIWidget::eAfterFullscreenToggle) {
|
if (data->mStage == nsIWidget::eAfterFullscreenToggle) {
|
||||||
opacity = 1.0 - opacity;
|
opacity = 1.0 - opacity;
|
||||||
}
|
}
|
||||||
gtk_window_set_opacity(GTK_WINDOW(data->mWindow->mWindow), opacity);
|
gtk_window_set_opacity(GTK_WINDOW(data->mWindow->mWindow), opacity);
|
||||||
|
|
||||||
if (data->mStep != data->mTotalSteps) {
|
if (!finishing) {
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
NS_DispatchToMainThread(data->mCallback.forget());
|
NS_DispatchToMainThread(data->mCallback.forget());
|
||||||
|
|
Загрузка…
Ссылка в новой задаче