I have a button that I've changed the border color on but it appears that the window manager is overlaying the stock grey border color with it resulting in a muted version of the color.
Image 1 on the far left is a stock button with a 10 pixel wide border. Image 2 has a pink left border and image 3 is when hovering and pressing the mouse button.
Image 2 should have a red border the same brightness as image three but it's being overlaid with grey resulting in the pink color.
I'm running on Ubuntu Natty. I've tried both classic and Unico. Could someone on Precise Pangolin and or Debian confirm this behaviour ?
Attachment:
btn.png [ 17.11 KiB | Viewed 468 times ]
Code:
/* COMPILE WITH:
* gcc -Wall -o btnborder `pkg-config --cflags --libs gtk+-3.0` btnborder.c
*/
#include <gtk/gtk.h>
#include <string.h>
int main (int argc, char *argv[])
{
GtkWidget *window;
GtkWidget *mybutton;
/*-- CSS ------------------*/
GtkCssProvider *provider;
GdkDisplay *display;
GdkScreen *screen;
/*---------------------------*/
gtk_init(&argc, &argv);
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
gtk_widget_set_size_request(window, 200, 200);
gtk_window_set_title(GTK_WINDOW(window), "button border");
g_signal_connect(G_OBJECT (window), "destroy",
G_CALLBACK(gtk_main_quit), NULL);
mybutton = gtk_button_new();
gtk_widget_set_name( GTK_WIDGET(mybutton),"mybtn" );
gtk_widget_set_margin_top( GTK_WIDGET(mybutton), 40);
gtk_widget_set_margin_bottom( GTK_WIDGET(mybutton), 40);
gtk_widget_set_margin_left( GTK_WIDGET(mybutton), 40);
gtk_widget_set_margin_right( GTK_WIDGET(mybutton), 40);
/*---------------- CSS ----------------------------------------------------------------------------------------------------*/
provider = gtk_css_provider_new ();
display = gdk_display_get_default ();
screen = gdk_display_get_default_screen (display);
gtk_style_context_add_provider_for_screen (screen, GTK_STYLE_PROVIDER (provider), GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
gsize bytes_written, bytes_read;
const gchar* home = "/home/zerohour/gtk/programming/Tests/btn1.css";
GError *error = 0;
gtk_css_provider_load_from_path (provider,
g_filename_to_utf8(home, strlen(home), &bytes_read, &bytes_written, &error),
NULL);
g_object_unref (provider);
/*-------------------------------------------------------------------------------------------------------------------------*/
gtk_container_add( GTK_CONTAINER(window), mybutton );
gtk_widget_show_all(window);
gtk_main ();
return 0;
}
btn1.css
Code:
GtkWindow {
background-color: black;
}
#mybtn {
border-width: 10;
}
#mybtn:hover{
border-left-color: red;
}