Hi,
> 1) Your proposal doesn't implement this point of my patch, which is
> unrelated to the escape key handling:
>
>> - If all windows are minimized, the first one in the list is
>> selected, instead of the second.
Yes, but that is what I want in this (all minimized) case.
If we are going to handle ESC I think it is better if it really
has _no_ effect at.
So when the windows are not minimized, pressing escape will give
the focus to the one which had it before (which is ok), but
if all windows are minimized I don't want that one of them
to show up.
Because if I did then I could simply use the status quo
by selecting that window (first or second or whatever)
with alt+tab.
This "select first" behaviour is already implemented
with the HOME key.
> 2) Is it really necessary to handle the escape key apart from the home
> and end keys? This induces some code duplication.
>
>> + } else if (ev.xkey.keycode == escapeKey) {
>> + /* Focus the first window of the swpanel */
>> + newFocused = wSwitchPanelSelectFirst(swpanel, 0);
>> + if (newFocused) {
>> + wWindowFocus(newFocused, oldFocused);
>> + oldFocused = newFocused;
>> +
>> + if (wPreferences.circ_raise) {
>> + CommitStacking(scr);
>> + raiseWindow(swpanel, newFocused);
>> + }
>> + }
>> + esc_cancel = True;
>> + done = True;
>> } else if (ev.xkey.keycode != shiftLKey &&
>> ev.xkey.keycode != shiftRKey) {
I think so, the escape key should be a special case. Because what
it does is conceptually different from what HOME and END do, so I
don't think we should mix them, even if it just happens to work.
I agree with the code duplication issue though. It is _not_
an excuse for adding more, but the code is already "duplicated" 5 times
in this function.
[ In fact, I have a question about it, the first use of that code
does not have the corresponding CommitStacking(scr), did you notice
it? Is it on purpose? ]
I tried to clean up the (alread existing) code duplication, but
my first attempt did not work well, I added a function like
+static void change_focus_and_raise(WWindow *newFocused, WWindow *oldFocused,
+ WSwitchPanel *swpanel, WScreen *scr)
+{
+ wWindowFocus(newFocused, oldFocused);
+ oldFocused = newFocused;
+
+ if (wPreferences.circ_raise) {
+ CommitStacking(scr);
+ raiseWindow(swpanel, newFocused);
+ }
+}
and replaced them with a call to change_focus_and_raise(...)
The code compiled and alt+tab kinda works, but after some time doing alt+tab
there are more than one window with focus (more than one have the color map of
focused window).
I am probably doing something wrong at the C level I guess, but I don't
bother being embarrassed if in the end I get to learn something.
Do you have an idea of how that code quaduplication can be avoided?
Thanks for the comments!!!
--
To unsubscribe, send mail to [email protected].