コード例 #1
0
ファイル: lemipc.c プロジェクト: kefranabg/LemiPC
static int		lemipc_bsc(int no_team, char *path)
{
  t_lemipc		lemipc;

  if (no_team < 1 || no_team > 255)
    return (lemipc_error(NO_TEAM_ERROR));
  if ((lemipc.key = ftok(path, 0)) == -1)
    return (lemipc_perror(FTOK_ERROR));
  lemipc.no_team = no_team;
  lemipc.pos = -1;
  lemipc.killed_by = 0;
  lemipc.is_alone = TRUE;
  lemipc.is_dead = FALSE;
  if (get_shm(&lemipc) == EXIT_FAILURE ||
      get_sem(&lemipc) == EXIT_FAILURE ||
      get_msgq(&lemipc) == EXIT_FAILURE ||
      launch_player(&lemipc) == EXIT_FAILURE)
    return (EXIT_FAILURE);
  return (EXIT_SUCCESS);
}
コード例 #2
0
ファイル: lnxmplayer.cpp プロジェクト: alilloyd/livecode
bool MPlayer::init(const char * p_filename, MCStack *p_stack, MCRectangle p_rect )
{
	
	// Are we already running a movie? If we are, then stop.
	if ( m_window != DNULL && m_filename != NULL )
		quit();
	
	GdkWindow* w ;
	if ( p_stack == NULL )
		return false ;
	
	// Locate the window for the stack
	GdkWindow* stack_window = p_stack->getwindow();
	if ( stack_window == DNULL)
		return false ;
	
    GdkWindowAttr t_wa;
    t_wa.colormap = ((MCScreenDC*)MCscreen)->getcmapnative();
    t_wa.x = p_rect.x;
    t_wa.y = p_rect.y;
    t_wa.width = p_rect.width;
    t_wa.height = p_rect.height;
    t_wa.event_mask = 0;
    t_wa.wclass = GDK_INPUT_OUTPUT;
    t_wa.visual = ((MCScreenDC*)MCscreen)->getvisual();
    t_wa.window_type = GDK_WINDOW_CHILD;
    
    w = gdk_window_new(stack_window, &t_wa, GDK_WA_X|GDK_WA_Y|GDK_WA_VISUAL);
	
	if ( w == DNULL )
		return False;
	
	// Set-up our hints so that we have NO window decorations.
    gdk_window_set_decorations(w, GdkWMDecoration(0));
	
	// Ensure the newly created window stays above the stack window & map ( show )
    gdk_window_set_transient_for(w, stack_window);
    gdk_window_show_unraised(w);
	
	m_window = w ;
	MClastvideowindow = w ;
	
	if ( m_filename == NULL ) 
		m_filename = strdup(p_filename) ;
	m_player_rect = p_rect ;
	m_stack = p_stack ;

	if ( !launch_player() )
	{
		gdk_window_hide(m_window);
        gdk_window_destroy(m_window);
		m_window = DNULL;
		MClastvideowindow = DNULL ;
		return false;
	}

	// We will be playing at start by default, so mark it as such
	m_playing = true ;
	// Start the media stopped
	pause();

	return true ;
}
コード例 #3
0
ファイル: lnxmplayer.cpp プロジェクト: Bjoernke/livecode
bool MPlayer::init( char * p_filename, MCStack *p_stack, MCRectangle p_rect )
{
	
	// Are we already running a movie? If we are, then stop.
	if ( m_window != DNULL && m_filename != NULL )
		quit();
	
	Window w ;
	if ( p_stack == NULL )
		return false ;
	
	// Locate the window for the stack
	Window stack_window = p_stack->getwindow();
	if ( stack_window == DNULL)
		return false ;
	
	
	// Create a new window
	XSetWindowAttributes xswa;
	unsigned long xswamask = CWBorderPixel | CWColormap;
	xswa.border_pixel = 0;
	xswa.colormap = ((MCScreenDC *)MCscreen) -> getcmapnative() ; 

	w = XCreateWindow(MCdpy, stack_window, 
					  p_rect . x,
					  p_rect . y,
					  p_rect . width,
					  p_rect . height ,
					  0, ((MCScreenDC *)MCscreen)->getrealdepth(), InputOutput,
					  ((MCScreenDC *)MCscreen)-> getvisnative() ->visual,
	                  xswamask, &xswa);
	
	if ( w == DNULL )
		return False;
	
	
	// Set-up our hints so that we have NO window decorations.
	MwmHints mwmhints;
	mwmhints.flags	= MWM_HINTS_DECORATIONS ;
	mwmhints.decorations = 0 ;
	XChangeProperty(MCdpy, w, MCmwmhintsatom, MCmwmhintsatom, 32,
	                PropModeReplace, (unsigned char *)&mwmhints,
	                sizeof(mwmhints) / 4);

	
	// Ensure the newly created window stays above the stack window & map ( show ) 
	XSetTransientForHint(MCdpy, w, stack_window);
	XMapWindow(MCdpy, w);
	
	m_window = w ;
	MClastvideowindow = w ;
	
	if ( m_filename == NULL ) 
		m_filename = strdup(p_filename) ;
	m_player_rect = p_rect ;
	m_stack = p_stack ;

	if ( !launch_player() )
	{
		XUnmapWindow (MCdpy, m_window);
		XDestroyWindow (MCdpy, m_window);
		m_window = DNULL;
		MClastvideowindow = DNULL ;
		return false;
	}

	// We will be playing at start by default, so mark it as such
	m_playing = true ;
	// Start the media stopped
	pause();

	return true ;
}