JWM Source Documentation
Macros | Functions | Variables
tray.c File Reference

Tray functions. More...

#include "jwm.h"
#include "tray.h"
#include "color.h"
#include "main.h"
#include "pager.h"
#include "cursor.h"
#include "error.h"
#include "taskbar.h"
#include "menu.h"
#include "timing.h"
#include "screen.h"
#include "settings.h"
#include "event.h"
#include "client.h"
#include "misc.h"
#include "hint.h"

Go to the source code of this file.

Macros

#define DEFAULT_TRAY_WIDTH   32
 
#define DEFAULT_TRAY_HEIGHT   32
 
#define TRAY_BORDER_SIZE   1
 

Functions

static void HandleTrayExpose (TrayType *tp, const XExposeEvent *event)
 Handle a tray expose event.
 
static void HandleTrayEnterNotify (TrayType *tp, const XCrossingEvent *event)
 Handle a tray enter notify (for autohide).
 
static TrayComponentTypeGetTrayComponent (TrayType *tp, int x, int y)
 Get the tray component under the given coordinates.
 
static void HandleTrayButtonPress (TrayType *tp, const XButtonEvent *event)
 Handle a button press on a tray.
 
static void HandleTrayButtonRelease (TrayType *tp, const XButtonEvent *event)
 Handle a button release on a tray.
 
static void HandleTrayMotionNotify (TrayType *tp, const XMotionEvent *event)
 Handle a motion notify event.
 
static void ComputeTraySize (TrayType *tp)
 Compute the size of a tray.
 
static int ComputeMaxWidth (TrayType *tp)
 Compute the max component width.
 
static int ComputeTotalWidth (TrayType *tp)
 Compute the total width of a tray.
 
static int ComputeMaxHeight (TrayType *tp)
 Compute the max component height.
 
static int ComputeTotalHeight (TrayType *tp)
 Compute the total height of a tray.
 
static char CheckHorizontalFill (TrayType *tp)
 Check if the tray fills the screen horizontally.
 
static char CheckVerticalFill (TrayType *tp)
 Check if the tray fills the screen vertically.
 
static void LayoutTray (TrayType *tp, int *variableSize, int *variableRemainder)
 Layout tray components on a tray.
 
static void SignalTray (const TimeType *now, int x, int y, Window w, void *data)
 Signal the tray (needed for autohide).
 
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 an empty tray.
 
TrayComponentTypeCreateTrayComponent (void)
 Create an empty tray component.
 
void AddTrayComponent (TrayType *tp, TrayComponentType *cp)
 Add a tray component to a tray.
 
void ShowTray (TrayType *tp)
 Display a tray (for autohide).
 
void ShowAllTrays (void)
 Show all trays.
 
void HideTray (TrayType *tp)
 Hide a tray (for autohide).
 
char ProcessTrayEvent (const XEvent *event)
 Process a tray event.
 
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 specific 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.
 
void SetAutoHideTray (TrayType *tp, TrayAutoHideType autohide)
 Determine if a tray should autohide.
 
void SetTrayX (TrayType *tp, const char *str)
 Set the x-coordinate of a tray.
 
void SetTrayY (TrayType *tp, const char *str)
 Set the y-coordinate of a tray.
 
void SetTrayWidth (TrayType *tp, const char *str)
 Set the width of a tray.
 
void SetTrayHeight (TrayType *tp, const char *str)
 Set the height of a tray.
 
void SetTrayLayout (TrayType *tp, const char *str)
 Set the tray orientation.
 
void SetTrayLayer (TrayType *tp, WinLayerType layer)
 Set the layer for a tray.
 
void SetTrayHorizontalAlignment (TrayType *tp, const char *str)
 Set the horizontal tray alignment.
 
void SetTrayVerticalAlignment (TrayType *tp, const char *str)
 Set the vertical tray alignment.
 

Variables

static TrayTypetrays
 
static unsigned int trayCount
 

Detailed Description

Tray functions.

Author
Joe Wingbermuehle
Date
2004-2006

Definition in file tray.c.

Macro Definition Documentation

#define DEFAULT_TRAY_HEIGHT   32

Definition at line 28 of file tray.c.

Referenced by ComputeTraySize().

#define DEFAULT_TRAY_WIDTH   32

Definition at line 27 of file tray.c.

Referenced by ComputeTraySize().

#define TRAY_BORDER_SIZE   1

Function Documentation

void AddTrayComponent ( TrayType tp,
TrayComponentType cp 
)
char CheckHorizontalFill ( TrayType tp)
static

Check if the tray fills the screen horizontally.

Definition at line 368 of file tray.c.

References TrayType::components, TrayComponentType::next, and TrayComponentType::width.

Referenced by ComputeTraySize().

char CheckVerticalFill ( TrayType tp)
static

Check if the tray fills the screen vertically.

Definition at line 382 of file tray.c.

References TrayType::components, TrayComponentType::height, and TrayComponentType::next.

Referenced by ComputeTraySize().

void ClearTrayDrawable ( const TrayComponentType cp)
int ComputeMaxHeight ( TrayType tp)
static

Compute the max component height.

Definition at line 334 of file tray.c.

References TrayType::components, TrayComponentType::height, and TrayComponentType::next.

Referenced by ComputeTraySize().

int ComputeMaxWidth ( TrayType tp)
static

Compute the max component width.

Definition at line 300 of file tray.c.

References TrayType::components, TrayComponentType::next, and TrayComponentType::width.

Referenced by ComputeTraySize().

int ComputeTotalHeight ( TrayType tp)
static

Compute the total height of a tray.

Definition at line 354 of file tray.c.

References TrayType::components, TrayComponentType::height, TrayComponentType::next, and TRAY_BORDER_SIZE.

Referenced by ComputeTraySize().

int ComputeTotalWidth ( TrayType tp)
static

Compute the total width of a tray.

Definition at line 320 of file tray.c.

References TrayType::components, TrayComponentType::next, TRAY_BORDER_SIZE, and TrayComponentType::width.

Referenced by ComputeTraySize().

void ComputeTraySize ( TrayType tp)
static
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().

TrayComponentType * GetTrayComponent ( TrayType tp,
int  x,
int  y 
)
static
unsigned int GetTrayCount ( void  )

Get 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.

Definition at line 999 of file tray.c.

References trays.

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

void HandleTrayButtonPress ( TrayType tp,
const XButtonEvent *  event 
)
static

Handle a button press on a tray.

Definition at line 699 of file tray.c.

References DiscardButtonEvents(), GetTrayComponent(), TrayComponentType::ProcessButtonPress, TrayComponentType::x, TrayType::x, and TrayComponentType::y.

Referenced by ProcessTrayEvent().

void HandleTrayButtonRelease ( TrayType tp,
const XButtonEvent *  event 
)
static
void HandleTrayEnterNotify ( TrayType tp,
const XCrossingEvent *  event 
)
static

Handle a tray enter notify (for autohide).

Definition at line 665 of file tray.c.

References ShowTray().

Referenced by ProcessTrayEvent().

void HandleTrayExpose ( TrayType tp,
const XExposeEvent *  event 
)
static

Handle a tray expose event.

Definition at line 659 of file tray.c.

References DrawSpecificTray().

Referenced by ProcessTrayEvent().

void HandleTrayMotionNotify ( TrayType tp,
const XMotionEvent *  event 
)
static

Handle a motion notify event.

Definition at line 739 of file tray.c.

References GetTrayComponent(), TrayComponentType::ProcessMotionEvent, TrayComponentType::x, TrayType::x, and TrayComponentType::y.

Referenced by ProcessTrayEvent().

void HideTray ( TrayType tp)
void InitializeTray ( void  )

Initialize tray data.

Definition at line 58 of file tray.c.

References trayCount.

Referenced by Initialize().

void LayoutTray ( TrayType tp,
int *  variableSize,
int *  variableRemainder 
)
static
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 a tray event.

Process an event that may be for a tray.

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 
)

Determine if a tray should autohide.

Set whether auto hide is enabled for a tray.

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 height of a tray.

Set the tray height.

Definition at line 1040 of file tray.c.

References TrayType::requestedHeight.

Referenced by ParseTray().

void SetTrayHorizontalAlignment ( TrayType tp,
const char *  str 
)

Set the horizontal tray alignment.

Set the tray horizontal alignment.

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 layer for a tray.

Set the tray 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 orientation.

Set the tray layout.

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 vertical tray alignment.

Set the tray vertical alignment.

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 width of a tray.

Set the tray width.

Definition at line 1034 of file tray.c.

References TrayType::requestedWidth.

Referenced by ParseTray().

void SetTrayX ( TrayType tp,
const char *  str 
)

Set the x-coordinate of a tray.

Set the tray x-coordinate.

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 y-coordinate of a tray.

Set the tray y-coordinate.

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)

Display a tray (for autohide).

Show a tray.

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 SignalTray ( const TimeType now,
int  x,
int  y,
Window  w,
void *  data 
)
static

Signal the tray (needed for autohide).

Definition at line 647 of file tray.c.

References TrayType::autoHide, TrayType::height, TrayType::hidden, HideTray(), menuShown, THIDE_OFF, TrayType::width, TrayType::x, and TrayType::y.

Referenced by CreateTray(), and DestroyTray().

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

Variable Documentation

unsigned int trayCount
static

Definition at line 33 of file tray.c.

Referenced by GetTrayCount(), InitializeTray(), RestackClients(), and StartupTray().

TrayType* trays
static

Definition at line 32 of file tray.c.

Referenced by CreateTray(), and GetTrays().

joewing.net / Projects / JWM