Exemple #1
0
void open_dialog_ok(char *filename)
{
/*	gtk_widget_set_sensitive(GTK_WIDGET(fs), 0);
	
	while(gtk_events_pending())
		gtk_main_iteration_do(0);
*/	
	stop_working();
	
	switch(try_load_map(filename))
	{
	case 0:
		view_all_map();
		break;
		
	case -1:
		run_file_not_found_dialog(GTK_WINDOW(window));
		break;
	
	case -2:
		run_corrupt_file_dialog(GTK_WINDOW(window));
		break;
	}
	
/*	gtk_widget_destroy(GTK_WIDGET(fs));
	
	while(gtk_events_pending())
		gtk_main_iteration_do(0);
*/	
	update_client_area();
	
	start_working();
}
Exemple #2
0
void save_dialog_ok(char *filename)
{
/*	gtk_widget_set_sensitive(GTK_WIDGET(file_selection), 0);
	
	while(gtk_events_pending())
		gtk_main_iteration_do(0);
*/	
	stop_working();
	
	int r = 0;
	
	if(!map_filename->text[0])
		r = 1;

	string_clear(map_filename);
	char *cc = filename;
		
	while(*cc && *cc != '.')
		string_cat_char(map_filename, *cc++);

	string_cat_text(map_filename, ".map");


	set_map_path();
	
	if(r)
		make_wall_texture_paths_relative();
	
	map_save();
	
	start_working();
}
Exemple #3
0
int main(int argc, char** argv) {
	ensure_eq(argc,2);
	recordInit();

	init_timeop();
	
	ssize_t amt;
	realpath(argv[0],lackey);
	char* lastslash = strrchr(lackey,'/');
	if(lastslash == NULL) {
		realpath("./lackey-bin",lackey);
	} else {
		// take the real path of us, and convert the end to lackey-bin
		amt = lastslash - lackey + 1;
		record(INFO,"realp %s",lackey+amt);
		memcpy(lackey+amt,"lackey-bin",sizeof("lackey-bin"));
	}
	record(INFO, "lackey '%s'",lackey);

	ensure_eq(0,chdir(argv[1])); // ehhhh
	
  dolock();

	mkfifo("incoming",0644); // not a directory anymore

	// we're opening our pipe for writing, so that it doesn't go into an EOF spin loop
	// when there are no more writers
	int incoming = open("incoming",O_RDWR|O_NONBLOCK);

	/* block the signals we care about
		 this does NOT ignore them, but queues them up
		 and interrupts stuff like ppoll (which reenables getting hit by those signals atomically)
		 then we can read info off the signalfd at our leisure, with no signal handler jammed in-between
		 an if(numworkers == 0) and start_worker();
	*/

	waiter_setup();

	assert(0 == numworkers);
	pfd = malloc(sizeof(*pfd)*2);

	pfd[INCOMING].fd = incoming;
	pfd[INCOMING].events = POLLIN;

	pfd[ACCEPTING].fd = start_working(true);
	pfd[ACCEPTING].events = POLLIN;

	void clear_incoming(void) {
		char buf[512];
		for(;;) {
			ssize_t amt = read(incoming,buf,512);
			if(amt <= 0) {
				ensure_eq(errno,EAGAIN);
				break;
			}
		}
		record(INFO,"Incoming fifo unclogged");
	}