12#include <X11/extensions/shape.h>
83 fprintf(
stderr,
"SetupFrame: x=%d, y=%d, w=%d, h=%d, bw=%d\n",
98#define MARGIN (16 - 1)
154 fprintf(
stderr,
"%s(): %p not the expected Occupy window %p.\n",
190 title_width =
xwc.width = w - (2 *
tmp_win->frame_bw3D);
215 title_width =
tmp_win->rightx +
Scr->TBInfo.rightoff;
216 if(title_width <
xwc.width) {
217 xwc.width = title_width;
228 if(
tmp_win->frame_height != h ||
231 title_width !=
tmp_win->title_width) {
239 title_width =
xwc.width;
244 tmp_win->title_width = title_width;
252 if(
tmp_win->title_height != 0) {
267 xwc.border_width =
bw;
283 tmp_win->widthEverChangedByUser =
true;
286 tmp_win->heightEverChangedByUser =
true;
373 if(
tmp_win->title_height != 0) {
384 if(
Scr->use3Dtitles) {
385 xwc.width -=
Scr->TitleButtonShadowDepth;
416 if(
Scr->TBInfo.nright > 0) {
417 xwc.width -= 2 *
Scr->TitlePadding;
421 if(
Scr->use3Dtitles) {
422 xwc.width -=
Scr->TitleButtonShadowDepth;
519 tmp->frame_bw3D,
tmp->title_height +
tmp->frame_bw3D,
tmp->w,
523 tmp->title_x +
tmp->frame_bw,
524 tmp->title_y +
tmp->frame_bw,
534 if(
tmp->squeeze_info && !
tmp->squeezed) {
607 tmp->title_y =
tmp->frame_bw3D -
tmp->frame_bw;
610 if(
tmp->squeeze_info && !
tmp->squeezed) {
614 int tw =
tmp->title_width + 2 *
tmp->frame_bw3D;
628 switch(
si->justify) {
650 tmp->title_x =
tmp->frame_bw3D -
tmp->frame_bw;
665 int leftx, rightx,
y;
673 if(
tmp_win->title_height == 0) {
685 leftx =
y =
Scr->TBInfo.leftx;
705 nb =
Scr->TBInfo.nleft +
Scr->TBInfo.nright;
721 unsigned int h = (
Scr->TBInfo.width -
Scr->TBInfo.border * 2);
741 if(
Scr->NameDecorations) {
761 fprintf(
stderr,
"%s: unable to add titlebar button \"%s\"\n",
834 const int titlew = width -
Scr->TBInfo.titlex -
Scr->TBInfo.rightoff;
859 fprintf(
stderr,
"%s(): Unexpected Scr->TitleJustification %d, "
860 "treating as left\n",
__func__,
Scr->TitleJustification);
863 if(
Scr->use3Dtitles) {
879 if(
Scr->use3Dtitles) {
893 if(
Scr->use3Dtitles) {
894 if(
tmp_win->name_x < (
Scr->TBInfo.titlex + 2 *
Scr->TitleShadowDepth)) {
895 tmp_win->name_x =
Scr->TBInfo.titlex + 2 *
Scr->TitleShadowDepth;
898 else if(
tmp_win->name_x <
Scr->TBInfo.titlex) {
908 if(
Scr->use3Dtitles) {
909 tmp_win->highlightxl +=
Scr->TitleShadowDepth;
928 if(
Scr->use3Dtitles) {
931 if(
tmp_win->hilite_wr ||
Scr->TBInfo.nright > 0) {
948 tmp_win->rightx = width -
Scr->TBInfo.rightoff;
951 + (
tmp_win->hilite_wr ?
Scr->TBInfo.width * 2 : 0)
952 + (
Scr->TBInfo.nright > 0 ?
Scr->TitlePadding : 0)
953 +
Scr->FramePadding);
971 int h = (
Scr->TitleHeight - 2 *
Scr->FramePadding);
972 int y =
Scr->FramePadding;
979 if(!
tmp_win->titlehighlight) {
996 if(
Scr->HighlightPixmapName) {
1005 if(
Scr->use3Dtitles && (
Scr->Monochrome !=
COLOR)) {
1018 &(
tmp_win->HiliteImage->height));
1038 if(
Scr->use3Dtitles) {
1039 y +=
Scr->TitleShadowDepth;
1040 h -= 2 *
Scr->TitleShadowDepth;
1047#define MKWIN() XCreateWindow(dpy, tmp_win->title_w, 0, y, \
1048 Scr->TBInfo.width, h, \
1049 0, Scr->d_depth, CopyFromParent, \
1050 Scr->d_visual, valuemask, &attributes)
1053 if(
Scr->NameDecorations) {
1059 if(
Scr->NameDecorations) {
1078 if(
Scr->HighlightPixmapName) {
1099 int h = (
Scr->TitleHeight - 2 *
Scr->FramePadding);
1100 int y =
Scr->FramePadding;
1111 if(!
Scr->UseSunkTitlePixmap || !
tmp_win->titlehighlight) {
1120 if(
Scr->HighlightPixmapName) {
1139 if(
Scr->use3Dtitles) {
1140 y +=
Scr->TitleShadowDepth;
1141 h -= 2 *
Scr->TitleShadowDepth;
1148#define MKWIN() XCreateWindow(dpy, tmp_win->title_w, 0, y, \
1149 Scr->TBInfo.width, h, \
1150 0, Scr->d_depth, CopyFromParent, \
1151 Scr->d_visual, valuemask, &attributes)
1154 if(
Scr->NameDecorations) {
1160 if(
Scr->NameDecorations) {
1192 if(
Scr->use3Dtitles) {
1198 -
Scr->TBInfo.rightoff -
Scr->TitlePadding;
1207 (
tmp_win->title_height != 0)) {
1212 Scr->TitleHeight,
Scr->TitleShadowDepth,
1213 tmp_win->title, state,
true,
false);
1220 if(
Scr->use3Dtitles) {
1237 Scr->TBInfo.rightoff -
Scr->TitlePadding -
1238 Scr->TitleShadowDepth - 4;
1286 int nb =
Scr->TBInfo.nleft +
Scr->TBInfo.nright;
1302 tb->srcx,
tb->srcy,
tb->width,
tb->height,
1303 tb->dstx,
tb->dsty);
1331 bw, cp,
on,
true,
false);
1337 bw, cp,
on,
true,
false);
1343 rects [0].height = height;
1352 bw, cp,
on,
true,
false);
1359 rects [0].height = height;
1368 bw, cp,
on,
true,
false);
1373 fprintf(
stderr,
"Internal error: Invalid Draw3DCorner type %d\n",
1400 if(
tmp_win->title_height == 0) {
1403 Scr->BorderShadowDepth, cp,
off,
true,
false);
1405 tmp_win->frame_bw3D -
Scr->BorderShadowDepth,
1406 tmp_win->frame_bw3D -
Scr->BorderShadowDepth,
1409 Scr->BorderShadowDepth, cp,
on,
true,
false);
1421#define CORNERLEN (Scr->TitleHeight + tmp_win->frame_bw3D)
1454 Scr->BorderShadowDepth, cp,
off,
true,
false);
1461 Scr->BorderShadowDepth, cp,
off,
true,
false);
1468 Scr->BorderShadowDepth, cp,
off,
true,
false);
1475 Scr->BorderShadowDepth, cp,
off,
true,
false);
1494 Scr->BorderShadowDepth, cp,
off,
true,
false);
1501 Scr->BorderShadowDepth, cp,
off,
true,
false);
1525 h =
Scr->TitleHeight +
wd;
1529#if defined DEBUG && DEBUG
1550 if((
x < -
wd) || (
y < -
wd)) {
1551 cursor =
Scr->FrameCursor;
1557 else if(
y >=
fh - h) {
1564 else if(
x >=
fw - h) {
1568 else if(
y >=
fh - h) {
1578 else if(
y >=
fh - h) {
1582 cursor =
Scr->FrameCursor;
1584 attr.cursor = cursor;
#define FB(fix_fore, fix_back)
void Draw3DBorder(Window w, int x, int y, int width, int height, int bw, ColorPair cp, ButtonState state, bool fill, bool forcebw)
Image * GetImage(const char *name, ColorPair cp)
Pixmap mk_blackgray_pixmap(const char *which, Drawable dw, unsigned long fg, unsigned long bg)
void get_blackgray_size(int *width, int *height)
void ResizeOccupyWindow(TwmWindow *win)
RArea RAreaNew(int x, int y, int width, int height)
Construct an RArea from given components.
int RLayoutFindBottomEdge(const RLayout *self, const RArea *area)
Find the bottom of the top stripe of self that area fits into.
int RLayoutFindRightEdge(const RLayout *self, const RArea *area)
Find the right edge of the left-most stripe of self that area fits into.
int RLayoutFindLeftEdge(const RLayout *self, const RArea *area)
Find the left edge of the right-most stripe of self that area fits into.
int RLayoutFindTopEdge(const RLayout *self, const RArea *area)
Find the top of the bottom stripe of self that area fits into.
A particular extent of space.
Info and control for every X Window we take over.
void CreateWindowTitlebarButtons(TwmWindow *tmp_win)
void SetBorderCursor(TwmWindow *tmp_win, int x, int y)
void PaintTitle(TwmWindow *tmp_win)
void ComputeTitleLocation(TwmWindow *tmp)
void SetFrameShape(TwmWindow *tmp)
void PaintTitleButton(TwmWindow *tmp_win, TBWindow *tbw)
void SetupWindow(TwmWindow *tmp_win, int x, int y, int w, int h, int bw)
static void Draw3DCorner(Window w, int x, int y, int width, int height, int thick, int bw, ColorPair cp, CornerType type)
void PaintTitleButtons(TwmWindow *tmp_win)
void PaintBorders(TwmWindow *tmp_win, bool focus)
void SetupFrame(TwmWindow *tmp_win, int x, int y, int w, int h, int bw, bool sendEvent)
static void CreateHighlightWindows(TwmWindow *tmp_win)
static void ComputeWindowTitleOffsets(TwmWindow *tmp_win, unsigned int width, bool squeeze)
static void CreateLowlightWindows(TwmWindow *tmp_win)
void DeleteHighlightWindows(TwmWindow *tmp_win)
bool visible(const TwmWindow *tmp_win)
void WMapSetupWindow(TwmWindow *win, int x, int y, int w, int h)