diff options
-rw-r--r-- | indra/media_plugins/webkit/media_plugin_webkit.cpp | 11 | ||||
-rw-r--r-- | indra/newview/lloverlaybar.cpp | 9 | ||||
-rw-r--r-- | indra/newview/llviewermedia.cpp | 48 | ||||
-rw-r--r-- | indra/newview/llviewermedia.h | 1 | ||||
-rw-r--r-- | indra/newview/llvovolume.cpp | 14 |
5 files changed, 56 insertions, 27 deletions
diff --git a/indra/media_plugins/webkit/media_plugin_webkit.cpp b/indra/media_plugins/webkit/media_plugin_webkit.cpp index 30c7483229..25f4c8720a 100644 --- a/indra/media_plugins/webkit/media_plugin_webkit.cpp +++ b/indra/media_plugins/webkit/media_plugin_webkit.cpp @@ -497,7 +497,16 @@ private: { // std::cerr << "unicode input, code = 0x" << std::hex << (unsigned long)(wstr[i]) << std::dec << std::endl; - LLQtWebKit::getInstance()->unicodeInput(mBrowserWindowId, wstr[i], modifiers); + if(wstr[i] == 32) + { + // For some reason, the webkit plugin really wants the space bar to come in through the key-event path, not the unicode path. + LLQtWebKit::getInstance()->keyEvent( mBrowserWindowId, LLQtWebKit::KE_KEY_DOWN, 32, modifiers); + LLQtWebKit::getInstance()->keyEvent( mBrowserWindowId, LLQtWebKit::KE_KEY_UP, 32, modifiers); + } + else + { + LLQtWebKit::getInstance()->unicodeInput(mBrowserWindowId, wstr[i], modifiers); + } } checkEditState(); diff --git a/indra/newview/lloverlaybar.cpp b/indra/newview/lloverlaybar.cpp index ea24638b6d..67e048885f 100644 --- a/indra/newview/lloverlaybar.cpp +++ b/indra/newview/lloverlaybar.cpp @@ -349,14 +349,8 @@ void LLOverlayBar::toggleMediaPlay(void*) //static void LLOverlayBar::toggleMusicPlay(void*) { - if (!gOverlayBar) - { - return; - } - - if (gOverlayBar->mMusicState != PLAYING) + if (gAudiop->isInternetStreamPlaying() != 1) { - gOverlayBar->mMusicState = PLAYING; // desired state if (gAudiop) { LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); @@ -381,7 +375,6 @@ void LLOverlayBar::toggleMusicPlay(void*) //} else { - gOverlayBar->mMusicState = STOPPED; // desired state if (gAudiop) { gAudiop->stopInternetStream(); diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp index 608c5c2097..d5fd23ac51 100644 --- a/indra/newview/llviewermedia.cpp +++ b/indra/newview/llviewermedia.cpp @@ -1290,16 +1290,36 @@ void LLViewerMediaImpl::mouseMove(S32 x, S32 y, MASK mask) } ////////////////////////////////////////////////////////////////////////////////////////// +//static +void LLViewerMediaImpl::scaleTextureCoords(const LLVector2& texture_coords, S32 *x, S32 *y) +{ + F32 texture_x = texture_coords.mV[VX]; + F32 texture_y = texture_coords.mV[VY]; + + // Deal with repeating textures by wrapping the coordinates into the range [0, 1.0) + texture_x = fmodf(texture_x, 1.0f); + if(texture_x < 0.0f) + texture_x = 1.0 + texture_x; + + texture_y = fmodf(texture_y, 1.0f); + if(texture_y < 0.0f) + texture_y = 1.0 + texture_y; + + // scale x and y to texel units. + *x = llround(texture_x * mMediaSource->getTextureWidth()); + *y = llround((1.0f - texture_y) * mMediaSource->getTextureHeight()); + + // Adjust for the difference between the actual texture height and the amount of the texture in use. + *y -= (mMediaSource->getTextureHeight() - mMediaSource->getHeight()); +} + +////////////////////////////////////////////////////////////////////////////////////////// void LLViewerMediaImpl::mouseDown(const LLVector2& texture_coords, MASK mask, S32 button) { if(mMediaSource) { - // scale x and y to texel units. - S32 x = llround(texture_coords.mV[VX] * mMediaSource->getTextureWidth()); - S32 y = llround((1.0f - texture_coords.mV[VY]) * mMediaSource->getTextureHeight()); - - // Adjust for the difference between the actual texture height and the amount of the texture in use. - y -= (mMediaSource->getTextureHeight() - mMediaSource->getHeight()); + S32 x, y; + scaleTextureCoords(texture_coords, &x, &y); mouseDown(x, y, mask, button); } @@ -1309,12 +1329,8 @@ void LLViewerMediaImpl::mouseUp(const LLVector2& texture_coords, MASK mask, S32 { if(mMediaSource) { - // scale x and y to texel units. - S32 x = llround(texture_coords.mV[VX] * mMediaSource->getTextureWidth()); - S32 y = llround((1.0f - texture_coords.mV[VY]) * mMediaSource->getTextureHeight()); - - // Adjust for the difference between the actual texture height and the amount of the texture in use. - y -= (mMediaSource->getTextureHeight() - mMediaSource->getHeight()); + S32 x, y; + scaleTextureCoords(texture_coords, &x, &y); mouseUp(x, y, mask, button); } @@ -1324,12 +1340,8 @@ void LLViewerMediaImpl::mouseMove(const LLVector2& texture_coords, MASK mask) { if(mMediaSource) { - // scale x and y to texel units. - S32 x = llround(texture_coords.mV[VX] * mMediaSource->getTextureWidth()); - S32 y = llround((1.0f - texture_coords.mV[VY]) * mMediaSource->getTextureHeight()); - - // Adjust for the difference between the actual texture height and the amount of the texture in use. - y -= (mMediaSource->getTextureHeight() - mMediaSource->getHeight()); + S32 x, y; + scaleTextureCoords(texture_coords, &x, &y); mouseMove(x, y, mask); } diff --git a/indra/newview/llviewermedia.h b/indra/newview/llviewermedia.h index ac12112ed4..e2d159304f 100644 --- a/indra/newview/llviewermedia.h +++ b/indra/newview/llviewermedia.h @@ -185,6 +185,7 @@ public: void setHomeURL(const std::string& home_url) { mHomeURL = home_url; }; std::string getMimeType() { return mMimeType; } void scaleMouse(S32 *mouse_x, S32 *mouse_y); + void scaleTextureCoords(const LLVector2& texture_coords, S32 *x, S32 *y); void update(); void updateImagesMediaStreams(); diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 1ee0811ba6..cf61994fea 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -1134,6 +1134,20 @@ void LLVOVolume::regenFaces() facep->setTEOffset(i); facep->setTexture(getTEImage(i)); facep->setViewerObject(this); + + // If the face had media on it, this will have broken the link between the LLViewerMediaTexture and the face. + // Re-establish the link. + if((int)mMediaImplList.size() > i) + { + if(mMediaImplList[i]) + { + LLViewerMediaTexture* media_tex = LLViewerTextureManager::findMediaTexture(mMediaImplList[i]->getMediaTextureID()) ; + if(media_tex) + { + media_tex->addMediaToFace(facep) ; + } + } + } } if (!count_changed) |