From ccb844716d526f6203bbc81ffdbfaae6c833bc8c Mon Sep 17 00:00:00 2001 From: Kim Woelders Date: Fri, 23 Sep 2005 16:12:13 +0000 Subject: [PATCH] Provide control over match conditions for saved settings. SVN revision: 16871 --- src/E.h | 14 --- src/ewins.c | 2 +- src/ewins.h | 4 +- src/ipc.c | 1 + src/main.c | 1 + src/mod-misc.c | 1 + src/session.c | 1 + src/snaps.c | 335 +++++++++++++++++++++++++++++++++---------------- src/snaps.h | 23 ++++ 9 files changed, 259 insertions(+), 123 deletions(-) diff --git a/src/E.h b/src/E.h index 5177dac5..d777fbe0 100644 --- a/src/E.h +++ b/src/E.h @@ -326,7 +326,6 @@ int Esnprintf(va_alist); typedef struct _ewin EWin; typedef struct _dialog Dialog; typedef struct _ditem DItem; -typedef struct _snapshot Snapshot; typedef struct _group Group; typedef struct _background Background; typedef struct _ecursor ECursor; @@ -1627,19 +1626,6 @@ void MaxHeight(EWin * ewin, const char *resize_type); /* slideouts.c */ int SlideoutsConfigLoad(FILE * fs); -/* snaps.c */ -void Real_SaveSnapInfo(int dumval, void *dumdat); -void LoadSnapInfo(void); -void SaveSnapInfo(void); -void SpawnSnappedCmds(void); -void SnapshotEwinMatch(EWin * ewin); -void SnapshotEwinUnmatch(EWin * ewin); -void SnapshotEwinUpdate(EWin * ewin, unsigned int flags); -void SnapshotEwinParse(EWin * ewin, const char *params); -void SettingsRemember(void); -extern const char SnapIpcText[]; -void SnapIpcFunc(const char *params, Client * c); - /* sound.c */ void SoundPlay(const char *name); diff --git a/src/ewins.c b/src/ewins.c index 451a23c8..f8d3cf1d 100644 --- a/src/ewins.c +++ b/src/ewins.c @@ -563,7 +563,7 @@ Adopt(EWin * ewin) MatchEwinToSM(ewin); #endif WindowMatchEwinOps(ewin); /* Window matches */ - SnapshotEwinMatch(ewin); /* Saved settings */ + SnapshotsApplyToEwin(ewin); /* Saved settings */ if (!EwinIsInternal(ewin) && Mode.wm.startup) EHintsGetInfo(ewin); /* E restart hints */ diff --git a/src/ewins.h b/src/ewins.h index 854edb4d..914ccc66 100644 --- a/src/ewins.h +++ b/src/ewins.h @@ -32,6 +32,8 @@ struct _desk; typedef struct _ewin EWin; #endif +struct _snapshot; + struct _ewin { EObj o; @@ -186,7 +188,7 @@ struct _ewin int shape_x, shape_y, shape_w, shape_h; int req_x, req_y; - Snapshot *snap; + struct _snapshot *snap; int head; /* Unused? */ int vx, vy; /* Position in virtual root */ diff --git a/src/ipc.c b/src/ipc.c index 3bf9e195..ce5ba060 100644 --- a/src/ipc.c +++ b/src/ipc.c @@ -27,6 +27,7 @@ #include "eobj.h" #include "ewins.h" #include "ewin-ops.h" +#include "snaps.h" #include "xwin.h" #include diff --git a/src/main.c b/src/main.c index d66c4c02..4f6b056d 100644 --- a/src/main.c +++ b/src/main.c @@ -24,6 +24,7 @@ #include "E.h" #include "desktops.h" #include "emodule.h" +#include "snaps.h" #include "timestamp.h" #include "xwin.h" #include diff --git a/src/mod-misc.c b/src/mod-misc.c index 1c758a02..35335134 100644 --- a/src/mod-misc.c +++ b/src/mod-misc.c @@ -22,6 +22,7 @@ */ #include "E.h" #include "emodule.h" +#include "snaps.h" /*********************************************************************** * *** should all go elsewhere *** diff --git a/src/session.c b/src/session.c index 61cb7c40..abca5b8b 100644 --- a/src/session.c +++ b/src/session.c @@ -25,6 +25,7 @@ #include "ecore-e16.h" #include "emodule.h" #include "ewins.h" +#include "snaps.h" #include "xwin.h" #include #include diff --git a/src/snaps.c b/src/snaps.c index 431538f7..5398b92d 100644 --- a/src/snaps.c +++ b/src/snaps.c @@ -1,5 +1,6 @@ /* - * Copyright (C) 2000-2005 Carsten Haitzler, Geoff Harrison and various contributors + * Copyright (C) 2000-2005 Carsten Haitzler, Geoff Harrison + * and various contributors * Copyright (C) 2004-2005 Kim Woelders * * Permission is hereby granted, free of charge, to any person obtaining a copy @@ -33,8 +34,10 @@ struct _snapshot char *win_title; char *win_name; char *win_class; + char *win_role; EWin *used; char track_changes; + unsigned int match_flags; unsigned int use_flags; char *border_name; @@ -65,7 +68,7 @@ SnapshotCreate(const char *name) sn = Ecalloc(1, sizeof(Snapshot)); sn->name = Estrdup(name); - AddItemEnd(sn, sn->name, 0, LIST_TYPE_SNAPSHOT); + AddItemEnd(sn, NULL, 0, LIST_TYPE_SNAPSHOT); return sn; } @@ -89,6 +92,8 @@ SnapshotDestroy(Snapshot * sn) Efree(sn->win_name); if (sn->win_class) Efree(sn->win_class); + if (sn->win_role) + Efree(sn->win_role); if (sn->border_name) Efree(sn->border_name); if (sn->cmd) @@ -103,15 +108,24 @@ SnapshotDestroy(Snapshot * sn) * a ---