edelib: Functions for easier talk with window managers

edelib 1.0

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

Typedefs | Enumerations | Functions
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_ICON, 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 }
enum | NetwmStateValue { NETWM_STATE_NONE = -1, NETWM_STATE_MODAL, NETWM_STATE_STICKY, NETWM_STATE_MAXIMIZED_VERT, NETWM_STATE_MAXIMIZED_HORZ, NETWM_STATE_MAXIMIZED, NETWM_STATE_SHADED, NETWM_STATE_SKIP_TASKBAR, NETWM_STATE_SKIP_PAGER, NETWM_STATE_HIDDEN, NETWM_STATE_FULLSCREEN, NETWM_STATE_ABOVE, NETWM_STATE_BELOW, NETWM_STATE_DEMANDS_ATTENTION }
enum | NetwmStateAction { NETWM_STATE_ACTION_REMOVE, NETWM_STATE_ACTION_ADD, NETWM_STATE_ACTION_TOGGLE }

## 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)
void | netwm_window_set_strut_partial (Window win, int sizes[12])
void | netwm_window_remove_strut (Window win)
void | netwm_window_remove_strut_partial (Window win)
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)
Fl_RGB_Image * | netwm_window_get_icon (Window win, unsigned int requested_width=0)
Window | netwm_window_get_active (void)
void | netwm_window_set_active (Window win, int source=0)
void | netwm_window_maximize (Window win)
void | netwm_window_close (Window win)
void | wm_window_ede_restore (Window win)
void | netwm_window_set_state (Window win, NetwmStateValue val, NetwmStateAction action)
bool | netwm_window_get_all_states (Window win, list< NetwmStateValue > &ret)
bool | netwm_window_have_state (Window win, NetwmStateValue val)
WmStateValue | wm_window_get_state (Window win)
void | wm_window_set_state (Window win, WmStateValue state)

## Detailed Description

## 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 | workarea 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_ICON | window icon was changed
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 NetwmStateAction

Options for setting one of NetwmStateValue values.

Enumerator
NETWM_STATE_ACTION_REMOVE | remove state
NETWM_STATE_ACTION_ADD | add state
NETWM_STATE_ACTION_TOGGLE | toggle state

enum NetwmStateValue

State of the window. These values represent newer EWMH standard states.

Enumerator
NETWM_STATE_NONE | window state couldn't be determined
NETWM_STATE_MODAL | modal dialog box
NETWM_STATE_STICKY | sticky window
NETWM_STATE_MAXIMIZED_VERT | maximized vertically
NETWM_STATE_MAXIMIZED_HORZ | maximized horizontally
NETWM_STATE_MAXIMIZED | fully maximized
NETWM_STATE_SHADED | shaded window
NETWM_STATE_SKIP_TASKBAR | window should skip taskbar
NETWM_STATE_SKIP_PAGER | window should skip pager
NETWM_STATE_HIDDEN | window should be hidden (or minimized)
NETWM_STATE_FULLSCREEN | window should go in fullscreen mode
NETWM_STATE_ABOVE | window should go on top of all windows
NETWM_STATE_BELOW | window should go below all windows
NETWM_STATE_DEMANDS_ATTENTION | some action in or with the window happened

enum WmStateValue

State of the window. These values represent old ICCCM standard.

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.

bool edelib::netwm_window_get_all_states | ( | Window | win,
|  | list< NetwmStateValue > & | ret
| ) |  |

Get all window states. Returns false if wasn't able to retrieve window state.

Fl_RGB_Image* edelib::netwm_window_get_icon | ( | Window | win,
|  | unsigned int | requested_width = `0`
| ) |  |

Return window icon set with _NET_WM_ICON property. Since application can have multiple icons, with this function you can set desired size to be returned, via requested_width. If icon with requested size wasn't found, it will return the first one.

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

bool edelib::netwm_window_have_state | ( | Window | win,
|  | NetwmStateValue | val
| ) |  |

Check if window has given state. Returns false if not.

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

Deprecated:
  with netwm_window_set_state().

void edelib::netwm_window_remove_strut | ( | Window | win | ) |

Remove offset, previously set with netwm_window_set_strut. If offset not set, it will do nothing.

void edelib::netwm_window_remove_strut_partial | ( | Window | win | ) |

Remove offset, previously set with netwm_window_set_strut_partial. If offset not set, it will do nothing.

void edelib::netwm_window_set_active | ( | Window | win,
|  | int | source = `0`
| ) |  |

Try to focus or raise given window. source must be set to 1 if request comes from application, and 2 when it comes from pager. By default, source is 0 so it (by specification) indicates using older specification version.

void edelib::netwm_window_set_state | ( | Window | win,
|  | NetwmStateValue | val,
|  | NetwmStateAction | action
| ) |  |

Set window state to one of NetwmStateValue values. Value will be set, removed or toggled according to NetwmStateAction action.

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_strut_partial | ( | Window | win,
|  | int | sizes[12]
| ) |  |

Resize area by setting offsets to each side and win will be outside that area. This function will use newer _NET_WM_STRUT_PARTIAL hint, which is highly likely to be supported by newer window managers.

Array is in offset form: left, right, top, bottom, left_start_y, left_end_y, right_start_y, right_end_y, top_start_x, top_end_x, bottom_start_x, bottom_end_x.

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.