📄 unixsite.cpp
字号:
CHXBaseSite::CheckColorSettings(); } else { if (m_pParentSite) { m_pParentSite->CheckColorSettings(); } else { pSurf->SetHWColorControls(); //We do all color stuff except sharpmess in hardware. float fCurrentSharpness; INT16 bInterpolate; zm_pColorAcc->GetSharpnessAdjustments(&fCurrentSharpness, &bInterpolate); if (fCurrentSharpness != m_fSharpness) { zm_pColorAcc->SetSharpnessAdjustments(m_fSharpness, FALSE); } } }#endif}//// OK, here it is. Take care of any OS specific duties, like scrollbar// stuff and expose events. Then, if the event isn't handled, convert// to an RMA event and return.BOOL CHXUnixSite::_HandleOSEvents(HXxEvent* pEvent){ HXxPoint position = {0, 0}; HXxPoint point; if( NULL==pEvent ) { return FALSE; } #if defined(_DEBUG) && 0// fprintf( stderr, "this: %p m_pUser: %p ", this, m_pUser ); switch( pEvent->event ) { case HX_MOUSE_LEAVE: fprintf( stderr, "HX_MOUSE_LEAVE\n" ); break;// case HX_MOUSE_MOVE:// point.x = ((HXxPoint*)pEvent->param1)->x;// point.y = ((HXxPoint*)pEvent->param1)->y;// fprintf( stderr, "HX_MOUSE_MOVE: %d %d\n", point.x, point.y );// break; case HX_MOUSE_ENTER: fprintf( stderr, "HX_MOUSE_ENTER\n" ); break;// case MotionNotify:// point.x = ((XMotionEvent*)pEvent->param2)->x;// point.y = ((XMotionEvent*)pEvent->param2)->y;// fprintf( stderr, "MotionNotify: %d %d\n", point.x, point.y );// break; case Expose: fprintf( stderr, "Expose\n" ); break; case EnterNotify : fprintf( stderr, "EnterNotify\n" ); break; case LeaveNotify: fprintf( stderr, "LeaveNotify\n" ); break; case KeyPress: fprintf( stderr, "this: %p m_pUser: %p ", this, m_pUser ); fprintf( stderr, "Keypress\n\n" ); break; case KeyRelease: fprintf( stderr, "this: %p m_pUser: %p ", this, m_pUser ); fprintf( stderr, "KeyRelease\n" ); break; default: fprintf( stderr, "Other\n" ); break; }#endif //Find the ConfigureNotify events so we can drop to RGB from //overlay while we move....// if( pEvent->event == ConfigureNotify && this==m_pTopLevelSite )// {// XConfigureEvent* pev = (XConfigureEvent*)pEvent->param2;// if( m_pWindow && pev->window == (Window)m_pWindow->window )// {// HXxPoint p;// _GetPositionRelativeToActualWindow( p );// // fprintf( stderr, "wint %p -- x,y width, height: %d %d %d %d \n",// // pev->window,// // pev->x, pev->y, pev->width, pev->height);// // fprintf( stderr, "size of site: %d %d\n", m_size.cx, m_size.cy); // // fprintf( stderr, "pos of site: %d %d\n", m_topleft.x, m_topleft.y); // m_pTopLevelSite->m_pMutex->Lock();// m_pTopLevelSite->SiteMoving(0, 0); // m_pTopLevelSite->m_nLastMoveTime = HX_GET_TICKCOUNT();// m_pTopLevelSite->ScheduleCallback(MOUSE, 100);// m_pTopLevelSite->m_pMutex->Unlock();// }// } //See if we should drop out of full screen if( pEvent->event == FocusOut && IsFullScreen() && !m_bIgnoreFocusOutInFS ) {// fprintf( stderr, "_HandleOSEvents: focus out: " );// XEvent* pXEvent = (XEvent*) pEvent->param2;// XFocusChangeEvent* event = (XFocusChangeEvent*) pXEvent;// switch( event->mode )// {// case NotifyAncestor:// fprintf( stderr, "NotifyAncestor\n" );// break;// case NotifyVirtual:// fprintf( stderr, "NotifyVirtual\n" );// break;// case NotifyInferior:// fprintf( stderr, "NotifyInferior\n" );// break;// case NotifyNonlinear:// fprintf( stderr, "NotifyNonlinear\n" );// break;// case NotifyNonlinearVirtual:// fprintf( stderr, "NotifyNonlinearVirtual\n" );// break;// case NotifyPointer:// fprintf( stderr, "NotifyPointer\n" );// break;// case NotifyPointerRoot:// fprintf( stderr, "NotifyPointerRoot\n" );// break;// case NotifyDetailNone:// fprintf( stderr, "NotifyDetailNone\n" );// break;// default:// fprintf( stderr, "screwed.....\n" ); // } ExitFullScreen(); }#if defined(_DEBUG) && defined(TEST_FULL_SCREEN) if( pEvent->event == KeyPress ) { KeySym sym; char szBuf[10]; /* Flawfinder: ignore */ int nNum; //Lookup the key without any state. nNum = XLookupString( (XKeyEvent*)(pEvent->param2), szBuf, 10, &sym, NULL ); if( nNum > 0 ) { if( 'f' == szBuf[0] && IsFullScreen() ) { //Exit full screen if 'f' is pressed..... m_pTopLevelSite->ExitFullScreen(); } else if( 'f' == szBuf[0] && !IsFullScreen() ) { //Enter full screen if 'f' is pressed..... m_pTopLevelSite->EnterFullScreen(); } } }#endif#if defined(_DEBUG) && defined(_TEST_COLOR_CONTROLS) if( pEvent->event == KeyPress ) { KeySym sym; char szBuf[10]; /* Flawfinder: ignore */ int nNum; //Lookup the key without any state. nNum = XLookupString( (XKeyEvent*)(pEvent->param2), szBuf, 10, &sym, NULL ); if( nNum > 0 ) { if( 'b' == szBuf[0] ) { SetBrightness( GetBrightness()-.05); } if( 'B' == szBuf[0] ) { SetBrightness( GetBrightness()+.05); } if( 'c' == szBuf[0] ) { SetContrast( GetContrast()-.05); } if( 'C' == szBuf[0] ) { SetContrast( GetContrast()+.05); } if( 'h' == szBuf[0] ) { SetHue( GetHue()-.05); } if( 'H' == szBuf[0] ) { SetHue( GetHue()+.05 ); } if( 's' == szBuf[0] ) { SetSaturation( GetSaturation()-.05); } if( 'S' == szBuf[0] ) { SetSaturation( GetSaturation()+.05); } fprintf( stderr, "colors %f %f %f %f\n", GetBrightness(), GetContrast(), GetSaturation(), GetHue()); } }#endif //Exit full screen on ESC pressed...... if( pEvent->event == KeyPress ) { KeySym sym; char szBuf[10]; /* Flawfinder: ignore */ int nNum; //Lookup the key without any state. nNum = XLookupString( (XKeyEvent*)(pEvent->param2), szBuf, 10, &sym, NULL ); if( nNum > 0 ) { if( 27 == (int)szBuf[0] && IsFullScreen() ) { //Exit full screen if esc is pressed..... m_pTopLevelSite->ExitFullScreen(); } } } //Find out if this is an event we are interested in. Make sure we //are visible, it isn't a button, expose or FocusIn event and also //make sure it is headed for our window. if (!_ShouldProcess(pEvent)) { return FALSE; } if(m_pUser && GetWindow() && GetWindow()->window) { //Do not send an update event to a hidden site. if( pEvent->event == Expose || pEvent->event == FocusIn || pEvent->event == HX_SURFACE_UPDATE ) { if( (m_ScrollVertButtonT || m_ScrollHorizButtonR) && IsSiteVisible() ) { _DrawArrows(); } _ForwardUpdateEvent(pEvent); return TRUE; } else { // get original events info from pEvent XEvent* pXEvent = (XEvent*) pEvent->param2; XButtonEvent* buttonEvent = (XButtonEvent*) pXEvent; //XXXgfw all this code sucks! It really need to be written //for just native events or RMA events. With the change to a //common site it is all screwed up. I am leaving it for now //so we can get on with transparancy but get back to it! //If the user clicks MB1 on a scroll button, handle it here and //don't pass it up or let the user handle the event. //Hit detection here. //////////////////////////////////////////////////////// // BEGIN SCROLLING GARBAGE //////////////////////////////////////////////////////// if( ((pEvent->event==ButtonPress || pEvent->event==ButtonRelease) && buttonEvent->button==Button1) && (m_ScrollHorizButtonL || m_ScrollVertButtonB ) ) { int buttonX=0; int buttonY=0; if( pEvent->event==ButtonRelease ) { if( m_bScrollingInProgress ) { m_bScrollingInProgress = FALSE; m_nScrollDir = 0; return TRUE ; } } else { buttonX = buttonEvent->x; buttonY = buttonEvent->y; BOOL bPointInSite = FALSE; if( m_Region ) bPointInSite = HXPointInRegion(m_Region, buttonX, buttonY); if( bPointInSite ) { if( m_ScrollHorizButtonL ) { if( _InButton( m_ptScrollHorizPosL, buttonX, buttonY )) { m_bScrollingInProgress = TRUE; m_nScrollDir = 1; } if( _InButton( m_ptScrollHorizPosR, buttonX, buttonY )) { m_bScrollingInProgress = TRUE; m_nScrollDir = 2; } } if( m_ScrollVertButtonT ) { if( _InButton( m_ptScrollVertPosT, buttonX, buttonY )) { m_bScrollingInProgress = TRUE; m_nScrollDir = 3; } if( _InButton( m_ptScrollVertPosB, buttonX, buttonY )) { m_bScrollingInProgress = TRUE; m_nScrollDir = 4; } } } } if( (m_ScrollHorizButtonL||m_ScrollVertButtonT) && m_bScrollingInProgress) { int xx=0; int yy=0; HXxWindow* pParentWindow = GetParentSite()->GetWindow(); //Make it scroll 10% of the parent window each click. HXxSize sizeTmp; GetParentSite()->GetSize(sizeTmp); //Set it to a percentage of the slider range. int incX = sizeTmp.cx/10; int incY = sizeTmp.cy/10; HX_ASSERT( pParentWindow ); xx = m_XSliderPos; yy = m_YSliderPos; if( m_nScrollDir == 1 ) xx-=incX; if( m_nScrollDir == 2 ) xx+=incX; if( m_nScrollDir == 3 ) yy-=incY; if( m_nScrollDir == 4 ) yy+=incY; if( xx > m_size.cx-sizeTmp.cx ) xx = m_size.cx-sizeTmp.cx; if( yy > m_size.cy-sizeTmp.cy) yy = m_size.cy-sizeTmp.cy; if( xx < 0 ) xx = 0; if( yy < 0 ) yy = 0; m_XSliderPos = xx; m_YSliderPos = yy; HXxRect rect; DamageRect(rect); InternalForceRedraw(); } //Only throw away the event if it had something to do with //scolling. if( m_bScrollingInProgress ) { m_bScrollingInProgress = FALSE; m_nScrollDir = 0; return TRUE; } } //////////////////////////////////////////////////////// // END SCROLLING GARBAGE //////////////////////////////////////////////////////// point.x = -1; point.y = -1; if( pEvent->event == MotionNotify) { point.x = ((XMotionEvent*)pXEvent)->x; point.y = ((XMotionEvent*)pXEvent)->y; } else if( pEvent->event == ButtonPress ) { point.x = ((XMotionEvent*)pXEvent)->x; point.y = ((XMotionEvent*)pXEvent)->y; } // //Give the user a chance at the native event. // if( m_RegionWithoutChildren && HXPointInRegion(m_RegionWithoutChildren, point.x, point.y )) { if( m_Region && HXPointInRegion(m_Region, point.x, point.y) ) { if (m_pUser) m_pUser->HandleEvent(pEvent); } else { INT32 handledCount = 0; INT32 mapCount = 0; //try send this to all of our children _unixsitecpp1: mapCount = m_ChildrenMap.GetCount(); CHXMapPtrToPtr::Iterator i; for(i=m_ChildrenMap.Begin() ; i!=m_ChildrenMap.End() ; ++i) { CHXBaseSite* pSite = (CHXBaseSite*) *i; pSite->_HandleOSEvents(pEvent); if (pEvent->handled) { break; }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -