From 1602f132703a0edd1643120d94887ff618813a48 Mon Sep 17 00:00:00 2001 From: Nick Gasson Date: Sat, 23 Oct 2010 17:02:25 +0100 Subject: [PATCH] Add --left option to put bubble on the left of the cow. --- ChangeLog | 7 +++++++ src/bubblegen.c | 5 ++++- src/xcowsay.c | 7 +++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 8a0a24b..3423e28 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2010-10-23 Nick Gasson + + * src/bubblegen.c (bubble_init): Add a function to generate + left-handed bubbles. + * src/xcowsay.c (main): Add --left option to put bubble on + the left of the cow. + 2010-09-29 Nick Gasson * src/display_cow.c (normal_setup, display_cow): Calculate diff --git a/src/bubblegen.c b/src/bubblegen.c index 23807fd..dcdfa4c 100644 --- a/src/bubblegen.c +++ b/src/bubblegen.c @@ -372,7 +372,10 @@ static void bubble_init(bubble_t *b, bubble_style_t style) g_assert(b->pixmap); b->gc = gdk_gc_new(b->pixmap); - bubble_init_left(b, style); + if (get_bool_option("left")) + bubble_init_left(b, style); + else + bubble_init_right(b, style); } static void bubble_size_from_content(bubble_t *b, bubble_style_t style, diff --git a/src/xcowsay.c b/src/xcowsay.c index 99b9822..ea0abf4 100644 --- a/src/xcowsay.c +++ b/src/xcowsay.c @@ -73,6 +73,7 @@ static struct option long_options[] = { {"bubble-at", required_argument, 0, 'b'}, {"at", required_argument, 0, 'a'}, {"no-wrap", no_argument, 0, 'w'}, + {"left", no_argument, 0, 'l'}, {"config", required_argument, 0, 'o'}, {"debug", no_argument, &debug, 1}, {0, 0, 0, 0} @@ -112,6 +113,7 @@ static void usage() " --at=X,Y\t\t%s\n" " --bubble-at=X,Y\t%s\n" " --no-wrap\t\t%s\n" + " --left\t\t%s\n" " --config=FILE\t%s\n" " --debug\t\t%s\n\n" "%s\n\n" @@ -134,6 +136,7 @@ static void usage() i18n("Force the cow to appear at screen location (X,Y)."), i18n("Change relative position of bubble."), i18n("Disable wrapping if text cannot fit on screen."), + i18n("Make the bubble appear to the left of cow."), i18n("Specify alternative config file."), i18n("Keep daemon attached to terminal."), i18n("Default values for these options can be specified in the " @@ -244,6 +247,7 @@ int main(int argc, char **argv) add_int_option("bubble_y", 0); add_string_option("alt_config_file", ""); add_bool_option("wrap", true); + add_bool_option("left", false); parse_config_file(); @@ -305,6 +309,9 @@ int main(int argc, char **argv) case 'w': set_bool_option("wrap", false); break; + case 'l': + set_bool_option("left", true); + break; case '?': // getopt_long already printed an error message failure = 1; -- 2.39.2