JWM Source Documentation
Functions | Variables
border.c File Reference

Functions for handling window borders. More...

#include "jwm.h"
#include "border.h"
#include "client.h"
#include "clientlist.h"
#include "color.h"
#include "icon.h"
#include "font.h"
#include "misc.h"
#include "settings.h"
#include "grab.h"

Go to the source code of this file.

Functions

static void DrawBorderHelper (const ClientNode *np)
 Helper method for drawing borders.
 
static void DrawBorderHandles (const ClientNode *np, Pixmap canvas, GC gc)
 Draw window handles.
 
static void DrawBorderButtons (const ClientNode *np, Pixmap canvas, GC gc)
 Draw the buttons on a client frame.
 
static char DrawBorderIcon (BorderIconType t, unsigned xoffset, unsigned yoffset, Pixmap canvas, long fg)
 Attempt to draw a border icon.
 
static void DrawCloseButton (unsigned xoffset, unsigned yoffset, Pixmap canvas, GC gc, long fg)
 Draw a close button.
 
static void DrawMaxIButton (unsigned xoffset, unsigned yoffset, Pixmap canvas, GC gc, long fg)
 Draw an inactive maximize button.
 
static void DrawMaxAButton (unsigned xoffset, unsigned yoffset, Pixmap canvas, GC gc, long fg)
 Draw an active maximize button.
 
static void DrawMinButton (unsigned xoffset, unsigned yoffset, Pixmap canvas, GC gc, long fg)
 Draw a minimize button.
 
static unsigned GetButtonCount (const ClientNode *np)
 Determine the number of buttons to be displayed for a client.
 
static void FillRoundedRectangle (Drawable d, GC gc, int x, int y, int width, int height, int radius)
 Fill a rounded rectangle.
 
void InitializeBorders (void)
 Initialize structures.
 
void StartupBorders (void)
 Initialize server resources.
 
void DestroyBorders (void)
 Destroy structures.
 
int GetBorderIconSize (void)
 Get the size of the icon to display on a window.
 
BorderActionType GetBorderActionType (const ClientNode *np, int x, int y)
 Determine the border action to take given coordinates.
 
void ResetBorder (const ClientNode *np)
 Reset the shape of a window border.
 
void DrawBorder (ClientNode *np)
 Draw a client border.
 
void ExposeCurrentDesktop (void)
 Redraw the borders on the current desktop.
 
unsigned GetTitleHeight (void)
 Get the height of a window title bar.
 
void GetBorderSize (const ClientState *state, int *north, int *south, int *east, int *west)
 Get the size of the borders for a client.
 
void DrawRoundedRectangle (Drawable d, GC gc, int x, int y, int width, int height, int radius)
 Draw a rounded rectangle.
 
void SetBorderIcon (BorderIconType t, const char *name)
 Set the icon to use for a button.
 

Variables

static char * buttonNames [BI_COUNT]
 
static IconNodebuttonIcons [BI_COUNT]
 

Detailed Description

Functions for handling window borders.

Author
Joe Wingbermuehle
Date
2004-2015

Definition in file border.c.

Function Documentation

void DestroyBorders ( void  )

Destroy structures.

Definition at line 75 of file border.c.

References BI_COUNT, buttonNames, and Release.

Referenced by Destroy().

void DrawBorder ( ClientNode np)
void DrawBorderButtons ( const ClientNode np,
Pixmap  canvas,
GC  gc 
)
static
void DrawBorderHandles ( const ClientNode np,
Pixmap  canvas,
GC  gc 
)
static
void DrawBorderHelper ( const ClientNode np)
static
char DrawBorderIcon ( BorderIconType  t,
unsigned  xoffset,
unsigned  yoffset,
Pixmap  canvas,
long  fg 
)
static

Attempt to draw a border icon.

Definition at line 929 of file border.c.

References GetTitleHeight(), and PutIcon().

Referenced by DrawCloseButton(), DrawMaxAButton(), DrawMaxIButton(), and DrawMinButton().

void DrawCloseButton ( unsigned  xoffset,
unsigned  yoffset,
Pixmap  canvas,
GC  gc,
long  fg 
)
static

Draw a close button.

Definition at line 946 of file border.c.

References BI_CLOSE, display, DrawBorderIcon(), GetTitleHeight(), JXDrawSegments, and JXSetLineAttributes.

Referenced by DrawBorderButtons().

void DrawMaxAButton ( unsigned  xoffset,
unsigned  yoffset,
Pixmap  canvas,
GC  gc,
long  fg 
)
static

Draw an active maximize button.

Definition at line 1038 of file border.c.

References BI_MAX_ACTIVE, display, DrawBorderIcon(), GetTitleHeight(), JXDrawSegments, and JXSetLineAttributes.

Referenced by DrawBorderButtons().

void DrawMaxIButton ( unsigned  xoffset,
unsigned  yoffset,
Pixmap  canvas,
GC  gc,
long  fg 
)
static

Draw an inactive maximize button.

Definition at line 984 of file border.c.

References BI_MAX, display, DrawBorderIcon(), GetTitleHeight(), JXDrawSegments, and JXSetLineAttributes.

Referenced by DrawBorderButtons().

void DrawMinButton ( unsigned  xoffset,
unsigned  yoffset,
Pixmap  canvas,
GC  gc,
long  fg 
)
static

Draw a minimize button.

Definition at line 1109 of file border.c.

References BI_MIN, display, DrawBorderIcon(), GetTitleHeight(), JXDrawLine, and JXSetLineAttributes.

Referenced by DrawBorderButtons().

void DrawRoundedRectangle ( Drawable  d,
GC  gc,
int  x,
int  y,
int  width,
int  height,
int  radius 
)

Draw a rounded rectangle.

Definition at line 1230 of file border.c.

References display, JXDrawArcs, JXDrawRectangle, and JXDrawSegments.

Referenced by DrawBorderHelper().

void ExposeCurrentDesktop ( void  )

Redraw the borders on the current desktop.

Redraw all borders on the current desktop.

This should be done after loading clients since the stacking order may cause borders on the current desktop to become visible after moving clients to their assigned desktops.

Definition at line 1139 of file border.c.

References DrawBorder(), LAYER_COUNT, ClientNode::next, nodes, STAT_HIDDEN, STAT_MINIMIZED, ClientNode::state, and ClientState::status.

Referenced by Startup().

void FillRoundedRectangle ( Drawable  d,
GC  gc,
int  x,
int  y,
int  width,
int  height,
int  radius 
)
static

Fill a rounded rectangle.

Definition at line 1298 of file border.c.

References display, JXFillArcs, and JXFillRectangles.

Referenced by ResetBorder().

BorderActionType GetBorderActionType ( const ClientNode np,
int  x,
int  y 
)
int GetBorderIconSize ( void  )

Get the size of the icon to display on a window.

Get the size of a border icon.

Definition at line 88 of file border.c.

References DECO_MOTIF, GetTitleHeight(), Max, settings, and Settings::windowDecorations.

Referenced by DrawBorderHelper(), and StartupIcons().

void GetBorderSize ( const ClientState state,
int *  north,
int *  south,
int *  east,
int *  west 
)
unsigned GetButtonCount ( const ClientNode np)
static

Determine the number of buttons to be displayed for a client.

Definition at line 765 of file border.c.

References ClientState::border, BORDER_CLOSE, BORDER_MAX, BORDER_MIN, BORDER_TITLE, Settings::borderWidth, DECO_MOTIF, GetBorderSize(), GetTitleHeight(), settings, ClientNode::state, ClientNode::width, and Settings::windowDecorations.

Referenced by DrawBorderHelper().

unsigned GetTitleHeight ( void  )
void InitializeBorders ( void  )

Initialize structures.

Definition at line 48 of file border.c.

References buttonNames.

Referenced by Initialize().

void ResetBorder ( const ClientNode np)
void SetBorderIcon ( BorderIconType  t,
const char *  name 
)

Set the icon to use for a button.

Set the icon to use for a border button.

Definition at line 1358 of file border.c.

References buttonNames, CopyString(), and Release.

Referenced by Parse().

void StartupBorders ( void  )

Initialize server resources.

Definition at line 54 of file border.c.

References BI_COUNT, BI_MENU, buttonNames, GetDefaultIcon(), LoadNamedIcon(), and Release.

Referenced by Startup().

Variable Documentation

IconNode* buttonIcons[BI_COUNT]
static

Definition at line 22 of file border.c.

char* buttonNames[BI_COUNT]
static

Definition at line 21 of file border.c.

Referenced by DestroyBorders(), InitializeBorders(), SetBorderIcon(), and StartupBorders().

joewing.net / Projects / JWM