webengine/osswebengine/WebKit/s60/webview/WebPageFullScreenHandler.cpp
branchRCL_3
changeset 94 919f36ff910f
parent 93 79859ed3eea9
--- a/webengine/osswebengine/WebKit/s60/webview/WebPageFullScreenHandler.cpp	Tue Aug 31 16:17:46 2010 +0300
+++ b/webengine/osswebengine/WebKit/s60/webview/WebPageFullScreenHandler.cpp	Wed Sep 01 12:28:30 2010 +0100
@@ -18,8 +18,8 @@
 
 // INCLUDE FILES
 #include <../bidi.h>
-#include <aknappui.h>
-#include <AknUtils.h>
+#include <aknAppUi.h>
+#include <aknutils.h>
 #include "StaticObjectsContainer.h"
 #include "WebCannedImages.h"
 #include "WebPageFullScreenHandler.h"
@@ -28,9 +28,8 @@
 
 using namespace WebCore;
 
-const int KFullScreenButtonHeight = 60;
-const int KFullScreenButtonWidth = 60;
-const int KFullScreenButtonBuff  = 5;
+const int KFullScreenButtonOffset = 50;
+const int KFullScreenButtonBuff  = 15;
 
 // -----------------------------------------------------------------------------
 // WebPageFullScreenHandler::NewL
@@ -66,6 +65,9 @@
     m_buttonIcon = StaticObjectsContainer::instance()->webCannedImages()->getImage(WebCannedImages::EImageEscFullScreen);
     TPoint pos = CalculatePosition();
     BaseConstructL(m_webView, pos, m_buttonIcon.m_img, m_buttonIcon.m_msk, ETrue);
+     if (AknLayoutUtils::PenEnabled()) {
+         DrawableWindow()->SetPointerGrab(ETrue);
+     }
     Hide();   
 }
 
@@ -89,6 +91,13 @@
     return pos;
 }
 
+TSize WebPageFullScreenHandler::CalculateSize()
+{
+    TSize size = m_buttonIcon.m_img->SizeInPixels();
+    size += TSize(KFullScreenButtonBuff, KFullScreenButtonBuff);
+    return size;
+}
+
 //-------------------------------------------------------------------------------
 // WebPageFullScreenHandler::showEscBtnL
 // Draws the full screen button on the screen
@@ -123,6 +132,8 @@
     if (AknLayoutUtils::PenEnabled()) {
         TPoint pos = CalculatePosition();
         SetPos(pos);
+        TSize size = CalculateSize();
+        SetSizeWithoutNotification(size);
     }
 }
 
@@ -147,11 +158,18 @@
 
        case TPointerEvent::EButton1Up:
            {
-           if (m_isTouchDown) {
-               Hide();
-               m_webView->notifyFullscreenModeChangeL( false );
-           }
-           m_isTouchDown = EFalse;
+           	TPoint fsPostion = PositionRelativeToScreen();
+            TRect fsRect = TRect(fsPostion,Size());
+            fsRect = TRect(fsRect.iTl - TPoint(KFullScreenButtonOffset,KFullScreenButtonOffset), fsRect.iBr);
+           	TPoint pointerPosition = fsPostion + aPointerEvent.iPosition;
+           	if( fsRect.Contains(pointerPosition))
+           	{
+             if (m_isTouchDown) {
+                  Hide();
+                  m_webView->notifyFullscreenModeChangeL( false );
+               }
+               m_isTouchDown = EFalse;
+            }
            }
            break;          
         }