mirror of
https://gitea.nishi.boats/pyrite-dev/milsko
synced 2026-01-04 08:30:51 +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);
|
MwWidget button = MwCreateWidget(MwButtonClass, "button", window, 50, 50, 400, 400);
|
||||||
MwLLPixmap px = MwLoadImage(window, "examples/picture.png");
|
MwLLPixmap px = MwLoadImage(window, "examples/picture.png");
|
||||||
|
|
||||||
|
MwVaApply(window,
|
||||||
|
MwNiconPixmap, px,
|
||||||
|
NULL);
|
||||||
|
|
||||||
MwVaApply(button,
|
MwVaApply(button,
|
||||||
MwNpixmap, px,
|
MwNpixmap, px,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
MwWindowSetIcon(window, px);
|
|
||||||
|
|
||||||
MwLoop(window);
|
MwLoop(window);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
#define MwNforeground "Sforeground"
|
#define MwNforeground "Sforeground"
|
||||||
|
|
||||||
#define MwNpixmap "Vpixmap"
|
#define MwNpixmap "Vpixmap"
|
||||||
|
#define MwNiconPixmap "ViconPixmap"
|
||||||
|
|
||||||
#define MwNactivateHandler "Cactivate"
|
#define MwNactivateHandler "Cactivate"
|
||||||
#define MwNresizeHandler "Cresize"
|
#define MwNresizeHandler "Cresize"
|
||||||
|
|||||||
@@ -18,13 +18,6 @@ extern "C" {
|
|||||||
*/
|
*/
|
||||||
MWDECL MwClass MwWindowClass;
|
MWDECL MwClass MwWindowClass;
|
||||||
|
|
||||||
/*!
|
|
||||||
* %brief Sets a window icon
|
|
||||||
* %param handle Widget
|
|
||||||
* %param pixmap Pixmap
|
|
||||||
*/
|
|
||||||
MWDECL void MwWindowSetIcon(MwWidget handle, MwLLPixmap pixmap);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -186,7 +186,11 @@ void MwSetText(MwWidget handle, const char* key, const char* value) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MwSetVoid(MwWidget handle, const char* key, void* value) {
|
void MwSetVoid(MwWidget handle, const char* key, void* value) {
|
||||||
shput(handle->data, key, value);
|
if(strcmp(key, MwNiconPixmap) == 0) {
|
||||||
|
MwLLSetIcon(handle->lowlevel, value);
|
||||||
|
} else {
|
||||||
|
shput(handle->data, key, value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int MwGetInteger(MwWidget handle, const char* key) {
|
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) {
|
void MwLLSetIcon(MwLL handle, MwLLPixmap pixmap) {
|
||||||
unsigned long* icon = malloc((2 + pixmap->width * pixmap->height) * sizeof(*icon));
|
unsigned long* icon = malloc((2 + pixmap->width * pixmap->height) * sizeof(*icon));
|
||||||
int i;
|
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[0] = pixmap->width;
|
||||||
icon[1] = pixmap->height;
|
icon[1] = pixmap->height;
|
||||||
@@ -299,7 +299,7 @@ void MwLLSetIcon(MwLL handle, MwLLPixmap pixmap) {
|
|||||||
icon[2 + i] = *(unsigned long*)(&pixmap->image->data[i * 4]);
|
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);
|
free(icon);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user