summarylogtreecommitdiffstats
path: root/07-InactiveFont.patch
diff options
context:
space:
mode:
Diffstat (limited to '07-InactiveFont.patch')
-rw-r--r--07-InactiveFont.patch340
1 files changed, 340 insertions, 0 deletions
diff --git a/07-InactiveFont.patch b/07-InactiveFont.patch
new file mode 100644
index 000000000000..c62a43e5f217
--- /dev/null
+++ b/07-InactiveFont.patch
@@ -0,0 +1,340 @@
+diff -U3 -r fvwm/add_window.c fvwm/add_window.c
+--- fvwm/add_window.c 2011-09-27 23:07:20.000000000 +0200
++++ fvwm/add_window.c 2011-12-09 19:40:50.151782172 +0100
+@@ -753,6 +753,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;
+ }
+
+@@ -1801,6 +1813,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;
+diff -U3 -r fvwm/borders.c fvwm/borders.c
+--- fvwm/borders.c 2011-12-09 19:32:33.277812649 +0100
++++ fvwm/borders.c 2011-12-09 19:44:44.919122542 +0100
+@@ -3921,7 +3921,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;
+
+@@ -3931,7 +3931,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 */
+@@ -3995,7 +3996,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;
+@@ -4017,14 +4018,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)
+ {
+ memset(tdd, 0, sizeof(*tdd));
+ /* prepare the gcs and variables */
+@@ -4038,7 +4040,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);
+ tdd->tstyle = &TB_STATE(
+ GetDecor(fw, titlebar))[td->tbstate.tstate].style;
+ tdd->df = &TB_STATE(GetDecor(fw, titlebar))[td->tbstate.tstate];
+@@ -4075,7 +4078,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;
+@@ -4083,7 +4086,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))
+@@ -4151,11 +4154,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);
+@@ -4164,7 +4167,7 @@
+ }
+
+ static void border_draw_title(
+- FvwmWindow *fw, titlebar_descr *td)
++ FvwmWindow *fw, titlebar_descr *td, Bool do_hilight)
+ {
+ Pixmap p;
+
+@@ -4182,7 +4185,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;
+@@ -4671,9 +4674,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)
+ {
+@@ -4779,7 +4782,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)
+ {
+diff -U3 -r fvwm/fvwm.h fvwm/fvwm.h
+--- fvwm/fvwm.h 2011-12-09 19:32:33.277812649 +0100
++++ fvwm/fvwm.h 2011-12-09 19:40:50.148448924 +0100
+@@ -200,6 +200,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
+@@ -363,11 +364,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
+@@ -679,6 +682,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;
+@@ -840,6 +844,7 @@
+
+ /* title font */
+ FlocaleFont *title_font;
++ FlocaleFont *inactive_title_font;
+ /* /Y coordinate to draw the title name */
+ short title_text_offset;
+ short title_length;
+diff -U3 -r fvwm/style.c fvwm/style.c
+--- fvwm/style.c 2011-12-09 19:32:33.274479401 +0100
++++ fvwm/style.c 2011-12-09 19:40:50.148448924 +0100
+@@ -452,6 +452,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));
+@@ -943,6 +959,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));
+@@ -3381,6 +3401,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"))
+ {
+ /* TA: This is being deprecated in favour of the more
+@@ -5261,6 +5290,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)) ||
+diff -U3 -r fvwm/style.h fvwm/style.h
+--- fvwm/style.h 2011-12-09 19:32:33.274479401 +0100
++++ fvwm/style.h 2011-12-09 19:40:50.148448924 +0100
+@@ -300,6 +300,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) \
+@@ -496,6 +500,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) \
+diff -U3 -r fvwm/window_flags.h fvwm/window_flags.h
+--- fvwm/window_flags.h 2011-12-09 19:32:33.277812649 +0100
++++ fvwm/window_flags.h 2011-12-09 19:40:50.151782172 +0100
+@@ -580,6 +580,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) \
+@@ -622,6 +628,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) \