Prepare for handling additional window flags in snapshots/across restart.

SVN revision: 33671
This commit is contained in:
Kim Woelders 2008-02-03 17:03:23 +00:00
parent f77768dd61
commit 62a6c2150e
4 changed files with 24 additions and 18 deletions

View File

@ -1831,8 +1831,8 @@ typedef union
} f;
} EWinMiscFlags;
unsigned int
EwinFlagsEncode(const EWin * ewin)
void
EwinFlagsEncode(const EWin * ewin, unsigned int *flags)
{
EWinMiscFlags fm;
@ -1841,15 +1841,16 @@ EwinFlagsEncode(const EWin * ewin)
fm.f.inh_user = ewin->inh_user.all;
fm.f.inh_wm = ewin->inh_wm.all;
return fm.all;
flags[0] = fm.all;
flags[1] = 0;
}
void
EwinFlagsDecode(EWin * ewin, unsigned int flags)
EwinFlagsDecode(EWin * ewin, const unsigned int *flags)
{
EWinMiscFlags fm;
fm.all = flags;
fm.all = flags[0];
ewin->inh_app.all = fm.f.inh_app;
ewin->inh_user.all = fm.f.inh_user;
ewin->inh_wm.all = fm.f.inh_wm;

View File

@ -384,8 +384,8 @@ void EwinRememberPositionGet(EWin * ewin, Desk * dsk,
int *px, int *py);
void EwinSetPlacementGravity(EWin * ewin, int x, int y);
void EwinReposition(EWin * ewin);
unsigned int EwinFlagsEncode(const EWin * ewin);
void EwinFlagsDecode(EWin * ewin, unsigned int flags);
void EwinFlagsEncode(const EWin * ewin, unsigned int *flags);
void EwinFlagsDecode(EWin * ewin, const unsigned int *flags);
void EwinUpdateOpacity(EWin * ewin);
void EwinChange(EWin * ewin, unsigned int flag);

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2003-2007 Kim Woelders
* Copyright (C) 2003-2008 Kim Woelders
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
@ -348,6 +348,7 @@ void
EHintsSetInfo(const EWin * ewin)
{
int c[ENL_DATA_ITEMS];
unsigned int flags[2];
EWinInfoFlags f;
if (EwinIsInternal(ewin))
@ -359,9 +360,9 @@ EHintsSetInfo(const EWin * ewin)
f.b.iconified = ewin->state.iconified;
c[0] = f.all;
c[1] = EwinFlagsEncode(ewin);
c[2] = 0;
EwinFlagsEncode(ewin, flags);
c[1] = flags[0];
c[2] = flags[1];
c[3] = ewin->save_max.x;
c[4] = ewin->save_max.y;
@ -391,6 +392,7 @@ EHintsGetInfo(EWin * ewin)
char *str;
int num;
int c[ENL_DATA_ITEMS + 1];
unsigned int flags[2];
EWinInfoFlags f;
if (EwinIsInternal(ewin))
@ -414,7 +416,9 @@ EHintsGetInfo(EWin * ewin)
ewin->icccm.start_iconified = f.b.iconified;
ewin->state.docked = f.b.docked;
EwinFlagsDecode(ewin, c[1]);
flags[0] = c[1];
flags[1] = c[2];
EwinFlagsDecode(ewin, flags);
if (num == ENL_DATA_ITEMS)
{

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
* Copyright (C) 2004-2007 Kim Woelders
* Copyright (C) 2004-2008 Kim Woelders
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
@ -57,7 +57,7 @@ struct _snapshot
int layer;
char sticky;
char shaded;
unsigned int flags;
unsigned int flags[2];
char *cmd;
int *groups;
int num_groups;
@ -379,7 +379,7 @@ SnapEwinSkipLists(Snapshot * sn, const EWin * ewin)
static void
SnapEwinFlags(Snapshot * sn, const EWin * ewin)
{
sn->flags = EwinFlagsEncode(ewin);
EwinFlagsEncode(ewin, sn->flags);
}
static void
@ -1156,7 +1156,7 @@ Real_SaveSnapInfo(int dumval __UNUSED__, void *dumdat __UNUSED__)
fprintf(f, "SKIPFOCUS: %i\n", sn->skipfocus);
}
if (sn->use_flags & SNAP_USE_FLAGS)
fprintf(f, "FLAGS: %#x\n", sn->flags);
fprintf(f, "FLAGS: %#x %#x\n", sn->flags[0], sn->flags[1]);
#if USE_COMPOSITE
if (sn->use_flags & SNAP_USE_OPACITY)
fprintf(f, "OPACITY: %i %i\n", sn->opacity, sn->focused_opacity);
@ -1371,7 +1371,8 @@ LoadSnapInfo(void)
else if (!strcmp(buf, "FLAGS"))
{
sn->use_flags |= SNAP_USE_FLAGS;
sn->flags = strtoul(s, NULL, 0);
sn->flags[0] = sn->flags[1] = 0;
sscanf(s, "%i %i", sn->flags, sn->flags + 1);
}
else if (!strcmp(buf, "GROUP"))
{
@ -1684,7 +1685,7 @@ _SnapShow(void *data, void *prm)
(" skiptask: %d skipfocus: %d skipwinlist: %d\n",
sn->skiptask, sn->skipfocus, sn->skipwinlist);
if (sn->use_flags & SNAP_USE_FLAGS)
IpcPrintf(" flags: %#x\n", sn->flags);
IpcPrintf(" flags: %#x %#x\n", sn->flags[0], sn->flags[1]);
IpcPrintf("\n");
}