11 void WMSetApplicationIconWindow(WMScreen
* scr
, Window window
)
13 scr
->applicationIconWindow
= window
;
15 if (scr
->groupLeader
) {
18 hints
= XGetWMHints(scr
->display
, scr
->groupLeader
);
19 hints
->flags
|= IconWindowHint
;
20 hints
->icon_window
= window
;
22 XSetWMHints(scr
->display
, scr
->groupLeader
, hints
);
27 void WMSetApplicationIconImage(WMScreen
* scr
, RImage
* image
)
31 if (scr
->applicationIconImage
== image
)
34 if (scr
->applicationIconImage
)
35 RReleaseImage(scr
->applicationIconImage
);
37 scr
->applicationIconImage
= RRetainImage(image
);
39 /* TODO: check whether we should set the pixmap only if there's none yet */
40 if (image
!= NULL
&& (icon
= WMCreatePixmapFromRImage(scr
, image
, 128)) != NULL
) {
41 WMSetApplicationIconPixmap(scr
, icon
);
42 WMReleasePixmap(icon
);
46 RImage
*WMGetApplicationIconImage(WMScreen
* scr
)
48 return scr
->applicationIconImage
;
51 void WMSetApplicationIconPixmap(WMScreen
* scr
, WMPixmap
* icon
)
53 if (scr
->applicationIconPixmap
== icon
)
56 if (scr
->applicationIconPixmap
)
57 WMReleasePixmap(scr
->applicationIconPixmap
);
59 scr
->applicationIconPixmap
= WMRetainPixmap(icon
);
61 if (scr
->groupLeader
) {
64 hints
= XGetWMHints(scr
->display
, scr
->groupLeader
);
65 hints
->flags
|= IconPixmapHint
| IconMaskHint
;
66 hints
->icon_pixmap
= (icon
!= NULL
? icon
->pixmap
: None
);
67 hints
->icon_mask
= (icon
!= NULL
? icon
->mask
: None
);
69 XSetWMHints(scr
->display
, scr
->groupLeader
, hints
);
74 WMPixmap
*WMGetApplicationIconPixmap(WMScreen
* scr
)
76 return scr
->applicationIconPixmap
;
79 WMPixmap
*WMCreateApplicationIconBlendedPixmap(WMScreen
* scr
, const RColor
* color
)
83 if (scr
->applicationIconImage
) {
84 static const RColor gray
= {
94 pix
= WMCreateBlendedPixmapFromRImage(scr
, scr
->applicationIconImage
, color
);
102 void WMSetApplicationHasAppIcon(WMScreen
* scr
, Bool flag
)
104 scr
->aflags
.hasAppIcon
= ((flag
== 0) ? 0 : 1);
107 void W_InitApplication(WMScreen
* scr
)
110 XClassHint
*classHint
;
113 leader
= XCreateSimpleWindow(scr
->display
, scr
->rootWin
, -1, -1, 1, 1, 0, 0, 0);
115 if (!scr
->aflags
.simpleApplication
) {
116 classHint
= XAllocClassHint();
117 classHint
->res_name
= "groupLeader";
118 classHint
->res_class
= WMApplication
.applicationName
;
119 XSetClassHint(scr
->display
, leader
, classHint
);
122 XSetCommand(scr
->display
, leader
, WMApplication
.argv
, WMApplication
.argc
);
124 hints
= XAllocWMHints();
126 hints
->flags
= WindowGroupHint
;
127 hints
->window_group
= leader
;
129 /* This code will never actually be reached, because to have
130 * scr->applicationIconPixmap set we need to have a screen first,
131 * but this function is called in the screen creation process.
134 if (scr
->applicationIconPixmap
) {
135 hints
->flags
|= IconPixmapHint
;
136 hints
->icon_pixmap
= scr
->applicationIconPixmap
->pixmap
;
137 if (scr
->applicationIconPixmap
->mask
) {
138 hints
->flags
|= IconMaskHint
;
139 hints
->icon_mask
= scr
->applicationIconPixmap
->mask
;
143 XSetWMHints(scr
->display
, leader
, hints
);
147 scr
->groupLeader
= leader
;