Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion modules/FvwmIconMan/FvwmIconMan.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ typedef enum {
ICON_NAME = 2,
RESOURCE_NAME = 4,
CLASS_NAME = 8,
ALL_NAME = 15
SCREEN_NAME = 16,
ALL_NAME = 31
} NameType;

typedef struct win_list {
Expand Down Expand Up @@ -259,6 +260,7 @@ typedef enum {
SortId, /* sort by window id */
SortName, /* case insensitive name sorting */
SortNameCase, /* case sensitive name sorting */
SortScreen, /* Sort by screen */
SortWeighted, /* custom sort order */
} SortType;

Expand All @@ -267,6 +269,7 @@ typedef struct {
char *classname;
char *titlename;
char *iconname;
char *screenname;
int weight;
} WeightedSort;

Expand Down
7 changes: 7 additions & 0 deletions modules/FvwmIconMan/readconfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -1017,6 +1017,10 @@ static NameType parse_format_dependencies(char *format)
{
flags |= RESOURCE_NAME;
}
else if (*format == 's')
{
flags |= SCREEN_NAME;
}
else if (*format != '%')
{
ConsoleMessage(
Expand Down Expand Up @@ -1830,6 +1834,9 @@ void read_in_resources(void)
else if (!strcasecmp(p, "none")) {
i = SortNone;
}
else if (!strcasecmp(p, "screen")) {
i = SortScreen;
}
else if (!strcasecmp(p, "weighted")) {
i = SortWeighted;
}
Expand Down
31 changes: 22 additions & 9 deletions modules/FvwmIconMan/winlist.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ void print_stringlist (StringList *list)
s = "class";
break;

case SCREEN_NAME:
s = "screen";
break;

default:
s = "unknown type";
}
Expand All @@ -78,6 +82,8 @@ void add_to_stringlist (StringList *list, char *s)
type = RESOURCE_NAME;
else if (!strcasecmp (s, "class"))
type = CLASS_NAME;
else if (!strcasecmp (s, "screen"))
type = SCREEN_NAME;
else {
ConsoleMessage ("Bad element in show/dontshow list: %s\n", s);
return;
Expand Down Expand Up @@ -107,17 +113,18 @@ void add_to_stringlist (StringList *list, char *s)
}

static int matches_string (NameType type, char *pattern, char *tname,
char *iname, char *rname, char *cname)
char *iname, char *rname, char *cname, char *sname)
{
int ans = 0;

ConsoleDebug (WINLIST, "matches_string: type: 0x%x pattern: %s\n",
type, pattern);
ConsoleDebug (WINLIST, "\tstrings: %s:%s %s:%s\n",
ConsoleDebug (WINLIST, "\tstrings: %s:%s %s:%s %s\n",
tname ? tname : "(null)",
iname ? iname : "(null)",
rname ? rname : "(null)",
cname ? cname : "(null)");
cname ? cname : "(null)",
sname ? sname : "(null");

if (tname && (type == ALL_NAME || type == TITLE_NAME)) {
ans |= matchWildcards (pattern, tname);
Expand All @@ -131,6 +138,9 @@ static int matches_string (NameType type, char *pattern, char *tname,
if (cname && (type == ALL_NAME || type == CLASS_NAME)) {
ans |= matchWildcards (pattern, cname);
}
if (cname && (type == ALL_NAME || type == SCREEN_NAME)) {
ans |= matchWildcards (pattern, sname);
}

ConsoleDebug (WINLIST, "\tmatches_string: %d\n", ans);
return ans;
Expand Down Expand Up @@ -209,7 +219,7 @@ int check_resolution(WinManager *manager, WinData *win)
}

static int iconmanager_show (WinManager *man, char *tname, char *iname,
char *rname, char *cname)
char *rname, char *cname, char *sname)
{
StringEl *string;
int in_showlist = 0, in_dontshowlist = 0;
Expand All @@ -228,7 +238,7 @@ static int iconmanager_show (WinManager *man, char *tname, char *iname,
for (string = man->dontshow.list; string; string = string->next) {
ConsoleDebug (WINLIST, "Matching: %s\n", string->string);
if (matches_string (string->type, string->string, tname, iname,
rname, cname)) {
rname, cname, sname)) {
ConsoleDebug (WINLIST, "Don't show\n");
in_dontshowlist = 1;
break;
Expand All @@ -243,7 +253,7 @@ static int iconmanager_show (WinManager *man, char *tname, char *iname,
for (string = man->show.list; string; string = string->next) {
ConsoleDebug (WINLIST, "Matching: %s\n", string->string);
if (matches_string (string->type, string->string, tname, iname,
rname, cname)) {
rname, cname, sname)) {
ConsoleDebug (WINLIST, "Show\n");
in_showlist = 1;
break;
Expand Down Expand Up @@ -295,14 +305,15 @@ WinManager *figure_win_manager (WinData *win, Uchar name_mask)
char *iname = win->iconname;
char *rname = win->resname;
char *cname = win->classname;
char *sname = win->monitor;
WinManager *man;

assert (tname || iname || rname || cname);
ConsoleDebug (WINLIST, "set_win_manager: %s %s %s %s\n", tname, iname, rname, cname);
assert (tname || iname || rname || cname || sname);
ConsoleDebug (WINLIST, "set_win_manager: %s %s %s %s %s\n", tname, iname, rname, cname, sname);

for (i = 0, man = &globals.managers[0]; i < globals.num_managers;
i++, man++) {
if (iconmanager_show (man, tname, iname, rname, cname) &&
if (iconmanager_show (man, tname, iname, rname, cname, sname) &&
check_resolution(man, win)) {
if (man != win->manager) {
assert (man->magic == 0x12344321);
Expand All @@ -329,6 +340,8 @@ int check_win_complete (WinData *p)
(p->resname ? p->resname : "No p->resname"));
ConsoleDebug (WINLIST, "\tclass: %s\n",
(p->classname ? p->classname : "No p->classname"));
ConsoleDebug (WINLIST, "\tscreen: %s\n",
(p->monitor ? p->monitor : "No p->monitor"));
ConsoleDebug (WINLIST, "\tdisplaystring: %s\n",
(p->display_string ? p->display_string :
"No p->display_string"));
Expand Down
12 changes: 11 additions & 1 deletion modules/FvwmIconMan/xmanager.c
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,10 @@ static char *make_display_string(WinData *win, char *format)
COPY(classname);
break;

case 's':
COPY(monitor);
break;

default:
*out_p++ = *in_p++;
break;
Expand Down Expand Up @@ -1014,7 +1018,8 @@ void set_win_displaystring(WinData *win)
if (!man || ((man->format_depend & CLASS_NAME) && !win->classname)
|| ((man->format_depend & ICON_NAME) && !win->visible_icon_name)
|| ((man->format_depend & TITLE_NAME) && !win->visible_name)
|| ((man->format_depend & RESOURCE_NAME) && !win->resname)) {
|| ((man->format_depend & RESOURCE_NAME) && !win->resname)
|| ((man->format_depend & SCREEN_NAME) && !win->monitor)) {
return;
}

Expand Down Expand Up @@ -2199,6 +2204,11 @@ static int compare_windows(SortType type, WinData *a, WinData *b)
return strcmp((a->display_string)? a->display_string:"",
(b->display_string)? b->display_string:"");
}
else if (type == SortScreen)
{
return (strcmp(a->monitor ? a->monitor : "",
b->monitor ? b->monitor : ""));
}
else if (type == SortWeighted)
{
wa = compute_weight(a);
Expand Down