Index: fvwm/style.c =================================================================== --- fvwm/style.c (revision 6) +++ fvwm/style.c (revision 7) @@ -419,6 +419,22 @@ *merged_style, SGET_WINDOW_FONT(*add_style)); } } + if (S_HAS_INACTIVE_WINDOW_FONT(SCF(*add_style))) + { + if (do_free_src_and_alloc_copy) + { + SAFEFREE(SGET_INACTIVE_WINDOW_FONT(*merged_style)); + SSET_INACTIVE_WINDOW_FONT( + *merged_style, (SGET_INACTIVE_WINDOW_FONT(*add_style)) ? + safestrdup(SGET_INACTIVE_WINDOW_FONT(*add_style)) : + NULL); + } + else + { + SSET_INACTIVE_WINDOW_FONT( + *merged_style, SGET_INACTIVE_WINDOW_FONT(*add_style)); + } + } if (add_style->flags.use_start_on_desk) { SSET_START_DESK(*merged_style, SGET_START_DESK(*add_style)); @@ -894,6 +910,10 @@ { SAFEFREE(SGET_WINDOW_FONT(*style)); } + if (pmask->common.has_inactive_window_font) + { + SAFEFREE(SGET_INACTIVE_WINDOW_FONT(*style)); + } if (pmask->has_icon) { SAFEFREE(SGET_ICON_NAME(*style)); @@ -3288,6 +3308,15 @@ S_SET_IS_UNICONIFIABLE(SCM(*ps), 1); S_SET_IS_UNICONIFIABLE(SCC(*ps), 1); } + else if (StrEquals(token, "InactiveFont")) + { + SAFEFREE(SGET_INACTIVE_WINDOW_FONT(*ps)); + rest = GetNextToken(rest, &token); + SSET_INACTIVE_WINDOW_FONT(*ps, token); + S_SET_HAS_INACTIVE_WINDOW_FONT(SCF(*ps), (token != NULL)); + S_SET_HAS_INACTIVE_WINDOW_FONT(SCM(*ps), 1); + S_SET_HAS_INACTIVE_WINDOW_FONT(SCC(*ps), 1); + } else if (StrEquals(token, "IndexedWindowName")) { S_SET_USE_INDEXED_WINDOW_NAME(SCF(*ps), on); @@ -5123,6 +5152,12 @@ flags->do_update_window_font = 1; } + /* has_inactive_window_font */ + if (S_HAS_INACTIVE_WINDOW_FONT(SCC(*ret_style))) + { + flags->do_update_window_font = True; + } + /* has_stippled_title */ if (S_HAS_STIPPLED_TITLE(SCC(*ret_style)) || S_HAS_NO_STICKY_STIPPLED_TITLE(SCC(*ret_style)) || Index: fvwm/style.h =================================================================== --- fvwm/style.h (revision 6) +++ fvwm/style.h (revision 7) @@ -247,6 +247,10 @@ ((c).has_window_font) #define S_SET_HAS_WINDOW_FONT(c,x) \ ((c).has_window_font = !!(x)) +#define S_HAS_INACTIVE_WINDOW_FONT(c) \ + ((c).has_inactive_window_font) +#define S_SET_HAS_INACTIVE_WINDOW_FONT(c,x) \ + ((c).has_inactive_window_font = !!(x)) #define S_ICON_OVERRIDE(c) \ ((c).s.icon_override) #define S_SET_ICON_OVERRIDE(c,x) \ @@ -443,6 +447,10 @@ ((s).window_font) #define SSET_WINDOW_FONT(s,x) \ ((s).window_font = (x)) +#define SGET_INACTIVE_WINDOW_FONT(s) \ + ((s).inactive_window_font) +#define SSET_INACTIVE_WINDOW_FONT(s,x) \ + ((s).inactive_window_font = (x)) #define SGET_COLORSET(s) \ ((s).colorset) #define SSET_COLORSET(s,x) \ Index: fvwm/fvwm.h =================================================================== --- fvwm/fvwm.h (revision 6) +++ fvwm/fvwm.h (revision 7) @@ -198,6 +198,7 @@ unsigned has_icon_font : 1; unsigned has_no_border : 1; unsigned has_window_font : 1; + unsigned has_inactive_window_font : 1; unsigned title_dir : 2; unsigned user_states : 32; /* static flags that do not change dynamically after the window has @@ -361,11 +362,13 @@ unsigned is_viewport_moved : 1; unsigned is_window_being_moved_opaque : 1; unsigned is_window_font_loaded : 1; + unsigned is_inactive_window_font_loaded : 1; unsigned is_window_shaded : 1; unsigned used_title_dir_for_shading : 1; unsigned shaded_dir : 3; unsigned using_default_icon_font : 1; unsigned using_default_window_font : 1; + unsigned using_default_inactive_window_font : 1; #define ICON_HINT_NEVER 0 #define ICON_HINT_ONCE 1 #define ICON_HINT_MULTIPLE 2 @@ -675,6 +678,7 @@ signed char icon_title_relief; char *icon_font; char *window_font; + char *inactive_window_font; char *fore_color_name; char *back_color_name; char *fore_color_name_hi; @@ -832,6 +836,7 @@ /* title font */ FlocaleFont *title_font; + FlocaleFont *inactive_title_font; /* /Y coordinate to draw the title name */ short title_text_offset; short title_length; Index: fvwm/add_window.c =================================================================== --- fvwm/add_window.c (revision 6) +++ fvwm/add_window.c (revision 7) @@ -632,6 +632,18 @@ fw->title_font = Scr.DefaultFont; SET_USING_DEFAULT_WINDOW_FONT(fw, 1); + if (IS_INACTIVE_WINDOW_FONT_LOADED(fw) && !USING_DEFAULT_INACTIVE_WINDOW_FONT(fw) && + fw->title_font != Scr.DefaultFont) + { + FlocaleUnloadFont(dpy, fw->title_font); + } + SET_INACTIVE_WINDOW_FONT_LOADED(fw, 0); + /* Fall back to default font. There are some race conditions when a + * window is destroyed and recaptured where an invalid font might be + * accessed otherwise. */ + fw->title_font = Scr.DefaultFont; + SET_USING_DEFAULT_INACTIVE_WINDOW_FONT(fw, 1); + return; } @@ -1673,6 +1685,25 @@ } SET_WINDOW_FONT_LOADED(fw, 1); } + /* load inactive font */ + if (!IS_INACTIVE_WINDOW_FONT_LOADED(fw)) + { + if (S_HAS_INACTIVE_WINDOW_FONT(SCF(*pstyle)) && + SGET_INACTIVE_WINDOW_FONT(*pstyle) && + (fw->inactive_title_font = + FlocaleLoadFont(dpy, SGET_INACTIVE_WINDOW_FONT(*pstyle), "FVWM"))) + { + SET_USING_DEFAULT_INACTIVE_WINDOW_FONT(fw, 0); + } + else + { + /* no explicit font or failed to load, use active title font + * instead */ + fw->inactive_title_font = fw->title_font; + SET_USING_DEFAULT_INACTIVE_WINDOW_FONT(fw, 1); + } + SET_INACTIVE_WINDOW_FONT_LOADED(fw, 1); + } setup_title_geometry(fw, pstyle); return; Index: fvwm/window_flags.h =================================================================== --- fvwm/window_flags.h (revision 6) +++ fvwm/window_flags.h (revision 7) @@ -562,6 +562,12 @@ (fw)->flags.is_window_font_loaded = !!(x) #define SETM_WINDOW_FONT_LOADED(fw,x) \ (fw)->flag_mask.is_window_font_loaded = !!(x) +#define IS_INACTIVE_WINDOW_FONT_LOADED(fw) \ + ((fw)->flags.is_inactive_window_font_loaded) +#define SET_INACTIVE_WINDOW_FONT_LOADED(fw,x) \ + (fw)->flags.is_inactive_window_font_loaded = !!(x) +#define SETM_INACTIVE_WINDOW_FONT_LOADED(fw,x) \ + (fw)->flag_mask.is_inactive_window_font_loaded = !!(x) #define CR_MOTION_METHOD(fw) \ ((fw)->flags.cr_motion_method) #define SET_CR_MOTION_METHOD(fw,x) \ @@ -604,6 +610,12 @@ (fw)->flags.using_default_window_font = !!(x) #define SETM_USING_DEFAULT_WINDOW_FONT(fw,x) \ (fw)->flag_mask.using_default_window_font = !!(x) +#define USING_DEFAULT_INACTIVE_WINDOW_FONT(fw) \ + ((fw)->flags.using_default_inactive_window_font) +#define SET_USING_DEFAULT_INACTIVE_WINDOW_FONT(fw,x) \ + (fw)->flags.using_default_inactive_window_font = !!(x) +#define SETM_USING_DEFAULT_INACTIVE_WINDOW_FONT(fw,x) \ + (fw)->flag_mask.using_default_inactive_window_font = !!(x) #define USING_DEFAULT_ICON_FONT(fw) \ ((fw)->flags.using_default_icon_font) #define SET_USING_DEFAULT_ICON_FONT(fw,x) \ Index: fvwm/borders.c =================================================================== --- fvwm/borders.c (revision 6) +++ fvwm/borders.c (revision 7) @@ -3510,7 +3510,7 @@ static void border_draw_title_mono( FvwmWindow *fw, titlebar_descr *td, title_draw_descr *tdd, - FlocaleWinString *fstr, Pixmap dest_pix) + FlocaleWinString *fstr, Pixmap dest_pix, Bool do_hilight) { int has_vt; @@ -3520,7 +3520,8 @@ td->offset - 2, 0, td->length+4, fw->title_thickness); if (fw->visible_name != (char *)NULL) { - FlocaleDrawString(dpy, fw->title_font, fstr, 0); + FlocaleDrawString(dpy, do_hilight ? fw->title_font : + fw->inactive_title_font, fstr, 0); } /* for mono, we clear an area in the title bar where the window * title goes, so that its more legible. For color, no need */ @@ -3584,7 +3585,7 @@ static void border_draw_title_deep( FvwmWindow *fw, titlebar_descr *td, title_draw_descr *tdd, - FlocaleWinString *fstr, Pixmap dest_pix, Window w) + FlocaleWinString *fstr, Pixmap dest_pix, Window w, Bool do_hilight) { DecorFace *df; pixmap_background_type bg; @@ -3606,14 +3607,15 @@ 1); } } - FlocaleDrawString(dpy, fw->title_font, &tdd->fstr, 0); + FlocaleDrawString(dpy, do_hilight ? fw->title_font : + fw->inactive_title_font, &tdd->fstr, 0); return; } static void border_get_titlebar_draw_descr( FvwmWindow *fw, titlebar_descr *td, title_draw_descr *tdd, - Pixmap dest_pix) + Pixmap dest_pix, Bool do_hilight) { rectangle *title_g; @@ -3629,7 +3631,8 @@ tdd->rgc = td->cd->relief_gc; tdd->sgc = td->cd->shadow_gc; } - NewFontAndColor(fw->title_font, td->cd->fore_color, td->cd->back_color); + NewFontAndColor(do_hilight ? fw->title_font : fw->inactive_title_font, + td->cd->fore_color, td->cd->back_color); title_g = &td->layout.title_g; tdd->tstyle = &TB_STATE( GetDecor(fw, titlebar))[td->tbstate.tstate].style; @@ -3667,7 +3670,7 @@ } static void border_set_title_pixmap( - FvwmWindow *fw, titlebar_descr *td, Pixmap *dest_pix, Window w) + FvwmWindow *fw, titlebar_descr *td, Pixmap *dest_pix, Window w, Bool do_hilight) { pixmap_background_type bg; title_draw_descr tdd; @@ -3675,7 +3678,7 @@ Bool free_bg_pixmap = False; rectangle pix_g; - border_get_titlebar_draw_descr(fw, td, &tdd, *dest_pix); + border_get_titlebar_draw_descr(fw, td, &tdd, *dest_pix, do_hilight); /* prepare background, either from the window colour or from the * border style */ if (!DFS_USE_BORDER_STYLE(*tdd.tstyle)) @@ -3743,11 +3746,11 @@ if (Pdepth < 2) { - border_draw_title_mono(fw, td, &tdd, &fstr, *dest_pix); + border_draw_title_mono(fw, td, &tdd, &fstr, *dest_pix, do_hilight); } else { - border_draw_title_deep(fw, td, &tdd, &fstr, *dest_pix, w); + border_draw_title_deep(fw, td, &tdd, &fstr, *dest_pix, w, do_hilight); } border_draw_title_relief(fw, td, &tdd, *dest_pix); border_draw_title_stick_lines(fw, td, &tdd, *dest_pix); @@ -3756,7 +3759,7 @@ } static void border_draw_title( - FvwmWindow *fw, titlebar_descr *td) + FvwmWindow *fw, titlebar_descr *td, Bool do_hilight) { Pixmap p; @@ -3774,7 +3777,7 @@ #if 0 fprintf(stderr,"drawing title\n"); #endif - border_set_title_pixmap(fw, td, &p, FW_W_TITLE(fw)); + border_set_title_pixmap(fw, td, &p, FW_W_TITLE(fw), do_hilight); if (td->draw_rotation != ROTATION_0) { Pixmap tmp; @@ -4261,9 +4264,9 @@ if (fw->visible_name != (char *)NULL) { ret_td->length = FlocaleTextWidth( - fw->title_font, fw->visible_name, - (ret_td->has_vt) ? -strlen(fw->visible_name) : - strlen(fw->visible_name)); + do_hilight ? fw->title_font : fw->inactive_title_font, + fw->visible_name, (ret_td->has_vt) ? + -strlen(fw->visible_name) : strlen(fw->visible_name)); if (ret_td->length > fw->title_length - 2*MIN_WINDOW_TITLE_TEXT_OFFSET) { @@ -4369,7 +4372,7 @@ } if ((draw_parts & PART_TITLE) != PART_NONE) { - border_draw_title(fw, &td); + border_draw_title(fw, &td, do_hilight); } if ((draw_parts & PART_BUTTONS) != PART_NONE) {