Example #1
0
static int enter_graphics_mode_picasso (int which)
{
    int oldmode = current_vgamode;
    if (which == oldmode)
	return 1;

    vga_setmode (TEXT);
    if (vga_setmode (which) < 0) {
	sleep (1);
	vga_setmode (TEXT);
	write_log ("SVGAlib doesn't like my video mode (%d). Giving up.\n", which);
	exit (1);
    }
    current_vgamode = which;

    linear_mem = 0;
    if ((modeinfo.flags & CAPABLE_LINEAR) && ! currprefs.svga_no_linear) {
	int val = vga_setlinearaddressing ();
	if (val != -1) {
	    linear_mem = (char *)vga_getgraphmem ();
	    write_log ("Using linear addressing: %p.\n", linear_mem);
	}
    }

    keyboard_close ();
    mouse_close ();
    return post_enter_graphics ();
}
Example #2
0
adv_error mouseb_event_init(int mouseb_id)
{
	unsigned i;
	adv_bool eacces = 0;
	struct event_location map[EVENT_MOUSE_DEVICE_MAX];
	unsigned mac;

	log_std(("mouseb:event: mouseb_event_init(id:%d)\n", mouseb_id));

#if defined(USE_SVGALIB)
	/* close the SVGALIB mouse device. SVGALIB always call mouse_init(), also */
	/* if mouse input is not requested */
	if (os_internal_svgalib_get()) {
		mouse_close();
	}
#endif

	log_std(("mouseb:event: opening mouse from 0 to %d\n", EVENT_MOUSE_DEVICE_MAX));

	mac = event_locate(map, EVENT_MOUSE_DEVICE_MAX, &eacces);

	event_state.mac = 0;
	for(i=0;i<mac;++i) {
		int f;

		if (event_state.mac >= EVENT_MOUSE_MAX)
			continue;

		f = event_open(map[i].file, event_state.map[event_state.mac].evtype_bitmask, sizeof(event_state.map[event_state.mac].evtype_bitmask));
		if (f == -1) {
			if (errno == EACCES) {
				eacces = 1;
			}
			continue;
		}

		if (!event_is_mouse(f, event_state.map[event_state.mac].evtype_bitmask)) {
			log_std(("mouseb:event: not a mouse on device %s\n", map[i].file));
			event_close(f);
			continue;
		}

		if (mouseb_setup(&event_state.map[event_state.mac], f) != 0) {
			event_close(f);
			continue;
		}

		++event_state.mac;
	}

	if (!event_state.mac) {
		if (eacces)
			error_set("No mouse found. Check the /dev/input/event* permissions.\n");
		else
			error_set("No mouse found.\n");
		return -1;
	}

	return 0;
}
Example #3
0
static bool cm_init( init_mode install )
/**************************************/
{
    struct itimercb     timercb;
    struct _osinfo      osinfo;
    MOUSEORD            row;
    MOUSEORD            col;

    MouseInstalled = false;
    if( install != INIT_MOUSELESS ) {
        MouseCtrl = mouse_open( 0, 0, UIConHandle );
        if( MouseCtrl != 0 ) {
            timercb.itcb_event.evt_value = UIProxy;
            MouseTimer = mktimer( TIMEOFDAY, _TNOTIFY_PROXY, &timercb );
            if( MouseTimer == -1 ) {
                mouse_close( MouseCtrl );
            } else {
                MouseInstalled = true;

                qnx_osinfo( 0, &osinfo );
                _SysTime = (struct _timesel __far *)MK_FP( osinfo.timesel, 0 );

                UIData->mouse_xscale = 1;
                UIData->mouse_yscale = 1;

                checkmouse( &MouseStatus, &row, &col, &MouseTime );
                MouseRow = row;
                MouseCol = col;
                _stopmouse();
            }
        }
    }
    return( MouseInstalled );
}
Example #4
0
File: wgl.c Project: paud/d2x-xl
int wgl_game_activate(int active,int min){
	int i=0;//do_game_activate(active,min);
	if (!gameStates.ogl.bInitialized) return -1;
	//	printf("****** wgl_game_activate: %i %i,%i %i *******\n",GLPREF_windowed,active,min,vid_susp);
	if (!active){
		mouse_close();
		if (!GLPREF_windowed)
			if (!vid_susp){
				ChangeDisplaySettings(NULL,0);
				vid_susp=1;
			}
	}else{
		mouse_init(0);
		if (!GLPREF_windowed)
			if (vid_susp){
				ChangeDisplaySettings(&devmode,CDS_FULLSCREEN);
				ShowWindow(g_hWnd,SW_SHOWNORMAL);
				SetWindowPos(g_hWnd,HWND_TOPMOST,0,0,GLPREF_width,GLPREF_height,SWP_FRAMECHANGED);//if you don't set the pos, it comes up half off the screen, or just shows the desktop
				UpdateWindow(g_hWnd);
				wglMakeCurrent(NULL, NULL);
				wglMakeCurrent(hDC,GL_ResourceContext);//this seems to fix some glitches that appear when you alt-tab back in.
				vid_susp=0;
			}
	}
	//printf("****** -----------------: %i %i,%i %i *******\n",GLPREF_windowed,active,min,vid_susp);
	return i;
}
Example #5
0
static void mouse_int_handler (int signal)
{
	mouse_close();
	/* restore old interrupt */
	sigaction(SIGINT, &ms.oldsiga, NULL);
	raise(SIGINT);
}
Example #6
0
static void leave_graphics_mode (void)
{
    keyboard_close ();
    mouse_close ();
    sleep (1); /* Maybe this will fix the "screen full of garbage" problem */
    current_vgamode = TEXT;
    vga_setmode (TEXT);
}
Example #7
0
void
IN_Shutdown ( void )
{
	Con_Printf("IN_Shutdown\n");

	if (UseMouse) mouse_close();
	if (UseKeyboard) keyboard_close();
	in_svgalib_inited = 0;
}
Example #8
0
void I_ShutdownGraphics(void)
{
	keyboard_close();
	if (usemouse)
		mouse_close();

	if (vga_getcurrentmode() != TEXT)
		vga_setmode(TEXT);
}
Example #9
0
static bool cm_fini( void )
/*************************/
{
    if( MouseInstalled ) {
        uioffmouse();
        mouse_close( MouseCtrl );
        rmtimer( MouseTimer );
    }
    return( false );
}
Example #10
0
void os_inner_done(void)
{
	log_std(("os: os_inner_done\n"));

#ifdef USE_X
	if (OS.x_display) {
		log_std(("os: XCloseDisplay()\n"));
		OS.curses_active = 0;
		XCloseDisplay(OS.x_display);
	}
#endif
#ifdef USE_CURSES
	if (OS.curses_active) {
		log_std(("os: endwin()\n"));
		OS.curses_active = 0;
		endwin();
	}
#endif
#ifdef USE_SLANG
	if (OS.slang_active) {
		log_std(("os: SLsmg_reset_smg()\n"));
		OS.slang_active = 0;
		SLsmg_reset_smg();
	}
#endif
#ifdef USE_SDL
	if (OS.sdl_active) {
		log_std(("os: SDL_Quit()\n"));
		OS.sdl_active = 0;
		SDL_Quit();
	}
#endif
#ifdef USE_SVGALIB
	if (OS.svgalib_active) {
		OS.svgalib_active = 0;
		mouse_close(); /* always called */
	}
#endif

	/* restore term */
	if (OS.term_active) {
		log_std(("os: tcsetattr(%sICANON %sECHO)\n", (OS.term.c_lflag & ICANON) ? "" : "~", (OS.term.c_lflag & ECHO) ? "" : "~"));
		OS.term_active = 0;
		if (tcsetattr(fileno(stdin), TCSAFLUSH, &OS.term) != 0) {
			/* ignore error */
			log_std(("os: tcsetattr(TCSAFLUSH) failed\n"));
		}
	}

	log_std(("os: os_inner_done completed\n"));
}
Example #11
0
void IN_Shutdown(void)
{
//#if defined  (_Soft_X11) || defined (_Soft_SVGA)

#ifdef _Soft_SVGA
	if (mouseinitialized)
		mouse_close();
#endif

#ifdef GLQUAKE
  IN_DeactivateMouse(); // btw we trying de init this in video shutdown too...
#endif

	mouseinitialized = false;

//#endif
}
Example #12
0
adv_error mouseb_raw_init(int mouseb_id)
{
	unsigned i;
	adv_bool eacces = 0;

	log_std(("mouseb:raw: mouseb_raw_init(id:%d)\n", mouseb_id));

#if defined(USE_SVGALIB)
	/* close the SVGALIB mouse device. SVGALIB always call mouse_init(), also */
	/* if mouse input is not requested */
	if (os_internal_svgalib_get()) {
		mouse_close();
	}
#endif

	raw_state.mac = 0;
	for (i = 0; i < RAW_MOUSE_MAX; ++i) {
		if (raw_mouse_init(&raw_state.map[i].context) == 0) {
			log_std(("mouseb:raw: open device %s\n", raw_state.map[i].context.dev));

			mouseb_setup(&raw_state.map[i]);

			raw_state.map[i].active_flag = 1;
			raw_state.mac = i + 1;
		} else {
			if (errno != ENODEV) {
				log_std(("ERROR:mouseb:raw: error opening device %s, errno %d (%s)\n", raw_state.map[i].context.dev, errno, strerror(errno)));
			}
			if (errno == EACCES) {
				eacces = 1;
			}
			raw_state.map[i].active_flag = 0;
		}
	}

	if (raw_state.mac == 0) {
		if (eacces)
			error_set("No mouse found. Check the /dev/mouse and /dev/input/mouse* permissions.\n");
		else
			error_set("No mouse found.\n");
		return -1;
	}

	return 0;
}
Example #13
0
static void arch_close(void)
{
	songs_uninit();

	gr_close();

	if (!GameArg.CtlNoJoystick)
		joy_close();

	mouse_close();

	if (!GameArg.SndNoSound)
	{
		digi_close();
	}

	key_close();

	SDL_Quit();
}
Example #14
0
File: wgl.c Project: paud/d2x-xl
void OglDestroyWindow(void){
	if (gameStates.ogl.bInitialized){
		OglSmashTextureListInternal();
		if (mouse_hidden){
			ShowCursor(TRUE);
			mouse_hidden = 0;
		}
		if (g_hWnd){
			key_close();
			mouse_close();
			joy_close();
			if (!FindArg( "-nosound" ))
				DigiClose();
			OpenGL_Shutdown();
			DestroyWindow(g_hWnd);
		}else
			Error("OglDestroyWindow: no g_hWnd?\n");
		gameStates.ogl.bInitialized=0;
	}
	return;
}
Example #15
0
int main(int argc, const char *argv[])
{
    FBDEV fbdev;
    MOUSE mouse;
    int err;


    /*open fb*/
    err = fb_init(&fbdev, NULL);
    if(FALSE == err)
    {
        return -1;
    };

    thr_mouse(NULL, &fbdev, &mouse);

    /*destroy*/
    fb_close(&fbdev);
    mouse_close(&mouse);

    return 0;
}
Example #16
0
int
lincity_main (int argc, char *argv[])
{
#if defined (LC_X11)
    char *geometry = NULL;
#endif

#if defined (SVGALIB)
    int q;
    vga_init ();
#endif

#if !defined (WIN32)
    signal (SIGPIPE, SIG_IGN);    /* broken pipes are ignored. */
#endif

    /* Initialize some global variables */
    make_dir_ok_flag = 1;
    main_screen_originx = 1;
    main_screen_originy = 1;
    given_scene[0] = 0;
    quit_flag = network_flag = load_flag = save_flag 
	    = prefs_flag = cheat_flag = monument_bul_flag
	    = river_bul_flag = shanty_bul_flag;
    prefs_drawn_flag = 0;
    kmouse_val = 8;

#ifdef LC_X11
    borderx = 0;
    bordery = 0;
    parse_xargs (argc, argv, &geometry);
#endif

    /* I18n */
    lincity_set_locale ();

    /* Set up the paths to certain files and directories */
    init_path_strings ();

    /* Make sure that things are installed where they should be */
    verify_package ();

    /* Make sure the save directory exists */
    check_savedir ();

    /* Load preferences */
    load_lincityrc ();

#ifndef CS_PROFILE
#ifdef SEED_RAND
    srand (time (0));
#endif
#endif

#ifdef LC_X11
#if defined (commentout)
    borderx = 0;
    bordery = 0;
    parse_xargs (argc, argv, &geometry);
#endif
    Create_Window (geometry);
    pirate_cursor = XCreateFontCursor (display.dpy, XC_pirate);
#elif defined (WIN32)
    /* Deal with all outstanding messages */
    ProcessPendingEvents ();
#else
    parse_args (argc, argv);
    q = vga_setmode (G640x480x256);
    gl_setcontextvga (G640x480x256);
#endif

#if defined (WIN32) || defined (LC_X11)
    initialize_pixmap ();
#endif

    init_fonts ();

#if defined (SKIP_OPENING_SCENE)
    skip_splash_screen = 1;
#endif
    if (!skip_splash_screen) {
	load_start_image ();
    }

#ifdef LC_X11
    unlock_window_size ();
#endif

    Fgl_setfont (8, 8, main_font);
    Fgl_setfontcolors (TEXT_BG_COLOUR, TEXT_FG_COLOUR);

    initialize_geometry (&scr);

#if defined (SVGALIB)
    set_vga_mode ();
#endif

    initialize_monthgraph ();
    init_mouse_registry ();
    init_mini_map_mouse ();

#ifdef LC_X11
    x_key_value = 0;
#elif defined (WIN32)
    RefreshScreen ();
#endif
    setcustompalette ();
    draw_background ();
    prog_box (_("Loading the game"), 1);
    init_types ();
    init_modules();
    init_mappoint_array ();
    initialize_tax_rates ();
    prog_box ("", 95);
    mouse_hide_count = 0;
    suppress_ok_buttons = 0;
    prog_box ("", 100);
#ifdef USE_PIXMAPS
    prog_box (_("Creating pixmaps"), 1);
    init_pixmaps ();
    prog_box ("", 100);
#endif
    //draw_normal_mouse (1, 1);
#if defined (LC_X11)
    init_x_mouse ();
#endif
    init_timer_buttons();
    mouse_initialized = 1;
    //set_selected_module (CST_TRACK_LR);
    screen_setup ();

    /* Main loop! */
    client_main_loop ();

#if defined (SVGALIB)
    mouse_close ();
    vga_setmode (TEXT);
#endif

    print_results ();

#if defined (WIN32) || defined (LC_X11)
    free_pixmap ();
#endif

#if defined (WIN32)
    return 0;
#else
    exit (0);
#endif
}
Example #17
0
void RW_IN_Shutdown(void)
{
	mouse_close();
}