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
25 extern struct W_Application WMApplication
;
29 WMSetApplicationIconWindow(WMScreen
*scr
, Window window
)
31 scr
->applicationIconWindow
= window
;
33 if (scr
->groupLeader
) {
36 hints
= XGetWMHints(scr
->display
, scr
->groupLeader
);
37 hints
->flags
|= IconWindowHint
;
38 hints
->icon_window
= window
;
40 XSetWMHints(scr
->display
, scr
->groupLeader
, hints
);
47 WMSetApplicationIconImage(WMScreen
*scr
, RImage
*image
)
51 if (scr
->applicationIconImage
== image
)
54 if (scr
->applicationIconImage
)
55 RReleaseImage(scr
->applicationIconImage
);
57 scr
->applicationIconImage
= RRetainImage(image
);
59 /* TODO: check whether we should set the pixmap only if there's none yet */
60 if (image
!=NULL
&& (icon
=WMCreatePixmapFromRImage(scr
, image
, 128))!=NULL
) {
61 WMSetApplicationIconPixmap(scr
, icon
);
62 WMReleasePixmap(icon
);
68 WMGetApplicationIconImage(WMScreen
*scr
)
70 return scr
->applicationIconImage
;
75 WMSetApplicationIconPixmap(WMScreen
*scr
, WMPixmap
*icon
)
77 if (scr
->applicationIconPixmap
== icon
)
80 if (scr
->applicationIconPixmap
)
81 WMReleasePixmap(scr
->applicationIconPixmap
);
83 scr
->applicationIconPixmap
= WMRetainPixmap(icon
);
85 if (scr
->groupLeader
) {
88 hints
= XGetWMHints(scr
->display
, scr
->groupLeader
);
89 hints
->flags
|= IconPixmapHint
|IconMaskHint
;
90 hints
->icon_pixmap
= (icon
!=NULL
? icon
->pixmap
: None
);
91 hints
->icon_mask
= (icon
!=NULL
? icon
->mask
: None
);
93 XSetWMHints(scr
->display
, scr
->groupLeader
, hints
);
100 WMGetApplicationIconPixmap(WMScreen
*scr
)
102 return scr
->applicationIconPixmap
;
107 WMCreateApplicationIconBlendedPixmap(WMScreen
*scr
, RColor
*color
)
111 if (scr
->applicationIconImage
) {
122 pix
= WMCreateBlendedPixmapFromRImage(scr
, scr
->applicationIconImage
,
133 WMSetApplicationHasAppIcon(WMScreen
*scr
, Bool flag
)
135 scr
->aflags
.hasAppIcon
= flag
;
140 W_InitApplication(WMScreen
*scr
)
143 XClassHint
*classHint
;
146 leader
= XCreateSimpleWindow(scr
->display
, scr
->rootWin
, -1, -1,
149 if (!scr
->aflags
.simpleApplication
) {
150 classHint
= XAllocClassHint();
151 classHint
->res_name
= "groupLeader";
152 classHint
->res_class
= WMApplication
.applicationName
;
153 XSetClassHint(scr
->display
, leader
, classHint
);
156 XSetCommand(scr
->display
, leader
, WMApplication
.argv
,
159 hints
= XAllocWMHints();
161 hints
->flags
= WindowGroupHint
;
162 hints
->window_group
= leader
;
164 /* This code will never actually be reached, because to have
165 * scr->applicationIconPixmap set we need to have a screen first,
166 * but this function is called in the screen creation process.
169 if (scr
->applicationIconPixmap
) {
170 hints
->flags
|= IconPixmapHint
;
171 hints
->icon_pixmap
= scr
->applicationIconPixmap
->pixmap
;
172 if (scr
->applicationIconPixmap
->mask
) {
173 hints
->flags
|= IconMaskHint
;
174 hints
->icon_mask
= scr
->applicationIconPixmap
->mask
;
178 XSetWMHints(scr
->display
, leader
, hints
);
182 scr
->groupLeader
= leader
;