From: <enl...@li...> - 2004-07-23 20:05:58
|
Enlightenment CVS committal Author : kwo Project : e16 Module : e Dir : e16/e/src Modified Files: E.h config.c focus.c ipc.c settings.c setup.c warp.c Log Message: Fix focuslist trouble. =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/E.h,v retrieving revision 1.310 retrieving revision 1.311 diff -u -3 -r1.310 -r1.311 --- E.h 22 Jul 2004 21:12:04 -0000 1.310 +++ E.h 23 Jul 2004 20:05:49 -0000 1.311 @@ -1203,8 +1203,8 @@ char all_new_windows_get_focus; char new_transients_get_focus; char new_transients_get_focus_if_group_focused; - char raise_on_focus; - char warp_on_focus; + char raise_on_next; + char warp_on_next; } focus; struct { @@ -2235,9 +2235,8 @@ #define FOCUS_DESK_ENTER 6 #define FOCUS_DESK_LEAVE 7 #define FOCUS_NEXT 8 -#define FOCUS_WARP_NEXT 9 -#define FOCUS_WARP_DONE 10 -#define FOCUS_CLICK 11 +#define FOCUS_PREV 9 +#define FOCUS_CLICK 10 void FocusGetNextEwin(void); void FocusGetPrevEwin(void); =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/config.c,v retrieving revision 1.109 retrieving revision 1.110 diff -u -3 -r1.109 -r1.110 --- config.c 17 Jul 2004 22:17:19 -0000 1.109 +++ config.c 23 Jul 2004 20:05:50 -0000 1.110 @@ -759,7 +759,7 @@ Conf.place.ignore_struts = i2; break; case CONTROL_RAISE_ON_NEXT_FOCUS: - Conf.focus.raise_on_focus = i2; + Conf.focus.raise_on_next = i2; break; case CONTROL_RAISE_AFTER_NEXT_FOCUS: Conf.warplist.raise_on_select = i2; @@ -768,7 +768,7 @@ Conf.warplist.enable = i2; break; case CONTROL_WARP_ON_NEXT_FOCUS: - Conf.focus.warp_on_focus = i2; + Conf.focus.warp_on_next = i2; break; case CONTROL_WARP_AFTER_NEXT_FOCUS: Conf.warplist.warp_on_select = i2; @@ -3898,8 +3898,8 @@ fprintf(autosavefile, "3360 %i\n", (int)Conf.place.manual_mouse_pointer); fprintf(autosavefile, "3361 %i\n", (int)Conf.place.ignore_struts); - fprintf(autosavefile, "344 %i\n", (int)Conf.focus.raise_on_focus); - fprintf(autosavefile, "345 %i\n", (int)Conf.focus.warp_on_focus); + fprintf(autosavefile, "344 %i\n", (int)Conf.focus.raise_on_next); + fprintf(autosavefile, "345 %i\n", (int)Conf.focus.warp_on_next); fprintf(autosavefile, "346 %i\n", (int)Conf.edge_flip_resistance); fprintf(autosavefile, "347 %i\n", (int)Conf.pagers.enable); fprintf(autosavefile, "348 %i\n", (int)Conf.pagers.hiq); =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/focus.c,v retrieving revision 1.80 retrieving revision 1.81 diff -u -3 -r1.80 -r1.81 --- focus.c 17 Jul 2004 22:42:29 -0000 1.80 +++ focus.c 23 Jul 2004 20:05:50 -0000 1.81 @@ -104,64 +104,52 @@ EwinListRaise(&EwinListFocus, ewin, 0); } -static void -FocusCycle(int inc) +void +FocusGetNextEwin(void) { - EWin *const *lst0; - EWin **lst, *ewin; - int i, num0, num; - - EDBUG(5, "FocusCycle"); - - /* On previous only ? */ - RemoveTimerEvent("REVERSE_FOCUS_TIMEOUT"); - DoIn("REVERSE_FOCUS_TIMEOUT", 1.0, ReverseTimeout, 0, NULL); - - lst0 = EwinListGetFocus(&num0); - if (lst0 == NULL) - EDBUG_RETURN_; - - num = 0; - lst = NULL; - for (i = 0; i < num0; i++) - { - ewin = lst0[i]; - if (FocusEwinValid(ewin, 1) || ewin->skipfocus) - { - num++; - lst = Erealloc(lst, sizeof(EWin *) * num); - lst[num - 1] = ewin; - } - } + EWin *const *lst; + EWin *ewin; + int i, num; - if (lst == NULL) - EDBUG_RETURN_; + lst = EwinListGetFocus(&num); + if (num <= 1) + return; - for (i = 0; i < num; i++) + ewin = NULL; + for (i = num - 1; i >= 0; i--) { - if (Mode.focuswin == lst[i]) - break; + if (lst[i]->skipfocus || !FocusEwinValid(lst[i], 1)) + continue; + ewin = lst[i]; + break; } - i += inc + num; - i %= num; - ewin = lst[i]; - Efree(lst); - FocusToEWin(ewin, FOCUS_NEXT); - - EDBUG_RETURN_; -} - -void -FocusGetNextEwin(void) -{ - FocusCycle(1); + if (ewin) + FocusToEWin(ewin, FOCUS_NEXT); } void FocusGetPrevEwin(void) { - FocusCycle(-1); + EWin *const *lst; + EWin *ewin; + int i, num; + + lst = EwinListGetFocus(&num); + if (num <= 1) + return; + + ewin = NULL; + for (i = 0; i < num; i++) + { + if (lst[i]->skipfocus || !FocusEwinValid(lst[i], 1)) + continue; + ewin = lst[i]; + break; + } + + if (ewin) + FocusToEWin(ewin, FOCUS_PREV); } void @@ -215,6 +203,7 @@ FocusToEWin(EWin * ewin, int why) { int do_follow = 0; + int do_raise = 0, do_warp = 0; EDBUG(4, "FocusToEWin"); @@ -229,11 +218,17 @@ switch (why) { + case FOCUS_NEXT: + case FOCUS_PREV: + if (Conf.focus.raise_on_next) + do_raise = 1; + if (Conf.focus.warp_on_next) + do_warp = 1; + /* Fall thru */ default: case FOCUS_SET: case FOCUS_ENTER: case FOCUS_LEAVE: /* Unused */ - case FOCUS_NEXT: case FOCUS_CLICK: if (ewin == Mode.focuswin) EDBUG_RETURN_; @@ -299,13 +294,6 @@ if (!FocusEwinValid(ewin, 0)) EDBUG_RETURN_; break; - - case FOCUS_WARP_NEXT: - why = FOCUS_NEXT; - case FOCUS_WARP_DONE: - if (!FocusEwinValid(ewin, 1)) - EDBUG_RETURN_; - break; } if (ewin == Mode.focuswin) @@ -330,20 +318,26 @@ ewin->client.win, NULL); } - if (Conf.focus.raise_on_focus) + if (do_raise) RaiseEwin(ewin); - if (Conf.focus.warp_on_focus) - { - if (ewin != Mode.mouse_over_ewin) - XWarpPointer(disp, None, ewin->win, 0, 0, 0, 0, ewin->w / 2, - ewin->h / 2); - } + if (do_warp && ewin != Mode.mouse_over_ewin) + XWarpPointer(disp, None, ewin->win, 0, 0, 0, 0, ewin->w / 2, ewin->h / 2); RemoveTimerEvent("REVERSE_FOCUS_TIMEOUT"); - if (why != FOCUS_DESK_ENTER) - DoIn("REVERSE_FOCUS_TIMEOUT", 0.5, ReverseTimeout, ewin->client.win, - NULL); + switch (why) + { + default: + case FOCUS_PREV: + DoIn("REVERSE_FOCUS_TIMEOUT", 0.5, ReverseTimeout, ewin->client.win, + NULL); + break; + case FOCUS_DESK_ENTER: + break; + case FOCUS_NEXT: + EwinListRaise(&EwinListFocus, ewin, 0); + break; + } SoundPlay("SOUND_FOCUS_SET"); done: =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/ipc.c,v retrieving revision 1.172 retrieving revision 1.173 diff -u -3 -r1.172 -r1.173 --- ipc.c 17 Jul 2004 22:17:20 -0000 1.172 +++ ipc.c 23 Jul 2004 20:05:50 -0000 1.173 @@ -1831,15 +1831,15 @@ { if (!strcmp(param2, "on")) { - Conf.focus.raise_on_focus = 1; + Conf.focus.raise_on_next = 1; } else if (!strcmp(param2, "off")) { - Conf.focus.raise_on_focus = 0; + Conf.focus.raise_on_next = 0; } else if (!strcmp(param2, "?")) { - if (Conf.focus.raise_on_focus) + if (Conf.focus.raise_on_next) { Esnprintf(buf, sizeof(buf), "raise_on_keyboard_focus_switch: on"); @@ -1913,15 +1913,15 @@ { if (!strcmp(param2, "on")) { - Conf.focus.warp_on_focus = 1; + Conf.focus.warp_on_next = 1; } else if (!strcmp(param2, "off")) { - Conf.focus.warp_on_focus = 0; + Conf.focus.warp_on_next = 0; } else if (!strcmp(param2, "?")) { - if (Conf.focus.warp_on_focus) + if (Conf.focus.warp_on_next) { Esnprintf(buf, sizeof(buf), "pointer_to_keyboard_focus_window: on"); @@ -5481,7 +5481,7 @@ else if (!strcmp(w, "RAISE_ON_NEXT_FOCUS:")) { word(s, wd, w); - Conf.focus.raise_on_focus = atoi(w); + Conf.focus.raise_on_next = atoi(w); } else if (!strcmp(w, "RAISE_AFTER_NEXT_FOCUS:")) { @@ -5496,7 +5496,7 @@ else if (!strcmp(w, "WARP_ON_NEXT_FOCUS:")) { word(s, wd, w); - Conf.focus.warp_on_focus = atoi(w); + Conf.focus.warp_on_next = atoi(w); } else if (!strcmp(w, "WARP_AFTER_NEXT_FOCUS:")) { @@ -5601,9 +5601,9 @@ Conf.focus.new_transients_get_focus, Conf.focus.new_transients_get_focus_if_group_focused, Conf.place.manual, Conf.place.manual_mouse_pointer, - Conf.focus.raise_on_focus, + Conf.focus.raise_on_next, Conf.warplist.raise_on_select, Conf.warplist.enable, - Conf.focus.warp_on_focus, + Conf.focus.warp_on_next, Conf.warplist.warp_on_select, Conf.edge_flip_resistance); CommsSend(c, buf); } =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/settings.c,v retrieving revision 1.118 retrieving revision 1.119 diff -u -3 -r1.118 -r1.119 --- settings.c 17 Jul 2004 22:17:20 -0000 1.118 +++ settings.c 23 Jul 2004 20:05:50 -0000 1.119 @@ -370,8 +370,8 @@ Conf.focus.new_transients_get_focus = tmp_popup_focus; Conf.focus.new_transients_get_focus_if_group_focused = tmp_owner_popup_focus; - Conf.focus.raise_on_focus = tmp_raise_focus; - Conf.focus.warp_on_focus = tmp_warp_focus; + Conf.focus.raise_on_next = tmp_raise_focus; + Conf.focus.warp_on_next = tmp_warp_focus; #ifdef WITH_TARTY_WARP Conf.warplist.warp_on_select = tmp_warp_after_focus; Conf.warplist.raise_on_select = tmp_raise_after_focus; @@ -406,8 +406,8 @@ tmp_new_focus = Conf.focus.all_new_windows_get_focus; tmp_popup_focus = Conf.focus.new_transients_get_focus; tmp_owner_popup_focus = Conf.focus.new_transients_get_focus_if_group_focused; - tmp_raise_focus = Conf.focus.raise_on_focus; - tmp_warp_focus = Conf.focus.warp_on_focus; + tmp_raise_focus = Conf.focus.raise_on_next; + tmp_warp_focus = Conf.focus.warp_on_next; #ifdef WITH_TARTY_WARP tmp_raise_after_focus = Conf.warplist.raise_on_select; tmp_warp_after_focus = Conf.warplist.warp_on_select; =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/setup.c,v retrieving revision 1.137 retrieving revision 1.138 diff -u -3 -r1.137 -r1.138 --- setup.c 20 Jul 2004 16:05:36 -0000 1.137 +++ setup.c 23 Jul 2004 20:05:50 -0000 1.138 @@ -427,8 +427,8 @@ Conf.focus.all_new_windows_get_focus = 0; Conf.focus.new_transients_get_focus = 0; Conf.focus.new_transients_get_focus_if_group_focused = 1; - Conf.focus.raise_on_focus = 0; - Conf.focus.warp_on_focus = 0; + Conf.focus.raise_on_next = 1; + Conf.focus.warp_on_next = 0; Conf.warplist.raise_on_select = 1; Conf.warplist.warp_on_select = 0; Conf.group_config.iconify = 1; =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/warp.c,v retrieving revision 1.48 retrieving revision 1.49 diff -u -3 -r1.48 -r1.49 --- warp.c 17 Jul 2004 22:17:20 -0000 1.48 +++ warp.c 23 Jul 2004 20:05:50 -0000 1.49 @@ -133,8 +133,14 @@ ewin = NULL; if (ewin) { + if (Conf.focus.raise_on_next) + RaiseEwin(ewin); + if (Conf.focus.warp_on_next) + if (ewin != Mode.mouse_over_ewin && !ewin->iconified) + XWarpPointer(disp, None, ewin->win, 0, 0, 0, 0, + ewin->w / 2, ewin->h / 2); if (Conf.warplist.warpfocused) - FocusToEWin(ewin, FOCUS_WARP_NEXT); + FocusToEWin(ewin, FOCUS_SET); WarpFocusShowTitle(ewin); } Efree(lst); @@ -169,7 +175,7 @@ if (ewin != Mode.mouse_over_ewin) XWarpPointer(disp, None, ewin->win, 0, 0, 0, 0, ewin->w / 2, ewin->h / 2); - FocusToEWin(ewin, FOCUS_WARP_DONE); + FocusToEWin(ewin, FOCUS_SET); } Efree(lst); |