mirror of
https://gitea.nishi.boats/pyrite-dev/milsko
synced 2026-01-08 10:23:27 +00:00
fix
git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@84 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
@@ -8,11 +8,13 @@ int main() {
|
||||
MwWidget button = MwCreateWidget(MwButtonClass, "button", window, 50, 50, 400, 400);
|
||||
MwLLPixmap px = MwLoadImage(window, "examples/picture.png");
|
||||
|
||||
MwVaApply(window,
|
||||
MwNiconPixmap, px,
|
||||
NULL);
|
||||
|
||||
MwVaApply(button,
|
||||
MwNpixmap, px,
|
||||
NULL);
|
||||
|
||||
MwWindowSetIcon(window, px);
|
||||
|
||||
MwLoop(window);
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#define MwNforeground "Sforeground"
|
||||
|
||||
#define MwNpixmap "Vpixmap"
|
||||
#define MwNiconPixmap "ViconPixmap"
|
||||
|
||||
#define MwNactivateHandler "Cactivate"
|
||||
#define MwNresizeHandler "Cresize"
|
||||
|
||||
@@ -18,13 +18,6 @@ extern "C" {
|
||||
*/
|
||||
MWDECL MwClass MwWindowClass;
|
||||
|
||||
/*!
|
||||
* %brief Sets a window icon
|
||||
* %param handle Widget
|
||||
* %param pixmap Pixmap
|
||||
*/
|
||||
MWDECL void MwWindowSetIcon(MwWidget handle, MwLLPixmap pixmap);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -186,7 +186,11 @@ void MwSetText(MwWidget handle, const char* key, const char* value) {
|
||||
}
|
||||
|
||||
void MwSetVoid(MwWidget handle, const char* key, void* value) {
|
||||
if(strcmp(key, MwNiconPixmap) == 0) {
|
||||
MwLLSetIcon(handle->lowlevel, value);
|
||||
} else {
|
||||
shput(handle->data, key, value);
|
||||
}
|
||||
}
|
||||
|
||||
int MwGetInteger(MwWidget handle, const char* key) {
|
||||
|
||||
@@ -290,7 +290,7 @@ void MwLLDrawPixmap(MwLL handle, MwRect* rect, MwLLPixmap pixmap) {
|
||||
void MwLLSetIcon(MwLL handle, MwLLPixmap pixmap) {
|
||||
unsigned long* icon = malloc((2 + pixmap->width * pixmap->height) * sizeof(*icon));
|
||||
int i;
|
||||
Atom atom = XInternAtom(lowlevel->display, "_NET_WM_ICON", False);
|
||||
Atom atom = XInternAtom(handle->display, "_NET_WM_ICON", False);
|
||||
|
||||
icon[0] = pixmap->width;
|
||||
icon[1] = pixmap->height;
|
||||
@@ -299,7 +299,7 @@ void MwLLSetIcon(MwLL handle, MwLLPixmap pixmap) {
|
||||
icon[2 + i] = *(unsigned long*)(&pixmap->image->data[i * 4]);
|
||||
}
|
||||
|
||||
XChangeProperty(lowlevel->display, lowlevel->window, atom, 6, 32, PropModeReplace, (unsigned char*)icon, 2 + pixmap->width * pixmap->height);
|
||||
XChangeProperty(handle->display, handle->window, atom, 6, 32, PropModeReplace, (unsigned char*)icon, 2 + pixmap->width * pixmap->height);
|
||||
|
||||
free(icon);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user