]>
Dogcows Code - chaz/openbox/blob - openbox/group.c
1 /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
3 group.c for the Openbox window manager
4 Copyright (c) 2003 Ben Jansens
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 See the COPYING file for a copy of the GNU General Public License.
22 GHashTable
*group_map
= NULL
;
24 static guint
map_hash(Window
*w
) { return *w
; }
25 static gboolean
map_key_comp(Window
*w1
, Window
*w2
) { return *w1
== *w2
; }
27 void group_startup(gboolean reconfig
)
31 group_map
= g_hash_table_new((GHashFunc
)map_hash
,
32 (GEqualFunc
)map_key_comp
);
35 void group_shutdown(gboolean reconfig
)
39 g_hash_table_destroy(group_map
);
42 ObGroup
*group_add(Window leader
, ObClient
*client
)
46 self
= g_hash_table_lookup(group_map
, &leader
);
48 self
= g_new(ObGroup
, 1);
49 self
->leader
= leader
;
51 g_hash_table_insert(group_map
, &self
->leader
, self
);
54 self
->members
= g_slist_append(self
->members
, client
);
59 void group_remove(ObGroup
*self
, ObClient
*client
)
61 self
->members
= g_slist_remove(self
->members
, client
);
62 if (self
->members
== NULL
) {
63 g_hash_table_remove(group_map
, &self
->leader
);
This page took 0.036261 seconds and 4 git commands to generate.