mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 20:38:08 +01:00
Highlite current window's appicon
This patch highlites appicon of a currently focused window. Original-patch-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Signed-off-by: Alexey I. Froloff <raorn@altlinux.org>
This commit is contained in:
committed by
Carlos R. Mafra
parent
a257e16593
commit
392ab2607d
@@ -132,8 +132,10 @@ void wSetFocusTo(WScreen *scr, WWindow *wwin)
|
|||||||
XSetInputFocus(dpy, scr->no_focus_win, RevertToParent, CurrentTime);
|
XSetInputFocus(dpy, scr->no_focus_win, RevertToParent, CurrentTime);
|
||||||
if (old_focused)
|
if (old_focused)
|
||||||
wWindowUnfocus(old_focused);
|
wWindowUnfocus(old_focused);
|
||||||
if (oapp)
|
if (oapp) {
|
||||||
wAppMenuUnmap(oapp->menu);
|
wAppMenuUnmap(oapp->menu);
|
||||||
|
wApplicationDeactivate(oapp);
|
||||||
|
}
|
||||||
|
|
||||||
WMPostNotificationName(WMNChangedFocus, NULL, (void *)True);
|
WMPostNotificationName(WMNChangedFocus, NULL, (void *)True);
|
||||||
return;
|
return;
|
||||||
@@ -194,8 +196,10 @@ void wSetFocusTo(WScreen *scr, WWindow *wwin)
|
|||||||
wwin->next = NULL;
|
wwin->next = NULL;
|
||||||
scr->focused_window = wwin;
|
scr->focused_window = wwin;
|
||||||
|
|
||||||
if (oapp && oapp != napp)
|
if (oapp && oapp != napp) {
|
||||||
wAppMenuUnmap(oapp->menu);
|
wAppMenuUnmap(oapp->menu);
|
||||||
|
wApplicationDeactivate(oapp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wWindowFocus(wwin, focused);
|
wWindowFocus(wwin, focused);
|
||||||
@@ -207,6 +211,7 @@ void wSetFocusTo(WScreen *scr, WWindow *wwin)
|
|||||||
|
|
||||||
if (wwin->flags.mapped)
|
if (wwin->flags.mapped)
|
||||||
wAppMenuMap(napp->menu, wwin);
|
wAppMenuMap(napp->menu, wwin);
|
||||||
|
wApplicationActivate(napp);
|
||||||
}
|
}
|
||||||
|
|
||||||
XFlush(dpy);
|
XFlush(dpy);
|
||||||
|
|||||||
@@ -434,6 +434,8 @@ void wApplicationDestroy(WApplication * wapp)
|
|||||||
|
|
||||||
XDeleteContext(dpy, wapp->main_window, wAppWinContext);
|
XDeleteContext(dpy, wapp->main_window, wAppWinContext);
|
||||||
wAppMenuDestroy(wapp->menu);
|
wAppMenuDestroy(wapp->menu);
|
||||||
|
wApplicationDeactivate(wapp);
|
||||||
|
|
||||||
if (wapp->app_icon) {
|
if (wapp->app_icon) {
|
||||||
if (wapp->app_icon->docked && !wapp->app_icon->attracted) {
|
if (wapp->app_icon->docked && !wapp->app_icon->attracted) {
|
||||||
wapp->app_icon->running = 0;
|
wapp->app_icon->running = 0;
|
||||||
|
|||||||
@@ -62,5 +62,23 @@ void wApplicationExtractDirPackIcon(WScreen *scr,char *path, char *wm_instance,
|
|||||||
char *wm_class);
|
char *wm_class);
|
||||||
|
|
||||||
void wAppBounce(WApplication *);
|
void wAppBounce(WApplication *);
|
||||||
#endif
|
|
||||||
|
|
||||||
|
#ifdef NEWAPPICON
|
||||||
|
#define wApplicationActivate(wapp) do { \
|
||||||
|
if (wapp->app_icon) { \
|
||||||
|
wIconSetHighlited(wapp->app_icon->icon, True); \
|
||||||
|
wAppIconPaint(wapp->app_icon);\
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
#define wApplicationDeactivate(wapp) do { \
|
||||||
|
if (wapp->app_icon) { \
|
||||||
|
wIconSetHighlited(wapp->app_icon->icon, False); \
|
||||||
|
wAppIconPaint(wapp->app_icon);\
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
#else
|
||||||
|
#define wApplicationActivate(wapp) do { } while (0)
|
||||||
|
#define wApplicationDeactivate(wapp) do { } while (0)
|
||||||
|
#endif /* NEWAPPICON */
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|||||||
27
src/icon.c
27
src/icon.c
@@ -279,7 +279,7 @@ static void drawIconTitle(WScreen * scr, Pixmap pixmap, int height)
|
|||||||
wPreferences.icon_size - 1, 0, wPreferences.icon_size - 1, height + 1);
|
wPreferences.icon_size - 1, 0, wPreferences.icon_size - 1, height + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Pixmap makeIcon(WScreen * scr, RImage * icon, int titled, int shadowed, int tileType)
|
static Pixmap makeIcon(WScreen *scr, RImage *icon, int titled, int shadowed, int tileType, int highlighted)
|
||||||
{
|
{
|
||||||
RImage *tile;
|
RImage *tile;
|
||||||
Pixmap pixmap;
|
Pixmap pixmap;
|
||||||
@@ -322,6 +322,13 @@ static Pixmap makeIcon(WScreen * scr, RImage * icon, int titled, int shadowed, i
|
|||||||
color.alpha = 150; /* about 60% */
|
color.alpha = 150; /* about 60% */
|
||||||
RClearImage(tile, &color);
|
RClearImage(tile, &color);
|
||||||
}
|
}
|
||||||
|
if (highlighted) {
|
||||||
|
RColor color;
|
||||||
|
|
||||||
|
color.red = color.green = color.blue = 0;
|
||||||
|
color.alpha = 160;
|
||||||
|
RLightImage(tile, &color);
|
||||||
|
}
|
||||||
|
|
||||||
if (!RConvertImage(scr->rcontext, tile, &pixmap)) {
|
if (!RConvertImage(scr->rcontext, tile, &pixmap)) {
|
||||||
wwarning(_("error rendering image:%s"), RMessageForError(RErrorCode));
|
wwarning(_("error rendering image:%s"), RMessageForError(RErrorCode));
|
||||||
@@ -520,6 +527,18 @@ static void cycleColor(void *data)
|
|||||||
icon->handlerID = WMAddTimerHandler(COLOR_CYCLE_DELAY, cycleColor, icon);
|
icon->handlerID = WMAddTimerHandler(COLOR_CYCLE_DELAY, cycleColor, icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef NEWAPPICON
|
||||||
|
void wIconSetHighlited(WIcon *icon, Bool flag)
|
||||||
|
{
|
||||||
|
if (icon->highlighted == flag)
|
||||||
|
return;
|
||||||
|
|
||||||
|
icon->highlighted = flag;
|
||||||
|
icon->force_paint = True;
|
||||||
|
wIconPaint(icon);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void wIconSelect(WIcon * icon)
|
void wIconSelect(WIcon * icon)
|
||||||
{
|
{
|
||||||
WScreen *scr = icon->core->screen_ptr;
|
WScreen *scr = icon->core->screen_ptr;
|
||||||
@@ -669,7 +688,7 @@ void wIconUpdate(WIcon * icon)
|
|||||||
|
|
||||||
if (icon->image) {
|
if (icon->image) {
|
||||||
icon->pixmap = makeIcon(scr, icon->image, icon->show_title,
|
icon->pixmap = makeIcon(scr, icon->image, icon->show_title,
|
||||||
icon->shadowed, icon->tile_type);
|
icon->shadowed, icon->tile_type, icon->highlighted);
|
||||||
} else {
|
} else {
|
||||||
/* make default icons */
|
/* make default icons */
|
||||||
|
|
||||||
@@ -696,8 +715,8 @@ void wIconUpdate(WIcon * icon)
|
|||||||
make_icons:
|
make_icons:
|
||||||
|
|
||||||
image = wIconValidateIconSize(scr, image);
|
image = wIconValidateIconSize(scr, image);
|
||||||
scr->def_icon_pixmap = makeIcon(scr, image, False, False, icon->tile_type);
|
scr->def_icon_pixmap = makeIcon(scr, image, False, False, icon->tile_type, icon->highlighted);
|
||||||
scr->def_ticon_pixmap = makeIcon(scr, image, True, False, icon->tile_type);
|
scr->def_ticon_pixmap = makeIcon(scr, image, True, False, icon->tile_type, icon->highlighted);
|
||||||
if (image)
|
if (image)
|
||||||
RReleaseImage(image);
|
RReleaseImage(image);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ LIBWRASTER3
|
|||||||
RGetSubImage;
|
RGetSubImage;
|
||||||
RGetXImage;
|
RGetXImage;
|
||||||
RHSVtoRGB;
|
RHSVtoRGB;
|
||||||
|
RLightImage;
|
||||||
RLoadImage;
|
RLoadImage;
|
||||||
RMakeCenteredImage;
|
RMakeCenteredImage;
|
||||||
RMakeTiledImage;
|
RMakeTiledImage;
|
||||||
|
|||||||
55
wrlib/misc.c
55
wrlib/misc.c
@@ -140,7 +140,7 @@ void RClearImage(RImage * image, RColor * color)
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
int bytes = image->width * image->height;
|
int bytes = image->width * image->height;
|
||||||
int alpha, nalpha, r, g, b;
|
int alpha, nalpha, r, g, b, s;
|
||||||
|
|
||||||
alpha = color->alpha;
|
alpha = color->alpha;
|
||||||
r = color->red * alpha;
|
r = color->red * alpha;
|
||||||
@@ -148,16 +148,49 @@ void RClearImage(RImage * image, RColor * color)
|
|||||||
b = color->blue * alpha;
|
b = color->blue * alpha;
|
||||||
nalpha = 255 - alpha;
|
nalpha = 255 - alpha;
|
||||||
|
|
||||||
for (i = 0; i < bytes; i++) {
|
s = (image->format == RRGBAFormat) ? 4 : 3;
|
||||||
*d = (((int)*d * nalpha) + r) / 256;
|
|
||||||
d++;
|
for (i = 0; i < bytes; i++, d += s) {
|
||||||
*d = (((int)*d * nalpha) + g) / 256;
|
d[0] = (((int)d[0] * nalpha) + r)/256;
|
||||||
d++;
|
d[1] = (((int)d[1] * nalpha) + g)/256;
|
||||||
*d = (((int)*d * nalpha) + b) / 256;
|
d[2] = (((int)d[2] * nalpha) + b)/256;
|
||||||
d++;
|
}
|
||||||
if (image->format == RRGBAFormat) {
|
}
|
||||||
d++;
|
}
|
||||||
}
|
|
||||||
|
static __inline__ unsigned char clip(int c)
|
||||||
|
{
|
||||||
|
if (c > 255)
|
||||||
|
c = 255;
|
||||||
|
return (unsigned char)c;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RLightImage(RImage *image, RColor *color)
|
||||||
|
{
|
||||||
|
unsigned char *d = image->data;
|
||||||
|
unsigned char *dd;
|
||||||
|
int alpha, r, g, b, s;
|
||||||
|
|
||||||
|
s = (image->format == RRGBAFormat) ? 4 : 3;
|
||||||
|
dd = d + s*image->width*image->height;
|
||||||
|
|
||||||
|
r = color->red;
|
||||||
|
g = color->green;
|
||||||
|
b = color->blue;
|
||||||
|
|
||||||
|
alpha = color->alpha;
|
||||||
|
|
||||||
|
if (r == 0 && g == 0 && b == 0) {
|
||||||
|
for (; d < dd; d += s) {
|
||||||
|
d[0] = clip(((int)d[0] * alpha)/128);
|
||||||
|
d[1] = clip(((int)d[1] * alpha)/128);
|
||||||
|
d[2] = clip(((int)d[2] * alpha)/128);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (; d < dd; d += s) {
|
||||||
|
d[0] = clip((((int)d[0] * alpha) + r)/128);
|
||||||
|
d[1] = clip((((int)d[1] * alpha) + g)/128);
|
||||||
|
d[2] = clip((((int)d[2] * alpha) + b)/128);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -411,6 +411,8 @@ void RHSVtoRGB(RHSVColor *hsv, RColor *rgb);
|
|||||||
*/
|
*/
|
||||||
void RClearImage(RImage *image, RColor *color);
|
void RClearImage(RImage *image, RColor *color);
|
||||||
|
|
||||||
|
void RLightImage(RImage *image, RColor *color);
|
||||||
|
|
||||||
void RFillImage(RImage *image, RColor *color);
|
void RFillImage(RImage *image, RColor *color);
|
||||||
|
|
||||||
void RBevelImage(RImage *image, int bevel_type);
|
void RBevelImage(RImage *image, int bevel_type);
|
||||||
|
|||||||
Reference in New Issue
Block a user