예제 #1
0
ASFlagType DigestWinListAlign( WinListConfig *Config, ASFlagType align )
{
	LOCAL_DEBUG_OUT( "Align = 0x%8.8lx, IconAlign = 0x%8.8lx, Location = %d", align, Config->IconAlign, Config->IconLocation );

	if( !get_flags( Config->set_flags, WINLIST_IconLocation ) )
	{
		if( get_flags(align, PAD_H_MASK) == ALIGN_RIGHT ) 
			Config->IconLocation = 6 ; 
		else if( get_flags(align, PAD_H_MASK) == ALIGN_LEFT ) 
			Config->IconLocation = 4 ; 
	}		
	if( !get_flags( Config->set_flags, WINLIST_IconAlign ) )
	{
		if( get_flags(align, PAD_H_MASK) == PAD_H_MASK )
		{
			if( Config->IconLocation == 0 || Config->IconLocation == 4  )
			{
				Config->IconAlign = ALIGN_RIGHT ; 
				align = (align&(~PAD_H_MASK))|ALIGN_LEFT ; 
			}else if( Config->IconLocation == 6  )
			{
				Config->IconAlign = ALIGN_LEFT ; 
				align = (align&(~PAD_H_MASK))|ALIGN_RIGHT ; 
			}
		}else if( get_flags(align, PAD_H_MASK) == ALIGN_LEFT && (Config->IconLocation == 0 || Config->IconLocation == 4) )
			Config->IconAlign = ALIGN_VCENTER ;
		else if( get_flags(align, PAD_H_MASK) == ALIGN_RIGHT && Config->IconLocation == 6 )
			Config->IconAlign = ALIGN_VCENTER ;
	}
	LOCAL_DEBUG_OUT( "Align = 0x%8.8lx, IconAlign = 0x%8.8lx, Location = %d", align, Config->IconAlign, Config->IconLocation );
	return align ;

}
예제 #2
0
Bool timer_delay_till_next_alarm (time_t * sec, time_t * usec)
{
	Timer        *timer;
	long         tsec, tusec = 0;

	if (timer_first == NULL)
		return False;

	tsec = 0x7fffffff;

	for (timer = timer_first; timer != NULL; timer = (*timer).next)
		if ((*timer).sec < tsec || ((*timer).sec == tsec && (*timer).usec <= tusec))
		{
			tsec = (*timer).sec;
			tusec = (*timer).usec;
		}

	timer_get_time (sec, usec);
	LOCAL_DEBUG_OUT( "next :  sec = %ld, usec = %ld( curr %ld, %ld)", tsec, tusec, *sec, *usec );
	timer_subtract_times (&tsec, &tusec, *sec, *usec);
	LOCAL_DEBUG_OUT( "waiting for sec = %ld, usec = %ld( curr %ld, %ld)", tsec, tusec, *sec, *usec );
	
	*sec = tsec;
	*usec = tusec;
	if (tsec < 0 || tusec < 0)
	{	
		*sec = 0 ; 
		*usec = 1;
	}
	return True;
}
예제 #3
0
static void
asgtk_imview_view_size_alloc (GtkWidget * widget,
															GtkAllocation * allocation,
															gpointer user_data)
{
	ASGtkImageView *iv = ASGTK_IMAGE_VIEW (user_data);
	int view_w, view_h;
	int w = allocation->width - 4;
	int h = allocation->height - 4;

	(void) view_w;
	(void) view_h;
	view_w = GTK_WIDGET (iv->view)->requisition.width;
	view_h = GTK_WIDGET (iv->view)->requisition.height;

	LOCAL_DEBUG_OUT ("####!!! SizeAlloc for %p is %dx%d%+d%+d", widget,
									 allocation->width, allocation->height, allocation->x,
									 allocation->y);
	LOCAL_DEBUG_OUT ("####!!! recquisition was %dx%d",
									 widget->requisition.width, widget->requisition.height);
	LOCAL_DEBUG_OUT ("####!!! view size is     %dx%d", iv->view_width,
									 iv->view_height);

#if 1														/* if size changed - refresh */
	if (iv->view_width != w || iv->view_height != h) {
		iv->view_width = w;
		iv->view_height = h;
		display_image_view (iv);
	}
#endif
}
예제 #4
0
void
ASCloseOnExec()
{
LOCAL_DEBUG_OUT( "pid(%d),shutting down modukes...", getpid() );
    ShutdownModules(True);
LOCAL_DEBUG_OUT( "pid(%d),closing x_fd...", getpid() );
    if( x_fd )
        close(x_fd);
LOCAL_DEBUG_OUT( "pid(%d),complete...", getpid() );
}
예제 #5
0
파일: xmlproc.c 프로젝트: Remmy/afterstep
Bool 
convert_xml_file( const char *syntax_dir, const char *file, ASXMLInterpreterState *state )
{
	char *source_file ;
	char *doc_str ; 
	Bool empty_file = False ;
	
	source_file = make_file_name( syntax_dir, file );
	doc_str = load_file(source_file);
	LOCAL_DEBUG_OUT( "file %s loaded", source_file );
	/*LOCAL_DEBUG_OUT( "file %s loaded into {%s}", source_file, doc_str ); */
	if( doc_str != NULL )
	{
		xml_elem_t* doc;
		xml_elem_t* ptr;
		
		if( file[0] == '_' && !get_flags( state->flags, ASXMLI_ProcessingOptions )) 
			state->pre_options_size += strlen(doc_str) ;
		else
			set_flags( state->flags, ASXMLI_ProcessingOptions );

		doc = xml_parse_doc(doc_str, DocBookVocabulary);
		LOCAL_DEBUG_OUT( "file %s parsed, child is %p", source_file, doc->child );
		if( doc->child ) 
		{
			LOCAL_DEBUG_OUT( "child tag = \"%s\", childs child = %p", doc->child->tag, doc->child->child);
			empty_file  = ( doc->child->tag_id == DOCBOOK_section_ID && 
							doc->child->child == NULL );
			if( doc->child->child ) 
			{
				empty_file  = ( doc->child->child->tag_id == XML_CDATA_ID && doc->child->child->next == NULL ); 
				LOCAL_DEBUG_OUT( "childs child tag = \"%s\", parm = \"%s\"", doc->child->child->tag, doc->child->child->parm);
			}	 
	   	}	 
		LOCAL_DEBUG_OUT( "file %s %s", source_file, empty_file?"empty":"not empty" );
		if( !empty_file )
		{	
			for (ptr = doc->child ; ptr ; ptr = ptr->next) 
			{
				LOCAL_DEBUG_OUT( "converting child <%s>", ptr->tag );
	  			convert_xml_tag( ptr, NULL, state );
				LOCAL_DEBUG_OUT( "done converting child <%s>", ptr->tag );
			}
		}
		/* Delete the xml. */
		LOCAL_DEBUG_OUT( "deleting xml %p", doc );
		xml_elem_delete(NULL, doc);
		LOCAL_DEBUG_OUT( "freeing doc_str %p", doc_str );
		free( doc_str );		
	}	 	   
	LOCAL_DEBUG_OUT( "done with %s", source_file );
	free( source_file );
	fprintf( state->dest_fp, "\n" );
	return !empty_file;
}
예제 #6
0
action_t *get_action_by_name(const char *needle)
{
	int i;
	LOCAL_DEBUG_OUT("needle: %s", needle);

	for( i = 0; Actions[i].name != NULL; i++)
		if(mystrcasecmp(Actions[i].name, needle) == 0)
			return &Actions[i];
	LOCAL_DEBUG_OUT("get_action_by_name returns NULL");
	return NULL;
}
예제 #7
0
파일: main.c 프로젝트: Remmy/afterstep
void updateVolumeContents (ASVolume *v){
	int align = Config->Align, h_spacing = 1, v_spacing = 1;
	ASFlagType context_mask = 0;
	if (v->contents == NULL ) {
    v->contents = create_astbar ();
    v->contents->context = C_TITLE ;
  } else /* delete label if it was previously created : */
	  delete_astbar_tile (v->contents, -1 );

	if (!ASVolume_isRequestPending(v)) {
		if (ASVolume_isEjectable(v))
			set_flags (context_mask, EJECT_CONTEXT);
		if (ASVolume_isMounted(v))
			set_flags (context_mask, UNMOUNT_CONTEXT);
		else
			set_flags (context_mask, MOUNT_CONTEXT);
	}
	
	LOCAL_DEBUG_OUT ("volume %s context mask 0x%lx", v->name, context_mask);
  set_astbar_style_ptr (v->contents, -1, Scr.Look.MSWindow[ASVolume_isMounted(v)?BACK_UNFOCUSED:BACK_FOCUSED] );
  set_astbar_hilite (v->contents, BAR_STATE_FOCUSED, Config->MountedBevel);
  set_astbar_hilite (v->contents, BAR_STATE_UNFOCUSED, Config->UnmountedBevel);
  set_astbar_composition_method(v->contents, BAR_STATE_FOCUSED, TEXTURE_TRANSPIXMAP_ALPHA);
  set_astbar_composition_method(v->contents, BAR_STATE_UNFOCUSED, TEXTURE_TRANSPIXMAP_ALPHA);

	if (v->iconIm){

		safe_asimage_destroy (v->iconImScaled);
#if 0		
		v->iconImScaled = scale_asimage (Scr.asv, v->iconIm, AppState.tileWidth-5, AppState.tileHeight-5-(AppState.buttons[0]->height + 4), ASA_ASImage, 100, ASIMAGE_QUALITY_DEFAULT);
		add_astbar_icon(v->contents, 0, 0, False, 0, v->iconImScaled);
#else		
		v->iconImScaled = scale_asimage (Scr.asv, v->iconIm, AppState.tileWidth*2/3, (AppState.tileHeight-(AppState.buttons[0]->height + 4)), ASA_ASImage, 100, ASIMAGE_QUALITY_DEFAULT);
		add_astbar_icon(v->contents, 0, 0, False, ALIGN_CENTER, v->iconImScaled);
#endif		
	}
  add_astbar_label (v->contents, 0, 0, False, align|AS_TilePadRight, h_spacing, v_spacing, v->name, AS_Text_UTF8 );

	LOCAL_DEBUG_OUT ("mount_button.width = %d, mount_button.height = %d, image %dx%d", 
										AppState.buttons[0]->width, AppState.buttons[0]->height, 
	                  AppState.buttons[0]->pressed.image->width, AppState.buttons[0]->pressed.image->height);
	add_astbar_btnblock (v->contents, 0, 2, True, align, AppState.buttons, context_mask, BUTTONS_NUM, 2, 2, 5, 0);

	if (get_flags(Config->flags, ASMOUNT_ShowHints)) {
		char* hint = ASVolume_toString (v);
		set_astbar_balloon (v->contents, C_TITLE, hint, AS_Text_UTF8);	
		safefree(hint);
		set_astbar_balloon (v->contents, MOUNT_CONTEXT, "Mount volume", AS_Text_UTF8);	
		set_astbar_balloon (v->contents, EJECT_CONTEXT, "Eject drive", AS_Text_UTF8);	
		set_astbar_balloon (v->contents, UNMOUNT_CONTEXT, "Un-mount volume", AS_Text_UTF8);	
	}
}
예제 #8
0
파일: Audio.c 프로젝트: Remmy/afterstep
void
process_message (send_data_type type, send_data_type *body)
{
	time_t        now = 0;
	static time_t last_time = 0;
	int code = -1 ;
	
    LOCAL_DEBUG_OUT( "received message %lX", type );
		
	if( type == M_PLAY_SOUND ) 
	{
		CARD32 *pbuf = &(body[4]);
       	char *new_name = deserialize_string( &pbuf, NULL );
  		SetupSoundEntry( EVENT_PlaySound, new_name);
		free( new_name );
		code = EVENT_PlaySound ;
	}else if( (type&WINDOW_PACKET_MASK) != 0 )
	{
		struct ASWindowData *wd = fetch_window_by_id( body[0] );
		WindowPacketResult res ;
        /* saving relevant client info since handle_window_packet could destroy the actuall structure */
		ASFlagType old_state = wd?wd->state_flags:0 ; 
        show_activity( "message %lX window %X data %p", type, body[0], wd );
		res = handle_window_packet( type, body, &wd );
		LOCAL_DEBUG_OUT( "result = %d", res );
        if( res == WP_DataCreated )
		{	
			code = EVENT_WindowAdded ;
		}else if( res == WP_DataChanged )
		{	
			
		}else if( res == WP_DataDeleted )
        {
			code = EVENT_WindowDestroyed ;
        }
    }else if( type == M_NEW_DESKVIEWPORT )
    {
		code = EVENT_DeskViewportChanged ;
	}else if( type == M_NEW_CONFIG )
	{
	 	code = EVENT_Config ;
	}else if( type == M_NEW_MODULE_CONFIG )
	{
		code = EVENT_ModuleConfig ;
	}
    now = time (0);
	if( code >= 0 )
	    if ( now >= (last_time + (time_t) Config->delay))
			if( audio_play ( code ) )
    	    	last_time = now;
}
예제 #9
0
파일: xmlproc.c 프로젝트: Remmy/afterstep
void
add_glossary_item( xml_elem_t* doc, ASXMLInterpreterState *state )
{	   
	xml_elem_t *cdata = find_tag_by_id( doc->child, XML_CDATA_ID );
	char *term_text = mystrdup(cdata?cdata->parm:"") ;
	char *orig_term_text = term_text ;
	int i ; 

	LOCAL_DEBUG_OUT( "term_text = \"%s\"", term_text );
	while(*term_text)
	{	
		if( isalnum(*term_text) )
			break;
		++term_text ;
	}
	i = 0 ;
	while( isalnum(term_text[i]) ) ++i ;
	term_text[i] = '\0' ;

	if( term_text[0] != '\0' ) /* need to add glossary term */
	{
	 	char *target = NULL, *target2 ;
		char *term = NULL, *term2 ;
		char *ptr = &(state->dest_file[strlen(state->dest_file)-4]);
		if( state->doc_type == DocType_PHP && *ptr == '.')
			*ptr = '\0' ;
		target = safemalloc( strlen( state->dest_file)+5+1+strlen(state->curr_url_anchor)+1);
		sprintf( target, "%s#%s", state->dest_file, state->curr_url_anchor );
		if( state->doc_type == DocType_PHP && *ptr == '\0' )
			*ptr = '.' ;
		
		target2 = mystrdup(target);
		term2 = mystrdup(term_text);
		if( add_hash_item( Links, AS_HASHABLE(term2), (void*)target2 ) != ASH_Success ) 
		{
			free( target2 );
			free( term2 );	   
		}	 
		term = safemalloc( strlen( term_text)+ 1 + 1 +strlen( state->doc_name ) + 1 +1 );
		sprintf( term, "%s (%s)", term_text, state->doc_name );
		LOCAL_DEBUG_OUT( "term = \"%s\"", term );				   
		if( add_hash_item( Glossary, AS_HASHABLE(term), (void*)target ) != ASH_Success ) 
		{
			free( target );
			free( term );	   
		}
	}	 
	
	free(orig_term_text);
}
예제 #10
0
void asgtk_image_view_refresh (ASGtkImageView * iv, Bool reload_file)
{
	g_return_if_fail (ASGTK_IS_IMAGE_VIEW (iv));
	if (iv->image_entry) {

		if (reload_file && iv->image_entry->type <= ASIT_Supported) {
			if (iv->image_entry->preview) {
				safe_asimage_destroy (iv->image_entry->preview);
				iv->image_entry->preview = NULL;
			}
			/* show empty screen while loading background for now : */
			display_image_view (iv);

			LOCAL_DEBUG_OUT ("imman = %p, fullname = \"%s\"",
											 get_screen_image_manager (NULL),
											 iv->image_entry->fullfilename);
			iv->image_entry->preview =
					get_asimage (get_screen_image_manager (NULL),
											 iv->image_entry->fullfilename, 0xffffffff, 100);
			LOCAL_DEBUG_OUT (" ASGtk image view loaded image %p",
											 iv->image_entry->preview);

		}


		if (iv->image_entry->preview) {
			Bool ratio_changed = False;
			char *details_text;

			details_text =
					format_asimage_list_entry_details (iv->image_entry,
																						 GTK_IS_VBUTTON_BOX (iv->
																																 details_hbox));
			gtk_label_set_text (GTK_LABEL (iv->details_label), details_text);
			free (details_text);

			if (iv->aspect_x <= 0 || iv->aspect_y <= 0)
				ratio_changed = set_aspect_ratio_from_image (iv);
			LOCAL_DEBUG_OUT (" ASGtk image view refreshing image %p",
											 iv->image_entry->preview);
			/* redisplay */
			if (!ratio_changed)
				display_image_view (iv);
			else
				gtk_image_set_from_stock (GTK_IMAGE (iv->view),
																	GTK_STOCK_MISSING_IMAGE,
																	GTK_ICON_SIZE_BUTTON);
		}
	}
}
예제 #11
0
ASFlagType
ParseAlignOptions( FreeStorageElem * options )
{
    ASFlagType align = 0 ;
    while( options )
	{
        LOCAL_DEBUG_OUT( "options(%p)->keyword(\"%s\")", options, options->term->keyword );
        if (options->term != NULL)
		{
			switch( options->term->id )
			{
				case ALIGN_Center_ID :
					set_flags( align, ALIGN_CENTER );
				    break ;
				case ALIGN_HCenter_ID :
					set_flags( align, ALIGN_HCENTER );
				    break ;
				case ALIGN_VCenter_ID :
					set_flags( align, ALIGN_VCENTER );
				    break ;
				default:
            		ReadFlagItem (NULL, &align, options, AlignFlagsXref);
			}
		}
        options = options->next;
    }
    return align;
}
예제 #12
0
파일: xmlproc.c 프로젝트: Remmy/afterstep
int 
check_xml_contents( const char *syntax_dir, const char *file )
{
	char *source_file ;
	char *doc_str ; 
	int size = 0 ;
	
	source_file = make_file_name( syntax_dir, file );
	doc_str = load_file(source_file);
	if( doc_str != NULL )
	{
		xml_elem_t* doc;
		size = strlen( doc_str );
		doc = xml_parse_doc(doc_str, DocBookVocabulary);
		if( doc->child ) 
		{
			if( doc->child->tag_id == DOCBOOK_section_ID && doc->child->child == NULL )
				size = 0 ;
			else if( doc->child->child ) 
			{
				if( doc->child->child->tag_id == XML_CDATA_ID && doc->child->child->next == NULL )
					size = 0;
			}	 
		}	 
		/* Delete the xml. */
		LOCAL_DEBUG_OUT( "xml_elem_delete for doc %p", doc );
		xml_elem_delete(NULL, doc);
		free( doc_str );		
	}	 	   
	free( source_file );
	return size;
}
예제 #13
0
파일: Ident.c 프로젝트: Remmy/afterstep
/**********************************************************************
 * If no application window was indicated on the command line, prompt
 * the user to select one
 *********************************************************************/
Window
get_target_window ()
{
	XEvent eventp;
	int val = -10, trials;
	Window target = None;

	trials = 0;
	while ((trials < 100) && (val != GrabSuccess))
    {
		val = XGrabPointer (dpy, Scr.Root, True,
				  		   	ButtonReleaseMask,
			  				GrabModeAsync, GrabModeAsync, Scr.Root,
			  				XCreateFontCursor (dpy, XC_crosshair),
			  				CurrentTime);
      	if( val != GrabSuccess )
			sleep_a_little (100);
		trials++;
    }
  	if (val != GrabSuccess)
    {
    	show_error( "Couldn't grab the cursor!\n", MyName);
      	DeadPipe(0);
    }
  	XMaskEvent (dpy, ButtonReleaseMask, &eventp);
  	XUngrabPointer (dpy, CurrentTime);
  	ASSync(0);
  	target = eventp.xbutton.window;
	LOCAL_DEBUG_OUT( "window = %lX, root = %lX, subwindow = %lX", 
					 eventp.xbutton.window, eventp.xbutton.root, eventp.xbutton.subwindow );
  	if( eventp.xbutton.subwindow != None )
    	target = eventp.xbutton.subwindow;
	return target;
}
예제 #14
0
파일: Ident.c 프로젝트: Remmy/afterstep
void
process_message (send_data_type type, send_data_type *body)
{
    LOCAL_DEBUG_OUT( "received message %lX", type );
	if( type == M_END_WINDOWLIST )
	{
		fill_window_data();
		display_window_data();
	}else if( (type&WINDOW_PACKET_MASK) != 0 )
	{
		struct ASWindowData *wd = fetch_window_by_id( body[0] );
        WindowPacketResult res ;

		show_progress( "message %X window %X data %p", type, body[0], wd );
		res = handle_window_packet( type, body, &wd );
		if( res == WP_DataCreated )
        {
			/* we may need to translate frame window into client window, 
			 * as Window Data is hashed by client, and get_target_window 
			 * return the frame */
			if( wd->frame == MyArgs.src_window )
				MyArgs.src_window = wd->client ;
        }else if( res == WP_DataChanged )
		{	
		}else if( res == WP_DataDeleted )
		{	
		}
	}
}
예제 #15
0
파일: main.c 프로젝트: Remmy/afterstep
void ASVolume_parseGnomeIconString (ASVolume *v)
{
	if (v) { 
		static char signature[] = ". GThemedIcon ";
		destroy_string (&(v->idString));

		if (v->icon) {
			ASImage *tmp = GIcon2ASImage (v->icon);
			gchar* str = g_icon_to_string (v->icon);

			show_activity ("volume added with icon \"%s\".", str);

			if (str) {
				if (strncmp (str, signature, sizeof(signature)-1) == 0)
					parse_token (&str [sizeof(signature)-1], &(v->idString));
				safefree (str);
			}

			if (tmp) {
				int l, t, r, b;
				get_asimage_closure (tmp, &l, &t, &r, &b, 10);
				v->iconIm = tile_asimage (Scr.asv, tmp, l, t, r+1-l, b+1-t, 0x4F7F7F7F, ASA_ASImage, 100, ASIMAGE_QUALITY_DEFAULT);
				safe_asimage_destroy (tmp);
			}					
		
			LOCAL_DEBUG_OUT ("Icon asim = %p", v->iconIm);
		}
		if (!v->idString)
			v->idString = mystrdup ("unknown");
	}
}
예제 #16
0
static void 
destroy_desktop_category( ASDesktopCategory **pdc )
{
	if( pdc ) 
	{
		ASDesktopCategory *dc = *pdc ;
		if( dc ) 
		{
			if( dc->name ) 
				free( dc->name );
			if( dc->index_name ) 
				free( dc->index_name );
			if( dc->entries )
			{	
				char **pe = PVECTOR_HEAD(char*,dc->entries);
				int i = PVECTOR_USED(dc->entries);
				while( --i >= 0 )
					if( pe[i] ) 
						free( pe[i] );
				destroy_asvector( &(dc->entries) );
			}
			LOCAL_DEBUG_OUT( "dc = %p, ref_count = %d", dc, dc->ref_count ) ;
			free( dc );
			*pdc = NULL ;
		}	 
	}
예제 #17
0
Bool timer_handle (void)
{
	Bool          success = False;
	Timer        *timer, *good_timer = NULL;
	time_t        sec, usec;

	timer_get_time (&sec, &usec);
	for (timer = timer_first; timer != NULL; timer = timer->next)
		if (timer->sec < sec || (timer->sec == sec && timer->usec <= usec))
		{  /* oldest event gets executed first ! */
			if( good_timer != NULL ) 
				if( good_timer->sec < timer->sec || (timer->sec == good_timer->sec && timer->usec > good_timer->usec ))
					continue;	   
			good_timer = timer ;
		}
	if (good_timer != NULL)
	{
		LOCAL_DEBUG_OUT( "handling task for sec = %ld, usec = %ld( curr %ld, %ld)", good_timer->sec, good_timer->usec, sec, usec );
		timer_extract (good_timer);
		good_timer->handler (good_timer->data);
		mytimer_delete (good_timer);
		success = True;
	}
	return success;
}
예제 #18
0
static int
match_int (ASDatabase * db, DBMatchType type)
{
	register ASDatabaseRecord *db_rec;
	register int  i = 0;
	int value = 0 ;

	for( i = 0 ; db->match_list[i] >= 0 ; ++i ) 
	{
		db_rec = get_asdb_record (db, db->match_list[i]);
		if (get_flags (db_rec->set_data_flags, type))
		{
			switch (type)
			{
			 case MATCH_Desk:		 	value = db_rec->desk; break;
			 case MATCH_layer:		 	value = db_rec->layer; break;
			 case MATCH_ViewportX:
				 LOCAL_DEBUG_OUT( "viewport_x = %d", db_rec->viewport_x );
				 value = db_rec->viewport_x;
				  break;
			 case MATCH_ViewportY:   	value = db_rec->viewport_y; break;
			 case MATCH_border_width: 	value = db_rec->border_width; break;
			 case MATCH_resize_width: 	value = db_rec->resize_width; break;
			 case MATCH_gravity:	 	value = db_rec->gravity; break;
			 case MATCH_window_opacity:	value = db_rec->window_opacity; break;
			 default:
				 break;
			}
		}
	}
	return value;
}
예제 #19
0
void
no_args_wrapper(ASWinCommandState *state, const char *action)
{
	LOCAL_DEBUG_OUT("no_args_wrapper called: %s", action);
	
	ascom_do(action, NULL);
}
예제 #20
0
파일: layout.c 프로젝트: Remmy/afterstep
void
get_layout_fixed_size( ASLayout *layout, CARD32 *fixed_width, CARD32 *fixed_height )
{
    int width = 0, height = 0;
    if( layout && layout->count > 0 )
    {
        if( fixed_width )
        {
			width = get_layout_fixed_width( layout, 0, layout->dim_x );
            if( width > 0 )
                width += layout->v_border + layout->v_border + layout->offset_east + layout->offset_west ;
        }
        if( fixed_height )
        {
            height = get_layout_fixed_height( layout, 0, layout->dim_y );
            if( height >0 )
                height += layout->h_border+ layout->h_border + layout->offset_north+ layout->offset_south ;
        }
    }
LOCAL_DEBUG_OUT( " layout %lX FIXED WIDTH is %d FIXED HEIGHT is %d", (unsigned long)layout, width, height );
    if( fixed_width )
        *fixed_width = width < 0 ? 0 : width ;
    if( fixed_height )
        *fixed_height = height < 0 ? 0 : height ;
}
예제 #21
0
파일: layout.c 프로젝트: Remmy/afterstep
static unsigned int
get_layout_fixed_height( ASLayout *layout, unsigned int start_row, unsigned int end_row )
{
    register int i ;
	unsigned int height = 0 ;

    for( i = start_row ; i < end_row ; i++ )
    {
        register ASLayoutElem *pelem = layout->rows[i];
        register int fh = 0 ;
        while ( pelem )
        {
            if( get_flags( pelem->flags, LF_FixedHeight ) )
			{
LOCAL_DEBUG_OUT( " layout %lX found item with fixed height %d at %dx%d", (unsigned long)layout, pelem->fixed_height, pelem->row, pelem->column );
                if( pelem->fixed_height+pelem->bw > fh )
                    fh = pelem->fixed_height+pelem->bw ;
			}
            pelem = pelem->right ;
        }
        if( fh > 0 )
            height += fh+layout->h_spacing ;
    }
    if( height >0 )
        height -= layout->h_spacing ;
	return height;
}
예제 #22
0
파일: layout.c 프로젝트: Remmy/afterstep
/* fixed size handling :                                              */
static unsigned int
get_layout_fixed_width( ASLayout *layout, unsigned int start_col, unsigned int end_col )
{
    register int i ;
	unsigned int width = 0 ;

    for( i = start_col ; i < end_col ; ++i )
    {
        register ASLayoutElem *pelem = layout->cols[i];
        register int fw = 0 ;
        while ( pelem )
        {
            if( get_flags( pelem->flags, LF_FixedWidth ) )
			{
                LOCAL_DEBUG_OUT( " layout %lX found item with fixed width %d at %dx%d",
                                    (unsigned long)layout, pelem->fixed_width, pelem->row, pelem->column );
                if( pelem->fixed_width+pelem->bw > fw )
                    fw = pelem->fixed_width+pelem->bw ;
            }
			pelem = pelem->below ;
        }
        if( fw > 0 )
            width += fw+layout->v_spacing ;
    }
    if( width > 0 )
        width -= (int)layout->v_spacing ;
	return width ;
}
예제 #23
0
ThemeConfig *
ParseThemeFile (const char *filename, char *myname)
{
	ThemeConfig *config ;
	ConfigData cd ;
    ConfigDef *ConfigReader;
    FreeStorageElem *Storage = NULL, *pCurr;
    ConfigItem item;

	cd.filename = filename ;
	ConfigReader = InitConfigReader (myname, &ThemeSyntax, CDT_Filename, cd, NULL);
	LOCAL_DEBUG_OUT( "ConfigReader is %p", ConfigReader );
    if (!ConfigReader)
        return NULL;

	config = safecalloc( 1, sizeof(ThemeConfig ) );

	PrintConfigReader (ConfigReader);
	ParseConfig (ConfigReader, &Storage);

	/* getting rid of all the crap first */
    StorageCleanUp (&Storage, &(config->more_stuff), CF_DISABLED_OPTION);

	for (pCurr = Storage; pCurr; pCurr = pCurr->next)
  	{
  	    if (pCurr->term == NULL)
			continue;
        if (!ReadConfigItem (&item, pCurr))
			continue;

        switch (pCurr->term->id)
		{
            case FEEL_Function_ID           :
                if( mystrncasecmp( item.data.string, THEME_INSTALL_FUNC_NAME, sizeof(THEME_INSTALL_FUNC_NAME))== 0 )
                {
                    if( config->install )
                        really_destroy_complex_func( config->install );
                     config->install = FreeStorage2ComplexFunction( pCurr, &item, NULL );
                }else if( mystrncasecmp( item.data.string, THEME_APPLY_FUNC_NAME, sizeof(THEME_APPLY_FUNC_NAME) )== 0 )
                {
                    if( config->apply )
                        really_destroy_complex_func( config->apply );
                    config->apply = FreeStorage2ComplexFunction( pCurr, &item, NULL );
                }
                break ;
          default:
				item.ok_to_free = 1;
		}
    }
	ReadConfigItem (&item, NULL);

	DestroyConfig (ConfigReader);
	DestroyFreeStorage (&Storage);

	return config;
}
예제 #24
0
파일: xutil.c 프로젝트: Remmy/afterstep
void
aftershow_set_string_property (AfterShowContext *ctx, Window w, Atom property, char *data)
{
    if (w != None && property != None && data)
	{
		LOCAL_DEBUG_OUT( "setting property %lX on %lX to \"%s\"", property, w, data );
        XChangeProperty (ctx->gui.x.dpy, w, property, XA_STRING, 8,
                         PropModeReplace, (unsigned char *)data, strlen (data));
    }
}
예제 #25
0
파일: module.c 프로젝트: Remmy/afterstep
/* SendCommand - send a preparsed AfterStep command : */
void SendCommand (FunctionData * pfunc, send_ID_type window)
{
	LOCAL_DEBUG_OUT ("sending command %p to the astep", pfunc);
	if (pfunc != NULL && as_module_out_buffer.fd >= 0) {
		send_module_msg_header (window, 0);
		send_module_msg_function (pfunc->func, pfunc->name, pfunc->text,
															pfunc->func_val, pfunc->unit_val);
		send_module_msg_tail ();
	}
}
예제 #26
0
void
change_desk_session_look (ASSession * session, int desk, struct MyLook *look)
{
#ifdef MYLOOK_HEADER_FILE_INCLUDED
	if (session && look )
	{
		ASDeskSession *d = NULL;
		MyLook *old_look ;

#ifdef DIFFERENTLOOKNFEELFOREACHDESKTOP
		if( IsValidDesk(desk) && session->overriding_look == NULL )
		{
			d = get_desk_session (session, desk);
			if( d->feel_file == NULL )
				d = session->defaults ;
		}
#endif
		if( d == NULL )
			d = session->defaults ;

		old_look = d->look ;
		d->look = look ;
LOCAL_DEBUG_OUT( "new look = %p, desk_session = %p (default is %p ), scr is %p ",
				  look, d, session->defaults, session->scr );
		if( !AS_ASSERT(session->scr) )
		{
			ScreenInfo *scr = session->scr ;

			if( d == session->defaults ||
				scr->DefaultLook == old_look )
			{
				MyLook *old_default_look = scr->DefaultLook ;
				scr->DefaultLook = look ;

				if( scr->OnDefaultLookChanged_hook )
					scr->OnDefaultLookChanged_hook( scr, old_default_look );

				/* There is a possibility for contention here, if DefaultLook was
				 * taken from session other then default one */
				if( old_default_look && old_default_look != old_look )
					mylook_destroy(&(old_default_look));
			}
		}
		if( session->on_look_changed_func )
		{
			session->on_look_changed_func( session->scr, desk, old_look );
			if( d->desk != desk )
				session->on_look_changed_func( session->scr, d->desk, old_look );
		}

		if ( old_look )
			mylook_destroy(&(old_look));
	}
#endif
}
예제 #27
0
void handle_ShmCompletion (ASEvent * event)
{
#ifdef XSHMIMAGE
	XShmCompletionEvent *sev = (XShmCompletionEvent *) & (event->x);

	LOCAL_DEBUG_OUT ("XSHMIMAGE> EVENT : offset   %ld(%lx), shmseg = %lx",
									 (long)sev->offset, (unsigned long)(sev->offset),
									 sev->shmseg);
	destroy_xshm_segment (sev->shmseg);
#endif													/* SHAPE */
}
예제 #28
0
void
send_to_desk_wrapper(ASWinCommandState *state, const char *action)
{
	send_to_desk_params p;
	p.desk = state->desk;
	
	LOCAL_DEBUG_OUT("send_to_desk_wrapper called: %s, desk = %d",
			action, p.desk);
	
	ascom_do(action, &p);
}
예제 #29
0
파일: main.c 프로젝트: Remmy/afterstep
Bool volumeByName(void *data, void *aux_data) {
  ASVolume *v = (ASVolume*)data;
	ASVolumeByName *adata = (ASVolumeByName*) aux_data;
	LOCAL_DEBUG_OUT ("name = \"%s\", volume_name = \"%s\"", 
	                  adata->name, v->name); 
  if (v->name && strcmp(v->name, adata->name) == 0) {
		adata->v = v;
		return False;
	}
  return True;
}
예제 #30
0
파일: main.c 프로젝트: Remmy/afterstep
void addTimeout()
{
	time_t sec, usec;
  if (timers_count <= 0 && timer_delay_till_next_alarm (&sec, &usec)){
		SHOW_CHECKPOINT;
		time_t tout = ((sec * 1000) + (usec / 1000))+100; 
		LOCAL_DEBUG_OUT ("timeout in %ld millisecs", tout);
		g_timeout_add (tout,(GSourceFunc)my_timer_handle, NULL);
		timers_count++;		
	}
}