@@ -72,12 +72,12 @@ static void action_update_color_state(struct swappy_state *state, double r,
72
72
state -> painting .b = b ;
73
73
state -> painting .a = a ;
74
74
75
- gtk_widget_set_sensitive (GTK_WIDGET (state -> ui -> custom ), custom );
75
+ gtk_widget_set_sensitive (GTK_WIDGET (state -> ui -> color ), custom );
76
76
}
77
77
78
78
static void action_set_color_from_custom (struct swappy_state * state ) {
79
79
GdkRGBA color ;
80
- gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (state -> ui -> custom ), & color );
80
+ gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (state -> ui -> color ), & color );
81
81
82
82
action_update_color_state (state , color .red , color .green , color .blue ,
83
83
color .alpha , true);
@@ -272,6 +272,23 @@ void window_keypress_handler(GtkWidget *widget, GdkEventKey *event,
272
272
case GDK_KEY_k :
273
273
action_clear (state );
274
274
break ;
275
+ case GDK_KEY_R :
276
+ action_update_color_state (state , 1 , 0 , 0 , 1 , false);
277
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (state -> ui -> red ), true);
278
+ break ;
279
+ case GDK_KEY_G :
280
+ action_update_color_state (state , 0 , 1 , 0 , 1 , false);
281
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (state -> ui -> green ), true);
282
+ break ;
283
+ case GDK_KEY_B :
284
+ action_update_color_state (state , 0 , 0 , 1 , 1 , false);
285
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (state -> ui -> blue ), true);
286
+ break ;
287
+ case GDK_KEY_C :
288
+ action_set_color_from_custom (state );
289
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (state -> ui -> custom ),
290
+ true);
291
+ break ;
275
292
case GDK_KEY_minus :
276
293
action_stroke_size_decrease (state );
277
294
break ;
@@ -474,7 +491,13 @@ static bool load_layout(struct swappy_state *state) {
474
491
475
492
state -> ui -> red =
476
493
GTK_RADIO_BUTTON (gtk_builder_get_object (builder , "color-red-button" ));
494
+ state -> ui -> green =
495
+ GTK_RADIO_BUTTON (gtk_builder_get_object (builder , "color-green-button" ));
496
+ state -> ui -> blue =
497
+ GTK_RADIO_BUTTON (gtk_builder_get_object (builder , "color-blue-button" ));
477
498
state -> ui -> custom =
499
+ GTK_RADIO_BUTTON (gtk_builder_get_object (builder , "color-custom-button" ));
500
+ state -> ui -> color =
478
501
GTK_COLOR_BUTTON (gtk_builder_get_object (builder , "custom-color-button" ));
479
502
480
503
state -> ui -> stroke_size =
0 commit comments