1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-24 23:22:30 +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:
Alexey I. Froloff
2010-09-10 20:51:07 +04:00
committed by Carlos R. Mafra
parent a257e16593
commit 392ab2607d
7 changed files with 98 additions and 18 deletions

View File

@@ -132,8 +132,10 @@ void wSetFocusTo(WScreen *scr, WWindow *wwin)
XSetInputFocus(dpy, scr->no_focus_win, RevertToParent, CurrentTime);
if (old_focused)
wWindowUnfocus(old_focused);
if (oapp)
if (oapp) {
wAppMenuUnmap(oapp->menu);
wApplicationDeactivate(oapp);
}
WMPostNotificationName(WMNChangedFocus, NULL, (void *)True);
return;
@@ -194,8 +196,10 @@ void wSetFocusTo(WScreen *scr, WWindow *wwin)
wwin->next = NULL;
scr->focused_window = wwin;
if (oapp && oapp != napp)
if (oapp && oapp != napp) {
wAppMenuUnmap(oapp->menu);
wApplicationDeactivate(oapp);
}
}
wWindowFocus(wwin, focused);
@@ -207,6 +211,7 @@ void wSetFocusTo(WScreen *scr, WWindow *wwin)
if (wwin->flags.mapped)
wAppMenuMap(napp->menu, wwin);
wApplicationActivate(napp);
}
XFlush(dpy);

View File

@@ -434,6 +434,8 @@ void wApplicationDestroy(WApplication * wapp)
XDeleteContext(dpy, wapp->main_window, wAppWinContext);
wAppMenuDestroy(wapp->menu);
wApplicationDeactivate(wapp);
if (wapp->app_icon) {
if (wapp->app_icon->docked && !wapp->app_icon->attracted) {
wapp->app_icon->running = 0;

View File

@@ -62,5 +62,23 @@ void wApplicationExtractDirPackIcon(WScreen *scr,char *path, char *wm_instance,
char *wm_class);
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

View File

@@ -279,7 +279,7 @@ static void drawIconTitle(WScreen * scr, Pixmap pixmap, int height)
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;
Pixmap pixmap;
@@ -322,6 +322,13 @@ static Pixmap makeIcon(WScreen * scr, RImage * icon, int titled, int shadowed, i
color.alpha = 150; /* about 60% */
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)) {
wwarning(_("error rendering image:%s"), RMessageForError(RErrorCode));
@@ -520,6 +527,18 @@ static void cycleColor(void *data)
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)
{
WScreen *scr = icon->core->screen_ptr;
@@ -669,7 +688,7 @@ void wIconUpdate(WIcon * icon)
if (icon->image) {
icon->pixmap = makeIcon(scr, icon->image, icon->show_title,
icon->shadowed, icon->tile_type);
icon->shadowed, icon->tile_type, icon->highlighted);
} else {
/* make default icons */
@@ -696,8 +715,8 @@ void wIconUpdate(WIcon * icon)
make_icons:
image = wIconValidateIconSize(scr, image);
scr->def_icon_pixmap = makeIcon(scr, image, False, False, icon->tile_type);
scr->def_ticon_pixmap = makeIcon(scr, image, True, 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, icon->highlighted);
if (image)
RReleaseImage(image);
}