1999-10-04 15:06:00 -07:00
|
|
|
/*
|
2007-01-13 11:14:29 -08:00
|
|
|
* Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
|
2009-12-03 11:29:30 -08:00
|
|
|
* Copyright (C) 2004-2014 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
|
|
|
#include "E.h"
|
2005-12-22 10:43:15 -08:00
|
|
|
#include "borders.h"
|
2005-09-04 00:27:20 -07:00
|
|
|
#include "desktops.h"
|
2005-10-29 01:48:40 -07:00
|
|
|
#include "dialog.h"
|
2005-07-16 09:57:45 -07:00
|
|
|
#include "ewins.h"
|
2006-07-24 14:10:59 -07:00
|
|
|
#include "file.h"
|
2005-11-19 07:47:10 -08:00
|
|
|
#include "groups.h"
|
2007-05-18 01:25:06 -07:00
|
|
|
#include "ipc.h"
|
2013-06-06 13:37:06 -07:00
|
|
|
#include "list.h"
|
2007-01-16 17:10:44 -08:00
|
|
|
#include "settings.h"
|
2005-02-15 14:19:52 -08:00
|
|
|
#include "snaps.h"
|
2006-04-16 06:27:38 -07:00
|
|
|
#include "timers.h"
|
2005-07-16 09:57:45 -07:00
|
|
|
#include "xwin.h"
|
1999-08-17 15:56:46 -07:00
|
|
|
|
2008-03-23 04:54:24 -07:00
|
|
|
struct _snapshot {
|
2013-06-06 13:37:06 -07:00
|
|
|
dlist_t list;
|
2005-01-12 15:10:24 -08:00
|
|
|
char *name;
|
|
|
|
char *win_title;
|
|
|
|
char *win_name;
|
|
|
|
char *win_class;
|
2005-09-23 09:12:13 -07:00
|
|
|
char *win_role;
|
2009-12-03 11:29:30 -08:00
|
|
|
EX_Window win;
|
2005-02-17 14:36:46 -08:00
|
|
|
EWin *used;
|
2005-10-29 18:05:26 -07:00
|
|
|
unsigned int startup_id;
|
2005-02-15 14:19:52 -08:00
|
|
|
char track_changes;
|
2005-09-23 09:12:13 -07:00
|
|
|
unsigned int match_flags;
|
2005-02-15 14:19:52 -08:00
|
|
|
unsigned int use_flags;
|
|
|
|
|
|
|
|
char *border_name;
|
2005-01-12 15:10:24 -08:00
|
|
|
int desktop;
|
|
|
|
int area_x, area_y;
|
|
|
|
int x, y;
|
2005-02-15 14:19:52 -08:00
|
|
|
int w, h;
|
2005-01-12 15:10:24 -08:00
|
|
|
int layer;
|
|
|
|
char sticky;
|
2005-02-15 14:19:52 -08:00
|
|
|
char shaded;
|
2008-02-03 09:03:23 -08:00
|
|
|
unsigned int flags[2];
|
2005-01-12 15:10:24 -08:00
|
|
|
char *cmd;
|
|
|
|
int *groups;
|
|
|
|
int num_groups;
|
|
|
|
char skiptask;
|
|
|
|
char skipfocus;
|
|
|
|
char skipwinlist;
|
|
|
|
#if USE_COMPOSITE
|
|
|
|
int opacity;
|
2006-11-03 15:44:32 -08:00
|
|
|
int focused_opacity;
|
2005-01-12 15:10:24 -08:00
|
|
|
char shadow;
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
2013-06-06 13:37:06 -07:00
|
|
|
static LIST_HEAD(ss_list);
|
2008-05-24 11:13:17 -07:00
|
|
|
static Timer *ss_timer = NULL;
|
2006-02-18 00:30:09 -08:00
|
|
|
|
2005-02-18 10:03:58 -08:00
|
|
|
static Snapshot *
|
2008-10-18 09:00:14 -07:00
|
|
|
_SnapCreate(const char *name)
|
2005-02-18 10:03:58 -08:00
|
|
|
{
|
|
|
|
Snapshot *sn;
|
|
|
|
|
2007-01-16 17:10:44 -08:00
|
|
|
sn = ECALLOC(Snapshot, 1);
|
2006-02-18 00:30:09 -08:00
|
|
|
if (!sn)
|
|
|
|
return NULL;
|
|
|
|
|
2013-06-06 13:37:06 -07:00
|
|
|
LIST_APPEND(Snapshot, &ss_list, sn);
|
2006-02-18 00:30:09 -08:00
|
|
|
|
2005-02-18 10:03:58 -08:00
|
|
|
sn->name = Estrdup(name);
|
|
|
|
|
|
|
|
return sn;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2008-10-18 09:00:14 -07:00
|
|
|
_SnapDestroy(Snapshot * sn)
|
2005-02-18 10:03:58 -08:00
|
|
|
{
|
2013-06-06 13:37:06 -07:00
|
|
|
LIST_REMOVE(Snapshot, &ss_list, sn);
|
2005-02-18 10:03:58 -08:00
|
|
|
|
|
|
|
if (sn->used)
|
|
|
|
sn->used->snap = NULL;
|
|
|
|
|
2008-02-23 04:09:38 -08:00
|
|
|
Efree(sn->name);
|
|
|
|
Efree(sn->win_title);
|
|
|
|
Efree(sn->win_name);
|
|
|
|
Efree(sn->win_class);
|
|
|
|
Efree(sn->win_role);
|
|
|
|
Efree(sn->border_name);
|
|
|
|
Efree(sn->cmd);
|
|
|
|
Efree(sn->groups);
|
|
|
|
|
2005-02-18 10:03:58 -08:00
|
|
|
Efree(sn);
|
|
|
|
}
|
|
|
|
|
2004-11-21 01:30:19 -08:00
|
|
|
/*
|
|
|
|
* Stupid hack to fix apps that set WM_WINDOW_ROLE to
|
|
|
|
* a <name>-<pid>-<something>-<time> like thing.
|
|
|
|
* Is this even ICCCM compliant?
|
|
|
|
*/
|
2005-09-23 09:12:13 -07:00
|
|
|
static char *
|
2008-10-18 09:00:14 -07:00
|
|
|
_ParseRole(const char *role, char *buf, int len)
|
2004-11-21 01:30:19 -08:00
|
|
|
{
|
|
|
|
int l1, l2;
|
|
|
|
|
2005-09-23 09:12:13 -07:00
|
|
|
if (!role)
|
|
|
|
return NULL;
|
|
|
|
|
2004-11-21 01:30:19 -08:00
|
|
|
l1 = strlen(role);
|
|
|
|
if (l1 >= len)
|
|
|
|
l1 = len - 1;
|
2005-09-23 09:12:13 -07:00
|
|
|
|
|
|
|
for (l2 = l1; l2 > 0; l2--)
|
|
|
|
{
|
|
|
|
if (role[l2 - 1] != '-' &&
|
|
|
|
!(role[l2 - 1] >= '0' && role[l2 - 1] <= '9'))
|
|
|
|
break;
|
|
|
|
}
|
2004-11-21 01:30:19 -08:00
|
|
|
if (l1 - l2 > 8)
|
|
|
|
l1 = l2;
|
|
|
|
memcpy(buf, role, l1);
|
|
|
|
buf[l1] = '\0';
|
|
|
|
|
|
|
|
return buf;
|
|
|
|
}
|
|
|
|
|
2005-09-23 09:12:13 -07:00
|
|
|
#define SEQ(s1, s2) ((s1) && (s2) && !strcmp(s1, s2))
|
|
|
|
|
2003-12-09 12:35:14 -08:00
|
|
|
static int
|
2008-10-18 09:00:14 -07:00
|
|
|
_SnapEwinMatch(const Snapshot * sn, const EWin * ewin)
|
2003-12-09 12:35:14 -08:00
|
|
|
{
|
2005-09-23 09:12:13 -07:00
|
|
|
char buf[256], *s;
|
|
|
|
|
|
|
|
/* Don't allow matching anything */
|
|
|
|
if (!sn->match_flags)
|
|
|
|
return 0;
|
|
|
|
|
2005-10-29 12:57:06 -07:00
|
|
|
if (ewin->state.identified)
|
2006-08-07 13:20:16 -07:00
|
|
|
return sn->win == EwinGetClientXwin(ewin);
|
2005-10-29 12:57:06 -07:00
|
|
|
|
2005-10-29 18:05:26 -07:00
|
|
|
if (sn->startup_id && !sn->cmd)
|
|
|
|
return 0;
|
|
|
|
|
2005-09-23 09:12:13 -07:00
|
|
|
if (sn->match_flags & SNAP_MATCH_TITLE
|
2006-11-26 04:42:05 -08:00
|
|
|
&& !SEQ(sn->win_title, EwinGetIcccmName(ewin)))
|
2005-09-23 09:12:13 -07:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
if (sn->match_flags & SNAP_MATCH_NAME
|
2006-11-26 04:42:05 -08:00
|
|
|
&& !SEQ(sn->win_name, EwinGetIcccmCName(ewin)))
|
2005-09-23 09:12:13 -07:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
if (sn->match_flags & SNAP_MATCH_CLASS
|
2006-11-26 04:42:05 -08:00
|
|
|
&& !SEQ(sn->win_class, EwinGetIcccmClass(ewin)))
|
2005-09-23 09:12:13 -07:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
if (sn->match_flags & SNAP_MATCH_ROLE)
|
|
|
|
{
|
2008-10-18 09:00:14 -07:00
|
|
|
s = _ParseRole(ewin->icccm.wm_role, buf, sizeof(buf));
|
2005-09-23 09:12:13 -07:00
|
|
|
if (!SEQ(sn->win_role, s))
|
|
|
|
return 0;
|
|
|
|
}
|
2003-12-09 12:35:14 -08:00
|
|
|
|
2005-09-23 09:12:13 -07:00
|
|
|
/* Match! */
|
|
|
|
return 1;
|
2003-12-09 12:35:14 -08:00
|
|
|
}
|
|
|
|
|
2006-02-18 00:30:09 -08:00
|
|
|
static int
|
2008-10-18 09:00:14 -07:00
|
|
|
_SnapEwinFindMatchCmd(const void *data, const void *match)
|
2006-02-18 00:30:09 -08:00
|
|
|
{
|
2007-01-16 17:10:44 -08:00
|
|
|
const Snapshot *sn = (Snapshot *) data;
|
|
|
|
const EWin *ewin = (EWin *) match;
|
2006-02-18 00:30:09 -08:00
|
|
|
|
|
|
|
return sn->used ||
|
|
|
|
!(sn->startup_id && SEQ(sn->cmd, ewin->icccm.wm_command) &&
|
2008-10-18 09:00:14 -07:00
|
|
|
_SnapEwinMatch(sn, ewin));
|
2006-02-18 00:30:09 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2008-10-18 09:00:14 -07:00
|
|
|
_SnapEwinFindMatch(const void *data, const void *match)
|
2006-02-18 00:30:09 -08:00
|
|
|
{
|
2007-01-16 17:10:44 -08:00
|
|
|
const Snapshot *sn = (Snapshot *) data;
|
|
|
|
const EWin *ewin = (EWin *) match;
|
2006-02-18 00:30:09 -08:00
|
|
|
|
2008-10-18 09:00:14 -07:00
|
|
|
return sn->used || !_SnapEwinMatch(sn, ewin);
|
2006-02-18 00:30:09 -08:00
|
|
|
}
|
|
|
|
|
1999-08-23 09:53:38 -07:00
|
|
|
/* find a snapshot state that applies to this ewin */
|
2005-01-12 15:10:24 -08:00
|
|
|
static Snapshot *
|
2008-10-18 09:00:14 -07:00
|
|
|
_SnapEwinFind(EWin * ewin)
|
1999-08-17 15:56:46 -07:00
|
|
|
{
|
2006-02-18 00:30:09 -08:00
|
|
|
Snapshot *sn;
|
1999-08-17 15:56:46 -07:00
|
|
|
|
|
|
|
if (ewin->snap)
|
|
|
|
return ewin->snap;
|
2003-12-09 12:35:14 -08:00
|
|
|
|
2013-06-06 13:37:06 -07:00
|
|
|
if (LIST_IS_EMPTY(&ss_list))
|
1999-08-17 15:56:46 -07:00
|
|
|
return NULL;
|
2003-12-09 12:35:14 -08:00
|
|
|
|
2005-10-29 18:05:26 -07:00
|
|
|
/* If exec'ed by snap try matching command exactly */
|
2013-06-06 13:37:06 -07:00
|
|
|
sn = LIST_FIND(Snapshot, &ss_list, _SnapEwinFindMatchCmd, ewin);
|
2013-03-30 12:57:12 -07:00
|
|
|
if (sn && sn->startup_id > 0)
|
|
|
|
{
|
|
|
|
/* Assuming we were started by snap */
|
|
|
|
sn->startup_id = 0; /* Only the first time */
|
|
|
|
ewin->state.snapstarted = 1;
|
|
|
|
}
|
2005-09-23 09:12:13 -07:00
|
|
|
|
2006-02-18 00:30:09 -08:00
|
|
|
if (!sn)
|
2013-06-06 13:37:06 -07:00
|
|
|
sn = LIST_FIND(Snapshot, &ss_list, _SnapEwinFindMatch, ewin);
|
2003-12-09 12:35:14 -08:00
|
|
|
|
2005-10-29 18:05:26 -07:00
|
|
|
if (sn && !(sn->match_flags & SNAP_MATCH_MULTIPLE))
|
|
|
|
{
|
|
|
|
sn->used = ewin;
|
|
|
|
ewin->snap = sn;
|
|
|
|
}
|
2006-02-18 00:30:09 -08:00
|
|
|
|
1999-08-17 15:56:46 -07:00
|
|
|
return sn;
|
|
|
|
}
|
|
|
|
|
2005-09-23 09:12:13 -07:00
|
|
|
#define ST(s) ((s) ? (s) : "")
|
|
|
|
|
1999-08-23 09:53:38 -07:00
|
|
|
/* find a snapshot state that applies to this ewin Or if that doesnt exist */
|
|
|
|
/* create a new one */
|
2003-12-09 12:35:14 -08:00
|
|
|
static Snapshot *
|
2008-10-18 09:00:14 -07:00
|
|
|
_SnapEwinGet(EWin * ewin, unsigned int match_flags)
|
1999-08-17 15:56:46 -07:00
|
|
|
{
|
|
|
|
Snapshot *sn;
|
2005-09-23 09:12:13 -07:00
|
|
|
char buf[1024], *s;
|
1999-08-17 15:56:46 -07:00
|
|
|
|
2008-10-18 09:00:14 -07:00
|
|
|
sn = _SnapEwinFind(ewin);
|
2005-02-17 14:36:46 -08:00
|
|
|
if (sn)
|
|
|
|
return sn;
|
2003-05-22 12:15:03 -07:00
|
|
|
|
2006-11-26 04:42:05 -08:00
|
|
|
if ((match_flags & SNAP_MATCH_TITLE) && !EwinGetIcccmName(ewin))
|
2005-10-23 07:25:03 -07:00
|
|
|
match_flags ^= SNAP_MATCH_TITLE;
|
2006-11-26 04:42:05 -08:00
|
|
|
if ((match_flags & SNAP_MATCH_NAME) && !EwinGetIcccmCName(ewin))
|
2005-10-23 07:25:03 -07:00
|
|
|
match_flags ^= SNAP_MATCH_NAME;
|
2006-11-26 04:42:05 -08:00
|
|
|
if ((match_flags & SNAP_MATCH_CLASS) && !EwinGetIcccmClass(ewin))
|
2005-10-23 07:25:03 -07:00
|
|
|
match_flags ^= SNAP_MATCH_CLASS;
|
|
|
|
if ((match_flags & SNAP_MATCH_ROLE) && !ewin->icccm.wm_role)
|
|
|
|
match_flags ^= SNAP_MATCH_ROLE;
|
|
|
|
if (match_flags == 0)
|
|
|
|
{
|
2006-11-26 04:42:05 -08:00
|
|
|
if (!EwinGetIcccmName(ewin))
|
2005-10-23 07:25:03 -07:00
|
|
|
return NULL;
|
|
|
|
match_flags = SNAP_MATCH_TITLE;
|
|
|
|
}
|
|
|
|
|
2008-10-18 09:00:14 -07:00
|
|
|
sn = _SnapCreate(NULL);
|
2005-09-23 09:12:13 -07:00
|
|
|
if (!sn)
|
2005-02-17 14:36:46 -08:00
|
|
|
return NULL;
|
2003-12-09 12:35:14 -08:00
|
|
|
|
2005-09-23 09:12:13 -07:00
|
|
|
sn->match_flags = match_flags;
|
|
|
|
if (match_flags & SNAP_MATCH_TITLE)
|
2006-11-26 04:42:05 -08:00
|
|
|
sn->win_title = Estrdup(EwinGetIcccmName(ewin));
|
2005-09-23 09:12:13 -07:00
|
|
|
if (match_flags & SNAP_MATCH_NAME)
|
2006-11-26 04:42:05 -08:00
|
|
|
sn->win_name = Estrdup(EwinGetIcccmCName(ewin));
|
2005-09-23 09:12:13 -07:00
|
|
|
if (match_flags & SNAP_MATCH_CLASS)
|
2006-11-26 04:42:05 -08:00
|
|
|
sn->win_class = Estrdup(EwinGetIcccmClass(ewin));
|
2005-09-23 09:12:13 -07:00
|
|
|
if (match_flags & SNAP_MATCH_ROLE)
|
2005-02-17 14:36:46 -08:00
|
|
|
{
|
2008-10-18 09:00:14 -07:00
|
|
|
s = _ParseRole(ewin->icccm.wm_role, buf, sizeof(buf));
|
2005-09-23 09:12:13 -07:00
|
|
|
sn->win_role = Estrdup(s);
|
2005-02-17 14:36:46 -08:00
|
|
|
}
|
2005-09-23 09:12:13 -07:00
|
|
|
|
|
|
|
/* Set the snap name. Has no particular significance. */
|
|
|
|
if ((sn->win_name || sn->win_class) && sn->win_role)
|
|
|
|
Esnprintf(buf, sizeof(buf), "%s.%s:%s", ST(sn->win_name),
|
|
|
|
ST(sn->win_class), sn->win_role);
|
|
|
|
else if (sn->win_name || sn->win_class)
|
|
|
|
Esnprintf(buf, sizeof(buf), "%s.%s", ST(sn->win_name), ST(sn->win_class));
|
|
|
|
else if (sn->win_title)
|
|
|
|
Esnprintf(buf, sizeof(buf), "TITLE.%s", sn->win_title);
|
|
|
|
else /* We should not go here */
|
2006-11-26 04:42:05 -08:00
|
|
|
Esnprintf(buf, sizeof(buf), "TITLE.%s", EwinGetIcccmName(ewin));
|
2005-09-23 09:12:13 -07:00
|
|
|
sn->name = Estrdup(buf);
|
|
|
|
|
|
|
|
if (!(sn->match_flags & SNAP_MATCH_MULTIPLE))
|
2005-02-17 14:36:46 -08:00
|
|
|
{
|
2005-09-23 09:12:13 -07:00
|
|
|
sn->used = ewin;
|
|
|
|
ewin->snap = sn;
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
2003-12-09 12:35:14 -08:00
|
|
|
|
1999-08-17 15:56:46 -07:00
|
|
|
return sn;
|
|
|
|
}
|
|
|
|
|
2005-01-12 15:10:24 -08:00
|
|
|
/* record info about this Ewin's attributes */
|
2005-02-15 14:19:52 -08:00
|
|
|
|
2005-01-12 15:10:24 -08:00
|
|
|
static void
|
2008-10-18 09:00:14 -07:00
|
|
|
_SnapUpdateEwinBorder(Snapshot * sn, const EWin * ewin)
|
2005-01-12 15:10:24 -08:00
|
|
|
{
|
2008-02-23 04:09:38 -08:00
|
|
|
Efree(sn->border_name);
|
2008-11-16 09:20:33 -08:00
|
|
|
sn->border_name = Estrdup(BorderGetName(ewin->normal_border));
|
2005-01-12 15:10:24 -08:00
|
|
|
}
|
1999-08-17 15:56:46 -07:00
|
|
|
|
|
|
|
static void
|
2008-10-18 09:00:14 -07:00
|
|
|
_SnapUpdateEwinDesktop(Snapshot * sn, const EWin * ewin)
|
1999-08-17 15:56:46 -07:00
|
|
|
{
|
2005-09-04 00:27:20 -07:00
|
|
|
sn->desktop = EoGetDeskNum(ewin);
|
2005-01-12 15:10:24 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2008-10-18 09:00:14 -07:00
|
|
|
_SnapUpdateEwinSize(Snapshot * sn, const EWin * ewin)
|
2005-01-12 15:10:24 -08:00
|
|
|
{
|
|
|
|
sn->w = ewin->client.w;
|
|
|
|
sn->h = ewin->client.h;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2008-10-18 09:00:14 -07:00
|
|
|
_SnapUpdateEwinLocation(Snapshot * sn, const EWin * ewin)
|
2005-01-12 15:10:24 -08:00
|
|
|
{
|
|
|
|
int ax, ay;
|
|
|
|
|
|
|
|
sn->x = EoGetX(ewin);
|
|
|
|
sn->y = EoGetY(ewin);
|
|
|
|
sn->area_x = ewin->area_x;
|
|
|
|
sn->area_y = ewin->area_y;
|
|
|
|
if (!EoIsSticky(ewin))
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2005-01-12 15:10:24 -08:00
|
|
|
DeskGetArea(EoGetDesk(ewin), &ax, &ay);
|
2008-03-24 04:12:40 -07:00
|
|
|
sn->x += ((ax - sn->area_x) * WinGetW(VROOT));
|
|
|
|
sn->y += ((ay - sn->area_y) * WinGetH(VROOT));
|
2005-01-12 15:10:24 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2008-10-18 09:00:14 -07:00
|
|
|
_SnapUpdateEwinLayer(Snapshot * sn, const EWin * ewin)
|
2005-01-12 15:10:24 -08:00
|
|
|
{
|
|
|
|
sn->layer = EoGetLayer(ewin);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2008-10-18 09:00:14 -07:00
|
|
|
_SnapUpdateEwinSticky(Snapshot * sn, const EWin * ewin)
|
2005-01-12 15:10:24 -08:00
|
|
|
{
|
|
|
|
sn->sticky = EoIsSticky(ewin);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2008-10-18 09:00:14 -07:00
|
|
|
_SnapUpdateEwinShade(Snapshot * sn, const EWin * ewin)
|
2005-01-12 15:10:24 -08:00
|
|
|
{
|
2005-07-08 09:48:19 -07:00
|
|
|
sn->shaded = ewin->state.shaded;
|
2005-02-15 14:19:52 -08:00
|
|
|
}
|
2003-05-22 12:15:03 -07:00
|
|
|
|
2005-02-15 14:19:52 -08:00
|
|
|
static void
|
2008-10-18 09:00:14 -07:00
|
|
|
_SnapUpdateEwinSkipLists(Snapshot * sn, const EWin * ewin)
|
2005-02-15 14:19:52 -08:00
|
|
|
{
|
2005-07-08 09:48:19 -07:00
|
|
|
sn->skiptask = ewin->props.skip_ext_task;
|
|
|
|
sn->skipwinlist = ewin->props.skip_winlist;
|
|
|
|
sn->skipfocus = ewin->props.skip_focuslist;
|
2005-01-12 15:10:24 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2008-10-18 09:00:14 -07:00
|
|
|
_SnapUpdateEwinFlags(Snapshot * sn, const EWin * ewin)
|
2005-01-12 15:10:24 -08:00
|
|
|
{
|
2008-02-03 09:03:23 -08:00
|
|
|
EwinFlagsEncode(ewin, sn->flags);
|
2005-01-12 15:10:24 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2008-10-18 09:00:14 -07:00
|
|
|
_SnapUpdateEwinCmd(Snapshot * sn, const EWin * ewin)
|
2005-01-12 15:10:24 -08:00
|
|
|
{
|
2005-02-15 14:19:52 -08:00
|
|
|
if (ewin->icccm.wm_machine &&
|
|
|
|
strcmp(ewin->icccm.wm_machine, Mode.wm.machine_name))
|
2005-01-12 15:10:24 -08:00
|
|
|
return;
|
|
|
|
|
2008-02-23 04:09:38 -08:00
|
|
|
Efree(sn->cmd);
|
2005-02-15 14:19:52 -08:00
|
|
|
sn->cmd = Estrdup(ewin->icccm.wm_command);
|
2005-01-12 15:10:24 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2008-10-18 09:00:14 -07:00
|
|
|
_SnapUpdateEwinGroups(Snapshot * sn, const EWin * ewin, char onoff)
|
2005-01-12 15:10:24 -08:00
|
|
|
{
|
2012-10-24 10:20:38 -07:00
|
|
|
EWin **gwins;
|
2008-10-18 09:13:54 -07:00
|
|
|
Group *const *groups;
|
2005-01-12 15:10:24 -08:00
|
|
|
int i, j, num, num_groups;
|
|
|
|
|
|
|
|
if (!ewin)
|
|
|
|
return;
|
2005-02-15 14:19:52 -08:00
|
|
|
|
2005-01-12 15:10:24 -08:00
|
|
|
if (!ewin->groups)
|
|
|
|
{
|
2008-02-23 04:09:38 -08:00
|
|
|
Efree(sn->groups);
|
|
|
|
sn->groups = NULL;
|
2005-02-15 14:19:52 -08:00
|
|
|
sn->num_groups = 0;
|
2005-01-12 15:10:24 -08:00
|
|
|
return;
|
|
|
|
}
|
2003-05-22 12:15:03 -07:00
|
|
|
|
2005-01-12 15:10:24 -08:00
|
|
|
gwins =
|
|
|
|
ListWinGroupMembersForEwin(ewin, GROUP_ACTION_ANY, Mode.nogroup, &num);
|
|
|
|
for (i = 0; i < num; i++)
|
|
|
|
{
|
|
|
|
if (onoff)
|
|
|
|
{
|
2008-10-18 09:13:54 -07:00
|
|
|
groups = EwinGetGroups(gwins[i], &num_groups);
|
2008-10-18 09:16:47 -07:00
|
|
|
if (!groups)
|
|
|
|
continue;
|
2005-01-12 15:10:24 -08:00
|
|
|
|
2008-10-18 09:16:47 -07:00
|
|
|
sn = gwins[i]->snap;
|
|
|
|
if (!sn)
|
|
|
|
sn = _SnapEwinGet(gwins[i], SNAP_MATCH_DEFAULT);
|
|
|
|
if (!sn)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
sn->num_groups = num_groups;
|
|
|
|
Efree(sn->groups);
|
|
|
|
sn->groups = EMALLOC(int, num_groups);
|
|
|
|
|
|
|
|
for (j = 0; j < num_groups; j++)
|
|
|
|
{
|
|
|
|
sn->groups[j] = groups[j]->index;
|
|
|
|
groups[j]->save = 1;
|
2005-01-12 15:10:24 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (ewin->snap)
|
|
|
|
{
|
2005-10-29 08:35:39 -07:00
|
|
|
sn = gwins[i]->snap;
|
2005-01-12 15:10:24 -08:00
|
|
|
if (sn)
|
|
|
|
{
|
2008-02-23 04:09:38 -08:00
|
|
|
Efree(sn->groups);
|
|
|
|
sn->groups = NULL;
|
2005-01-12 15:10:24 -08:00
|
|
|
sn->num_groups = 0;
|
|
|
|
}
|
2003-05-22 12:15:03 -07:00
|
|
|
}
|
|
|
|
}
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
2005-01-12 15:10:24 -08:00
|
|
|
Efree(gwins);
|
1999-08-17 15:56:46 -07:00
|
|
|
}
|
|
|
|
|
2005-01-12 15:10:24 -08:00
|
|
|
#if USE_COMPOSITE
|
|
|
|
|
|
|
|
static void
|
2008-10-18 09:00:14 -07:00
|
|
|
_SnapUpdateEwinOpacity(Snapshot * sn, const EWin * ewin)
|
2005-01-12 15:10:24 -08:00
|
|
|
{
|
2013-02-23 03:35:49 -08:00
|
|
|
sn->opacity = OpacityToPercent(ewin->props.opacity);
|
2006-11-03 15:44:32 -08:00
|
|
|
sn->focused_opacity = OpacityToPercent(ewin->props.focused_opacity);
|
2005-01-12 15:10:24 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2008-10-18 09:00:14 -07:00
|
|
|
_SnapUpdateEwinShadow(Snapshot * sn, const EWin * ewin)
|
2005-01-12 15:10:24 -08:00
|
|
|
{
|
|
|
|
sn->shadow = EoGetShadow(ewin);
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
static void
|
2008-10-18 09:00:14 -07:00
|
|
|
_SnapUpdateEwin(Snapshot * sn, const EWin * ewin, unsigned int flags)
|
2005-01-12 15:10:24 -08:00
|
|
|
{
|
2005-02-15 14:19:52 -08:00
|
|
|
/* FIXME - We should check if anything is actually changed */
|
|
|
|
|
|
|
|
if (flags & SNAP_USE_BORDER)
|
2008-10-18 09:00:14 -07:00
|
|
|
_SnapUpdateEwinBorder(sn, ewin);
|
2005-02-15 14:19:52 -08:00
|
|
|
if (flags & SNAP_USE_COMMAND)
|
2008-10-18 09:00:14 -07:00
|
|
|
_SnapUpdateEwinCmd(sn, ewin);
|
2005-02-15 14:19:52 -08:00
|
|
|
if (flags & SNAP_USE_DESK)
|
2008-10-18 09:00:14 -07:00
|
|
|
_SnapUpdateEwinDesktop(sn, ewin);
|
2005-02-15 14:19:52 -08:00
|
|
|
if (flags & SNAP_USE_POS)
|
2008-10-18 09:00:14 -07:00
|
|
|
_SnapUpdateEwinLocation(sn, ewin);
|
2005-02-15 14:19:52 -08:00
|
|
|
if (flags & SNAP_USE_SIZE)
|
2008-10-18 09:00:14 -07:00
|
|
|
_SnapUpdateEwinSize(sn, ewin);
|
2005-02-15 14:19:52 -08:00
|
|
|
if (flags & SNAP_USE_LAYER)
|
2008-10-18 09:00:14 -07:00
|
|
|
_SnapUpdateEwinLayer(sn, ewin);
|
2005-02-15 14:19:52 -08:00
|
|
|
if (flags & SNAP_USE_STICKY)
|
2008-10-18 09:00:14 -07:00
|
|
|
_SnapUpdateEwinSticky(sn, ewin);
|
2005-02-15 14:19:52 -08:00
|
|
|
if (flags & SNAP_USE_SHADED)
|
2008-10-18 09:00:14 -07:00
|
|
|
_SnapUpdateEwinShade(sn, ewin);
|
2005-02-15 14:19:52 -08:00
|
|
|
if (flags & SNAP_USE_SKIP_LISTS)
|
2008-10-18 09:00:14 -07:00
|
|
|
_SnapUpdateEwinSkipLists(sn, ewin);
|
2005-11-18 23:39:30 -08:00
|
|
|
if (flags & SNAP_USE_FLAGS)
|
2008-10-18 09:00:14 -07:00
|
|
|
_SnapUpdateEwinFlags(sn, ewin);
|
2005-01-12 15:10:24 -08:00
|
|
|
#if USE_COMPOSITE
|
2005-02-15 14:19:52 -08:00
|
|
|
if (flags & SNAP_USE_OPACITY)
|
2008-10-18 09:00:14 -07:00
|
|
|
_SnapUpdateEwinOpacity(sn, ewin);
|
2005-02-15 14:19:52 -08:00
|
|
|
if (flags & SNAP_USE_SHADOW)
|
2008-10-18 09:00:14 -07:00
|
|
|
_SnapUpdateEwinShadow(sn, ewin);
|
2005-01-12 15:10:24 -08:00
|
|
|
#endif
|
2005-02-15 14:19:52 -08:00
|
|
|
if (flags & SNAP_USE_GROUPS)
|
2008-10-18 09:00:14 -07:00
|
|
|
_SnapUpdateEwinGroups(sn, ewin, ewin->num_groups);
|
2005-02-15 14:19:52 -08:00
|
|
|
|
2008-10-18 09:00:14 -07:00
|
|
|
SnapshotsSave();
|
2005-02-15 14:19:52 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2008-10-18 09:00:14 -07:00
|
|
|
_EwinSnapSet(EWin * ewin, unsigned int match_flags, unsigned int use_flags)
|
2005-02-15 14:19:52 -08:00
|
|
|
{
|
|
|
|
Snapshot *sn;
|
|
|
|
|
|
|
|
/* Quit if nothing to be saved */
|
2005-09-23 09:12:13 -07:00
|
|
|
if (!match_flags || !(use_flags & SNAP_USE_ALL))
|
2005-02-15 14:19:52 -08:00
|
|
|
return;
|
|
|
|
|
2008-10-18 09:00:14 -07:00
|
|
|
sn = _SnapEwinGet(ewin, match_flags);
|
2005-02-15 14:19:52 -08:00
|
|
|
if (!sn)
|
|
|
|
return;
|
|
|
|
|
2005-09-23 09:12:13 -07:00
|
|
|
if (use_flags & SNAP_AUTO)
|
2005-02-15 14:19:52 -08:00
|
|
|
sn->track_changes = 1;
|
|
|
|
|
2005-09-23 09:12:13 -07:00
|
|
|
sn->use_flags = use_flags & SNAP_USE_ALL;
|
|
|
|
|
2008-10-18 09:00:14 -07:00
|
|
|
_SnapUpdateEwin(sn, ewin, use_flags);
|
2005-02-15 14:19:52 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2005-10-29 08:35:39 -07:00
|
|
|
SnapshotEwinUpdate(const EWin * ewin, unsigned int flags)
|
2005-02-15 14:19:52 -08:00
|
|
|
{
|
|
|
|
Snapshot *sn;
|
|
|
|
|
|
|
|
sn = ewin->snap;
|
|
|
|
if (!sn || !sn->track_changes)
|
|
|
|
return;
|
|
|
|
|
2005-02-18 10:03:58 -08:00
|
|
|
#if 0
|
2006-11-26 03:30:59 -08:00
|
|
|
Eprintf("SnapshotEwinUpdate %s: %#x\n", EwinGetTitle(ewin), flags);
|
2005-02-18 10:03:58 -08:00
|
|
|
#endif
|
|
|
|
|
2005-02-15 14:19:52 -08:00
|
|
|
if (flags & sn->use_flags)
|
2008-10-18 09:00:14 -07:00
|
|
|
_SnapUpdateEwin(sn, ewin, flags);
|
2005-01-12 15:10:24 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* unsnapshot any saved info about this ewin */
|
|
|
|
static void
|
2008-10-18 09:00:14 -07:00
|
|
|
_EwinSnapRemove(EWin * ewin)
|
2005-01-12 15:10:24 -08:00
|
|
|
{
|
|
|
|
if (ewin->snap)
|
2008-10-18 09:00:14 -07:00
|
|
|
_SnapDestroy(ewin->snap);
|
2005-02-18 10:44:44 -08:00
|
|
|
ewin->snap = NULL;
|
2005-01-12 15:10:24 -08:00
|
|
|
}
|
|
|
|
|
2009-01-24 00:31:50 -08:00
|
|
|
#if ENABLE_DIALOGS
|
2005-01-12 15:10:24 -08:00
|
|
|
/*
|
|
|
|
* Snapshot dialogs
|
|
|
|
*/
|
2008-03-23 04:54:24 -07:00
|
|
|
typedef struct {
|
2009-12-03 11:29:30 -08:00
|
|
|
EX_Window client;
|
2005-09-23 09:12:13 -07:00
|
|
|
|
2008-03-23 04:54:24 -07:00
|
|
|
struct {
|
2005-09-23 09:12:13 -07:00
|
|
|
char title;
|
|
|
|
char name;
|
2007-01-16 17:10:44 -08:00
|
|
|
char clss;
|
2005-09-23 09:12:13 -07:00
|
|
|
char role;
|
|
|
|
} match;
|
|
|
|
|
2005-02-15 14:19:52 -08:00
|
|
|
char track_changes;
|
2005-01-12 15:10:24 -08:00
|
|
|
char snap_border;
|
|
|
|
char snap_desktop;
|
|
|
|
char snap_size;
|
|
|
|
char snap_location;
|
|
|
|
char snap_layer;
|
|
|
|
char snap_sticky;
|
2005-02-15 14:19:52 -08:00
|
|
|
char snap_shaded;
|
2005-01-12 15:10:24 -08:00
|
|
|
char snap_cmd;
|
|
|
|
char snap_group;
|
|
|
|
char snap_skiplists;
|
2005-11-18 23:39:30 -08:00
|
|
|
char snap_flags;
|
2005-01-12 15:10:24 -08:00
|
|
|
|
|
|
|
#if USE_COMPOSITE
|
|
|
|
char snap_opacity;
|
|
|
|
char snap_shadow;
|
|
|
|
#endif
|
|
|
|
} SnapDlgData;
|
|
|
|
|
|
|
|
static void
|
2014-04-25 11:20:20 -07:00
|
|
|
_DlgApplySnap(Dialog * d, int val __UNUSED__, void *data __UNUSED__)
|
2005-01-12 15:10:24 -08:00
|
|
|
{
|
|
|
|
EWin *ewin;
|
2009-11-05 10:45:58 -08:00
|
|
|
SnapDlgData *sd = DLG_DATA_GET(d, SnapDlgData);
|
2005-09-23 09:12:13 -07:00
|
|
|
unsigned int match_flags, use_flags;
|
2005-01-12 15:10:24 -08:00
|
|
|
|
2005-06-30 05:50:47 -07:00
|
|
|
ewin = EwinFindByClient(sd->client);
|
2005-01-12 15:10:24 -08:00
|
|
|
if (!ewin)
|
|
|
|
goto done;
|
|
|
|
|
2008-10-18 09:00:14 -07:00
|
|
|
_EwinSnapRemove(ewin);
|
2005-01-12 15:10:24 -08:00
|
|
|
|
2005-09-23 09:12:13 -07:00
|
|
|
match_flags = 0;
|
|
|
|
if (sd->match.title)
|
|
|
|
match_flags |= SNAP_MATCH_TITLE;
|
|
|
|
if (sd->match.name)
|
|
|
|
match_flags |= SNAP_MATCH_NAME;
|
2007-01-16 17:10:44 -08:00
|
|
|
if (sd->match.clss)
|
2005-09-23 09:12:13 -07:00
|
|
|
match_flags |= SNAP_MATCH_CLASS;
|
|
|
|
if (sd->match.role)
|
|
|
|
match_flags |= SNAP_MATCH_ROLE;
|
|
|
|
|
|
|
|
if (!match_flags)
|
|
|
|
goto done;
|
|
|
|
|
2005-02-15 14:19:52 -08:00
|
|
|
use_flags = 0;
|
|
|
|
if (sd->track_changes)
|
|
|
|
use_flags |= SNAP_AUTO;
|
2005-01-12 15:10:24 -08:00
|
|
|
if (sd->snap_border)
|
2005-02-15 14:19:52 -08:00
|
|
|
use_flags |= SNAP_USE_BORDER;
|
|
|
|
if (sd->snap_cmd)
|
|
|
|
use_flags |= SNAP_USE_COMMAND;
|
2005-01-12 15:10:24 -08:00
|
|
|
if (sd->snap_desktop)
|
2005-02-15 14:19:52 -08:00
|
|
|
use_flags |= SNAP_USE_DESK;
|
2005-01-12 15:10:24 -08:00
|
|
|
if (sd->snap_location)
|
2005-02-15 14:19:52 -08:00
|
|
|
use_flags |= SNAP_USE_POS;
|
|
|
|
if (sd->snap_size)
|
|
|
|
use_flags |= SNAP_USE_SIZE;
|
2005-01-12 15:10:24 -08:00
|
|
|
if (sd->snap_layer)
|
2005-02-15 14:19:52 -08:00
|
|
|
use_flags |= SNAP_USE_LAYER;
|
2005-01-12 15:10:24 -08:00
|
|
|
if (sd->snap_sticky)
|
2005-02-15 14:19:52 -08:00
|
|
|
use_flags |= SNAP_USE_STICKY;
|
|
|
|
if (sd->snap_shaded)
|
|
|
|
use_flags |= SNAP_USE_SHADED;
|
2005-01-12 15:10:24 -08:00
|
|
|
if (sd->snap_skiplists)
|
2005-02-15 14:19:52 -08:00
|
|
|
use_flags |= SNAP_USE_SKIP_LISTS;
|
2005-11-18 23:39:30 -08:00
|
|
|
if (sd->snap_flags)
|
|
|
|
use_flags |= SNAP_USE_FLAGS;
|
2005-01-12 15:10:24 -08:00
|
|
|
#if USE_COMPOSITE
|
|
|
|
if (sd->snap_opacity)
|
2005-02-15 14:19:52 -08:00
|
|
|
use_flags |= SNAP_USE_OPACITY;
|
2005-01-12 15:10:24 -08:00
|
|
|
if (sd->snap_shadow)
|
2005-02-15 14:19:52 -08:00
|
|
|
use_flags |= SNAP_USE_SHADOW;
|
2005-01-12 15:10:24 -08:00
|
|
|
#endif
|
2005-02-15 14:19:52 -08:00
|
|
|
if (sd->snap_group)
|
|
|
|
use_flags |= SNAP_USE_GROUPS;
|
|
|
|
|
2005-09-23 09:12:13 -07:00
|
|
|
if (!use_flags)
|
|
|
|
goto done;
|
|
|
|
|
2008-10-18 09:00:14 -07:00
|
|
|
_EwinSnapSet(ewin, match_flags, use_flags);
|
2005-01-12 15:10:24 -08:00
|
|
|
|
|
|
|
done:
|
2008-10-18 09:00:14 -07:00
|
|
|
SnapshotsSave();
|
2005-01-12 15:10:24 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2006-07-26 21:52:50 -07:00
|
|
|
_DlgFillSnap(Dialog * d, DItem * table, void *data)
|
1999-08-17 15:56:46 -07:00
|
|
|
{
|
2014-04-25 14:07:58 -07:00
|
|
|
SnapDlgData *sd = DLG_DATA_GET(d, SnapDlgData);
|
2006-07-26 21:52:50 -07:00
|
|
|
DItem *di;
|
1999-08-17 15:56:46 -07:00
|
|
|
Snapshot *sn;
|
|
|
|
char s[1024];
|
2007-01-16 17:10:44 -08:00
|
|
|
const EWin *ewin = (EWin *) data;
|
2000-04-05 18:51:47 -07:00
|
|
|
|
2006-08-07 13:20:16 -07:00
|
|
|
sd->client = EwinGetClientXwin(ewin);
|
2005-01-12 15:10:24 -08:00
|
|
|
|
1999-08-17 15:56:46 -07:00
|
|
|
sn = ewin->snap;
|
|
|
|
if (sn)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2005-09-23 09:12:13 -07:00
|
|
|
sd->match.title = (sn->match_flags & SNAP_MATCH_TITLE) != 0;
|
|
|
|
sd->match.name = (sn->match_flags & SNAP_MATCH_NAME) != 0;
|
2007-01-16 17:10:44 -08:00
|
|
|
sd->match.clss = (sn->match_flags & SNAP_MATCH_CLASS) != 0;
|
2005-09-23 09:12:13 -07:00
|
|
|
sd->match.role = (sn->match_flags & SNAP_MATCH_ROLE) != 0;
|
|
|
|
|
2005-02-15 14:19:52 -08:00
|
|
|
if (sn->track_changes)
|
|
|
|
sd->track_changes = 1;
|
|
|
|
if (sn->use_flags & SNAP_USE_BORDER)
|
2005-01-12 15:10:24 -08:00
|
|
|
sd->snap_border = 1;
|
2005-02-15 14:19:52 -08:00
|
|
|
if (sn->use_flags & SNAP_USE_COMMAND)
|
|
|
|
sd->snap_cmd = 1;
|
|
|
|
if (sn->use_flags & SNAP_USE_DESK)
|
2005-01-12 15:10:24 -08:00
|
|
|
sd->snap_desktop = 1;
|
2005-02-15 14:19:52 -08:00
|
|
|
if (sn->use_flags & SNAP_USE_POS)
|
2005-01-12 15:10:24 -08:00
|
|
|
sd->snap_location = 1;
|
2005-02-15 14:19:52 -08:00
|
|
|
if (sn->use_flags & SNAP_USE_SIZE)
|
|
|
|
sd->snap_size = 1;
|
|
|
|
if (sn->use_flags & SNAP_USE_LAYER)
|
2005-01-12 15:10:24 -08:00
|
|
|
sd->snap_layer = 1;
|
2005-02-15 14:19:52 -08:00
|
|
|
if (sn->use_flags & SNAP_USE_STICKY)
|
2005-01-12 15:10:24 -08:00
|
|
|
sd->snap_sticky = 1;
|
2005-02-15 14:19:52 -08:00
|
|
|
if (sn->use_flags & SNAP_USE_SHADED)
|
|
|
|
sd->snap_shaded = 1;
|
|
|
|
if (sn->use_flags & SNAP_USE_SKIP_LISTS)
|
2005-01-12 15:10:24 -08:00
|
|
|
sd->snap_skiplists = 1;
|
2005-11-18 23:39:30 -08:00
|
|
|
if (sn->use_flags & SNAP_USE_FLAGS)
|
|
|
|
sd->snap_flags = 1;
|
2005-01-12 15:10:24 -08:00
|
|
|
#if USE_COMPOSITE
|
2005-02-15 14:19:52 -08:00
|
|
|
if (sn->use_flags & SNAP_USE_OPACITY)
|
2005-01-12 15:10:24 -08:00
|
|
|
sd->snap_opacity = 1;
|
2005-02-15 14:19:52 -08:00
|
|
|
if (sn->use_flags & SNAP_USE_SHADOW)
|
2005-01-12 15:10:24 -08:00
|
|
|
sd->snap_shadow = 1;
|
|
|
|
#endif
|
2005-02-15 14:19:52 -08:00
|
|
|
if (sn->use_flags & SNAP_USE_GROUPS)
|
|
|
|
sd->snap_group = 1;
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
2005-09-23 09:12:13 -07:00
|
|
|
else
|
|
|
|
{
|
2006-11-26 04:42:05 -08:00
|
|
|
if (EwinGetIcccmCName(ewin))
|
2005-09-23 09:12:13 -07:00
|
|
|
{
|
|
|
|
sd->match.name = 1;
|
2007-01-16 17:10:44 -08:00
|
|
|
sd->match.clss = 1;
|
2010-08-21 07:39:55 -07:00
|
|
|
sd->match.role = ! !ewin->icccm.wm_role;
|
2005-09-23 09:12:13 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-08-21 07:39:55 -07:00
|
|
|
sd->match.title = ! !EwinGetIcccmName(ewin);
|
2005-09-23 09:12:13 -07:00
|
|
|
}
|
|
|
|
}
|
1999-08-17 15:56:46 -07:00
|
|
|
|
2006-07-26 21:52:50 -07:00
|
|
|
table = DialogAddItem(table, DITEM_TABLE);
|
|
|
|
DialogItemTableSetOptions(table, 4, 0, 0, 0);
|
|
|
|
|
2005-09-23 09:12:13 -07:00
|
|
|
di = DialogAddItem(table, DITEM_CHECKBUTTON);
|
1999-08-17 15:56:46 -07:00
|
|
|
DialogItemSetAlign(di, 0, 512);
|
2005-08-02 09:50:40 -07:00
|
|
|
DialogItemSetText(di, _("Title:"));
|
2005-09-23 09:12:13 -07:00
|
|
|
DialogItemCheckButtonSetPtr(di, &sd->match.title);
|
1999-08-20 05:23:26 -07:00
|
|
|
|
|
|
|
di = DialogAddItem(table, DITEM_TEXT);
|
|
|
|
DialogItemSetColSpan(di, 3);
|
|
|
|
DialogItemSetAlign(di, 1024, 512);
|
2006-11-26 04:42:05 -08:00
|
|
|
DialogItemSetText(di, EwinGetIcccmName(ewin));
|
1999-08-17 15:56:46 -07:00
|
|
|
|
2006-11-26 04:42:05 -08:00
|
|
|
if (EwinGetIcccmCName(ewin))
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2005-09-23 09:12:13 -07:00
|
|
|
di = DialogAddItem(table, DITEM_CHECKBUTTON);
|
2003-05-22 12:15:03 -07:00
|
|
|
DialogItemSetAlign(di, 0, 512);
|
2005-08-02 09:50:40 -07:00
|
|
|
DialogItemSetText(di, _("Name:"));
|
2005-09-23 09:12:13 -07:00
|
|
|
DialogItemCheckButtonSetPtr(di, &sd->match.name);
|
2003-05-22 12:15:03 -07:00
|
|
|
|
|
|
|
di = DialogAddItem(table, DITEM_TEXT);
|
|
|
|
DialogItemSetColSpan(di, 3);
|
|
|
|
DialogItemSetAlign(di, 1024, 512);
|
2006-11-26 04:42:05 -08:00
|
|
|
DialogItemSetText(di, EwinGetIcccmCName(ewin));
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
1999-08-17 15:56:46 -07:00
|
|
|
|
2006-11-26 04:42:05 -08:00
|
|
|
if (EwinGetIcccmClass(ewin))
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2005-09-23 09:12:13 -07:00
|
|
|
di = DialogAddItem(table, DITEM_CHECKBUTTON);
|
2003-05-22 12:15:03 -07:00
|
|
|
DialogItemSetAlign(di, 0, 512);
|
2005-08-02 09:50:40 -07:00
|
|
|
DialogItemSetText(di, _("Class:"));
|
2007-01-16 17:10:44 -08:00
|
|
|
DialogItemCheckButtonSetPtr(di, &sd->match.clss);
|
2003-05-22 12:15:03 -07:00
|
|
|
|
|
|
|
di = DialogAddItem(table, DITEM_TEXT);
|
|
|
|
DialogItemSetColSpan(di, 3);
|
|
|
|
DialogItemSetAlign(di, 1024, 512);
|
2006-11-26 04:42:05 -08:00
|
|
|
DialogItemSetText(di, EwinGetIcccmClass(ewin));
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
1999-08-17 15:56:46 -07:00
|
|
|
|
2005-09-23 09:12:13 -07:00
|
|
|
if (ewin->icccm.wm_role)
|
|
|
|
{
|
|
|
|
di = DialogAddItem(table, DITEM_CHECKBUTTON);
|
|
|
|
DialogItemSetAlign(di, 0, 512);
|
|
|
|
DialogItemSetText(di, _("Role:"));
|
|
|
|
DialogItemCheckButtonSetPtr(di, &sd->match.role);
|
|
|
|
|
|
|
|
di = DialogAddItem(table, DITEM_TEXT);
|
|
|
|
DialogItemSetColSpan(di, 3);
|
|
|
|
DialogItemSetAlign(di, 1024, 512);
|
|
|
|
DialogItemSetText(di, ewin->icccm.wm_role);
|
|
|
|
}
|
|
|
|
|
2004-02-28 17:30:18 -08:00
|
|
|
if (ewin->icccm.wm_command)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
di = DialogAddItem(table, DITEM_TEXT);
|
|
|
|
DialogItemSetAlign(di, 0, 512);
|
2005-08-02 09:50:40 -07:00
|
|
|
DialogItemSetText(di, _("Command:"));
|
2003-05-22 12:15:03 -07:00
|
|
|
|
|
|
|
di = DialogAddItem(table, DITEM_TEXT);
|
|
|
|
DialogItemSetColSpan(di, 3);
|
|
|
|
DialogItemSetAlign(di, 1024, 512);
|
|
|
|
|
|
|
|
/* if the command is long, cut in into slices of about 80 characters */
|
2004-02-28 17:30:18 -08:00
|
|
|
if (strlen(ewin->icccm.wm_command) > 80)
|
2003-05-22 12:15:03 -07:00
|
|
|
{
|
|
|
|
int i = 0, slice, last;
|
|
|
|
|
|
|
|
s[0] = 0;
|
2004-02-28 17:30:18 -08:00
|
|
|
while ((i <= (int)strlen(ewin->icccm.wm_command))
|
2003-05-22 12:15:03 -07:00
|
|
|
&& (i < (int)(sizeof(s) / 4)))
|
|
|
|
{
|
|
|
|
last = i;
|
|
|
|
i += 64;
|
|
|
|
slice = 64;
|
|
|
|
/* and make sure that we don't cut in the middle of a word. */
|
2004-02-28 17:30:18 -08:00
|
|
|
while ((ewin->icccm.wm_command[i++] != ' ')
|
2003-05-22 12:15:03 -07:00
|
|
|
&& (i < (int)(sizeof(s) / 4)))
|
|
|
|
slice++;
|
2004-02-28 17:30:18 -08:00
|
|
|
strncat(s, ewin->icccm.wm_command + last, slice);
|
2003-05-22 12:15:03 -07:00
|
|
|
if (i < (int)(sizeof(s) / 4))
|
|
|
|
strcat(s, "\n");
|
|
|
|
else
|
|
|
|
strcat(s, "...\n");
|
|
|
|
}
|
2005-08-02 09:50:40 -07:00
|
|
|
DialogItemSetText(di, s);
|
2003-05-22 12:15:03 -07:00
|
|
|
}
|
|
|
|
else
|
2005-08-02 09:50:40 -07:00
|
|
|
DialogItemSetText(di, ewin->icccm.wm_command);
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
1999-08-17 15:56:46 -07:00
|
|
|
|
|
|
|
di = DialogAddItem(table, DITEM_SEPARATOR);
|
1999-08-20 05:23:26 -07:00
|
|
|
DialogItemSetColSpan(di, 4);
|
1999-08-17 15:56:46 -07:00
|
|
|
|
2005-02-15 14:19:52 -08:00
|
|
|
di = DialogAddItem(table, DITEM_CHECKBUTTON);
|
|
|
|
DialogItemSetColSpan(di, 4);
|
2005-08-02 09:50:40 -07:00
|
|
|
DialogItemSetText(di, _("Track Changes"));
|
2005-02-15 14:19:52 -08:00
|
|
|
DialogItemCheckButtonSetPtr(di, &sd->track_changes);
|
|
|
|
|
1999-08-17 15:56:46 -07:00
|
|
|
di = DialogAddItem(table, DITEM_CHECKBUTTON);
|
1999-08-20 05:23:26 -07:00
|
|
|
DialogItemSetColSpan(di, 2);
|
2005-08-02 09:50:40 -07:00
|
|
|
DialogItemSetText(di, _("Location"));
|
2005-01-12 15:10:24 -08:00
|
|
|
DialogItemCheckButtonSetPtr(di, &sd->snap_location);
|
1999-08-17 15:56:46 -07:00
|
|
|
|
|
|
|
di = DialogAddItem(table, DITEM_CHECKBUTTON);
|
1999-08-20 05:23:26 -07:00
|
|
|
DialogItemSetColSpan(di, 2);
|
2005-08-02 09:50:40 -07:00
|
|
|
DialogItemSetText(di, _("Border style"));
|
2005-01-12 15:10:24 -08:00
|
|
|
DialogItemCheckButtonSetPtr(di, &sd->snap_border);
|
1999-08-17 15:56:46 -07:00
|
|
|
|
|
|
|
di = DialogAddItem(table, DITEM_CHECKBUTTON);
|
1999-08-20 05:23:26 -07:00
|
|
|
DialogItemSetColSpan(di, 2);
|
2005-08-02 09:50:40 -07:00
|
|
|
DialogItemSetText(di, _("Size"));
|
2005-01-12 15:10:24 -08:00
|
|
|
DialogItemCheckButtonSetPtr(di, &sd->snap_size);
|
1999-08-17 15:56:46 -07:00
|
|
|
|
|
|
|
di = DialogAddItem(table, DITEM_CHECKBUTTON);
|
1999-08-20 05:23:26 -07:00
|
|
|
DialogItemSetColSpan(di, 2);
|
2005-08-02 09:50:40 -07:00
|
|
|
DialogItemSetText(di, _("Desktop"));
|
2005-01-12 15:10:24 -08:00
|
|
|
DialogItemCheckButtonSetPtr(di, &sd->snap_desktop);
|
1999-08-17 15:56:46 -07:00
|
|
|
|
|
|
|
di = DialogAddItem(table, DITEM_CHECKBUTTON);
|
1999-08-20 05:23:26 -07:00
|
|
|
DialogItemSetColSpan(di, 2);
|
2005-08-02 09:50:40 -07:00
|
|
|
DialogItemSetText(di, _("Shaded state"));
|
2005-02-15 14:19:52 -08:00
|
|
|
DialogItemCheckButtonSetPtr(di, &sd->snap_shaded);
|
1999-08-17 15:56:46 -07:00
|
|
|
|
|
|
|
di = DialogAddItem(table, DITEM_CHECKBUTTON);
|
1999-08-20 05:23:26 -07:00
|
|
|
DialogItemSetColSpan(di, 2);
|
2005-08-02 09:50:40 -07:00
|
|
|
DialogItemSetText(di, _("Sticky state"));
|
2005-01-12 15:10:24 -08:00
|
|
|
DialogItemCheckButtonSetPtr(di, &sd->snap_sticky);
|
1999-08-17 15:56:46 -07:00
|
|
|
|
|
|
|
di = DialogAddItem(table, DITEM_CHECKBUTTON);
|
1999-08-20 05:23:26 -07:00
|
|
|
DialogItemSetColSpan(di, 2);
|
2005-08-02 09:50:40 -07:00
|
|
|
DialogItemSetText(di, _("Stacking layer"));
|
2005-01-12 15:10:24 -08:00
|
|
|
DialogItemCheckButtonSetPtr(di, &sd->snap_layer);
|
1999-08-17 15:56:46 -07:00
|
|
|
|
2000-02-21 12:53:42 -08:00
|
|
|
di = DialogAddItem(table, DITEM_CHECKBUTTON);
|
|
|
|
DialogItemSetColSpan(di, 2);
|
2005-08-02 09:50:40 -07:00
|
|
|
DialogItemSetText(di, _("Window List Skip"));
|
2005-01-12 15:10:24 -08:00
|
|
|
DialogItemCheckButtonSetPtr(di, &sd->snap_skiplists);
|
|
|
|
|
|
|
|
#if USE_COMPOSITE
|
|
|
|
di = DialogAddItem(table, DITEM_CHECKBUTTON);
|
|
|
|
DialogItemSetColSpan(di, 2);
|
2005-08-02 09:50:40 -07:00
|
|
|
DialogItemSetText(di, _("Opacity"));
|
2005-01-12 15:10:24 -08:00
|
|
|
DialogItemCheckButtonSetPtr(di, &sd->snap_opacity);
|
|
|
|
|
|
|
|
di = DialogAddItem(table, DITEM_CHECKBUTTON);
|
|
|
|
DialogItemSetColSpan(di, 2);
|
2005-08-02 09:50:40 -07:00
|
|
|
DialogItemSetText(di, _("Shadowing"));
|
2005-01-12 15:10:24 -08:00
|
|
|
DialogItemCheckButtonSetPtr(di, &sd->snap_shadow);
|
|
|
|
#endif
|
2000-02-28 10:08:25 -08:00
|
|
|
|
2000-02-27 07:02:10 -08:00
|
|
|
di = DialogAddItem(table, DITEM_CHECKBUTTON);
|
|
|
|
DialogItemSetColSpan(di, 2);
|
2005-11-18 23:39:30 -08:00
|
|
|
DialogItemSetText(di, _("Flags"));
|
|
|
|
DialogItemCheckButtonSetPtr(di, &sd->snap_flags);
|
|
|
|
|
|
|
|
di = DialogAddItem(table, DITEM_NONE);
|
|
|
|
DialogItemSetColSpan(di, 2);
|
|
|
|
|
2004-02-28 17:30:18 -08:00
|
|
|
if (ewin->icccm.wm_command)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
char ok = 1;
|
|
|
|
|
2004-02-28 17:30:18 -08:00
|
|
|
if (ewin->icccm.wm_machine)
|
2003-05-22 12:15:03 -07:00
|
|
|
{
|
2004-12-28 15:46:49 -08:00
|
|
|
if (strcmp(ewin->icccm.wm_machine, Mode.wm.machine_name))
|
2003-05-22 12:15:03 -07:00
|
|
|
ok = 0;
|
|
|
|
}
|
|
|
|
if (ok)
|
|
|
|
{
|
|
|
|
di = DialogAddItem(table, DITEM_CHECKBUTTON);
|
|
|
|
DialogItemSetColSpan(di, 4);
|
2005-08-02 09:50:40 -07:00
|
|
|
DialogItemSetText(di, _("Restart application on login"));
|
2005-01-12 15:10:24 -08:00
|
|
|
DialogItemCheckButtonSetPtr(di, &sd->snap_cmd);
|
2003-05-22 12:15:03 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
di = DialogAddItem(table, DITEM_NONE);
|
|
|
|
DialogItemSetColSpan(di, 4);
|
|
|
|
}
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
1999-08-17 15:56:46 -07:00
|
|
|
else
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
di = DialogAddItem(table, DITEM_NONE);
|
|
|
|
DialogItemSetColSpan(di, 4);
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
1999-08-20 05:23:26 -07:00
|
|
|
|
1999-09-08 17:39:43 -07:00
|
|
|
if (ewin->groups)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
di = DialogAddItem(table, DITEM_CHECKBUTTON);
|
|
|
|
DialogItemSetColSpan(di, 4);
|
2005-08-02 09:50:40 -07:00
|
|
|
DialogItemSetText(di, _("Remember this window's group(s)"));
|
2005-01-12 15:10:24 -08:00
|
|
|
DialogItemCheckButtonSetPtr(di, &sd->snap_group);
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
2006-07-26 21:52:50 -07:00
|
|
|
}
|
2005-01-12 15:10:24 -08:00
|
|
|
|
2008-05-10 16:22:31 -07:00
|
|
|
static const DialogDef DlgSnap = {
|
2006-07-26 21:52:50 -07:00
|
|
|
NULL,
|
2014-04-25 14:07:58 -07:00
|
|
|
NULL, N_("Remembered Application Attributes"),
|
|
|
|
sizeof(SnapDlgData),
|
2008-12-14 08:44:45 -08:00
|
|
|
SOUND_NONE,
|
2006-07-26 21:52:50 -07:00
|
|
|
"pix/snapshots.png",
|
|
|
|
N_("Select the attributes of this\n"
|
|
|
|
"window you wish to Remember\n" "from now on\n"),
|
2006-08-07 20:58:42 -07:00
|
|
|
_DlgFillSnap,
|
2014-04-25 11:20:20 -07:00
|
|
|
DLG_OAC, _DlgApplySnap, NULL
|
2006-07-26 21:52:50 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
static void
|
2008-10-18 09:00:14 -07:00
|
|
|
_EwinSnapDialog(const EWin * ewin)
|
2006-07-26 21:52:50 -07:00
|
|
|
{
|
|
|
|
char s[1024];
|
|
|
|
|
2009-12-03 11:29:30 -08:00
|
|
|
Esnprintf(s, sizeof(s), "SNAPSHOT_WINDOW-%#x", EwinGetClientXwin(ewin));
|
2006-07-26 21:52:50 -07:00
|
|
|
|
|
|
|
DialogShowSimpleWithName(&DlgSnap, s, (void *)ewin);
|
2000-02-27 07:02:10 -08:00
|
|
|
}
|
|
|
|
|
2005-01-12 15:10:24 -08:00
|
|
|
/* list of remembered items for the remember dialog -- it's either
|
|
|
|
* _another_ global var, or a wrapper struct to pass data to the
|
|
|
|
* callback funcs besides the dialog itself -- this is much easier */
|
|
|
|
|
2008-03-23 04:54:24 -07:00
|
|
|
typedef struct _remwinlist {
|
2005-02-17 14:36:46 -08:00
|
|
|
Snapshot *snap;
|
|
|
|
char remove;
|
2005-01-12 15:10:24 -08:00
|
|
|
} RememberWinList;
|
1999-08-17 15:56:46 -07:00
|
|
|
|
2005-02-17 14:36:46 -08:00
|
|
|
static RememberWinList *rd_ewin_list;
|
1999-08-17 15:56:46 -07:00
|
|
|
|
2005-01-12 15:10:24 -08:00
|
|
|
static void
|
2014-04-25 11:20:20 -07:00
|
|
|
_DlgApplyRemember(Dialog * d __UNUSED__,
|
|
|
|
int val __UNUSED__, void *data __UNUSED__)
|
1999-08-17 15:56:46 -07:00
|
|
|
{
|
2005-01-12 15:10:24 -08:00
|
|
|
int i;
|
1999-10-28 05:24:39 -07:00
|
|
|
|
2014-04-25 11:20:20 -07:00
|
|
|
if (!rd_ewin_list)
|
|
|
|
return;
|
|
|
|
|
|
|
|
for (i = 0; rd_ewin_list[i].snap; i++)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2014-04-25 11:20:20 -07:00
|
|
|
if (!rd_ewin_list[i].remove)
|
|
|
|
continue;
|
2005-02-17 14:36:46 -08:00
|
|
|
|
2014-04-25 11:20:20 -07:00
|
|
|
_SnapDestroy(rd_ewin_list[i].snap);
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
2014-04-25 11:20:20 -07:00
|
|
|
/* save snapshot info to disk */
|
|
|
|
SnapshotsSave();
|
|
|
|
}
|
2005-02-17 14:36:46 -08:00
|
|
|
|
2014-04-25 11:20:20 -07:00
|
|
|
static void
|
|
|
|
_DlgExitRemember(Dialog * d __UNUSED__)
|
|
|
|
{
|
|
|
|
Efree(rd_ewin_list);
|
|
|
|
rd_ewin_list = NULL;
|
1999-08-17 15:56:46 -07:00
|
|
|
}
|
|
|
|
|
2005-01-12 15:10:24 -08:00
|
|
|
static void
|
|
|
|
CB_RememberWindowSettings(Dialog * d __UNUSED__, int val __UNUSED__, void *data)
|
|
|
|
{
|
2013-06-05 13:41:36 -07:00
|
|
|
RememberWinList *rd = (RememberWinList *) data;
|
2005-02-17 14:36:46 -08:00
|
|
|
Snapshot *sn;
|
1999-08-20 05:23:26 -07:00
|
|
|
|
2013-06-05 13:41:36 -07:00
|
|
|
if (!rd)
|
2005-01-12 15:10:24 -08:00
|
|
|
return;
|
|
|
|
|
2005-02-17 14:36:46 -08:00
|
|
|
/* Make sure its still there */
|
2013-06-06 13:37:06 -07:00
|
|
|
sn = LIST_CHECK(Snapshot, &ss_list, rd->snap);
|
2005-01-12 15:10:24 -08:00
|
|
|
|
2005-02-17 14:36:46 -08:00
|
|
|
if (!sn || !sn->used)
|
|
|
|
return;
|
2008-10-18 09:00:14 -07:00
|
|
|
_EwinSnapDialog(sn->used);
|
2005-02-17 14:36:46 -08:00
|
|
|
}
|
2005-01-12 15:10:24 -08:00
|
|
|
|
2006-07-20 20:17:18 -07:00
|
|
|
static void
|
2006-08-07 20:58:42 -07:00
|
|
|
_DlgFillRemember(Dialog * d __UNUSED__, DItem * table, void *data __UNUSED__)
|
2005-01-12 15:10:24 -08:00
|
|
|
{
|
2006-07-20 20:17:18 -07:00
|
|
|
DItem *di;
|
2006-02-18 00:30:09 -08:00
|
|
|
Snapshot *sn;
|
2005-02-17 14:36:46 -08:00
|
|
|
int i, num;
|
|
|
|
char buf[128];
|
|
|
|
const char *s;
|
2005-01-12 15:10:24 -08:00
|
|
|
|
|
|
|
DialogItemTableSetOptions(table, 3, 0, 0, 0);
|
|
|
|
|
2013-06-06 13:37:06 -07:00
|
|
|
num = LIST_GET_COUNT(&ss_list);
|
2007-01-16 17:10:44 -08:00
|
|
|
rd_ewin_list = EMALLOC(RememberWinList, num + 1);
|
2005-02-17 14:36:46 -08:00
|
|
|
|
|
|
|
if (num > 0)
|
2005-01-12 15:10:24 -08:00
|
|
|
{
|
2005-02-17 14:36:46 -08:00
|
|
|
di = DialogAddItem(table, DITEM_TEXT);
|
|
|
|
DialogItemSetColSpan(di, 3);
|
|
|
|
DialogItemSetFill(di, 0, 0);
|
|
|
|
DialogItemSetAlign(di, 0, 512);
|
2005-08-02 09:50:40 -07:00
|
|
|
DialogItemSetText(di, _("Delete"));
|
2005-02-17 14:36:46 -08:00
|
|
|
}
|
|
|
|
|
2006-02-18 00:30:09 -08:00
|
|
|
i = 0;
|
2013-06-06 13:37:06 -07:00
|
|
|
LIST_FOR_EACH(Snapshot, &ss_list, sn)
|
2006-02-18 00:30:09 -08:00
|
|
|
{
|
|
|
|
rd_ewin_list[i].snap = sn;
|
|
|
|
rd_ewin_list[i].remove = 0;
|
|
|
|
|
|
|
|
di = DialogAddItem(table, DITEM_CHECKBUTTON);
|
|
|
|
DialogItemSetColSpan(di, 2);
|
|
|
|
DialogItemSetAlign(di, 0, 512);
|
|
|
|
if (sn->used)
|
2006-11-26 03:30:59 -08:00
|
|
|
s = EwinGetTitle(sn->used);
|
2006-02-18 00:30:09 -08:00
|
|
|
else if (sn->win_title)
|
|
|
|
s = sn->win_title;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Esnprintf(buf, sizeof(buf), "%s.%s", sn->win_name, sn->win_class);
|
|
|
|
s = buf;
|
|
|
|
}
|
|
|
|
DialogItemSetText(di, s);
|
|
|
|
DialogItemCheckButtonSetPtr(di, &(rd_ewin_list[i].remove));
|
|
|
|
|
|
|
|
if (sn->used)
|
|
|
|
{
|
|
|
|
di = DialogAddItem(table, DITEM_BUTTON);
|
|
|
|
DialogItemSetAlign(di, 0, 512);
|
|
|
|
DialogItemSetText(di, _("Remembered Settings..."));
|
|
|
|
DialogItemSetCallback(di, CB_RememberWindowSettings, 0,
|
|
|
|
(char *)(&rd_ewin_list[i]));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
di = DialogAddItem(table, DITEM_TEXT);
|
|
|
|
DialogItemSetText(di, _("Unused"));
|
|
|
|
}
|
|
|
|
i++;
|
|
|
|
}
|
2005-02-17 14:36:46 -08:00
|
|
|
rd_ewin_list[num].snap = NULL;
|
1999-08-17 15:56:46 -07:00
|
|
|
|
2005-01-12 15:10:24 -08:00
|
|
|
/* finish remember window */
|
2005-02-17 14:36:46 -08:00
|
|
|
if (!num)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2005-01-12 15:10:24 -08:00
|
|
|
di = DialogAddItem(table, DITEM_TEXT);
|
|
|
|
DialogItemSetColSpan(di, 3);
|
2005-08-02 09:50:40 -07:00
|
|
|
DialogItemSetText(di,
|
|
|
|
_
|
|
|
|
("There are no active windows with remembered attributes."));
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
1999-08-17 15:56:46 -07:00
|
|
|
}
|
|
|
|
|
2006-07-20 20:17:18 -07:00
|
|
|
const DialogDef DlgRemember = {
|
|
|
|
"CONFIGURE_PAGER",
|
2014-04-25 14:07:58 -07:00
|
|
|
N_("Remember"), N_("Remembered Windows Settings"),
|
|
|
|
0,
|
2008-12-14 08:44:45 -08:00
|
|
|
SOUND_SETTINGS_PAGER,
|
2006-07-26 21:52:50 -07:00
|
|
|
"pix/snapshots.png",
|
2010-05-09 12:03:19 -07:00
|
|
|
N_("Enlightenment Remembered\n" "Windows Settings Dialog"),
|
2006-08-07 20:58:42 -07:00
|
|
|
_DlgFillRemember,
|
2014-04-25 11:20:20 -07:00
|
|
|
DLG_OC, _DlgApplyRemember, _DlgExitRemember
|
2006-07-20 20:17:18 -07:00
|
|
|
};
|
2009-01-24 00:31:50 -08:00
|
|
|
#endif /* ENABLE_DIALOGS */
|
2006-07-20 20:17:18 -07:00
|
|
|
|
2000-03-30 18:25:00 -08:00
|
|
|
/* ... combine writes, only save after a timeout */
|
2012-04-22 10:39:51 -07:00
|
|
|
static int
|
|
|
|
_SnapshotsSaveReal(void *data __UNUSED__)
|
|
|
|
{
|
|
|
|
SnapshotsSaveReal();
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
1999-08-17 15:56:46 -07:00
|
|
|
void
|
2008-10-18 09:00:14 -07:00
|
|
|
SnapshotsSave(void)
|
2000-03-30 18:25:00 -08:00
|
|
|
{
|
2008-05-24 11:13:17 -07:00
|
|
|
TIMER_DEL(ss_timer);
|
2012-04-22 10:39:51 -07:00
|
|
|
TIMER_ADD(ss_timer, 5000, _SnapshotsSaveReal, NULL);
|
2000-03-30 18:25:00 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* save out all snapped info to disk */
|
2012-04-22 10:39:51 -07:00
|
|
|
void
|
|
|
|
SnapshotsSaveReal(void)
|
1999-08-17 15:56:46 -07:00
|
|
|
{
|
2006-02-18 00:30:09 -08:00
|
|
|
Snapshot *sn;
|
|
|
|
int j;
|
2005-03-12 07:22:08 -08:00
|
|
|
char buf[4096], s[4096];
|
1999-08-17 15:56:46 -07:00
|
|
|
FILE *f;
|
|
|
|
|
2004-05-07 08:18:07 -07:00
|
|
|
if (!Mode.wm.save_ok)
|
2008-05-24 11:13:17 -07:00
|
|
|
goto done;
|
2000-03-30 18:25:00 -08:00
|
|
|
|
1999-08-17 15:56:46 -07:00
|
|
|
Etmp(s);
|
|
|
|
f = fopen(s, "w");
|
|
|
|
if (!f)
|
2008-05-24 11:13:17 -07:00
|
|
|
goto done;
|
2003-08-17 03:15:16 -07:00
|
|
|
|
2013-06-06 13:37:06 -07:00
|
|
|
LIST_FOR_EACH(Snapshot, &ss_list, sn)
|
2006-02-18 00:30:09 -08:00
|
|
|
{
|
|
|
|
fprintf(f, "NEW: %s\n", sn->name);
|
|
|
|
if (sn->used)
|
2009-12-03 11:29:30 -08:00
|
|
|
fprintf(f, "WIN: %#x\n", EwinGetClientXwin(sn->used));
|
2006-02-18 00:30:09 -08:00
|
|
|
if ((sn->match_flags & SNAP_MATCH_TITLE) && sn->win_title)
|
|
|
|
fprintf(f, "TITLE: %s\n", sn->win_title);
|
|
|
|
if ((sn->match_flags & SNAP_MATCH_NAME) && sn->win_name)
|
|
|
|
fprintf(f, "NAME: %s\n", sn->win_name);
|
|
|
|
if ((sn->match_flags & SNAP_MATCH_CLASS) && sn->win_class)
|
|
|
|
fprintf(f, "CLASS: %s\n", sn->win_class);
|
|
|
|
if ((sn->match_flags & SNAP_MATCH_ROLE) && sn->win_role)
|
|
|
|
fprintf(f, "ROLE: %s\n", sn->win_role);
|
|
|
|
if (sn->track_changes)
|
|
|
|
fprintf(f, "AUTO: yes\n");
|
|
|
|
if ((sn->use_flags & SNAP_USE_BORDER) && sn->border_name)
|
|
|
|
fprintf(f, "BORDER: %s\n", sn->border_name);
|
|
|
|
if ((sn->use_flags & SNAP_USE_COMMAND) && sn->cmd)
|
|
|
|
fprintf(f, "CMD: %s\n", sn->cmd);
|
|
|
|
if (sn->use_flags & SNAP_USE_DESK)
|
|
|
|
fprintf(f, "DESKTOP: %i\n", sn->desktop);
|
|
|
|
if (sn->use_flags & SNAP_USE_POS)
|
2008-03-24 04:12:40 -07:00
|
|
|
fprintf(f, "RES: %i %i\n", WinGetW(VROOT), WinGetH(VROOT));
|
2006-02-18 00:30:09 -08:00
|
|
|
if (sn->use_flags & SNAP_USE_SIZE)
|
|
|
|
fprintf(f, "WH: %i %i\n", sn->w, sn->h);
|
|
|
|
if (sn->use_flags & SNAP_USE_POS)
|
|
|
|
fprintf(f, "XY: %i %i %i %i\n", sn->x, sn->y, sn->area_x, sn->area_y);
|
|
|
|
if (sn->use_flags & SNAP_USE_LAYER)
|
|
|
|
fprintf(f, "LAYER: %i\n", sn->layer);
|
|
|
|
if (sn->use_flags & SNAP_USE_STICKY)
|
|
|
|
fprintf(f, "STICKY: %i\n", sn->sticky);
|
|
|
|
if (sn->use_flags & SNAP_USE_SHADED)
|
|
|
|
fprintf(f, "SHADE: %i\n", sn->shaded);
|
|
|
|
if (sn->use_flags & SNAP_USE_SKIP_LISTS)
|
|
|
|
{
|
|
|
|
fprintf(f, "SKIPTASK: %i\n", sn->skiptask);
|
|
|
|
fprintf(f, "SKIPWINLIST: %i\n", sn->skipwinlist);
|
|
|
|
fprintf(f, "SKIPFOCUS: %i\n", sn->skipfocus);
|
|
|
|
}
|
|
|
|
if (sn->use_flags & SNAP_USE_FLAGS)
|
2008-02-03 09:03:23 -08:00
|
|
|
fprintf(f, "FLAGS: %#x %#x\n", sn->flags[0], sn->flags[1]);
|
2005-01-12 15:10:24 -08:00
|
|
|
#if USE_COMPOSITE
|
2006-02-18 00:30:09 -08:00
|
|
|
if (sn->use_flags & SNAP_USE_OPACITY)
|
2006-11-03 15:44:32 -08:00
|
|
|
fprintf(f, "OPACITY: %i %i\n", sn->opacity, sn->focused_opacity);
|
2006-02-18 00:30:09 -08:00
|
|
|
if (sn->use_flags & SNAP_USE_SHADOW)
|
|
|
|
fprintf(f, "SHADOW: %i\n", sn->shadow);
|
2005-01-12 15:10:24 -08:00
|
|
|
#endif
|
2006-02-18 00:30:09 -08:00
|
|
|
if (sn->groups)
|
|
|
|
{
|
|
|
|
for (j = 0; j < sn->num_groups; j++)
|
|
|
|
fprintf(f, "GROUP: %i\n", sn->groups[j]);
|
|
|
|
}
|
|
|
|
fprintf(f, "\n");
|
|
|
|
}
|
2003-08-17 03:15:16 -07:00
|
|
|
|
1999-08-17 15:56:46 -07:00
|
|
|
fclose(f);
|
2003-08-17 03:15:16 -07:00
|
|
|
|
2004-12-28 15:46:49 -08:00
|
|
|
Esnprintf(buf, sizeof(buf), "%s.snapshots", EGetSavePrefix());
|
|
|
|
|
2006-11-19 13:55:52 -08:00
|
|
|
if (EDebug(EDBUG_TYPE_SNAPS))
|
2008-10-18 09:00:14 -07:00
|
|
|
Eprintf("SnapshotsSaveReal: %s\n", buf);
|
2004-03-20 07:49:05 -08:00
|
|
|
E_mv(s, buf);
|
1999-08-17 15:56:46 -07:00
|
|
|
if (!isfile(buf))
|
2010-05-09 12:03:19 -07:00
|
|
|
Alert(_("Error saving snaps file"));
|
2003-08-17 03:15:16 -07:00
|
|
|
|
2008-10-18 09:13:54 -07:00
|
|
|
GroupsSave();
|
2008-05-24 11:13:17 -07:00
|
|
|
|
|
|
|
done:
|
|
|
|
TIMER_DEL(ss_timer);
|
1999-08-17 15:56:46 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2008-10-18 09:00:14 -07:00
|
|
|
SnapshotsSpawn(void)
|
1999-08-17 15:56:46 -07:00
|
|
|
{
|
2006-02-18 00:30:09 -08:00
|
|
|
Snapshot *sn;
|
1999-08-17 15:56:46 -07:00
|
|
|
|
2013-06-06 13:37:06 -07:00
|
|
|
LIST_FOR_EACH(Snapshot, &ss_list, sn)
|
2006-02-18 00:30:09 -08:00
|
|
|
{
|
|
|
|
if ((sn->use_flags & SNAP_USE_COMMAND) && (sn->cmd) &&
|
|
|
|
!sn->used && !(sn->match_flags & SNAP_MATCH_MULTIPLE))
|
|
|
|
{
|
|
|
|
sn->startup_id = ++Mode.apps.startup_id;
|
2013-04-03 12:54:05 -07:00
|
|
|
Espawn(sn->cmd);
|
2006-02-18 00:30:09 -08:00
|
|
|
}
|
|
|
|
}
|
1999-08-17 15:56:46 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/* load all snapped info */
|
2010-04-02 08:28:20 -07:00
|
|
|
static int
|
|
|
|
_SnapshotsLoad(FILE * fs)
|
1999-08-17 15:56:46 -07:00
|
|
|
{
|
|
|
|
Snapshot *sn = NULL;
|
2005-10-29 18:05:26 -07:00
|
|
|
char buf[4096], *s;
|
|
|
|
int res_w, res_h, a, b, c, d;
|
1999-08-17 15:56:46 -07:00
|
|
|
|
2008-03-24 04:12:40 -07:00
|
|
|
res_w = WinGetW(VROOT);
|
|
|
|
res_h = WinGetH(VROOT);
|
2010-04-02 08:28:20 -07:00
|
|
|
while (fgets(buf, sizeof(buf), fs))
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2005-10-29 18:05:26 -07:00
|
|
|
s = strchr(buf, ':');
|
|
|
|
if (!s)
|
2005-10-27 13:38:12 -07:00
|
|
|
continue;
|
2005-10-29 18:05:26 -07:00
|
|
|
*s++ = '\0';
|
|
|
|
s = Estrtrim(s);
|
|
|
|
if (!buf[0] || !s[0])
|
|
|
|
continue;
|
|
|
|
if (!strcmp(buf, "NEW"))
|
2003-05-22 12:15:03 -07:00
|
|
|
{
|
2008-03-24 04:12:40 -07:00
|
|
|
res_w = WinGetW(VROOT);
|
|
|
|
res_h = WinGetH(VROOT);
|
2008-10-18 09:00:14 -07:00
|
|
|
sn = _SnapCreate(s);
|
2003-05-22 12:15:03 -07:00
|
|
|
}
|
|
|
|
else if (sn)
|
|
|
|
{
|
2005-10-29 18:05:26 -07:00
|
|
|
if (!strcmp(buf, "WIN"))
|
2005-10-29 12:57:06 -07:00
|
|
|
{
|
2005-10-29 18:05:26 -07:00
|
|
|
sn->win = strtoul(s, NULL, 0);
|
2005-10-29 12:57:06 -07:00
|
|
|
}
|
2005-10-29 18:05:26 -07:00
|
|
|
else if (!strcmp(buf, "TITLE"))
|
2005-09-23 09:12:13 -07:00
|
|
|
{
|
2005-10-29 18:05:26 -07:00
|
|
|
sn->win_title = Estrdup(s);
|
2005-09-23 09:12:13 -07:00
|
|
|
sn->match_flags |= SNAP_MATCH_TITLE;
|
|
|
|
}
|
2005-10-29 18:05:26 -07:00
|
|
|
else if (!strcmp(buf, "NAME"))
|
2005-09-23 09:12:13 -07:00
|
|
|
{
|
2005-10-29 18:05:26 -07:00
|
|
|
sn->win_name = Estrdup(s);
|
2005-09-23 09:12:13 -07:00
|
|
|
sn->match_flags |= SNAP_MATCH_NAME;
|
|
|
|
}
|
2005-10-29 18:05:26 -07:00
|
|
|
else if (!strcmp(buf, "CLASS"))
|
2005-09-23 09:12:13 -07:00
|
|
|
{
|
2005-10-29 18:05:26 -07:00
|
|
|
sn->win_class = Estrdup(s);
|
2005-09-23 09:12:13 -07:00
|
|
|
sn->match_flags |= SNAP_MATCH_CLASS;
|
|
|
|
}
|
2005-10-29 18:05:26 -07:00
|
|
|
else if (!strcmp(buf, "ROLE"))
|
2005-09-23 09:12:13 -07:00
|
|
|
{
|
2005-10-29 18:05:26 -07:00
|
|
|
sn->win_role = Estrdup(s);
|
2005-09-23 09:12:13 -07:00
|
|
|
sn->match_flags |= SNAP_MATCH_ROLE;
|
|
|
|
}
|
2005-10-29 18:05:26 -07:00
|
|
|
else if (!strcmp(buf, "AUTO"))
|
|
|
|
{
|
|
|
|
sn->track_changes = 1;
|
|
|
|
}
|
|
|
|
else if (!strcmp(buf, "BORDER"))
|
2005-02-15 14:19:52 -08:00
|
|
|
{
|
|
|
|
sn->use_flags |= SNAP_USE_BORDER;
|
2005-10-29 18:05:26 -07:00
|
|
|
sn->border_name = Estrdup(s);
|
2005-02-15 14:19:52 -08:00
|
|
|
}
|
2005-10-29 18:05:26 -07:00
|
|
|
else if (!strcmp(buf, "CMD"))
|
2003-05-22 12:15:03 -07:00
|
|
|
{
|
2005-02-15 14:19:52 -08:00
|
|
|
sn->use_flags |= SNAP_USE_COMMAND;
|
2005-10-29 18:05:26 -07:00
|
|
|
sn->cmd = Estrdup(s);
|
2003-05-22 12:15:03 -07:00
|
|
|
}
|
2005-10-29 18:05:26 -07:00
|
|
|
else if (!strcmp(buf, "DESKTOP"))
|
2003-05-22 12:15:03 -07:00
|
|
|
{
|
2005-02-15 14:19:52 -08:00
|
|
|
sn->use_flags |= SNAP_USE_DESK;
|
2003-05-22 12:15:03 -07:00
|
|
|
sn->desktop = atoi(s);
|
|
|
|
}
|
2005-10-29 18:05:26 -07:00
|
|
|
else if (!strcmp(buf, "RES"))
|
2003-05-22 12:15:03 -07:00
|
|
|
{
|
2005-10-29 18:05:26 -07:00
|
|
|
if (sscanf(s, "%u %u", &a, &b) < 2)
|
|
|
|
continue;
|
|
|
|
if (a <= 0 || b <= 0)
|
|
|
|
continue;
|
|
|
|
res_w = a;
|
|
|
|
res_h = b;
|
2003-05-22 12:15:03 -07:00
|
|
|
}
|
2005-10-29 18:05:26 -07:00
|
|
|
else if (!strcmp(buf, "WH"))
|
2003-05-22 12:15:03 -07:00
|
|
|
{
|
2005-10-29 18:05:26 -07:00
|
|
|
if (sscanf(s, "%u %u", &a, &b) < 2)
|
|
|
|
continue;
|
|
|
|
if (a <= 0 || b <= 0)
|
|
|
|
continue;
|
2005-02-15 14:19:52 -08:00
|
|
|
sn->use_flags |= SNAP_USE_SIZE;
|
2005-10-29 18:05:26 -07:00
|
|
|
sn->w = a;
|
|
|
|
sn->h = b;
|
2003-05-22 12:15:03 -07:00
|
|
|
}
|
2005-10-29 18:05:26 -07:00
|
|
|
else if (!strcmp(buf, "XY"))
|
2003-05-22 12:15:03 -07:00
|
|
|
{
|
2005-10-29 18:05:26 -07:00
|
|
|
if (sscanf(s, "%d %d %u %u", &a, &b, &c, &d) < 4)
|
|
|
|
continue;
|
2005-02-15 14:19:52 -08:00
|
|
|
sn->use_flags |= SNAP_USE_POS;
|
2005-10-29 18:05:26 -07:00
|
|
|
sn->x = a;
|
|
|
|
sn->y = b;
|
2003-05-22 12:15:03 -07:00
|
|
|
/* we changed reses since we last used this snapshot file */
|
2008-03-24 04:12:40 -07:00
|
|
|
if (res_w != WinGetW(VROOT))
|
2003-05-22 12:15:03 -07:00
|
|
|
{
|
2005-02-15 14:19:52 -08:00
|
|
|
if (sn->use_flags & SNAP_USE_SIZE)
|
2003-05-22 12:15:03 -07:00
|
|
|
{
|
|
|
|
if ((res_w - sn->w) <= 0)
|
|
|
|
sn->x = 0;
|
|
|
|
else
|
|
|
|
sn->x =
|
2008-03-24 04:12:40 -07:00
|
|
|
(sn->x * (WinGetW(VROOT) - sn->w)) /
|
|
|
|
(res_w - sn->w);
|
2003-05-22 12:15:03 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-03-24 04:12:40 -07:00
|
|
|
if (sn->x >= WinGetW(VROOT))
|
|
|
|
sn->x = WinGetW(VROOT) - 32;
|
2003-05-22 12:15:03 -07:00
|
|
|
}
|
|
|
|
}
|
2008-03-24 04:12:40 -07:00
|
|
|
if (res_h != WinGetH(VROOT))
|
2003-05-22 12:15:03 -07:00
|
|
|
{
|
2005-02-15 14:19:52 -08:00
|
|
|
if (sn->use_flags & SNAP_USE_SIZE)
|
2003-05-22 12:15:03 -07:00
|
|
|
{
|
|
|
|
if ((res_h - sn->h) <= 0)
|
|
|
|
sn->y = 0;
|
|
|
|
else
|
|
|
|
sn->y =
|
2008-03-24 04:12:40 -07:00
|
|
|
(sn->y * (WinGetH(VROOT) - sn->h)) /
|
|
|
|
(res_h - sn->h);
|
2003-05-22 12:15:03 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-03-24 04:12:40 -07:00
|
|
|
if (sn->y >= WinGetH(VROOT))
|
|
|
|
sn->y = WinGetH(VROOT) - 32;
|
2003-05-22 12:15:03 -07:00
|
|
|
}
|
|
|
|
}
|
2005-10-29 18:05:26 -07:00
|
|
|
sn->area_x = c;
|
|
|
|
sn->area_y = d;
|
2003-05-22 12:15:03 -07:00
|
|
|
}
|
2005-10-29 18:05:26 -07:00
|
|
|
else if (!strcmp(buf, "LAYER"))
|
2003-05-22 12:15:03 -07:00
|
|
|
{
|
2005-02-15 14:19:52 -08:00
|
|
|
sn->use_flags |= SNAP_USE_LAYER;
|
2003-05-22 12:15:03 -07:00
|
|
|
sn->layer = atoi(s);
|
|
|
|
}
|
2005-10-29 18:05:26 -07:00
|
|
|
else if (!strcmp(buf, "STICKY"))
|
2003-05-22 12:15:03 -07:00
|
|
|
{
|
2005-02-15 14:19:52 -08:00
|
|
|
sn->use_flags |= SNAP_USE_STICKY;
|
2003-05-22 12:15:03 -07:00
|
|
|
sn->sticky = atoi(s);
|
|
|
|
}
|
2005-10-29 18:05:26 -07:00
|
|
|
else if (!strcmp(buf, "SHADE"))
|
2005-02-15 14:19:52 -08:00
|
|
|
{
|
|
|
|
sn->use_flags |= SNAP_USE_SHADED;
|
|
|
|
sn->shaded = atoi(s);
|
|
|
|
}
|
2005-10-29 18:05:26 -07:00
|
|
|
else if (!strcmp(buf, "SKIPFOCUS"))
|
2003-05-22 12:15:03 -07:00
|
|
|
{
|
2005-02-15 14:19:52 -08:00
|
|
|
sn->use_flags |= SNAP_USE_SKIP_LISTS;
|
2003-05-22 12:15:03 -07:00
|
|
|
sn->skipfocus = atoi(s);
|
|
|
|
}
|
2005-10-29 18:05:26 -07:00
|
|
|
else if (!strcmp(buf, "SKIPTASK"))
|
2003-05-22 12:15:03 -07:00
|
|
|
{
|
2005-02-15 14:19:52 -08:00
|
|
|
sn->use_flags |= SNAP_USE_SKIP_LISTS;
|
2003-05-22 12:15:03 -07:00
|
|
|
sn->skiptask = atoi(s);
|
|
|
|
}
|
2005-10-29 18:05:26 -07:00
|
|
|
else if (!strcmp(buf, "SKIPWINLIST"))
|
2003-05-22 12:15:03 -07:00
|
|
|
{
|
2005-02-15 14:19:52 -08:00
|
|
|
sn->use_flags |= SNAP_USE_SKIP_LISTS;
|
2003-05-22 12:15:03 -07:00
|
|
|
sn->skipwinlist = atoi(s);
|
|
|
|
}
|
2005-11-18 23:39:30 -08:00
|
|
|
else if (!strcmp(buf, "FLAGS"))
|
2003-05-22 12:15:03 -07:00
|
|
|
{
|
2005-11-18 23:39:30 -08:00
|
|
|
sn->use_flags |= SNAP_USE_FLAGS;
|
2008-02-03 09:03:23 -08:00
|
|
|
sn->flags[0] = sn->flags[1] = 0;
|
|
|
|
sscanf(s, "%i %i", sn->flags, sn->flags + 1);
|
2003-05-22 12:15:03 -07:00
|
|
|
}
|
2005-10-29 18:05:26 -07:00
|
|
|
else if (!strcmp(buf, "GROUP"))
|
2003-05-22 12:15:03 -07:00
|
|
|
{
|
2008-10-18 09:05:04 -07:00
|
|
|
sn->use_flags |= SNAP_USE_GROUPS;
|
2003-05-22 12:15:03 -07:00
|
|
|
sn->num_groups++;
|
2007-01-16 17:10:44 -08:00
|
|
|
sn->groups = EREALLOC(int, sn->groups, sn->num_groups);
|
2003-05-22 12:15:03 -07:00
|
|
|
|
|
|
|
sn->groups[sn->num_groups - 1] = atoi(s);
|
2008-10-18 09:16:47 -07:00
|
|
|
GroupRemember(sn->groups[sn->num_groups - 1]);
|
2003-05-22 12:15:03 -07:00
|
|
|
}
|
2005-01-12 15:10:24 -08:00
|
|
|
#if USE_COMPOSITE
|
2005-10-29 18:05:26 -07:00
|
|
|
else if (!strcmp(buf, "OPACITY"))
|
2005-01-12 15:10:24 -08:00
|
|
|
{
|
2005-02-15 14:19:52 -08:00
|
|
|
sn->use_flags |= SNAP_USE_OPACITY;
|
2006-04-02 01:45:40 -08:00
|
|
|
a = 100;
|
2006-11-03 15:44:32 -08:00
|
|
|
b = 100;
|
2006-04-02 01:45:40 -08:00
|
|
|
sscanf(s, "%i %i", &a, &b);
|
2006-11-03 15:44:32 -08:00
|
|
|
if (b == 1)
|
|
|
|
b = 100; /* BW compat - focused is opaque */
|
2006-04-02 01:45:40 -08:00
|
|
|
sn->opacity = a;
|
2006-11-03 15:44:32 -08:00
|
|
|
sn->focused_opacity = b;
|
2005-01-12 15:10:24 -08:00
|
|
|
}
|
2005-10-29 18:05:26 -07:00
|
|
|
else if (!strcmp(buf, "SHADOW"))
|
2005-01-12 15:10:24 -08:00
|
|
|
{
|
2005-02-15 14:19:52 -08:00
|
|
|
sn->use_flags |= SNAP_USE_SHADOW;
|
2005-01-12 15:10:24 -08:00
|
|
|
sn->shadow = atoi(s);
|
|
|
|
}
|
|
|
|
#endif
|
2003-05-22 12:15:03 -07:00
|
|
|
}
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
2010-04-02 08:28:20 -07:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
SnapshotsLoad(void)
|
|
|
|
{
|
|
|
|
char s[4096];
|
|
|
|
|
|
|
|
GroupsLoad();
|
|
|
|
|
|
|
|
Esnprintf(s, sizeof(s), "%s.snapshots", EGetSavePrefix());
|
|
|
|
|
|
|
|
ConfigFileLoad(s, NULL, _SnapshotsLoad, 0);
|
1999-08-17 15:56:46 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/* make a client window conform to snapshot info */
|
|
|
|
void
|
2005-10-29 08:35:39 -07:00
|
|
|
SnapshotEwinApply(EWin * ewin)
|
1999-08-17 15:56:46 -07:00
|
|
|
{
|
|
|
|
Snapshot *sn;
|
2008-11-08 07:47:09 -08:00
|
|
|
int ax, ay;
|
2005-11-05 09:12:53 -08:00
|
|
|
unsigned int use_flags;
|
1999-08-17 15:56:46 -07:00
|
|
|
|
2008-10-18 09:00:14 -07:00
|
|
|
_SnapEwinFind(ewin); /* Find a saved settings match */
|
|
|
|
|
2005-10-29 08:35:39 -07:00
|
|
|
sn = ewin->snap;
|
1999-08-17 15:56:46 -07:00
|
|
|
if (!sn)
|
2005-10-30 14:55:45 -08:00
|
|
|
{
|
|
|
|
if (ewin->props.autosave)
|
2008-10-18 09:00:14 -07:00
|
|
|
_EwinSnapSet(ewin, SNAP_MATCH_DEFAULT, SNAP_USE_ALL | SNAP_AUTO);
|
2005-10-30 14:55:45 -08:00
|
|
|
return;
|
|
|
|
}
|
2004-06-18 13:12:10 -07:00
|
|
|
|
2005-03-04 14:31:56 -08:00
|
|
|
if (ewin->props.autosave)
|
|
|
|
sn->track_changes = 1;
|
|
|
|
|
2005-11-05 09:12:53 -08:00
|
|
|
use_flags = sn->use_flags;
|
|
|
|
/* If restarting don't override stuff set in attributes/properties */
|
|
|
|
if (ewin->state.identified)
|
2006-04-02 01:45:40 -08:00
|
|
|
use_flags &= SNAP_USE_LAYER | SNAP_USE_SHADOW | SNAP_USE_GROUPS |
|
|
|
|
SNAP_USE_OPACITY;
|
2005-11-05 09:12:53 -08:00
|
|
|
|
|
|
|
if (use_flags & SNAP_USE_STICKY)
|
2004-12-28 15:46:49 -08:00
|
|
|
EoSetSticky(ewin, sn->sticky);
|
2004-06-18 13:12:10 -07:00
|
|
|
|
2005-11-05 09:12:53 -08:00
|
|
|
if (use_flags & SNAP_USE_DESK)
|
2009-09-10 07:34:06 -07:00
|
|
|
EoSetDesk(ewin, DeskGetValid(sn->desktop));
|
2004-06-18 13:12:10 -07:00
|
|
|
|
2005-11-05 09:12:53 -08:00
|
|
|
if (use_flags & SNAP_USE_SIZE)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
ewin->client.w = sn->w;
|
|
|
|
ewin->client.h = sn->h;
|
2008-06-22 15:54:49 -07:00
|
|
|
ewin->state.maximized_horz = ewin->state.maximized_vert = 0;
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
2004-06-18 13:12:10 -07:00
|
|
|
|
2005-11-05 09:12:53 -08:00
|
|
|
if (use_flags & SNAP_USE_POS)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2005-07-08 09:48:19 -07:00
|
|
|
ewin->state.placed = 1;
|
2003-05-22 12:15:03 -07:00
|
|
|
ewin->client.x = sn->x;
|
|
|
|
ewin->client.y = sn->y;
|
2005-03-06 03:40:56 -08:00
|
|
|
#if 0 /* No, do later in EwinDetermineArea() */
|
2004-06-18 13:12:10 -07:00
|
|
|
ewin->area_x = sn->area_x;
|
|
|
|
ewin->area_y = sn->area_y;
|
2005-03-06 03:40:56 -08:00
|
|
|
#endif
|
2004-12-28 15:46:49 -08:00
|
|
|
if (!EoIsSticky(ewin))
|
2003-05-22 12:15:03 -07:00
|
|
|
{
|
2004-12-28 15:46:49 -08:00
|
|
|
DeskGetArea(EoGetDesk(ewin), &ax, &ay);
|
2008-03-24 04:12:40 -07:00
|
|
|
ewin->client.x += ((sn->area_x - ax) * WinGetW(VROOT));
|
|
|
|
ewin->client.y += ((sn->area_y - ay) * WinGetH(VROOT));
|
2003-05-22 12:15:03 -07:00
|
|
|
}
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
2004-06-18 13:12:10 -07:00
|
|
|
|
2005-11-05 09:12:53 -08:00
|
|
|
if (use_flags & SNAP_USE_LAYER)
|
2004-12-28 15:46:49 -08:00
|
|
|
EoSetLayer(ewin, sn->layer);
|
2004-06-18 13:12:10 -07:00
|
|
|
|
2005-11-05 09:12:53 -08:00
|
|
|
if (use_flags & SNAP_USE_SKIP_LISTS)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2005-07-08 09:48:19 -07:00
|
|
|
ewin->props.skip_focuslist = sn->skipfocus;
|
|
|
|
ewin->props.skip_ext_task = sn->skiptask;
|
|
|
|
ewin->props.skip_winlist = sn->skipwinlist;
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
2004-06-18 13:12:10 -07:00
|
|
|
|
2005-11-18 23:39:30 -08:00
|
|
|
if (use_flags & SNAP_USE_FLAGS)
|
|
|
|
EwinFlagsDecode(ewin, sn->flags);
|
2004-06-18 13:12:10 -07:00
|
|
|
|
2005-11-05 09:12:53 -08:00
|
|
|
if (use_flags & SNAP_USE_SHADED)
|
2005-07-08 09:48:19 -07:00
|
|
|
ewin->state.shaded = sn->shaded;
|
2004-06-18 13:12:10 -07:00
|
|
|
|
2005-11-05 09:12:53 -08:00
|
|
|
if (use_flags & SNAP_USE_BORDER)
|
2008-11-16 09:20:37 -08:00
|
|
|
EwinBorderSetInitially(ewin, sn->border_name);
|
2004-06-18 13:12:10 -07:00
|
|
|
|
2008-11-08 07:47:09 -08:00
|
|
|
if (use_flags & SNAP_USE_GROUPS)
|
|
|
|
GroupsEwinAdd(ewin, sn->groups, sn->num_groups);
|
2004-06-18 13:12:10 -07:00
|
|
|
|
2005-01-12 15:10:24 -08:00
|
|
|
#if USE_COMPOSITE
|
2005-11-05 09:12:53 -08:00
|
|
|
if (use_flags & SNAP_USE_OPACITY)
|
2006-04-02 01:45:40 -08:00
|
|
|
{
|
2008-02-10 12:21:53 -08:00
|
|
|
sn->opacity = OpacityFix(sn->opacity, 0);
|
2006-11-03 15:44:32 -08:00
|
|
|
sn->focused_opacity = OpacityFix(sn->focused_opacity, 0);
|
2013-02-23 03:35:49 -08:00
|
|
|
ewin->props.opacity = OpacityFromPercent(sn->opacity);
|
2006-11-03 15:44:32 -08:00
|
|
|
ewin->props.focused_opacity = OpacityFromPercent(sn->focused_opacity);
|
2013-02-23 03:35:49 -08:00
|
|
|
ewin->ewmh.opacity_update = 1; /* Set opacity on client window */
|
2006-04-02 01:45:40 -08:00
|
|
|
}
|
2005-01-12 15:10:24 -08:00
|
|
|
|
2005-11-05 09:12:53 -08:00
|
|
|
if (use_flags & SNAP_USE_SHADOW)
|
2005-01-12 15:10:24 -08:00
|
|
|
EoSetShadow(ewin, sn->shadow);
|
|
|
|
#endif
|
|
|
|
|
2006-11-19 13:55:52 -08:00
|
|
|
if (EDebug(EDBUG_TYPE_SNAPS))
|
2009-12-03 11:29:30 -08:00
|
|
|
Eprintf("Snap get snap %#x: %4d+%4d %4dx%4d: %s\n",
|
2006-08-07 13:20:16 -07:00
|
|
|
EwinGetClientXwin(ewin), ewin->client.x, ewin->client.y,
|
2006-11-26 03:30:59 -08:00
|
|
|
ewin->client.w, ewin->client.h, EwinGetTitle(ewin));
|
1999-08-17 15:56:46 -07:00
|
|
|
}
|
|
|
|
|
2005-02-18 10:03:58 -08:00
|
|
|
/* Detach snapshot from ewin */
|
2003-12-09 12:35:14 -08:00
|
|
|
void
|
2005-02-15 14:19:52 -08:00
|
|
|
SnapshotEwinUnmatch(EWin * ewin)
|
2003-12-09 12:35:14 -08:00
|
|
|
{
|
|
|
|
Snapshot *sn;
|
|
|
|
|
|
|
|
sn = ewin->snap;
|
2010-08-13 10:04:13 -07:00
|
|
|
if (!sn)
|
2003-12-09 12:35:14 -08:00
|
|
|
return;
|
|
|
|
|
|
|
|
ewin->snap = NULL;
|
2005-02-17 14:36:46 -08:00
|
|
|
sn->used = NULL;
|
2003-12-09 12:35:14 -08:00
|
|
|
}
|
|
|
|
|
1999-08-23 09:53:38 -07:00
|
|
|
void
|
2005-02-15 14:19:52 -08:00
|
|
|
SnapshotEwinParse(EWin * ewin, const char *params)
|
2005-01-12 15:10:24 -08:00
|
|
|
{
|
2007-02-25 11:03:19 -08:00
|
|
|
char param[1024];
|
|
|
|
const char *p;
|
|
|
|
int len;
|
2005-09-23 09:12:13 -07:00
|
|
|
unsigned int match_flags, use_flags;
|
2005-01-12 15:10:24 -08:00
|
|
|
|
2007-02-25 11:03:19 -08:00
|
|
|
p = params;
|
|
|
|
if (!p)
|
|
|
|
return;
|
|
|
|
|
2005-09-23 09:12:13 -07:00
|
|
|
match_flags = SNAP_MATCH_DEFAULT;
|
2005-02-15 14:19:52 -08:00
|
|
|
use_flags = 0;
|
2005-09-23 09:12:13 -07:00
|
|
|
|
2007-02-25 11:03:19 -08:00
|
|
|
for (;;)
|
2005-01-12 15:10:24 -08:00
|
|
|
{
|
2007-02-25 11:03:19 -08:00
|
|
|
param[0] = '\0';
|
|
|
|
len = 0;
|
|
|
|
sscanf(p, "%s %n", param, &len);
|
|
|
|
if (len <= 0)
|
|
|
|
break;
|
|
|
|
p += len;
|
2005-01-12 15:10:24 -08:00
|
|
|
|
|
|
|
if (!strcmp(param, "all"))
|
|
|
|
{
|
2005-02-15 14:19:52 -08:00
|
|
|
use_flags = SNAP_USE_ALL;
|
2005-01-12 15:10:24 -08:00
|
|
|
}
|
2009-01-24 00:31:50 -08:00
|
|
|
#if ENABLE_DIALOGS
|
2005-01-12 15:10:24 -08:00
|
|
|
else if (!strcmp(param, "dialog"))
|
|
|
|
{
|
2008-10-18 09:00:14 -07:00
|
|
|
_EwinSnapDialog(ewin);
|
2005-01-12 15:10:24 -08:00
|
|
|
break;
|
|
|
|
}
|
2009-01-24 00:31:50 -08:00
|
|
|
#endif
|
2005-01-12 15:10:24 -08:00
|
|
|
else if (!strcmp(param, "none"))
|
2008-10-18 09:00:14 -07:00
|
|
|
_EwinSnapRemove(ewin);
|
2005-02-15 14:19:52 -08:00
|
|
|
else if (!strcmp(param, "auto"))
|
|
|
|
use_flags |= SNAP_AUTO;
|
2005-01-12 15:10:24 -08:00
|
|
|
else if (!strcmp(param, "border"))
|
2005-02-15 14:19:52 -08:00
|
|
|
use_flags |= SNAP_USE_BORDER;
|
2005-01-12 15:10:24 -08:00
|
|
|
else if (!strcmp(param, "command"))
|
2005-02-15 14:19:52 -08:00
|
|
|
use_flags |= SNAP_USE_COMMAND;
|
2005-01-12 15:10:24 -08:00
|
|
|
else if (!strcmp(param, "desktop"))
|
2005-02-15 14:19:52 -08:00
|
|
|
use_flags |= SNAP_USE_DESK;
|
2005-01-12 15:10:24 -08:00
|
|
|
else if (!strcmp(param, "location"))
|
2005-02-15 14:19:52 -08:00
|
|
|
use_flags |= SNAP_USE_POS;
|
2005-01-12 15:10:24 -08:00
|
|
|
else if (!strcmp(param, "size"))
|
2005-02-15 14:19:52 -08:00
|
|
|
use_flags |= SNAP_USE_SIZE;
|
|
|
|
else if (!strcmp(param, "layer"))
|
|
|
|
use_flags |= SNAP_USE_LAYER;
|
2005-01-12 15:10:24 -08:00
|
|
|
else if (!strcmp(param, "shade"))
|
2005-02-15 14:19:52 -08:00
|
|
|
use_flags |= SNAP_USE_SHADED;
|
2005-01-12 15:10:24 -08:00
|
|
|
else if (!strcmp(param, "sticky"))
|
2005-02-15 14:19:52 -08:00
|
|
|
use_flags |= SNAP_USE_STICKY;
|
2005-01-12 15:10:24 -08:00
|
|
|
#if USE_COMPOSITE
|
|
|
|
else if (!strcmp(param, "opacity"))
|
2005-02-15 14:19:52 -08:00
|
|
|
use_flags |= SNAP_USE_OPACITY;
|
2005-01-12 15:10:24 -08:00
|
|
|
else if (!strcmp(param, "shadow"))
|
2005-02-15 14:19:52 -08:00
|
|
|
use_flags |= SNAP_USE_SHADOW;
|
2005-01-12 15:10:24 -08:00
|
|
|
#endif
|
2005-02-15 14:19:52 -08:00
|
|
|
else if (!strcmp(param, "group"))
|
|
|
|
use_flags |= SNAP_USE_GROUPS;
|
2005-01-12 15:10:24 -08:00
|
|
|
}
|
|
|
|
|
2005-02-15 14:19:52 -08:00
|
|
|
if (ewin->snap)
|
2005-09-23 09:12:13 -07:00
|
|
|
{
|
|
|
|
match_flags = ewin->snap->match_flags;
|
|
|
|
use_flags |= ewin->snap->use_flags;
|
|
|
|
}
|
|
|
|
|
2008-10-18 09:00:14 -07:00
|
|
|
_EwinSnapSet(ewin, match_flags, use_flags);
|
2005-02-15 14:19:52 -08:00
|
|
|
|
2008-10-18 09:00:14 -07:00
|
|
|
SnapshotsSave();
|
1999-08-23 09:53:38 -07:00
|
|
|
}
|
2005-01-12 15:10:24 -08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* IPC functions
|
|
|
|
* A bit ugly...
|
|
|
|
*/
|
2008-10-18 09:00:14 -07:00
|
|
|
const char SnapshotsIpcText[] =
|
2005-01-12 15:10:24 -08:00
|
|
|
"usage:\n" " list_remember [full]\n"
|
|
|
|
" Retrieve a list of remembered windows. with full, the list\n"
|
|
|
|
" includes the window's remembered attributes\n";
|
|
|
|
|
2005-02-15 14:19:52 -08:00
|
|
|
#define SS(s) ((s) ? (s) : NoText)
|
|
|
|
static const char NoText[] = "-NONE-";
|
|
|
|
|
2006-02-18 00:30:09 -08:00
|
|
|
static void
|
|
|
|
_SnapShow(void *data, void *prm)
|
2005-01-12 15:10:24 -08:00
|
|
|
{
|
2007-01-16 17:10:44 -08:00
|
|
|
Snapshot *sn = (Snapshot *) data;
|
2010-08-21 07:39:55 -07:00
|
|
|
int full = ! !prm;
|
2006-02-18 00:30:09 -08:00
|
|
|
char buf[FILEPATH_LEN_MAX];
|
2005-09-23 09:12:13 -07:00
|
|
|
const char *name;
|
2005-01-12 15:10:24 -08:00
|
|
|
|
2006-02-18 00:30:09 -08:00
|
|
|
name = (sn->name) ? sn->name : "???";
|
2005-01-12 15:10:24 -08:00
|
|
|
|
2006-02-18 00:30:09 -08:00
|
|
|
if (!full)
|
2005-01-12 15:10:24 -08:00
|
|
|
{
|
2006-02-18 00:30:09 -08:00
|
|
|
if (sn->used)
|
|
|
|
IpcPrintf("%s\n", name);
|
|
|
|
else
|
|
|
|
IpcPrintf("%s (unused)\n", name);
|
|
|
|
return;
|
2005-01-12 15:10:24 -08:00
|
|
|
}
|
|
|
|
|
2006-02-18 00:30:09 -08:00
|
|
|
#define SU(sn, item) ((sn->match_flags & item) ? '>' : ':')
|
2005-01-12 15:10:24 -08:00
|
|
|
|
2006-02-18 00:30:09 -08:00
|
|
|
if (sn->used)
|
2009-12-03 11:29:30 -08:00
|
|
|
Esnprintf(buf, sizeof(buf), "In use - %#x", EwinGetClientXwin(sn->used));
|
2006-02-18 00:30:09 -08:00
|
|
|
else
|
|
|
|
Esnprintf(buf, sizeof(buf), "*** Unused ***");
|
|
|
|
IpcPrintf(" Snapshot Name: %s %s\n", name, buf);
|
|
|
|
if (sn->win_title)
|
|
|
|
IpcPrintf(" Window Title%c %s\n", SU(sn, SNAP_MATCH_TITLE),
|
|
|
|
sn->win_title);
|
|
|
|
if (sn->win_name)
|
|
|
|
IpcPrintf(" Window Name%c %s\n", SU(sn, SNAP_MATCH_NAME),
|
|
|
|
sn->win_name);
|
|
|
|
if (sn->win_class)
|
|
|
|
IpcPrintf(" Window Class%c %s\n", SU(sn, SNAP_MATCH_CLASS),
|
|
|
|
sn->win_class);
|
|
|
|
if (sn->win_role)
|
|
|
|
IpcPrintf(" Window Role%c %s\n", SU(sn, SNAP_MATCH_ROLE),
|
|
|
|
sn->win_role);
|
|
|
|
|
|
|
|
if (sn->track_changes)
|
|
|
|
IpcPrintf(" Tracking changes\n");
|
|
|
|
if (sn->use_flags & SNAP_USE_BORDER)
|
|
|
|
IpcPrintf(" Border Name: %s\n", SS(sn->border_name));
|
|
|
|
if (sn->use_flags & SNAP_USE_DESK)
|
|
|
|
IpcPrintf(" desktop: %d\n", sn->desktop);
|
|
|
|
if (sn->use_flags & SNAP_USE_POS)
|
|
|
|
IpcPrintf(" (x, y): %d, %d area (x, y): %d, %d\n",
|
|
|
|
sn->x, sn->y, sn->area_x, sn->area_y);
|
|
|
|
if (sn->use_flags & SNAP_USE_SIZE)
|
|
|
|
IpcPrintf(" (w, h): %d, %d\n", sn->w, sn->h);
|
|
|
|
if (sn->use_flags & SNAP_USE_LAYER)
|
|
|
|
IpcPrintf(" layer: %d\n", sn->layer);
|
|
|
|
if (sn->use_flags & SNAP_USE_STICKY)
|
|
|
|
IpcPrintf(" sticky: %d\n", sn->sticky);
|
|
|
|
if (sn->use_flags & SNAP_USE_SHADED)
|
|
|
|
IpcPrintf(" shade: %d\n", sn->shaded);
|
|
|
|
if (sn->use_flags & SNAP_USE_COMMAND)
|
|
|
|
IpcPrintf(" command: %s\n", SS(sn->cmd));
|
|
|
|
if (sn->use_flags & SNAP_USE_SKIP_LISTS)
|
|
|
|
IpcPrintf
|
|
|
|
(" skiptask: %d skipfocus: %d skipwinlist: %d\n",
|
|
|
|
sn->skiptask, sn->skipfocus, sn->skipwinlist);
|
|
|
|
if (sn->use_flags & SNAP_USE_FLAGS)
|
2008-02-03 09:03:23 -08:00
|
|
|
IpcPrintf(" flags: %#x %#x\n", sn->flags[0], sn->flags[1]);
|
2006-02-18 00:30:09 -08:00
|
|
|
IpcPrintf("\n");
|
|
|
|
}
|
2005-01-12 15:10:24 -08:00
|
|
|
|
2006-02-18 00:30:09 -08:00
|
|
|
void
|
2008-10-18 09:00:14 -07:00
|
|
|
SnapshotsIpcFunc(const char *params)
|
2006-02-18 00:30:09 -08:00
|
|
|
{
|
|
|
|
const char *p;
|
|
|
|
char cmd[128], prm[4096];
|
|
|
|
int len;
|
2013-06-06 13:37:06 -07:00
|
|
|
Snapshot *sn;
|
2005-01-12 15:10:24 -08:00
|
|
|
|
2006-02-18 00:30:09 -08:00
|
|
|
cmd[0] = prm[0] = '\0';
|
|
|
|
p = params;
|
|
|
|
if (p)
|
|
|
|
{
|
|
|
|
len = 0;
|
|
|
|
sscanf(p, "%100s %4000s %n", cmd, prm, &len);
|
|
|
|
p += len;
|
|
|
|
}
|
2005-10-29 12:57:06 -07:00
|
|
|
|
2013-06-06 13:37:06 -07:00
|
|
|
if (LIST_IS_EMPTY(&ss_list))
|
2006-02-18 00:30:09 -08:00
|
|
|
{
|
|
|
|
IpcPrintf("No remembered windows\n");
|
|
|
|
return;
|
|
|
|
}
|
2005-02-15 14:19:52 -08:00
|
|
|
|
2006-02-18 00:30:09 -08:00
|
|
|
if (!p || cmd[0] == '?')
|
|
|
|
{
|
2013-06-06 13:37:06 -07:00
|
|
|
LIST_FOR_EACH(Snapshot, &ss_list, sn) _SnapShow(sn, NULL);
|
2006-02-18 00:30:09 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-06-06 13:37:06 -07:00
|
|
|
LIST_FOR_EACH(Snapshot, &ss_list, sn) _SnapShow(sn, (void *)1L);
|
2005-01-12 15:10:24 -08:00
|
|
|
}
|
|
|
|
}
|