aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans-Christoph Steiner <eighthave@users.sourceforge.net>2007-11-08 03:24:16 +0000
committerHans-Christoph Steiner <eighthave@users.sourceforge.net>2007-11-08 03:24:16 +0000
commit84314420f2f2f8f05adc7ddabd9228d98a4ee172 (patch)
tree211a74817894a8e85f1d1e8952c191234a5b2c1e
parent34a09f0f43047dd99d41e97e5af06a8f40e09771 (diff)
created object to get current window name so you can change it's tk options
svn path=/trunk/externals/hcs/; revision=8959
-rw-r--r--window_name-help.pd20
-rw-r--r--window_name.c41
2 files changed, 61 insertions, 0 deletions
diff --git a/window_name-help.pd b/window_name-help.pd
new file mode 100644
index 0000000..993b2cb
--- /dev/null
+++ b/window_name-help.pd
@@ -0,0 +1,20 @@
+#N canvas 431 431 476 365 10;
+#X obj 175 202 sys_gui;
+#X symbolatom 290 96 0 0 0 0 - - -;
+#X obj 274 27 loadbang;
+#X obj 175 143 pack float symbol;
+#X obj 110 83 hsl 128 15 0.1 1 1 1 empty empty window_alpha -2 -8 0
+10 -204800 -1 -1 12700 1;
+#X floatatom 107 118 5 0 0 0 - - -;
+#X msg 175 172 wm attributes \$2 -alpha \$1;
+#X text 43 256 for more options:;
+#X obj 62 279 pddp/pddplink http://tcl.tk/man/tcl8.4/TkCmd/wm.htm;
+#X text 164 229 alpha does not work with X11 :(;
+#X obj 274 64 window_name;
+#X connect 2 0 10 0;
+#X connect 3 0 6 0;
+#X connect 4 0 3 0;
+#X connect 4 0 5 0;
+#X connect 6 0 0 0;
+#X connect 10 0 3 1;
+#X connect 10 0 1 0;
diff --git a/window_name.c b/window_name.c
new file mode 100644
index 0000000..04e551b
--- /dev/null
+++ b/window_name.c
@@ -0,0 +1,41 @@
+#include <stdio.h>
+#include <string.h>
+#include <m_pd.h>
+#include <g_canvas.h>
+
+#define DEBUG(x)
+
+static t_class *window_name_class;
+
+typedef struct _window_name
+{
+ t_object x_obj;
+ t_symbol *windowname;
+} t_window_name;
+
+static void window_name_bang(t_window_name *x)
+{
+ outlet_symbol(x->x_obj.ob_outlet,x->windowname);
+}
+
+static void *window_name_new(void)
+{
+ t_window_name *x = (t_window_name *)pd_new(window_name_class);
+ char buf[MAXPDSTRING];
+
+ snprintf(buf, MAXPDSTRING, ".x%lx", (long unsigned int)canvas_getcurrent());
+ x->windowname = gensym(buf);
+
+ outlet_new(&x->x_obj, &s_symbol);
+
+ return(x);
+}
+
+void window_name_setup(void)
+{
+ window_name_class = class_new(gensym("window_name"),
+ (t_newmethod)window_name_new, NULL,
+ sizeof(t_window_name), 0, 0);
+
+ class_addbang(window_name_class, (t_method)window_name_bang);
+}