aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2021-07-26 14:33:56 +0200
committerJohn Ankarström <john@ankarstrom.se>2021-07-26 14:33:56 +0200
commit7ad85517b33bb1ae2404af7c4d019b3abfe7ca1f (patch)
tree66a988c24355516ca30a8145a22215ede59876e5
parentc60c576fcb8d4b1fe4d23551b50ca464e4bbb0d0 (diff)
downloadjwm-7ad85517b33bb1ae2404af7c4d019b3abfe7ca1f.tar.gz
Highlight tray button when active
-rw-r--r--src/traybutton.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/traybutton.c b/src/traybutton.c
index ce185d0..1f98d0f 100644
--- a/src/traybutton.c
+++ b/src/traybutton.c
@@ -42,7 +42,7 @@ typedef struct TrayButtonType {
static TrayButtonType *buttons;
static void CheckedCreate(TrayComponentType *cp);
-static void Create(TrayComponentType *cp);
+static void Create(TrayComponentType *cp, int active);
static void Destroy(TrayComponentType *cp);
static void SetSize(TrayComponentType *cp, int width, int height);
static void Resize(TrayComponentType *cp);
@@ -287,14 +287,14 @@ CheckedCreate(TrayComponentType *cp)
*/
}
- Create(cp);
+ Create(cp, 0);
}
/***************************************************************************
***************************************************************************/
void
-Create(TrayComponentType *cp)
+Create(TrayComponentType *cp, int active)
{
ButtonNode button;
@@ -310,7 +310,7 @@ Create(TrayComponentType *cp)
JXFillRectangle(display, cp->pixmap, rootGC, 0, 0, cp->width, cp->height);
ResetButton(&button, cp->pixmap, rootGC);
- button.type = BUTTON_TASK;
+ button.type = active ? BUTTON_TASK_ACTIVE : BUTTON_TASK;
button.width = cp->width - 3;
button.height = cp->height - 3;
button.x = 1;
@@ -342,6 +342,8 @@ Create(TrayComponentType *cp)
cp->width - labelx, NULL, bp->label);
}
+ UpdateSpecificTray(cp->tray, cp);
+
}
/***************************************************************************
@@ -351,7 +353,7 @@ Resize(TrayComponentType *cp)
{
Destroy(cp);
- Create(cp);
+ Create(cp, 0);
}
@@ -372,13 +374,19 @@ ProcessButtonEvent(TrayComponentType *cp, int x, int y, int mask)
{
const ScreenType *sp;
+ //long evmask;
int mwidth, mheight;
int button;
+ //XEvent ev;
+
+ //XSendEvent(display, rootWindow, False, evmask, &ev);
TrayButtonType *bp = (TrayButtonType*)cp->object;
Assert(bp);
+ Create(cp, 1);
+
if(bp->action && strlen(bp->action) > 0) {
if(!strncmp(bp->action, "exec:", 5)) {
RunCommand(bp->action + 5);
@@ -417,6 +425,7 @@ ProcessButtonEvent(TrayComponentType *cp, int x, int y, int mask)
ShowRootMenu(button, x, y);
+ Create(cp, 0);
}
/***************************************************************************