mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
bug 610834 - New windows opened don't get painted until resized r=fabrice
This commit is contained in:
parent
7f56a280da
commit
64fdb76ac2
@ -384,12 +384,6 @@ var Browser = {
|
|||||||
let event = document.createEvent("Events");
|
let event = document.createEvent("Events");
|
||||||
event.initEvent("UIReady", true, false);
|
event.initEvent("UIReady", true, false);
|
||||||
window.dispatchEvent(event);
|
window.dispatchEvent(event);
|
||||||
|
|
||||||
// If we have an opener this was not the first window opened and will not
|
|
||||||
// receive an initial resize event. instead we fire the resize handler manually
|
|
||||||
// Bug 610834
|
|
||||||
if (window.opener)
|
|
||||||
resizeHandler({ target: window });
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_alertShown: function _alertShown() {
|
_alertShown: function _alertShown() {
|
||||||
|
@ -457,6 +457,19 @@ AndroidGeckoEvent::Init(int x1, int y1, int x2, int y2)
|
|||||||
mRect.SetEmpty();
|
mRect.SetEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
AndroidGeckoEvent::Init(AndroidGeckoEvent *aResizeEvent)
|
||||||
|
{
|
||||||
|
NS_ASSERTION(aResizeEvent->Type() == SIZE_CHANGED, "Init called on non-SIZE_CHANGED event");
|
||||||
|
|
||||||
|
mType = FORCED_RESIZE;
|
||||||
|
mTime = aResizeEvent->mTime;
|
||||||
|
mP0.x = aResizeEvent->mP0.x;
|
||||||
|
mP0.y = aResizeEvent->mP0.y;
|
||||||
|
mP1.x = aResizeEvent->mP1.x;
|
||||||
|
mP1.y = aResizeEvent->mP1.y;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
AndroidGeckoSurfaceView::Init(jobject jobj)
|
AndroidGeckoSurfaceView::Init(jobject jobj)
|
||||||
{
|
{
|
||||||
|
@ -386,10 +386,14 @@ public:
|
|||||||
AndroidGeckoEvent(JNIEnv *jenv, jobject jobj) {
|
AndroidGeckoEvent(JNIEnv *jenv, jobject jobj) {
|
||||||
Init(jenv, jobj);
|
Init(jenv, jobj);
|
||||||
}
|
}
|
||||||
|
AndroidGeckoEvent(AndroidGeckoEvent *aResizeEvent) {
|
||||||
|
Init(aResizeEvent);
|
||||||
|
}
|
||||||
|
|
||||||
void Init(JNIEnv *jenv, jobject jobj);
|
void Init(JNIEnv *jenv, jobject jobj);
|
||||||
void Init(int aType);
|
void Init(int aType);
|
||||||
void Init(int x1, int y1, int x2, int y2);
|
void Init(int x1, int y1, int x2, int y2);
|
||||||
|
void Init(AndroidGeckoEvent *aResizeEvent);
|
||||||
|
|
||||||
int Action() { return mAction; }
|
int Action() { return mAction; }
|
||||||
int Type() { return mType; }
|
int Type() { return mType; }
|
||||||
@ -487,6 +491,7 @@ public:
|
|||||||
SURFACE_CREATED = 13,
|
SURFACE_CREATED = 13,
|
||||||
SURFACE_DESTROYED = 14,
|
SURFACE_DESTROYED = 14,
|
||||||
GECKO_EVENT_SYNC = 15,
|
GECKO_EVENT_SYNC = 15,
|
||||||
|
FORCED_RESIZE = 16,
|
||||||
dummy_java_enum_list_end
|
dummy_java_enum_list_end
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -74,6 +74,7 @@ PRLogModuleInfo *gWidgetLog = nsnull;
|
|||||||
|
|
||||||
nsDeviceMotionSystem *gDeviceMotionSystem = nsnull;
|
nsDeviceMotionSystem *gDeviceMotionSystem = nsnull;
|
||||||
nsIGeolocationUpdate *gLocationCallback = nsnull;
|
nsIGeolocationUpdate *gLocationCallback = nsnull;
|
||||||
|
nsAutoPtr<mozilla::AndroidGeckoEvent> gLastSizeChange;
|
||||||
|
|
||||||
nsAppShell *nsAppShell::gAppShell = nsnull;
|
nsAppShell *nsAppShell::gAppShell = nsnull;
|
||||||
|
|
||||||
@ -380,6 +381,15 @@ nsAppShell::ProcessNextNativeEvent(PRBool mayWait)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case AndroidGeckoEvent::SIZE_CHANGED: {
|
||||||
|
// store the last resize event to dispatch it to new windows with a FORCED_RESIZE event
|
||||||
|
if (curEvent != gLastSizeChange) {
|
||||||
|
gLastSizeChange = new AndroidGeckoEvent(curEvent);
|
||||||
|
}
|
||||||
|
nsWindow::OnGlobalAndroidEvent(curEvent);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
nsWindow::OnGlobalAndroidEvent(curEvent);
|
nsWindow::OnGlobalAndroidEvent(curEvent);
|
||||||
}
|
}
|
||||||
@ -389,6 +399,13 @@ nsAppShell::ProcessNextNativeEvent(PRBool mayWait)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
nsAppShell::ResendLastResizeEvent(nsWindow* aDest) {
|
||||||
|
if (gLastSizeChange) {
|
||||||
|
nsWindow::OnGlobalAndroidEvent(gLastSizeChange);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
AndroidGeckoEvent*
|
AndroidGeckoEvent*
|
||||||
nsAppShell::GetNextEvent()
|
nsAppShell::GetNextEvent()
|
||||||
{
|
{
|
||||||
|
@ -52,6 +52,8 @@ bool ProcessNextEvent();
|
|||||||
void NotifyEvent();
|
void NotifyEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class nsWindow;
|
||||||
|
|
||||||
class nsAppShell :
|
class nsAppShell :
|
||||||
public nsBaseAppShell
|
public nsBaseAppShell
|
||||||
{
|
{
|
||||||
@ -81,6 +83,7 @@ public:
|
|||||||
void CallObserver(const nsAString &aObserverKey, const nsAString &aTopic, const nsAString &aData);
|
void CallObserver(const nsAString &aObserverKey, const nsAString &aTopic, const nsAString &aData);
|
||||||
void RemoveObserver(const nsAString &aObserverKey);
|
void RemoveObserver(const nsAString &aObserverKey);
|
||||||
void NotifyObservers(nsISupports *aSupports, const char *aTopic, const PRUnichar *aData);
|
void NotifyObservers(nsISupports *aSupports, const char *aTopic, const PRUnichar *aData);
|
||||||
|
void ResendLastResizeEvent(nsWindow* aDest);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void ScheduleNativeEventCallback();
|
virtual void ScheduleNativeEventCallback();
|
||||||
|
@ -448,14 +448,6 @@ nsWindow::Resize(PRInt32 aX,
|
|||||||
|
|
||||||
PRBool needSizeDispatch = aWidth != mBounds.width || aHeight != mBounds.height;
|
PRBool needSizeDispatch = aWidth != mBounds.width || aHeight != mBounds.height;
|
||||||
|
|
||||||
if (IsTopLevel()) {
|
|
||||||
ALOG("... ignoring Resize sizes on toplevel window");
|
|
||||||
aX = 0;
|
|
||||||
aY = 0;
|
|
||||||
aWidth = gAndroidBounds.width;
|
|
||||||
aHeight = gAndroidBounds.height;
|
|
||||||
}
|
|
||||||
|
|
||||||
mBounds.x = aX;
|
mBounds.x = aX;
|
||||||
mBounds.y = aY;
|
mBounds.y = aY;
|
||||||
mBounds.width = aWidth;
|
mBounds.width = aWidth;
|
||||||
@ -586,6 +578,8 @@ nsWindow::BringToFront()
|
|||||||
nsGUIEvent event(PR_TRUE, NS_ACTIVATE, this);
|
nsGUIEvent event(PR_TRUE, NS_ACTIVATE, this);
|
||||||
DispatchEvent(&event);
|
DispatchEvent(&event);
|
||||||
|
|
||||||
|
// force a window resize
|
||||||
|
nsAppShell::gAppShell->ResendLastResizeEvent(this);
|
||||||
nsAppShell::gAppShell->PostEvent(new AndroidGeckoEvent(-1, -1, -1, -1));
|
nsAppShell::gAppShell->PostEvent(new AndroidGeckoEvent(-1, -1, -1, -1));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -738,11 +732,19 @@ nsWindow::OnGlobalAndroidEvent(AndroidGeckoEvent *ae)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
switch (ae->Type()) {
|
switch (ae->Type()) {
|
||||||
|
case AndroidGeckoEvent::FORCED_RESIZE:
|
||||||
|
win->mBounds.width = 0;
|
||||||
|
win->mBounds.height = 0;
|
||||||
|
// also resize the children
|
||||||
|
for (PRUint32 i = 0; i < win->mChildren.Length(); i++) {
|
||||||
|
win->mChildren[i]->mBounds.width = 0;
|
||||||
|
win->mChildren[i]->mBounds.height = 0;
|
||||||
|
}
|
||||||
case AndroidGeckoEvent::SIZE_CHANGED: {
|
case AndroidGeckoEvent::SIZE_CHANGED: {
|
||||||
int nw = ae->P0().x;
|
int nw = ae->P0().x;
|
||||||
int nh = ae->P0().y;
|
int nh = ae->P0().y;
|
||||||
|
|
||||||
if (nw != gAndroidBounds.width ||
|
if (ae->Type() == AndroidGeckoEvent::FORCED_RESIZE || nw != gAndroidBounds.width ||
|
||||||
nh != gAndroidBounds.height) {
|
nh != gAndroidBounds.height) {
|
||||||
|
|
||||||
gAndroidBounds.width = nw;
|
gAndroidBounds.width = nw;
|
||||||
|
Loading…
Reference in New Issue
Block a user