From 84314420f2f2f8f05adc7ddabd9228d98a4ee172 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Thu, 8 Nov 2007 03:24:16 +0000 Subject: created object to get current window name so you can change it's tk options svn path=/trunk/externals/hcs/; revision=8959 --- window_name-help.pd | 20 ++++++++++++++++++++ window_name.c | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 window_name-help.pd create mode 100644 window_name.c 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 +#include +#include +#include + +#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); +} -- cgit v1.2.1