diff --git a/modules/FvwmPager/FvwmPager.c b/modules/FvwmPager/FvwmPager.c index 077bfac9c..5ad602fef 100644 --- a/modules/FvwmPager/FvwmPager.c +++ b/modules/FvwmPager/FvwmPager.c @@ -408,6 +408,7 @@ DeskStyle *FindDeskStyle(int desk) style->desk = desk; xasprintf(&style->label, "Desk %d", desk); + initialize_desk_style_gcs(style); TAILQ_INSERT_TAIL(&desk_style_q, style, entry); return style; diff --git a/modules/FvwmPager/init_pager.c b/modules/FvwmPager/init_pager.c index 260d85d58..82e173132 100644 --- a/modules/FvwmPager/init_pager.c +++ b/modules/FvwmPager/init_pager.c @@ -68,14 +68,14 @@ void init_fvwm_pager(void) initialize_transient(); initialize_pager_window(); - /* Initialize DeskStyle GCs */ + /* Update styles with user configurations. */ + TAILQ_FOREACH(style, &desk_style_q, entry) { + update_desk_style_gcs(style); + } + /* Initialize any non configured desks. */ for (i = 0; i < ndesks; i++) { - /* Create any missing DeskStyles. */ style = FindDeskStyle(i); } - TAILQ_FOREACH(style, &desk_style_q, entry) { - initialize_desk_style_gcs(style); - } /* After DeskStyles are initialized, initialize desk windows. */ for (i = 0; i < ndesks; i++) { @@ -201,7 +201,7 @@ void initialize_colorset(DeskStyle *style) } if (style->balloon_cs >= 0) { style->balloon_fg = Colorset[style->balloon_cs].fg; - style->balloon_bg = Colorset[style->balloon_bg].bg; + style->balloon_bg = Colorset[style->balloon_cs].bg; } } @@ -531,14 +531,8 @@ void initialize_desk_style_gcs(DeskStyle *style) /* Desk labels GC. */ gcv.foreground = style->fg; - if (Scr.Ffont && Scr.Ffont->font) { - gcv.font = Scr.Ffont->font->fid; - style->label_gc = fvwmlib_XCreateGC( - dpy, Scr.pager_w, GCForeground | GCFont, &gcv); - } else { - style->label_gc = fvwmlib_XCreateGC( - dpy, Scr.pager_w, GCForeground, &gcv); - } + style->label_gc = fvwmlib_XCreateGC( + dpy, Scr.pager_w, GCForeground, &gcv); /* Hilight GC, used for monitors and labels backgrounds. */ gcv.foreground = (Pdepth < 2) ? style->bg : style->hi_bg; @@ -547,12 +541,8 @@ void initialize_desk_style_gcs(DeskStyle *style) /* create the hilight desk title drawing GC */ gcv.foreground = (Pdepth < 2) ? style->fg : style->hi_fg; - if (Scr.Ffont && Scr.Ffont->font) - style->hi_fg_gc = fvwmlib_XCreateGC( - dpy, Scr.pager_w, GCForeground | GCFont, &gcv); - else - style->hi_fg_gc = fvwmlib_XCreateGC( - dpy, Scr.pager_w, GCForeground, &gcv); + style->hi_fg_gc = fvwmlib_XCreateGC( + dpy, Scr.pager_w, GCForeground, &gcv); /* create the virtual page boundary GC */ gcv.foreground = style->fg; @@ -864,7 +854,6 @@ void parse_options(void) char *next; token = PeekToken(tline, &next); - /* Step 1: Initial configuration broadcasts are parsed here. */ if (token[0] == '*') { /* Module configuration item, skip to next step. */ diff --git a/modules/FvwmPager/messages.c b/modules/FvwmPager/messages.c index 3dc504c43..6f66e4b5b 100644 --- a/modules/FvwmPager/messages.c +++ b/modules/FvwmPager/messages.c @@ -64,8 +64,6 @@ void process_message(FvwmPacket *packet) switch (type) { case M_ADD_WINDOW: - process_configure(body); - break; case M_CONFIGURE_WINDOW: process_configure(body); break; @@ -366,7 +364,8 @@ void process_new_page(unsigned long *body) fp = fpmonitor_this(m); if (fp == NULL) return; - do_reconfigure = true; + if (monitor_to_track == NULL) + do_reconfigure = true; } fp->virtual_scr.Vx = fp->m->virtual_scr.Vx = body[0]; @@ -377,16 +376,20 @@ void process_new_page(unsigned long *body) body[1] = mon_num; process_new_desk(body); } - if (fp->virtual_scr.VxPages != body[5] || fp->virtual_scr.VyPages != body[6]) + if (fp->virtual_scr.VxPages != body[5] || + fp->virtual_scr.VyPages != body[6]) { fp->virtual_scr.VxPages = body[5]; fp->virtual_scr.VyPages = body[6]; - fp->virtual_scr.VWidth = fp->virtual_scr.VxPages * fpmonitor_get_all_widths(); - fp->virtual_scr.VHeight = fp->virtual_scr.VyPages * fpmonitor_get_all_heights(); - fp->virtual_scr.VxMax = fp->virtual_scr.VWidth - fpmonitor_get_all_widths(); - fp->virtual_scr.VyMax = fp->virtual_scr.VHeight - fpmonitor_get_all_heights(); - if (do_reconfigure) - ReConfigure(); + fp->virtual_scr.VWidth = + fp->virtual_scr.VxPages * fpmonitor_get_all_widths(); + fp->virtual_scr.VHeight = + fp->virtual_scr.VyPages * fpmonitor_get_all_heights(); + fp->virtual_scr.VxMax = + fp->virtual_scr.VWidth - fpmonitor_get_all_widths(); + fp->virtual_scr.VyMax = + fp->virtual_scr.VHeight - fpmonitor_get_all_heights(); + ReConfigure(); } if (do_reconfigure) { @@ -428,10 +431,10 @@ void process_new_desk(unsigned long *body) * and tracking is per-monitor or shared. */ if (!CurrentDeskPerMonitor && ((monitor_to_track != NULL && - mout != monitor_to_track->m) || + fp != monitor_to_track) || (current_monitor != NULL && monitor_to_track == NULL && - mout != current_monitor->m && + fp != current_monitor && (monitor_mode == MONITOR_TRACKING_M || is_tracking_shared)))) { @@ -444,13 +447,6 @@ void process_new_desk(unsigned long *body) /* Update the current desk. */ desk_i = newDesk; style = FindDeskStyle(newDesk); - /* Create and update GCs if needed. */ - if (oldDesk != newDesk) { - if (style->label_gc) - update_desk_style_gcs(style); - else - initialize_desk_style_gcs(style); - } /* Keep monitors in sync when tracking is global. */ if (monitor_mode == MONITOR_TRACKING_G) @@ -473,7 +469,6 @@ void process_new_desk(unsigned long *body) update_desk_background(0); update_monitor_locations(0); update_monitor_backgrounds(0); - ReConfigureAll(); } XStoreName(dpy, Scr.pager_w, style->label); @@ -481,6 +476,7 @@ void process_new_desk(unsigned long *body) update_grid: MovePage(); + ReConfigureAll(); draw_desk_grid(oldDesk - desk1); draw_desk_grid(newDesk - desk1); MoveStickyWindows(false, true); @@ -932,7 +928,10 @@ void process_config_info_line(char *line, bool is_init) { PagerWindow *t = Start; - update_desk_style_gcs(style); + /* Only update if it wasn't updated previously. */ + if (style->cs != color && style->hi_cs != color) + update_desk_style_gcs(style); + while (t != NULL) { if (t->desk != style->desk) { t = t->next; diff --git a/modules/FvwmPager/x_update.c b/modules/FvwmPager/x_update.c index 6474bc4ac..4932e70a9 100644 --- a/modules/FvwmPager/x_update.c +++ b/modules/FvwmPager/x_update.c @@ -240,6 +240,10 @@ void update_desk_style_gcs(DeskStyle *style) { initialize_colorset(style); + /* Don't update GC's for default style. */ + if (style->desk < 0) + return; + XSetForeground(dpy, style->label_gc, style->fg); XSetForeground(dpy, style->dashed_gc, style->fg); XSetForeground(dpy, style->hi_bg_gc, style->hi_bg);