On 16 Sep 2004 15:11:56 -0400, Salvatore Domenick Desiano wrote: > > o But I really like your suggestion about a C program which will > o generate a perl only FVWM::WindowFlags, and I will look into doing so. > > I reiterate the suggestion that this be done on module startup, rather > than by file generation. Then, rather than adding a file to the > distribution, you simply generate a set of M_CONFIG_INFO messages > > M_CONFIG_INFO FlagBit WINDOW_HAS_TITLE 134 > M_CONFIG_INFO FlagBit WINDOW_IS_STICKY_ACROSS_DESKS 0 > M_CONFIG_INFO FlagBit STYLE_IS_TRANSIENT 150
[I move this discussion to fvwm-workers@ not to scare readers.] This is a good suggestion, but it adds more than 300 events to modules even if they are not interested in window flag bits. I am not against going this way although it is harder than my my intermediate solution and still is not fully the ideal solution (that would be not to dump and pass C structures across network). But again, this is an acceptable solution. But then, to be optimal we need a new event type MX_WINDOW_FLAG with three arguments: short int bit_start, short int bit_length, char *name. > The C code is the same as what Mark has been talked about for a C -> Perl > module, and I've written it already for another project, although it's not > to Fvwm coding standards. It's not elegant, but brute force is all we can > get because of the implementation-dependent style of the C standard. > > #define FIND_BIT(x) \ > { SET_##x(with,1); \ > find_bit(##x,with,without); \ > SET_##x(with,0); } > > unsigned find_bit(char * name, > window_flags * with, > window_flags * without) > { > for (i = 0; i < (sizeof(wf) * 8); ++i) > { > unsigned bitIndex = i % 8; > unsigned byteIndex = i / 8; > unsigned char byte = ((unsigned char *)&wf)[byteIndex]; > unsigned char bit = (byte >> bitIndex) & 0x1; > unsigned char bytet = ((unsigned char *)&wft)[byteIndex]; > unsigned char bitt = (bytet >> bitIndex) & 0x1; > if (bit != bitt) > printf("M_CONFIG_INFO FlagBit %s %d\n",name,bit); > } > } > > unsigned dump_window_flags() > { > FvwmWindow with; > FvwmWindow without; > FIND_BIT(DO_SHRINK_WINDOWSHADE); > FIND_BIT(DO_LOWER_TRANSIENT); > FIND_BIT(DO_STACK_TRANSIENT_PARENT); > > ... > > } Regards, Mikhael. -- Visit the official FVWM web page at <URL:http://www.fvwm.org/>. To unsubscribe from the list, send "unsubscribe fvwm-workers" in the body of a message to [EMAIL PROTECTED] To report problems, send mail to [EMAIL PROTECTED]