]> Dogcows Code - chaz/tint2/commitdiff
add some HSB config
authorThierry Lorthiois <lorthiois@bbsoft.fr>
Fri, 28 Aug 2009 12:14:45 +0000 (12:14 +0000)
committerThierry Lorthiois <lorthiois@bbsoft.fr>
Fri, 28 Aug 2009 12:14:45 +0000 (12:14 +0000)
ChangeLog
src/config.c
src/taskbar/task.c
src/taskbar/task.h
src/tint.c
src/util/common.h

index 4a34333dc285454a1a032599358b5d24891e32df..ff5f65b42e408747f2177d5b161510aa7003fca8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,6 @@
+2009-08-28
+- add some HSB config
+
 2009-08-09
 - add mouse action : maximize_restore
 - fixed issue 125
index f1b4655b50ae53a197435b020a1fd5b4c59e9b83..bb2603a2c8ccfa2b0af9a9fe9de995d912b3037a 100644 (file)
@@ -511,6 +511,18 @@ void add_entry (char *key, char *value)
       if (value2) panel_config->g_task.font_active.alpha = (atoi (value2) / 100.0);
       else panel_config->g_task.font_active.alpha = 0.1;
    }
+   else if (strcmp (key, "task_icon_hsb") == 0) {
+      extract_values(value, &value1, &value2, &value3);
+               panel_config->g_task.hue = atoi(value1);
+               panel_config->g_task.saturation = atoi(value2);
+               panel_config->g_task.brightness = atoi(value3);
+   }
+   else if (strcmp (key, "task_active_icon_hsb") == 0) {
+      extract_values(value, &value1, &value2, &value3);
+               panel_config->g_task.hue_active = atoi(value1);
+               panel_config->g_task.saturation_active = atoi(value2);
+               panel_config->g_task.brightness_active = atoi(value3);
+   }
    else if (strcmp (key, "task_background_id") == 0) {
       int id = atoi (value);
       Area *a = g_slist_nth_data(list_back, id);
index 3e1c9de2f1803325cbcdfdcee1d75e5a2cd51712..e7314ed443cb224a68202b9e06e7bd595459b2b6 100644 (file)
@@ -25,7 +25,6 @@
 #include <stdlib.h>
 #include <string.h>
 #include <glib.h>
-#include <Imlib2.h>
 
 #include "window.h"
 #include "task.h"
@@ -52,6 +51,7 @@ Task *add_task (Window win)
        // even with task_on_all_desktop and with task_on_all_panel
        new_tsk.title = 0;
        new_tsk.icon_data = 0;
+       new_tsk.icon_data_active = 0;
        get_title(&new_tsk);
        get_icon(&new_tsk);
 
@@ -74,6 +74,7 @@ Task *add_task (Window win)
                        new_tsk2->desktop = new_tsk.desktop;
                        new_tsk2->title = new_tsk.title;
                        new_tsk2->icon_data = new_tsk.icon_data;
+                       new_tsk2->icon_data_active = new_tsk.icon_data_active;
                        new_tsk2->icon_width = new_tsk.icon_width;
                        new_tsk2->icon_height = new_tsk.icon_height;
                        tskbar->area.list = g_slist_append(tskbar->area.list, new_tsk2);
@@ -97,8 +98,10 @@ void remove_task (Task *tsk)
        //printf("remove_task %s %d\n", tsk->title, tsk->desktop);
        if (tsk->title)
                free (tsk->title);
-       if (tsk->icon_data)
+       if (tsk->icon_data) {
                free (tsk->icon_data);
+               free (tsk->icon_data_active);
+       }
 
        int i, j;
        Task *tsk2;
@@ -171,7 +174,8 @@ void get_icon (Task *tsk)
 
        if (tsk->icon_data) {
                free (tsk->icon_data);
-               tsk->icon_data = 0;
+               free (tsk->icon_data_active);
+               tsk->icon_data = tsk->icon_data_active = 0;
        }
        tsk->area.redraw = 1;
 
@@ -203,44 +207,48 @@ void get_icon (Task *tsk)
    else {
       // get Pixmap icon
       XWMHints *hints = XGetWMHints(server.dsp, tsk->win);
-      if (hints) {
-         if (hints->flags & IconPixmapHint && hints->icon_pixmap != 0) {
-               // get width, height and depth for the pixmap
-                               Window root;
-                               int  icon_x, icon_y;
-                               uint border_width, bpp;
-                               uint icon_width, icon_height;
-
-                               XGetGeometry(server.dsp, hints->icon_pixmap, &root, &icon_x, &icon_y, &icon_width, &icon_height, &border_width, &bpp);
-
-                     //printf("  get_pixmap\n");
-                     Imlib_Image  img;
-                               imlib_context_set_drawable(hints->icon_pixmap);
-                               img = imlib_create_image_from_drawable(hints->icon_mask, 0, 0, icon_width, icon_height, 0);
-                               imlib_context_set_image(img);
-                               unsigned int *data = imlib_image_get_data();
-                               if (!data) {
-                                       return;
-                               }
-                               tsk->icon_width = imlib_image_get_width();
-                               tsk->icon_height = imlib_image_get_height();
-                               tsk->icon_data = malloc (tsk->icon_width * tsk->icon_height * sizeof (DATA32));
-                               memcpy (tsk->icon_data, data, tsk->icon_width * tsk->icon_height * sizeof (DATA32));
-                               imlib_free_image();
+      if (!hints) return;
+               if (hints->flags & IconPixmapHint && hints->icon_pixmap != 0) {
+                       // get width, height and depth for the pixmap
+                       Window root;
+                       int  icon_x, icon_y;
+                       uint border_width, bpp;
+                       uint icon_width, icon_height;
+
+                       XGetGeometry(server.dsp, hints->icon_pixmap, &root, &icon_x, &icon_y, &icon_width, &icon_height, &border_width, &bpp);
+
+                       //printf("  get_pixmap\n");
+                       Imlib_Image  img;
+                       imlib_context_set_drawable(hints->icon_pixmap);
+                       img = imlib_create_image_from_drawable(hints->icon_mask, 0, 0, icon_width, icon_height, 0);
+                       imlib_context_set_image(img);
+                       unsigned int *data = imlib_image_get_data();
+                       if (!data) {
+                               return;
                        }
-         XFree(hints);
+                       tsk->icon_width = imlib_image_get_width();
+                       tsk->icon_height = imlib_image_get_height();
+                       tsk->icon_data = malloc (tsk->icon_width * tsk->icon_height * sizeof (DATA32));
+                       memcpy (tsk->icon_data, data, tsk->icon_width * tsk->icon_height * sizeof (DATA32));
+                       imlib_free_image();
                }
+               XFree(hints);
    }
+
+       tsk->icon_data_active = malloc (tsk->icon_width * tsk->icon_height * sizeof (DATA32));
+       memcpy (tsk->icon_data_active, tsk->icon_data, tsk->icon_width * tsk->icon_height * sizeof (DATA32));
+
 }
 
 
 void draw_task_icon (Task *tsk, int text_width, int active)
 {
-       if (tsk->icon_data == 0) return;
+       if (tsk->icon_data == 0 || tsk->icon_data_active == 0) return;
 
        Pixmap *pmap = (active == 0) ? (&tsk->area.pix.pmap) : (&tsk->area.pix_active.pmap);
+       unsigned int *icon_data = (active == 0) ? (tsk->icon_data) : (tsk->icon_data_active);
 
-       /* Find pos */
+       // Find pos
        int pos_x;
        Panel *panel = (Panel*)tsk->area.panel;
        if (panel->g_task.centered) {
@@ -251,12 +259,12 @@ void draw_task_icon (Task *tsk, int text_width, int active)
        }
        else pos_x = panel->g_task.area.paddingxlr + panel->g_task.area.pix.border.width;
 
-       /* Render */
+       // Render
        Imlib_Image icon;
        Imlib_Color_Modifier cmod;
        DATA8 red[256], green[256], blue[256], alpha[256];
 
-       icon = imlib_create_image_using_data (tsk->icon_width, tsk->icon_height, tsk->icon_data);
+       icon = imlib_create_image_using_data (tsk->icon_width, tsk->icon_height, icon_data);
        imlib_context_set_image (icon);
        imlib_context_set_drawable (*pmap);
 
@@ -328,3 +336,4 @@ void draw_task (void *obj, cairo_t *c, int active)
        }
 }
 
+
index d1870dbbbca9a6a25beb8216061f5b1a393c58ab..051c7198472360ce1cf114ea5f8dda5dcfce06f0 100644 (file)
@@ -9,6 +9,7 @@
 
 #include <X11/Xlib.h>
 #include <pango/pangocairo.h>
+#include <Imlib2.h>
 #include "common.h"
 
 
@@ -25,6 +26,8 @@ typedef struct {
        int icon_size1;
        int maximum_width;
        int maximum_height;
+   int hue, saturation, brightness;
+   int hue_active, saturation_active, brightness_active;
        // starting position for text ~ task_padding + task_border + icon_size
        double text_posx, text_posy;
 
@@ -43,7 +46,9 @@ typedef struct {
        // TODO: group task with list of windows here
        Window win;
        int  desktop;
+       // ARGB icon
        unsigned int *icon_data;
+       unsigned int *icon_data_active;
        int icon_width;
        int icon_height;
        char *title;
index ffd1c5cd8fabf8b0c1b6bb051d97da93815a2a41..51c4c220e3b6afba744b87c3d479f8765362e182 100644 (file)
@@ -482,6 +482,7 @@ void event_property_notify (XEvent *e)
                                                        tsk2->icon_width = tsk->icon_width;
                                                        tsk2->icon_height = tsk->icon_height;
                                                        tsk2->icon_data = tsk->icon_data;
+                                                       tsk2->icon_data_active = tsk->icon_data_active;
                                                        tsk2->area.redraw = 1;
                                                }
                                        }
index 0877d72c30a87f757daee00b67a08a18629819d9..e874ba6d8627e8a4a505da6443a4eb372e798c6c 100644 (file)
@@ -32,6 +32,9 @@ enum { NONE=0, CLOSE, TOGGLE, ICONIFY, SHADE, TOGGLE_ICONIFY, MAXIMIZE_RESTORE,
 
 #define ALLDESKTOP  0xFFFFFFFF
 
+#define MIN3(x,y,z)  ((y) <= (z) ? ((x) <= (y) ? (x) : (y)) : ((x) <= (z) ? (x) : (z)))
+#define MAX3(x,y,z)  ((y) >= (z) ? ((x) >= (y) ? (x) : (y)) : ((x) >= (z) ? (x) : (z)))
+
 
 typedef struct config_border
 {
This page took 0.038808 seconds and 4 git commands to generate.