Changed the default colors
This commit is contained in:
parent
58cce62927
commit
ab6b005a06
23
src/key.c
23
src/key.c
|
@ -1,5 +1,5 @@
|
||||||
/* $Id$ */
|
/* $Id$ */
|
||||||
/* Copyright (c) 2010 Pierre Pronchery <khorben@defora.org> */
|
/* Copyright (c) 2011 Pierre Pronchery <khorben@defora.org> */
|
||||||
/* This file is part of DeforaOS Desktop Keyboard */
|
/* This file is part of DeforaOS Desktop Keyboard */
|
||||||
/* This program is free software: you can redistribute it and/or modify
|
/* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -122,6 +122,27 @@ GtkWidget * keyboard_key_get_widget(KeyboardKey * key)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* keyboard_key_set_background */
|
||||||
|
void keyboard_key_set_background(KeyboardKey * key, GdkColor * color)
|
||||||
|
{
|
||||||
|
gtk_widget_modify_bg(key->widget, GTK_STATE_NORMAL, color);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* keyboard_key_set_font */
|
||||||
|
void keyboard_key_set_font(KeyboardKey * key, PangoFontDescription * font)
|
||||||
|
{
|
||||||
|
gtk_widget_modify_font(key->label, font);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* keyboard_key_set_foreground */
|
||||||
|
void keyboard_key_set_foreground(KeyboardKey * key, GdkColor * color)
|
||||||
|
{
|
||||||
|
gtk_widget_modify_fg(key->label, GTK_STATE_NORMAL, color);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* keyboard_key_set_modifier */
|
/* keyboard_key_set_modifier */
|
||||||
int keyboard_key_set_modifier(KeyboardKey * key, unsigned int modifier,
|
int keyboard_key_set_modifier(KeyboardKey * key, unsigned int modifier,
|
||||||
unsigned int keysym, char const * label)
|
unsigned int keysym, char const * label)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* $Id$ */
|
/* $Id$ */
|
||||||
/* Copyright (c) 2010 Pierre Pronchery <khorben@defora.org> */
|
/* Copyright (c) 2011 Pierre Pronchery <khorben@defora.org> */
|
||||||
/* This file is part of DeforaOS Desktop Keyboard */
|
/* This file is part of DeforaOS Desktop Keyboard */
|
||||||
/* This program is free software: you can redistribute it and/or modify
|
/* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -36,6 +36,9 @@ GtkWidget * keyboard_key_get_label_widget(KeyboardKey * key);
|
||||||
GtkWidget * keyboard_key_get_widget(KeyboardKey * key);
|
GtkWidget * keyboard_key_get_widget(KeyboardKey * key);
|
||||||
unsigned int keyboard_key_get_width(KeyboardKey * key);
|
unsigned int keyboard_key_get_width(KeyboardKey * key);
|
||||||
|
|
||||||
|
void keyboard_key_set_background(KeyboardKey * key, GdkColor * color);
|
||||||
|
void keyboard_key_set_font(KeyboardKey * key, PangoFontDescription * font);
|
||||||
|
void keyboard_key_set_foreground(KeyboardKey * key, GdkColor * color);
|
||||||
int keyboard_key_set_modifier(KeyboardKey * key, unsigned int modifier,
|
int keyboard_key_set_modifier(KeyboardKey * key, unsigned int modifier,
|
||||||
unsigned int keysym, char const * label);
|
unsigned int keysym, char const * label);
|
||||||
|
|
||||||
|
|
|
@ -271,6 +271,7 @@ Keyboard * keyboard_new(KeyboardPrefs * prefs)
|
||||||
GtkWidget * vbox;
|
GtkWidget * vbox;
|
||||||
GtkWidget * widget;
|
GtkWidget * widget;
|
||||||
PangoFontDescription * bold;
|
PangoFontDescription * bold;
|
||||||
|
GdkColor gray = { 0xb0b0b0b0, 0xb0b0, 0xb0b0, 0xb0b0 };
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf(stderr, "DEBUG: %s()\n", __func__);
|
fprintf(stderr, "DEBUG: %s()\n", __func__);
|
||||||
|
@ -319,13 +320,17 @@ Keyboard * keyboard_new(KeyboardPrefs * prefs)
|
||||||
"delete-event",
|
"delete-event",
|
||||||
G_CALLBACK(on_keyboard_delete_event), keyboard);
|
G_CALLBACK(on_keyboard_delete_event), keyboard);
|
||||||
}
|
}
|
||||||
|
gtk_widget_modify_bg(keyboard->window, GTK_STATE_NORMAL, &gray);
|
||||||
/* fonts */
|
/* fonts */
|
||||||
if(prefs->font != NULL)
|
if(prefs->font != NULL)
|
||||||
keyboard->font = pango_font_description_from_string(
|
keyboard->font = pango_font_description_from_string(
|
||||||
prefs->font);
|
prefs->font);
|
||||||
else
|
else
|
||||||
|
{
|
||||||
keyboard->font = pango_font_description_new();
|
keyboard->font = pango_font_description_new();
|
||||||
pango_font_description_set_weight(keyboard->font, PANGO_WEIGHT_BOLD);
|
pango_font_description_set_weight(keyboard->font,
|
||||||
|
PANGO_WEIGHT_BOLD);
|
||||||
|
}
|
||||||
bold = pango_font_description_new();
|
bold = pango_font_description_new();
|
||||||
pango_font_description_set_weight(bold, PANGO_WEIGHT_BOLD);
|
pango_font_description_set_weight(bold, PANGO_WEIGHT_BOLD);
|
||||||
/* layouts */
|
/* layouts */
|
||||||
|
@ -436,6 +441,9 @@ static GtkWidget * _keyboard_add_layout(Keyboard * keyboard,
|
||||||
GtkWidget * label;
|
GtkWidget * label;
|
||||||
GtkWidget * widget;
|
GtkWidget * widget;
|
||||||
unsigned long l;
|
unsigned long l;
|
||||||
|
GdkColor black = { 0x00000000, 0x0000, 0x0000, 0x0000 };
|
||||||
|
GdkColor white = { 0xffffffff, 0xffff, 0xffff, 0xffff };
|
||||||
|
GdkColor gray = { 0xd0d0d0d0, 0xd0d0, 0xd0d0, 0xd0d0 };
|
||||||
|
|
||||||
if((p = realloc(keyboard->layouts, sizeof(*p) * (keyboard->layouts_cnt
|
if((p = realloc(keyboard->layouts, sizeof(*p) * (keyboard->layouts_cnt
|
||||||
+ 1))) == NULL)
|
+ 1))) == NULL)
|
||||||
|
@ -451,16 +459,22 @@ static GtkWidget * _keyboard_add_layout(Keyboard * keyboard,
|
||||||
keys[i].keysym, keys[i].label);
|
keys[i].keysym, keys[i].label);
|
||||||
if(key == NULL)
|
if(key == NULL)
|
||||||
continue;
|
continue;
|
||||||
widget = keyboard_key_get_label_widget(key);
|
keyboard_key_set_background(key, &gray);
|
||||||
gtk_widget_modify_font(widget, keyboard->font);
|
keyboard_key_set_foreground(key, &black);
|
||||||
|
keyboard_key_set_font(key, keyboard->font);
|
||||||
for(; keys[i + 1].width == 0 && keys[i + 1].modifier != 0; i++)
|
for(; keys[i + 1].width == 0 && keys[i + 1].modifier != 0; i++)
|
||||||
|
{
|
||||||
|
keyboard_key_set_background(key, &white);
|
||||||
keyboard_key_set_modifier(key, keys[i + 1].modifier,
|
keyboard_key_set_modifier(key, keys[i + 1].modifier,
|
||||||
keys[i + 1].keysym, keys[i + 1].label);
|
keys[i + 1].keysym, keys[i + 1].label);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
l = (section + 1) % definitions_cnt;
|
l = (section + 1) % definitions_cnt;
|
||||||
label = gtk_label_new(definitions[l].label);
|
label = gtk_label_new(definitions[l].label);
|
||||||
|
gtk_widget_modify_fg(label, GTK_STATE_NORMAL, &black);
|
||||||
gtk_widget_modify_font(label, keyboard->font);
|
gtk_widget_modify_font(label, keyboard->font);
|
||||||
widget = gtk_button_new();
|
widget = gtk_button_new();
|
||||||
|
gtk_widget_modify_bg(widget, GTK_STATE_NORMAL, &gray);
|
||||||
gtk_container_add(GTK_CONTAINER(widget), label);
|
gtk_container_add(GTK_CONTAINER(widget), label);
|
||||||
g_object_set_data(G_OBJECT(widget), "layout", (void *)l);
|
g_object_set_data(G_OBJECT(widget), "layout", (void *)l);
|
||||||
g_signal_connect(widget, "clicked", G_CALLBACK(_layout_clicked),
|
g_signal_connect(widget, "clicked", G_CALLBACK(_layout_clicked),
|
||||||
|
|
Loading…
Reference in New Issue
Block a user