⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 winsite.cpp

📁 linux下的一款播放器
💻 CPP
📖 第 1 页 / 共 5 页
字号:
            // If we are in overlay mode, we need a SiteMoving to            // update the overaly's location - a repaint will not            // help us here.  Proxy a MOVE message to the main app thread.            if (m_pVideoSurface->m_nBltMode == HX_OVERLAY_BLT)                m_pTopLevelSite->ScheduleCallback(MOVE, 0);            else            {                m_pTopLevelSite->ScheduleCallback(REPAINT, 0);                m_bRepaintScheduled = TRUE;            }        }    }    else    {        if (message == WM_MOVE)        {            _TLSLock();            /*             * Site moving used to take an X, Y parameter, but since we changed it to             * go to GDI mode, that is no longer relevant.             */            m_pTopLevelSite->SiteMoving(0, 0);            m_pTopLevelSite->m_nLastMoveTime = HX_GET_TICKCOUNT();            m_pTopLevelSite->ScheduleCallback(MOUSE, 100);            _TLSUnlock();        }    }    Release();    return;}BOOLCHXWinSite::HandleWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, LRESULT& lResult){    //Give the event to windraw, we may be in 8 bit mode, and it will    //want to know about it.    if (m_pRootSurface)    {        WINDRAW* pWindraw;        pWindraw = ((CWinBaseRootSurface*)m_pRootSurface)->GetWinDraw();        WinDraw2_OnPaletteChange(pWindraw, hWnd, message);    }    //Before we do anything we give the native event to the renderer.    HXxEvent     event = {0,0,0,0,0,0};    AddRef();    BOOL retValue = FALSE;    if (m_pUser)    {        HXxEvent event = {message, (void*)hWnd, (void*)wParam, (void*)lParam, 0, 0};        if (message == WM_DESTROY && m_bDetachWndMsgPending && m_pUser)        {            m_bDetachWndMsgPending = FALSE;            event.event   = HX_DETACH_WINDOW;            if (HXR_OK == m_pUser->HandleEvent(&event))            {                lResult = (LRESULT)event.result;            }            event.event  = WM_DESTROY;        }        if (!event.handled && m_pUser)        {            m_pUser->HandleEvent(&event);        }        if (event.handled)        {            retValue = TRUE;            goto leave;        }        //This is an iffy decision. It could go either way. This does        //not fix any bug that I am aware of, and may create others so        //perhaps it should not go in.  The idea is that if the        //renderer needs windowed sites, then we should not do any        //further processing on the message. Don't know if this would        //be a good thing.        if (m_pUser && m_pUser->NeedsWindowedSites())        {            //retValue = FALSE;            //goto leave;        }    }    // Was this a scroll message? If so we need to process it here.    if (message == WM_HSCROLL || message == WM_VSCROLL )    {        CHXWinSite* pParent;        void* hwndScrollBar = (void*) lParam;        if (zm_ScrollBarWnds.Lookup(hwndScrollBar, (void*&)pParent))        {            int nScrollCode = (int) LOWORD(wParam); // scroll bar value            int nPos = (int) HIWORD(wParam);   // scroll box position            BOOL bNeedRedraw = FALSE;            SCROLLINFO info;            memset(&info, 0, sizeof(SCROLLINFO));            info.cbSize = sizeof(SCROLLINFO);            info.fMask     = SIF_POS;            info.nPos      = nPos;            HXxSize size;            HXxRect rect;            pParent->GetWindowRect(&rect);            size.cx = rect.right - rect.left;            size.cy = rect.bottom - rect.top;            if (SB_THUMBPOSITION == nScrollCode || SB_THUMBTRACK == nScrollCode)            {                SetScrollInfo((HWND)hwndScrollBar, SB_CTL, &info, FALSE);                /* !(*&*(@ Shitty code becuase GetScrollInfo seems to be causing deadlocks. */                if (message == WM_HSCROLL)                {                    pParent->m_XSliderPos = nPos;                }                else                {                    pParent->m_YSliderPos = nPos;                }                bNeedRedraw = TRUE;            }            if (SB_LINEUP == nScrollCode)            {                if (message == WM_HSCROLL)                {                    if (pParent->m_XSliderPos) pParent->m_XSliderPos--;                    info.nPos = pParent->m_XSliderPos;                }                else                {                    if (pParent->m_YSliderPos) pParent->m_YSliderPos--;                    info.nPos = pParent->m_YSliderPos;                }                SetScrollInfo((HWND)hwndScrollBar, SB_CTL, &info, TRUE);                bNeedRedraw = TRUE;            }            if (SB_LINEDOWN == nScrollCode)            {                if (message == WM_HSCROLL)                {                    if (pParent->m_XSliderPos < (pParent->m_XSliderRange - size.cx) ) pParent->m_XSliderPos++;                    info.nPos = pParent->m_XSliderPos;                }                else                {                    if (pParent->m_YSliderPos < (pParent->m_YSliderRange - size.cy) ) pParent->m_YSliderPos++;                    info.nPos = pParent->m_YSliderPos;                }                SetScrollInfo((HWND)hwndScrollBar, SB_CTL, &info, TRUE);                bNeedRedraw = TRUE;            }            if (SB_PAGEUP == nScrollCode)            {                if (message == WM_HSCROLL)                {                    pParent->m_XSliderPos -= size.cx;                    if (pParent->m_XSliderPos < 0)                    {                        pParent->m_XSliderPos = 0;                    }                    info.nPos = pParent->m_XSliderPos;                }                else                {                    pParent->m_YSliderPos -= size.cy;                    if (pParent->m_YSliderPos < 0)                    {                        pParent->m_YSliderPos = 0;                    }                    info.nPos = pParent->m_YSliderPos;                }                SetScrollInfo((HWND)hwndScrollBar, SB_CTL, &info, TRUE);                bNeedRedraw = TRUE;            }            if (SB_PAGEDOWN == nScrollCode)            {                if (message == WM_HSCROLL)                {                    pParent->m_XSliderPos += size.cx;                    if (pParent->m_XSliderPos > pParent->m_XSliderRange - size.cx)                    {                        pParent->m_XSliderPos = pParent->m_XSliderRange - size.cx;                    }                    info.nPos = pParent->m_XSliderPos;                }                else                {                    pParent->m_YSliderPos += size.cy;                    if (pParent->m_YSliderPos > pParent->m_YSliderRange - size.cy)                    {                        pParent->m_YSliderPos = pParent->m_YSliderRange - size.cy;                    }                    info.nPos = pParent->m_YSliderPos;                }                SetScrollInfo((HWND)hwndScrollBar, SB_CTL, &info, TRUE);                bNeedRedraw = TRUE;            }            if (bNeedRedraw)            {		//We have scrolled by at least one line. This invalidates the		//whole rect.		HXxRect pTmp = { pParent->m_topleft.x,			pParent->m_topleft.y,			pParent->m_topleft.x + pParent->m_size.cx,			pParent->m_topleft.y + pParent->m_size.cy };		m_pTopLevelSite->_RecursiveDamageRect(&pTmp, TRUE);		pParent->InternalForceRedraw();            }        }        retValue = TRUE;        goto leave;    }    //    // Need to translate native events to HXxEvents.    //    UINT32       hxEventType;    hxEventType = 0;    HXxPoint     pxMouse;    HXxRect      boundsRect;    pxMouse.x = LOWORD(lParam) - m_screenOffset.x;    pxMouse.y = HIWORD(lParam) - m_screenOffset.y;                   // XXXAH WHOOPS! Currently in the paint function I am               // assuming that you are painting the enitire rectangle.               // So for the moment we will be painting the whole thing.               boundsRect.left     = 0;               boundsRect.right    = m_size.cx;               boundsRect.top      = 0;               boundsRect.bottom   = m_size.cy;    UINT32 flags;    flags = 0;    if (wParam & MK_SHIFT)        flags += HX_SHIFT_KEY;    if (wParam & MK_CONTROL)        flags += HX_CTRL_KEY;    if (GetAsyncKeyState(VK_MENU) & (1<<16))        flags += HX_ALT_COMMAND_KEY;    if (wParam & MK_LBUTTON)        flags += HX_PRIMARY_BUTTON;    if (wParam & MK_RBUTTON)        flags += HX_CONTEXT_BUTTON;    if (wParam & MK_MBUTTON)        flags += HX_THIRD_BUTTON;    switch (message)    {       case WM_PAINT:           PAINTSTRUCT ps;           ::BeginPaint(hWnd,&ps);           boundsRect.left    = ps.rcPaint.left;           boundsRect.right   = ps.rcPaint.right;           boundsRect.top     = ps.rcPaint.top;           boundsRect.bottom  = ps.rcPaint.bottom;           m_pTopLevelSite->CheckDisplayMode(ps.hdc);           ::EndPaint(hWnd,&ps);           //Take care of all the dirty rects for all sites           m_pTopLevelSite->ManageExposeEvents(&boundsRect);//            // Check to see if this is a spurrious WM_PAINT generated by//            // our Invalidate rect calls.//            if (!(m_pDirtyRegion->numRects &&//                  boundsRect.left   >= m_pDirtyRegion->extents.x1   &&//                  boundsRect.right  <= m_pDirtyRegion->extents.x2   &&//                  boundsRect.top    >= m_pDirtyRegion->extents.y1   &&//                  boundsRect.bottom <= m_pDirtyRegion->extents.y2 ) &&//                (boundsRect.left != boundsRect.right && boundsRect.top != boundsRect.bottom)//                )//            {//                FillColorKey();//                //Tell all of my children to update their overlays next time.//                ResetUpdateOverlay();//                if (m_pParentSite)//                {//                    // Taking the easy way out (would you expect anything//                    // less of me?)  The hard, but better, way would be to//                    // extract from the composition surface.  *sigh* but I//                    // am too lazy right now ... maybe later ... AS IF!//                    // XXXAH//                    m_bDoNotGenerateWMPPaint = TRUE;//                    InternalForceRedraw();//                    m_bDoNotGenerateWMPPaint = FALSE;//                    m_pTopLevelSite->_ForceRedrawAll();//                }//                else//                {//                    m_pTopLevelSite->_ForceRedrawAll();//                }//                RecursiveSizeSliders();//           }           lResult = 0;           retValue = TRUE;           goto leave;           break;       case WM_MOUSEMOVE:           CheckCapture();           SetCaptureMessage(hWnd, message, wParam, lParam);           SetEvent(event, HX_MOUSE_MOVE, (void*)hWnd, (void*)&pxMouse, (void*)&flags);           break;       case WM_LBUTTONDOWN:#ifdef _DEBUG           if( wParam & MK_CONTROL )           {               DisplayAllSiteData();           }           if( wParam & MK_SHIFT)           {               DisplaySiteData("");           }#endif           CheckCapture();           SetCaptureMessage(hWnd, message, wParam, lParam);           SetEvent(event, HX_PRIMARY_BUTTON_DOWN, (void*)hWnd, (void*)&pxMouse, (void*)&flags);           break;       case WM_RBUTTONDOWN:           CheckCapture();           SetCaptureMessage(hWnd, message, wParam, lParam);           SetEvent(event, HX_CONTEXT_BUTTON_DOWN, (void*)hWnd, (void*)&pxMouse, (void*)&flags);           break;       case WM_LBUTTONUP:           CheckCapture();           SetCaptureMessage(hWnd, message, wParam, lParam);           SetEvent(event, HX_PRIMARY_BUTTON_UP, (void*)hWnd, (void*)&pxMouse, (void*)&flags);           break;       case WM_RBUTTONUP:           CheckCapture();           SetCaptureMessage(hWnd, message, wParam, lParam);           SetEvent(event, HX_CONTEXT_BUTTON_UP, (void*)hWnd, (void*)&pxMouse, (void*)&flags);           break;       case WM_LBUTTONDBLCLK:           CheckCapture();           SetCaptureMessage(hWnd, message, wParam, lParam);           SetEvent(event, HX_PRIMARY_DBLCLK, (void*)hWnd, (void*)&pxMouse, (void*)&flags);           break;       case WM_RBUTTONDBLCLK:           CheckCapture();           SetCaptureMessage(hWnd, message, wParam, lParam);           SetEvent(event, HX_CONTEXT_DBLCLK, (void*)hWnd, (void*)&pxMouse, (void*)&flags);           break;       case WM_CHAR:       case WM_KEYDOWN:       case WM_KEYUP:       case WM_NCHITTEST:           SetEvent(event, message, (void*)hWnd, (void*)wParam, (void*)&lParam);           break;           /*            *  Some silly plugins call SetCapture. SO we have to keep on sending them mouse messages            *  like crazy.            */       case WM_CAPTURECHANGED:           m_pTopLevelSite->m_bSetCaptureOn = (void*)lParam == GetWindow()->window;           if (m_pTopLevelSite->m_bSetCaptureOn)           {               if( m_pTopLevelSite->m_pCaptureUser)                   m_pTopLevelSite->m_pCaptureUser = m_pTopLevelSite->m_pLastUser;           }           else           {               if( m_pTopLevelSite->m_pCaptureUser)                   m_pTopLevelSite->m_pCaptureUser = NULL;           }           break;       case WM_SIZE:       case WM_MOVE:       case WM_SIZING:       case WM_MOVING:       case WM_WINDOWPOSCHANGED:       case WM_WINDOWPOSCHANGING:#ifdef _CHECK_CREATE       {           RECT rect;           ::GetWindowRect((HWND)GetWindow()->window, &rect);           FILE* f1 = fopen("c:\\create.txt", "a+"); /* Flawfinder: ignore */           fprintf(f1, "%p WM_SIZE: %p  hwnd: %p  internalSize: (%d, %d) external Size: (%d, %d)\n", GetCurrentThreadId(),this, GetWindow()->window, m_size.cx, m_size.cy, rect.right -rect.left, rect.bottom - rect.top);           fclose(f1);       }#endif       if (m_bInFullScreen)       {           lResult = DefWindowProc( hWnd, message, wParam, lParam);           retValue = TRUE;           goto leave;       }       else       {           retValue = FALSE;           goto leave;       }       break;#ifndef _HAMEL       case WM_ACTIVATE:       case WM_ACTIVATEAPP:       {           DWORD fActive = LOWORD(wParam);           if (m_bInFullScreen && m_pUser && !fActive)           {               HXxEvent event = {WM_CHAR, GetWindow()->window, (void*)VK_ESCAPE, 0, 0, 0};               m_pUser->HandleEvent(&event);           }           retValue = FALSE;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -