Skip to content

Commit d0edd84

Browse files
committed
1
1 parent 3fe29c7 commit d0edd84

File tree

4 files changed

+84
-10
lines changed

4 files changed

+84
-10
lines changed

fvwm/module_list.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1120,6 +1120,7 @@ void CMD_ModuleSynchronous(F_CMD_ARGS)
11201120
token = PeekToken(next, &next);
11211121
if (token)
11221122
{
1123+
free(expect);
11231124
expect = fxstrdup(token);
11241125
}
11251126
action = next;

libs/mcomms.c

Lines changed: 37 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,51 @@
1313
*/
1414

1515
#include <stdio.h>
16+
#include <stdint.h>
1617

1718
#include "config.h"
1819
#include "log.h"
20+
#include "safemalloc.h"
1921
#include "mcomms.h"
2022

21-
const char *m_register[] = {
22-
"new_window"
23+
uint64_t m_find_bit(const char *);
24+
25+
static const struct {
26+
uint64_t bits;
27+
const char *name;
28+
} all_mcomm_types[] = {
29+
{ MCOMMS_NEW_WINDOW, "new-window" },
30+
{ 0, NULL },
2331
};
2432

25-
bool
26-
m_register_interest(int *fd, const char *type, ...)
33+
uint64_t
34+
m_find_bit(const char *name)
35+
{
36+
int i = 0;
37+
38+
for (i = 0; all_mcomm_types[i].name != NULL; i++) {
39+
if (strcmp(all_mcomm_types[i].name, name) == 0) {
40+
return all_mcomm_types[i].bits;
41+
}
42+
}
43+
fprintf(stderr, "%s: Invalid module interest: %s\n", __func__, name);
44+
return 0;
45+
}
46+
47+
uint64_t
48+
m_register_interest(int *fd, const char *me)
2749
{
28-
va_list ap;
50+
char *me1;
51+
const char *component;
52+
uint64_t m_bits = 0;
53+
54+
if (me == NULL)
55+
return 0;
56+
me1 = fxstrdup(me);
2957

30-
va_start(ap, type);
31-
vfprintf(stderr, type, ap);
32-
va_end(ap);
58+
while ((component = strsep(&me1, " ")) != NULL)
59+
m_bits |= m_find_bit(component);
3360

34-
return true;
61+
free(me1);
62+
return m_bits;
3563
}

libs/mcomms.h

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#ifndef FVWMLIB_MCOMMS_H
2+
#define FVWMLIB_MCOMMS_H
3+
4+
#include <stdbool.h>
5+
6+
#define MCOMMS_NEW_WINDOW 0x0000000000000001ULL
7+
#define MCOMMS_ALL 0xffffffffffffffffULL
8+
9+
struct m_add_window {
10+
char *window;
11+
int title_height;
12+
int border_width;
13+
14+
struct {
15+
int window;
16+
int x;
17+
int y;
18+
int width;
19+
int height;
20+
} frame;
21+
22+
struct {
23+
int base_width;
24+
int base_height;
25+
int inc_width;
26+
int inc_height;
27+
int orig_inc_width;
28+
int orig_inc_height;
29+
int min_width;
30+
int min_height;
31+
int max_width;
32+
int max_height;
33+
} hints;
34+
35+
struct {
36+
int layer;
37+
int desktop;
38+
int window_type;
39+
} ewmh;
40+
};
41+
42+
uint64_t m_register_interest(int *, const char *);
43+
44+
#endif

modules/FvwmIdent/FvwmIdent.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,8 @@ int main(int argc, char **argv)
218218
InitGetConfigLine(fd, mname);
219219
GetConfigLine(fd,&tline);
220220
#ifdef HAVE_MPACK
221-
m_register_interest(fd, "new_window", "this", "that");
221+
fprintf(stderr, "GOT: %lu\n",
222+
m_register_interest(fd, "new-window this that the-other"));
222223
#endif
223224
while (tline != (char *)0)
224225
{

0 commit comments

Comments
 (0)