JWM Source Documentation
Data Structures | Macros | Functions | Variables
hint.c File Reference

Functions for reading and writing X properties. More...

#include "jwm.h"
#include "hint.h"
#include "client.h"
#include "desktop.h"
#include "misc.h"
#include "font.h"
#include "settings.h"
#include <X11/Xlibint.h>

Go to the source code of this file.

Data Structures

struct  PropMwmHints
 
struct  ProtocolNode
 
struct  AtomNode
 

Macros

#define MWM_HINTS_FUNCTIONS   (1L << 0)
 
#define MWM_HINTS_DECORATIONS   (1L << 1)
 
#define MWM_HINTS_INPUT_MODE   (1L << 2)
 
#define MWM_HINTS_STATUS   (1L << 3)
 
#define MWM_FUNC_ALL   (1L << 0)
 
#define MWM_FUNC_RESIZE   (1L << 1)
 
#define MWM_FUNC_MOVE   (1L << 2)
 
#define MWM_FUNC_MINIMIZE   (1L << 3)
 
#define MWM_FUNC_MAXIMIZE   (1L << 4)
 
#define MWM_FUNC_CLOSE   (1L << 5)
 
#define MWM_DECOR_ALL   (1L << 0)
 
#define MWM_DECOR_BORDER   (1L << 1)
 
#define MWM_DECOR_RESIZEH   (1L << 2)
 
#define MWM_DECOR_TITLE   (1L << 3)
 
#define MWM_DECOR_MENU   (1L << 4)
 
#define MWM_DECOR_MINIMIZE   (1L << 5)
 
#define MWM_DECOR_MAXIMIZE   (1L << 6)
 
#define MWM_INPUT_MODELESS   0
 
#define MWM_INPUT_PRIMARY_APPLICATION_MODAL   1
 
#define MWM_INPUT_SYSTEM_MODAL   2
 
#define MWM_INPUT_FULL_APPLICATION_MODAL   3
 
#define MWM_TEAROFF_WINDOW   (1L << 0)
 

Functions

static char CheckShape (Window win)
 Check if a window uses the shape extension.
 
static void WriteNetAllowed (ClientNode *np)
 Write the allowed action property.
 
static void ReadWMState (Window win, ClientState *state)
 Read the WM state for a window.
 
static void ReadMotifHints (Window win, ClientState *state)
 Read _MOTIF_WM_HINTS.
 
void StartupHints (void)
 Set root hints and intern atoms.
 
void ReadCurrentDesktop (void)
 Determine the current desktop.
 
void ReadClientInfo (ClientNode *np, char alreadyMapped)
 Read client hints.
 
void WriteState (ClientNode *np)
 Write the window state hint for a client.
 
void SetOpacity (ClientNode *np, unsigned int opacity, char force)
 Set the opacity of a client.
 
void WriteNetState (ClientNode *np)
 Write the net state hint for a client.
 
void WriteFrameExtents (Window win, const ClientState *state)
 Set _NET_FRAME_EXTENTS.
 
ClientState ReadWindowState (Window win, char alreadyMapped)
 Read all hints needed to determine the current window state.
 
void ReadWMName (ClientNode *np)
 Determine the title to display for a client.
 
void ReadWMClass (ClientNode *np)
 Read the window class for a client.
 
void ReadWMProtocols (Window w, ClientState *state)
 Read the protocols hint for a window.
 
void ReadWMNormalHints (ClientNode *np)
 Read the "normal hints" for a client.
 
void ReadWMColormaps (ClientNode *np)
 Read colormap information for a client.
 
void ReadWMHints (Window win, ClientState *state, char alreadyMapped)
 Read the WM hints for a window.
 
void ReadWMOpacity (Window win, unsigned *opacity)
 Read _NET_WM_WINDOW_OPACITY.
 
char GetCardinalAtom (Window window, AtomType atom, unsigned long *value)
 Read a cardinal atom.
 
void SetCardinalAtom (Window window, AtomType atom, unsigned long value)
 Set a cardinal atom.
 
char GetWindowAtom (Window window, AtomType atom, Window *value)
 Read a window atom.
 
void SetWindowAtom (Window window, AtomType atom, unsigned long value)
 Set a window atom.
 
void SetPixmapAtom (Window window, AtomType atom, Pixmap value)
 Set a pixmap atom.
 
void SetAtomAtom (Window window, AtomType atom, AtomType value)
 Set an atom atom.
 

Variables

Atom atoms [ATOM_COUNT]
 
const char jwmRestart [] = "_JWM_RESTART"
 
const char jwmExit [] = "_JWM_EXIT"
 
const char jwmReload [] = "_JWM_RELOAD"
 
const char managerProperty [] = "MANAGER"
 
static const AtomNode atomList []
 

Detailed Description

Functions for reading and writing X properties.

Author
Joe Wingbermuehle
Date
2004-2006

Definition in file hint.c.

Macro Definition Documentation

#define MWM_DECOR_ALL   (1L << 0)

Definition at line 33 of file hint.c.

Referenced by ReadMotifHints().

#define MWM_DECOR_BORDER   (1L << 1)

Definition at line 34 of file hint.c.

Referenced by ReadMotifHints().

#define MWM_DECOR_MAXIMIZE   (1L << 6)

Definition at line 39 of file hint.c.

#define MWM_DECOR_MENU   (1L << 4)

Definition at line 37 of file hint.c.

#define MWM_DECOR_MINIMIZE   (1L << 5)

Definition at line 38 of file hint.c.

#define MWM_DECOR_RESIZEH   (1L << 2)

Definition at line 35 of file hint.c.

#define MWM_DECOR_TITLE   (1L << 3)

Definition at line 36 of file hint.c.

Referenced by ReadMotifHints().

#define MWM_FUNC_ALL   (1L << 0)

Definition at line 26 of file hint.c.

Referenced by ReadMotifHints().

#define MWM_FUNC_CLOSE   (1L << 5)

Definition at line 31 of file hint.c.

Referenced by ReadMotifHints().

#define MWM_FUNC_MAXIMIZE   (1L << 4)

Definition at line 30 of file hint.c.

Referenced by ReadMotifHints().

#define MWM_FUNC_MINIMIZE   (1L << 3)

Definition at line 29 of file hint.c.

Referenced by ReadMotifHints().

#define MWM_FUNC_MOVE   (1L << 2)

Definition at line 28 of file hint.c.

Referenced by ReadMotifHints().

#define MWM_FUNC_RESIZE   (1L << 1)

Definition at line 27 of file hint.c.

Referenced by ReadMotifHints().

#define MWM_HINTS_DECORATIONS   (1L << 1)

Definition at line 22 of file hint.c.

Referenced by ReadMotifHints().

#define MWM_HINTS_FUNCTIONS   (1L << 0)

Definition at line 21 of file hint.c.

Referenced by ReadMotifHints().

#define MWM_HINTS_INPUT_MODE   (1L << 2)

Definition at line 23 of file hint.c.

#define MWM_HINTS_STATUS   (1L << 3)

Definition at line 24 of file hint.c.

#define MWM_INPUT_FULL_APPLICATION_MODAL   3

Definition at line 44 of file hint.c.

#define MWM_INPUT_MODELESS   0

Definition at line 41 of file hint.c.

#define MWM_INPUT_PRIMARY_APPLICATION_MODAL   1

Definition at line 42 of file hint.c.

#define MWM_INPUT_SYSTEM_MODAL   2

Definition at line 43 of file hint.c.

#define MWM_TEAROFF_WINDOW   (1L << 0)

Definition at line 46 of file hint.c.

Function Documentation

char CheckShape ( Window  win)
static

Check if a window uses the shape extension.

Definition at line 525 of file hint.c.

References display, haveShape, and JXShapeSelectInput.

Referenced by ReadWindowState().

char GetCardinalAtom ( Window  window,
AtomType  atom,
unsigned long *  value 
)

Read a cardinal atom.

Definition at line 1079 of file hint.c.

References Assert, atoms, display, JLIKELY, JXFree, and JXGetWindowProperty.

Referenced by ReadCurrentDesktop(), ReadWindowState(), and ReadWMOpacity().

char GetWindowAtom ( Window  window,
AtomType  atom,
Window *  value 
)

Read a window atom.

Definition at line 1119 of file hint.c.

References Assert, atoms, display, JLIKELY, JXFree, and JXGetWindowProperty.

Referenced by ReadWindowState().

void ReadClientInfo ( ClientNode np,
char  alreadyMapped 
)
void ReadCurrentDesktop ( void  )

Determine the current desktop.

Definition at line 274 of file hint.c.

References ATOM_NET_CURRENT_DESKTOP, ChangeDesktop(), currentDesktop, GetCardinalAtom(), rootWindow, and SetCardinalAtom().

Referenced by Startup().

void ReadMotifHints ( Window  win,
ClientState state 
)
static
ClientState ReadWindowState ( Window  win,
char  alreadyMapped 
)

Read all hints needed to determine the current window state.

Read the current state of a window.

Definition at line 546 of file hint.c.

References Assert, ATOM_JWM_WM_STATE_MAXIMIZED_BOTTOM, ATOM_JWM_WM_STATE_MAXIMIZED_LEFT, ATOM_JWM_WM_STATE_MAXIMIZED_RIGHT, ATOM_JWM_WM_STATE_MAXIMIZED_TOP, ATOM_NET_WM_DESKTOP, ATOM_NET_WM_STATE, ATOM_NET_WM_STATE_ABOVE, ATOM_NET_WM_STATE_BELOW, ATOM_NET_WM_STATE_DEMANDS_ATTENTION, ATOM_NET_WM_STATE_FULLSCREEN, ATOM_NET_WM_STATE_HIDDEN, ATOM_NET_WM_STATE_MAXIMIZED_HORZ, ATOM_NET_WM_STATE_MAXIMIZED_VERT, ATOM_NET_WM_STATE_SHADED, ATOM_NET_WM_STATE_SKIP_PAGER, ATOM_NET_WM_STATE_SKIP_TASKBAR, ATOM_NET_WM_STATE_STICKY, ATOM_NET_WM_USER_TIME, ATOM_NET_WM_USER_TIME_WINDOW, ATOM_NET_WM_WINDOW_TYPE, ATOM_NET_WM_WINDOW_TYPE_DESKTOP, ATOM_NET_WM_WINDOW_TYPE_DIALOG, ATOM_NET_WM_WINDOW_TYPE_DOCK, ATOM_NET_WM_WINDOW_TYPE_MENU, ATOM_NET_WM_WINDOW_TYPE_NORMAL, ATOM_NET_WM_WINDOW_TYPE_NOTIFICATION, ATOM_NET_WM_WINDOW_TYPE_SPLASH, ATOM_NET_WM_WINDOW_TYPE_TOOLBAR, ATOM_NET_WM_WINDOW_TYPE_UTILITY, atoms, ClientState::border, BORDER_DEFAULT, BORDER_MAX, BORDER_MIN, BORDER_NONE, CheckShape(), currentDesktop, Debug(), ClientState::defaultLayer, ClientState::desktop, Settings::desktopCount, display, GetCardinalAtom(), GetWindowAtom(), JXFree, JXGetWindowProperty, ClientState::layer, LAYER_ABOVE, LAYER_BELOW, LAYER_DESKTOP, LAYER_NORMAL, MAX_BOTTOM, MAX_HORIZ, MAX_LEFT, MAX_NONE, MAX_RIGHT, MAX_TOP, MAX_VERT, ClientState::maxFlags, ClientState::opacity, ReadMotifHints(), ReadWMHints(), ReadWMOpacity(), ReadWMProtocols(), ReadWMState(), settings, STAT_FULLSCREEN, STAT_MAPPED, STAT_MINIMIZED, STAT_NOFOCUS, STAT_NOLIST, STAT_NOPAGER, STAT_SHADED, STAT_SHAPED, STAT_STICKY, STAT_URGENT, and ClientState::status.

Referenced by HandleFrameExtentsRequest(), ReadClientInfo(), and UpdateState().

void ReadWMClass ( ClientNode np)

Read the window class for a client.

Read a client's class.

Definition at line 782 of file hint.c.

References Assert, ClientNode::className, display, ClientNode::instanceName, JXGetClassHint, and ClientNode::window.

Referenced by ReadClientInfo().

void ReadWMColormaps ( ClientNode np)

Read colormap information for a client.

Definition at line 900 of file hint.c.

References Allocate, Assert, colormapCount, ClientNode::colormaps, display, JXFree, JXGetWMColormapWindows, Min, ColormapNode::next, Release, ColormapNode::window, and ClientNode::window.

Referenced by HandlePropertyNotify(), and ReadClientInfo().

void ReadWMHints ( Window  win,
ClientState state,
char  alreadyMapped 
)

Read the WM hints for a window.

Read WM hints.

Definition at line 975 of file hint.c.

References Assert, display, JXFree, JXGetWMHints, STAT_CANFOCUS, STAT_FLASH, STAT_MINIMIZED, STAT_URGENT, and ClientState::status.

Referenced by HandlePropertyNotify(), and ReadWindowState().

void ReadWMName ( ClientNode np)

Determine the title to display for a client.

Read a client's name.

Definition at line 714 of file hint.c.

References Allocate, ATOM_COMPOUND_TEXT, ATOM_NET_WM_NAME, ATOM_UTF8_STRING, atoms, ConvertFromUTF8(), display, JXFetchName, JXFree, JXGetWindowProperty, ClientNode::name, Release, and ClientNode::window.

Referenced by HandlePropertyNotify(), and ReadClientInfo().

void ReadWMNormalHints ( ClientNode np)
void ReadWMOpacity ( Window  win,
unsigned *  opacity 
)

Read _NET_WM_WINDOW_OPACITY.

Read opacity.

Definition at line 1009 of file hint.c.

References ATOM_NET_WM_WINDOW_OPACITY, and GetCardinalAtom().

Referenced by HandlePropertyNotify(), and ReadWindowState().

void ReadWMProtocols ( Window  w,
ClientState state 
)

Read the protocols hint for a window.

Read the WM_PROTOCOLS property for a window.

Definition at line 793 of file hint.c.

References Assert, ATOM_WM_DELETE_WINDOW, ATOM_WM_PROTOCOLS, ATOM_WM_TAKE_FOCUS, atoms, display, JXFree, JXGetWindowProperty, STAT_DELETE, STAT_TAKEFOCUS, and ClientState::status.

Referenced by DeleteClient(), Destroy(), HandlePropertyNotify(), and ReadWindowState().

void ReadWMState ( Window  win,
ClientState state 
)
static

Read the WM state for a window.

Definition at line 941 of file hint.c.

References ATOM_WM_STATE, atoms, display, JLIKELY, JXFree, JXGetWindowProperty, STAT_MAPPED, STAT_MINIMIZED, and ClientState::status.

Referenced by ReadWindowState().

void SetAtomAtom ( Window  window,
AtomType  atom,
AtomType  value 
)

Set an atom atom.

Definition at line 1167 of file hint.c.

References Assert, atoms, display, and JXChangeProperty.

Referenced by CreateMoveResizeWindow(), MapMenu(), ShowConfirmDialog(), ShowPopup(), and StartupTray().

void SetCardinalAtom ( Window  window,
AtomType  atom,
unsigned long  value 
)
void SetOpacity ( ClientNode np,
unsigned int  opacity,
char  force 
)

Set the opacity of a client.

Set the opacity of a client window.

Definition at line 358 of file hint.c.

References ATOM_NET_WM_WINDOW_OPACITY, atoms, display, JXDeleteProperty, ClientState::opacity, ClientNode::parent, SetCardinalAtom(), ClientNode::state, and ClientNode::window.

Referenced by AddClientWindow(), FocusClient(), and HandlePropertyNotify().

void SetPixmapAtom ( Window  window,
AtomType  atom,
Pixmap  value 
)

Set a pixmap atom.

Definition at line 1159 of file hint.c.

References Assert, atoms, display, and JXChangeProperty.

Referenced by LoadBackground().

void SetWindowAtom ( Window  window,
AtomType  atom,
unsigned long  value 
)

Set a window atom.

Definition at line 1151 of file hint.c.

References Assert, atoms, display, and JXChangeProperty.

Referenced by FocusClient(), RemoveClient(), and StartupHints().

void StartupHints ( void  )
void WriteFrameExtents ( Window  win,
const ClientState state 
)

Set _NET_FRAME_EXTENTS.

Set the frame extents of a window.

Definition at line 454 of file hint.c.

References ATOM_NET_FRAME_EXTENTS, atoms, display, GetBorderSize(), and JXChangeProperty.

Referenced by HandleFrameExtentsRequest(), and WriteState().

void WriteNetAllowed ( ClientNode np)
static
void WriteNetState ( ClientNode np)
void WriteState ( ClientNode np)

Variable Documentation

const AtomNode atomList[]
static

Definition at line 75 of file hint.c.

Atom atoms[ATOM_COUNT]
const char jwmExit[] = "_JWM_EXIT"

Definition at line 71 of file hint.c.

Referenced by SendExit().

const char jwmReload[] = "_JWM_RELOAD"

Definition at line 72 of file hint.c.

Referenced by SendReload().

const char jwmRestart[] = "_JWM_RESTART"

Definition at line 70 of file hint.c.

Referenced by SendRestart().

const char managerProperty[] = "MANAGER"

Definition at line 73 of file hint.c.

Referenced by StartupConnection().

joewing.net / Projects / JWM