mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-23 22:52:34 +01:00
get_pixmap_icon_from_wm_hints rewritten
The function get_pixmap_icon_from_wm_hints() is now rewritten using the functions get_wwindow_image_from_wmhints() and icon_update_pixmap(). Now, the function creates a new RImage using get_wwindow_image_from_wmhints() and then updates the Pixmap using the function icon_update_pixmap().
This commit is contained in:
committed by
Carlos R. Mafra
parent
0493974cbc
commit
0106b2a4e9
50
src/icon.c
50
src/icon.c
@@ -728,60 +728,22 @@ static void get_pixmap_icon_from_icon_win(WIcon * icon)
|
|||||||
/* Get the Pixmap from the XWindow wm_hints */
|
/* Get the Pixmap from the XWindow wm_hints */
|
||||||
static int get_pixmap_icon_from_wm_hints(WIcon *icon)
|
static int get_pixmap_icon_from_wm_hints(WIcon *icon)
|
||||||
{
|
{
|
||||||
Pixmap pixmap;
|
RImage *image = NULL;
|
||||||
unsigned int w, h, d;
|
unsigned int w, h, d;
|
||||||
int x, y;
|
|
||||||
WWindow *wwin = icon->owner;
|
WWindow *wwin = icon->owner;
|
||||||
WScreen *scr = icon->core->screen_ptr;
|
|
||||||
int title_height = WMFontHeight(scr->icon_title_font);
|
|
||||||
|
|
||||||
if (!getSize(wwin->wm_hints->icon_pixmap, &w, &h, &d)) {
|
if (!getSize(wwin->wm_hints->icon_pixmap, &w, &h, &d)) {
|
||||||
icon->owner->wm_hints->flags &= ~IconPixmapHint;
|
icon->owner->wm_hints->flags &= ~IconPixmapHint;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
pixmap = XCreatePixmap(dpy, icon->core->window, wPreferences.icon_size,
|
image = get_wwindow_image_from_wmhints(wwin, icon);
|
||||||
wPreferences.icon_size, scr->w_depth);
|
if (!image)
|
||||||
XSetClipMask(dpy, scr->copy_gc, None);
|
return 1;
|
||||||
XCopyArea(dpy, scr->icon_tile_pixmap, pixmap, scr->copy_gc, 0, 0,
|
|
||||||
wPreferences.icon_size, wPreferences.icon_size, 0, 0);
|
|
||||||
|
|
||||||
if (w > wPreferences.icon_size)
|
icon_update_pixmap(icon, image);
|
||||||
w = wPreferences.icon_size;
|
|
||||||
x = (wPreferences.icon_size - w) / 2;
|
|
||||||
|
|
||||||
if (icon->show_title && (title_height < wPreferences.icon_size)) {
|
return 0;
|
||||||
drawIconTitle(scr, pixmap, title_height);
|
|
||||||
|
|
||||||
if (h > wPreferences.icon_size - title_height - 2) {
|
|
||||||
h = wPreferences.icon_size - title_height - 2;
|
|
||||||
y = title_height + 1;
|
|
||||||
} else {
|
|
||||||
y = (wPreferences.icon_size - h - title_height) / 2 + title_height + 1;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (w > wPreferences.icon_size)
|
|
||||||
w = wPreferences.icon_size;
|
|
||||||
y = (wPreferences.icon_size - h) / 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (wwin->wm_hints->flags & IconMaskHint)
|
|
||||||
XSetClipMask(dpy, scr->copy_gc, wwin->wm_hints->icon_mask);
|
|
||||||
|
|
||||||
XSetClipOrigin(dpy, scr->copy_gc, x, y);
|
|
||||||
|
|
||||||
if (d != scr->w_depth) {
|
|
||||||
XSetForeground(dpy, scr->copy_gc, scr->black_pixel);
|
|
||||||
XSetBackground(dpy, scr->copy_gc, scr->white_pixel);
|
|
||||||
XCopyPlane(dpy, wwin->wm_hints->icon_pixmap, pixmap, scr->copy_gc, 0, 0, w, h, x, y, 1);
|
|
||||||
} else {
|
|
||||||
XCopyArea(dpy, wwin->wm_hints->icon_pixmap, pixmap, scr->copy_gc, 0, 0, w, h, x, y);
|
|
||||||
}
|
|
||||||
|
|
||||||
XSetClipOrigin(dpy, scr->copy_gc, 0, 0);
|
|
||||||
|
|
||||||
icon->pixmap = pixmap;
|
|
||||||
return (0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wIconPaint(WIcon * icon)
|
void wIconPaint(WIcon * icon)
|
||||||
|
|||||||
Reference in New Issue
Block a user