1999-10-04 15:06:00 -07:00
|
|
|
/*
|
2005-03-19 08:40:18 -08:00
|
|
|
* Copyright (C) 2000-2005 Carsten Haitzler, Geoff Harrison and various contributors
|
|
|
|
* Copyright (C) 2004-2005 Kim Woelders
|
2000-04-05 16:22:56 -07:00
|
|
|
*
|
1999-10-04 15:06:00 -07:00
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
* of this software and associated documentation files (the "Software"), to
|
|
|
|
* deal in the Software without restriction, including without limitation the
|
|
|
|
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
|
|
* sell copies of the Software, and to permit persons to whom the Software is
|
|
|
|
* furnished to do so, subject to the following conditions:
|
2000-04-05 16:22:56 -07:00
|
|
|
*
|
1999-10-04 15:06:00 -07:00
|
|
|
* The above copyright notice and this permission notice shall be included in
|
|
|
|
* all copies of the Software, its documentation and marketing & publicity
|
|
|
|
* materials, and acknowledgment shall be given in the documentation, materials
|
|
|
|
* and software packages that this Software was used.
|
2000-04-05 16:22:56 -07:00
|
|
|
*
|
1999-10-04 15:06:00 -07:00
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
* THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
|
|
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
|
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
*/
|
1999-08-17 15:56:46 -07:00
|
|
|
/*
|
|
|
|
* Author: Merlin Hughes
|
|
|
|
* - merlin@merlin.org
|
|
|
|
*
|
|
|
|
* This code is free software.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
*/
|
|
|
|
#include "E.h"
|
2005-05-25 14:42:59 -07:00
|
|
|
#include "icons.h"
|
2004-12-28 15:46:49 -08:00
|
|
|
#include <X11/keysym.h>
|
1999-08-17 15:56:46 -07:00
|
|
|
|
2004-04-18 12:26:32 -07:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
EWin *ewin;
|
|
|
|
Window win;
|
|
|
|
char *txt;
|
|
|
|
} WarplistItem;
|
|
|
|
|
2004-12-28 15:46:49 -08:00
|
|
|
static void WarpFocusHandleEvent(XEvent * ev, void *prm);
|
1999-08-17 15:56:46 -07:00
|
|
|
|
2005-04-17 06:58:09 -07:00
|
|
|
static EObj *warpFocusWindow = NULL;
|
|
|
|
|
1999-08-17 15:56:46 -07:00
|
|
|
static int warpFocusIndex = 0;
|
2004-03-18 16:27:16 -08:00
|
|
|
static unsigned int warpFocusKey = 0;
|
2004-04-18 12:26:32 -07:00
|
|
|
static int warplist_num = 0;
|
|
|
|
static WarplistItem *warplist;
|
1999-08-17 15:56:46 -07:00
|
|
|
|
2005-02-09 11:29:16 -08:00
|
|
|
#define ICON_PAD 2
|
|
|
|
|
2003-08-10 08:44:47 -07:00
|
|
|
static void
|
2005-04-17 06:58:09 -07:00
|
|
|
WarpFocusShow(EWin * ewin)
|
1999-08-17 15:56:46 -07:00
|
|
|
{
|
|
|
|
TextClass *tc;
|
|
|
|
ImageClass *ic;
|
2005-06-30 05:03:38 -07:00
|
|
|
int i, x, y, w, h, ww, hh;
|
2005-02-09 11:29:16 -08:00
|
|
|
static int mw, mh, tw, th;
|
2004-04-18 12:26:32 -07:00
|
|
|
char s[1024];
|
2005-06-30 05:03:38 -07:00
|
|
|
const char *fmt;
|
2005-05-25 14:42:59 -07:00
|
|
|
WarplistItem *wl;
|
1999-08-17 15:56:46 -07:00
|
|
|
|
2005-06-30 05:03:38 -07:00
|
|
|
if (!warplist)
|
|
|
|
return;
|
|
|
|
|
2004-12-28 15:46:49 -08:00
|
|
|
tc = TextclassFind("WARPFOCUS", 0);
|
1999-08-17 15:56:46 -07:00
|
|
|
if (!tc)
|
2004-12-28 15:46:49 -08:00
|
|
|
tc = TextclassFind("COORDS", 1);
|
|
|
|
|
|
|
|
ic = ImageclassFind("WARPFOCUS", 0);
|
1999-08-17 15:56:46 -07:00
|
|
|
if (!ic)
|
2004-12-28 15:46:49 -08:00
|
|
|
ic = ImageclassFind("COORDS", 1);
|
|
|
|
|
1999-08-17 15:56:46 -07:00
|
|
|
if ((!ic) || (!tc))
|
|
|
|
return;
|
2003-08-10 08:44:47 -07:00
|
|
|
|
2005-04-17 06:58:09 -07:00
|
|
|
if (!warpFocusWindow)
|
2004-12-28 15:46:49 -08:00
|
|
|
{
|
2005-04-17 06:58:09 -07:00
|
|
|
EObj *eo;
|
|
|
|
|
|
|
|
eo = EobjWindowCreate(EOBJ_TYPE_MISC, 0, 0, 1, 1, 1, "Warp");
|
|
|
|
if (!eo)
|
|
|
|
return;
|
|
|
|
|
|
|
|
warpFocusWindow = eo;
|
|
|
|
|
|
|
|
EventCallbackRegister(eo->win, 0, WarpFocusHandleEvent, NULL);
|
2005-06-30 05:03:38 -07:00
|
|
|
ESelectInput(eo->win, ButtonReleaseMask);
|
2005-04-17 06:58:09 -07:00
|
|
|
|
2005-02-10 02:35:16 -08:00
|
|
|
TooltipsEnable(0);
|
2004-12-28 15:46:49 -08:00
|
|
|
}
|
1999-08-17 15:56:46 -07:00
|
|
|
|
2005-04-17 06:58:09 -07:00
|
|
|
if (!warpFocusWindow->shown)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
w = 0;
|
|
|
|
h = 0;
|
2005-06-30 05:03:38 -07:00
|
|
|
for (i = 0; i < warplist_num; i++)
|
2003-05-22 12:15:03 -07:00
|
|
|
{
|
2005-06-30 05:03:38 -07:00
|
|
|
wl = warplist + i;
|
|
|
|
wl->win = ECreateWindow(warpFocusWindow->win, 0, 0, 1, 1, 0);
|
|
|
|
EMapWindow(wl->win);
|
|
|
|
if (wl->ewin->iconified)
|
|
|
|
fmt = "[%s]";
|
|
|
|
else if (wl->ewin->shaded)
|
|
|
|
fmt = "=%s=";
|
|
|
|
else
|
|
|
|
fmt = "%s";
|
|
|
|
Esnprintf(s, sizeof(s), fmt, EwinGetName(wl->ewin));
|
|
|
|
wl->txt = strdup(s);
|
|
|
|
TextSize(tc, 0, 0, 0, wl->txt, &ww, &hh, 17);
|
|
|
|
if (ww > w)
|
|
|
|
w = ww;
|
|
|
|
if (hh > h)
|
|
|
|
h = hh;
|
2003-05-22 12:15:03 -07:00
|
|
|
}
|
2005-02-09 11:29:16 -08:00
|
|
|
|
|
|
|
tw = w; /* Text size */
|
|
|
|
th = h;
|
|
|
|
w += (ic->padding.left + ic->padding.right);
|
2003-05-22 12:15:03 -07:00
|
|
|
h += (ic->padding.top + ic->padding.bottom);
|
2005-02-09 11:29:16 -08:00
|
|
|
if (Conf.warplist.icon_mode != 0)
|
|
|
|
w += h;
|
|
|
|
mw = w; /* Focus list item size */
|
|
|
|
mh = h;
|
|
|
|
|
2004-07-02 17:58:19 -07:00
|
|
|
GetPointerScreenAvailableArea(&x, &y, &ww, &hh);
|
2003-05-22 12:15:03 -07:00
|
|
|
x += (ww - w) / 2;
|
2004-04-18 12:26:32 -07:00
|
|
|
y += (hh - h * warplist_num) / 2;
|
2005-04-17 06:58:09 -07:00
|
|
|
EobjMoveResize(warpFocusWindow, x, y, w, h * warplist_num);
|
2005-02-09 11:29:16 -08:00
|
|
|
|
2004-04-18 12:26:32 -07:00
|
|
|
for (i = 0; i < warplist_num; i++)
|
2003-05-22 12:15:03 -07:00
|
|
|
{
|
2005-02-02 09:12:07 -08:00
|
|
|
EMoveResizeWindow(warplist[i].win, 0, (h * i), mw, mh);
|
2003-05-22 12:15:03 -07:00
|
|
|
}
|
2005-02-09 11:29:16 -08:00
|
|
|
|
2005-04-23 00:31:18 -07:00
|
|
|
EobjMap(warpFocusWindow, 0);
|
2003-08-10 08:44:47 -07:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Grab the keyboard. The grab is automatically released when
|
2005-04-17 06:58:09 -07:00
|
|
|
* WarpFocusHide unmaps warpFocusWindow.
|
2003-08-10 08:44:47 -07:00
|
|
|
*/
|
2005-06-30 05:37:43 -07:00
|
|
|
GrabKeyboardSet(warpFocusWindow->win);
|
|
|
|
GrabPointerSet(warpFocusWindow->win, None, 0);
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
2003-08-10 08:44:47 -07:00
|
|
|
|
2004-04-18 12:26:32 -07:00
|
|
|
for (i = 0; i < warplist_num; i++)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2005-05-25 14:42:59 -07:00
|
|
|
wl = warplist + i;
|
|
|
|
|
2005-06-30 05:50:47 -07:00
|
|
|
if (!EwinFindByPtr(wl->ewin))
|
2005-05-25 14:42:59 -07:00
|
|
|
wl->ewin = NULL;
|
|
|
|
if (wl->ewin)
|
2003-05-22 12:15:03 -07:00
|
|
|
{
|
2004-04-18 12:26:32 -07:00
|
|
|
int state;
|
|
|
|
|
2005-05-25 14:42:59 -07:00
|
|
|
state = (ewin == wl->ewin) ? STATE_CLICKED : STATE_NORMAL;
|
2004-02-28 17:30:18 -08:00
|
|
|
|
2005-05-25 14:42:59 -07:00
|
|
|
ImageclassApply(ic, wl->win, mw, mh, 0, 0, state, 0, ST_WARPLIST);
|
2005-02-09 05:45:30 -08:00
|
|
|
|
|
|
|
/* New icon stuff */
|
|
|
|
if (Conf.warplist.icon_mode != 0)
|
|
|
|
{
|
2005-02-09 11:29:16 -08:00
|
|
|
int icon_size = mh - 2 * ICON_PAD;
|
2005-05-25 14:42:59 -07:00
|
|
|
Imlib_Image *im;
|
2005-02-09 11:29:16 -08:00
|
|
|
|
2005-05-25 14:42:59 -07:00
|
|
|
TextDraw(tc, wl->win, 0, 0, state, wl->txt,
|
2005-02-09 11:29:16 -08:00
|
|
|
ic->padding.left + mh, ic->padding.top,
|
|
|
|
tw, th, 0, 0);
|
2005-02-09 05:45:30 -08:00
|
|
|
|
2005-05-25 14:42:59 -07:00
|
|
|
im = EwinIconImageGet(wl->ewin, icon_size,
|
2005-06-30 04:52:03 -07:00
|
|
|
Conf.warplist.icon_mode);
|
2005-05-25 14:42:59 -07:00
|
|
|
if (!im)
|
2005-02-09 11:29:16 -08:00
|
|
|
continue;
|
2005-02-09 05:45:30 -08:00
|
|
|
|
2005-05-25 14:42:59 -07:00
|
|
|
imlib_context_set_image(im);
|
|
|
|
imlib_context_set_drawable(wl->win);
|
2005-02-09 05:45:30 -08:00
|
|
|
imlib_context_set_blend(1);
|
2005-02-09 11:29:16 -08:00
|
|
|
imlib_render_image_on_drawable_at_size(ic->padding.left +
|
|
|
|
ICON_PAD, ICON_PAD,
|
|
|
|
icon_size, icon_size);
|
2005-06-30 04:52:03 -07:00
|
|
|
imlib_free_image();
|
2005-02-09 05:45:30 -08:00
|
|
|
imlib_context_set_blend(0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2005-05-25 14:42:59 -07:00
|
|
|
TextclassApply(ic, wl->win, mw, mh, 0, 0, state, 0,
|
|
|
|
tc, wl->txt);
|
2005-02-09 05:45:30 -08:00
|
|
|
}
|
2003-05-22 12:15:03 -07:00
|
|
|
}
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
2003-08-10 08:44:47 -07:00
|
|
|
|
2005-05-21 13:58:18 -07:00
|
|
|
EShapePropagate(warpFocusWindow->win);
|
2005-05-07 04:20:02 -07:00
|
|
|
EFlush();
|
1999-08-17 15:56:46 -07:00
|
|
|
}
|
|
|
|
|
2003-08-10 08:44:47 -07:00
|
|
|
static void
|
2005-04-17 06:58:09 -07:00
|
|
|
WarpFocusHide(void)
|
1999-08-17 15:56:46 -07:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
2005-04-17 06:58:09 -07:00
|
|
|
if (warpFocusWindow && warpFocusWindow->shown)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2005-04-17 06:58:09 -07:00
|
|
|
EobjUnmap(warpFocusWindow);
|
2004-04-18 12:26:32 -07:00
|
|
|
for (i = 0; i < warplist_num; i++)
|
|
|
|
{
|
2005-02-02 09:12:07 -08:00
|
|
|
EDestroyWindow(warplist[i].win);
|
2004-04-18 12:26:32 -07:00
|
|
|
Efree(warplist[i].txt);
|
|
|
|
}
|
2005-04-17 06:58:09 -07:00
|
|
|
#if 0 /* We might as well keep it around */
|
|
|
|
EventCallbackUnregister(warpFocusWindow->win, 0, WarpFocusHandleEvent,
|
2005-02-10 02:35:16 -08:00
|
|
|
NULL);
|
2005-04-21 09:41:57 -07:00
|
|
|
EobjWindowDestroy(warpFocusWindow);
|
2005-04-17 06:58:09 -07:00
|
|
|
warpFocusWindow = None;
|
|
|
|
#endif
|
|
|
|
|
2005-02-10 02:35:16 -08:00
|
|
|
TooltipsEnable(1);
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
2003-08-10 08:44:47 -07:00
|
|
|
|
2004-04-18 12:26:32 -07:00
|
|
|
if (warplist)
|
|
|
|
Efree(warplist);
|
|
|
|
warplist = NULL;
|
|
|
|
warplist_num = 0;
|
1999-08-17 15:56:46 -07:00
|
|
|
}
|
2004-12-28 15:46:49 -08:00
|
|
|
|
|
|
|
void
|
|
|
|
WarpFocus(int delta)
|
|
|
|
{
|
2005-06-30 05:03:38 -07:00
|
|
|
EWin *const *lst;
|
|
|
|
EWin *ewin;
|
|
|
|
int i, num;
|
|
|
|
WarplistItem *wl;
|
2004-12-28 15:46:49 -08:00
|
|
|
|
|
|
|
/* Remember invoking keycode (ugly hack) */
|
2005-04-17 06:58:09 -07:00
|
|
|
if (!warpFocusWindow || !warpFocusWindow->shown)
|
2004-12-28 15:46:49 -08:00
|
|
|
warpFocusKey = Mode.last_keycode;
|
|
|
|
|
2005-06-30 05:03:38 -07:00
|
|
|
if (!warplist)
|
2004-12-28 15:46:49 -08:00
|
|
|
{
|
2005-06-30 05:03:38 -07:00
|
|
|
lst = EwinListFocusGet(&num);
|
|
|
|
for (i = 0; i < num; i++)
|
2004-12-28 15:46:49 -08:00
|
|
|
{
|
2005-06-30 05:03:38 -07:00
|
|
|
ewin = lst[i];
|
2004-12-28 15:46:49 -08:00
|
|
|
if ( /* Either visible or iconified */
|
|
|
|
((EwinIsOnScreen(ewin)) || (ewin->iconified)) &&
|
|
|
|
/* Exclude windows that explicitely say so */
|
|
|
|
(!ewin->skipfocus) &&
|
|
|
|
/* Keep shaded windows if conf say so */
|
|
|
|
((!ewin->shaded) || (Conf.warplist.showshaded)) &&
|
|
|
|
/* Keep sticky windows if conf say so */
|
|
|
|
((!EoIsSticky(ewin)) || (Conf.warplist.showsticky)) &&
|
|
|
|
/* Keep iconified windows if conf say so */
|
|
|
|
((!ewin->iconified) || (Conf.warplist.showiconified)))
|
2005-06-30 05:03:38 -07:00
|
|
|
{
|
|
|
|
warplist_num++;
|
|
|
|
warplist = Erealloc(warplist,
|
|
|
|
warplist_num * sizeof(WarplistItem));
|
|
|
|
wl = warplist + warplist_num - 1;
|
|
|
|
wl->ewin = ewin;
|
|
|
|
}
|
2004-12-28 15:46:49 -08:00
|
|
|
}
|
|
|
|
|
2005-06-30 05:03:38 -07:00
|
|
|
/* Hmmm. Hack... */
|
|
|
|
if (warplist_num >= 2 && warplist[1].ewin == GetFocusEwin())
|
2004-12-28 15:46:49 -08:00
|
|
|
{
|
2005-06-30 05:03:38 -07:00
|
|
|
warplist[1].ewin = warplist[0].ewin;
|
|
|
|
warplist[0].ewin = GetFocusEwin();
|
2004-12-28 15:46:49 -08:00
|
|
|
}
|
2005-06-30 05:03:38 -07:00
|
|
|
|
|
|
|
warpFocusIndex = 0;
|
2004-12-28 15:46:49 -08:00
|
|
|
}
|
2005-06-30 05:03:38 -07:00
|
|
|
|
|
|
|
if (!warplist)
|
|
|
|
return;
|
|
|
|
|
|
|
|
warpFocusIndex = (warpFocusIndex + warplist_num + delta) % warplist_num;
|
|
|
|
ewin = warplist[warpFocusIndex].ewin;
|
2005-06-30 05:50:47 -07:00
|
|
|
if (!EwinFindByPtr(ewin))
|
2005-06-30 05:03:38 -07:00
|
|
|
ewin = NULL;
|
|
|
|
if (!ewin)
|
|
|
|
return;
|
|
|
|
|
|
|
|
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, EoGetWin(ewin), 0, 0, 0, 0,
|
|
|
|
EoGetW(ewin) / 2, EoGetH(ewin) / 2);
|
|
|
|
if (Conf.warplist.warpfocused)
|
|
|
|
FocusToEWin(ewin, FOCUS_SET);
|
|
|
|
WarpFocusShow(ewin);
|
2004-12-28 15:46:49 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2005-06-30 05:03:38 -07:00
|
|
|
WarpFocusClick(int ix)
|
2004-12-28 15:46:49 -08:00
|
|
|
{
|
2005-06-30 05:03:38 -07:00
|
|
|
EWin *ewin;
|
|
|
|
|
|
|
|
if (!warplist)
|
|
|
|
return;
|
2004-12-28 15:46:49 -08:00
|
|
|
|
2005-06-30 05:03:38 -07:00
|
|
|
ewin = warplist[ix].ewin;
|
2005-06-30 05:50:47 -07:00
|
|
|
if (!EwinFindByPtr(ewin))
|
2005-01-25 13:58:28 -08:00
|
|
|
return;
|
2004-12-28 15:46:49 -08:00
|
|
|
|
2005-06-30 05:03:38 -07:00
|
|
|
RaiseEwin(ewin);
|
|
|
|
if (ewin->iconified)
|
|
|
|
EwinDeIconify(ewin);
|
|
|
|
FocusToEWin(ewin, FOCUS_SET);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
WarpFocusFinish(void)
|
|
|
|
{
|
|
|
|
EWin *ewin;
|
|
|
|
|
|
|
|
ewin = warplist[warpFocusIndex].ewin;
|
2004-12-28 15:46:49 -08:00
|
|
|
|
2005-04-17 06:58:09 -07:00
|
|
|
WarpFocusHide();
|
2005-06-30 05:03:38 -07:00
|
|
|
|
2004-12-28 15:46:49 -08:00
|
|
|
if (!FindItem((char *)ewin, 0, LIST_FINDBY_POINTER, LIST_TYPE_EWIN))
|
2005-06-30 05:03:38 -07:00
|
|
|
return;
|
2004-12-28 15:46:49 -08:00
|
|
|
|
2005-06-30 05:03:38 -07:00
|
|
|
if (ewin->iconified)
|
|
|
|
EwinDeIconify(ewin);
|
|
|
|
if (ewin->shaded)
|
|
|
|
EwinUnShade(ewin);
|
|
|
|
if (Conf.warplist.raise_on_select)
|
|
|
|
RaiseEwin(ewin);
|
|
|
|
if (Conf.warplist.warp_on_select)
|
|
|
|
if (ewin != Mode.mouse_over_ewin)
|
|
|
|
XWarpPointer(disp, None, EoGetWin(ewin), 0, 0, 0, 0,
|
|
|
|
EoGetW(ewin) / 2, EoGetH(ewin) / 2);
|
|
|
|
FocusToEWin(ewin, FOCUS_SET);
|
2004-12-28 15:46:49 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
WarpFocusHandleEvent(XEvent * ev, void *prm __UNUSED__)
|
|
|
|
{
|
|
|
|
switch (ev->type)
|
|
|
|
{
|
|
|
|
#if 0 /* Not necessary when sampling keycode in events.c */
|
|
|
|
case KeyPress:
|
2005-04-17 06:58:09 -07:00
|
|
|
if (warpFocusWindow->shown && ev->xany.window == VRoot.win)
|
2004-12-28 15:46:49 -08:00
|
|
|
warpFocusKey = ev->xkey.keycode;
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
case KeyRelease:
|
2005-04-17 06:58:09 -07:00
|
|
|
if (warpFocusWindow->shown && ev->xkey.keycode != warpFocusKey)
|
2004-12-28 15:46:49 -08:00
|
|
|
WarpFocusFinish();
|
|
|
|
break;
|
2005-06-30 05:03:38 -07:00
|
|
|
|
|
|
|
case ButtonRelease:
|
|
|
|
WarpFocusClick((ev->xbutton.y * warplist_num) / warpFocusWindow->h);
|
|
|
|
break;
|
2004-12-28 15:46:49 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
WarplistInit(void)
|
|
|
|
{
|
|
|
|
#if 0 /* Not necessary when sampling keycode in events.c */
|
|
|
|
/* Ugly hack to get the invoking key press */
|
|
|
|
EventCallbackRegister(VRoot.win, 0, WarpFocusHandleEvent, NULL);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Warplist module
|
|
|
|
*/
|
|
|
|
|
2005-04-23 06:30:03 -07:00
|
|
|
static void
|
|
|
|
WarplistCfgValidate(void)
|
|
|
|
{
|
|
|
|
if (Conf.warplist.icon_mode < 0 || Conf.warplist.icon_mode > 3)
|
|
|
|
Conf.warplist.icon_mode = 3;
|
|
|
|
}
|
|
|
|
|
2004-12-28 15:46:49 -08:00
|
|
|
static void
|
|
|
|
WarplistSighan(int sig, void *prm __UNUSED__)
|
|
|
|
{
|
|
|
|
switch (sig)
|
|
|
|
{
|
|
|
|
case ESIGNAL_INIT:
|
|
|
|
WarplistInit();
|
2005-04-23 06:30:03 -07:00
|
|
|
WarplistCfgValidate();
|
2004-12-28 15:46:49 -08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static const CfgItem WarplistCfgItems[] = {
|
2005-02-09 05:45:30 -08:00
|
|
|
CFG_ITEM_INT(Conf.warplist, icon_mode, 3),
|
2004-12-28 15:46:49 -08:00
|
|
|
CFG_ITEM_BOOL(Conf.warplist, enable, 1),
|
|
|
|
CFG_ITEM_BOOL(Conf.warplist, showsticky, 1),
|
|
|
|
CFG_ITEM_BOOL(Conf.warplist, showshaded, 1),
|
|
|
|
CFG_ITEM_BOOL(Conf.warplist, showiconified, 0),
|
|
|
|
CFG_ITEM_BOOL(Conf.warplist, warpfocused, 1),
|
|
|
|
CFG_ITEM_BOOL(Conf.warplist, raise_on_select, 1),
|
|
|
|
CFG_ITEM_BOOL(Conf.warplist, warp_on_select, 0),
|
|
|
|
};
|
|
|
|
#define N_CFG_ITEMS (sizeof(WarplistCfgItems)/sizeof(CfgItem))
|
|
|
|
|
|
|
|
EModule ModWarplist = {
|
|
|
|
"warplist", "warp",
|
|
|
|
WarplistSighan,
|
|
|
|
{0, NULL},
|
|
|
|
{N_CFG_ITEMS, WarplistCfgItems}
|
|
|
|
};
|