Miscellaneous Functions

Miscellaneous Functions — reading resource usage of X clients, and other additional features.

Stability Level

Unstable, unless otherwise indicated

Synopsis


#include <libwnck/libwnck.h>


void                wnck_gtk_window_set_dock_type       (GtkWindow *window);
enum                WnckClientType;
void                wnck_set_client_type                (WnckClientType ewmh_sourceindication_client_type);
                    WnckResourceUsage;
void                wnck_xid_read_resource_usage        (GdkDisplay *gdk_display,
                                                         gulong xid,
                                                         WnckResourceUsage *usage);
void                wnck_pid_read_resource_usage        (GdkDisplay *gdk_display,
                                                         gulong pid,
                                                         WnckResourceUsage *usage);








Description

These functions are utility functions providing some additional features to libwcnk users, like functions to read resource usage of X clients.

Details

wnck_gtk_window_set_dock_type ()

void                wnck_gtk_window_set_dock_type       (GtkWindow *window);

Warning

wnck_gtk_window_set_dock_type is deprecated and should not be used in newly-written code. Use gdk_window_set_type_hint() instead.

Sets the semantic type of window to WNCK_WINDOW_DOCK.

window : a GtkWindow.

enum WnckClientType

typedef enum {
  WNCK_CLIENT_TYPE_APPLICATION = 1,
  WNCK_CLIENT_TYPE_PAGER = 2
} WnckClientType;

Type describing the role of the libwnck user.

WNCK_CLIENT_TYPE_APPLICATION the libwnck user is a normal application.
WNCK_CLIENT_TYPE_PAGER the libwnck user is an utility application dealing with window management, like pagers and taskbars.

Since 2.14


wnck_set_client_type ()

void                wnck_set_client_type                (WnckClientType ewmh_sourceindication_client_type);

Sets the role of the libwnck user. For applications providing some window management features, like pagers or tasklists, it is important to set the role to WNCK_CLIENT_TYPE_PAGER for libwnck to properly work.

ewmh_sourceindication_client_type : a role for the client.

Since 2.14


WnckResourceUsage

typedef struct {
  gulong        total_bytes_estimate;
  
  gulong        pixmap_bytes;

  unsigned int n_pixmaps;
  unsigned int n_windows;
  unsigned int n_gcs;
  unsigned int n_pictures;
  unsigned int n_glyphsets;
  unsigned int n_fonts;
  unsigned int n_colormap_entries;
  unsigned int n_passive_grabs;
  unsigned int n_cursors;
  unsigned int n_other;
} WnckResourceUsage;

The WnckResourceUsage struct contains information about the total resource usage of an X client, and the number of resources allocated for each resource type.

gulong total_bytes_estimate; estimation of the total number of bytes allocated in the X server.
gulong pixmap_bytes; number of bytes allocated in the X server for resources of type Pixmap.
unsigned int n_pixmaps; number of Pixmap resources allocated.
unsigned int n_windows; number of Window resources allocated.
unsigned int n_gcs; number of GContext resources allocated.
unsigned int n_pictures; number of Picture resources allocated.
unsigned int n_glyphsets; number of Glyphset resources allocated.
unsigned int n_fonts; number of Font resources allocated.
unsigned int n_colormap_entries; number of Colormap resources allocated.
unsigned int n_passive_grabs; number of PassiveGrab resources allocated.
unsigned int n_cursors; number of Cursor resources allocated.
unsigned int n_other; number of other resources allocated.

Since 2.6


wnck_xid_read_resource_usage ()

void                wnck_xid_read_resource_usage        (GdkDisplay *gdk_display,
                                                         gulong xid,
                                                         WnckResourceUsage *usage);

Looks for the X resource usage of the application owning the X window ID xid on display gdisplay. If no resource usage can be found, then all fields of usage are set to 0.

To properly work, this function requires the XRes extension on the X server.

gdk_display : a GdkDisplay.
xid : an X window ID.
usage : return location for the X resource usage of the application owning the X window ID xid.

Since 2.6


wnck_pid_read_resource_usage ()

void                wnck_pid_read_resource_usage        (GdkDisplay *gdk_display,
                                                         gulong pid,
                                                         WnckResourceUsage *usage);

Looks for the X resource usage of the application with process ID pid on display gdisplay. If no resource usage can be found, then all fields of usage are set to 0.

In order to find the resource usage of an application that does not have an X window visible to libwnck (panel applets do not have any toplevel windows, for example), wnck_pid_read_resource_usage() walks through the whole tree of X windows. Since this walk is expensive in CPU, a cache is created. This cache is updated in the background. This means there is a non-null probability that no resource usage will be found for an application, even if it is an X client. If this happens, calling wnck_pid_read_resource_usage() again after a few seconds should work.

To properly work, this function requires the XRes extension on the X server.

gdk_display : a GdkDisplay.
pid : a process ID.
usage : return location for the X resource usage of the application with process ID pid.

Since 2.6

See Also

wnck_window_get_xid(), wnck_application_get_xid(), wnck_window_get_pid(), wnck_application_get_pid()