summaryrefslogtreecommitdiffstats
path: root/abs/mv-core/ghosd/ghosd-0.0.1/examples/example-shared.c
diff options
context:
space:
mode:
authorJames Meyer <james.meyer@operamail.com>2009-02-23 21:19:04 (GMT)
committerJames Meyer <james.meyer@operamail.com>2009-02-23 21:19:04 (GMT)
commit577c09bc1ea57e3fc5fe459ad91aafa4412b2297 (patch)
tree5fdcf480f545a75514783b155e3b23dea397eaf6 /abs/mv-core/ghosd/ghosd-0.0.1/examples/example-shared.c
parent1552b1b0221ed6a7e26e486187be25031408b453 (diff)
downloadlinhes_pkgbuild-577c09bc1ea57e3fc5fe459ad91aafa4412b2297.zip
linhes_pkgbuild-577c09bc1ea57e3fc5fe459ad91aafa4412b2297.tar.gz
linhes_pkgbuild-577c09bc1ea57e3fc5fe459ad91aafa4412b2297.tar.bz2
adding in ghosd
Diffstat (limited to 'abs/mv-core/ghosd/ghosd-0.0.1/examples/example-shared.c')
-rw-r--r--abs/mv-core/ghosd/ghosd-0.0.1/examples/example-shared.c66
1 files changed, 66 insertions, 0 deletions
diff --git a/abs/mv-core/ghosd/ghosd-0.0.1/examples/example-shared.c b/abs/mv-core/ghosd/ghosd-0.0.1/examples/example-shared.c
new file mode 100644
index 0000000..fb4b7d4
--- /dev/null
+++ b/abs/mv-core/ghosd/ghosd-0.0.1/examples/example-shared.c
@@ -0,0 +1,66 @@
+/* ghosd -- OSD with fake transparency, cairo, and pango.
+ * Copyright (C) 2006 Evan Martin <martine@danga.com>
+ */
+
+#include <glib.h>
+#include <stdlib.h>
+#include <ghosd/ghosd.h>
+
+#include "example-shared.h"
+
+ExampleOptions opts = {
+ TRUE,
+ 50, -50
+};
+
+gboolean
+example_options_parse(int *argc, char ***argv, ...) {
+ GOptionEntry options[] = {
+ { "opaque", 0, G_OPTION_FLAG_REVERSE, G_OPTION_ARG_NONE,
+ (gpointer)&opts.transparent, "turn off transparent background" },
+ { "x", 'x', 0, G_OPTION_ARG_INT, (gpointer)&opts.x,
+ "x coordinate for window" },
+ { "y", 'y', 0, G_OPTION_ARG_INT, (gpointer)&opts.y,
+ "y coordinate for window" },
+ { NULL }
+ };
+ GOptionContext *ctx;
+ GOptionGroup *group;
+ gboolean ret;
+ va_list ap;
+
+ va_start(ap, argv);
+
+ ctx = g_option_context_new("");
+ g_option_context_add_main_entries(ctx, options, "bar");
+
+ while ((group = va_arg(ap, GOptionGroup*)) != NULL) {
+ g_option_context_add_group(ctx, group);
+ }
+ va_end(ap);
+
+ g_option_context_set_ignore_unknown_options(ctx, FALSE);
+ ret = g_option_context_parse(ctx, argc, argv, NULL);
+ g_option_context_free(ctx);
+
+ if (opts.x == 0) opts.x = GHOSD_COORD_CENTER;
+ if (opts.y == 0) opts.y = GHOSD_COORD_CENTER;
+
+ return ret;
+}
+
+void
+example_round_rect(cairo_t *cr, int x, int y, int w, int h, int r) {
+ cairo_move_to(cr, x+r, y);
+ cairo_line_to(cr, x+w-r, y); /* top edge */
+ cairo_curve_to(cr, x+w, y, x+w, y, x+w, y+r);
+ cairo_line_to(cr, x+w, y+h-r); /* right edge */
+ cairo_curve_to(cr, x+w, y+h, x+w, y+h, x+w-r, y+h);
+ cairo_line_to(cr, x+r, y+h); /* bottom edge */
+ cairo_curve_to(cr, x, y+h, x, y+h, x, y+h-r);
+ cairo_line_to(cr, x, y+r); /* left edge */
+ cairo_curve_to(cr, x, y, x, y, x+r, y);
+ cairo_close_path(cr);
+}
+
+/* vim: set ts=2 sw=2 et cino=(0 : */