View Full Version : My second compiz hack ( doesn't work again :( )
gnumdk
November 11th, 2006, 05:19 PM
http://puffy.homelinux.org/~gnumdk/switcher.c
I tried to add "window_list" option in switcher.
Here, it works well but:
if i switch option to on, it go on but never go off again => go off after a restart of compiz.
I'm wrong somewhere because if i modify ss->windowList with "Bring to front" option, it works !!! :(
Another thing i don't understand:
Why for bool type we have:
case SWITCH_SCREEN_OPTION_MIPMAP:
case SWITCH_SCREEN_OPTION_ICON:
case SWITCH_SCREEN_OPTION_MINIMIZED:
if (compSetBoolOption (o, value))
return TRUE;
break;
and:
case SWITCH_SCREEN_OPTION_BRINGTOFRONT:
if (compSetBoolOption (o, value))
{
ss->bringToFront = o->value.b;
return TRUE;
}
I see after in the code that we use directly ss->opt[SWITCH_SCREEN_OPTION_MINIMIZED].value.b...
But, what is best? Reading directly CompOption or add a member to my plugin struct?
mikedee
November 11th, 2006, 06:54 PM
But, what is best? Reading directly CompOption or add a member to my plugin struct?
This is a very good question, I think you should post it to the mailing list for Davids attention. I would have thought that private members should be used where there is a more complex datatype, but the code does not show that.
I think you bug is because you unmap the window on the first time the switcher is initiated. The if statement above checks if this window exists or not, because the window exists, your code never gets called the second time. I am not sure how to fix it though :(
RYX
November 11th, 2006, 08:10 PM
That's indeed something I'd like to know, too. I had a similar problem when trying to get/set strings within scripts. Apparently the compSet*Option-functions do nothing different than setting the value directly, but I guess they are to be prefered because of future-extensibilty/-changes ... however - I agree that this question should be mailed to the list.
gnumdk
November 11th, 2006, 09:53 PM
You're right !
I was searching the bug in my configuration code...
In fact, the same "bug" existe in beryl. It should be easy to fix it with C++/Qt slot mecanism but in pure C! I don't know how.
I will ask david for my other question.
gnumdk
November 11th, 2006, 10:28 PM
Ok, that was not as hard as i think.
http://puffy.homelinux.org/~gnumdk/compiz/patch/
It seems to work well.
mikedee
November 12th, 2006, 12:26 AM
Looks good :)
BTW you do not need to worry about the schemas, they are regenerated by David where necessary.
gnumdk
November 12th, 2006, 11:45 AM
The fix isn't good i think, i'm looking for a better one
gnumdk
November 12th, 2006, 12:13 PM
ok, i think it's fixed and it's clean now, will put the new patch on the mailing list.
mikedee
November 13th, 2006, 07:36 PM
For the benefit of people not on the list, here is Davids reply
Well, ss->opt[SWITCH_SCREEN_OPTION_MINIMIZED].value.b is the real
storage for the option value. There's usually no reason to keep a copy
of it in another variable, it's just a waste of memory. In some cases a
different value needs to be computed from the actual option value and it
then makes sense to do this when the option is changed. In some cases, I
probably make a copy of option values to clean up the code but that's
just me being lazy and not recommend. It's much better to put a
temporary variable on the stack to clean up code than putting a variable
in the heap allocated screen and display structures.
vBulletin® v3.7.3, Copyright ©2000-2008, Jelsoft Enterprises Ltd.