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); MatchEwinToSM(ewin);
#endif #endif
WindowMatchEwinOps(ewin); /* Window matches */ WindowMatchEwinOps(ewin); /* Window matches */
SnapshotsApplyToEwin(ewin); /* Saved settings */
if (!EwinIsInternal(ewin) && Mode.wm.startup) if (!EwinIsInternal(ewin) && Mode.wm.startup)
EHintsGetInfo(ewin); /* E restart hints */ 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); ICCCM_Adopt(ewin);

View File

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

View File

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

View File

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

View File

@ -55,11 +55,14 @@ void Real_SaveSnapInfo(int dumval, void *dumdat);
void LoadSnapInfo(void); void LoadSnapInfo(void);
void SaveSnapInfo(void); void SaveSnapInfo(void);
void SpawnSnappedCmds(void); void SpawnSnappedCmds(void);
void SnapshotsEwinMatch(EWin * ewin);
void SnapshotEwinApply(EWin * ewin);
void SnapshotEwinUnmatch(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 SnapshotEwinParse(EWin * ewin, const char *params);
void SnapshotsApplyToEwin(EWin * ewin);
void SettingsRemember(void); void SettingsRemember(void);
extern const char SnapIpcText[]; extern const char SnapIpcText[];
void SnapIpcFunc(const char *params, Client * c); void SnapIpcFunc(const char *params, Client * c);