Re: error--> (error "unknown font type" "Xft")
- From: Teika Kazura <teika lavabit com>
- To: sawfish-list gnome org
- Subject: Re: error--> (error "unknown font type" "Xft")
- Date: Sat, 06 Jun 2009 13:52:37 +0900 (JST)
Hi, Petter. Please try the attached patch.
I confirmed that thrown signal breaks sawfish. So I introduced an
optional argument in get-font-typed which suppresses signal. When
non-nil, it just returns nil.
Once sawfish starts, then (get-font-typed "foo" "bar") sends an error
signal, but all happens is that it prints the error message, as
expected.
To Chris:
If this patch is ok, I'll write the doc, so please wait to commit to
git repo.
Good luck,
Teika (Teika kazura)
diff --git a/src/fonts.c b/src/fonts.c
index 7914e84..9e851d4 100644
--- a/src/fonts.c
+++ b/src/fonts.c
@@ -607,7 +607,7 @@ loaded.
}
DEFUN("get-font-typed", Fget_font_typed, Sget_font_typed,
- (repv type, repv name), rep_Subr2) /*
+ (repv type, repv name, repv noError), rep_Subr3) /*
::doc:sawfish.wm.fonts#get-font-typed::
get-font-typed TYPE NAME
@@ -661,8 +661,12 @@ interpreted based on the value of the string TYPE.
if (class == 0)
{
+ if (noError == Qnil){
DEFSTRING (err, "unknown font type");
return Fsignal (Qerror, rep_list_2 (rep_VAL (&err), type));
+ }else{
+ return Qnil;
+ }
}
f = rep_ALLOC_CELL(sizeof(Lisp_Font));
@@ -675,10 +679,14 @@ interpreted based on the value of the string TYPE.
if (!(*class->load) (f))
{
- DEFSTRING (err, "unknown font");
-
rep_FREE_CELL (f);
- return Fsignal (Qerror, rep_list_2 (rep_VAL (&err), name));
+
+ if(noError == Qnil){
+ DEFSTRING (err, "unknown font");
+ return Fsignal (Qerror, rep_list_2 (rep_VAL (&err), name));
+ }else{
+ return Qnil;
+ }
}
rep_data_after_gc += sizeof (Lisp_Font);
@@ -699,7 +707,7 @@ font specifier string).
{
DEFSTRING (type, "xlfd");
- return Fget_font_typed (rep_VAL (&type), name);
+ return Fget_font_typed (rep_VAL (&type), name, Qnil);
}
DEFUN("font-get", Ffont_get, Sfont_get, (repv win, repv prop), rep_Subr2) /*
@@ -953,19 +961,22 @@ fonts_init (void)
{
#ifdef HAVE_PANGO
font = Fget_font_typed (rep_VAL (&pango_type),
- rep_VAL (&pango_name));
+ rep_VAL (&pango_name),
+ Qt);
if (font == rep_NULL || !FONTP (font))
#endif
{
font = Fget_font_typed (rep_VAL (&xft_type),
- rep_VAL (&xft_name));
+ rep_VAL (&xft_name),
+ Qt);
}
}
if (font == rep_NULL || !FONTP (font))
{
font = Fget_font_typed (rep_VAL (&xlfd_type),
- rep_VAL (&xlfd_name));
+ rep_VAL (&xlfd_name),
+ Qt);
}
if (font == rep_NULL || !FONTP(font))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]