Mouse over effects
This commit is contained in:
@@ -227,6 +227,11 @@ void init_battery_panel(void *p)
|
|||||||
battery->area._resize = resize_battery;
|
battery->area._resize = resize_battery;
|
||||||
battery->area.on_screen = 1;
|
battery->area.on_screen = 1;
|
||||||
battery->area.resize = 1;
|
battery->area.resize = 1;
|
||||||
|
battery->area.mouse_effects = battery_lclick_command ||
|
||||||
|
battery_mclick_command ||
|
||||||
|
battery_rclick_command ||
|
||||||
|
battery_uwheel_command ||
|
||||||
|
battery_dwheel_command;
|
||||||
|
|
||||||
if (battery_tooltip_enabled)
|
if (battery_tooltip_enabled)
|
||||||
battery->area._get_tooltip_text = battery_get_tooltip;
|
battery->area._get_tooltip_text = battery_get_tooltip;
|
||||||
|
|||||||
@@ -185,6 +185,11 @@ void init_clock_panel(void *p)
|
|||||||
clock->area.bg = &g_array_index(backgrounds, Background, 0);
|
clock->area.bg = &g_array_index(backgrounds, Background, 0);
|
||||||
clock->area.parent = p;
|
clock->area.parent = p;
|
||||||
clock->area.panel = p;
|
clock->area.panel = p;
|
||||||
|
clock->area.mouse_effects = clock_lclick_command ||
|
||||||
|
clock_mclick_command ||
|
||||||
|
clock_rclick_command ||
|
||||||
|
clock_uwheel_command ||
|
||||||
|
clock_dwheel_command;
|
||||||
clock->area._draw_foreground = draw_clock;
|
clock->area._draw_foreground = draw_clock;
|
||||||
clock->area.size_mode = SIZE_BY_CONTENT;
|
clock->area.size_mode = SIZE_BY_CONTENT;
|
||||||
clock->area._resize = resize_clock;
|
clock->area._resize = resize_clock;
|
||||||
|
|||||||
+17
-1
@@ -206,7 +206,7 @@ void add_entry (char *key, char *value)
|
|||||||
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
|
||||||
Background bg;
|
Background bg;
|
||||||
memset(&bg, 0, sizeof(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);
|
||||||
}
|
}
|
||||||
@@ -227,6 +227,20 @@ void add_entry (char *key, char *value)
|
|||||||
if (value2) bg->border.alpha = (atoi (value2) / 100.0);
|
if (value2) bg->border.alpha = (atoi (value2) / 100.0);
|
||||||
else bg->border.alpha = 0.5;
|
else bg->border.alpha = 0.5;
|
||||||
}
|
}
|
||||||
|
else if (strcmp (key, "background_color_hover") == 0) {
|
||||||
|
Background* bg = &g_array_index(backgrounds, Background, backgrounds->len-1);
|
||||||
|
extract_values(value, &value1, &value2, &value3);
|
||||||
|
get_color (value1, bg->back_hover.color);
|
||||||
|
if (value2) bg->back_hover.alpha = (atoi (value2) / 100.0);
|
||||||
|
else bg->back_hover.alpha = 0.5;
|
||||||
|
}
|
||||||
|
else if (strcmp (key, "border_color_hover") == 0) {
|
||||||
|
Background* bg = &g_array_index(backgrounds, Background, backgrounds->len-1);
|
||||||
|
extract_values(value, &value1, &value2, &value3);
|
||||||
|
get_color (value1, bg->border_hover.color);
|
||||||
|
if (value2) bg->border_hover.alpha = (atoi (value2) / 100.0);
|
||||||
|
else bg->border_hover.alpha = 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
/* Panel */
|
/* Panel */
|
||||||
else if (strcmp (key, "panel_monitor") == 0) {
|
else if (strcmp (key, "panel_monitor") == 0) {
|
||||||
@@ -821,6 +835,8 @@ void add_entry (char *key, char *value)
|
|||||||
get_action (value, &mouse_scroll_up);
|
get_action (value, &mouse_scroll_up);
|
||||||
else if (strcmp (key, "mouse_scroll_down") == 0)
|
else if (strcmp (key, "mouse_scroll_down") == 0)
|
||||||
get_action (value, &mouse_scroll_down);
|
get_action (value, &mouse_scroll_down);
|
||||||
|
else if (strcmp (key, "mouse_effects") == 0)
|
||||||
|
panel_config.mouse_effects = atoi(value);
|
||||||
|
|
||||||
/* autohide options */
|
/* autohide options */
|
||||||
else if (strcmp(key, "autohide") == 0)
|
else if (strcmp(key, "autohide") == 0)
|
||||||
|
|||||||
@@ -426,6 +426,7 @@ void launcher_load_icons(Launcher *launcher)
|
|||||||
launcherIcon->area._resize = NULL;
|
launcherIcon->area._resize = NULL;
|
||||||
launcherIcon->area.resize = 0;
|
launcherIcon->area.resize = 0;
|
||||||
launcherIcon->area.redraw = 1;
|
launcherIcon->area.redraw = 1;
|
||||||
|
launcherIcon->area.mouse_effects = 1;
|
||||||
launcherIcon->area.bg = &g_array_index(backgrounds, Background, 0);
|
launcherIcon->area.bg = &g_array_index(backgrounds, Background, 0);
|
||||||
launcherIcon->area.on_screen = 1;
|
launcherIcon->area.on_screen = 1;
|
||||||
launcherIcon->area._on_change_layout = launcher_icon_on_change_layout;
|
launcherIcon->area._on_change_layout = launcher_icon_on_change_layout;
|
||||||
|
|||||||
+5
-2
@@ -100,7 +100,7 @@ void default_panel()
|
|||||||
|
|
||||||
// append full transparency background
|
// append full transparency background
|
||||||
Background transparent_bg;
|
Background transparent_bg;
|
||||||
memset(&transparent_bg, 0, sizeof(Background));
|
init_background(&transparent_bg);
|
||||||
g_array_append_val(backgrounds, transparent_bg);
|
g_array_append_val(backgrounds, transparent_bg);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -217,7 +217,10 @@ void init_panel()
|
|||||||
p->main_win = XCreateWindow(server.dsp, server.root_win, p->posx, p->posy, p->area.width, p->area.height, 0, server.depth, InputOutput, server.visual, mask, &att);
|
p->main_win = XCreateWindow(server.dsp, server.root_win, p->posx, p->posy, p->area.width, p->area.height, 0, server.depth, InputOutput, server.visual, mask, &att);
|
||||||
|
|
||||||
long event_mask = ExposureMask|ButtonPressMask|ButtonReleaseMask|ButtonMotionMask;
|
long event_mask = ExposureMask|ButtonPressMask|ButtonReleaseMask|ButtonMotionMask;
|
||||||
if (p->g_task.tooltip_enabled || p->clock.area._get_tooltip_text || (launcher_enabled && launcher_tooltip_enabled))
|
if (p->mouse_effects ||
|
||||||
|
p->g_task.tooltip_enabled ||
|
||||||
|
p->clock.area._get_tooltip_text ||
|
||||||
|
(launcher_enabled && launcher_tooltip_enabled))
|
||||||
event_mask |= PointerMotionMask|LeaveWindowMask;
|
event_mask |= PointerMotionMask|LeaveWindowMask;
|
||||||
if (panel_autohide)
|
if (panel_autohide)
|
||||||
event_mask |= LeaveWindowMask|EnterWindowMask;
|
event_mask |= LeaveWindowMask|EnterWindowMask;
|
||||||
|
|||||||
@@ -91,6 +91,7 @@ typedef struct {
|
|||||||
// location of the panel (monitor number)
|
// location of the panel (monitor number)
|
||||||
int monitor;
|
int monitor;
|
||||||
int font_shadow;
|
int font_shadow;
|
||||||
|
int mouse_effects;
|
||||||
|
|
||||||
// --------------------------------------------------
|
// --------------------------------------------------
|
||||||
// task and taskbar parameter per panel
|
// task and taskbar parameter per panel
|
||||||
|
|||||||
+3
-4
@@ -61,6 +61,7 @@ Task *add_task (Window win)
|
|||||||
else monitor = 0;
|
else monitor = 0;
|
||||||
|
|
||||||
Task new_tsk;
|
Task new_tsk;
|
||||||
|
new_tsk.area.mouse_effects = 1;
|
||||||
new_tsk.win = win;
|
new_tsk.win = win;
|
||||||
new_tsk.desktop = window_get_desktop (win);
|
new_tsk.desktop = window_get_desktop (win);
|
||||||
new_tsk.area.panel = &panel1[monitor];
|
new_tsk.area.panel = &panel1[monitor];
|
||||||
@@ -91,6 +92,7 @@ Task *add_task (Window win)
|
|||||||
new_tsk2 = calloc(1, sizeof(Task));
|
new_tsk2 = calloc(1, sizeof(Task));
|
||||||
memcpy(&new_tsk2->area, &panel1[monitor].g_task.area, sizeof(Area));
|
memcpy(&new_tsk2->area, &panel1[monitor].g_task.area, sizeof(Area));
|
||||||
new_tsk2->area.parent = tskbar;
|
new_tsk2->area.parent = tskbar;
|
||||||
|
new_tsk2->area.mouse_effects = 1;
|
||||||
new_tsk2->win = new_tsk.win;
|
new_tsk2->win = new_tsk.win;
|
||||||
new_tsk2->desktop = new_tsk.desktop;
|
new_tsk2->desktop = new_tsk.desktop;
|
||||||
new_tsk2->win_x = new_tsk.win_x;
|
new_tsk2->win_x = new_tsk.win_x;
|
||||||
@@ -164,16 +166,13 @@ void remove_task (Task *tsk)
|
|||||||
|
|
||||||
int i;
|
int i;
|
||||||
Task *tsk2;
|
Task *tsk2;
|
||||||
Taskbar *tskbar;
|
|
||||||
GPtrArray* task_group = g_hash_table_lookup(win_to_task_table, &win);
|
GPtrArray* task_group = g_hash_table_lookup(win_to_task_table, &win);
|
||||||
for (i=0; i<task_group->len; ++i) {
|
for (i=0; i<task_group->len; ++i) {
|
||||||
tsk2 = g_ptr_array_index(task_group, i);
|
tsk2 = g_ptr_array_index(task_group, i);
|
||||||
tskbar = tsk2->area.parent;
|
|
||||||
tskbar->area.list = g_list_remove(tskbar->area.list, tsk2);
|
|
||||||
tskbar->area.resize = 1;
|
|
||||||
if (tsk2 == task_active) task_active = 0;
|
if (tsk2 == task_active) task_active = 0;
|
||||||
if (tsk2 == task_drag) task_drag = 0;
|
if (tsk2 == task_drag) task_drag = 0;
|
||||||
if (g_slist_find(urgent_list, tsk2)) del_urgent(tsk2);
|
if (g_slist_find(urgent_list, tsk2)) del_urgent(tsk2);
|
||||||
|
remove_area(tsk2);
|
||||||
free(tsk2);
|
free(tsk2);
|
||||||
}
|
}
|
||||||
g_hash_table_remove(win_to_task_table, &win);
|
g_hash_table_remove(win_to_task_table, &win);
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ void cleanup_taskbar()
|
|||||||
}
|
}
|
||||||
free_area(&tskbar->area);
|
free_area(&tskbar->area);
|
||||||
// remove taskbar from the panel
|
// remove taskbar from the panel
|
||||||
panel->area.list = g_list_remove(panel->area.list, tskbar);
|
remove_area(tskbar);
|
||||||
}
|
}
|
||||||
if (panel->taskbar) {
|
if (panel->taskbar) {
|
||||||
free(panel->taskbar);
|
free(panel->taskbar);
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ void init_taskbarname_panel(void *p)
|
|||||||
tskbar = &panel->taskbar[j];
|
tskbar = &panel->taskbar[j];
|
||||||
memcpy(&tskbar->bar_name.area, &panel->g_taskbar.area_name, sizeof(Area));
|
memcpy(&tskbar->bar_name.area, &panel->g_taskbar.area_name, sizeof(Area));
|
||||||
tskbar->bar_name.area.parent = tskbar;
|
tskbar->bar_name.area.parent = tskbar;
|
||||||
|
tskbar->bar_name.area.mouse_effects = 1;
|
||||||
if (j == server.desktop)
|
if (j == server.desktop)
|
||||||
tskbar->bar_name.area.bg = panel->g_taskbar.background_name[TASKBAR_ACTIVE];
|
tskbar->bar_name.area.bg = panel->g_taskbar.background_name[TASKBAR_ACTIVE];
|
||||||
else
|
else
|
||||||
@@ -103,7 +104,7 @@ void cleanup_taskbarname()
|
|||||||
XFreePixmap(server.dsp, tskbar->bar_name.state_pix[k]);
|
XFreePixmap(server.dsp, tskbar->bar_name.state_pix[k]);
|
||||||
tskbar->bar_name.state_pix[k] = 0;
|
tskbar->bar_name.state_pix[k] = 0;
|
||||||
}
|
}
|
||||||
tskbar->area.list = g_list_remove(tskbar->area.list, &tskbar->bar_name);
|
remove_area(&tskbar->bar_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-1
@@ -557,7 +557,7 @@ void event_button_motion_notify (XEvent *e)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
Taskbar * drag_taskbar = (Taskbar*)task_drag->area.parent;
|
Taskbar * drag_taskbar = (Taskbar*)task_drag->area.parent;
|
||||||
drag_taskbar->area.list = g_list_remove(drag_taskbar->area.list, task_drag);
|
remove_area(task_drag);
|
||||||
|
|
||||||
if (event_taskbar->area.posx > drag_taskbar->area.posx || event_taskbar->area.posy > drag_taskbar->area.posy) {
|
if (event_taskbar->area.posx > drag_taskbar->area.posx || event_taskbar->area.posy > drag_taskbar->area.posy) {
|
||||||
int i = (taskbarname_enabled) ? 1 : 0;
|
int i = (taskbarname_enabled) ? 1 : 0;
|
||||||
@@ -1316,11 +1316,15 @@ start:
|
|||||||
tooltip_trigger_show(area, panel, &e);
|
tooltip_trigger_show(area, panel, &e);
|
||||||
else
|
else
|
||||||
tooltip_trigger_hide();
|
tooltip_trigger_hide();
|
||||||
|
if (panel_config.mouse_effects)
|
||||||
|
mouse_over(area);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case LeaveNotify:
|
case LeaveNotify:
|
||||||
tooltip_trigger_hide();
|
tooltip_trigger_hide();
|
||||||
|
if (panel_config.mouse_effects)
|
||||||
|
mouse_out();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Expose:
|
case Expose:
|
||||||
|
|||||||
+375
-345
File diff suppressed because it is too large
Load Diff
+384
-353
File diff suppressed because it is too large
Load Diff
+375
-345
File diff suppressed because it is too large
Load Diff
+375
-345
File diff suppressed because it is too large
Load Diff
+375
-345
File diff suppressed because it is too large
Load Diff
+371
-345
File diff suppressed because it is too large
Load Diff
+109
-1
@@ -34,6 +34,7 @@ GtkWidget *panel_width, *panel_height, *panel_margin_x, *panel_margin_y, *panel_
|
|||||||
GtkWidget *panel_wm_menu, *panel_dock, *panel_autohide, *panel_autohide_show_time, *panel_autohide_hide_time, *panel_autohide_size;
|
GtkWidget *panel_wm_menu, *panel_dock, *panel_autohide, *panel_autohide_show_time, *panel_autohide_hide_time, *panel_autohide_size;
|
||||||
GtkWidget *panel_combo_strut_policy, *panel_combo_layer, *panel_combo_width_type, *panel_combo_height_type, *panel_combo_monitor;
|
GtkWidget *panel_combo_strut_policy, *panel_combo_layer, *panel_combo_width_type, *panel_combo_height_type, *panel_combo_monitor;
|
||||||
GtkWidget *panel_window_name, *disable_transparency;
|
GtkWidget *panel_window_name, *disable_transparency;
|
||||||
|
GtkWidget *panel_mouse_effects;
|
||||||
|
|
||||||
GtkListStore *panel_items, *all_items;
|
GtkListStore *panel_items, *all_items;
|
||||||
GtkWidget *panel_items_view, *all_items_view;
|
GtkWidget *panel_items_view, *all_items_view;
|
||||||
@@ -126,6 +127,8 @@ GtkListStore *backgrounds;
|
|||||||
GtkWidget *current_background,
|
GtkWidget *current_background,
|
||||||
*background_fill_color,
|
*background_fill_color,
|
||||||
*background_border_color,
|
*background_border_color,
|
||||||
|
*background_fill_color_over,
|
||||||
|
*background_border_color_over,
|
||||||
*background_border_width,
|
*background_border_width,
|
||||||
*background_corner_radius;
|
*background_corner_radius;
|
||||||
|
|
||||||
@@ -458,7 +461,11 @@ void create_background(GtkWidget *parent)
|
|||||||
GTK_TYPE_INT,
|
GTK_TYPE_INT,
|
||||||
GTK_TYPE_INT,
|
GTK_TYPE_INT,
|
||||||
GTK_TYPE_INT,
|
GTK_TYPE_INT,
|
||||||
GTK_TYPE_STRING);
|
GTK_TYPE_STRING,
|
||||||
|
GDK_TYPE_COLOR,
|
||||||
|
GTK_TYPE_INT,
|
||||||
|
GDK_TYPE_COLOR,
|
||||||
|
GTK_TYPE_INT);
|
||||||
|
|
||||||
GtkWidget *table, *label, *button;
|
GtkWidget *table, *label, *button;
|
||||||
int row, col;
|
int row, col;
|
||||||
@@ -532,6 +539,34 @@ void create_background(GtkWidget *parent)
|
|||||||
col++;
|
col++;
|
||||||
gtk_tooltips_set_tip(tooltips, background_border_color, _("The border color of the current background"), NULL);
|
gtk_tooltips_set_tip(tooltips, background_border_color, _("The border color of the current background"), NULL);
|
||||||
|
|
||||||
|
row++, col = 2;
|
||||||
|
label = gtk_label_new(_("Fill color (mouse over)"));
|
||||||
|
gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
|
||||||
|
gtk_widget_show(label);
|
||||||
|
gtk_table_attach(GTK_TABLE(table), label, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
||||||
|
col++;
|
||||||
|
|
||||||
|
background_fill_color_over = gtk_color_button_new();
|
||||||
|
gtk_color_button_set_use_alpha(GTK_COLOR_BUTTON(background_fill_color_over), TRUE);
|
||||||
|
gtk_widget_show(background_fill_color_over);
|
||||||
|
gtk_table_attach(GTK_TABLE(table), background_fill_color_over, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
||||||
|
col++;
|
||||||
|
gtk_tooltips_set_tip(tooltips, background_fill_color_over, _("The fill color of the current background on mouse over"), NULL);
|
||||||
|
|
||||||
|
row++, col = 2;
|
||||||
|
label = gtk_label_new(_("Border color (mouse over)"));
|
||||||
|
gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
|
||||||
|
gtk_widget_show(label);
|
||||||
|
gtk_table_attach(GTK_TABLE(table), label, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
||||||
|
col++;
|
||||||
|
|
||||||
|
background_border_color_over = gtk_color_button_new();
|
||||||
|
gtk_color_button_set_use_alpha(GTK_COLOR_BUTTON(background_border_color_over), TRUE);
|
||||||
|
gtk_widget_show(background_border_color_over);
|
||||||
|
gtk_table_attach(GTK_TABLE(table), background_border_color_over, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
||||||
|
col++;
|
||||||
|
gtk_tooltips_set_tip(tooltips, background_border_color_over, _("The border color of the current background on mouse over"), NULL);
|
||||||
|
|
||||||
row++, col = 2;
|
row++, col = 2;
|
||||||
label = gtk_label_new(_("Border width"));
|
label = gtk_label_new(_("Border width"));
|
||||||
gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
|
gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
|
||||||
@@ -561,6 +596,8 @@ void create_background(GtkWidget *parent)
|
|||||||
g_signal_connect(G_OBJECT(current_background), "changed", G_CALLBACK(current_background_changed), NULL);
|
g_signal_connect(G_OBJECT(current_background), "changed", G_CALLBACK(current_background_changed), NULL);
|
||||||
g_signal_connect(G_OBJECT(background_fill_color), "color-set", G_CALLBACK(background_update), NULL);
|
g_signal_connect(G_OBJECT(background_fill_color), "color-set", G_CALLBACK(background_update), NULL);
|
||||||
g_signal_connect(G_OBJECT(background_border_color), "color-set", G_CALLBACK(background_update), NULL);
|
g_signal_connect(G_OBJECT(background_border_color), "color-set", G_CALLBACK(background_update), NULL);
|
||||||
|
g_signal_connect(G_OBJECT(background_fill_color_over), "color-set", G_CALLBACK(background_update), NULL);
|
||||||
|
g_signal_connect(G_OBJECT(background_border_color_over), "color-set", G_CALLBACK(background_update), NULL);
|
||||||
g_signal_connect(G_OBJECT(background_border_width), "value-changed", G_CALLBACK(background_update), NULL);
|
g_signal_connect(G_OBJECT(background_border_width), "value-changed", G_CALLBACK(background_update), NULL);
|
||||||
g_signal_connect(G_OBJECT(background_corner_radius), "value-changed", G_CALLBACK(background_update), NULL);
|
g_signal_connect(G_OBJECT(background_corner_radius), "value-changed", G_CALLBACK(background_update), NULL);
|
||||||
|
|
||||||
@@ -604,6 +641,14 @@ void background_create_new()
|
|||||||
cairoColor2GdkColor(0, 0, 0, &borderColor);
|
cairoColor2GdkColor(0, 0, 0, &borderColor);
|
||||||
int borderOpacity = 0;
|
int borderOpacity = 0;
|
||||||
|
|
||||||
|
GdkColor fillColorOver;
|
||||||
|
cairoColor2GdkColor(0.8, 0.8, 0.8, &fillColorOver);
|
||||||
|
int fillOpacityOver = 30;
|
||||||
|
GdkColor borderColorOver;
|
||||||
|
cairoColor2GdkColor(0.8, 0.8, 0.8, &borderColorOver);
|
||||||
|
int borderOpacityOver = 50;
|
||||||
|
|
||||||
|
|
||||||
int index = 0;
|
int index = 0;
|
||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
|
|
||||||
@@ -616,11 +661,16 @@ void background_create_new()
|
|||||||
bgColBorderOpacity, borderOpacity,
|
bgColBorderOpacity, borderOpacity,
|
||||||
bgColBorderWidth, b,
|
bgColBorderWidth, b,
|
||||||
bgColCornerRadius, r,
|
bgColCornerRadius, r,
|
||||||
|
bgColFillColorOver, &fillColorOver,
|
||||||
|
bgColFillOpacityOver, fillOpacityOver,
|
||||||
|
bgColBorderColorOver, &borderColorOver,
|
||||||
|
bgColBorderOpacityOver, borderOpacityOver,
|
||||||
bgColText, "",
|
bgColText, "",
|
||||||
-1);
|
-1);
|
||||||
|
|
||||||
background_update_image(index);
|
background_update_image(index);
|
||||||
gtk_combo_box_set_active(GTK_COMBO_BOX(current_background), get_model_length(GTK_TREE_MODEL(backgrounds)) - 1);
|
gtk_combo_box_set_active(GTK_COMBO_BOX(current_background), get_model_length(GTK_TREE_MODEL(backgrounds)) - 1);
|
||||||
|
current_background_changed(0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void background_duplicate(GtkWidget *widget, gpointer data)
|
void background_duplicate(GtkWidget *widget, gpointer data)
|
||||||
@@ -644,12 +694,20 @@ void background_duplicate(GtkWidget *widget, gpointer data)
|
|||||||
int fillOpacity;
|
int fillOpacity;
|
||||||
GdkColor *borderColor;
|
GdkColor *borderColor;
|
||||||
int borderOpacity;
|
int borderOpacity;
|
||||||
|
GdkColor *fillColorOver;
|
||||||
|
int fillOpacityOver;
|
||||||
|
GdkColor *borderColorOver;
|
||||||
|
int borderOpacityOver;
|
||||||
|
|
||||||
gtk_tree_model_get(GTK_TREE_MODEL(backgrounds), &iter,
|
gtk_tree_model_get(GTK_TREE_MODEL(backgrounds), &iter,
|
||||||
bgColFillColor, &fillColor,
|
bgColFillColor, &fillColor,
|
||||||
bgColFillOpacity, &fillOpacity,
|
bgColFillOpacity, &fillOpacity,
|
||||||
bgColBorderColor, &borderColor,
|
bgColBorderColor, &borderColor,
|
||||||
bgColBorderOpacity, &borderOpacity,
|
bgColBorderOpacity, &borderOpacity,
|
||||||
|
bgColFillColorOver, &fillColorOver,
|
||||||
|
bgColFillOpacityOver, &fillOpacityOver,
|
||||||
|
bgColBorderColorOver, &borderColorOver,
|
||||||
|
bgColBorderOpacityOver, &borderOpacityOver,
|
||||||
bgColBorderWidth, &b,
|
bgColBorderWidth, &b,
|
||||||
bgColCornerRadius, &r,
|
bgColCornerRadius, &r,
|
||||||
-1);
|
-1);
|
||||||
@@ -661,12 +719,18 @@ void background_duplicate(GtkWidget *widget, gpointer data)
|
|||||||
bgColFillOpacity, fillOpacity,
|
bgColFillOpacity, fillOpacity,
|
||||||
bgColBorderColor, borderColor,
|
bgColBorderColor, borderColor,
|
||||||
bgColBorderOpacity, borderOpacity,
|
bgColBorderOpacity, borderOpacity,
|
||||||
|
bgColFillColorOver, fillColorOver,
|
||||||
|
bgColFillOpacityOver, fillOpacityOver,
|
||||||
|
bgColBorderColorOver, borderColorOver,
|
||||||
|
bgColBorderOpacityOver, borderOpacityOver,
|
||||||
bgColBorderWidth, b,
|
bgColBorderWidth, b,
|
||||||
bgColCornerRadius, r,
|
bgColCornerRadius, r,
|
||||||
bgColText, ""
|
bgColText, ""
|
||||||
-1);
|
-1);
|
||||||
g_boxed_free(GDK_TYPE_COLOR, fillColor);
|
g_boxed_free(GDK_TYPE_COLOR, fillColor);
|
||||||
g_boxed_free(GDK_TYPE_COLOR, borderColor);
|
g_boxed_free(GDK_TYPE_COLOR, borderColor);
|
||||||
|
g_boxed_free(GDK_TYPE_COLOR, fillColorOver);
|
||||||
|
g_boxed_free(GDK_TYPE_COLOR, borderColorOver);
|
||||||
background_update_image(get_model_length(GTK_TREE_MODEL(backgrounds)) - 1);
|
background_update_image(get_model_length(GTK_TREE_MODEL(backgrounds)) - 1);
|
||||||
gtk_combo_box_set_active(GTK_COMBO_BOX(current_background), get_model_length(GTK_TREE_MODEL(backgrounds)) - 1);
|
gtk_combo_box_set_active(GTK_COMBO_BOX(current_background), get_model_length(GTK_TREE_MODEL(backgrounds)) - 1);
|
||||||
}
|
}
|
||||||
@@ -794,12 +858,21 @@ void background_update(GtkWidget *widget, gpointer data)
|
|||||||
GdkColor borderColor;
|
GdkColor borderColor;
|
||||||
int borderOpacity;
|
int borderOpacity;
|
||||||
|
|
||||||
|
GdkColor fillColorOver;
|
||||||
|
int fillOpacityOver;
|
||||||
|
GdkColor borderColorOver;
|
||||||
|
int borderOpacityOver;
|
||||||
|
|
||||||
r = gtk_spin_button_get_value(GTK_SPIN_BUTTON(background_corner_radius));
|
r = gtk_spin_button_get_value(GTK_SPIN_BUTTON(background_corner_radius));
|
||||||
b = gtk_spin_button_get_value(GTK_SPIN_BUTTON(background_border_width));
|
b = gtk_spin_button_get_value(GTK_SPIN_BUTTON(background_border_width));
|
||||||
gtk_color_button_get_color(GTK_COLOR_BUTTON(background_fill_color), &fillColor);
|
gtk_color_button_get_color(GTK_COLOR_BUTTON(background_fill_color), &fillColor);
|
||||||
fillOpacity = MIN(100, 0.5 + gtk_color_button_get_alpha(GTK_COLOR_BUTTON(background_fill_color)) * 100.0 / 0xffff);
|
fillOpacity = MIN(100, 0.5 + gtk_color_button_get_alpha(GTK_COLOR_BUTTON(background_fill_color)) * 100.0 / 0xffff);
|
||||||
gtk_color_button_get_color(GTK_COLOR_BUTTON(background_border_color), &borderColor);
|
gtk_color_button_get_color(GTK_COLOR_BUTTON(background_border_color), &borderColor);
|
||||||
borderOpacity = MIN(100, 0.5 + gtk_color_button_get_alpha(GTK_COLOR_BUTTON(background_border_color)) * 100.0 / 0xffff);
|
borderOpacity = MIN(100, 0.5 + gtk_color_button_get_alpha(GTK_COLOR_BUTTON(background_border_color)) * 100.0 / 0xffff);
|
||||||
|
gtk_color_button_get_color(GTK_COLOR_BUTTON(background_fill_color_over), &fillColorOver);
|
||||||
|
fillOpacityOver = MIN(100, 0.5 + gtk_color_button_get_alpha(GTK_COLOR_BUTTON(background_fill_color_over)) * 100.0 / 0xffff);
|
||||||
|
gtk_color_button_get_color(GTK_COLOR_BUTTON(background_border_color_over), &borderColorOver);
|
||||||
|
borderOpacityOver = MIN(100, 0.5 + gtk_color_button_get_alpha(GTK_COLOR_BUTTON(background_border_color_over)) * 100.0 / 0xffff);
|
||||||
|
|
||||||
gtk_list_store_set(backgrounds, &iter,
|
gtk_list_store_set(backgrounds, &iter,
|
||||||
bgColPixbuf, NULL,
|
bgColPixbuf, NULL,
|
||||||
@@ -807,6 +880,10 @@ void background_update(GtkWidget *widget, gpointer data)
|
|||||||
bgColFillOpacity, fillOpacity,
|
bgColFillOpacity, fillOpacity,
|
||||||
bgColBorderColor, &borderColor,
|
bgColBorderColor, &borderColor,
|
||||||
bgColBorderOpacity, borderOpacity,
|
bgColBorderOpacity, borderOpacity,
|
||||||
|
bgColFillColorOver, &fillColorOver,
|
||||||
|
bgColFillOpacityOver, fillOpacityOver,
|
||||||
|
bgColBorderColorOver, &borderColorOver,
|
||||||
|
bgColBorderOpacityOver, borderOpacityOver,
|
||||||
bgColBorderWidth, b,
|
bgColBorderWidth, b,
|
||||||
bgColCornerRadius, r,
|
bgColCornerRadius, r,
|
||||||
-1);
|
-1);
|
||||||
@@ -832,12 +909,20 @@ void current_background_changed(GtkWidget *widget, gpointer data)
|
|||||||
int fillOpacity;
|
int fillOpacity;
|
||||||
GdkColor *borderColor;
|
GdkColor *borderColor;
|
||||||
int borderOpacity;
|
int borderOpacity;
|
||||||
|
GdkColor *fillColorOver;
|
||||||
|
int fillOpacityOver;
|
||||||
|
GdkColor *borderColorOver;
|
||||||
|
int borderOpacityOver;
|
||||||
|
|
||||||
gtk_tree_model_get(GTK_TREE_MODEL(backgrounds), &iter,
|
gtk_tree_model_get(GTK_TREE_MODEL(backgrounds), &iter,
|
||||||
bgColFillColor, &fillColor,
|
bgColFillColor, &fillColor,
|
||||||
bgColFillOpacity, &fillOpacity,
|
bgColFillOpacity, &fillOpacity,
|
||||||
bgColBorderColor, &borderColor,
|
bgColBorderColor, &borderColor,
|
||||||
bgColBorderOpacity, &borderOpacity,
|
bgColBorderOpacity, &borderOpacity,
|
||||||
|
bgColFillColorOver, &fillColorOver,
|
||||||
|
bgColFillOpacityOver, &fillOpacityOver,
|
||||||
|
bgColBorderColorOver, &borderColorOver,
|
||||||
|
bgColBorderOpacityOver, &borderOpacityOver,
|
||||||
bgColBorderWidth, &b,
|
bgColBorderWidth, &b,
|
||||||
bgColCornerRadius, &r,
|
bgColCornerRadius, &r,
|
||||||
-1);
|
-1);
|
||||||
@@ -846,11 +931,19 @@ void current_background_changed(GtkWidget *widget, gpointer data)
|
|||||||
gtk_color_button_set_alpha(GTK_COLOR_BUTTON(background_fill_color), (fillOpacity*0xffff)/100);
|
gtk_color_button_set_alpha(GTK_COLOR_BUTTON(background_fill_color), (fillOpacity*0xffff)/100);
|
||||||
gtk_color_button_set_color(GTK_COLOR_BUTTON(background_border_color), borderColor);
|
gtk_color_button_set_color(GTK_COLOR_BUTTON(background_border_color), borderColor);
|
||||||
gtk_color_button_set_alpha(GTK_COLOR_BUTTON(background_border_color), (borderOpacity*0xffff)/100);
|
gtk_color_button_set_alpha(GTK_COLOR_BUTTON(background_border_color), (borderOpacity*0xffff)/100);
|
||||||
|
|
||||||
|
gtk_color_button_set_color(GTK_COLOR_BUTTON(background_fill_color_over), fillColorOver);
|
||||||
|
gtk_color_button_set_alpha(GTK_COLOR_BUTTON(background_fill_color_over), (fillOpacityOver*0xffff)/100);
|
||||||
|
gtk_color_button_set_color(GTK_COLOR_BUTTON(background_border_color_over), borderColorOver);
|
||||||
|
gtk_color_button_set_alpha(GTK_COLOR_BUTTON(background_border_color_over), (borderOpacityOver*0xffff)/100);
|
||||||
|
|
||||||
gtk_spin_button_set_value(GTK_SPIN_BUTTON(background_border_width), b);
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(background_border_width), b);
|
||||||
gtk_spin_button_set_value(GTK_SPIN_BUTTON(background_corner_radius), r);
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(background_corner_radius), r);
|
||||||
|
|
||||||
g_boxed_free(GDK_TYPE_COLOR, fillColor);
|
g_boxed_free(GDK_TYPE_COLOR, fillColor);
|
||||||
g_boxed_free(GDK_TYPE_COLOR, borderColor);
|
g_boxed_free(GDK_TYPE_COLOR, borderColor);
|
||||||
|
g_boxed_free(GDK_TYPE_COLOR, fillColorOver);
|
||||||
|
g_boxed_free(GDK_TYPE_COLOR, borderColorOver);
|
||||||
}
|
}
|
||||||
|
|
||||||
void create_panel(GtkWidget *parent)
|
void create_panel(GtkWidget *parent)
|
||||||
@@ -1128,6 +1221,21 @@ void create_panel(GtkWidget *parent)
|
|||||||
gtk_tooltips_set_tip(tooltips, font_shadow, _("If enabled, a shadow will be drawn behind text. "
|
gtk_tooltips_set_tip(tooltips, font_shadow, _("If enabled, a shadow will be drawn behind text. "
|
||||||
"This may improve legibility on transparent panels."), NULL);
|
"This may improve legibility on transparent panels."), NULL);
|
||||||
|
|
||||||
|
row++;
|
||||||
|
col = 2;
|
||||||
|
label = gtk_label_new(_("Mouse effects"));
|
||||||
|
gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
|
||||||
|
gtk_widget_show(label);
|
||||||
|
gtk_table_attach(GTK_TABLE(table), label, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
||||||
|
col++;
|
||||||
|
|
||||||
|
panel_mouse_effects = gtk_check_button_new();
|
||||||
|
gtk_widget_show(panel_mouse_effects);
|
||||||
|
gtk_table_attach(GTK_TABLE(table), panel_mouse_effects, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
||||||
|
col++;
|
||||||
|
gtk_tooltips_set_tip(tooltips, panel_mouse_effects, _("Clickable interface items change appearance when the mouse is moved over them."), NULL);
|
||||||
|
|
||||||
|
|
||||||
change_paragraph(parent);
|
change_paragraph(parent);
|
||||||
|
|
||||||
label = gtk_label_new(_("<b>Autohide</b>"));
|
label = gtk_label_new(_("<b>Autohide</b>"));
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ extern GtkWidget *panel_width, *panel_height, *panel_margin_x, *panel_margin_y,
|
|||||||
extern GtkWidget *panel_wm_menu, *panel_dock, *panel_autohide, *panel_autohide_show_time, *panel_autohide_hide_time, *panel_autohide_size;
|
extern GtkWidget *panel_wm_menu, *panel_dock, *panel_autohide, *panel_autohide_show_time, *panel_autohide_hide_time, *panel_autohide_size;
|
||||||
extern GtkWidget *panel_combo_strut_policy, *panel_combo_layer, *panel_combo_width_type, *panel_combo_height_type, *panel_combo_monitor;
|
extern GtkWidget *panel_combo_strut_policy, *panel_combo_layer, *panel_combo_width_type, *panel_combo_height_type, *panel_combo_monitor;
|
||||||
extern GtkWidget *panel_window_name, *disable_transparency;
|
extern GtkWidget *panel_window_name, *disable_transparency;
|
||||||
|
extern GtkWidget *panel_mouse_effects;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
itemsColName = 0,
|
itemsColName = 0,
|
||||||
@@ -147,6 +148,10 @@ enum {
|
|||||||
bgColBorderWidth,
|
bgColBorderWidth,
|
||||||
bgColCornerRadius,
|
bgColCornerRadius,
|
||||||
bgColText,
|
bgColText,
|
||||||
|
bgColFillColorOver,
|
||||||
|
bgColFillOpacityOver,
|
||||||
|
bgColBorderColorOver,
|
||||||
|
bgColBorderOpacityOver,
|
||||||
bgNumCols
|
bgNumCols
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -154,6 +159,8 @@ extern GtkListStore *backgrounds;
|
|||||||
extern GtkWidget *current_background,
|
extern GtkWidget *current_background,
|
||||||
*background_fill_color,
|
*background_fill_color,
|
||||||
*background_border_color,
|
*background_border_color,
|
||||||
|
*background_fill_color_over,
|
||||||
|
*background_border_color_over,
|
||||||
*background_border_width,
|
*background_border_width,
|
||||||
*background_corner_radius;
|
*background_corner_radius;
|
||||||
|
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ void config_read_file(const char *path)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void config_write_color(FILE *fp, char *name, GdkColor color, int opacity)
|
void config_write_color(FILE *fp, const char *name, GdkColor color, int opacity)
|
||||||
{
|
{
|
||||||
fprintf(fp,
|
fprintf(fp,
|
||||||
"%s = #%02x%02x%02x %d\n",
|
"%s = #%02x%02x%02x %d\n",
|
||||||
@@ -110,6 +110,10 @@ void config_write_backgrounds(FILE *fp)
|
|||||||
int fillOpacity;
|
int fillOpacity;
|
||||||
GdkColor *borderColor;
|
GdkColor *borderColor;
|
||||||
int borderOpacity;
|
int borderOpacity;
|
||||||
|
GdkColor *fillColorOver;
|
||||||
|
int fillOpacityOver;
|
||||||
|
GdkColor *borderColorOver;
|
||||||
|
int borderOpacityOver;
|
||||||
gchar *text;
|
gchar *text;
|
||||||
|
|
||||||
gtk_tree_model_get(GTK_TREE_MODEL(backgrounds), &iter,
|
gtk_tree_model_get(GTK_TREE_MODEL(backgrounds), &iter,
|
||||||
@@ -117,6 +121,10 @@ void config_write_backgrounds(FILE *fp)
|
|||||||
bgColFillOpacity, &fillOpacity,
|
bgColFillOpacity, &fillOpacity,
|
||||||
bgColBorderColor, &borderColor,
|
bgColBorderColor, &borderColor,
|
||||||
bgColBorderOpacity, &borderOpacity,
|
bgColBorderOpacity, &borderOpacity,
|
||||||
|
bgColFillColorOver, &fillColorOver,
|
||||||
|
bgColFillOpacityOver, &fillOpacityOver,
|
||||||
|
bgColBorderColorOver, &borderColorOver,
|
||||||
|
bgColBorderOpacityOver, &borderOpacityOver,
|
||||||
bgColBorderWidth, &b,
|
bgColBorderWidth, &b,
|
||||||
bgColCornerRadius, &r,
|
bgColCornerRadius, &r,
|
||||||
bgColText, &text,
|
bgColText, &text,
|
||||||
@@ -126,6 +134,8 @@ void config_write_backgrounds(FILE *fp)
|
|||||||
fprintf(fp, "border_width = %d\n", b);
|
fprintf(fp, "border_width = %d\n", b);
|
||||||
config_write_color(fp, "background_color", *fillColor, fillOpacity);
|
config_write_color(fp, "background_color", *fillColor, fillOpacity);
|
||||||
config_write_color(fp, "border_color", *borderColor, borderOpacity);
|
config_write_color(fp, "border_color", *borderColor, borderOpacity);
|
||||||
|
config_write_color(fp, "background_color_hover", *fillColorOver, fillOpacityOver);
|
||||||
|
config_write_color(fp, "border_color_hover", *borderColorOver, borderOpacityOver);
|
||||||
fprintf(fp, "\n");
|
fprintf(fp, "\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -216,6 +226,7 @@ void config_write_panel(FILE *fp)
|
|||||||
|
|
||||||
fprintf(fp, "panel_window_name = %s\n", gtk_entry_get_text(GTK_ENTRY(panel_window_name)));
|
fprintf(fp, "panel_window_name = %s\n", gtk_entry_get_text(GTK_ENTRY(panel_window_name)));
|
||||||
fprintf(fp, "disable_transparency = %d\n", gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(disable_transparency)) ? 1 : 0);
|
fprintf(fp, "disable_transparency = %d\n", gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(disable_transparency)) ? 1 : 0);
|
||||||
|
fprintf(fp, "mouse_effects = %d\n", gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(panel_mouse_effects)) ? 1 : 0);
|
||||||
fprintf(fp, "font_shadow = %d\n", gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(font_shadow)) ? 1 : 0);
|
fprintf(fp, "font_shadow = %d\n", gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(font_shadow)) ? 1 : 0);
|
||||||
|
|
||||||
fprintf(fp, "\n");
|
fprintf(fp, "\n");
|
||||||
@@ -729,6 +740,24 @@ void add_entry(char *key, char *value)
|
|||||||
gtk_color_button_set_alpha(GTK_COLOR_BUTTON(background_border_color), (alpha*65535)/100);
|
gtk_color_button_set_alpha(GTK_COLOR_BUTTON(background_border_color), (alpha*65535)/100);
|
||||||
background_force_update();
|
background_force_update();
|
||||||
}
|
}
|
||||||
|
else if (strcmp(key, "background_color_hover") == 0) {
|
||||||
|
extract_values(value, &value1, &value2, &value3);
|
||||||
|
GdkColor col;
|
||||||
|
hex2gdk(value1, &col);
|
||||||
|
gtk_color_button_set_color(GTK_COLOR_BUTTON(background_fill_color_over), &col);
|
||||||
|
int alpha = value2 ? atoi(value2) : 50;
|
||||||
|
gtk_color_button_set_alpha(GTK_COLOR_BUTTON(background_fill_color_over), (alpha*65535)/100);
|
||||||
|
background_force_update();
|
||||||
|
}
|
||||||
|
else if (strcmp(key, "border_color_hover") == 0) {
|
||||||
|
extract_values(value, &value1, &value2, &value3);
|
||||||
|
GdkColor col;
|
||||||
|
hex2gdk(value1, &col);
|
||||||
|
gtk_color_button_set_color(GTK_COLOR_BUTTON(background_border_color_over), &col);
|
||||||
|
int alpha = value2 ? atoi(value2) : 50;
|
||||||
|
gtk_color_button_set_alpha(GTK_COLOR_BUTTON(background_border_color_over), (alpha*65535)/100);
|
||||||
|
background_force_update();
|
||||||
|
}
|
||||||
|
|
||||||
/* Panel */
|
/* Panel */
|
||||||
else if (strcmp(key, "panel_size") == 0) {
|
else if (strcmp(key, "panel_size") == 0) {
|
||||||
@@ -842,6 +871,9 @@ void add_entry(char *key, char *value)
|
|||||||
else if (strcmp(key, "disable_transparency") == 0) {
|
else if (strcmp(key, "disable_transparency") == 0) {
|
||||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(disable_transparency), atoi(value));
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(disable_transparency), atoi(value));
|
||||||
}
|
}
|
||||||
|
else if (strcmp(key, "mouse_effects") == 0) {
|
||||||
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(panel_mouse_effects), atoi(value));
|
||||||
|
}
|
||||||
else if (strcmp(key, "font_shadow") == 0) {
|
else if (strcmp(key, "font_shadow") == 0) {
|
||||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(font_shadow), atoi(value));
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(font_shadow), atoi(value));
|
||||||
}
|
}
|
||||||
|
|||||||
+62
-45
@@ -71,6 +71,8 @@
|
|||||||
*
|
*
|
||||||
************************************************************/
|
************************************************************/
|
||||||
|
|
||||||
|
Area *mouse_over_area = NULL;
|
||||||
|
|
||||||
void init_rendering(void *obj, int pos)
|
void init_rendering(void *obj, int pos)
|
||||||
{
|
{
|
||||||
Area *a = (Area*)obj;
|
Area *a = (Area*)obj;
|
||||||
@@ -443,69 +445,44 @@ void draw (Area *a)
|
|||||||
|
|
||||||
void draw_background (Area *a, cairo_t *c)
|
void draw_background (Area *a, cairo_t *c)
|
||||||
{
|
{
|
||||||
if (a->bg->back.alpha > 0.0) {
|
if (a->bg->back.alpha > 0.0 ||
|
||||||
|
(panel_config.mouse_effects && a->mouse_effects && a->mouse_state == MOUSE_OVER)) {
|
||||||
//printf(" draw_background (%d %d) RGBA (%lf, %lf, %lf, %lf)\n", a->posx, a->posy, pix->back.color[0], pix->back.color[1], pix->back.color[2], pix->back.alpha);
|
//printf(" draw_background (%d %d) RGBA (%lf, %lf, %lf, %lf)\n", a->posx, a->posy, pix->back.color[0], pix->back.color[1], pix->back.color[2], pix->back.alpha);
|
||||||
draw_rect(c, a->bg->border.width, a->bg->border.width, a->width-(2.0 * a->bg->border.width), a->height-(2.0*a->bg->border.width), a->bg->border.rounded - a->bg->border.width/1.571);
|
if (a->mouse_state == MOUSE_OVER) {
|
||||||
|
cairo_set_source_rgba(c, a->bg->back_hover.color[0], a->bg->back_hover.color[1], a->bg->back_hover.color[2], a->bg->back_hover.alpha);
|
||||||
|
} else
|
||||||
cairo_set_source_rgba(c, a->bg->back.color[0], a->bg->back.color[1], a->bg->back.color[2], a->bg->back.alpha);
|
cairo_set_source_rgba(c, a->bg->back.color[0], a->bg->back.color[1], a->bg->back.color[2], a->bg->back.alpha);
|
||||||
|
draw_rect(c, a->bg->border.width, a->bg->border.width, a->width-(2.0 * a->bg->border.width), a->height-(2.0*a->bg->border.width), a->bg->border.rounded - a->bg->border.width/1.571);
|
||||||
cairo_fill(c);
|
cairo_fill(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (a->bg->border.width > 0 && a->bg->border.alpha > 0.0) {
|
if (a->bg->border.width > 0) {
|
||||||
cairo_set_line_width (c, a->bg->border.width);
|
cairo_set_line_width (c, a->bg->border.width);
|
||||||
|
|
||||||
// draw border inside (x, y, width, height)
|
// draw border inside (x, y, width, height)
|
||||||
|
if (a->mouse_state == MOUSE_OVER) {
|
||||||
|
cairo_set_source_rgba(c, a->bg->border_hover.color[0], a->bg->border_hover.color[1], a->bg->border_hover.color[2], a->bg->border_hover.alpha);
|
||||||
|
} else
|
||||||
|
cairo_set_source_rgba(c, a->bg->border.color[0], a->bg->border.color[1], a->bg->border.color[2], a->bg->border.alpha);
|
||||||
draw_rect(c, a->bg->border.width/2.0, a->bg->border.width/2.0, a->width - a->bg->border.width, a->height - a->bg->border.width, a->bg->border.rounded);
|
draw_rect(c, a->bg->border.width/2.0, a->bg->border.width/2.0, a->width - a->bg->border.width, a->height - a->bg->border.width, a->bg->border.rounded);
|
||||||
/*
|
|
||||||
// convert : radian = degre * M_PI/180
|
|
||||||
// definir le degrade dans un carre de (0,0) (100,100)
|
|
||||||
// ensuite ce degrade est extrapoler selon le ratio width/height
|
|
||||||
// dans repere (0, 0) (100, 100)
|
|
||||||
double X0, Y0, X1, Y1, degre;
|
|
||||||
// x = X * (a->width / 100), y = Y * (a->height / 100)
|
|
||||||
double x0, y0, x1, y1;
|
|
||||||
X0 = 0;
|
|
||||||
Y0 = 100;
|
|
||||||
X1 = 100;
|
|
||||||
Y1 = 0;
|
|
||||||
degre = 45;
|
|
||||||
// et ensuite faire la changement d'unite du repere
|
|
||||||
// car ce qui doit reste inchangee est les traits et pas la direction
|
|
||||||
|
|
||||||
// il faut d'abord appliquer une rotation de 90 (et -180 si l'angle est superieur a 180)
|
cairo_stroke(c);
|
||||||
// ceci peut etre applique une fois pour toute au depart
|
|
||||||
// ensuite calculer l'angle dans le nouveau repare
|
|
||||||
// puis faire une rotation de 90
|
|
||||||
x0 = X0 * ((double)a->width / 100);
|
|
||||||
x1 = X1 * ((double)a->width / 100);
|
|
||||||
y0 = Y0 * ((double)a->height / 100);
|
|
||||||
y1 = Y1 * ((double)a->height / 100);
|
|
||||||
|
|
||||||
x0 = X0 * ((double)a->height / 100);
|
|
||||||
x1 = X1 * ((double)a->height / 100);
|
|
||||||
y0 = Y0 * ((double)a->width / 100);
|
|
||||||
y1 = Y1 * ((double)a->width / 100);
|
|
||||||
|
|
||||||
cairo_pattern_t *linpat;
|
|
||||||
linpat = cairo_pattern_create_linear (x0, y0, x1, y1);
|
|
||||||
cairo_pattern_add_color_stop_rgba (linpat, 0, a->border.color[0], a->border.color[1], a->border.color[2], a->border.alpha);
|
|
||||||
cairo_pattern_add_color_stop_rgba (linpat, 1, a->border.color[0], a->border.color[1], a->border.color[2], 0);
|
|
||||||
cairo_set_source (c, linpat);
|
|
||||||
*/
|
|
||||||
cairo_set_source_rgba (c, a->bg->border.color[0], a->bg->border.color[1], a->bg->border.color[2], a->bg->border.alpha);
|
|
||||||
|
|
||||||
cairo_stroke (c);
|
|
||||||
//cairo_pattern_destroy (linpat);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void remove_area (Area *a)
|
void remove_area (void *a)
|
||||||
{
|
{
|
||||||
Area *parent = (Area*)a->parent;
|
Area *area = (Area*)a;
|
||||||
|
Area *parent = (Area*)area->parent;
|
||||||
|
|
||||||
parent->list = g_list_remove(parent->list, a);
|
parent->list = g_list_remove(parent->list, area);
|
||||||
|
parent->resize = 1;
|
||||||
set_redraw (parent);
|
set_redraw (parent);
|
||||||
|
|
||||||
|
if (mouse_over_area == a) {
|
||||||
|
mouse_over_area = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -536,6 +513,9 @@ void free_area (Area *a)
|
|||||||
XFreePixmap (server.dsp, a->pix);
|
XFreePixmap (server.dsp, a->pix);
|
||||||
a->pix = 0;
|
a->pix = 0;
|
||||||
}
|
}
|
||||||
|
if (mouse_over_area == a) {
|
||||||
|
mouse_over_area = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -566,3 +546,40 @@ void clear_pixmap(Pixmap p, int x, int y, int w, int h)
|
|||||||
XRenderFillRectangle(server.dsp, PictOpSrc, pict, &col, x, y, w, h);
|
XRenderFillRectangle(server.dsp, PictOpSrc, pict, &col, x, y, w, h);
|
||||||
XRenderFreePicture(server.dsp, pict);
|
XRenderFreePicture(server.dsp, pict);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void mouse_over(Area *area)
|
||||||
|
{
|
||||||
|
if (mouse_over_area == area)
|
||||||
|
return;
|
||||||
|
mouse_out();
|
||||||
|
if (!area->mouse_effects)
|
||||||
|
return;
|
||||||
|
mouse_over_area = area;
|
||||||
|
|
||||||
|
mouse_over_area->mouse_state = MOUSE_OVER;
|
||||||
|
set_redraw(mouse_over_area);
|
||||||
|
panel_refresh = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void mouse_out()
|
||||||
|
{
|
||||||
|
if (!mouse_over_area)
|
||||||
|
return;
|
||||||
|
mouse_over_area->mouse_state = MOUSE_NORMAL;
|
||||||
|
set_redraw(mouse_over_area);
|
||||||
|
panel_refresh = 1;
|
||||||
|
mouse_over_area = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void init_background(Background *bg)
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|||||||
+18
-1
@@ -44,6 +44,8 @@ typedef struct
|
|||||||
{
|
{
|
||||||
Color back;
|
Color back;
|
||||||
Border border;
|
Border border;
|
||||||
|
Color back_hover;
|
||||||
|
Color border_hover;
|
||||||
} Background;
|
} Background;
|
||||||
|
|
||||||
|
|
||||||
@@ -53,6 +55,12 @@ typedef struct
|
|||||||
enum { SIZE_BY_LAYOUT, SIZE_BY_CONTENT };
|
enum { SIZE_BY_LAYOUT, SIZE_BY_CONTENT };
|
||||||
enum { ALIGN_LEFT = 0, ALIGN_CENTER = 1, ALIGN_RIGHT = 2 };
|
enum { ALIGN_LEFT = 0, ALIGN_CENTER = 1, ALIGN_RIGHT = 2 };
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
MOUSE_NORMAL = 0,
|
||||||
|
MOUSE_OVER = 1
|
||||||
|
} MouseState;
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
// coordinate relative to panel window
|
// coordinate relative to panel window
|
||||||
int posx, posy;
|
int posx, posy;
|
||||||
@@ -83,6 +91,9 @@ typedef struct {
|
|||||||
// panel
|
// panel
|
||||||
void *panel;
|
void *panel;
|
||||||
|
|
||||||
|
int mouse_effects;
|
||||||
|
MouseState mouse_state;
|
||||||
|
|
||||||
// each object can overwrite following function
|
// each object can overwrite following function
|
||||||
void (*_draw_foreground)(void *obj, cairo_t *c);
|
void (*_draw_foreground)(void *obj, cairo_t *c);
|
||||||
// update area's content and update size (width/heith).
|
// update area's content and update size (width/heith).
|
||||||
@@ -95,6 +106,8 @@ typedef struct {
|
|||||||
char* (*_get_tooltip_text)(void *obj);
|
char* (*_get_tooltip_text)(void *obj);
|
||||||
} Area;
|
} Area;
|
||||||
|
|
||||||
|
void init_background(Background *bg);
|
||||||
|
|
||||||
// on startup, initialize fixed pos/size
|
// on startup, initialize fixed pos/size
|
||||||
void init_rendering(void *obj, int pos);
|
void init_rendering(void *obj, int pos);
|
||||||
|
|
||||||
@@ -118,7 +131,7 @@ void show(Area *a);
|
|||||||
void draw (Area *a);
|
void draw (Area *a);
|
||||||
void draw_background (Area *a, cairo_t *c);
|
void draw_background (Area *a, cairo_t *c);
|
||||||
|
|
||||||
void remove_area (Area *a);
|
void remove_area (void *a);
|
||||||
void add_area (Area *a);
|
void add_area (Area *a);
|
||||||
void free_area (Area *a);
|
void free_area (Area *a);
|
||||||
|
|
||||||
@@ -127,5 +140,9 @@ void draw_rect(cairo_t *c, double x, double y, double w, double h, double r);
|
|||||||
|
|
||||||
// clear pixmap with transparent color
|
// clear pixmap with transparent color
|
||||||
void clear_pixmap(Pixmap p, int x, int y, int w, int h);
|
void clear_pixmap(Pixmap p, int x, int y, int w, int h);
|
||||||
|
|
||||||
|
void mouse_over(Area *area);
|
||||||
|
void mouse_out();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user