10 extern struct W_Application WMApplication
;
12 void WMSetApplicationIconWindow(WMScreen
* scr
, Window window
)
14 scr
->applicationIconWindow
= window
;
16 if (scr
->groupLeader
) {
19 hints
= XGetWMHints(scr
->display
, scr
->groupLeader
);
20 hints
->flags
|= IconWindowHint
;
21 hints
->icon_window
= window
;
23 XSetWMHints(scr
->display
, scr
->groupLeader
, hints
);
28 void WMSetApplicationIconImage(WMScreen
* scr
, RImage
* image
)
32 if (scr
->applicationIconImage
== image
)
35 if (scr
->applicationIconImage
)
36 RReleaseImage(scr
->applicationIconImage
);
38 scr
->applicationIconImage
= RRetainImage(image
);
40 /* TODO: check whether we should set the pixmap only if there's none yet */
41 if (image
!= NULL
&& (icon
= WMCreatePixmapFromRImage(scr
, image
, 128)) != NULL
) {
42 WMSetApplicationIconPixmap(scr
, icon
);
43 WMReleasePixmap(icon
);
47 RImage
*WMGetApplicationIconImage(WMScreen
* scr
)
49 return scr
->applicationIconImage
;
52 void WMSetApplicationIconPixmap(WMScreen
* scr
, WMPixmap
* icon
)
54 if (scr
->applicationIconPixmap
== icon
)
57 if (scr
->applicationIconPixmap
)
58 WMReleasePixmap(scr
->applicationIconPixmap
);
60 scr
->applicationIconPixmap
= WMRetainPixmap(icon
);
62 if (scr
->groupLeader
) {
65 hints
= XGetWMHints(scr
->display
, scr
->groupLeader
);
66 hints
->flags
|= IconPixmapHint
| IconMaskHint
;
67 hints
->icon_pixmap
= (icon
!= NULL
? icon
->pixmap
: None
);
68 hints
->icon_mask
= (icon
!= NULL
? icon
->mask
: None
);
70 XSetWMHints(scr
->display
, scr
->groupLeader
, hints
);
75 WMPixmap
*WMGetApplicationIconPixmap(WMScreen
* scr
)
77 return scr
->applicationIconPixmap
;
80 WMPixmap
*WMCreateApplicationIconBlendedPixmap(WMScreen
* scr
, RColor
* color
)
84 if (scr
->applicationIconImage
) {
95 pix
= WMCreateBlendedPixmapFromRImage(scr
, scr
->applicationIconImage
, color
);
103 void WMSetApplicationHasAppIcon(WMScreen
* scr
, Bool flag
)
105 scr
->aflags
.hasAppIcon
= ((flag
== 0) ? 0 : 1);
108 void W_InitApplication(WMScreen
* scr
)
111 XClassHint
*classHint
;
114 leader
= XCreateSimpleWindow(scr
->display
, scr
->rootWin
, -1, -1, 1, 1, 0, 0, 0);
116 if (!scr
->aflags
.simpleApplication
) {
117 classHint
= XAllocClassHint();
118 classHint
->res_name
= "groupLeader";
119 classHint
->res_class
= WMApplication
.applicationName
;
120 XSetClassHint(scr
->display
, leader
, classHint
);
123 XSetCommand(scr
->display
, leader
, WMApplication
.argv
, WMApplication
.argc
);
125 hints
= XAllocWMHints();
127 hints
->flags
= WindowGroupHint
;
128 hints
->window_group
= leader
;
130 /* This code will never actually be reached, because to have
131 * scr->applicationIconPixmap set we need to have a screen first,
132 * but this function is called in the screen creation process.
135 if (scr
->applicationIconPixmap
) {
136 hints
->flags
|= IconPixmapHint
;
137 hints
->icon_pixmap
= scr
->applicationIconPixmap
->pixmap
;
138 if (scr
->applicationIconPixmap
->mask
) {
139 hints
->flags
|= IconMaskHint
;
140 hints
->icon_mask
= scr
->applicationIconPixmap
->mask
;
144 XSetWMHints(scr
->display
, leader
, hints
);
148 scr
->groupLeader
= leader
;