13 extern struct W_Application WMApplication
;
17 WMSetApplicationIconWindow(WMScreen
*scr
, Window window
)
19 scr
->applicationIconWindow
= window
;
21 if (scr
->groupLeader
) {
24 hints
= XGetWMHints(scr
->display
, scr
->groupLeader
);
25 hints
->flags
|= IconWindowHint
;
26 hints
->icon_window
= window
;
28 XSetWMHints(scr
->display
, scr
->groupLeader
, hints
);
35 WMSetApplicationIconImage(WMScreen
*scr
, RImage
*image
)
39 if (scr
->applicationIconImage
== image
)
42 if (scr
->applicationIconImage
)
43 RReleaseImage(scr
->applicationIconImage
);
45 scr
->applicationIconImage
= RRetainImage(image
);
47 /* TODO: check whether we should set the pixmap only if there's none yet */
48 if (image
!=NULL
&& (icon
=WMCreatePixmapFromRImage(scr
, image
, 128))!=NULL
) {
49 WMSetApplicationIconPixmap(scr
, icon
);
50 WMReleasePixmap(icon
);
56 WMGetApplicationIconImage(WMScreen
*scr
)
58 return scr
->applicationIconImage
;
63 WMSetApplicationIconPixmap(WMScreen
*scr
, WMPixmap
*icon
)
65 if (scr
->applicationIconPixmap
== icon
)
68 if (scr
->applicationIconPixmap
)
69 WMReleasePixmap(scr
->applicationIconPixmap
);
71 scr
->applicationIconPixmap
= WMRetainPixmap(icon
);
73 if (scr
->groupLeader
) {
76 hints
= XGetWMHints(scr
->display
, scr
->groupLeader
);
77 hints
->flags
|= IconPixmapHint
|IconMaskHint
;
78 hints
->icon_pixmap
= (icon
!=NULL
? icon
->pixmap
: None
);
79 hints
->icon_mask
= (icon
!=NULL
? icon
->mask
: None
);
81 XSetWMHints(scr
->display
, scr
->groupLeader
, hints
);
88 WMGetApplicationIconPixmap(WMScreen
*scr
)
90 return scr
->applicationIconPixmap
;
95 WMCreateApplicationIconBlendedPixmap(WMScreen
*scr
, RColor
*color
)
99 if (scr
->applicationIconImage
) {
110 pix
= WMCreateBlendedPixmapFromRImage(scr
, scr
->applicationIconImage
,
121 WMSetApplicationHasAppIcon(WMScreen
*scr
, Bool flag
)
123 scr
->aflags
.hasAppIcon
= ((flag
==0) ? 0 : 1);
128 W_InitApplication(WMScreen
*scr
)
131 XClassHint
*classHint
;
134 leader
= XCreateSimpleWindow(scr
->display
, scr
->rootWin
, -1, -1,
137 if (!scr
->aflags
.simpleApplication
) {
138 classHint
= XAllocClassHint();
139 classHint
->res_name
= "groupLeader";
140 classHint
->res_class
= WMApplication
.applicationName
;
141 XSetClassHint(scr
->display
, leader
, classHint
);
144 XSetCommand(scr
->display
, leader
, WMApplication
.argv
,
147 hints
= XAllocWMHints();
149 hints
->flags
= WindowGroupHint
;
150 hints
->window_group
= leader
;
152 /* This code will never actually be reached, because to have
153 * scr->applicationIconPixmap set we need to have a screen first,
154 * but this function is called in the screen creation process.
157 if (scr
->applicationIconPixmap
) {
158 hints
->flags
|= IconPixmapHint
;
159 hints
->icon_pixmap
= scr
->applicationIconPixmap
->pixmap
;
160 if (scr
->applicationIconPixmap
->mask
) {
161 hints
->flags
|= IconMaskHint
;
162 hints
->icon_mask
= scr
->applicationIconPixmap
->mask
;
166 XSetWMHints(scr
->display
, leader
, hints
);
170 scr
->groupLeader
= leader
;