Client adoption changes - continued.

SVN revision: 18110
This commit is contained in:
Kim Woelders 2005-10-29 15:35:39 +00:00
parent 37350b71ee
commit 20429a1f72
6 changed files with 65 additions and 54 deletions

View File

@ -254,11 +254,13 @@ EwinConfigure(EWin * ewin)
MatchEwinToSM(ewin);
#endif
WindowMatchEwinOps(ewin); /* Window matches */
SnapshotsApplyToEwin(ewin); /* Saved settings */
if (!EwinIsInternal(ewin) && Mode.wm.startup)
EHintsGetInfo(ewin); /* E restart hints */
SnapshotsEwinMatch(ewin); /* Find a saved settings match */
if (!ewin->state.identified)
SnapshotEwinApply(ewin); /* Apply saved settings */
EwinStateUpdate(ewin); /* Update after snaps */
EwinStateUpdate(ewin); /* Update after snaps etc. */
ICCCM_Adopt(ewin);

View File

@ -63,6 +63,7 @@ struct _ewin
char shaped;
char shaded;
unsigned identified:1;
unsigned placed:1;
unsigned iconified:1;
unsigned docked:1;

View File

@ -30,6 +30,9 @@
#include "hints.h"
#include "xwin.h"
static Atom E16_WIN_DATA;
static Atom E16_WIN_BORDER;
/*
* Functions that set X11-properties from E-internals
*/
@ -58,6 +61,9 @@ HintsInit(void)
}
Mode.hints.old_root_pmap = HintsGetRootPixmap(VRoot.win);
E16_WIN_DATA = XInternAtom(disp, "ENL_INTERNAL_DATA", False);
E16_WIN_BORDER = XInternAtom(disp, "ENL_INTERNAL_DATA_BORDER", False);
}
void
@ -297,17 +303,11 @@ HintsSetRootInfo(Window win, Pixmap pmap, unsigned int color)
void
EHintsSetInfo(const EWin * ewin)
{
static Atom a = 0, aa = 0;
int c[9];
if (EwinIsInternal(ewin))
return;
if (!a)
a = XInternAtom(disp, "ENL_INTERNAL_DATA", False);
if (!aa)
aa = XInternAtom(disp, "ENL_INTERNAL_DATA_BORDER", False);
c[0] = EoGetDeskNum(ewin);
c[1] = EoIsSticky(ewin);
c[2] = EoGetX(ewin);
@ -318,10 +318,10 @@ EHintsSetInfo(const EWin * ewin)
c[7] = ewin->client.h;
c[8] = ewin->state.docked;
ecore_x_window_prop_card32_set(_EwinGetClientXwin(ewin), a,
ecore_x_window_prop_card32_set(_EwinGetClientXwin(ewin), E16_WIN_DATA,
(unsigned int *)c, 9);
ecore_x_window_prop_string_set(_EwinGetClientXwin(ewin), aa,
ecore_x_window_prop_string_set(_EwinGetClientXwin(ewin), E16_WIN_BORDER,
ewin->normal_border->name);
if (EventDebug(EDBUG_TYPE_SNAPS))
@ -330,27 +330,23 @@ EHintsSetInfo(const EWin * ewin)
ewin->client.w, ewin->client.h, EwinGetName(ewin));
}
int
void
EHintsGetInfo(EWin * ewin)
{
static Atom a = 0, aa = 0;
char *str;
int num;
int c[9];
if (EwinIsInternal(ewin))
return 0;
if (!a)
a = XInternAtom(disp, "ENL_INTERNAL_DATA", False);
if (!aa)
aa = XInternAtom(disp, "ENL_INTERNAL_DATA_BORDER", False);
return;
num =
ecore_x_window_prop_card32_get(_EwinGetClientXwin(ewin), a,
ecore_x_window_prop_card32_get(_EwinGetClientXwin(ewin), E16_WIN_DATA,
(unsigned int *)c, 9);
if (num < 8)
return 0;
return;
ewin->state.identified = 1;
EoSetDesk(ewin, DeskGet(c[0]));
EoSetSticky(ewin, c[1]);
@ -371,7 +367,8 @@ EHintsGetInfo(EWin * ewin)
}
ewin->state.placed = 1;
str = ecore_x_window_prop_string_get(_EwinGetClientXwin(ewin), aa);
str =
ecore_x_window_prop_string_get(_EwinGetClientXwin(ewin), E16_WIN_BORDER);
if (str)
EwinSetBorderByName(ewin, str);
Efree(str);
@ -380,8 +377,6 @@ EHintsGetInfo(EWin * ewin)
Eprintf("Snap get einf %#lx: %4d+%4d %4dx%4d: %s\n",
_EwinGetClientXwin(ewin), ewin->client.x, ewin->client.y,
ewin->client.w, ewin->client.h, EwinGetName(ewin));
return 0;
}
void

View File

@ -94,7 +94,7 @@ void HintsSetRootInfo(Window win, Pixmap pmap,
unsigned int color);
void EHintsSetInfo(const EWin * ewin);
int EHintsGetInfo(EWin * ewin);
void EHintsGetInfo(EWin * ewin);
void EHintsSetDeskInfo(void);
void EHintsGetDeskInfo(void);
void EHintsSetInfoOnAll(void);

View File

@ -138,7 +138,7 @@ SnapGetRole(const char *role, char *buf, int len)
#define SEQ(s1, s2) ((s1) && (s2) && !strcmp(s1, s2))
static int
SnapshotEwinMatch(Snapshot * sn, EWin * ewin)
SnapshotEwinMatch(Snapshot * sn, const EWin * ewin)
{
char buf[256], *s;
@ -194,7 +194,10 @@ SnapshotEwinFind(EWin * ewin)
continue;
if (!(sn->match_flags & SNAP_MATCH_MULTIPLE))
sn->used = ewin;
{
sn->used = ewin;
ewin->snap = sn;
}
goto done;
}
sn = NULL;
@ -274,7 +277,7 @@ SnapshotEwinGet(EWin * ewin, unsigned int match_flags)
/* record info about this Ewin's attributes */
static void
SnapEwinBorder(Snapshot * sn, EWin * ewin)
SnapEwinBorder(Snapshot * sn, const EWin * ewin)
{
if (sn->border_name)
Efree(sn->border_name);
@ -286,20 +289,20 @@ SnapEwinBorder(Snapshot * sn, EWin * ewin)
}
static void
SnapEwinDesktop(Snapshot * sn, EWin * ewin)
SnapEwinDesktop(Snapshot * sn, const EWin * ewin)
{
sn->desktop = EoGetDeskNum(ewin);
}
static void
SnapEwinSize(Snapshot * sn, EWin * ewin)
SnapEwinSize(Snapshot * sn, const EWin * ewin)
{
sn->w = ewin->client.w;
sn->h = ewin->client.h;
}
static void
SnapEwinLocation(Snapshot * sn, EWin * ewin)
SnapEwinLocation(Snapshot * sn, const EWin * ewin)
{
int ax, ay;
@ -316,25 +319,25 @@ SnapEwinLocation(Snapshot * sn, EWin * ewin)
}
static void
SnapEwinLayer(Snapshot * sn, EWin * ewin)
SnapEwinLayer(Snapshot * sn, const EWin * ewin)
{
sn->layer = EoGetLayer(ewin);
}
static void
SnapEwinSticky(Snapshot * sn, EWin * ewin)
SnapEwinSticky(Snapshot * sn, const EWin * ewin)
{
sn->sticky = EoIsSticky(ewin);
}
static void
SnapEwinShade(Snapshot * sn, EWin * ewin)
SnapEwinShade(Snapshot * sn, const EWin * ewin)
{
sn->shaded = ewin->state.shaded;
}
static void
SnapEwinSkipLists(Snapshot * sn, EWin * ewin)
SnapEwinSkipLists(Snapshot * sn, const EWin * ewin)
{
sn->skiptask = ewin->props.skip_ext_task;
sn->skipwinlist = ewin->props.skip_winlist;
@ -342,13 +345,13 @@ SnapEwinSkipLists(Snapshot * sn, EWin * ewin)
}
static void
SnapEwinNeverFocus(Snapshot * sn, EWin * ewin)
SnapEwinNeverFocus(Snapshot * sn, const EWin * ewin)
{
sn->neverfocus = ewin->props.never_focus;
}
static void
SnapEwinCmd(Snapshot * sn, EWin * ewin)
SnapEwinCmd(Snapshot * sn, const EWin * ewin)
{
if (ewin->icccm.wm_machine &&
strcmp(ewin->icccm.wm_machine, Mode.wm.machine_name))
@ -360,7 +363,7 @@ SnapEwinCmd(Snapshot * sn, EWin * ewin)
}
static void
SnapEwinGroups(Snapshot * sn, EWin * ewin, char onoff)
SnapEwinGroups(Snapshot * sn, const EWin * ewin, char onoff)
{
EWin **gwins = NULL;
Group **groups;
@ -409,7 +412,7 @@ SnapEwinGroups(Snapshot * sn, EWin * ewin, char onoff)
{
if (ewin->snap)
{
sn = SnapshotEwinFind(gwins[i]);
sn = gwins[i]->snap;
if (sn)
{
if (sn->groups)
@ -425,13 +428,13 @@ SnapEwinGroups(Snapshot * sn, EWin * ewin, char onoff)
#if USE_COMPOSITE
static void
SnapEwinOpacity(Snapshot * sn, EWin * ewin)
SnapEwinOpacity(Snapshot * sn, const EWin * ewin)
{
sn->opacity = ewin->ewmh.opacity >> 24;
}
static void
SnapEwinShadow(Snapshot * sn, EWin * ewin)
SnapEwinShadow(Snapshot * sn, const EWin * ewin)
{
sn->shadow = EoGetShadow(ewin);
}
@ -439,7 +442,7 @@ SnapEwinShadow(Snapshot * sn, EWin * ewin)
#endif
static void
SnapEwinUpdate(Snapshot * sn, EWin * ewin, unsigned int flags)
SnapEwinUpdate(Snapshot * sn, const EWin * ewin, unsigned int flags)
{
/* FIXME - We should check if anything is actually changed */
@ -497,7 +500,7 @@ SnapshotEwinSet(EWin * ewin, unsigned int match_flags, unsigned int use_flags)
}
void
SnapshotEwinUpdate(EWin * ewin, unsigned int flags)
SnapshotEwinUpdate(const EWin * ewin, unsigned int flags)
{
Snapshot *sn;
@ -634,7 +637,7 @@ CB_ApplySnap(Dialog * d, int val, void *data __UNUSED__)
}
static void
SnapshotEwinDialog(EWin * ewin)
SnapshotEwinDialog(const EWin * ewin)
{
Dialog *d;
DItem *table, *di;
@ -1382,22 +1385,29 @@ LoadSnapInfo(void)
fclose(f);
}
void
SnapshotsEwinMatch(EWin * ewin)
{
Snapshot *sn;
sn = SnapshotEwinFind(ewin);
if (sn)
return;
if (ewin->props.autosave)
SnapshotEwinSet(ewin, SNAP_MATCH_DEFAULT, SNAP_USE_ALL | SNAP_AUTO);
}
/* make a client window conform to snapshot info */
void
SnapshotsApplyToEwin(EWin * ewin)
SnapshotEwinApply(EWin * ewin)
{
Snapshot *sn;
int i, ax, ay;
sn = SnapshotEwinFind(ewin);
sn = ewin->snap;
if (!sn)
{
if (ewin->props.autosave)
SnapshotEwinSet(ewin, SNAP_MATCH_DEFAULT, SNAP_USE_ALL | SNAP_AUTO);
return;
}
ewin->snap = sn;
return;
if (ewin->props.autosave)
sn->track_changes = 1;

View File

@ -55,11 +55,14 @@ void Real_SaveSnapInfo(int dumval, void *dumdat);
void LoadSnapInfo(void);
void SaveSnapInfo(void);
void SpawnSnappedCmds(void);
void SnapshotsEwinMatch(EWin * ewin);
void SnapshotEwinApply(EWin * ewin);
void SnapshotEwinUnmatch(EWin * ewin);
void SnapshotEwinUpdate(EWin * ewin, unsigned int flags);
void SnapshotEwinUpdate(const EWin * ewin, unsigned int flags);
void SnapshotEwinParse(EWin * ewin, const char *params);
void SnapshotsApplyToEwin(EWin * ewin);
void SettingsRemember(void);
extern const char SnapIpcText[];
void SnapIpcFunc(const char *params, Client * c);