Exemplo n.º 1
0
void GetTaskinformationForWindowAction(TASKINFORMATION* taskInfo, int nCode, WPARAM wParam, LPARAM lParam)
{
		taskInfo->WindowName = GetWindowName((HWND)wParam);
		taskInfo->WindowHandle = (HWND)wParam;
		taskInfo->SystemMenu = GetSystemMenu(taskInfo->WindowHandle, TRUE);
		taskInfo->WindowIcon = GetWindowIcon((HWND)wParam);
		if(nCode == HSHELL_WINDOWREPLACED)
		{
			taskInfo->NewWindowHandle = (HWND)lParam;
		}
}
Exemplo n.º 2
0
    void WidgetDelegate::SaveWindowPlacement(const gfx::Rect& bounds,
        ui::WindowShowState show_state)
    {
        std::wstring window_name = GetWindowName();
        if(!ViewDelegate::view_delegate || window_name.empty())
        {
            return;
        }

        ViewDelegate::view_delegate->SaveWindowPlacement(
            GetWidget(), window_name, bounds, show_state);
    }
Exemplo n.º 3
0
    bool WidgetDelegate::GetSavedWindowPlacement(
        gfx::Rect* bounds,
        ui::WindowShowState* show_state) const
    {
        std::wstring window_name = GetWindowName();
        if(!ViewDelegate::view_delegate || window_name.empty())
        {
            return false;
        }

        return ViewDelegate::view_delegate->GetSavedWindowPlacement(
            window_name, bounds, show_state);
    }
Exemplo n.º 4
0
/*!
@brief ウィンドウの生成
@par   関数説明
ウィンドウを生成する。
決まったウィンドウサイズやスタイルがあるのであればあらかじめSet系関数で設定しておく。
@param nCmdShow WinMain関数で取得できる第三引数。
@return 0=成功。
@return 1=生成に失敗。
*/
unsigned long Window::MakeWindow( int nCmdShow )
{
	//int w = 0, h = 0;
	unsigned long err;

	if ( wd.WindowParent )
	{
		SetWindowStyleDirect( GetWindowStyle() | WS_CHILD );
	} else
	{
		SetWindowStyleDirect( GetWindowStyle() & ( ~WS_CHILD ) );
	}

	// 判定。
	//if ( GetPositionX() < 0 ){ SetPositionX( 0 ); w = GetWindowWidth();  SetWindowWidth( 640 );  }
	//if ( GetPositionY() < 0 ){ SetPositionY( 0 ); h = GetWindowHeight(); SetWindowHeight( 480 ); }

	//ウィンドウの生成
	wd.WindowHandle = CreateWindowEx(
		GetWindowStyleEx(),
		wd.wcx.lpszClassName,//MIKANCLASSNAME,//GetClassNameEx(),
		GetWindowName(),
		GetWindowStyle(),
		GetPositionX(), GetPositionY(),
		GetWindowWidth(), GetWindowHeight(),
		GetParentWindowHandle(),
		GetMenuHandle(),
		GetInstanceHandle(),
		GetParameter()
		);
	/*if ( w > 0 || h > 0 )
	{
	SetWindowSize( w, h );
	SetWindow();
	}*/

	//生成に失敗したら1を返して終了
	if ( wd.WindowHandle == NULL )
	{
		err = GetLastError();
		return err;
	}

	ShowWindow( wd.WindowHandle, nCmdShow );
	UpdateWindow( wd.WindowHandle );
	//  SetWindowText( wd.WindowParent, GetWindowName() );

	return 0;
}
Exemplo n.º 5
0
static void *
winMultiWindowWMProc (void *pArg)
{
  WMProcArgPtr		pProcArg = (WMProcArgPtr)pArg;
  WMInfoPtr		pWMInfo = pProcArg->pWMInfo;
  
  /* Initialize the Window Manager */
  winInitMultiWindowWM (pWMInfo, pProcArg);
  
#if CYGMULTIWINDOW_DEBUG
  ErrorF ("winMultiWindowWMProc ()\n");
#endif

  /* Loop until we explicity break out */
  for (;;)
    {
      WMMsgNodePtr	pNode;

      /* Pop a message off of our queue */
      pNode = PopMessage (&pWMInfo->wmMsgQueue);
      if (pNode == NULL)
	{
	  /* Bail if PopMessage returns without a message */
	  /* NOTE: Remember that PopMessage is a blocking function. */
	  ErrorF ("winMultiWindowWMProc - Queue is Empty?\n");
	  pthread_exit (NULL);
	}

#if CYGMULTIWINDOW_DEBUG
      ErrorF ("winMultiWindowWMProc - %d ms MSG: %d ID: %d\n",
	      GetTickCount (), (int)pNode->msg.msg, (int)pNode->msg.dwID);
#endif
      
      /* Branch on the message type */
      switch (pNode->msg.msg)
	{
#if 0
	case WM_WM_MOVE:
	  ErrorF ("\tWM_WM_MOVE\n");
	  break;

	case WM_WM_SIZE:
	  ErrorF ("\tWM_WM_SIZE\n");
	  break;
#endif

	case WM_WM_RAISE:
#if CYGMULTIWINDOW_DEBUG
	  ErrorF ("\tWM_WM_RAISE\n");
#endif

	  /* Raise the window */
	  XRaiseWindow (pWMInfo->pDisplay, pNode->msg.iWindow);
	  break;

	case WM_WM_LOWER:
#if CYGMULTIWINDOW_DEBUG
	  ErrorF ("\tWM_WM_LOWER\n");
#endif

	  /* Lower the window */
	  XLowerWindow (pWMInfo->pDisplay, pNode->msg.iWindow);
	  break;

	case WM_WM_MAP:
#if CYGMULTIWINDOW_DEBUG
	  ErrorF ("\tWM_WM_MAP\n");
#endif
	  {
	    XWindowAttributes		attr;
	    char			*pszName;
#if 0
	    XWMHints			*pHints;
#endif

	    /* Get the window attributes */
	    XGetWindowAttributes (pWMInfo->pDisplay,
				  pNode->msg.iWindow,
				  &attr);
	    if (!attr.override_redirect)
	      {
		/* Set the Windows window name */
		GetWindowName(pWMInfo->pDisplay, pNode->msg.iWindow, &pszName);
		SetWindowText (pNode->msg.hwndWindow, pszName);
		free (pszName);
	      }
	  }
	  break;

	case WM_WM_UNMAP:
#if CYGMULTIWINDOW_DEBUG
	  ErrorF ("\tWM_WM_UNMAP\n");
#endif
	  
	  /* Unmap the window */
	  XUnmapWindow(pWMInfo->pDisplay, pNode->msg.iWindow);
	  break;

	case WM_WM_KILL:
#if CYGMULTIWINDOW_DEBUG
	  ErrorF ("\tWM_WM_KILL\n");
#endif
	  {
	    int				i, n, found = 0;
	    Atom			*protocols;
	    
	    /* --- */
	    if (XGetWMProtocols (pWMInfo->pDisplay,
				 pNode->msg.iWindow,
				 &protocols,
				 &n))
	      {
		for (i = 0; i < n; ++i)
		  if (protocols[i] == pWMInfo->atmWmDelete)
		    ++found;
		
		XFree (protocols);
	      }

	    /* --- */
	    if (found)
	      SendXMessage (pWMInfo->pDisplay,
			    pNode->msg.iWindow,
			    pWMInfo->atmWmProtos,
			    pWMInfo->atmWmDelete);
	    else
	      XKillClient (pWMInfo->pDisplay,
			   pNode->msg.iWindow);
	  }
	  break;

	case WM_WM_ACTIVATE:
#if CYGMULTIWINDOW_DEBUG
	  ErrorF ("\tWM_WM_ACTIVATE\n");
#endif
	  
	  /* Set the input focus */
	  XSetInputFocus (pWMInfo->pDisplay,
			  pNode->msg.iWindow,
			  RevertToPointerRoot,
			  CurrentTime);
	  break;

	case WM_WM_X_EVENT:
	  /* Process all X events in the Window Manager event queue */
	  FlushXEvents (pWMInfo);
	  break;

	default:
	  ErrorF ("winMultiWindowWMProc - Unknown Message.\n");
	  pthread_exit (NULL);
	  break;
	}

      /* Free the retrieved message */
      free (pNode);

      /* Flush any pending events on our display */
      XFlush (pWMInfo->pDisplay);
    }

  /* Free the condition variable */
  pthread_cond_destroy (&pWMInfo->wmMsgQueue.pcNotEmpty);
  
  /* Free the mutex variable */
  pthread_mutex_destroy (&pWMInfo->wmMsgQueue.pmMutex);
  
  /* Free the passed-in argument */
  free (pProcArg);
  
#if CYGMULTIWINDOW_DEBUG
  ErrorF("-winMultiWindowWMProc ()\n");
#endif
}
Exemplo n.º 6
0
void keys(unsigned char key, int x, int y)
{
	switch ( key )
    {
    default:
      break;
    case 'T':
		photonPointSize += 2.0;
		printf("    (-) Photon Splat Size (for original approach): %f\n", photonPointSize );
		needToRerenderCaustics = 1;
		glutPostRedisplay();
		break;
	case 't':
		photonPointSize -= 2.0;
		if (photonPointSize < 1) photonPointSize = 1;
		printf("    (-) Photon Splat Size (for original approach): %f\n", photonPointSize );
		needToRerenderCaustics = 1;
		glutPostRedisplay();
		break;
	case 'X':
	case 'x':
		if (!useExperimentalApproach && !usingAdaptiveMultresolutionSplats)
		{
			useExperimentalApproach = !useExperimentalApproach;	
			printf("    (-) Using dynamically varying splat sizes...\n" );
		}
		else if (useExperimentalApproach && !usingAdaptiveMultresolutionSplats)
		{
			useExperimentalApproach = !useExperimentalApproach;	
            usingAdaptiveMultresolutionSplats = !usingAdaptiveMultresolutionSplats;
			printf("    (-) Using adaptive multiresolution splats (4 fixed radii splats)...\n" );
		}
		else if (!useExperimentalApproach && usingAdaptiveMultresolutionSplats)
		{
			usingAdaptiveMultresolutionSplats = !usingAdaptiveMultresolutionSplats;
			printf("    (-) Using original I3D 2006 work of Wyman and Davis...\n" );
		}
		needToRerenderCaustics = 1;
		glutPostRedisplay();
		break;
	case '1':
		displayDragon = !displayDragon;
		needToRerenderCaustics = 1;
		glutPostRedisplay();
		break;
	case '2':
		displayMacBeth = !displayMacBeth;
		needToRerenderCaustics = 1;
		glutPostRedisplay();
		break;
	case '3':
		displayTable = !displayTable;
		needToRerenderCaustics = 1;
		glutPostRedisplay();
		break;
	case '8':
		break;
	case '9':
		break;
	case '*':
		displayBig++;
		if (displayBig > 9) displayBig=9;
		glutSetWindowTitle( GetWindowName( displayBig ) );
		glutPostRedisplay();
		break;
	case '/':
		displayBig--;
		if (displayBig < 0) displayBig = 0;
		glutSetWindowTitle( GetWindowName( displayBig ) );
		glutPostRedisplay();
		break;
	case 'a':
		benchmarking = !benchmarking;
		if (benchmarking)
		{
			frameCount = 0;
			startTime = clock();
		}
		else
		{
			clock_t currTime = clock();
			unsigned int diff = currTime - startTime;
			printf("(+) Benchmark results: %f fps over %d frames\n", 
					(frameCount*CLOCKS_PER_SEC)/((float)diff),
					frameCount );
		}
		break;
	case 'v':
		currentEnvMap++;
		if (currentEnvMap >= NUM_ENVMAPS) currentEnvMap = 0;
		glutPostRedisplay();
		break;
	case 'V':
		currentEnvMap--;
		if (currentEnvMap < 0) currentEnvMap = NUM_ENVMAPS-1;
		glutPostRedisplay();
		break;
	case 's':
		objScale -= 0.2;
		printf("    (-) Object scale: %f\n", objScale);
		needToRerenderCaustics = 1;
		glutPostRedisplay();
		break;
	case 'S':
		objScale += 0.2;
		printf("    (-) Object scale: %f\n", objScale);
		needToRerenderCaustics = 1;
		glutPostRedisplay();
		break;
	case 'y':
		rotating = !rotating;
		glutPostRedisplay();
		break;

	case 'f':
	case 'F':
		temporalFiltering = ( temporalFiltering == 0 ? 3 : 0 );
		currentTemporalBufferPointer = (temporalFiltering == 0 ? 0 : 1);
		printf("    (-) Temporal filtering: %s\n", temporalFiltering ? "Enabled" : "Disabled" );
		glutPostRedisplay();
		break;

	case '{':
	case '[':
		viewDistance -= 0.05;
		if (viewDistance < 0.05) viewDistance = 0.05;
		printf("Viewing Distance Factor: %f\n", viewDistance);

		{
			GLfloat tmpMat[16];

			/* find the updated eye position */
			GetTrackBallMatrix( EYE_TRACKBALL, tmpMat );
			lookFrom[EYE_POV][0] = viewDistance*tmpMat[0]*origLookFrom[EYE_POV][0] + 
				viewDistance*tmpMat[4]*origLookFrom[EYE_POV][1] + 
				viewDistance*tmpMat[8]*origLookFrom[EYE_POV][2] + 
				tmpMat[12]*origLookFrom[EYE_POV][3];
			lookFrom[EYE_POV][1] = viewDistance*tmpMat[1]*origLookFrom[EYE_POV][0] + 
				viewDistance*tmpMat[5]*origLookFrom[EYE_POV][1] + 
				viewDistance*tmpMat[9]*origLookFrom[EYE_POV][2] + 
				tmpMat[13]*origLookFrom[EYE_POV][3];
			lookFrom[EYE_POV][2] = viewDistance*tmpMat[2]*origLookFrom[EYE_POV][0] + 
				viewDistance*tmpMat[6]*origLookFrom[EYE_POV][1] + 
				viewDistance*tmpMat[10]*origLookFrom[EYE_POV][2] + 
				tmpMat[14]*origLookFrom[EYE_POV][3];
			lookFrom[EYE_POV][3] = viewDistance*tmpMat[3]*origLookFrom[EYE_POV][0] + 
				viewDistance*tmpMat[7]*origLookFrom[EYE_POV][1] + 
				viewDistance*tmpMat[11]*origLookFrom[EYE_POV][2] + 
				tmpMat[15]*origLookFrom[EYE_POV][3];

			/* compute the new, updated gluLookAt() matrix for the eye */
			glMatrixMode( GL_MODELVIEW );
			glPushMatrix();
			glLoadIdentity();
			gluLookAt(lookFrom[EYE_POV][0], lookFrom[EYE_POV][1], lookFrom[EYE_POV][2],
	  				    0, 0, lookAtZ,  
						0,1,0);
			glGetDoublev( GL_MODELVIEW_MATRIX, lookAtMatrix[EYE_POV] );
			matInvertd( lookAtMatrix[EYE_POV], inverseLookAtMatrix[EYE_POV] );
			glPopMatrix();
		}

		glutPostRedisplay();
		break;
	case '}':
	case ']':
		viewDistance += 0.05;
		printf("Viewing Distance Factor: %f\n", viewDistance);

		{
			GLfloat tmpMat[16];

			/* find the updated eye position */
			GetTrackBallMatrix( EYE_TRACKBALL, tmpMat );
			lookFrom[EYE_POV][0] = viewDistance*tmpMat[0]*origLookFrom[EYE_POV][0] + 
				viewDistance*tmpMat[4]*origLookFrom[EYE_POV][1] + 
				viewDistance*tmpMat[8]*origLookFrom[EYE_POV][2] + 
				tmpMat[12]*origLookFrom[EYE_POV][3];
			lookFrom[EYE_POV][1] = viewDistance*tmpMat[1]*origLookFrom[EYE_POV][0] + 
				viewDistance*tmpMat[5]*origLookFrom[EYE_POV][1] + 
				viewDistance*tmpMat[9]*origLookFrom[EYE_POV][2] + 
				tmpMat[13]*origLookFrom[EYE_POV][3];
			lookFrom[EYE_POV][2] = viewDistance*tmpMat[2]*origLookFrom[EYE_POV][0] + 
				viewDistance*tmpMat[6]*origLookFrom[EYE_POV][1] + 
				viewDistance*tmpMat[10]*origLookFrom[EYE_POV][2] + 
				tmpMat[14]*origLookFrom[EYE_POV][3];
			lookFrom[EYE_POV][3] = viewDistance*tmpMat[3]*origLookFrom[EYE_POV][0] + 
				viewDistance*tmpMat[7]*origLookFrom[EYE_POV][1] + 
				viewDistance*tmpMat[11]*origLookFrom[EYE_POV][2] + 
				tmpMat[15]*origLookFrom[EYE_POV][3];

			/* compute the new, updated gluLookAt() matrix for the eye */
			glMatrixMode( GL_MODELVIEW );
			glPushMatrix();
			glLoadIdentity();
			gluLookAt(lookFrom[EYE_POV][0], lookFrom[EYE_POV][1], lookFrom[EYE_POV][2],
	  				    0, 0, lookAtZ,  
						0,1,0);
			glGetDoublev( GL_MODELVIEW_MATRIX, lookAtMatrix[EYE_POV] );
			matInvertd( lookAtMatrix[EYE_POV], inverseLookAtMatrix[EYE_POV] );
			glPopMatrix();
		}

		glutPostRedisplay();
		break;

	case '+':
	case '=':
		if (index2_1 >= 1.5) break;
		index2_1 += 0.01;
		index2_1sqr = index2_1 * index2_1;
		printf("Index2 / index1: %f\n", index2_1);
		needToRerenderCaustics = 1;
		glutPostRedisplay();
		break;
	case '-':
	case '_':
		if (index2_1 <= 0.51) break;
		index2_1 -= 0.01;
		index2_1sqr = index2_1 * index2_1;
		printf("Index2 / index1: %f\n", index2_1);
		needToRerenderCaustics = 1;
		glutPostRedisplay();
		break;

	case 'C':
	case 'c':
		drawComplex = 1-drawComplex;
		needToRerenderCaustics = 1;
		glutPostRedisplay();
		break;
	case ' ':
		drawSideImages = 1-drawSideImages;
		glutPostRedisplay();
		break;
	case 'H':
	case 'h':
		drawHelpMenu = 1-drawHelpMenu;
		glutPostRedisplay();
		break;
	case 'q':
	case 'Q':
		exit(0);
		break;
	case 'r':
	case 'R':
		shaderLoadError=ReloadCGShaders();
		needToRerenderCaustics = 1;
		glutPostRedisplay();
		break;
	case 'b':
	case 'B':
		whichBackSide = 1-whichBackSide;
		needToRerenderCaustics = 1;
		glutPostRedisplay();
		break;
	case '>':
	case '.':
		moveOthersZ -= 0.2;
		needToRerenderCaustics = 1;
		glutPostRedisplay();
		break;
	case '<':
	case ',':
		moveOthersZ += 0.2;
		needToRerenderCaustics = 1;
		glutPostRedisplay();
		break;

	case 'W':
	case 'w':
		viewpoint = !viewpoint;
		glutPostRedisplay();
		break;

	case 'M':
	case 'm':
		{
			FILE *f;
			GLfloat tmpMatrix[16];

			f = fopen( "mostRecent.settings", "w" );

			GetTrackBallMatrix( OBJECT_TRACKBALL, tmpMatrix );
			fprintf(f, "Current OBJ Matrix: %f %f %f %f \n", tmpMatrix[0], tmpMatrix[1], tmpMatrix[2], tmpMatrix[3] );
			fprintf(f, "Current OBJ Matrix: %f %f %f %f \n", tmpMatrix[4], tmpMatrix[5], tmpMatrix[6], tmpMatrix[7] );
			fprintf(f, "Current OBJ Matrix: %f %f %f %f \n", tmpMatrix[8], tmpMatrix[9], tmpMatrix[10], tmpMatrix[11] );
			fprintf(f, "Current OBJ Matrix: %f %f %f %f \n", tmpMatrix[12], tmpMatrix[13], tmpMatrix[14], tmpMatrix[15] );

			GetTrackBallMatrix( ENVIRONMENT_TRACKBALL, tmpMatrix );
			fprintf(f, "Current Env Matrix: %f %f %f %f \n", tmpMatrix[0], tmpMatrix[1], tmpMatrix[2], tmpMatrix[3] );
			fprintf(f, "Current Env Matrix: %f %f %f %f \n", tmpMatrix[4], tmpMatrix[5], tmpMatrix[6], tmpMatrix[7] );
			fprintf(f, "Current Env Matrix: %f %f %f %f \n", tmpMatrix[8], tmpMatrix[9], tmpMatrix[10], tmpMatrix[11] );
			fprintf(f, "Current Env Matrix: %f %f %f %f \n", tmpMatrix[12], tmpMatrix[13], tmpMatrix[14], tmpMatrix[15] );

			GetTrackBallMatrix( EYE_TRACKBALL, tmpMatrix );
			fprintf(f, "Current Eye Matrix: %f %f %f %f \n", tmpMatrix[0], tmpMatrix[1], tmpMatrix[2], tmpMatrix[3] );
			fprintf(f, "Current Eye Matrix: %f %f %f %f \n", tmpMatrix[4], tmpMatrix[5], tmpMatrix[6], tmpMatrix[7] );
			fprintf(f, "Current Eye Matrix: %f %f %f %f \n", tmpMatrix[8], tmpMatrix[9], tmpMatrix[10], tmpMatrix[11] );
			fprintf(f, "Current Eye Matrix: %f %f %f %f \n", tmpMatrix[12], tmpMatrix[13], tmpMatrix[14], tmpMatrix[15] );

			GetTrackBallMatrix( LIGHT_TRACKBALL, tmpMatrix );
			fprintf(f, "Current Light Matrix: %f %f %f %f \n", tmpMatrix[0], tmpMatrix[1], tmpMatrix[2], tmpMatrix[3] );
			fprintf(f, "Current Light Matrix: %f %f %f %f \n", tmpMatrix[4], tmpMatrix[5], tmpMatrix[6], tmpMatrix[7] );
			fprintf(f, "Current Light Matrix: %f %f %f %f \n", tmpMatrix[8], tmpMatrix[9], tmpMatrix[10], tmpMatrix[11] );
			fprintf(f, "Current Light Matrix: %f %f %f %f \n", tmpMatrix[12], tmpMatrix[13], tmpMatrix[14], tmpMatrix[15] );

            PrintInverseTrackballMatrix( LIGHT_TRACKBALL );

			fprintf(f, "Object Scale: %f\n", objScale );
			fprintf(f, "Index Ratio: %f\n", index2_1 ); 
			fprintf(f, "Object Number: %d\n", currentModelNum );
			fprintf(f, "Environment Number: %d\n", currentEnvMap );

			GetTrackBallMatrix( MISC_TRACKBALL, tmpMatrix );
			fprintf(f, "Current Misc Matrix: %f %f %f %f\n", tmpMatrix[0], tmpMatrix[1], tmpMatrix[2], tmpMatrix[3] );
			fprintf(f, "Current Misc Matrix: %f %f %f %f\n", tmpMatrix[4], tmpMatrix[5], tmpMatrix[6], tmpMatrix[7] );
			fprintf(f, "Current Misc Matrix: %f %f %f %f\n", tmpMatrix[8], tmpMatrix[9], tmpMatrix[10], tmpMatrix[11] );
			fprintf(f, "Current Misc Matrix: %f %f %f %f\n", tmpMatrix[12], tmpMatrix[13], tmpMatrix[14], tmpMatrix[15] );

			fprintf(f, "Current Misc Offset: %f %f %f\n", moveOthersX, moveOthersY, moveOthersZ );
			fprintf(f, "Current Zoom Factor: %f\n", viewDistance );
			fprintf(f, "Current Displayed Objects: %d %d %d\n", displayDragon, displayMacBeth, displayTable );
			fprintf(f, "Current Viewpoint: %d\n", viewpoint );

			fclose( f );

			printf("Settings output to \"mostRecent.settings\"...\n");
		}
		break;
	}
}