added some new functions
[wmaker-crm.git] / WINGs / wappresource.c
blobde4138931d255053c2974d4f4ac346d4853462fc
3 #include <unistd.h>
5 #include "WINGsP.h"
7 #include <X11/Xutil.h>
9 /* Xmd.h which is indirectly included by GNUstep.h defines BOOL,
10 * but libPropList also defines it. So we do this kluge to get rid of BOOL
11 * temporarily */
12 #ifdef BOOL
13 # define WINGS_BOOL
14 # undef BOOL
15 #endif
17 #include "GNUstep.h"
19 #ifdef WINGS_BOOL
20 # define BOOL
21 # undef WINGS_BOOL
22 #endif
25 extern struct W_Application WMApplication;
28 void
29 WMSetApplicationIconWindow(WMScreen *scr, Window window)
31 scr->applicationIconWindow = window;
33 if (scr->groupLeader) {
34 XWMHints *hints;
36 hints = XGetWMHints(scr->display, scr->groupLeader);
37 hints->flags |= IconWindowHint;
38 hints->icon_window = window;
40 XSetWMHints(scr->display, scr->groupLeader, hints);
41 XFree(hints);
46 void
47 WMSetApplicationIconImage(WMScreen *scr, WMPixmap *icon)
49 if (scr->applicationIcon)
50 WMReleasePixmap(scr->applicationIcon);
52 scr->applicationIcon = WMRetainPixmap(icon);
54 if (scr->groupLeader) {
55 XWMHints *hints;
57 hints = XGetWMHints(scr->display, scr->groupLeader);
58 hints->flags |= IconPixmapHint|IconMaskHint;
59 hints->icon_pixmap = icon->pixmap;
60 hints->icon_mask = icon->mask;
62 XSetWMHints(scr->display, scr->groupLeader, hints);
63 XFree(hints);
68 WMPixmap*
69 WMGetApplicationIconImage(WMScreen *scr)
71 return scr->applicationIcon;
75 void
76 WMSetApplicationHasAppIcon(WMScreen *scr, Bool flag)
78 scr->aflags.hasAppIcon = flag;
82 void
83 W_InitApplication(WMScreen *scr)
85 Window leader;
86 XClassHint *classHint;
87 XWMHints *hints;
89 leader = XCreateSimpleWindow(scr->display, scr->rootWin, -1, -1,
90 1, 1, 0, 0, 0);
92 if (!scr->aflags.simpleApplication) {
93 classHint = XAllocClassHint();
94 classHint->res_name = "groupLeader";
95 classHint->res_class = WMApplication.applicationName;
96 XSetClassHint(scr->display, leader, classHint);
97 XFree(classHint);
99 XSetCommand(scr->display, leader, WMApplication.argv,
100 WMApplication.argc);
102 hints = XAllocWMHints();
104 hints->flags = WindowGroupHint;
105 hints->window_group = leader;
107 if (scr->applicationIcon) {
108 hints->flags |= IconPixmapHint;
109 hints->icon_pixmap = scr->applicationIcon->pixmap;
110 if (scr->applicationIcon->mask) {
111 hints->flags |= IconMaskHint;
112 hints->icon_mask = scr->applicationIcon->mask;
116 XSetWMHints(scr->display, leader, hints);
118 XFree(hints);
120 scr->groupLeader = leader;