JWM Source Documentation
Data Structures | Macros | Typedefs | Functions
tray.h File Reference

Tray functions. More...

#include "hint.h"

Go to the source code of this file.

Data Structures

struct  TrayComponentType
 Structure to hold common tray component data. More...
 
struct  TrayType
 Structure to represent a tray. More...
 

Macros

#define LAYOUT_HORIZONTAL   0
 Left-to-right.
 
#define LAYOUT_VERTICAL   1
 Top-to-bottom.
 
#define TALIGN_FIXED   0
 Fixed at user specified x and y coordinates.
 
#define TALIGN_LEFT   1
 Left aligned.
 
#define TALIGN_TOP   2
 Top aligned.
 
#define TALIGN_CENTER   3
 Center aligned.
 
#define TALIGN_RIGHT   4
 Right aligned.
 
#define TALIGN_BOTTOM   5
 Bottom aligned.
 
#define THIDE_OFF   0
 No autohide.
 
#define THIDE_LEFT   1
 Hide on the left.
 
#define THIDE_RIGHT   2
 Hide on the right.
 
#define THIDE_TOP   3
 Hide on the top.
 
#define THIDE_BOTTOM   4
 Hide on the bottom.
 
#define THIDE_RAISED   8
 Mask to indicate the tray is raised.
 

Typedefs

typedef unsigned char LayoutType
 Enumeration of tray layouts.
 
typedef unsigned char TrayAlignmentType
 Enumeration of tray alignments.
 
typedef unsigned char TrayAutoHideType
 Enumeration of tray autohide values.
 
typedef struct TrayComponentType TrayComponentType
 Structure to hold common tray component data.
 
typedef struct TrayType TrayType
 Structure to represent a tray.
 

Functions

void InitializeTray (void)
 Initialize tray data.
 
void StartupTray (void)
 Startup trays.
 
void ShutdownTray (void)
 Shutdown trays.
 
void DestroyTray (void)
 Destroy tray data.
 
TrayTypeCreateTray (void)
 Create a new tray.
 
TrayComponentTypeCreateTrayComponent (void)
 Create a tray component.
 
void AddTrayComponent (TrayType *tp, TrayComponentType *cp)
 Add a tray component to a tray.
 
void ShowTray (TrayType *tp)
 Show a tray.
 
void ShowAllTrays (void)
 Show all trays.
 
void HideTray (TrayType *tp)
 Hide a tray.
 
void DrawTray (void)
 Draw all trays.
 
void DrawSpecificTray (const TrayType *tp)
 Draw a specific tray.
 
void RaiseTrays (void)
 Raise tray windows.
 
void LowerTrays (void)
 Lower tray windows.
 
void UpdateSpecificTray (const TrayType *tp, const TrayComponentType *cp)
 Update a component on a tray.
 
void ResizeTray (TrayType *tp)
 Resize a tray.
 
void ClearTrayDrawable (const TrayComponentType *cp)
 Draw the tray background on a drawable.
 
TrayTypeGetTrays (void)
 Get a linked list of trays.
 
unsigned int GetTrayCount (void)
 Get the number of trays.
 
char ProcessTrayEvent (const XEvent *event)
 Process an event that may be for a tray.
 
void SetAutoHideTray (TrayType *tp, TrayAutoHideType autohide)
 Set whether auto hide is enabled for a tray.
 
void SetTrayX (TrayType *tp, const char *str)
 Set the tray x-coordinate.
 
void SetTrayY (TrayType *tp, const char *str)
 Set the tray y-coordinate.
 
void SetTrayWidth (TrayType *tp, const char *str)
 Set the tray width.
 
void SetTrayHeight (TrayType *tp, const char *str)
 Set the tray height.
 
void SetTrayLayout (TrayType *tp, const char *str)
 Set the tray layout.
 
void SetTrayLayer (TrayType *tp, WinLayerType layer)
 Set the tray layer.
 
void SetTrayHorizontalAlignment (TrayType *tp, const char *str)
 Set the tray horizontal alignment.
 
void SetTrayVerticalAlignment (TrayType *tp, const char *str)
 Set the tray vertical alignment.
 

Detailed Description

Tray functions.

Author
Joe Wingbermuehle
Date
2004-2006

Definition in file tray.h.

Macro Definition Documentation

#define LAYOUT_HORIZONTAL   0
#define LAYOUT_VERTICAL   1

Top-to-bottom.

Definition at line 18 of file tray.h.

Referenced by ComputeItemSize(), SetSize(), SetTrayLayout(), and UpdateTaskBar().

#define TALIGN_BOTTOM   5

Bottom aligned.

Definition at line 27 of file tray.h.

Referenced by ComputeTraySize(), and SetTrayVerticalAlignment().

#define TALIGN_CENTER   3

Center aligned.

Definition at line 25 of file tray.h.

Referenced by ComputeTraySize(), SetTrayHorizontalAlignment(), and SetTrayVerticalAlignment().

#define TALIGN_FIXED   0

Fixed at user specified x and y coordinates.

Definition at line 22 of file tray.h.

Referenced by CreateTray(), SetTrayHorizontalAlignment(), and SetTrayVerticalAlignment().

#define TALIGN_LEFT   1

Left aligned.

Definition at line 23 of file tray.h.

Referenced by ComputeTraySize(), and SetTrayHorizontalAlignment().

#define TALIGN_RIGHT   4

Right aligned.

Definition at line 26 of file tray.h.

Referenced by ComputeTraySize(), and SetTrayHorizontalAlignment().

#define TALIGN_TOP   2

Top aligned.

Definition at line 24 of file tray.h.

Referenced by ComputeTraySize(), and SetTrayVerticalAlignment().

#define THIDE_BOTTOM   4

Hide on the bottom.

Definition at line 35 of file tray.h.

Referenced by HideTray(), and ParseTray().

#define THIDE_LEFT   1

Hide on the left.

Definition at line 32 of file tray.h.

Referenced by HideTray(), and ParseTray().

#define THIDE_OFF   0

No autohide.

Definition at line 31 of file tray.h.

Referenced by CreateTray(), ParseTray(), SignalTray(), and SubtractTrayBounds().

#define THIDE_RAISED   8

Mask to indicate the tray is raised.

Definition at line 36 of file tray.h.

Referenced by HideTray(), LowerTrays(), and RaiseTrays().

#define THIDE_RIGHT   2

Hide on the right.

Definition at line 33 of file tray.h.

Referenced by HideTray(), and ParseTray().

#define THIDE_TOP   3

Hide on the top.

Definition at line 34 of file tray.h.

Referenced by HideTray(), and ParseTray().

Typedef Documentation

typedef unsigned char LayoutType

Enumeration of tray layouts.

Definition at line 16 of file tray.h.

typedef unsigned char TrayAlignmentType

Enumeration of tray alignments.

Definition at line 21 of file tray.h.

typedef unsigned char TrayAutoHideType

Enumeration of tray autohide values.

Definition at line 30 of file tray.h.

Structure to hold common tray component data.

Sizing is handled as follows:

  • The component is created via a factory method. It sets its requested size (0 for no preference).
  • The SetSize callback is issued with size constraints (0 for no constraint). The component should update width and height in SetSize.
  • The Create callback is issued with finalized size information. Resizing is handled as follows:
  • A component determines that it needs to change size. It updates its requested size (0 for no preference).
  • The component calls ResizeTray.
  • The SetSize callback is issued with size constraints (0 for no constraint). The component should update width and height in SetSize.
  • The Resize callback is issued with finalized size information.
typedef struct TrayType TrayType

Structure to represent a tray.

Function Documentation

void AddTrayComponent ( TrayType tp,
TrayComponentType cp 
)

Add a tray component to a tray.

Parameters
tpThe tray to update.
cpThe tray component to add.

Definition at line 287 of file tray.c.

References TrayType::components, TrayType::componentsTail, TrayComponentType::next, and TrayComponentType::tray.

Referenced by ParseClock(), ParseDock(), ParsePager(), ParseSpacer(), ParseSwallow(), ParseTaskList(), and ParseTrayButton().

void ClearTrayDrawable ( const TrayComponentType cp)
TrayType* CreateTray ( void  )
TrayComponentType* CreateTrayComponent ( void  )
void DestroyTray ( void  )

Destroy tray data.

Definition at line 194 of file tray.c.

References TrayType::components, TrayComponentType::next, TrayType::next, Release, SignalTray(), and UnregisterCallback().

Referenced by Destroy().

void DrawSpecificTray ( const TrayType tp)
void DrawTray ( void  )

Draw all trays.

Definition at line 751 of file tray.c.

References DrawSpecificTray(), TrayType::next, and shouldExit.

Referenced by Startup().

unsigned int GetTrayCount ( void  )

Get the number of trays.

Returns
The number of trays.

Definition at line 1005 of file tray.c.

References trayCount.

Referenced by RestackClients().

TrayType* GetTrays ( void  )

Get a linked list of trays.

Returns
The trays.

Definition at line 999 of file tray.c.

References trays.

Referenced by DoSnapBorder(), RestackClients(), ShutdownKeys(), StartupKeys(), and SubtractTrayBounds().

void HideTray ( TrayType tp)
void InitializeTray ( void  )

Initialize tray data.

Definition at line 58 of file tray.c.

References trayCount.

Referenced by Initialize().

void LowerTrays ( void  )

Lower tray windows.

Definition at line 802 of file tray.c.

References TrayType::autoHide, TrayType::next, RequireRestack(), and THIDE_RAISED.

Referenced by StopWindowWalk().

char ProcessTrayEvent ( const XEvent *  event)

Process an event that may be for a tray.

Parameters
eventThe event to process.
Returns
1 if this event was for a tray, 0 otherwise.

Definition at line 615 of file tray.c.

References HandleTrayButtonPress(), HandleTrayButtonRelease(), HandleTrayEnterNotify(), HandleTrayExpose(), HandleTrayMotionNotify(), TrayType::next, and TrayType::window.

Referenced by WaitForEvent().

void RaiseTrays ( void  )

Raise tray windows.

Definition at line 791 of file tray.c.

References TrayType::autoHide, display, JXRaiseWindow, TrayType::next, ShowTray(), THIDE_RAISED, and TrayType::window.

Referenced by StartWindowStackWalk(), and StartWindowWalk().

void ResizeTray ( TrayType tp)
void SetAutoHideTray ( TrayType tp,
TrayAutoHideType  autohide 
)

Set whether auto hide is enabled for a tray.

Parameters
tpThe tray.
autohideThe auto hide setting.

Definition at line 1011 of file tray.c.

References Assert, and TrayType::autoHide.

Referenced by ParseTray().

void SetTrayHeight ( TrayType tp,
const char *  str 
)

Set the tray height.

Parameters
tpThe tray.
strThe height (ASCII, pixels).

Definition at line 1040 of file tray.c.

References TrayType::requestedHeight.

Referenced by ParseTray().

void SetTrayHorizontalAlignment ( TrayType tp,
const char *  str 
)

Set the tray horizontal alignment.

Parameters
tpThe tray.
strThe alignment (ASCII).

Definition at line 1086 of file tray.c.

References _, ARRAY_LENGTH, FindValue(), TrayType::halign, JLIKELY, TALIGN_CENTER, TALIGN_FIXED, TALIGN_LEFT, TALIGN_RIGHT, and Warning().

Referenced by ParseTray().

void SetTrayLayer ( TrayType tp,
WinLayerType  layer 
)

Set the tray layer.

Parameters
tpThe tray.
layerThe layer.

Definition at line 1080 of file tray.c.

References TrayType::layer.

Referenced by ParseTray().

void SetTrayLayout ( TrayType tp,
const char *  str 
)

Set the tray layout.

Parameters
tpThe tray.
strA string representation of the layout to use.

Definition at line 1047 of file tray.c.

References _, TrayType::layout, LAYOUT_HORIZONTAL, LAYOUT_VERTICAL, TrayType::requestedHeight, TrayType::requestedWidth, and Warning().

Referenced by ParseTray().

void SetTrayVerticalAlignment ( TrayType tp,
const char *  str 
)

Set the tray vertical alignment.

Parameters
tpThe tray.
strThe alignment (ASCII).

Definition at line 1109 of file tray.c.

References _, ARRAY_LENGTH, FindValue(), JLIKELY, TALIGN_BOTTOM, TALIGN_CENTER, TALIGN_FIXED, TALIGN_TOP, TrayType::valign, and Warning().

Referenced by ParseTray().

void SetTrayWidth ( TrayType tp,
const char *  str 
)

Set the tray width.

Parameters
tpThe tray.
strThe width (ASCII, pixels).

Definition at line 1034 of file tray.c.

References TrayType::requestedWidth.

Referenced by ParseTray().

void SetTrayX ( TrayType tp,
const char *  str 
)

Set the tray x-coordinate.

Parameters
tpThe tray.
strThe x-coordinate (ASCII, pixels, negative ok).

Definition at line 1018 of file tray.c.

References Assert, and TrayType::requestedX.

Referenced by ParseTray().

void SetTrayY ( TrayType tp,
const char *  str 
)

Set the tray y-coordinate.

Parameters
tpThe tray.
strThe y-coordinate (ASCII, pixels, negative ok).

Definition at line 1026 of file tray.c.

References Assert, and TrayType::requestedY.

Referenced by ParseTray().

void ShowAllTrays ( void  )

Show all trays.

Definition at line 559 of file tray.c.

References TrayType::next, shouldExit, and ShowTray().

Referenced by HandleKeyPress().

void ShowTray ( TrayType tp)

Show a tray.

Parameters
tpThe tray to show.

Definition at line 539 of file tray.c.

References display, TrayType::hidden, JXMoveWindow, JXQueryPointer, mousex, mousey, rootWindow, SetMousePosition(), TrayType::window, TrayType::x, and TrayType::y.

Referenced by HandleTrayEnterNotify(), RaiseTrays(), and ShowAllTrays().

void ShutdownTray ( void  )
void StartupTray ( void  )
void UpdateSpecificTray ( const TrayType tp,
const TrayComponentType cp 
)

Update a component on a tray.

Parameters
tpThe tray containing the component.
cpThe component that needs updating.

Definition at line 812 of file tray.c.

References display, TrayComponentType::height, JUNLIKELY, JXCopyArea, TrayComponentType::pixmap, rootGC, shouldExit, TrayComponentType::width, TrayType::window, TrayComponentType::x, and TrayComponentType::y.

Referenced by DrawClock(), DrawSpecificTray(), ProcessActionPress(), ProcessActionRelease(), Render(), and UpdatePager().

joewing.net / Projects / JWM