Commented version of color cycling core cursor.
authorMikael Magnusson <mikachu@comhem.se>
Mon, 23 Jul 2007 23:30:50 +0000 (01:30 +0200)
committerDana Jansens <danakj@orodu.net>
Tue, 24 Jul 2007 18:48:08 +0000 (14:48 -0400)
I think it leaks the color specs.

openbox/openbox.c

index 0c758cfdf4bd4c762833522c5c12c89dfb7003ed..56bfadbf4633f8153dda14a46fa285eb7b99cf20 100644 (file)
@@ -113,6 +113,35 @@ static void parse_env();
 static void parse_args(gint *argc, gchar **argv);
 static Cursor load_cursor(const gchar *name, guint fontval);
 
+#if 0
+gboolean haxxor_func(gpointer data)
+{
+    int *foo = data;
+    static int dir = 1;
+    *foo += dir;
+    if (*foo >= 200 || *foo <= 0)
+        dir = -dir;
+
+    Colormap cm = RrColormap(ob_rr_inst);
+    static XColor xcb, xcg;
+    xcg.red = *foo << 8;
+    xcg.blue = (*foo / 4) << 8;
+    xcg.green = *foo / 2 << 8;
+
+    xcb.red = 0;
+    xcb.blue = (196 - *foo / 4) << 8;
+    xcb.green = 0;
+    XAllocColor(ob_display, cm, &xcg);
+    XAllocColor(ob_display, cm, &xcb);
+//    XAllocNamedColor(ob_display, cm, "dark blue", &xcb, &xcb);
+    static int i;
+    for (i = 1; i <= OB_CURSOR_NORTHWEST; i++)
+        XRecolorCursor(ob_display, cursors[i], &xcb, &xcg);
+
+    return TRUE;
+}
+#endif
+
 gint main(gint argc, gchar **argv)
 {
     gchar *program_name;
@@ -213,7 +242,13 @@ gint main(gint argc, gchar **argv)
     cursors[OB_CURSOR_WEST] = load_cursor("left_side", XC_left_side);
     cursors[OB_CURSOR_NORTHWEST] = load_cursor("top_left_corner",
                                                XC_top_left_corner);
-
+#if 0
+    int color = 0;
+    ob_main_loop_timeout_add(ob_main_loop,
+                             25000,
+                             haxxor_func,
+                             &color, NULL);
+#endif
 
     prop_startup(); /* get atoms values for the display */
     extensions_query_all(); /* find which extensions are present */