Functions for easier talk with window managers


Typedefs

typedef void(*) NetwmCallback (int action, Window xid, void *data)

Enumerations

enum  {
  NETWM_CHANGED_WORKSPACE_COUNT, NETWM_CHANGED_WORKSPACE_NAMES, NETWM_CHANGED_CURRENT_WORKSPACE, NETWM_CHANGED_CURRENT_WORKAREA,
  NETWM_CHANGED_ACTIVE_WINDOW, NETWM_CHANGED_WINDOW_NAME, NETWM_CHANGED_WINDOW_VISIBLE_NAME, NETWM_CHANGED_WINDOW_DESKTOP,
  NETWM_CHANGED_WINDOW_LIST
}
enum  {
  NETWM_WINDOW_TYPE_NORMAL, NETWM_WINDOW_TYPE_DESKTOP, NETWM_WINDOW_TYPE_DOCK, NETWM_WINDOW_TYPE_TOOLBAR,
  NETWM_WINDOW_TYPE_MENU, NETWM_WINDOW_TYPE_UTILITY, NETWM_WINDOW_TYPE_SPLASH, NETWM_WINDOW_TYPE_DIALOG,
  NETWM_WINDOW_TYPE_DROPDOWN_MENU, NETWM_WINDOW_TYPE_POPUP_MENU, NETWM_WINDOW_TYPE_TOOLTIP, NETWM_WINDOW_TYPE_NOTIFICATION,
  NETWM_WINDOW_TYPE_COMBO, NETWM_WINDOW_TYPE_DND
}
enum  WmStateValue { WM_WINDOW_STATE_NONE = -1, WM_WINDOW_STATE_WITHDRAW = 0, WM_WINDOW_STATE_NORMAL = 1, WM_WINDOW_STATE_ICONIC = 3 }

Functions

void netwm_callback_add (NetwmCallback cb, void *data=0)
void netwm_callback_remove (NetwmCallback cb)
bool netwm_workarea_get_size (int &x, int &y, int &w, int &h)
int netwm_workspace_get_count (void)
void netwm_workspace_change (int n)
int netwm_workspace_get_current (void)
int netwm_workspace_get_names (char **&names)
void netwm_workspace_free_names (char **names)
void netwm_window_set_type (Window win, int t)
int netwm_window_get_type (Window win)
void netwm_window_set_strut (Window win, int left, int right, int top, int bottom)
int netwm_window_get_all_mapped (Window **windows)
int netwm_window_get_workspace (Window win)
int netwm_window_is_manageable (Window win)
char * netwm_window_get_title (Window win)
Window netwm_window_get_active (void)
void netwm_window_set_active (Window win)
void netwm_window_maximize (Window win)
void netwm_window_close (Window win)
void wm_window_ede_restore (Window win)
WmStateValue wm_window_get_state (Window win)
void wm_window_set_state (Window win, WmStateValue state)

Typedef Documentation

typedef void(*) NetwmCallback(int action, Window xid, void *data)

Callback type for netwm_callback_add().


Enumeration Type Documentation

anonymous enum

Various codes reported to callback added with netwm_callback_add().

Enumerator:
NETWM_CHANGED_WORKSPACE_COUNT  workspace count was changed
NETWM_CHANGED_WORKSPACE_NAMES  workspace names gets changed
NETWM_CHANGED_CURRENT_WORKSPACE  different workspace was activated
NETWM_CHANGED_CURRENT_WORKAREA  workaread was changed
NETWM_CHANGED_ACTIVE_WINDOW  different window was selected
NETWM_CHANGED_WINDOW_NAME  window name was changed
NETWM_CHANGED_WINDOW_VISIBLE_NAME  window visible name was changed
NETWM_CHANGED_WINDOW_DESKTOP  window is moved to another workspace
NETWM_CHANGED_WINDOW_LIST  window list was changed (another window is created or existing was closed)

anonymous enum

Window type codes. Codes marked as (part of 1.4) are added in Window Manager Specification 1.4 and not all window managers support it. The rest of codes are part of 1.3 specification version.

Enumerator:
NETWM_WINDOW_TYPE_NORMAL  ordinary window
NETWM_WINDOW_TYPE_DESKTOP  window placed as desktop
NETWM_WINDOW_TYPE_DOCK  docked window, like pager or panel
NETWM_WINDOW_TYPE_TOOLBAR  window as toolbar
NETWM_WINDOW_TYPE_MENU  window as menu
NETWM_WINDOW_TYPE_UTILITY  window as utility window
NETWM_WINDOW_TYPE_SPLASH  splash window
NETWM_WINDOW_TYPE_DIALOG  dialog window
NETWM_WINDOW_TYPE_DROPDOWN_MENU  dropdown menu window (part of 1.4)
NETWM_WINDOW_TYPE_POPUP_MENU  popup window (part of 1.4)
NETWM_WINDOW_TYPE_TOOLTIP  tooltip (part of 1.4)
NETWM_WINDOW_TYPE_NOTIFICATION  notification (part of 1.4)
NETWM_WINDOW_TYPE_COMBO  window popped up by combo boxes (part of 1.4)
NETWM_WINDOW_TYPE_DND  window is being dragged (part of 1.4)

enum WmStateValue

State of the window.

Enumerator:
WM_WINDOW_STATE_NONE  window state couldn't be determined
WM_WINDOW_STATE_WITHDRAW  withdraw state
WM_WINDOW_STATE_NORMAL  window is visible
WM_WINDOW_STATE_ICONIC  window is hidden


Function Documentation

void edelib::netwm_callback_add ( NetwmCallback  cb,
void *  data = 0 
)

Register callback for events related to windows and environment. This function will open display by calling fl_open_display().

When actions get reported, window id will be set to target id. If action wasn't figured, it will be set to -1.

Note:
To get some events (e.g. NETWM_CHANGED_WINDOW_NAME) you will have to use XSelectInput() on source window.

void edelib::netwm_callback_remove ( NetwmCallback  cb  ) 

Remove callback if exists.

void edelib::netwm_window_close ( Window  win  ) 

Close window.

Window edelib::netwm_window_get_active ( void   ) 

Return ID of currently focused window. If fails, return -1.

int edelib::netwm_window_get_all_mapped ( Window **  windows  ) 

Get array of mapped windows. Returns array size or -1 if fails. Call XFree() to free allocation.

char* edelib::netwm_window_get_title ( Window  win  ) 

Return window title or NULL if fails. Call free() on returned string.

int edelib::netwm_window_get_type ( Window  win  ) 

Return window type by returning one of NETWM_WINDOW_TYPE_* codes. If fails, the function returns -1.

int edelib::netwm_window_get_workspace ( Window  win  ) 

Get workspace given window resides. If fails returns -2 or return -1 if window is sticky (present on all workspaces).

int edelib::netwm_window_is_manageable ( Window  win  ) 

Return 1 if given window is manageable (window can be moved or closed) or 0 if not. Desktop/dock/splash types are not manageable. In case it could not figure out this property, it will return -1.

void edelib::netwm_window_maximize ( Window  win  ) 

Maximize window.

void edelib::netwm_window_set_active ( Window  win  ) 

Try to focus or raise given window.

void edelib::netwm_window_set_strut ( Window  win,
int  left,
int  right,
int  top,
int  bottom 
)

Resize area by setting offsets to each side. win will be outside that area.

void edelib::netwm_window_set_type ( Window  win,
int  t 
)

Set window type by using one of NETWM_WINDOW_TYPE_* codes. Depending on window managers some types will be applied correctly when window is showed and for some, application must be restarted.

bool edelib::netwm_workarea_get_size ( int &  x,
int &  y,
int &  w,
int &  h 
)

Get workarea set by window manager. Return false if fails.

void edelib::netwm_workspace_change ( int  n  ) 

Change current workspace.

void edelib::netwm_workspace_free_names ( char **  names  ) 

Free allocated names array with netwm_workspace_get_names().

int edelib::netwm_workspace_get_count ( void   ) 

Return number of available workspaces. Returns -1 if failed to fetch workspaces count.

int edelib::netwm_workspace_get_current ( void   ) 

Currently visible workspace. Workspaces are starting from 0. Returns -1 if failed.

int edelib::netwm_workspace_get_names ( char **&  names  ) 

Get array of workspace names. Function returns number of allocated items in array and should be freed with netwm_workspace_free_names().

void edelib::wm_window_ede_restore ( Window  win  ) 

edewm specific: restore window to previous state

WmStateValue edelib::wm_window_get_state ( Window  win  ) 

Not part of NETWM. Set window state to one of WmStateValue.

void edelib::wm_window_set_state ( Window  win,
WmStateValue  state 
)

Not part of NETWM. Get one of WmStateValue for given window.


Generated on Wed Dec 16 14:31:53 2009 for edelib by  doxygen 1.5.2