JWM Source Documentation
Functions | Variables
main.c File Reference

The main entry point and related JWM functions. More...

#include "jwm.h"
#include "main.h"
#include "parse.h"
#include "help.h"
#include "error.h"
#include "event.h"
#include "border.h"
#include "client.h"
#include "color.h"
#include "command.h"
#include "cursor.h"
#include "confirm.h"
#include "font.h"
#include "group.h"
#include "key.h"
#include "icon.h"
#include "taskbar.h"
#include "tray.h"
#include "traybutton.h"
#include "popup.h"
#include "pager.h"
#include "swallow.h"
#include "screen.h"
#include "root.h"
#include "desktop.h"
#include "place.h"
#include "clock.h"
#include "dock.h"
#include "misc.h"
#include "background.h"
#include "settings.h"
#include "timing.h"
#include "grab.h"
#include <errno.h>

Go to the source code of this file.

Functions

static void Initialize (void)
 Initialize data structures.
 
static void Startup (void)
 Startup the various JWM components.
 
static void Shutdown (void)
 Shutdown the various JWM components.
 
static void Destroy (void)
 Clean up memory.
 
static void OpenConnection (void)
 Open a connection to the X server.
 
static void CloseConnection (void)
 Close the X server connection.
 
static Bool SelectionReleased (Display *d, XEvent *e, XPointer arg)
 Predicate for XIfEvent to determine if we got the WM_Sn selection.
 
static void StartupConnection (void)
 Prepare the connection.
 
static void ShutdownConnection (void)
 Close the X server connection.
 
static void EventLoop (void)
 Main JWM event loop.
 
static void HandleExit (int sig)
 Signal handler.
 
static void HandleChild (int sig)
 Signal handler for SIGCHLD.
 
static void DoExit (int code)
 Exit with the specified status code.
 
static void SendRestart (void)
 Send _JWM_RESTART to the root window.
 
static void SendExit (void)
 Send _JWM_EXIT to the root window.
 
static void SendReload (void)
 Send _JWM_RELOAD to the root window.
 
static void SendJWMMessage (const char *message)
 Send a JWM message to the root window.
 
int main (int argc, char *argv[])
 The main entry point.
 

Variables

Display * display = NULL
 
Window rootWindow
 
int rootWidth
 
int rootHeight
 
int rootScreen
 
Colormap rootColormap
 
Visual * rootVisual
 
int rootDepth
 
GC rootGC
 
int colormapCount
 
Window supportingWindow
 
Atom managerSelection
 
char shouldExit = 0
 
char shouldRestart = 0
 
char isRestarting = 0
 
char initializing = 0
 
char shouldReload = 0
 
unsigned int currentDesktop = 0
 
char * exitCommand = NULL
 
XContext clientContext
 
XContext frameContext
 
char haveShape
 
int shapeEvent
 
char haveRender
 
static const char CONFIG_FILE [] = "/.jwmrc"
 
static char * displayString = NULL
 
char * configPath = NULL
 

Detailed Description

The main entry point and related JWM functions.

Author
Joe Wingbermuehle
Date
2004-2006

Definition in file main.c.

Function Documentation

void CloseConnection ( void  )
static

Close the X server connection.

Definition at line 449 of file main.c.

References display, JXCloseDisplay, and JXFlush.

Referenced by SendJWMMessage(), and ShutdownConnection().

void Destroy ( void  )
static
void DoExit ( int  code)
static

Exit with the specified status code.

Definition at line 234 of file main.c.

References configPath, Destroy(), exitCommand, Release, and StopDebug.

Referenced by main(), and OpenConnection().

void EventLoop ( void  )
static

Main JWM event loop.

Definition at line 253 of file main.c.

References display, GetCurrentTime(), GetTimeDifference(), IsSwallowPending(), JLIKELY, JXPending, ProcessEvent(), RESTART_DELAY, shouldExit, and WaitForEvent().

Referenced by main().

void HandleChild ( int  sig)
static

Signal handler for SIGCHLD.

Definition at line 468 of file main.c.

Referenced by StartupConnection().

void HandleExit ( int  sig)
static

Signal handler.

Definition at line 462 of file main.c.

References shouldExit.

Referenced by StartupConnection().

void Initialize ( void  )
static
int main ( int  argc,
char *  argv[] 
)
void OpenConnection ( void  )
static

Open a connection to the X server.

Definition at line 288 of file main.c.

References colormapCount, display, displayString, DoExit(), JUNLIKELY, JXOpenDisplay, rootColormap, rootDepth, rootGC, rootHeight, rootScreen, rootVisual, rootWidth, and rootWindow.

Referenced by SendJWMMessage(), and StartupConnection().

Bool SelectionReleased ( Display *  d,
XEvent *  e,
XPointer  arg 
)
static

Predicate for XIfEvent to determine if we got the WM_Sn selection.

Definition at line 315 of file main.c.

Referenced by StartupConnection().

void SendExit ( void  )
static

Send _JWM_EXIT to the root window.

Definition at line 660 of file main.c.

References jwmExit, and SendJWMMessage().

Referenced by main().

void SendJWMMessage ( const char *  message)
static

Send a JWM message to the root window.

Definition at line 672 of file main.c.

References CloseConnection(), display, JXInternAtom, JXSendEvent, OpenConnection(), and rootWindow.

Referenced by SendExit(), SendReload(), and SendRestart().

void SendReload ( void  )
static

Send _JWM_RELOAD to the root window.

Definition at line 666 of file main.c.

References jwmReload, and SendJWMMessage().

Referenced by main().

void SendRestart ( void  )
static

Send _JWM_RESTART to the root window.

Definition at line 654 of file main.c.

References jwmRestart, and SendJWMMessage().

Referenced by main().

void Shutdown ( void  )
static
void ShutdownConnection ( void  )
static

Close the X server connection.

Definition at line 456 of file main.c.

References CloseConnection().

Referenced by main().

void Startup ( void  )
static
void StartupConnection ( void  )
static

Variable Documentation

XContext clientContext

Definition at line 69 of file main.c.

Referenced by AddClientWindow(), FindClientByWindow(), RemoveClient(), and StartupConnection().

int colormapCount

Definition at line 55 of file main.c.

Referenced by OpenConnection(), and ReadWMColormaps().

const char CONFIG_FILE[] = "/.jwmrc"
static

Definition at line 80 of file main.c.

Referenced by main().

char* configPath = NULL

Definition at line 103 of file main.c.

Referenced by DoExit(), main(), and ReloadMenu().

unsigned int currentDesktop = 0
Display* display = NULL

Definition at line 47 of file main.c.

Referenced by AddClientWindow(), AllocateColor(), CheckShape(), CheckSwallowMap(), ChooseWindow(), ClearOutline(), ClearTrayDrawable(), CloseConnection(), Create(), CreateCursor(), CreateImageFromXImages(), CreateMoveResizeWindow(), CreateScaledRenderIcon(), Destroy(), DestroyConfirmDialog(), DestroyMoveResizeWindow(), DiscardButtonEvents(), DiscardEnterEvents(), DiscardKeyEvents(), DiscardMotionEvents(), DockWindow(), DoDestroyIcon(), DrawBorderButtons(), DrawBorderHandles(), DrawBorderHelper(), DrawButton(), DrawClock(), DrawCloseButton(), DrawDialog(), DrawHorizontalGradient(), DrawMaxAButton(), DrawMaxIButton(), DrawMenu(), DrawMenuItem(), DrawMinButton(), DrawMoveResizeWindow(), DrawOutline(), DrawPager(), DrawPagerClient(), DrawRoundedRectangle(), DrawSpecificTray(), ErrorHandler(), EventLoop(), ExposeConfirmDialog(), FillRoundedRectangle(), FindClientByParent(), FindClientByWindow(), FocusClient(), FocusNextStacked(), GetCardinalAtom(), GetMappedPixel(), GetModifierMask(), GetMouseMask(), GetScaledIcon(), GetStringWidth(), GetWindowAtom(), GetXftColor(), GrabKey(), GrabMouse(), GrabMouseForChoose(), GrabMouseForMove(), GrabMouseForResize(), GrabServer(), HandleButtonEvent(), HandleClientMessage(), HandleConfigureRequest(), HandleEnterNotify(), HandleMapRequest(), HandleMotionNotify(), HandlePropertyNotify(), HandleTrayButtonRelease(), HandleUnmapNotify(), HideClient(), HideMenu(), HideTray(), KillClientHandler(), LoadBackground(), LoadFocus(), LoadGradientBackground(), LoadImageBackground(), LoadImageFromDrawable(), LoadXPMImage(), MapMenu(), MenuLoop(), MinimizeTransients(), MoveClient(), MoveClientKeyboard(), MoveController(), MoveMouse(), OpenConnection(), PagerMoveController(), ParseColorToRGB(), ProcessEvent(), ProcessPopupEvent(), PutIcon(), PutScaledRenderIcon(), RaiseTrays(), ReadClientInfo(), ReadClientStrut(), ReadMotifHints(), ReadNetWMIcon(), ReadWindowState(), ReadWMClass(), ReadWMColormaps(), ReadWMHintIcon(), ReadWMHints(), ReadWMName(), ReadWMNormalHints(), ReadWMProtocols(), ReadWMState(), RemoveClient(), RenderString(), ReparentClient(), ResetBorder(), Resize(), ResizeClientKeyboard(), ResizeController(), ResizeTray(), RestackClients(), RestoreTransients(), RunCommand(), SendClientMessage(), SendConfigureEvent(), SendJWMMessage(), SetAtomAtom(), SetCardinalAtom(), SetClientFullScreen(), SetClientWithdrawn(), SetDefaultCursor(), SetOpacity(), SetPixmapAtom(), SetPosition(), SetSize(), SetWindowAtom(), SetWorkarea(), ShowClient(), ShowConfirmDialog(), ShowDesktop(), ShowMenu(), ShowPopup(), ShowSubmenu(), ShowTray(), ShutdownBackgrounds(), ShutdownColors(), ShutdownCursors(), ShutdownDock(), ShutdownFonts(), ShutdownIcons(), ShutdownKeys(), ShutdownPager(), ShutdownPopup(), ShutdownTaskBar(), ShutdownTray(), SignalPopup(), StartPagerMove(), Startup(), StartupClients(), StartupConnection(), StartupCursors(), StartupDock(), StartupFonts(), StartupHints(), StartupIcons(), StartupKeys(), StartupScreens(), StartupTray(), StartWindowStackWalk(), StartWindowWalk(), StopMove(), StopPagerMove(), StopResize(), StopWindowWalk(), UngrabServer(), UnmapClient(), UnshadeClient(), UpdateClientColormap(), UpdateDock(), UpdateMenu(), UpdateNetClientList(), UpdateSpecificTray(), WaitForEvent(), WalkWindowStack(), WriteFrameExtents(), WriteNetAllowed(), WriteNetState(), and WriteState().

char* displayString = NULL
static

Definition at line 101 of file main.c.

Referenced by main(), OpenConnection(), and RunCommand().

char* exitCommand = NULL

Definition at line 67 of file main.c.

Referenced by DoExit(), main(), and RunRootCommand().

XContext frameContext

Definition at line 70 of file main.c.

Referenced by FindClientByParent(), RemoveClient(), ReparentClient(), and StartupConnection().

char haveRender

Definition at line 77 of file main.c.

Referenced by CreateImage(), CreateScaledRenderIcon(), PutScaledRenderIcon(), and StartupConnection().

char haveShape

Definition at line 73 of file main.c.

Referenced by CheckShape(), StartupConnection(), and WaitForEvent().

char initializing = 0

Definition at line 62 of file main.c.

Referenced by ErrorHandler(), and StartupConnection().

char isRestarting = 0

Definition at line 61 of file main.c.

Referenced by main(), and StartupCommands().

Atom managerSelection

Definition at line 57 of file main.c.

Referenced by HandleSelectionClear(), and StartupConnection().

Colormap rootColormap
int rootDepth
GC rootGC
int rootHeight
int rootScreen

Definition at line 50 of file main.c.

Referenced by OpenConnection(), StartupConnection(), StartupDock(), and StartupFonts().

Visual* rootVisual
int rootWidth
Window rootWindow
int shapeEvent

Definition at line 74 of file main.c.

Referenced by StartupConnection(), and WaitForEvent().

char shouldExit = 0
char shouldReload = 0

Definition at line 63 of file main.c.

Referenced by main(), Parse(), ReloadMenu(), and ShowMenu().

char shouldRestart = 0

Definition at line 60 of file main.c.

Referenced by HandleConfigureNotify(), main(), Restart(), and ShutdownCommands().

Window supportingWindow

Definition at line 56 of file main.c.

Referenced by StartupConnection(), and StartupHints().

joewing.net / Projects / JWM