aboutsummaryrefslogtreecommitdiff
path: root/src/border.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/border.c')
-rw-r--r--src/border.c68
1 files changed, 39 insertions, 29 deletions
diff --git a/src/border.c b/src/border.c
index cfe6b93..135392c 100644
--- a/src/border.c
+++ b/src/border.c
@@ -58,7 +58,7 @@ static GC borderGC;
static void DrawBorderHelper(const ClientNode *np,
unsigned int width, unsigned int height, int drawIcon);
static void DrawButtonBorder(const ClientNode *np, int offset,
- Pixmap canvas, GC gc);
+ Pixmap canvas, GC gc, BorderActionType button);
static int DrawBorderButtons(const ClientNode *np, Pixmap canvas, GC gc);
/****************************************************************************
@@ -66,6 +66,7 @@ static int DrawBorderButtons(const ClientNode *np, Pixmap canvas, GC gc);
void
InitializeBorders()
{
+ PressedBorderButton = BA_NONE;
}
/****************************************************************************
@@ -394,27 +395,6 @@ DrawBorderHelper(const ClientNode *np,
JXSetForeground(display, gc, borderPixel);
JXFillRectangle(display, canvas, gc, 0, 0, width + 1, height + 1);
- buttonCount = DrawBorderButtons(np, canvas, gc);
- titleWidth = width - (titleHeight + 2) * buttonCount - bsize
- - (titleHeight + bsize + 4) - 2;
-
- if(np->state.border & BORDER_TITLE) {
-
- if(np->icon && np->width >= titleHeight && drawIcon) {
- PutIcon(np->icon, canvas, bsize + 2,
- bsize + titleHeight / 2 - iconSize / 2,
- iconSize, iconSize);
- }
-
- if(np->name && np->name[0] && titleWidth > 0) {
- RenderString(canvas, FONT_BORDER, borderTextColor,
- titleHeight + bsize + 4, bsize + titleHeight / 2
- - GetStringHeight(FONT_BORDER) / 2,
- titleWidth, borderRegion, np->name);
- }
-
- }
-
if(np->state.border & BORDER_OUTLINE) {
/* Draw title outline */
@@ -529,13 +509,34 @@ DrawBorderHelper(const ClientNode *np,
}
+ buttonCount = DrawBorderButtons(np, canvas, gc);
+ titleWidth = width - (titleHeight + 2) * buttonCount - bsize
+ - (titleHeight + bsize + 4) - 2;
+
+ if(np->state.border & BORDER_TITLE) {
+
+ if(np->icon && np->width >= titleHeight && drawIcon) {
+ PutIcon(np->icon, canvas, bsize + 2,
+ bsize + titleHeight / 2 - iconSize / 2,
+ iconSize, iconSize);
+ }
+
+ if(np->name && np->name[0] && titleWidth > 0) {
+ RenderString(canvas, FONT_BORDER, borderTextColor,
+ titleHeight + bsize + 4, bsize + titleHeight / 2
+ - GetStringHeight(FONT_BORDER) / 2,
+ titleWidth, borderRegion, np->name);
+ }
+
+ }
+
}
/****************************************************************************
****************************************************************************/
void
DrawButtonBorder(const ClientNode *np, int offset,
- Pixmap canvas, GC gc)
+ Pixmap canvas, GC gc, BorderActionType button)
{
long up, down;
@@ -559,12 +560,21 @@ DrawButtonBorder(const ClientNode *np, int offset,
JXSetForeground(display, gc, up);
JXDrawLine(display, canvas, gc, offset, bsize + 1,
- offset, titleHeight + bsize - 2);
+ offset, titleHeight + bsize - 2);
JXSetForeground(display, gc, down);
JXDrawLine(display, canvas, gc, offset - 1,
bsize + 1, offset - 1, titleHeight + bsize - 2);
+ if (PressedBorderButton == button) {
+ JXSetForeground(display, gc, down);
+ JXDrawLine(display, canvas, gc, offset, bsize + 1,
+ offset, titleHeight + bsize - 2);
+ JXSetForeground(display, gc, down);
+ JXDrawLine(display, canvas, gc, offset - 1, bsize,
+ offset + titleHeight - 1, bsize);
+ }
+
}
/****************************************************************************
@@ -597,8 +607,6 @@ DrawBorderButtons(const ClientNode *np, Pixmap canvas, GC gc)
if(np->state.border & BORDER_CLOSE) {
- DrawButtonBorder(np, offset, canvas, gc);
-
if(np->state.status & STAT_ACTIVE) {
pixmap = pixmaps[BP_ACTIVE_CLOSE];
} else {
@@ -608,6 +616,8 @@ DrawBorderButtons(const ClientNode *np, Pixmap canvas, GC gc)
JXCopyArea(display, pixmap, canvas, gc, 0, 0, 16, 16,
offset + titleHeight / 2 - 8, bsize + titleHeight / 2 - 8);
+ DrawButtonBorder(np, offset, canvas, gc, BA_CLOSE);
+
offset -= titleHeight;
++count;
@@ -635,7 +645,7 @@ DrawBorderButtons(const ClientNode *np, Pixmap canvas, GC gc)
JXCopyArea(display, pixmap, canvas, gc, 0, 0, 16, 16,
offset + titleHeight / 2 - 8, bsize + titleHeight / 2 - 8);
- DrawButtonBorder(np, offset, canvas, gc);
+ DrawButtonBorder(np, offset, canvas, gc, BA_MAXIMIZE);
offset -= titleHeight;
++count;
@@ -648,8 +658,6 @@ DrawBorderButtons(const ClientNode *np, Pixmap canvas, GC gc)
if(np->state.border & BORDER_MIN) {
- DrawButtonBorder(np, offset, canvas, gc);
-
if(np->state.status & STAT_ACTIVE) {
pixmap = pixmaps[BP_ACTIVE_MINIMIZE];
} else {
@@ -659,6 +667,8 @@ DrawBorderButtons(const ClientNode *np, Pixmap canvas, GC gc)
JXCopyArea(display, pixmap, canvas, gc, 0, 0, 16, 16,
offset + titleHeight / 2 - 8, bsize + titleHeight / 2 - 8);
+ DrawButtonBorder(np, offset, canvas, gc, BA_MINIMIZE);
+
++count;
}