changeset 3133:2588713b7c27

Updated return values of various methods
author unexist
date Wed, 16 Nov 2011 21:16:21 +0100
parents 94a2d064ffa6
children 712a6060fc4a
files src/subtlext/client.c src/subtlext/color.c src/subtlext/geometry.c src/subtlext/icon.c src/subtlext/screen.c src/subtlext/sublet.c src/subtlext/tag.c src/subtlext/tray.c src/subtlext/view.c src/subtlext/window.c
diffstat 10 files changed, 218 insertions(+), 192 deletions(-) [+]
line wrap: on
line diff
--- a/src/subtlext/client.c	Wed Nov 16 21:16:03 2011 +0100
+++ b/src/subtlext/client.c	Wed Nov 16 21:16:21 2011 +0100
@@ -33,7 +33,7 @@
   subSharedMessage(display, DefaultRootWindow(display),
     "_NET_RESTACK_WINDOW", data, 32, True);
 
-  return Qnil;
+  return self;
 } /* }}} */
 
 /* ClientFlagsGet {{{ */
@@ -87,7 +87,7 @@
 
   rb_iv_set(self, "@flags", INT2FIX(iflags));
 
-  return Qnil;
+  return self;
 } /* }}} */
 
 /* ClientFlagsToggle {{{ */
@@ -120,7 +120,7 @@
 
   subSharedMessage(display, NUM2LONG(win), "_NET_WM_STATE", data, 32, True);
 
-  return Qnil;
+  return self;
 } /* }}} */
 
 /* ClientGravity {{{ */
@@ -136,21 +136,22 @@
   /* Find gravity */
   if(RTEST(value))
     {
-      /* Check if finder returned an array */
-      VALUE gravity = subSubtlextManyToOne(subGravitySingFind(Qnil, value));
+      VALUE gravity = Qnil;
 
-      if(RTEST(gravity)) data.l[1] = FIX2INT(rb_iv_get(gravity, "@id"));
+      if(RTEST((gravity = subGravitySingFirst(Qnil, value))))
+        data.l[1] = FIX2INT(rb_iv_get(gravity, "@id"));
     }
 
   /* Find view id if any */
   if(RTEST(key))
     {
-      VALUE view = subSubtlextManyToOne(subViewSingFind(Qnil, key));
+      VALUE view = Qnil;
 
-      if(RTEST(view)) data.l[2] = FIX2INT(rb_iv_get(view, "@id"));
+      if(RTEST((view = subViewSingFirst(Qnil, key))))
+        data.l[2] = FIX2INT(rb_iv_get(view, "@id"));
     }
 
-  /* Finally send */
+  /* Finally send message */
   if(-1 != data.l[0] && -1 != data.l[1])
     {
       subSharedMessage(display, DefaultRootWindow(display),
@@ -485,7 +486,7 @@
   return array;
 } /* }}} */
 
-/* Class */
+/* Helper */
 
 /* subClientInstantiate {{{ */
 VALUE
@@ -500,6 +501,8 @@
   return client;
 } /* }}} */
 
+/* Class */
+
 /* subClientInit {{{ */
 /*
  * call-seq: new(win) -> Subtlext::Client
@@ -538,7 +541,7 @@
 
 /* subClientUpdate {{{ */
 /*
- * call-seq: update -> nil
+ * call-seq: update -> Subtlext::Client
  *
  * Update Client properties based on <b>required</b> Client window id.
  *
@@ -592,7 +595,7 @@
     }
   else rb_raise(rb_eStandardError, "Invalid client id `%#lx'", win);
 
-  return Qnil;
+  return self;
 } /* }}} */
 
 /* subClientViewList {{{ */
@@ -817,7 +820,7 @@
 
 /* subClientFlagsToggleFull {{{ */
 /*
- * call-seq: toggle_full -> nil
+ * call-seq: toggle_full -> Subtlext::Client
  *
  * Toggle Client fullscreen state.
  *
@@ -833,7 +836,7 @@
 
 /* subClientFlagsToggleFloat {{{ */
 /*
- * call-seq: toggle_float -> nil
+ * call-seq: toggle_float -> Subtlext::Client
  *
  * Toggle Client floating state.
  *
@@ -849,7 +852,7 @@
 
 /* subClientFlagsToggleStick {{{ */
 /*
- * call-seq: toggle_stick -> nil
+ * call-seq: toggle_stick -> Subtlext::Client
  *
  * Toggle Client sticky state.
  *
@@ -865,7 +868,7 @@
 
 /* subClientFlagsToggleResize {{{ */
 /*
- * call-seq: toggle_stick -> nil
+ * call-seq: toggle_stick -> Subtlext::Client
  *
  * Toggle Client resize state.
  *
@@ -881,7 +884,7 @@
 
 /* subClientFlagsToggleUrgent {{{ */
 /*
- * call-seq: toggle_urgent -> nil
+ * call-seq: toggle_urgent -> Subtlext::Client
  *
  * Toggle Client urgent state.
  *
@@ -897,7 +900,7 @@
 
 /* subClientFlagsToggleZaphod {{{ */
 /*
- * call-seq: toggle_zaphod -> nil
+ * call-seq: toggle_zaphod -> Subtlext::Client
  *
  * Toggle Client zaphod state.
  *
@@ -913,7 +916,7 @@
 
 /* subClientFlagsToggleFixed {{{ */
 /*
- * call-seq: toggle_fixed -> nil
+ * call-seq: toggle_fixed -> Subtlext::Client
  *
  * Toggle Client fixed state.
  *
@@ -929,7 +932,7 @@
 
 /* subClientFlagsToggleBorderless {{{ */
 /*
- * call-seq: toggle_borderless -> nil
+ * call-seq: toggle_borderless -> Subtlext::Client
  *
  * Toggle Client borderless state.
  *
@@ -945,7 +948,7 @@
 
 /* subClientFlagsWriter {{{ */
 /*
- * call-seq: flags=(array) -> nil
+ * call-seq: flags=(array) -> Subtlext::Client
  *
  * Set multiple flags at once. Flags can be one or a combination of the
  * following:
@@ -989,12 +992,12 @@
       ClientFlagsSet(self, flags, False);
     }
 
-  return Qnil;
+  return self;
 } /* }}} */
 
 /* subClientRestackRaise {{{ */
 /*
- * call-seq: raise -> nil
+ * call-seq: raise -> Subtlext::Client
  *
  * Move Client window to top of window stack.
  *
@@ -1010,7 +1013,7 @@
 
 /* subClientRestackLower {{{ */
 /*
- * call-seq: lower -> nil
+ * call-seq: lower -> Subtlext::Client
  *
  * Move Client window to bottom of window stack.
  *
@@ -1105,26 +1108,26 @@
 
 /* subClientGravityWriter {{{ */
 /*
- * call-seq: gravity=(fixnum) -> nil
- *           gravity=(symbol) -> nil
- *           gravity=(object) -> nil
- *           gravity=(hash)   -> nil
+ * call-seq: gravity=(fixnum) -> Fixnum
+ *           gravity=(symbol) -> Symbol
+ *           gravity=(object) -> Object
+ *           gravity=(hash)   -> Hash
  *
  * Set Client Gravity either for current or for specific View.
  *
  *  # Set gravity for current view
  *  client.gravity = 0
- *  => nil
+ *  => #<Subtlext::Gravity:xxx>
  *
  *  client.gravity = :center
- *  => nil
+ *  => #<Subtlext::Gravity:xxx>
  *
  *  client.gravity = Subtlext::Gravity[0]
- *  => nil
+ *  => #<Subtlext::Gravity:xxx>
  *
  *  # Set gravity for specific view
  *  client.gravity = { :terms => :center }
- *  => nil
+ *  => #<Subtlext::Gravity:xxx>
  */
 
 VALUE
@@ -1136,7 +1139,7 @@
 
   subSubtlextConnect(NULL); ///< Implicit open connection
 
-  /* Check instance type */
+  /* Check value type */
   switch(rb_type(value))
     {
       case T_FIXNUM:
@@ -1157,7 +1160,7 @@
   /* Reset gravity */
   rb_iv_set(self, "@gravity", Qnil);
 
-  return Qnil;
+  return value;
 } /* }}} */
 
 /* subClientGeometryReader {{{ */
@@ -1199,25 +1202,25 @@
 
 /* subClientGeometryWriter {{{ */
 /*
- * call-seq: geometry=(x, y, width, height) -> Subtlext::Geometry
- *           geometry=(array)               -> Subtlext::Geometry
- *           geometry=(hash)                -> Subtlext::Geometry
- *           geometry=(string)              -> Subtlext::Geometry
+ * call-seq: geometry=(x, y, width, height) -> Fixnum
+ *           geometry=(array)               -> Array
+ *           geometry=(hash)                -> Hash
+ *           geometry=(string)              -> String
  *           geometry=(geometry)            -> Subtlext::Geometry
  *
  * Set Client geometry.
  *
  *  client.geometry = 0, 0, 100, 100
- *  => #<Subtlext::Geometry:xxx>
+ *  => 0
  *
  *  client.geometry = [ 0, 0, 100, 100 ]
- *  => #<Subtlext::Geometry:xxx>
+ *  => [ 0, 0, 100, 100 ]
  *
- *  client.geometry = {x: 0, y: 0, width: 100, height: 100 }
- *  => #<Subtlext::Geometry:xxx>
+ *  client.geometry = { x: 0, y: 0, width: 100, height: 100 }
+ *  => { x: 0, y: 0, width: 100, height: 100 }
  *
  *  client.geometry = "0x0+100+100"
- *  => #<Subtlext::Geometry:xxx>
+ *  => "0x0+100+100"
  *
  *  client.geometry = Subtlext::Geometry(0, 0, 100, 100)
  *  => #<Subtlext::Geometry:xxx>
--- a/src/subtlext/color.c	Wed Nov 16 21:16:03 2011 +0100
+++ b/src/subtlext/color.c	Wed Nov 16 21:16:21 2011 +0100
@@ -67,7 +67,7 @@
   xcolor->blue  = SCALE(xcolor->blue,  65535, 255);
 } /* }}} */
 
-/* Exported */
+/* Helper */
 
 /* subColorPixel {{{ */
 unsigned long
@@ -166,6 +166,8 @@
   return color;
 } /* }}} */
 
+/* Class */
+
 /* subColorInit {{{ */
 /*
  * call-seq: new(red, green, blue) -> Subtlext::Color
--- a/src/subtlext/geometry.c	Wed Nov 16 21:16:03 2011 +0100
+++ b/src/subtlext/geometry.c	Wed Nov 16 21:16:21 2011 +0100
@@ -34,7 +34,7 @@
   return ret ? Qtrue : Qfalse;
 } /* }}} */
 
-/* Class */
+/* Helper */
 
 /* subGeometryInstantiate {{{ */
 VALUE
@@ -65,6 +65,8 @@
   r->height = FIX2INT(rb_iv_get(self, "@height"));
 } /* }}} */
 
+/* Class */
+
 /* subGeometryInit {{{ */
 /*
  * call-seq: new(x, y, width, height) -> Subtlext::Geometry
--- a/src/subtlext/icon.c	Wed Nov 16 21:16:03 2011 +0100
+++ b/src/subtlext/icon.c	Wed Nov 16 21:16:21 2011 +0100
@@ -82,7 +82,7 @@
   return ret ? Qtrue : Qfalse;
 } /* }}} */
 
-/* Exported */
+/* Class */
 
 /* subIconAlloc {{{ */
 /*
@@ -257,15 +257,15 @@
 
 /* subIconDrawPoint {{{ */
 /*
- * call-seq: draw_point(x, y, fg, bg) -> nil
+ * call-seq: draw_point(x, y, fg, bg) -> Subtlext::Icon
  *
  * Draw a pixel on the icon at given coordinates in given colors.
  *
  *  icon.draw_point(1, 1)
- *  => nil
+ *  => #<Subtlext::Icon:xxx>
  *
  *  icon.draw_point(1, 1, "#ff0000", "#000000")
- *  => nil
+ *  => #<Subtlext::Icon:xxx>
  */
 
 VALUE
@@ -313,20 +313,20 @@
     }
   else rb_raise(rb_eArgError, "Unexpected value-types");
 
-  return Qnil;
+  return self;
 } /* }}} */
 
 /* subIconDrawLine {{{ */
 /*
- * call-seq: draw_line(x1, y1, x2, y2, fg, bg) -> nil
+ * call-seq: draw_line(x1, y1, x2, y2, fg, bg) -> Subtlext::Icon
  *
  * Draw a line on the Icon starting at x1/y1 to x2/y2 in given colors.
  *
  *  icon.draw_line(1, 1, 10, 1)
- *  => nil
+ *  => #<Subtlext::Icon:xxx>
  *
  *  icon.draw_line(1, 1, 10, 1, "#ff0000", "#000000")
- *  => nil
+ *  => #<Subtlext::Icon:xxx>
  */
 
 VALUE
@@ -376,21 +376,21 @@
     }
   else rb_raise(rb_eArgError, "Unexpected value-types");
 
-  return Qnil;
+  return self;
 } /* }}} */
 
 /* subIconDrawRect {{{ */
 /*
- * call-seq: draw_rect(x, y, width, height, fill, fg, bg) -> nil
+ * call-seq: draw_rect(x, y, width, height, fill, fg, bg) -> Subtlext::Icon
  *
  * Draw a rect on the Icon starting at x/y with given width, height
  * and colors.
  *
  *  icon.draw_rect(1, 1, 10, 10, false)
- *  => nil
+ *  => #<Subtlext::Icon:xxx>
  *
  *  icon.draw_rect(1, 1, 10, 10, false, "#ff0000", "#000000")
- *  => nil
+ *  => #<Subtlext::Icon:xxx>
  */
 
 VALUE
@@ -446,17 +446,17 @@
     }
   else rb_raise(rb_eArgError, "Unexpected value-types");
 
-  return Qnil;
+  return self;
 } /* }}} */
 
 /* subIconCopyArea {{{ */
 /*
- * call-seq: copy_area(icon2, src_x, src_y, width, height, dest_x, dest_y) -> nil
+ * call-seq: copy_area(icon2, src_x, src_y, width, height, dest_x, dest_y) -> Subtlext::Icon
  *
  * Copy area of given width/height from one Icon to another.
  *
  *  icon.copy_area(icon, 0, 0, 10, 10, 0, 0)
- *  => nil
+ *  => #<Subtlext::Icon:xxx>
  */
 
 VALUE
@@ -529,21 +529,21 @@
     }
   else rb_raise(rb_eArgError, "Unexpected value-types");
 
-  return Qnil;
+  return self;
 } /* }}} */
 
 /* subIconClear {{{ */
 /*
- * call-seq: clear         -> nil
- *           clear(fg, bg) -> nil
+ * call-seq: clear         -> Subtlext::Icon
+ *           clear(fg, bg) -> Subtlext::Icon
  *
  * Clear the icon and optionally set a fore-/background color.
  *
  *  icon.clear
- *  => nil
+ *  => #<Subtlext::Icon:xxx>
  *
  *  icon.clear("#ff0000", "#000000")
- *  => nil
+ *  => #<Subtlext::Icon:xxx>
  */
 
 VALUE
@@ -584,7 +584,7 @@
       XFlush(display);
     }
 
-  return Qnil;
+  return self;
 } /* }}} */
 
 /* subIconAskBitmap {{{ */
--- a/src/subtlext/screen.c	Wed Nov 16 21:16:03 2011 +0100
+++ b/src/subtlext/screen.c	Wed Nov 16 21:16:21 2011 +0100
@@ -230,7 +230,7 @@
   return screen;
 } /* }}} */
 
-/* Class */
+/* Helper */
 
 /* subScreenInstantiate {{{ */
 VALUE
@@ -245,6 +245,8 @@
   return screen;
 } /* }}} */
 
+/* Class */
+
 /* subScreenInit {{{ */
 /*
  * call-seq: new(id) -> Subtlext::Screen
@@ -274,12 +276,12 @@
 
 /* subScreenUpdate {{{ */
 /*
- * call-seq: update -> nil
+ * call-seq: update -> Subtlext::Screen
  *
  * Update Screen properties
  *
  *  screen.update
- *  => nil
+ *  => #<Subtlext::Screen:xxx>
  */
 
 VALUE
@@ -301,17 +303,17 @@
   else rb_raise(rb_eStandardError, "Invalid screen id `%d'",
     (int)FIX2INT(id));
 
-  return Qnil;
+  return self;
 } /* }}} */
 
 /* subScreenJump {{{ */
 /*
- * call-seq: screen -> nil
+ * call-seq: screen -> Subtlext::Screen
  *
  * Jump to this Screen
  *
  *  screen.jump
- *  => nil
+ *  => #<Subtlext::Screen:xxx>
  */
 
 VALUE
@@ -332,7 +334,7 @@
   subSharedMessage(display, DefaultRootWindow(display),
     "SUBTLE_SCREEN_JUMP", data, 32, True);
 
-  return Qnil;
+  return self;
 } /* }}} */
 
 /* subScreenViewReader {{{ */
@@ -386,9 +388,9 @@
 
 /* subScreenViewWriter {{{ */
 /*
- * call-seq: view=(fixnum) -> nil
- *           view=(symbol) -> nil
- *           view=(object) -> nil
+ * call-seq: view=(fixnum) -> Fixnum
+ *           view=(symbol) -> Symbol
+ *           view=(object) -> Subtlext::View
  *
  * Set active view for screen
  *
@@ -426,7 +428,7 @@
   subSharedMessage(display, DefaultRootWindow(display),
     "_NET_CURRENT_DESKTOP", data, 32, True);
 
-  return Qnil;
+  return value;
 } /* }}} */
 
 /* subScreenAskCurrent {{{ */
--- a/src/subtlext/sublet.c	Wed Nov 16 21:16:03 2011 +0100
+++ b/src/subtlext/sublet.c	Wed Nov 16 21:16:21 2011 +0100
@@ -134,7 +134,7 @@
  * Create new Sublet object locally <b>without</b> calling #save automatically.
  *
  *  sublet = Subtlext::Sublet.new("subtle")
- *  => #<Subtlext::Sublet:xxx> *
+ *  => #<Subtlext::Sublet:xxx>
  */
 
 VALUE
@@ -156,12 +156,12 @@
 
 /* subSubletUpdate {{{ */
 /*
- * call-seq: update -> nil
+ * call-seq: update -> Subtlext::Sublet
  *
  * Force subtle to update the data of this Sublet.
  *
  *  sublet.update
- *  => nil
+ *  => #<Subtlext::Sublet:xxx>
  */
 
 VALUE
@@ -180,18 +180,18 @@
   subSharedMessage(display, DefaultRootWindow(display),
     "SUBTLE_SUBLET_UPDATE", data, 32, True);
 
-  return Qnil;
+  return self;
 } /* }}} */
 
 /* subSubletSend {{{ */
 /*
- * call-seq: send_data(string) -> nil
+ * call-seq: send_data(string) -> Subtlext::Sublet
  *
  * Send given string data to a :data event of a Sublet. The data is
  * passed as second argument.
  *
  *  sublet.send_data("subtle")
- *  => nil
+ *  => #<Subtlext::Sublet:xxx>
  */
 
 VALUE
@@ -224,17 +224,17 @@
   else rb_raise(rb_eArgError, "Unexpected value-type `%s'",
     rb_obj_classname(value));
 
-  return Qnil;
+  return self;
 } /* }}} */
 
 /* subSubletVisibilityShow {{{ */
 /*
- * call-seq: show -> nil
+ * call-seq: show -> Subtlext::Sublet
  *
  * Show sublet in the panels.
  *
  *  sublet.show
- *  => nil
+ *  => #<Subtlext::Sublet:xxx>
  */
 
 VALUE
@@ -253,17 +253,17 @@
   subSharedMessage(display, DefaultRootWindow(display),
     "SUBTLE_SUBLET_FLAGS", data, 32, True);
 
-  return Qnil;
+  return self;
 } /* }}} */
 
 /* subSubletVisibilityHide {{{ */
 /*
- * call-seq: hide -> nil
+ * call-seq: hide -> Subtlext::Sublet
  *
  * Hide sublet from the panels.
  *
  *  sublet.hide
- *  => nil
+ *  => #<Subtlext::Sublet:xxx>
  */
 
 VALUE
@@ -282,7 +282,7 @@
   subSharedMessage(display, DefaultRootWindow(display),
     "SUBTLE_SUBLET_FLAGS", data, 32, True);
 
-  return Qnil;
+  return self;
 } /* }}} */
 
 /* subSubletToString {{{ */
--- a/src/subtlext/tag.c	Wed Nov 16 21:16:03 2011 +0100
+++ b/src/subtlext/tag.c	Wed Nov 16 21:16:21 2011 +0100
@@ -205,7 +205,7 @@
   return array;
 } /* }}} */
 
-/* Class */
+/* Helper */
 
 /* subTagInstantiate {{{ */
 VALUE
@@ -220,6 +220,8 @@
   return tag;
 } /* }}} */
 
+/* Class */
+
 /* subTagInit {{{ */
 /*
  * call-seq: new(name) -> Subtlext::Tag
@@ -251,12 +253,12 @@
 
 /* subTagUpdate {{{ */
 /*
- * call-seq: update -> nil
+ * call-seq: update -> Subtlext::Tag
  *
  * Update Tag properties based on Tag index.
  *
  *  tag.update
- *  => nil
+ *  => #<Subtlext::Tag:xxx>
  */
 
 VALUE
@@ -302,7 +304,7 @@
 
   rb_iv_set(self, "@id", INT2FIX(id));
 
-  return Qnil;
+  return self;
 } /* }}} */
 
 /* subTagClients {{{ */
--- a/src/subtlext/tray.c	Wed Nov 16 21:16:03 2011 +0100
+++ b/src/subtlext/tray.c	Wed Nov 16 21:16:21 2011 +0100
@@ -162,7 +162,7 @@
   return array;
 } /* }}} */
 
-/* Class */
+/* Helper */
 
 /* subTrayInstantiate {{{ */
 VALUE
@@ -177,6 +177,8 @@
   return tray;
 } /* }}} */
 
+/* Class */
+
 /* subTrayInit {{{ */
 /*
  * call-seq: new(name) -> Subtlext::Tray
@@ -210,12 +212,12 @@
 
 /* subTrayUpdate {{{ */
 /*
- * call-seq: update -> nil
+ * call-seq: update -> Subtlext::Tray
  *
  * Update Tray properties based on <b>required</b> Tray window id.
  *
  *  tray.update
- *  => nil
+ *  => #<Subtlext::Tray:xxx>
  */
 
 VALUE
@@ -250,7 +252,7 @@
     }
   else rb_raise(rb_eStandardError, "Invalid tray id `%#lx`", win);
 
-  return Qnil;
+  return self;
 } /* }}} */
 
 /* subTrayToString {{{ */
--- a/src/subtlext/view.c	Wed Nov 16 21:16:03 2011 +0100
+++ b/src/subtlext/view.c	Wed Nov 16 21:16:21 2011 +0100
@@ -290,7 +290,7 @@
   return array;
 } /* }}} */
 
-/* Class */
+/* Helper */
 
 /* subViewInstantiate {{{ */
 VALUE
@@ -307,6 +307,8 @@
   return view;
 } /* }}} */
 
+/* Class */
+
 /* subViewInit {{{ */
 /*
  * call-seq: new(name) -> Subtlext::View
@@ -338,12 +340,12 @@
 
 /* subViewUpdate {{{ */
 /*
- * call-seq: Update -> nil
+ * call-seq: Update -> Subtlext::View
  *
  * Update View properties based on <b>required</b> View index.
  *
  *  view.update
- *  => nil
+ *  => #<Subtlext::View:xxx>
  */
 
 VALUE
@@ -389,7 +391,7 @@
 
   rb_iv_set(self, "@id", INT2FIX(id));
 
-  return Qnil;
+  return self;
 } /* }}} */
 
 /* subViewClients {{{ */
@@ -469,12 +471,12 @@
 
 /* subViewJump {{{ */
 /*
- * call-seq: jump -> nil
+ * call-seq: jump -> Subtlext::View
  *
  * Set this View to the current active one
  *
  *  view.jump
- *  => nil
+ *  => #<Subtlext::View:xxx>
  */
 
 VALUE
@@ -495,7 +497,7 @@
   subSharedMessage(display, DefaultRootWindow(display),
     "_NET_CURRENT_DESKTOP", data, 32, True);
 
-  return Qnil;
+  return self;
 } /* }}} */
 
 /* subViewSelectNext {{{ */
--- a/src/subtlext/window.c	Wed Nov 16 21:16:03 2011 +0100
+++ b/src/subtlext/window.c	Wed Nov 16 21:16:21 2011 +0100
@@ -312,7 +312,7 @@
   return ret;
 } /* }}} */
 
-/* Class */
+/* Helper */
 
 /* subWindowInstantiate {{{ */
 VALUE
@@ -327,6 +327,8 @@
   return win;
 } /* }}} */
 
+/* Class */
+
 /* subWindowAlloc {{{ */
 /*
  * call-seq: new(geometry) -> Subtlext::Window
@@ -478,12 +480,12 @@
 
 /* subWindowNameWriter {{{ */
 /*
- * call-seq: name=(str) -> nil
+ * call-seq: name=(str) -> String
  *
  * Set the WM_NAME of a Window-
  *
  *  win.name = "sublet"
- *  => nil
+ *  => "sublet"
  */
 
 VALUE
@@ -523,17 +525,17 @@
         rb_obj_classname(value));
     }
 
-  return Qnil;
+  return value;
 } /* }}} */
 
 /* subWindowFontWriter {{{ */
 /*
- * call-seq: font=(string) -> nil
+ * call-seq: font=(string) -> String
  *
  * Set the font that is used for text inside of a W.indow
  *
- *  win.font = "-*-fixed-*-*-*-*-10-*-*-*-*-*-*-*"
- *  => nil
+ *  win.font = "-*-*-*-*-*-*-10-*-*-*-*-*-*-*"
+ *  => "-*-*-*-*-*-*-10-*-*-*-*-*-*-*"
  */
 
 VALUE
@@ -568,7 +570,7 @@
         rb_obj_classname(value));
     }
 
-  return Qnil;
+  return value;
 } /* }}} */
 
 /* subWindowFontYReader {{{ */
@@ -651,11 +653,11 @@
 
 /* subWindowForegroundWriter {{{ */
 /*
- * call-seq: foreground=(string) -> nil
- *           foreground=(array)  -> nil
- *           foreground=(hash)   -> nil
- *           foreground=(fixnum) -> nil
- *           foreground=(color)  -> nil
+ * call-seq: foreground=(string) -> String
+ *           foreground=(array)  -> Array
+ *           foreground=(hash)   -> Hash
+ *           foreground=(fixnum) -> Fixnum
+ *           foreground=(object) -> Subtlext::Color
  *
  * Set the foreground color of this Window which can be of
  * following types:
@@ -664,10 +666,10 @@
  * [Array]  Must be an array with values for red, green and blue
  * [Hash]   Must be a hash with values for red, green and blue
  * [Fixnum] Pixel representation of a color in Xlib
- * [Color]  Copy color from a Color object
+ * [Object] Copy color from a Color object
  *
  *  win.foreground = "#000000"
- *  => nil
+ *  => "#000000"
  */
 
 VALUE
@@ -682,16 +684,16 @@
   Data_Get_Struct(self, SubtlextWindow, w);
   if(w) w->fg = subColorPixel(value, Qnil, Qnil, NULL);
 
-  return Qnil;
+  return value;
 } /* }}} */
 
 /* subWindowBackgroundWriter {{{ */
 /*
- * call-seq: background=(string) -> nil
- *           background=(array)  -> nil
- *           background=(hash)   -> nil
- *           background=(fixnum) -> nil
- *           background=(color)  -> nil
+ * call-seq: background=(string) -> String
+ *           background=(array)  -> Array
+ *           background=(hash)   -> Hash
+ *           background=(fixnum) -> Fixnum
+ *           background=(object) -> Subtlext::Color
  *
  * Set the background color of this Window which can be of
  * following types:
@@ -700,10 +702,10 @@
  * [Array]  Must be an array with values for red, green and blue
  * [Hash]   Must be a hash with values for red, green and blue
  * [Fixnum] Pixel representation of a color in Xlib
- * [Color]  Copy color from a Color object
+ * [Object] Copy color from a Color object
 
  *  win.background = "#000000"
- *  => nil
+ *  => "#000000"
  */
 
 VALUE
@@ -723,16 +725,16 @@
       XSetWindowBackground(display, w->win, w->bg);
     }
 
-  return Qnil;
+  return value;
 } /* }}} */
 
 /* subWindowBorderColorWriter {{{ */
 /*
- * call-seq: border=(string) -> nil
- *           border=(array)  -> nil
- *           border=(hash)   -> nil
- *           border=(fixnum) -> nil
- *           border=(color)  -> nil
+ * call-seq: border=(string) -> String
+ *           border=(array)  -> Array
+ *           border=(hash)   -> Hash
+ *           border=(fixnum) -> Fixnum
+ *           border=(object) -> Subtlext::Color
  *
  * Set the border color of this Window which can be of
  * following types:
@@ -741,10 +743,10 @@
  * [Array]  Must be an array with values for red, green and blue
  * [Hash]   Must be a hash with values for red, green and blue
  * [Fixnum] Pixel representation of a color in Xlib
- * [Color]  Copy color from a Color object
+ * [Object] Copy color from a Color object
  *
  *  win.border_color = "#000000"
- *  => nil
+ *  => "#000000"
  */
 
 VALUE
@@ -769,12 +771,12 @@
 
 /* subWindowBorderSizeWriter {{{ */
 /*
- * call-seq: border_size=(fixnum) -> nil
+ * call-seq: border_size=(fixnum) -> Fixnum
  *
  * Set border size of this Window.
  *
  *  win.border_size = 3
- *  => nil
+ *  => 3
  */
 
 VALUE
@@ -803,7 +805,7 @@
         rb_obj_classname(value));
     }
 
-  return Qnil;
+  return value;
 } /* }}} */
 
 /* subWindowGeometryReader {{{ */
@@ -830,10 +832,9 @@
 
 /* subWindowGeometryWriter {{{ */
 /*
- * call-seq: geometry=(value)    -> nil
- *           geometry=(array)    -> nil
- *           geometry=(hash)     -> nil
- *           geometry=(geometry) -> nil
+ * call-seq: geometry=(array)  -> Array
+ *           geometry=(hash)   -> Hash
+ *           geometry=(object) -> Subtlext::Geometry
  *
  * Set the geometry of this Window which can be of following
  * types:
@@ -843,7 +844,7 @@
  * [Geometry] Copy geometry from a Geometry object
  *
  *  win.geometry = { :x => 0, :y => 0, :width => 50, :height => 50 }
- *  => nil
+ *  => { :x => 0, :y => 0, :width => 50, :height => 50 }
  */
 
 VALUE
@@ -870,12 +871,12 @@
       XMoveResizeWindow(display, w->win, r.x, r.y, r.width, r.height);
     }
 
-  return Qnil;
+  return value;
 } /* }}} */
 
 /* subWindowWrite {{{ */
 /*
- * call-seq: write(x, y, string) -> nil
+ * call-seq: write(x, y, string) -> Fixnum
  *
  * Write a string onto this Window at given x/y coordinates, that
  * <b>won't</b> be visible unless the Window content is updated
@@ -1155,7 +1156,7 @@
 
 /* subWindowOn {{{ */
 /*
- * call-seq: on(event, &block) -> nil
+ * call-seq: on(event, &block) -> Subtlext::Window
  *
  * Grab pointer button press events and pass them to the block until
  * the return value of the block isn't <b>true</b> or an error occured.
@@ -1163,7 +1164,7 @@
  *  grab_mouse do |x, y, button|
  *    p "x=#{x}, y=#{y}, button=#{button}"
  *  end
- *  => nil
+ *  => #<Subtlext::Window:xxx>
  */
 
 VALUE
@@ -1200,20 +1201,20 @@
       else rb_raise(rb_eArgError, "Unexpected value type for on");
     }
 
-  return Qnil;
+  return self;
 } /* }}} */
 
 /* subWindowDrawPoint {{{ */
 /*
- * call-seq: draw_point(x, y, color) -> nil
+ * call-seq: draw_point(x, y, color) -> Subtlext::Window
  *
  * Draw a pixel on the window at given coordinates in given color.
  *
  *  win.draw_point(1, 1)
- *  => nil
+ *  => #<Subtlext::Window:xxx>
  *
  *  win.draw_point(1, 1, "#ff0000")
- *  => nil
+ *  => #<Subtlext::Window:xxx>
  */
 
 VALUE
@@ -1255,20 +1256,20 @@
     }
   else rb_raise(rb_eArgError, "Unexpected value-types");
 
-  return Qnil;
+  return self;
 } /* }}} */
 
 /* subWindowDrawLine {{{ */
 /*
- * call-seq: draw_line(x1, y1, x2, y2, color) -> nil
+ * call-seq: draw_line(x1, y1, x2, y2, color) -> Subtlext::Window
  *
  * Draw a line on the window starting at x1/y1 to x2/y2 in given color.
  *
  *  win.draw_line(1, 1, 10, 1)
- *  => nil
+ *  => #<Subtlext::Window:xxx>
  *
  *  win.draw_line(1, 1, 10, 1, "#ff0000", "#000000")
- *  => nil
+ *  => #<Subtlext::Window:xxx>
  */
 
 VALUE
@@ -1312,21 +1313,21 @@
     }
   else rb_raise(rb_eArgError, "Unexpected value-types");
 
-  return Qnil;
+  return self;
 } /* }}} */
 
 /* subWindowDrawRect {{{ */
 /*
- * call-seq: draw_rect(x, y, width, height, color, fill) -> nil
+ * call-seq: draw_rect(x, y, width, height, color, fill) -> Subtlext::Window
  *
  * Draw a rect on the Window starting at x/y with given width, height
  * and colors.
  *
  *  win.draw_rect(1, 1, 10, 10)
- *  => nil
+ *  => #<Subtlext::Window:xxx>
  *
  *  win.draw_rect(1, 1, 10, 10, "#ff0000", true)
- *  => nil
+ *  => #<Subtlext::Window:xxx>
  */
 
 VALUE
@@ -1376,18 +1377,18 @@
     }
   else rb_raise(rb_eArgError, "Unexpected value-types");
 
-  return Qnil;
+  return self;
 } /* }}} */
 
 /* subWindowDrawText {{{ */
 /*
- * call-seq: draw_text(x, y, string, color) -> nil
+ * call-seq: draw_text(x, y, string, color) -> Subtlext::Window
  *
  * Draw a text on the Window starting at x/y with given width, height
  * and color <b>without</b> caching it.
  *
  *  win.draw_text(10, 10, "subtle")
- *  => nil
+ *  => #<Subtlext::Window:xxx>
  */
 
 VALUE
@@ -1419,18 +1420,18 @@
         FIX2INT(y), lcolor, w->bg, RSTRING_PTR(text), RSTRING_LEN(text));
     }
 
-  return Qnil;
+  return self;
 } /* }}} */
 
 /* subWindowDrawIcon {{{ */
 /*
- * call-seq: draw_icon(x, y, icon, fg, bg) -> nil
+ * call-seq: draw_icon(x, y, icon, fg, bg) -> Subtlext::Window
  *
  * Draw a icon on the Window starting at x/y with given width, height
  * and color <b>without</b> caching it.
  *
  *  win.draw_icon(10, 10, Subtlext::Icon.new("foo.xbm"))
- *  => nil
+ *  => #<Subtlext::Window:xxx>
  */
 
 VALUE
@@ -1447,10 +1448,12 @@
   rb_scan_args(argc, argv, "32", &x, &y, &icon, &fg, &bg);
 
   Data_Get_Struct(self, SubtlextWindow, w);
-  if(w && FIXNUM_P(x) && FIXNUM_P(y) && T_OBJECT == rb_type(icon))
+  if(w && FIXNUM_P(x) && FIXNUM_P(y) &&
+      rb_obj_is_instance_of(icon, rb_const_get(mod, rb_intern("Icon"))))
     {
-#if 0
+      int bitmap = False;
       long lfg = w->fg, lbg = w->bg;
+      VALUE width = Qnil, height = Qnil, pixmap = Qnil;
 
       /* Create on demand */
       if(0 == w->gc)
@@ -1460,22 +1463,28 @@
       if(!NIL_P(fg)) lfg = subColorPixel(fg, Qnil, Qnil, NULL);
       if(!NIL_P(bg)) lbg = subColorPixel(bg, Qnil, Qnil, NULL);
 
-      subSharedTextIconDraw(display, w->gc, w->font, w->win, FIX2INT(x),
-        FIX2INT(y), lfg, lbg, RSTRING_PTR(text), RSTRING_LEN(text));
-#endif
+      /* Fetch icon values */
+      width  = rb_iv_get(icon, "@width");
+      height = rb_iv_get(icon, "@height");
+      pixmap = rb_iv_get(icon, "@pixmap");
+      bitmap = Qtrue == subIconAskBitmap(icon) ? True : False;
+
+      subSharedTextIconDraw(display, w->gc, w->win, FIX2INT(x),
+        FIX2INT(y), FIX2INT(width), FIX2INT(height), lfg, lbg,
+        NUM2LONG(pixmap), bitmap);
     }
 
-  return Qnil;
+  return self;
 } /* }}} */
 
 /* subWindowClear {{{ */
 /*
- * call-seq: clear -> nil
+ * call-seq: clear -> Subtlext::Window
  *
  * Clear this Window and remove all stored text.
  *
  *  win.clear
- *  => nil
+ *  => #<Subtlext::Window:xxx>
  */
 
 VALUE
@@ -1504,17 +1513,17 @@
       else XClearWindow(display, w->win);
     }
 
-  return Qnil;
+  return self;
 } /* }}} */
 
 /* subWindowRedraw {{{ */
 /*
- * call-seq: redraw -> nil
+ * call-seq: redraw -> Subtlext::Window
  *
  * Redraw Window content.
  *
  *  win.redraw
- *  => nil
+ *  => #<Subtlext::Window:xxx>
  */
 
 VALUE
@@ -1528,12 +1537,12 @@
   Data_Get_Struct(self, SubtlextWindow, w);
   if(w) WindowExpose(w);
 
-  return Qnil;
+  return self;
 } /* }}} */
 
 /* subWindowCompletion {{{ */
 /*
- * call-seq: completion(&block) -> nil
+ * call-seq: completion(&block) -> Subtlext::Window
  *
  * Add completion block to this Window, that is called whenever the
  * tab key is pressed.
@@ -1541,6 +1550,7 @@
  *  win.completion do |str, guess|
  *    str
  *  end
+ *  => #<Subtlext::Window:xxx>
  */
 
 VALUE
@@ -1552,7 +1562,7 @@
 
 /* subWindowInput {{{ */
 /*
- * call-seq: input(&block) -> nil
+ * call-seq: input(&block) -> Subtlext::Window
  *
  * Add input block that to this Window, that is called whenever the user
  * makes any input in a #read call.
@@ -1560,6 +1570,7 @@
  *  win.input do |str|
  *    str
  *  end
+ *  => #<Subtlext::Window:xxx>
  */
 
 VALUE
@@ -1570,13 +1581,13 @@
 
 /* subWindowRaise {{{ */
 /*
- * call-seq: raise -> nil
+ * call-seq: raise -> Subtlext::Window
  *
  * Raise this Window to the top of the window stack, when the window manager
  * supports that. (subtle does)
  *
  *  win.raise
- *  => nil
+ *  => #<Subtlext::Window:xxx>
  */
 
 VALUE
@@ -1594,18 +1605,18 @@
       WindowExpose(w);
     }
 
-  return Qnil;
+  return self;
 } /* }}} */
 
 /* subWindowLower {{{ */
 /*
- * call-seq: lower -> nil
+ * call-seq: lower -> Subtlext::Window
  *
  * Lower this Window to the bottom of the window stack, when the window manager
  * supports that. (subtle does)
  *
  *  win.lower
- *  => nil
+ *  => #<Subtlext::Window:xxx>
  */
 
 VALUE
@@ -1623,17 +1634,17 @@
       WindowExpose(w);
     }
 
-  return Qnil;
+  return self;
 } /* }}} */
 
 /* subWindowShow {{{ */
 /*
- * call-seq: show() -> nil
+ * call-seq: show() -> Subtlext::Window
  *
  * Show this Window on screen.
  *
  *  win.show
- *  => nil
+ *  => #<Subtlext::Window:xxx>
  */
 
 VALUE
@@ -1657,17 +1668,17 @@
         }
     }
 
-  return Qnil;
+  return self;
 } /* }}} */
 
 /* subWindowHide {{{ */
 /*
- * call-seq: hide() -> nil
+ * call-seq: hide() -> Subtlext::Window
  *
  * Hide this Window from screen.
  *
  *  win.hide
- *  => nil
+ *  => #<Subtlext::Window:xxx>
  */
 
 VALUE
@@ -1687,7 +1698,7 @@
       XSync(display, False); ///< Sync with X
     }
 
-  return Qnil;
+  return self;
 } /* }}} */
 
 /* subWindowAskHidden {{{ */