[Xfce4-commits] xfce4-settings:bluesabre/display-settings Visual improvements to the identity-popup

2013-12-09 Thread Nick Schermer
Updating branch refs/heads/bluesabre/display-settings
 to af52d5f5c0782bb7a86dba96d63bff3086a0fe3d (commit)
   from 0b641006b099507b8017bc46777d2606cf7cf4e2 (commit)

commit af52d5f5c0782bb7a86dba96d63bff3086a0fe3d
Author: Simon Steinbeiss simon.steinbe...@elfenbeinturm.at
Date:   Wed Oct 10 18:27:21 2012 +0200

Visual improvements to the identity-popup

 dialogs/display-settings/main.c |   87 +--
 1 file changed, 75 insertions(+), 12 deletions(-)

diff --git a/dialogs/display-settings/main.c b/dialogs/display-settings/main.c
index 9b5aa69..0775ae8 100644
--- a/dialogs/display-settings/main.c
+++ b/dialogs/display-settings/main.c
@@ -1011,21 +1011,63 @@ display_setting_screen_changed(GtkWidget *widget, 
GdkScreen *old_screen, gpointe
 }
 
 static gboolean
-display_setting_identity_popup_expose(GtkWidget *popup, GdkEventExpose *event, 
gpointer userdata)
+display_setting_identity_popup_expose(GtkWidget *popup, GdkEventExpose *event, 
gpointer has_selection)
 {
 cairo_t *cr = gdk_cairo_create(popup-window);
 gint radius;
+gboolean selected = GPOINTER_TO_INT(has_selection);
+cairo_pattern_t *vertical_gradient, *innerstroke_gradient, 
*selected_gradient, *selected_innerstroke_gradient;
 
-radius = 15;
+radius = 10;
 cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
-
+
+/* Create the various gradients */
+   vertical_gradient = cairo_pattern_create_linear(0, 0, 0, 
popup-allocation.height);
+   cairo_pattern_add_color_stop_rgb(vertical_gradient, 0, 0.25, 0.25, 
0.25);
+   cairo_pattern_add_color_stop_rgb(vertical_gradient, 0.24, 0.15, 0.15, 
0.15);
+   cairo_pattern_add_color_stop_rgb(vertical_gradient, 0.6, 0.0, 0.0, 0.0);
+   
+   innerstroke_gradient = cairo_pattern_create_linear(0, 0, 0, 
popup-allocation.height);
+   cairo_pattern_add_color_stop_rgb(innerstroke_gradient, 0, 0.35, 0.35, 
0.35);
+   cairo_pattern_add_color_stop_rgb(innerstroke_gradient, 0.4, 0.25, 0.25, 
0.25);
+   cairo_pattern_add_color_stop_rgb(innerstroke_gradient, 0.7, 0.15, 0.15, 
0.15);
+   cairo_pattern_add_color_stop_rgb(innerstroke_gradient, 0.85, 0.0, 0.0, 
0.0);
+   
+   selected_gradient = cairo_pattern_create_linear(0, 0, 0, 
popup-allocation.height);
+   cairo_pattern_add_color_stop_rgb(selected_gradient, 0, 0.05, 0.25, 
0.45);
+   cairo_pattern_add_color_stop_rgb(selected_gradient, 0.4, 0.05, 0.15, 
0.25);
+   cairo_pattern_add_color_stop_rgb(selected_gradient, 0.6, 0.05, 0.10, 
0.20);
+   cairo_pattern_add_color_stop_rgb(selected_gradient, 0.8, 0.0, 0.05, 
0.05);
+   
+   selected_innerstroke_gradient = cairo_pattern_create_linear(0, 0, 0, 
popup-allocation.height);
+   cairo_pattern_add_color_stop_rgb(selected_innerstroke_gradient, 0, 
0.15, 0.45, 0.75);
+   cairo_pattern_add_color_stop_rgb(selected_innerstroke_gradient, 0.7, 
0.0, 0.15, 0.25);
+   cairo_pattern_add_color_stop_rgb(selected_innerstroke_gradient, 0.85, 
0.0, 0.0, 0.0);
+   
 /* Compositing is not available, so just set the background color. */
 if (!supports_alpha)
 {
-cairo_set_source_rgb(cr, 0.1, 0.1, 0.1);
+   /* Draw a filled rectangle with outline */
+   cairo_set_line_width(cr, 1.0);
+cairo_set_source(cr, vertical_gradient);
+if (selected) cairo_set_source(cr, selected_gradient);
 cairo_paint (cr);
-cairo_set_source_rgb(cr, 1.0, 1.0, 1.0);
-cairo_rectangle(cr, 0, 0, popup-allocation.width, 
popup-allocation.height);
+cairo_set_source_rgb(cr, 0.0, 0.0, 0.0);
+cairo_rectangle(cr, 0.5, 0.5, popup-allocation.width-0.5, 
popup-allocation.height-0.5);
+cairo_stroke(cr);
+
+/* Draw the inner stroke */
+cairo_set_source_rgb(cr, 0.35, 0.35, 0.35);
+if (selected) cairo_set_source_rgb(cr, 0.15, 0.45, 0.75);
+cairo_move_to(cr, 1.5, 1.5);
+cairo_line_to(cr, popup-allocation.width-1, 1.5);
+cairo_stroke(cr);
+cairo_set_source(cr, innerstroke_gradient);
+if (selected) cairo_set_source(cr, selected_innerstroke_gradient);
+cairo_move_to(cr, 1.5, 1.5);
+cairo_line_to(cr, 1.5, popup-allocation.height-1.0);
+cairo_move_to(cr, popup-allocation.width-1.5, 1.5);
+cairo_line_to(cr, popup-allocation.width-1.5, 
popup-allocation.height-1.0);
 cairo_stroke(cr);
 }
 
@@ -1043,14 +1085,35 @@ display_setting_identity_popup_expose(GtkWidget *popup, 
GdkEventExpose *event, g
 cairo_line_to(cr, popup-allocation.width-0.5 - radius, 0.5);
 cairo_arc(cr, popup-allocation.width-0.5 - radius, radius+0.5, 
radius, 3.0*3.14/2.0, 0.0);
 cairo_line_to(cr, popup-allocation.width-0.5, 
popup-allocation.height+0.5);
-cairo_set_source_rgba(cr, 0.1, 0.1, 0.1, 0.9);
+cairo_set_source(cr, vertical_gradient);
+if (selected) cairo_set_source(cr, 

[Xfce4-commits] xfce4-settings:bluesabre/display-settings Visual improvements to the identity-popup

2012-10-10 Thread Simon Steinbeiss
Updating branch refs/heads/bluesabre/display-settings
 to 89112673807e2915d38bf727bec69fab6fcbef69 (commit)
   from 633a97e9edbda29b25f403a1f7540a72d11189e7 (commit)

commit 89112673807e2915d38bf727bec69fab6fcbef69
Author: Simon Steinbeiss simon.steinbe...@elfenbeinturm.at
Date:   Wed Oct 10 18:27:21 2012 +0200

Visual improvements to the identity-popup

 dialogs/display-settings/main.c |   87 +-
 1 files changed, 75 insertions(+), 12 deletions(-)

diff --git a/dialogs/display-settings/main.c b/dialogs/display-settings/main.c
index 9b5aa69..0775ae8 100644
--- a/dialogs/display-settings/main.c
+++ b/dialogs/display-settings/main.c
@@ -1011,21 +1011,63 @@ display_setting_screen_changed(GtkWidget *widget, 
GdkScreen *old_screen, gpointe
 }
 
 static gboolean
-display_setting_identity_popup_expose(GtkWidget *popup, GdkEventExpose *event, 
gpointer userdata)
+display_setting_identity_popup_expose(GtkWidget *popup, GdkEventExpose *event, 
gpointer has_selection)
 {
 cairo_t *cr = gdk_cairo_create(popup-window);
 gint radius;
+gboolean selected = GPOINTER_TO_INT(has_selection);
+cairo_pattern_t *vertical_gradient, *innerstroke_gradient, 
*selected_gradient, *selected_innerstroke_gradient;
 
-radius = 15;
+radius = 10;
 cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
-
+
+/* Create the various gradients */
+   vertical_gradient = cairo_pattern_create_linear(0, 0, 0, 
popup-allocation.height);
+   cairo_pattern_add_color_stop_rgb(vertical_gradient, 0, 0.25, 0.25, 
0.25);
+   cairo_pattern_add_color_stop_rgb(vertical_gradient, 0.24, 0.15, 0.15, 
0.15);
+   cairo_pattern_add_color_stop_rgb(vertical_gradient, 0.6, 0.0, 0.0, 0.0);
+   
+   innerstroke_gradient = cairo_pattern_create_linear(0, 0, 0, 
popup-allocation.height);
+   cairo_pattern_add_color_stop_rgb(innerstroke_gradient, 0, 0.35, 0.35, 
0.35);
+   cairo_pattern_add_color_stop_rgb(innerstroke_gradient, 0.4, 0.25, 0.25, 
0.25);
+   cairo_pattern_add_color_stop_rgb(innerstroke_gradient, 0.7, 0.15, 0.15, 
0.15);
+   cairo_pattern_add_color_stop_rgb(innerstroke_gradient, 0.85, 0.0, 0.0, 
0.0);
+   
+   selected_gradient = cairo_pattern_create_linear(0, 0, 0, 
popup-allocation.height);
+   cairo_pattern_add_color_stop_rgb(selected_gradient, 0, 0.05, 0.25, 
0.45);
+   cairo_pattern_add_color_stop_rgb(selected_gradient, 0.4, 0.05, 0.15, 
0.25);
+   cairo_pattern_add_color_stop_rgb(selected_gradient, 0.6, 0.05, 0.10, 
0.20);
+   cairo_pattern_add_color_stop_rgb(selected_gradient, 0.8, 0.0, 0.05, 
0.05);
+   
+   selected_innerstroke_gradient = cairo_pattern_create_linear(0, 0, 0, 
popup-allocation.height);
+   cairo_pattern_add_color_stop_rgb(selected_innerstroke_gradient, 0, 
0.15, 0.45, 0.75);
+   cairo_pattern_add_color_stop_rgb(selected_innerstroke_gradient, 0.7, 
0.0, 0.15, 0.25);
+   cairo_pattern_add_color_stop_rgb(selected_innerstroke_gradient, 0.85, 
0.0, 0.0, 0.0);
+   
 /* Compositing is not available, so just set the background color. */
 if (!supports_alpha)
 {
-cairo_set_source_rgb(cr, 0.1, 0.1, 0.1);
+   /* Draw a filled rectangle with outline */
+   cairo_set_line_width(cr, 1.0);
+cairo_set_source(cr, vertical_gradient);
+if (selected) cairo_set_source(cr, selected_gradient);
 cairo_paint (cr);
-cairo_set_source_rgb(cr, 1.0, 1.0, 1.0);
-cairo_rectangle(cr, 0, 0, popup-allocation.width, 
popup-allocation.height);
+cairo_set_source_rgb(cr, 0.0, 0.0, 0.0);
+cairo_rectangle(cr, 0.5, 0.5, popup-allocation.width-0.5, 
popup-allocation.height-0.5);
+cairo_stroke(cr);
+
+/* Draw the inner stroke */
+cairo_set_source_rgb(cr, 0.35, 0.35, 0.35);
+if (selected) cairo_set_source_rgb(cr, 0.15, 0.45, 0.75);
+cairo_move_to(cr, 1.5, 1.5);
+cairo_line_to(cr, popup-allocation.width-1, 1.5);
+cairo_stroke(cr);
+cairo_set_source(cr, innerstroke_gradient);
+if (selected) cairo_set_source(cr, selected_innerstroke_gradient);
+cairo_move_to(cr, 1.5, 1.5);
+cairo_line_to(cr, 1.5, popup-allocation.height-1.0);
+cairo_move_to(cr, popup-allocation.width-1.5, 1.5);
+cairo_line_to(cr, popup-allocation.width-1.5, 
popup-allocation.height-1.0);
 cairo_stroke(cr);
 }
 
@@ -1043,14 +1085,35 @@ display_setting_identity_popup_expose(GtkWidget *popup, 
GdkEventExpose *event, g
 cairo_line_to(cr, popup-allocation.width-0.5 - radius, 0.5);
 cairo_arc(cr, popup-allocation.width-0.5 - radius, radius+0.5, 
radius, 3.0*3.14/2.0, 0.0);
 cairo_line_to(cr, popup-allocation.width-0.5, 
popup-allocation.height+0.5);
-cairo_set_source_rgba(cr, 0.1, 0.1, 0.1, 0.9);
+cairo_set_source(cr, vertical_gradient);
+if (selected) cairo_set_source(cr,