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

📄 kscreensave.c

📁 linux下的flash播放器源程序
💻 C
字号:
//-----------------------------------------------------------------------------// $Id: kscreensave.C,v 1.1 2003/09/08 19:41:55 jasonk Exp $// KDE screen saver//-----------------------------------------------------------------------------#include <signal.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include <unistd.h>#include <kapp.h>#include "kscreensave.h"int sendSignal(){	QString buffer(getenv("HOME"));	buffer.append("/.kss-install.pid.");        char ksshostname[200];        gethostname(ksshostname, 200);        buffer.append(ksshostname);	int r = -1;	FILE *fp;	if ( (fp = fopen( buffer, "r" ) ) != NULL )	{		// a screen saver is running - just tell it to lock		int pid;		fscanf( fp, "%d", &pid );		fclose( fp );                // But only kill it if the pid isn't -1!                if (pid > 0) {                  if( kill( pid, SIGUSR1 ) == 0 )			  r = 0;		}	}	return r;}void kForceLocker(){	if( sendSignal() != 0 )	{		KConfig *kdisplayConfig = new KConfig( kapp->kde_configdir() + "/kdisplayrc",		                                       kapp->localconfigdir() + "/kdisplayrc" );		kdisplayConfig->setGroup("ScreenSaver");		bool allowRoot = kdisplayConfig->readBoolEntry( "allowRoot", false );		delete kdisplayConfig;		char *root = "-allow-root";		if( !allowRoot )			root = 0;		// either no saver is running or an old pidFile was not removed		QString buffer = QString(KApplication::kde_bindir().data());		buffer.append("/kblankscrn.kss");	    		if ( fork() == 0 )		{			execlp( buffer, buffer, "-install", "-delay", "0", "-lock", root, 0 );			// if we make it here then try again using default path			execlp("kblankscrn.kss","kblankscrn.kss", "-install", "-delay", "0", "-lock", root, 0);		    			// uh oh - failed			fprintf( stderr, "Could not invoke kblankscrn.kss in $PATH or"			         " %s/bin\n" , KApplication::kde_bindir().data());			exit (1);		}	}}

⌨️ 快捷键说明

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