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

Functions to handle X11 events. More...

#include "jwm.h"
#include "event.h"
#include "client.h"
#include "clientlist.h"
#include "confirm.h"
#include "cursor.h"
#include "desktop.h"
#include "dock.h"
#include "icon.h"
#include "key.h"
#include "move.h"
#include "place.h"
#include "resize.h"
#include "root.h"
#include "swallow.h"
#include "taskbar.h"
#include "timing.h"
#include "winmenu.h"
#include "settings.h"
#include "tray.h"
#include "popup.h"
#include "pager.h"
#include "grab.h"

Go to the source code of this file.

Data Structures

struct  CallbackNode
 

Macros

#define MIN_TIME_DELTA   50
 

Typedefs

typedef struct CallbackNode CallbackNode
 

Functions

static void Signal (void)
 Wake up components that need to run at certain times.
 
static void DispatchBorderButtonEvent (const XButtonEvent *event, ClientNode *np)
 Take the appropriate action for a click on a client border.
 
static void HandleConfigureRequest (const XConfigureRequestEvent *event)
 Process a configure request.
 
static char HandleConfigureNotify (const XConfigureEvent *event)
 Process a configure notify event.
 
static char HandleExpose (const XExposeEvent *event)
 Handle an expose event.
 
static char HandlePropertyNotify (const XPropertyEvent *event)
 Handle a property notify event.
 
static void HandleClientMessage (const XClientMessageEvent *event)
 Handle a client message.
 
static void HandleColormapChange (const XColormapEvent *event)
 Handle a colormap event.
 
static char HandleDestroyNotify (const XDestroyWindowEvent *event)
 Handle a destroy notify event.
 
static void HandleMapRequest (const XMapEvent *event)
 Handle a map request.
 
static void HandleUnmapNotify (const XUnmapEvent *event)
 Handle an unmap notify event.
 
static void HandleButtonEvent (const XButtonEvent *event)
 Process a button event.
 
static void ToggleMaximized (ClientNode *np, MaxFlags flags)
 Toggle maximized state.
 
static void HandleKeyPress (const XKeyEvent *event)
 Process a key press event.
 
static void HandleKeyRelease (const XKeyEvent *event)
 Handle a key release event.
 
static void HandleEnterNotify (const XCrossingEvent *event)
 Process an enter notify event.
 
static void HandleMotionNotify (const XMotionEvent *event)
 Handle a motion notify event.
 
static char HandleSelectionClear (const XSelectionClearEvent *event)
 Process a selection clear event.
 
static void HandleNetMoveResize (const XClientMessageEvent *event, ClientNode *np)
 Handle a _NET_MOVERESIZE_WINDOW request.
 
static void HandleNetWMMoveResize (const XClientMessageEvent *event, ClientNode *np)
 Handle a _NET_WM_MOVERESIZE request.
 
static void HandleNetRestack (const XClientMessageEvent *event, ClientNode *np)
 Handle a _NET_RESTACK_WINDOW request.
 
static void HandleNetWMState (const XClientMessageEvent *event, ClientNode *np)
 Handle a _NET_WM_STATE request.
 
static void HandleFrameExtentsRequest (const XClientMessageEvent *event)
 Handle a _NET_REQUEST_FRAME_EXTENTS request.
 
static void UpdateState (ClientNode *np)
 Update window state information.
 
static void DiscardEnterEvents ()
 Discard enter notify events.
 
static void HandleShapeEvent (const XShapeEvent *event)
 Handle a shape event.
 
char WaitForEvent (XEvent *event)
 Wait for an event and process it.
 
void ProcessEvent (XEvent *event)
 Process an event.
 
void DiscardButtonEvents ()
 Discard button events for the specified windows.
 
void DiscardMotionEvents (XEvent *event, Window w)
 Discard motion events for the specified window.
 
void DiscardKeyEvents (XEvent *event, Window w)
 Discard key events for the specified window.
 
void UpdateTime (const XEvent *event)
 Update the last event time.
 
void RegisterCallback (int freq, SignalCallback callback, void *data)
 Register a callback.
 
void UnregisterCallback (SignalCallback callback, void *data)
 Unregister a callback.
 
void RequireRestack ()
 Restack clients before waiting for an event.
 
void RequireTaskUpdate ()
 Update the task bar before waiting for an event.
 
void RequirePagerUpdate ()
 Update the pager before waiting for an event.
 

Variables

Time eventTime = CurrentTime
 Last event time.
 
static CallbackNodecallbacks = NULL
 
static char restack_pending = 0
 
static char task_update_pending = 0
 
static char pager_update_pending = 0
 

Detailed Description

Functions to handle X11 events.

Author
Joe Wingbermuehle
Date
2004-2006

Definition in file event.c.

Macro Definition Documentation

#define MIN_TIME_DELTA   50

Definition at line 35 of file event.c.

Referenced by Signal().

Typedef Documentation

typedef struct CallbackNode CallbackNode

Function Documentation

void DiscardButtonEvents ( void  )

Discard button events for the specified windows.

Descard excess button events.

Definition at line 308 of file event.c.

References display, JXCheckMaskEvent, JXSync, and UpdateTime().

Referenced by HandleTrayButtonPress().

void DiscardEnterEvents ( )
static

Discard enter notify events.

Definition at line 343 of file event.c.

References display, JXCheckMaskEvent, JXSync, SetMousePosition(), and UpdateTime().

Referenced by DispatchBorderButtonEvent(), and HandleKeyPress().

void DiscardKeyEvents ( XEvent *  event,
Window  w 
)

Discard key events for the specified window.

Discard excess key events.

Definition at line 334 of file event.c.

References display, JXCheckTypedWindowEvent, JXSync, and UpdateTime().

Referenced by MoveClientKeyboard(), and ResizeClientKeyboard().

void DiscardMotionEvents ( XEvent *  event,
Window  w 
)

Discard motion events for the specified window.

Discard excess motion events.

Definition at line 319 of file event.c.

References display, JXCheckTypedEvent, JXSync, SetMousePosition(), and UpdateTime().

Referenced by MoveClient(), MoveClientKeyboard(), ResizeClient(), ResizeClientKeyboard(), and UpdateMotion().

void DispatchBorderButtonEvent ( const XButtonEvent *  event,
ClientNode np 
)
static
void HandleButtonEvent ( const XButtonEvent *  event)
static
void HandleClientMessage ( const XClientMessageEvent *  event)
static
void HandleColormapChange ( const XColormapEvent *  event)
static

Handle a colormap event.

Definition at line 1409 of file event.c.

References ClientNode::cmap, FindClientByWindow(), and UpdateClientColormap().

Referenced by WaitForEvent().

char HandleConfigureNotify ( const XConfigureEvent *  event)
static

Process a configure notify event.

Definition at line 756 of file event.c.

References rootHeight, rootWidth, rootWindow, shouldExit, and shouldRestart.

Referenced by WaitForEvent().

void HandleConfigureRequest ( const XConfigureRequestEvent *  event)
static
char HandleDestroyNotify ( const XDestroyWindowEvent *  event)
static

Handle a destroy notify event.

Definition at line 1510 of file event.c.

References ClientNode::controller, FindClientByWindow(), HandleDockDestroy(), and RemoveClient().

Referenced by WaitForEvent().

void HandleEnterNotify ( const XCrossingEvent *  event)
static
char HandleExpose ( const XExposeEvent *  event)
static

Handle an expose event.

Definition at line 794 of file event.c.

References DrawBorder(), FindClientByParent(), FindClientByWindow(), STAT_WMDIALOG, ClientNode::state, and ClientState::status.

Referenced by WaitForEvent().

void HandleFrameExtentsRequest ( const XClientMessageEvent *  event)
static

Handle a _NET_REQUEST_FRAME_EXTENTS request.

Definition at line 1364 of file event.c.

References ReadWindowState(), and WriteFrameExtents().

Referenced by HandleClientMessage().

void HandleKeyPress ( const XKeyEvent *  event)
static
void HandleKeyRelease ( const XKeyEvent *  event)
static

Handle a key release event.

Definition at line 613 of file event.c.

References GetKey(), KEY_NEXT, KEY_NEXTSTACK, KEY_PREV, KEY_PREVSTACK, and StopWindowWalk().

Referenced by ProcessEvent().

void HandleMapRequest ( const XMapEvent *  event)
static
void HandleMotionNotify ( const XMotionEvent *  event)
static

Handle a motion notify event.

Definition at line 1372 of file event.c.

References ClientNode::borderAction, display, FindClientByParent(), GetBorderActionType(), GetFrameCursor(), JXDefineCursor, ClientNode::parent, and ClientNode::x.

Referenced by ProcessEvent().

void HandleNetMoveResize ( const XClientMessageEvent *  event,
ClientNode np 
)
static
void HandleNetRestack ( const XClientMessageEvent *  event,
ClientNode np 
)
static

Handle a _NET_RESTACK_WINDOW request.

Definition at line 1169 of file event.c.

References RestackClient().

Referenced by HandleClientMessage().

void HandleNetWMMoveResize ( const XClientMessageEvent *  event,
ClientNode np 
)
static
void HandleNetWMState ( const XClientMessageEvent *  event,
ClientNode np 
)
static
char HandlePropertyNotify ( const XPropertyEvent *  event)
static
char HandleSelectionClear ( const XSelectionClearEvent *  event)
static

Process a selection clear event.

Definition at line 355 of file event.c.

References HandleDockSelectionClear(), managerSelection, and shouldExit.

Referenced by WaitForEvent().

void HandleShapeEvent ( const XShapeEvent *  event)
static

Handle a shape event.

Definition at line 1397 of file event.c.

References FindClientByWindow(), ResetBorder(), STAT_SHAPED, ClientNode::state, and ClientState::status.

Referenced by WaitForEvent().

void HandleUnmapNotify ( const XUnmapEvent *  event)
static
void ProcessEvent ( XEvent *  event)
void RegisterCallback ( int  freq,
SignalCallback  callback,
void *  data 
)
void RequirePagerUpdate ( )
void RequireRestack ( )
void RequireTaskUpdate ( )
void Signal ( void  )
static
void ToggleMaximized ( ClientNode np,
MaxFlags  flags 
)
static

Toggle maximized state.

Definition at line 425 of file event.c.

References MAX_NONE, ClientState::maxFlags, MaximizeClient(), and ClientNode::state.

Referenced by HandleKeyPress().

void UnregisterCallback ( SignalCallback  callback,
void *  data 
)
void UpdateState ( ClientNode np)
static
void UpdateTime ( const XEvent *  event)

Update the last event time.

Definition at line 1700 of file event.c.

References Assert, and eventTime.

Referenced by DiscardButtonEvents(), DiscardEnterEvents(), DiscardKeyEvents(), DiscardMotionEvents(), HandleUnmapNotify(), ProcessEvent(), and WaitForEvent().

char WaitForEvent ( XEvent *  event)

Variable Documentation

CallbackNode* callbacks = NULL
static

Definition at line 47 of file event.c.

Referenced by RegisterCallback().

Time eventTime = CurrentTime

Last event time.

Definition at line 37 of file event.c.

Referenced by FocusClient(), FocusNextStacked(), HandleButtonEvent(), RemoveClient(), SendClientMessage(), and UpdateTime().

char pager_update_pending = 0
static

Definition at line 51 of file event.c.

Referenced by RequirePagerUpdate(), and Signal().

char restack_pending = 0
static

Definition at line 49 of file event.c.

Referenced by RequireRestack(), and Signal().

char task_update_pending = 0
static

Definition at line 50 of file event.c.

Referenced by RequireTaskUpdate(), and Signal().

joewing.net / Projects / JWM