changeset 3264:a778341be5ec

Fixed #317: Added setters to views
author unexist
date Sun, 24 Dec 2017 20:04:53 +0100
parents 64593648a9d2
children bace520f988a
files src/subtle/ruby.c
diffstat 1 files changed, 22 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/src/subtle/ruby.c	Sun Dec 24 20:01:24 2017 +0100
+++ b/src/subtle/ruby.c	Sun Dec 24 20:04:53 2017 +0100
@@ -274,7 +274,7 @@
   else if(CHAR2SYM("role")       == sym) (*flags) |= SUB_TAG_MATCH_ROLE;
   else if(CHAR2SYM("type")       == sym) (*flags) |= SUB_TAG_MATCH_TYPE;
 
-  /* Types */
+  /* Window types */
   else if(CHAR2SYM("normal")     == sym) (*flags) |= SUB_CLIENT_TYPE_NORMAL;
   else if(CHAR2SYM("desktop")    == sym) (*flags) |= SUB_CLIENT_TYPE_DESKTOP;
   else if(CHAR2SYM("dock")       == sym) (*flags) |= SUB_CLIENT_TYPE_DOCK;
@@ -282,7 +282,7 @@
   else if(CHAR2SYM("splash")     == sym) (*flags) |= SUB_CLIENT_TYPE_SPLASH;
   else if(CHAR2SYM("dialog")     == sym) (*flags) |= SUB_CLIENT_TYPE_DIALOG;
 
-  /* Modes */
+  /* Tag modes */
   else if(CHAR2SYM("borderless") == sym) (*flags) |= SUB_CLIENT_MODE_BORDERLESS;
   else if(CHAR2SYM("centered")   == sym) (*flags) |= SUB_CLIENT_MODE_CENTER;
   else if(CHAR2SYM("fixed")      == sym) (*flags) |= SUB_CLIENT_MODE_FIXED;
@@ -292,6 +292,10 @@
   else if(CHAR2SYM("sticky")     == sym) (*flags) |= SUB_CLIENT_MODE_STICK;
   else if(CHAR2SYM("urgent")     == sym) (*flags) |= SUB_CLIENT_MODE_URGENT;
   else if(CHAR2SYM("zaphod")     == sym) (*flags) |= SUB_CLIENT_MODE_ZAPHOD;
+
+  /* View modes */
+  else if(CHAR2SYM("dynamic")     == sym) (*flags) |= SUB_VIEW_DYNAMIC;
+  else if(CHAR2SYM("icons_only")   == sym) (*flags) |= SUB_VIEW_ICON_ONLY;
 } /* }}} */
 
 /* RubyArrayToArray {{{ */
@@ -2280,7 +2284,7 @@
           RubyArrayToGeometry(value, &geom);
         }
 
-      /* Set geometry */
+      /* Set position */
       if(T_ARRAY == rb_type(value = rb_hash_lookup(params,
           CHAR2SYM("position"))))
         {
@@ -2418,15 +2422,21 @@
       /* Check match */
       match = rb_hash_lookup(params, CHAR2SYM("match")); ///< Lazy eval
 
-      /* Check dynamic */
-      if(Qtrue == (value = rb_hash_lookup(params,
-          CHAR2SYM("dynamic"))))
-        flags |= SUB_VIEW_DYNAMIC;
-
-      /* Check icon only */
-      if(Qtrue == (value = rb_hash_lookup(params,
-          CHAR2SYM("icon_only"))))
-        flags |= SUB_VIEW_ICON_ONLY;
+      /* Set modes */
+      if(T_SYMBOL == rb_type(value = rb_hash_lookup(params,
+          CHAR2SYM("set"))))
+        {
+          RubySymbolToFlag(value, &flags);
+        }
+      else if(T_ARRAY == rb_type(value))
+        {
+          int i;
+          VALUE entry = Qnil;
+
+          /* Translate modes */
+          for(i = 0; Qnil != (entry = rb_ary_entry(value, i)); i++)
+            RubySymbolToFlag(entry, &flags);
+        }
 
       /* Check icon */
       icon = RubyValueToIcon(rb_hash_lookup(params, CHAR2SYM("icon")));