From 4e8d728814a7875d2299f3fea1fd8adf2d1096a8 Mon Sep 17 00:00:00 2001 From: Kim Woelders Date: Wed, 10 Aug 2005 15:31:48 +0000 Subject: [PATCH] Speed up pseudotrans changes. SVN revision: 16094 --- src/ewins.c | 34 ++++++++++++++++------------------ src/iclass.c | 20 ++++++++++++++++++-- src/mod-trans.c | 22 +++++++++++++++++----- 3 files changed, 51 insertions(+), 25 deletions(-) diff --git a/src/ewins.c b/src/ewins.c index 70fa0473..cc92a8bc 100644 --- a/src/ewins.c +++ b/src/ewins.c @@ -1599,17 +1599,25 @@ EwinsEventsConfigure(int mode) } static void -EwinsTouch(void) +EwinsTouch(int desk) { int i, num; EWin *const *lst, *ewin; - lst = EwinListStackGet(&num); + if (desk < 0) + lst = EwinListGetAll(&num); + else + lst = EwinListGetForDesk(&num, desk); + for (i = num - 1; i >= 0; i--) { ewin = lst[i]; - if (EwinIsMapped(ewin)) + if (EwinIsMapped(ewin) && EwinIsOnScreen(ewin)) +#if 1 /* FIXME - Which one? */ EwinMove(ewin, EoGetX(ewin), EoGetY(ewin)); +#else + EwinResize(ewin, ewin->client.w, ewin->client.h); +#endif } } @@ -1872,12 +1880,8 @@ EwinsInit(void) */ static void -EwinsSighan(int sig, void *prm __UNUSED__) +EwinsSighan(int sig, void *prm) { - EWin *ewin; - EWin **ewin_lst; - int win_cnt, i; - switch (sig) { case ESIGNAL_INIT: @@ -1894,19 +1898,13 @@ EwinsSighan(int sig, void *prm __UNUSED__) break; #endif case ESIGNAL_DESK_RESIZE: - EwinsTouch(); + EwinsTouch(-1); break; case ESIGNAL_THEME_TRANS_CHANGE: + EwinsTouch(DesksGetCurrent()); + break; case ESIGNAL_BACKGROUND_CHANGE: - /* FIXME - Only visible windows */ - /* FIXME - BG: Only affected desk */ - ewin_lst = (EWin **) EwinListStackGet(&win_cnt); - for (i = 0; i < win_cnt; i++) - { - ewin = ewin_lst[i]; - if (EwinIsMapped(ewin)) - EwinResize(ewin, ewin->client.w, ewin->client.h); - } + EwinsTouch((long)prm); break; } } diff --git a/src/iclass.c b/src/iclass.c index 414aec97..d04f87cd 100644 --- a/src/iclass.c +++ b/src/iclass.c @@ -91,10 +91,26 @@ TransparencySet(int transparency) prev_alpha = Conf.trans.alpha; Conf.trans.alpha = transparency; } + + if (!changed) + return; + /* Generate the color modifier tables */ TransparencyMakeColorModifier(); - if (changed) - ModulesSignal(ESIGNAL_THEME_TRANS_CHANGE, NULL); + + if (prev_alpha == 0) + { + /* Hack to get tiled backgrounds regenerated at full size */ + int i, num; + + num = DesksGetNumber(); + for (i = 0; i < num; i++) + { + BackgroundPixmapFree(DeskGetBackground(i)); + DeskRefresh(i); + } + } + ModulesSignal(ESIGNAL_THEME_TRANS_CHANGE, NULL); } #endif /* ENABLE_THEME_TRANSPARENCY */ diff --git a/src/mod-trans.c b/src/mod-trans.c index 3568a86a..948ca773 100644 --- a/src/mod-trans.c +++ b/src/mod-trans.c @@ -39,6 +39,19 @@ static int tmp_st_menu; static int tmp_st_tooltip; static int tmp_st_hilight; +static void +TransparencyChangeTimeout(int val, void *data __UNUSED__) +{ + TransparencySet(val); +} + +static void +TransparencyChange(int val) +{ + RemoveTimerEvent("PT-Change"); + DoIn("PT-Change", .01, TransparencyChangeTimeout, val, NULL); +} + static void CB_ConfigureTrans(Dialog * d __UNUSED__, int val, void *data __UNUSED__) { @@ -72,8 +85,9 @@ CB_ConfigureTrans(Dialog * d __UNUSED__, int val, void *data __UNUSED__) Conf.trans.pager = ICLASS_ATTR_BG; Conf.trans.iconbox = ICLASS_ATTR_BG; Conf.trans.warplist = ICLASS_ATTR_BG; - - TransparencySet(tmp_theme_transparency); +#if 0 /* Should not be necessary */ + TransparencyChange(tmp_theme_transparency); +#endif } autosave(); } @@ -88,10 +102,8 @@ CB_ThemeTransparency(Dialog * d __UNUSED__, int val __UNUSED__, void *data) Esnprintf(s, sizeof(s), _("Theme transparency: %2d"), tmp_theme_transparency); DialogItemSetText(di, s); - DialogDrawItems(tr_sel_dialog, di, 0, 0, 99999, 99999); - /* FIXME - We may not want to do this unless things are speeded up */ - TransparencySet(tmp_theme_transparency); + TransparencyChange(tmp_theme_transparency); } static void