Mouse effects: fixes, changed defaults, more config options
This commit is contained in:
63
src/config.c
63
src/config.c
@@ -70,6 +70,11 @@ char *snapshot_path;
|
|||||||
// detect if it's an old config file (==1)
|
// detect if it's an old config file (==1)
|
||||||
static int new_config_file;
|
static int new_config_file;
|
||||||
|
|
||||||
|
static int read_bg_color_hover;
|
||||||
|
static int read_border_color_hover;
|
||||||
|
static int read_bg_color_press;
|
||||||
|
static int read_border_color_press;
|
||||||
|
|
||||||
|
|
||||||
void default_config()
|
void default_config()
|
||||||
{
|
{
|
||||||
@@ -205,10 +210,25 @@ void add_entry (char *key, char *value)
|
|||||||
/* Background and border */
|
/* Background and border */
|
||||||
if (strcmp (key, "rounded") == 0) {
|
if (strcmp (key, "rounded") == 0) {
|
||||||
// 'rounded' is the first parameter => alloc a new background
|
// 'rounded' is the first parameter => alloc a new background
|
||||||
|
if (backgrounds->len > 0) {
|
||||||
|
Background *bg = &g_array_index(backgrounds, Background, backgrounds->len-1);
|
||||||
|
if (!read_bg_color_hover)
|
||||||
|
memcpy(&bg->back_hover, &bg->back, sizeof(Color));
|
||||||
|
if (!read_border_color_hover)
|
||||||
|
memcpy(&bg->border_hover, &bg->border, sizeof(Color));
|
||||||
|
if (!read_bg_color_press)
|
||||||
|
memcpy(&bg->back_pressed, &bg->back, sizeof(Color));
|
||||||
|
if (!read_border_color_press)
|
||||||
|
memcpy(&bg->border_pressed, &bg->border, sizeof(Color));
|
||||||
|
}
|
||||||
Background bg;
|
Background bg;
|
||||||
init_background(&bg);
|
init_background(&bg);
|
||||||
bg.border.rounded = atoi(value);
|
bg.border.rounded = atoi(value);
|
||||||
g_array_append_val(backgrounds, bg);
|
g_array_append_val(backgrounds, bg);
|
||||||
|
read_bg_color_hover = 0;
|
||||||
|
read_border_color_hover = 0;
|
||||||
|
read_bg_color_press = 0;
|
||||||
|
read_border_color_press = 0;
|
||||||
}
|
}
|
||||||
else if (strcmp (key, "border_width") == 0) {
|
else if (strcmp (key, "border_width") == 0) {
|
||||||
g_array_index(backgrounds, Background, backgrounds->len-1).border.width = atoi(value);
|
g_array_index(backgrounds, Background, backgrounds->len-1).border.width = atoi(value);
|
||||||
@@ -233,6 +253,7 @@ void add_entry (char *key, char *value)
|
|||||||
get_color (value1, bg->back_hover.color);
|
get_color (value1, bg->back_hover.color);
|
||||||
if (value2) bg->back_hover.alpha = (atoi (value2) / 100.0);
|
if (value2) bg->back_hover.alpha = (atoi (value2) / 100.0);
|
||||||
else bg->back_hover.alpha = 0.5;
|
else bg->back_hover.alpha = 0.5;
|
||||||
|
read_bg_color_hover = 1;
|
||||||
}
|
}
|
||||||
else if (strcmp (key, "border_color_hover") == 0) {
|
else if (strcmp (key, "border_color_hover") == 0) {
|
||||||
Background* bg = &g_array_index(backgrounds, Background, backgrounds->len-1);
|
Background* bg = &g_array_index(backgrounds, Background, backgrounds->len-1);
|
||||||
@@ -240,6 +261,23 @@ void add_entry (char *key, char *value)
|
|||||||
get_color (value1, bg->border_hover.color);
|
get_color (value1, bg->border_hover.color);
|
||||||
if (value2) bg->border_hover.alpha = (atoi (value2) / 100.0);
|
if (value2) bg->border_hover.alpha = (atoi (value2) / 100.0);
|
||||||
else bg->border_hover.alpha = 0.5;
|
else bg->border_hover.alpha = 0.5;
|
||||||
|
read_border_color_hover = 1;
|
||||||
|
}
|
||||||
|
else if (strcmp (key, "background_color_pressed") == 0) {
|
||||||
|
Background* bg = &g_array_index(backgrounds, Background, backgrounds->len-1);
|
||||||
|
extract_values(value, &value1, &value2, &value3);
|
||||||
|
get_color (value1, bg->back_pressed.color);
|
||||||
|
if (value2) bg->back_pressed.alpha = (atoi (value2) / 100.0);
|
||||||
|
else bg->back_pressed.alpha = 0.5;
|
||||||
|
read_bg_color_press = 1;
|
||||||
|
}
|
||||||
|
else if (strcmp (key, "border_color_pressed") == 0) {
|
||||||
|
Background* bg = &g_array_index(backgrounds, Background, backgrounds->len-1);
|
||||||
|
extract_values(value, &value1, &value2, &value3);
|
||||||
|
get_color (value1, bg->border_pressed.color);
|
||||||
|
if (value2) bg->border_pressed.alpha = (atoi (value2) / 100.0);
|
||||||
|
else bg->border_pressed.alpha = 0.5;
|
||||||
|
read_border_color_press = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Panel */
|
/* Panel */
|
||||||
@@ -842,6 +880,19 @@ void add_entry (char *key, char *value)
|
|||||||
get_action (value, &mouse_scroll_down);
|
get_action (value, &mouse_scroll_down);
|
||||||
else if (strcmp (key, "mouse_effects") == 0)
|
else if (strcmp (key, "mouse_effects") == 0)
|
||||||
panel_config.mouse_effects = atoi(value);
|
panel_config.mouse_effects = atoi(value);
|
||||||
|
else if (strcmp(key, "mouse_hover_icon_asb") == 0) {
|
||||||
|
extract_values(value, &value1, &value2, &value3);
|
||||||
|
panel_config.mouse_over_alpha = atoi(value1);
|
||||||
|
panel_config.mouse_over_saturation = atoi(value2);
|
||||||
|
panel_config.mouse_over_brightness = atoi(value3);
|
||||||
|
}
|
||||||
|
else if (strcmp(key, "mouse_pressed_icon_asb") == 0) {
|
||||||
|
extract_values(value, &value1, &value2, &value3);
|
||||||
|
panel_config.mouse_pressed_alpha = atoi(value1);
|
||||||
|
panel_config.mouse_pressed_saturation = atoi(value2);
|
||||||
|
panel_config.mouse_pressed_brightness = atoi(value3);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* autohide options */
|
/* autohide options */
|
||||||
else if (strcmp(key, "autohide") == 0)
|
else if (strcmp(key, "autohide") == 0)
|
||||||
@@ -985,6 +1036,18 @@ int config_read_file (const char *path)
|
|||||||
panel_items_order = strdup("T");
|
panel_items_order = strdup("T");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (backgrounds->len > 0) {
|
||||||
|
Background *bg = &g_array_index(backgrounds, Background, backgrounds->len-1);
|
||||||
|
if (!read_bg_color_hover)
|
||||||
|
memcpy(&bg->back_hover, &bg->back, sizeof(Color));
|
||||||
|
if (!read_border_color_hover)
|
||||||
|
memcpy(&bg->border_hover, &bg->border, sizeof(Color));
|
||||||
|
if (!read_bg_color_press)
|
||||||
|
memcpy(&bg->back_pressed, &bg->back, sizeof(Color));
|
||||||
|
if (!read_border_color_press)
|
||||||
|
memcpy(&bg->border_pressed, &bg->border, sizeof(Color));
|
||||||
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -234,8 +234,8 @@ int resize_launcher(void *obj)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (panel_config.mouse_effects) {
|
if (panel_config.mouse_effects) {
|
||||||
launcherIcon->image_hover = adjust_icon(launcherIcon->image, 100, 0, 10);
|
launcherIcon->image_hover = adjust_icon(launcherIcon->image, panel_config.mouse_over_alpha, panel_config.mouse_over_saturation, panel_config.mouse_over_brightness);
|
||||||
launcherIcon->image_pressed = adjust_icon(launcherIcon->image, 100, 0, -10);
|
launcherIcon->image_pressed = adjust_icon(launcherIcon->image, panel_config.mouse_pressed_alpha, panel_config.mouse_pressed_saturation, panel_config.mouse_pressed_brightness);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -97,6 +97,12 @@ void default_panel()
|
|||||||
backgrounds = g_array_new(0, 0, sizeof(Background));
|
backgrounds = g_array_new(0, 0, sizeof(Background));
|
||||||
|
|
||||||
memset(&panel_config, 0, sizeof(Panel));
|
memset(&panel_config, 0, sizeof(Panel));
|
||||||
|
panel_config.mouse_over_alpha = 100;
|
||||||
|
panel_config.mouse_over_saturation = 0;
|
||||||
|
panel_config.mouse_over_brightness = 10;
|
||||||
|
panel_config.mouse_pressed_alpha = 100;
|
||||||
|
panel_config.mouse_pressed_saturation = 0;
|
||||||
|
panel_config.mouse_pressed_brightness = -10;
|
||||||
|
|
||||||
// append full transparency background
|
// append full transparency background
|
||||||
Background transparent_bg;
|
Background transparent_bg;
|
||||||
|
|||||||
@@ -92,6 +92,13 @@ typedef struct {
|
|||||||
int monitor;
|
int monitor;
|
||||||
int font_shadow;
|
int font_shadow;
|
||||||
int mouse_effects;
|
int mouse_effects;
|
||||||
|
// Mouse effects for icons
|
||||||
|
int mouse_over_alpha;
|
||||||
|
int mouse_over_saturation;
|
||||||
|
int mouse_over_brightness;
|
||||||
|
int mouse_pressed_alpha;
|
||||||
|
int mouse_pressed_saturation;
|
||||||
|
int mouse_pressed_brightness;
|
||||||
|
|
||||||
// --------------------------------------------------
|
// --------------------------------------------------
|
||||||
// task and taskbar parameter per panel
|
// task and taskbar parameter per panel
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ Task *add_task (Window win)
|
|||||||
else monitor = 0;
|
else monitor = 0;
|
||||||
|
|
||||||
Task new_tsk;
|
Task new_tsk;
|
||||||
|
memset(&new_tsk, 0, sizeof(new_tsk));
|
||||||
new_tsk.area.mouse_over_effect = 1;
|
new_tsk.area.mouse_over_effect = 1;
|
||||||
new_tsk.area.mouse_press_effect = 1;
|
new_tsk.area.mouse_press_effect = 1;
|
||||||
new_tsk.win = win;
|
new_tsk.win = win;
|
||||||
@@ -323,8 +324,8 @@ void get_icon (Task *tsk)
|
|||||||
imlib_image_put_back_data(data32);
|
imlib_image_put_back_data(data32);
|
||||||
}
|
}
|
||||||
if (panel_config.mouse_effects) {
|
if (panel_config.mouse_effects) {
|
||||||
tsk->icon_hover[k] = adjust_icon(tsk->icon[k], 100, 0, 10);
|
tsk->icon_hover[k] = adjust_icon(tsk->icon[k], panel_config.mouse_over_alpha, panel_config.mouse_over_saturation, panel_config.mouse_over_brightness);
|
||||||
tsk->icon_press[k] = adjust_icon(tsk->icon[k], 100, 0, -10);
|
tsk->icon_press[k] = adjust_icon(tsk->icon[k], panel_config.mouse_pressed_alpha, panel_config.mouse_pressed_saturation, panel_config.mouse_pressed_brightness);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
imlib_context_set_image(orig_image);
|
imlib_context_set_image(orig_image);
|
||||||
|
|||||||
@@ -596,21 +596,4 @@ void mouse_out()
|
|||||||
void init_background(Background *bg)
|
void init_background(Background *bg)
|
||||||
{
|
{
|
||||||
memset(bg, 0, sizeof(Background));
|
memset(bg, 0, sizeof(Background));
|
||||||
bg->back_hover.color[0] = 0.8;
|
|
||||||
bg->back_hover.color[1] = 0.8;
|
|
||||||
bg->back_hover.color[2] = 0.8;
|
|
||||||
bg->back_hover.alpha = 0.3;
|
|
||||||
bg->border_hover.color[0] = 0.8;
|
|
||||||
bg->border_hover.color[1] = 0.8;
|
|
||||||
bg->border_hover.color[2] = 0.8;
|
|
||||||
bg->border_hover.alpha = 0.5;
|
|
||||||
|
|
||||||
bg->back_pressed.color[0] = 0.6;
|
|
||||||
bg->back_pressed.color[1] = 0.6;
|
|
||||||
bg->back_pressed.color[2] = 0.6;
|
|
||||||
bg->back_pressed.alpha = 0.3;
|
|
||||||
bg->border_pressed.color[0] = 0.8;
|
|
||||||
bg->border_pressed.color[1] = 0.8;
|
|
||||||
bg->border_pressed.color[2] = 0.8;
|
|
||||||
bg->border_pressed.alpha = 0.5;
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user