Changeset 10501 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Jul 11, 2008 9:29:38 AM (17 years ago)
- svn:sync-xref-src-repo-rev:
- 33180
- Location:
- trunk/src/VBox/Frontends/VBoxSDL
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxSDL/Framebuffer.cpp
r8155 r10501 42 42 #include <VBox/err.h> 43 43 #include <VBox/log.h> 44 #include <signal.h>45 44 46 45 #include "VBoxSDL.h" … … 145 144 return; 146 145 } 147 148 #ifdef VBOXSDL_WITH_X11149 /* NOTE: we still want Ctrl-C to work, so we undo the SDL redirections */150 signal(SIGINT, SIG_DFL);151 signal(SIGQUIT, SIG_DFL);152 #endif153 146 154 147 const SDL_VideoInfo *videoInfo = SDL_GetVideoInfo(); -
trunk/src/VBox/Frontends/VBoxSDL/VBoxSDL.cpp
r10434 r10501 164 164 #endif 165 165 static const char *gHostKeyDisabledCombinations = ""; 166 static const char *gpszPidFile; 166 167 static BOOL gfGrabbed = FALSE; 167 168 static BOOL gfGrabOnMouseClick = TRUE; … … 743 744 * annoying enough for introducing this hack. 744 745 */ 745 void signal_handler (int sig, siginfo_t *info, void *secret)746 void signal_handler_SIGUSR1(int sig, siginfo_t *info, void *secret) 746 747 { 747 748 /* only SIGUSR1 is interesting */ … … 751 752 ResetKeys(); 752 753 } 754 } 755 756 /** 757 * Custom signal handler for catching exit events. 758 */ 759 void signal_handler_SIGINT(int sig) 760 { 761 if (gpszPidFile) 762 RTFileDelete(gpszPidFile); 763 signal(SIGINT, SIG_DFL); 764 signal(SIGQUIT, SIG_DFL); 765 signal(SIGSEGV, SIG_DFL); 766 kill(getpid(), sig); 753 767 } 754 768 #endif /* VBOXSDL_WITH_X11 */ … … 1326 1340 gfACPITerm = TRUE; 1327 1341 } 1342 else if (strcmp(argv[curArg], "-pidfile") == 0) 1343 { 1344 if (++curArg >= argc) 1345 { 1346 RTPrintf("Error: missing file name for -pidfile!\n"); 1347 rc = E_FAIL; 1348 break; 1349 } 1350 gpszPidFile = argv[curArg]; 1351 } 1328 1352 else if (strcmp(argv[curArg], "-hda") == 0) 1329 1353 { … … 1902 1926 gpFrameBuffer->AddRef(); 1903 1927 if (fFullscreen) 1904 {1905 1928 gpFrameBuffer->setFullscreen(true); 1906 } 1929 1907 1930 #ifdef VBOX_SECURELABEL 1908 1931 if (fSecureLabel) … … 1951 1974 gpFrameBuffer->setSecureLabelText(labelUtf8.raw()); 1952 1975 } 1976 #endif 1977 1978 #ifdef VBOXSDL_WITH_X11 1979 /* NOTE1: We still want Ctrl-C to work, so we undo the SDL redirections. 1980 * NOTE2: We have to remove the PidFile if this file exists. */ 1981 signal(SIGINT, signal_handler_SIGINT); 1982 signal(SIGQUIT, signal_handler_SIGINT); 1983 signal(SIGSEGV, signal_handler_SIGINT); 1953 1984 #endif 1954 1985 … … 2130 2161 #ifdef VBOXSDL_WITH_X11 2131 2162 struct sigaction sa; 2132 sa.sa_sigaction = signal_handler ;2163 sa.sa_sigaction = signal_handler_SIGUSR1; 2133 2164 sigemptyset (&sa.sa_mask); 2134 2165 sa.sa_flags = SA_RESTART | SA_SIGINFO; … … 2319 2350 */ 2320 2351 SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); 2352 2353 /* 2354 * Create PID file. 2355 */ 2356 if (gpszPidFile) 2357 { 2358 char szBuf[32]; 2359 const char *pcszLf = "\n"; 2360 RTFILE PidFile; 2361 RTFileOpen(&PidFile, gpszPidFile, RTFILE_O_WRITE | RTFILE_O_CREATE_REPLACE); 2362 RTStrFormatNumber(szBuf, RTProcSelf(), 10, 0, 0, 0); 2363 RTFileWrite(PidFile, szBuf, strlen(szBuf), NULL); 2364 RTFileWrite(PidFile, pcszLf, strlen(pcszLf), NULL); 2365 RTFileClose(PidFile); 2366 } 2321 2367 2322 2368 /* … … 2719 2765 2720 2766 leave: 2767 if (gpszPidFile) 2768 RTFileDelete(gpszPidFile); 2769 2721 2770 LogFlow(("leaving...\n")); 2722 2771 #if defined(VBOX_WITH_XPCOM) && !defined(RT_OS_DARWIN) && !defined(RT_OS_OS2)
Note:
See TracChangeset
for help on using the changeset viewer.