Репозиторий Sisyphus
Последнее обновление: 1 октября 2023 | Пакетов: 18631 | Посещений: 37510182
en ru br
Репозитории ALT
S:0.96.0-alt1
5.1: 0.92.0-alt6
4.1: 0.92.0-alt2
4.0: 0.92.0-alt2
3.0: 0.91.0-alt1
+backports:0.92.0-alt0.M30.1
www.altlinux.org/Changes

Группа :: Графические оболочки/Window Maker
Пакет: WindowMaker

 Главная   Изменения   Спек   Патчи   Sources   Загрузить   Gear   Bugs and FR  Repocop 

Патч: WindowMaker-0.92.0-peter-newappicon.patch
Скачать


 src/appicon.c     |    2 +-
 src/application.c |    3 +++
 src/application.h |   24 +++++++++++++++---------
 src/icon.c        |   16 ++++++++++++----
 wrlib/misc.c      |   52 ++++++++++++++++++++++++++++++++++++++++++++--------
 wrlib/wraster.h   |    2 ++
 6 files changed, 77 insertions(+), 22 deletions(-)
diff --git a/src/appicon.c b/src/appicon.c
index 22f2693..21e1403 100644
--- a/src/appicon.c
+++ b/src/appicon.c
@@ -222,7 +222,7 @@ wAppIconDestroy(WAppIcon *aicon)
 
 
 
-#ifdef NEWAPPICON
+#if 0 
 static void
 drawCorner(WIcon *icon, WWindow *wwin, int active)
 {
diff --git a/src/application.c b/src/application.c
index ad5d388..5676f25 100644
--- a/src/application.c
+++ b/src/application.c
@@ -465,6 +465,9 @@ wApplicationDestroy(WApplication *wapp)
 
     XDeleteContext(dpy, wapp->main_window, wAppWinContext);
     wAppMenuDestroy(wapp->menu);
+#ifdef NEWAPPICON
+    wApplicationDeactivate(wapp);
+#endif
     if (wapp->app_icon) {
         if (wapp->app_icon->docked && !wapp->app_icon->attracted) {
             wapp->app_icon->running = 0;
diff --git a/src/application.h b/src/application.h
index 57a1b5c..c0165ce 100644
--- a/src/application.h
+++ b/src/application.h
@@ -60,15 +60,21 @@ void wApplicationExtractDirPackIcon(WScreen *scr,char *path, char *wm_instance,
 
 #ifdef NEWAPPICON
 
-# define wApplicationActivate(wapp)	{\
-    wapp->main_window_desc->flags.focused=1; \
-    wAppIconPaint(wapp->app_icon);\
-    }
-#define wApplicationDeactivate(wapp)	{\
-    wapp->main_window_desc->flags.focused=0;\
-    wAppIconPaint(wapp->app_icon);\
-    }
-#endif
+#define wApplicationActivate(wapp) do { \
+	if (wapp->app_icon) { \
+	    wIconSetHighlited(wapp->app_icon->icon, True); \
+		wAppIconPaint(wapp->app_icon);\
+	} \
+    } while (0)
+
+#define wApplicationDeactivate(wapp) do { \
+	if (wapp->app_icon) { \
+	    wIconSetHighlited(wapp->app_icon->icon, False); \
+		wAppIconPaint(wapp->app_icon);\
+	} \
+    } while (0)
+
 
 #endif
 
+#endif
diff --git a/src/icon.c b/src/icon.c
index e87d2f1..c235193 100644
--- a/src/icon.c
+++ b/src/icon.c
@@ -312,7 +312,7 @@ drawIconTitle(WScreen *scr, Pixmap pixmap, int height)
 
 
 static Pixmap
-makeIcon(WScreen *scr, RImage *icon, int titled, int shadowed, int tileType)
+makeIcon(WScreen *scr, RImage *icon, int titled, int shadowed, int tileType, int highlighted)
 {
     RImage *tile;
     Pixmap pixmap;
@@ -355,6 +355,13 @@ makeIcon(WScreen *scr, RImage *icon, int titled, int shadowed, int tileType)
         color.alpha = 150; /* about 60% */
         RClearImage(tile, &color);
     }
+    if (highlighted) {
+	RColor color;
+
+	color.red = color.green = color.blue = 0;
+	color.alpha = 160;
+	RLightImage(tile, &color);
+    }
 
     if (!RConvertImage(scr->rcontext, tile, &pixmap)) {
         wwarning(_("error rendering image:%s"), RMessageForError(RErrorCode));
@@ -597,6 +604,7 @@ wIconSetHighlited(WIcon *icon, Bool flag)
     }
 
     icon->highlighted = flag;
+    icon->force_paint = True;
     wIconPaint(icon);
 }
 
@@ -766,7 +774,7 @@ wIconUpdate(WIcon *icon)
 
         if (icon->image) {
             icon->pixmap = makeIcon(scr, icon->image, icon->show_title,
-                                    icon->shadowed, icon->tile_type);
+                                    icon->shadowed, icon->tile_type, icon->highlighted);
         } else {
             /* make default icons */
 
@@ -794,9 +802,9 @@ wIconUpdate(WIcon *icon)
 
                 image = wIconValidateIconSize(scr, image);
                 scr->def_icon_pixmap = makeIcon(scr, image, False, False,
-                                                icon->tile_type);
+                                                icon->tile_type, icon->highlighted);
                 scr->def_ticon_pixmap = makeIcon(scr, image, True, False,
-                                                 icon->tile_type);
+                                                 icon->tile_type, icon->highlighted);
                 if (image)
                     RReleaseImage(image);
             }
diff --git a/wrlib/misc.c b/wrlib/misc.c
index 3da6adf..dded195 100644
--- a/wrlib/misc.c
+++ b/wrlib/misc.c
@@ -152,7 +152,7 @@ RClearImage(RImage *image, RColor *color)
         }
     } else {
         int bytes = image->width*image->height;
-        int alpha, nalpha, r, g, b;
+        int alpha, nalpha, r, g, b, s;
 
         alpha = color->alpha;
         r = color->red * alpha;
@@ -160,17 +160,53 @@ RClearImage(RImage *image, RColor *color)
         b = color->blue * alpha;
         nalpha = 255 - alpha;
 
-        for (i=0; i<bytes; i++) {
-            *d = (((int)*d * nalpha) + r)/256; d++;
-            *d = (((int)*d * nalpha) + g)/256; d++;
-            *d = (((int)*d * nalpha) + b)/256; d++;
-            if (image->format == RRGBAFormat) {
-                d++;
-            }
+	s = (image->format == RRGBAFormat) ? 4 : 3;
+
+	for (i=0; i<bytes; i++, d+=s) {
+	    d[0] = (((int)d[0] * nalpha) + r)/256;
+	    d[1] = (((int)d[1] * nalpha) + g)/256;
+	    d[2] = (((int)d[2] * nalpha) + b)/256;
         }
     }
 }
 
+static __inline__ unsigned char
+clip(int c) {
+    if (c > 255) c=255;
+    return (unsigned char)c;
+}
+
+void
+RLightImage(RImage *image, RColor *color)
+{
+    unsigned char *d = image->data;
+    unsigned char *dd;
+    int alpha, r, g, b, s;
+
+    s = (image->format == RRGBAFormat) ? 4 : 3;
+    dd = d + s*image->width*image->height;
+
+    r = color->red;
+    g = color->green;
+    b = color->blue;
+
+    alpha = color->alpha;
+
+    if (r == 0 && g == 0 && b == 0) {
+	for (; d<dd; d+=s) {
+	    d[0] = clip(((int)d[0] * alpha)/128);
+	    d[1] = clip(((int)d[1] * alpha)/128);
+	    d[2] = clip(((int)d[2] * alpha)/128);
+	    }
+    } else {
+	for (; d<dd; d+=s) {
+	    d[0] = clip((((int)d[0] * alpha) + r)/128);
+	    d[1] = clip((((int)d[1] * alpha) + g)/128);
+	    d[2] = clip((((int)d[2] * alpha) + b)/128);
+	}
+    }
+}
+
 const char*
 RMessageForError(int errorCode)
 {
diff --git a/wrlib/wraster.h b/wrlib/wraster.h
index 8b07c3f..7444bf4 100644
--- a/wrlib/wraster.h
+++ b/wrlib/wraster.h
@@ -411,6 +411,8 @@ void RHSVtoRGB(RHSVColor *hsv, RColor *rgb);
  */
 void RClearImage(RImage *image, RColor *color);
 
+void RLightImage(RImage *image, RColor *color);
+
 void RFillImage(RImage *image, RColor *color);
 
 void RBevelImage(RImage *image, int bevel_type);
 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin