parent
2c73ed7219
commit
b46f03578e
40
src/E.h
40
src/E.h
|
@ -453,9 +453,9 @@ int Esnprintf(va_alist);
|
|||
#define FLAG_FIXED_HORIZ 8
|
||||
#define FLAG_FIXED_VERT 16
|
||||
|
||||
#define FOCUS_POINTER 0
|
||||
#define FOCUS_SLOPPY 1
|
||||
#define FOCUS_CLICK 2
|
||||
#define MODE_FOCUS_POINTER 0
|
||||
#define MODE_FOCUS_SLOPPY 1
|
||||
#define MODE_FOCUS_CLICK 2
|
||||
|
||||
#define DOCK_LEFT 0
|
||||
#define DOCK_RIGHT 1
|
||||
|
@ -1852,19 +1852,29 @@ void DrawEwinShape(EWin * ewin, int md, int x, int y, int w,
|
|||
int h, char firstlast);
|
||||
void PropagateShapes(Window win);
|
||||
|
||||
void FlipFocusList(void);
|
||||
void RemoveEwinFromFocusList(EWin * ewin);
|
||||
void AddEwinToFocusList(EWin * ewin);
|
||||
void GetNextFocusEwin(void);
|
||||
void GetPrevFocusEwin(void);
|
||||
void FixFocus(void);
|
||||
void FocusToEWin(EWin * ewin);
|
||||
/* focus.c functions */
|
||||
#define FOCUS_SET 0
|
||||
#define FOCUS_NONE 1
|
||||
#define FOCUS_ENTER 2
|
||||
#define FOCUS_LEAVE 3
|
||||
#define FOCUS_EWIN_NEW 4
|
||||
#define FOCUS_EWIN_GONE 5
|
||||
#define FOCUS_DESK_ENTER 6
|
||||
#define FOCUS_DESK_LEAVE 7
|
||||
#define FOCUS_WARP 8
|
||||
#define FOCUS_CLICK 9
|
||||
|
||||
#if 0 /* Clean up if OK -- Remove FocusToNone */
|
||||
void FocusToNone(void);
|
||||
#endif
|
||||
void BeginNewDeskFocus(void);
|
||||
void NewDeskFocus(void);
|
||||
void FocusGetNextEwin(void);
|
||||
void FocusGetPrevEwin(void);
|
||||
void FocusEwinSetGrabs(EWin * ewin);
|
||||
void FocusFix(void);
|
||||
void FocusToEWin(EWin * ewin, int why);
|
||||
void FocusHandleFocusIn(Window win);
|
||||
void FocusHandleFocusOut(Window win);
|
||||
void FocusHandleEnter(XEvent * ev);
|
||||
void FocusHandleClick(Window win);
|
||||
void FocusNewDeskBegin(void);
|
||||
void FocusNewDesk(void);
|
||||
|
||||
/* icccm.c functions */
|
||||
void ICCCM_Init(void);
|
||||
|
|
|
@ -1712,22 +1712,22 @@ doFocusModeSet(EWin * edummy, void *params)
|
|||
if (params)
|
||||
{
|
||||
if (!strcmp("pointer", (char *)params))
|
||||
conf.focus.mode = FOCUS_POINTER;
|
||||
conf.focus.mode = MODE_FOCUS_POINTER;
|
||||
else if (!strcmp("sloppy", (char *)params))
|
||||
conf.focus.mode = FOCUS_SLOPPY;
|
||||
conf.focus.mode = MODE_FOCUS_SLOPPY;
|
||||
else if (!strcmp("click", (char *)params))
|
||||
conf.focus.mode = FOCUS_CLICK;
|
||||
conf.focus.mode = MODE_FOCUS_CLICK;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (conf.focus.mode == FOCUS_POINTER)
|
||||
conf.focus.mode = FOCUS_SLOPPY;
|
||||
else if (conf.focus.mode == FOCUS_SLOPPY)
|
||||
conf.focus.mode = FOCUS_CLICK;
|
||||
else if (conf.focus.mode == FOCUS_CLICK)
|
||||
conf.focus.mode = FOCUS_POINTER;
|
||||
if (conf.focus.mode == MODE_FOCUS_POINTER)
|
||||
conf.focus.mode = MODE_FOCUS_SLOPPY;
|
||||
else if (conf.focus.mode == MODE_FOCUS_SLOPPY)
|
||||
conf.focus.mode = MODE_FOCUS_CLICK;
|
||||
else if (conf.focus.mode == MODE_FOCUS_CLICK)
|
||||
conf.focus.mode = MODE_FOCUS_POINTER;
|
||||
}
|
||||
FixFocus();
|
||||
FocusFix();
|
||||
autosave();
|
||||
EDBUG_RETURN(0);
|
||||
}
|
||||
|
@ -2514,7 +2514,7 @@ static int
|
|||
doFocusNext(EWin * edummy, void *params)
|
||||
{
|
||||
EDBUG(6, "doFocusNext");
|
||||
GetNextFocusEwin();
|
||||
FocusGetNextEwin();
|
||||
EDBUG_RETURN(0);
|
||||
}
|
||||
|
||||
|
@ -2522,7 +2522,7 @@ static int
|
|||
doFocusPrev(EWin * edummy, void *params)
|
||||
{
|
||||
EDBUG(6, "doFocusPrev");
|
||||
GetPrevFocusEwin();
|
||||
FocusGetPrevEwin();
|
||||
EDBUG_RETURN(0);
|
||||
}
|
||||
|
||||
|
@ -2544,7 +2544,7 @@ doFocusSet(EWin * ewin, void *params)
|
|||
RaiseEwin(ewin);
|
||||
if (conf.focus.warp_on_next_focus)
|
||||
XWarpPointer(disp, None, ewin->win, 0, 0, 0, 0, ewin->w / 2, ewin->h / 2);
|
||||
FocusToEWin(ewin);
|
||||
FocusToEWin(ewin, FOCUS_SET);
|
||||
|
||||
EDBUG_RETURN(0);
|
||||
}
|
||||
|
|
|
@ -275,7 +275,7 @@ SetCurrentArea(int ax, int ay)
|
|||
#if 0 /* Clean up if not causing trouble */
|
||||
FocusToEWin(NULL);
|
||||
#endif
|
||||
BeginNewDeskFocus();
|
||||
FocusNewDeskBegin();
|
||||
|
||||
/* move all the windows around */
|
||||
lst = (EWin **) ListItemType(&num, LIST_TYPE_EWIN);
|
||||
|
@ -432,7 +432,7 @@ SetCurrentArea(int ax, int ay)
|
|||
ActionsResume();
|
||||
|
||||
/* re-focus on a new ewin on that new desktop area */
|
||||
NewDeskFocus();
|
||||
FocusNewDesk();
|
||||
|
||||
/* tell the FX api abotu the change */
|
||||
FX_DeskChange();
|
||||
|
|
|
@ -805,7 +805,7 @@ ArrangeEwinCentered(EWin * ewin, int focus)
|
|||
ArrangeEwinCenteredXY(ewin, &ewin->x, &ewin->y);
|
||||
MoveEwin(ewin, ewin->x, ewin->y);
|
||||
if (focus)
|
||||
FocusToEWin(ewin);
|
||||
FocusToEWin(ewin, FOCUS_SET);
|
||||
|
||||
EDBUG_RETURN_;
|
||||
}
|
||||
|
|
|
@ -141,7 +141,7 @@ SetEInfoOnAll()
|
|||
}
|
||||
|
||||
EWin *
|
||||
GetEwinPointerInClient()
|
||||
GetEwinPointerInClient(void)
|
||||
{
|
||||
Window rt, ch;
|
||||
int dum, px, py, d, i;
|
||||
|
@ -645,7 +645,7 @@ AddToFamily(Window win)
|
|||
RaiseEwin(ewin);
|
||||
ShowEwin(ewin);
|
||||
StackDesktops();
|
||||
FocusToEWin(ewin);
|
||||
FocusToEWin(ewin, FOCUS_EWIN_NEW);
|
||||
GrabThePointer(root.win);
|
||||
mode.have_place_grab = 1;
|
||||
mode.place = 1;
|
||||
|
@ -709,7 +709,7 @@ AddToFamily(Window win)
|
|||
DetermineEwinArea(ewin);
|
||||
if (conf.focus.all_new_windows_get_focus)
|
||||
{
|
||||
FocusToEWin(ewin);
|
||||
FocusToEWin(ewin, FOCUS_EWIN_NEW);
|
||||
if ((ewin->desktop != desks.current) && (!ewin->iconified))
|
||||
{
|
||||
GotoDesktop(ewin->desktop);
|
||||
|
@ -720,7 +720,7 @@ AddToFamily(Window win)
|
|||
{
|
||||
if (ewin->client.transient)
|
||||
{
|
||||
FocusToEWin(ewin);
|
||||
FocusToEWin(ewin, FOCUS_EWIN_NEW);
|
||||
if ((ewin->desktop != desks.current) && (!ewin->iconified))
|
||||
{
|
||||
GotoDesktop(ewin->desktop);
|
||||
|
@ -735,7 +735,7 @@ AddToFamily(Window win)
|
|||
LIST_TYPE_EWIN);
|
||||
if ((ewin2) && (mode.focuswin == ewin2))
|
||||
{
|
||||
FocusToEWin(ewin);
|
||||
FocusToEWin(ewin, FOCUS_EWIN_NEW);
|
||||
if ((ewin->desktop != desks.current) && (!ewin->iconified))
|
||||
{
|
||||
GotoDesktop(ewin->desktop);
|
||||
|
@ -1381,7 +1381,7 @@ CreateEwin()
|
|||
XChangeWindowAttributes(disp, ewin->win_container,
|
||||
CWEventMask | CWDontPropagate, &att);
|
||||
EMapWindow(disp, ewin->win_container);
|
||||
if ((conf.focus.clickraises) || (conf.focus.mode == FOCUS_CLICK))
|
||||
if ((conf.focus.clickraises) || (conf.focus.mode == MODE_FOCUS_CLICK))
|
||||
XGrabButton(disp, AnyButton, 0, ewin->win_container, False,
|
||||
ButtonPressMask, GrabModeSync, GrabModeAsync, None, None);
|
||||
att.event_mask =
|
||||
|
@ -1441,7 +1441,7 @@ FreeEwin(EWin * ewin)
|
|||
#if 0 /* Clean up if OK -- Remove FocusToNone */
|
||||
FocusToNone();
|
||||
#else
|
||||
FocusToEWin(NULL);
|
||||
FocusToEWin(NULL, FOCUS_EWIN_GONE);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -1478,7 +1478,7 @@ HandleComms(XClientMessageEvent * ev)
|
|||
InitDesktopControls();
|
||||
ShowDesktopControls();
|
||||
}
|
||||
FixFocus();
|
||||
FocusFix();
|
||||
|
||||
GetAreaSize(&ax, &ay);
|
||||
GetCurrentArea(&a, &b);
|
||||
|
|
|
@ -1253,8 +1253,8 @@ GotoDesktop(int num)
|
|||
|
||||
ActionsSuspend();
|
||||
|
||||
FocusToEWin(NULL);
|
||||
BeginNewDeskFocus();
|
||||
FocusToEWin(NULL, FOCUS_DESK_LEAVE);
|
||||
FocusNewDeskBegin();
|
||||
|
||||
if (mode.mode == MODE_NONE)
|
||||
mode.mode = MODE_DESKSWITCH;
|
||||
|
@ -1321,7 +1321,7 @@ GotoDesktop(int num)
|
|||
if (mode.mode == MODE_DESKSWITCH)
|
||||
mode.mode = MODE_NONE;
|
||||
|
||||
NewDeskFocus();
|
||||
FocusNewDesk();
|
||||
RedrawPagersForDesktop(pdesk, 0);
|
||||
RedrawPagersForDesktop(num, 3);
|
||||
ForceUpdatePagersForDesktop(num);
|
||||
|
@ -1448,7 +1448,7 @@ RaiseDesktop(int num)
|
|||
if ((num < 0) || (num >= conf.desks.numdesktops))
|
||||
EDBUG_RETURN_;
|
||||
|
||||
BeginNewDeskFocus();
|
||||
FocusNewDeskBegin();
|
||||
CloneDesktop(deskorder[0]);
|
||||
desks.desk[num].viewable = 1;
|
||||
RefreshDesktop(num);
|
||||
|
@ -1464,7 +1464,7 @@ RaiseDesktop(int num)
|
|||
StackDesktops();
|
||||
desks.current = num;
|
||||
MoveStickyWindowsToCurrentDesk();
|
||||
NewDeskFocus();
|
||||
FocusNewDesk();
|
||||
FX_DeskChange();
|
||||
RemoveClones();
|
||||
RedrawPagersForDesktop(num, 3);
|
||||
|
@ -1487,7 +1487,7 @@ LowerDesktop(int num)
|
|||
if ((num <= 0) || (num >= conf.desks.numdesktops))
|
||||
EDBUG_RETURN_;
|
||||
|
||||
BeginNewDeskFocus();
|
||||
FocusNewDeskBegin();
|
||||
CloneDesktop(num);
|
||||
MoveToDeskBottom(num);
|
||||
UncoverDesktop(deskorder[0]);
|
||||
|
@ -1495,7 +1495,7 @@ LowerDesktop(int num)
|
|||
StackDesktops();
|
||||
desks.current = deskorder[0];
|
||||
MoveStickyWindowsToCurrentDesk();
|
||||
NewDeskFocus();
|
||||
FocusNewDesk();
|
||||
FX_DeskChange();
|
||||
RemoveClones();
|
||||
RedrawPagersForDesktop(deskorder[0], 3);
|
||||
|
|
|
@ -228,7 +228,7 @@ HEnterNotify(XEvent * ev)
|
|||
*/
|
||||
if (ev->xany.window == root.win)
|
||||
{
|
||||
if (!mode.focuswin || FOCUS_POINTER == conf.focus.mode)
|
||||
if (!mode.focuswin || conf.focus.mode == MODE_FOCUS_POINTER)
|
||||
HandleFocusWindow(root.focuswin);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -128,7 +128,7 @@ HandleFocusWindowIn(Window win)
|
|||
{
|
||||
mode.focuswin->active = 0;
|
||||
DrawEwin(mode.focuswin);
|
||||
if (conf.focus.mode == FOCUS_CLICK)
|
||||
if (conf.focus.mode == MODE_FOCUS_CLICK)
|
||||
XGrabButton(disp, AnyButton, AnyModifier,
|
||||
mode.focuswin->win_container, False,
|
||||
ButtonPressMask, GrabModeSync, GrabModeAsync, None,
|
||||
|
@ -145,7 +145,7 @@ HandleFocusWindowIn(Window win)
|
|||
{
|
||||
mode.focuswin->active = 1;
|
||||
DrawEwin(mode.focuswin);
|
||||
if (conf.focus.mode == FOCUS_CLICK)
|
||||
if (conf.focus.mode == MODE_FOCUS_CLICK)
|
||||
{
|
||||
XUngrabButton(disp, AnyButton, AnyModifier,
|
||||
mode.focuswin->win_container);
|
||||
|
@ -163,27 +163,27 @@ HandleFocusWindow(Window win)
|
|||
|
||||
EDBUG(5, "HandleFocusWindow");
|
||||
if (root.focuswin == win)
|
||||
FocusToEWin(NULL);
|
||||
FocusToEWin(NULL, FOCUS_SET);
|
||||
else
|
||||
{
|
||||
found_ewin = FindEwinByChildren(win);
|
||||
if (!found_ewin)
|
||||
found_ewin = FindEwinByBase(win);
|
||||
if (conf.focus.mode == FOCUS_CLICK)
|
||||
if (conf.focus.mode == MODE_FOCUS_CLICK)
|
||||
mode.mouse_over_win = found_ewin;
|
||||
else if (conf.focus.mode == FOCUS_SLOPPY)
|
||||
else if (conf.focus.mode == MODE_FOCUS_SLOPPY)
|
||||
{
|
||||
if (!found_ewin)
|
||||
ICCCM_Cmap(NULL);
|
||||
else if (!(found_ewin->focusclick))
|
||||
FocusToEWin(found_ewin);
|
||||
FocusToEWin(found_ewin, FOCUS_SET);
|
||||
mode.mouse_over_win = found_ewin;
|
||||
}
|
||||
else if (conf.focus.mode == FOCUS_POINTER)
|
||||
else if (conf.focus.mode == MODE_FOCUS_POINTER)
|
||||
{
|
||||
if (!found_ewin)
|
||||
found_ewin = GetEwinPointerInClient();
|
||||
FocusToEWin(found_ewin);
|
||||
FocusToEWin(found_ewin, FOCUS_SET);
|
||||
mode.mouse_over_win = found_ewin;
|
||||
}
|
||||
}
|
||||
|
@ -670,7 +670,7 @@ HandleUnmap(XEvent * ev)
|
|||
SlideoutsHide();
|
||||
|
||||
if (ewin == mode.focuswin)
|
||||
FocusToEWin(NULL);
|
||||
FocusToEWin(NULL, FOCUS_SET);
|
||||
if (ewin == mode.mouse_over_win)
|
||||
mode.mouse_over_win = NULL;
|
||||
|
||||
|
@ -846,13 +846,13 @@ HandleMouseDown(XEvent * ev)
|
|||
if (MenusEventMouseDown(ev))
|
||||
goto exit;
|
||||
|
||||
if ((conf.focus.clickraises) || (conf.focus.mode == FOCUS_CLICK))
|
||||
if ((conf.focus.clickraises) || (conf.focus.mode == MODE_FOCUS_CLICK))
|
||||
{
|
||||
ewin = FindEwinByChildren(win);
|
||||
if (!ewin)
|
||||
ewin = FindEwinByBase(win);
|
||||
if (ewin)
|
||||
FocusToEWin(ewin);
|
||||
FocusToEWin(ewin, FOCUS_CLICK);
|
||||
if (ewin)
|
||||
RaiseEwin(ewin);
|
||||
/* allow click to pass thorugh */
|
||||
|
|
|
@ -723,7 +723,7 @@ EWMH_ProcessClientMessage(XClientMessageEvent * event)
|
|||
RaiseEwin(ewin);
|
||||
if (ewin->shaded)
|
||||
UnShadeEwin(ewin);
|
||||
FocusToEWin(ewin);
|
||||
FocusToEWin(ewin, FOCUS_SET);
|
||||
}
|
||||
else if (event->message_type == _NET_CLOSE_WINDOW)
|
||||
{
|
||||
|
|
214
src/focus.c
214
src/focus.c
|
@ -22,9 +22,6 @@
|
|||
*/
|
||||
#include "E.h"
|
||||
|
||||
static void ReverseTimeout(int val, void *data);
|
||||
static void AutoraiseTimeout(int val, void *data);
|
||||
|
||||
static int new_desk_focus_nesting = 0;
|
||||
|
||||
/* Mostly stolen from the temporary 'ToolTipTimeout' */
|
||||
|
@ -33,7 +30,7 @@ AutoraiseTimeout(int val, void *data)
|
|||
{
|
||||
EWin *found_ewin;
|
||||
|
||||
if (conf.focus.mode == FOCUS_CLICK)
|
||||
if (conf.focus.mode == MODE_FOCUS_CLICK)
|
||||
return;
|
||||
found_ewin = FindItem("", val, LIST_FINDBY_ID, LIST_TYPE_EWIN);
|
||||
if (found_ewin)
|
||||
|
@ -53,151 +50,86 @@ ReverseTimeout(int val, void *data)
|
|||
data = NULL;
|
||||
}
|
||||
|
||||
void
|
||||
GetNextFocusEwin(void)
|
||||
static void
|
||||
FocusCycle(int inc)
|
||||
{
|
||||
EWin **lst0, **lst, *ewin;
|
||||
int i, num0, num, ax, ay;
|
||||
|
||||
EDBUG(5, "GetNextFocusEwin");
|
||||
EDBUG(5, "FocusCycle");
|
||||
|
||||
if (conf.warplist.enable)
|
||||
{
|
||||
WarpFocus(1);
|
||||
WarpFocus(inc);
|
||||
EDBUG_RETURN_;
|
||||
}
|
||||
lst0 = (EWin **) ListItemType(&num0, LIST_TYPE_EWIN);
|
||||
num = 0;
|
||||
lst = NULL;
|
||||
GetCurrentArea(&ax, &ay);
|
||||
if (lst0)
|
||||
{
|
||||
for (i = 0; i < num0; i++)
|
||||
{
|
||||
ewin = lst0[i];
|
||||
if (((ewin->sticky) || (ewin->desktop == desks.current)) && ((ewin->area_x == ax) && (ewin->area_y == ay)) && (!ewin->skipfocus) && (!ewin->neverfocus) && (!ewin->iconified) && (!ewin->menu) && (!ewin->pager) && (!ewin->ibox) && (!ewin->iconified) /*&& (ewin->client.mwm_decor_title) &&
|
||||
* * * * (ewin->client.mwm_decor_border) */
|
||||
)
|
||||
{
|
||||
num++;
|
||||
lst = Erealloc(lst, sizeof(EWin *) * num);
|
||||
lst[num - 1] = lst0[i];
|
||||
}
|
||||
}
|
||||
Efree(lst0);
|
||||
}
|
||||
ewin = NULL;
|
||||
if (lst)
|
||||
{
|
||||
for (i = 0; i < num; i++)
|
||||
{
|
||||
if (mode.focuswin == lst[i])
|
||||
{
|
||||
if (i < num - 1)
|
||||
ewin = lst[i + 1];
|
||||
else
|
||||
ewin = lst[0];
|
||||
Efree(lst);
|
||||
if (conf.focus.raise_on_next_focus)
|
||||
RaiseEwin(ewin);
|
||||
if (conf.focus.warp_on_next_focus)
|
||||
XWarpPointer(disp, None, ewin->win, 0, 0, 0, 0,
|
||||
ewin->w / 2, ewin->h / 2);
|
||||
FocusToEWin(ewin);
|
||||
EDBUG_RETURN_;
|
||||
}
|
||||
}
|
||||
ewin = lst[0];
|
||||
Efree(lst);
|
||||
if (conf.focus.raise_on_next_focus)
|
||||
RaiseEwin(ewin);
|
||||
if (conf.focus.warp_on_next_focus)
|
||||
XWarpPointer(disp, None, ewin->win, 0, 0, 0, 0, ewin->w / 2,
|
||||
ewin->h / 2);
|
||||
FocusToEWin(ewin);
|
||||
}
|
||||
EDBUG_RETURN_;
|
||||
}
|
||||
|
||||
void
|
||||
GetPrevFocusEwin(void)
|
||||
{
|
||||
EWin **lst0, **lst, *ewin;
|
||||
int i, num0, num, ax, ay;
|
||||
|
||||
EDBUG(5, "GetPrevFocusEwin");
|
||||
if (conf.warplist.enable)
|
||||
{
|
||||
WarpFocus(-1);
|
||||
EDBUG_RETURN_;
|
||||
}
|
||||
/* On previous only ? */
|
||||
RemoveTimerEvent("REVERSE_FOCUS_TIMEOUT");
|
||||
DoIn("REVERSE_FOCUS_TIMEOUT", 1.0, ReverseTimeout, 0, NULL);
|
||||
|
||||
GetCurrentArea(&ax, &ay);
|
||||
|
||||
lst0 = (EWin **) ListItemType(&num0, LIST_TYPE_EWIN);
|
||||
if (lst0 == NULL)
|
||||
EDBUG_RETURN_;
|
||||
|
||||
num = 0;
|
||||
lst = NULL;
|
||||
GetCurrentArea(&ax, &ay);
|
||||
if (lst0)
|
||||
for (i = 0; i < num0; i++)
|
||||
{
|
||||
for (i = 0; i < num0; i++)
|
||||
ewin = lst0[i];
|
||||
DetermineEwinArea(ewin); // ???
|
||||
if (((ewin->sticky) || (ewin->desktop == desks.current)) &&
|
||||
((ewin->area_x == ax) && (ewin->area_y == ay)) &&
|
||||
(!ewin->skipfocus) && (!ewin->neverfocus) &&
|
||||
(!ewin->shaded) && (!ewin->iconified) &&
|
||||
(!ewin->menu) && (!ewin->pager) && (!ewin->ibox))
|
||||
{
|
||||
ewin = lst0[i];
|
||||
DetermineEwinArea(ewin);
|
||||
if (((ewin->sticky) || (ewin->desktop == desks.current))
|
||||
&& ((ewin->area_x == ax) && (ewin->area_y == ay))
|
||||
&& (!ewin->skipfocus) && (!ewin->neverfocus) && (!ewin->shaded)
|
||||
&& (!ewin->menu) && (!ewin->pager) && (!ewin->ibox)
|
||||
&& (!ewin->iconified)
|
||||
/* && (ewin->client.mwm_decor_title) &&
|
||||
* (ewin->client.mwm_decor_border) */
|
||||
)
|
||||
{
|
||||
num++;
|
||||
lst = Erealloc(lst, sizeof(EWin *) * num);
|
||||
lst[num - 1] = lst0[i];
|
||||
}
|
||||
num++;
|
||||
lst = Erealloc(lst, sizeof(EWin *) * num);
|
||||
lst[num - 1] = lst0[i];
|
||||
}
|
||||
Efree(lst0);
|
||||
}
|
||||
ewin = NULL;
|
||||
if (lst)
|
||||
Efree(lst0);
|
||||
|
||||
if (lst == NULL)
|
||||
EDBUG_RETURN_;
|
||||
|
||||
for (i = 0; i < num; i++)
|
||||
{
|
||||
for (i = 0; i < num; i++)
|
||||
{
|
||||
if (mode.focuswin == lst[i])
|
||||
{
|
||||
if (i == 0)
|
||||
ewin = lst[num - 1];
|
||||
else
|
||||
ewin = lst[i - 1];
|
||||
Efree(lst);
|
||||
if (conf.focus.raise_on_next_focus)
|
||||
RaiseEwin(ewin);
|
||||
if (conf.focus.warp_on_next_focus)
|
||||
XWarpPointer(disp, None, ewin->win, 0, 0, 0, 0,
|
||||
ewin->w / 2, ewin->h / 2);
|
||||
FocusToEWin(ewin);
|
||||
EDBUG_RETURN_;
|
||||
}
|
||||
}
|
||||
ewin = lst[0];
|
||||
Efree(lst);
|
||||
if (conf.focus.raise_on_next_focus)
|
||||
RaiseEwin(ewin);
|
||||
if (conf.focus.warp_on_next_focus)
|
||||
XWarpPointer(disp, None, ewin->win, 0, 0, 0, 0, ewin->w / 2,
|
||||
ewin->h / 2);
|
||||
FocusToEWin(ewin);
|
||||
if (mode.focuswin == lst[i])
|
||||
break;
|
||||
}
|
||||
i += inc + num;
|
||||
i %= num;
|
||||
ewin = lst[i];
|
||||
Efree(lst);
|
||||
|
||||
FocusToEWin(ewin, FOCUS_SET);
|
||||
|
||||
EDBUG_RETURN_;
|
||||
}
|
||||
|
||||
void
|
||||
FixFocus(void)
|
||||
FocusGetNextEwin(void)
|
||||
{
|
||||
FocusCycle(1);
|
||||
}
|
||||
|
||||
void
|
||||
FocusGetPrevEwin(void)
|
||||
{
|
||||
FocusCycle(-1);
|
||||
}
|
||||
|
||||
void
|
||||
FocusFix(void)
|
||||
{
|
||||
EWin **lst, *ewin;
|
||||
int i, num;
|
||||
|
||||
EDBUG(5, "FixFocus");
|
||||
EDBUG(5, "FocusFix");
|
||||
num = 0;
|
||||
lst = (EWin **) ListItemType(&num, LIST_TYPE_EWIN);
|
||||
if (lst)
|
||||
|
@ -205,7 +137,7 @@ FixFocus(void)
|
|||
for (i = 0; i < num; i++)
|
||||
{
|
||||
ewin = lst[i];
|
||||
if (conf.focus.mode == FOCUS_CLICK)
|
||||
if (conf.focus.mode == MODE_FOCUS_CLICK)
|
||||
{
|
||||
if (!(ewin->active))
|
||||
XGrabButton(disp, AnyButton, AnyModifier,
|
||||
|
@ -224,7 +156,7 @@ FixFocus(void)
|
|||
}
|
||||
|
||||
void
|
||||
FocusToEWin(EWin * ewin)
|
||||
FocusToEWin(EWin * ewin, int why)
|
||||
{
|
||||
int ax, ay;
|
||||
|
||||
|
@ -237,10 +169,10 @@ FocusToEWin(EWin * ewin)
|
|||
EDBUG_RETURN_;
|
||||
|
||||
ICCCM_Cmap(ewin);
|
||||
if ((!ewin) && (conf.focus.mode != FOCUS_POINTER))
|
||||
if ((!ewin) && (conf.focus.mode != MODE_FOCUS_POINTER))
|
||||
{
|
||||
ewin = FindItem("", 0, LIST_FINDBY_NONE, LIST_TYPE_EWIN);
|
||||
if (conf.focus.mode == FOCUS_CLICK)
|
||||
if (conf.focus.mode == MODE_FOCUS_CLICK)
|
||||
{
|
||||
if ((mode.focuswin) && (ewin))
|
||||
{
|
||||
|
@ -289,7 +221,7 @@ FocusToEWin(EWin * ewin)
|
|||
/* losing the focus may cause the titlebar to be resized */
|
||||
CalcEwinSizes(mode.focuswin);
|
||||
DrawEwin(mode.focuswin);
|
||||
if ((conf.focus.clickraises) || (conf.focus.mode == FOCUS_CLICK))
|
||||
if ((conf.focus.clickraises) || (conf.focus.mode == MODE_FOCUS_CLICK))
|
||||
XGrabButton(disp, AnyButton, AnyModifier,
|
||||
mode.focuswin->win_container, False, ButtonPressMask,
|
||||
GrabModeSync, GrabModeAsync, None, None);
|
||||
|
@ -312,7 +244,7 @@ FocusToEWin(EWin * ewin)
|
|||
mode.focuswin->active = 1;
|
||||
}
|
||||
/* gaining the focus may cause the titlebar to be resized */
|
||||
if ((conf.focus.mode == FOCUS_CLICK) && (mode.focuswin))
|
||||
if ((conf.focus.mode == MODE_FOCUS_CLICK) && (mode.focuswin))
|
||||
{
|
||||
XUngrabButton(disp, AnyButton, AnyModifier,
|
||||
mode.focuswin->win_container);
|
||||
|
@ -327,10 +259,10 @@ FocusToEWin(EWin * ewin)
|
|||
}
|
||||
/* ReZoom(mode.focuswin); */
|
||||
if ((conf.autoraise) && (mode.focuswin) && (!mode.focuswin->menu)
|
||||
&& (conf.focus.mode != FOCUS_CLICK))
|
||||
&& (conf.focus.mode != MODE_FOCUS_CLICK))
|
||||
DoIn("AUTORAISE_TIMEOUT", conf.autoraisetime, AutoraiseTimeout,
|
||||
mode.focuswin->client.win, NULL);
|
||||
if (conf.focus.mode == FOCUS_CLICK)
|
||||
if (conf.focus.mode == MODE_FOCUS_CLICK)
|
||||
{
|
||||
if (ewin)
|
||||
{
|
||||
|
@ -360,7 +292,7 @@ FocusToEWin(EWin * ewin)
|
|||
}
|
||||
|
||||
void
|
||||
BeginNewDeskFocus(void)
|
||||
FocusNewDeskBegin(void)
|
||||
{
|
||||
EWin *ewin, **lst;
|
||||
int i, j, num;
|
||||
|
@ -422,12 +354,12 @@ BeginNewDeskFocus(void)
|
|||
}
|
||||
|
||||
void
|
||||
NewDeskFocus(void)
|
||||
FocusNewDesk(void)
|
||||
{
|
||||
EWin *ewin, **lst;
|
||||
int i, j, num;
|
||||
|
||||
EDBUG(4, "NewDeskFocus");
|
||||
EDBUG(4, "FocusNewDesk");
|
||||
|
||||
if (--new_desk_focus_nesting)
|
||||
return;
|
||||
|
@ -491,13 +423,11 @@ NewDeskFocus(void)
|
|||
SubstructureRedirectMask | KeyPressMask | KeyReleaseMask |
|
||||
PointerMotionMask);
|
||||
|
||||
if ((conf.focus.mode == FOCUS_POINTER) || (conf.focus.mode == FOCUS_SLOPPY))
|
||||
if ((conf.focus.mode == MODE_FOCUS_POINTER) ||
|
||||
(conf.focus.mode == MODE_FOCUS_SLOPPY))
|
||||
{
|
||||
ewin = GetEwinPointerInClient();
|
||||
if (ewin)
|
||||
ICCCM_Focus(ewin);
|
||||
else
|
||||
ICCCM_Focus(NULL);
|
||||
ICCCM_Focus(ewin);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -510,11 +440,9 @@ NewDeskFocus(void)
|
|||
for (i = 0; i < num; i++)
|
||||
{
|
||||
ewin = lst[i];
|
||||
if ((ewin->sticky)
|
||||
||
|
||||
((((ewin->area_x
|
||||
== ax) && (ewin->area_y == ay)) || (ewin->fixedpos))
|
||||
&& (ewin->desktop == desks.current)))
|
||||
if ((ewin->sticky) ||
|
||||
((((ewin->area_x == ax) && (ewin->area_y == ay)) ||
|
||||
(ewin->fixedpos)) && (ewin->desktop == desks.current)))
|
||||
{
|
||||
ICCCM_Focus(ewin);
|
||||
break;
|
||||
|
@ -545,7 +473,7 @@ FocusToNone(void)
|
|||
/* losing the focus may cause the titlebar to be resized */
|
||||
CalcEwinSizes(mode.focuswin);
|
||||
DrawEwin(mode.focuswin);
|
||||
if (conf.focus.mode == FOCUS_CLICK)
|
||||
if (conf.focus.mode == MODE_FOCUS_CLICK)
|
||||
XGrabButton(disp, AnyButton, AnyModifier,
|
||||
mode.focuswin->win_container, False, ButtonPressMask,
|
||||
GrabModeSync, GrabModeAsync, None, None);
|
||||
|
|
|
@ -218,6 +218,7 @@ IconboxIconifyEwin(Iconbox * ib, EWin * ewin)
|
|||
{
|
||||
was_shaded = ewin->shaded;
|
||||
SoundPlay("SOUND_ICONIFY");
|
||||
|
||||
if (ib)
|
||||
{
|
||||
if (ib->animate)
|
||||
|
@ -235,7 +236,7 @@ IconboxIconifyEwin(Iconbox * ib, EWin * ewin)
|
|||
|
||||
prev_warp = conf.warplist.enable;
|
||||
conf.warplist.enable = 0;
|
||||
GetPrevFocusEwin();
|
||||
FocusGetPrevEwin();
|
||||
conf.warplist.enable = prev_warp;
|
||||
}
|
||||
if (ewin->has_transients)
|
||||
|
@ -253,7 +254,7 @@ IconboxIconifyEwin(Iconbox * ib, EWin * ewin)
|
|||
HideEwin(lst[i]);
|
||||
lst[i]->iconified = 4;
|
||||
if (lst[i] == mode.focuswin)
|
||||
FocusToEWin(NULL);
|
||||
FocusToEWin(NULL, FOCUS_EWIN_GONE);
|
||||
}
|
||||
}
|
||||
HintsSetClientList();
|
||||
|
@ -320,7 +321,7 @@ DeIconifyEwin(EWin * ewin)
|
|||
RaiseEwin(ewin);
|
||||
ShowEwin(ewin);
|
||||
ICCCM_DeIconify(ewin);
|
||||
FocusToEWin(ewin);
|
||||
FocusToEWin(ewin, FOCUS_EWIN_NEW);
|
||||
if (ewin->has_transients)
|
||||
{
|
||||
EWin **lst, *e;
|
||||
|
|
33
src/ipc.c
33
src/ipc.c
|
@ -2233,21 +2233,20 @@ IPC_DialogOK(char *params, Client * c)
|
|||
static void
|
||||
IPC_SetFocus(char *params, Client * c)
|
||||
{
|
||||
EWin *ewin;
|
||||
char buf[FILEPATH_LEN_MAX];
|
||||
|
||||
buf[0] = 0;
|
||||
|
||||
if (params)
|
||||
{
|
||||
EWin *my_focused_win;
|
||||
|
||||
if (!strcmp(params, "?"))
|
||||
{
|
||||
my_focused_win = GetFocusEwin();
|
||||
if (my_focused_win)
|
||||
ewin = GetFocusEwin();
|
||||
if (ewin)
|
||||
{
|
||||
Esnprintf(buf, sizeof(buf), "focused: %8x",
|
||||
(unsigned)my_focused_win->client.win);
|
||||
Esnprintf(buf, sizeof(buf), "focused: %#lx",
|
||||
ewin->client.win);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2259,9 +2258,9 @@ IPC_SetFocus(char *params, Client * c)
|
|||
unsigned int win;
|
||||
|
||||
sscanf(params, "%x", &win);
|
||||
my_focused_win = FindEwinByChildren(win);
|
||||
if (my_focused_win)
|
||||
FocusToEWin(my_focused_win);
|
||||
ewin = FindEwinByChildren(win);
|
||||
if (ewin)
|
||||
FocusToEWin(ewin, FOCUS_SET);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -4050,7 +4049,7 @@ IPC_WinOps(char *params, Client * c)
|
|||
}
|
||||
else
|
||||
{
|
||||
FocusToEWin(ewin);
|
||||
FocusToEWin(ewin, FOCUS_SET);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -4133,26 +4132,26 @@ IPC_FocusMode(char *params, Client * c)
|
|||
{
|
||||
if (!strcmp(params, "click"))
|
||||
{
|
||||
conf.focus.mode = 2;
|
||||
conf.focus.mode = MODE_FOCUS_CLICK;
|
||||
mode.click_focus_grabbed = 1;
|
||||
}
|
||||
else if (!strcmp(params, "pointer"))
|
||||
{
|
||||
conf.focus.mode = 0;
|
||||
conf.focus.mode = MODE_FOCUS_POINTER;
|
||||
}
|
||||
else if (!strcmp(params, "sloppy"))
|
||||
{
|
||||
conf.focus.mode = 1;
|
||||
conf.focus.mode = MODE_FOCUS_SLOPPY;
|
||||
}
|
||||
else if (!strcmp(params, "clicknograb"))
|
||||
{
|
||||
conf.focus.mode = 2;
|
||||
conf.focus.mode = MODE_FOCUS_CLICK;
|
||||
mode.click_focus_grabbed = 0;
|
||||
}
|
||||
else if (!strcmp(params, "?"))
|
||||
{
|
||||
Esnprintf(buf, sizeof(buf), "Focus Mode: ");
|
||||
if (conf.focus.mode == 2)
|
||||
if (conf.focus.mode == MODE_FOCUS_CLICK)
|
||||
{
|
||||
if (mode.click_focus_grabbed)
|
||||
{
|
||||
|
@ -4163,11 +4162,11 @@ IPC_FocusMode(char *params, Client * c)
|
|||
strcat(buf, "clicknograb");
|
||||
}
|
||||
}
|
||||
else if (conf.focus.mode == 1)
|
||||
else if (conf.focus.mode == MODE_FOCUS_SLOPPY)
|
||||
{
|
||||
strcat(buf, "sloppy");
|
||||
}
|
||||
else if (conf.focus.mode == 0)
|
||||
else if (conf.focus.mode == MODE_FOCUS_POINTER)
|
||||
{
|
||||
strcat(buf, "pointer");
|
||||
}
|
||||
|
|
|
@ -1906,7 +1906,7 @@ PagersEventMouseUp(XEvent * ev)
|
|||
if (ewin)
|
||||
{
|
||||
RaiseEwin(ewin);
|
||||
FocusToEWin(ewin);
|
||||
FocusToEWin(ewin, FOCUS_SET);
|
||||
}
|
||||
}
|
||||
if (p->hi_ewin)
|
||||
|
|
|
@ -377,7 +377,7 @@ CB_ConfigureFocus(int val, void *data)
|
|||
conf.warplist.warpfocused = tmp_warpfocused;
|
||||
#endif /* WITH_TARTY_WARP */
|
||||
conf.focus.clickraises = tmp_clickalways;
|
||||
FixFocus();
|
||||
FocusFix();
|
||||
}
|
||||
autosave();
|
||||
data = NULL;
|
||||
|
|
|
@ -298,12 +298,14 @@ SetupX()
|
|||
root.w = DisplayWidth(disp, root.scr);
|
||||
root.h = DisplayHeight(disp, root.scr);
|
||||
root.focuswin = ECreateFocusWindow(root.win, -100, -100, 5, 5);
|
||||
|
||||
/* just in case - set them up again */
|
||||
/* set up an error handler for then E would normally have fatal X errors */
|
||||
XSetErrorHandler((XErrorHandler) EHandleXError);
|
||||
/* set up a handler for when the X Connection goes down */
|
||||
XSetIOErrorHandler((XIOErrorHandler) HandleXIOError);
|
||||
/* slect all the root window events to start managing */
|
||||
|
||||
/* select all the root window events to start managing */
|
||||
mode.xselect = 1;
|
||||
XSelectInput(disp, root.win,
|
||||
ButtonPressMask | ButtonReleaseMask | EnterWindowMask |
|
||||
|
@ -397,7 +399,7 @@ SetupX()
|
|||
conf.dock.dirmode = DOCK_DOWN;
|
||||
conf.dock.startx = 0;
|
||||
conf.dock.starty = 0;
|
||||
conf.focus.mode = FOCUS_SLOPPY;
|
||||
conf.focus.mode = MODE_FOCUS_SLOPPY;
|
||||
conf.focus.clickraises = 0;
|
||||
conf.focus.transientsfollowleader = 1;
|
||||
conf.focus.switchfortransientmap = 1;
|
||||
|
|
|
@ -136,10 +136,10 @@ WarpFocus(int delta)
|
|||
if (conf.focus.warp_on_next_focus && !ewin->iconified)
|
||||
XWarpPointer(disp, None, ewin->win, 0, 0, 0, 0, ewin->w / 2,
|
||||
ewin->h / 2);
|
||||
/* if (conf.focus.mode == FOCUS_CLICK) */
|
||||
/* if (conf.focus.mode == MODE_FOCUS_CLICK) */
|
||||
/* FocusToEWin(ewin); */
|
||||
if (conf.warplist.warpfocused && !ewin->iconified)
|
||||
FocusToEWin(ewin);
|
||||
FocusToEWin(ewin, FOCUS_WARP);
|
||||
}
|
||||
WarpFocusShowTitle(ewin);
|
||||
Efree(lst);
|
||||
|
@ -168,7 +168,7 @@ WarpFocusFinish(void)
|
|||
{
|
||||
if (conf.warplist.warpiconified && ewin->iconified)
|
||||
DeIconifyEwin(ewin);
|
||||
FocusToEWin(ewin);
|
||||
FocusToEWin(ewin, FOCUS_SET);
|
||||
if (conf.focus.warp_after_next_focus
|
||||
|| conf.focus.warp_on_next_focus)
|
||||
{
|
||||
|
|
|
@ -249,7 +249,7 @@ Zoom(EWin * ewin)
|
|||
MoveEwin(ewin, -ewin->border->border.left + x1,
|
||||
-ewin->border->border.top + y1);
|
||||
ICCCM_Configure(ewin);
|
||||
FocusToEWin(ewin);
|
||||
FocusToEWin(ewin, FOCUS_SET);
|
||||
XWarpPointer(disp, None, ewin->client.win, 0, 0, 0, 0,
|
||||
ewin->client.w / 2, ewin->client.h / 2);
|
||||
#if 0
|
||||
|
|
Loading…
Reference in New Issue