![]() |
![]() |
![]() |
Libmatewnck Reference Manual | ![]() |
---|---|---|---|---|
Top | Description | Object Hierarchy | Signals |
#include <libmatewnck/libmatewnck.h> struct MatewnckScreen; MatewnckScreen * matewnck_screen_get_default (void
); MatewnckScreen * matewnck_screen_get (int index
); MatewnckScreen * matewnck_screen_get_for_root (gulong root_window_id
); int matewnck_screen_get_number (MatewnckScreen *screen
); int matewnck_screen_get_width (MatewnckScreen *screen
); int matewnck_screen_get_height (MatewnckScreen *screen
); void matewnck_screen_force_update (MatewnckScreen *screen
); const char * matewnck_screen_get_window_manager_name (MatewnckScreen *screen
); gboolean matewnck_screen_net_wm_supports (MatewnckScreen *screen
,const char *atom
); MatewnckWindow * matewnck_screen_get_active_window (MatewnckScreen *screen
); MatewnckWindow * matewnck_screen_get_previously_active_window (MatewnckScreen *screen
); GList * matewnck_screen_get_windows (MatewnckScreen *screen
); GList * matewnck_screen_get_windows_stacked (MatewnckScreen *screen
); MatewnckWorkspace * matewnck_screen_get_active_workspace (MatewnckScreen *screen
); GList * matewnck_screen_get_workspaces (MatewnckScreen *screen
); MatewnckWorkspace * matewnck_screen_get_workspace (MatewnckScreen *screen
,int workspace
); int matewnck_screen_get_workspace_index (MatewnckScreen *screen
,MatewnckWorkspace *space
); enum MatewnckMotionDirection; MatewnckWorkspace * matewnck_screen_get_workspace_neighbor (MatewnckScreen *screen
,MatewnckWorkspace *space
,MatewnckMotionDirection direction
); int matewnck_screen_get_workspace_count (MatewnckScreen *screen
); void matewnck_screen_change_workspace_count (MatewnckScreen *screen
,int count
); int matewnck_screen_try_set_workspace_layout (MatewnckScreen *screen
,int current_token
,int rows
,int columns
); void matewnck_screen_release_workspace_layout (MatewnckScreen *screen
,int current_token
); struct MatewnckWorkspaceLayout; void matewnck_screen_calc_workspace_layout (MatewnckScreen *screen
,int num_workspaces
,int space_index
,MatewnckWorkspaceLayout *layout
); void matewnck_screen_free_workspace_layout (MatewnckWorkspaceLayout *layout
); void matewnck_screen_move_viewport (MatewnckScreen *screen
,int x
,int y
); gulong matewnck_screen_get_background_pixmap (MatewnckScreen *screen
); gboolean matewnck_screen_get_showing_desktop (MatewnckScreen *screen
); void matewnck_screen_toggle_showing_desktop (MatewnckScreen *screen
,gboolean show
);
"active-window-changed" :Run Last
"active-workspace-changed" :Run Last
"application-closed" :Run Last
"application-opened" :Run Last
"background-changed" :Run Last
"class-group-closed" :Run Last
"class-group-opened" :Run Last
"showing-desktop-changed" :Run Last
"viewports-changed" :Run Last
"window-closed" :Run Last
"window-manager-changed" :Run Last
"window-opened" :Run Last
"window-stacking-changed" :Run Last
"workspace-created" :Run Last
"workspace-destroyed" :Run Last
The MatewnckScreen represents a physical screen. A screen may consist of multiple monitors which are merged to form a large screen area. The MatewnckScreen is at the bottom of the libmatewnck stack of objects: MatewnckWorkspace objects exist a MatewnckScreen and MatewnckWindow objects are displayed on a MatewnckWorkspace.
The MatewnckScreen corresponds to the notion of
GdkScreen
in GDK.
The MatewnckScreen objects are always owned by libmatewnck and must not be referenced or unreferenced.
struct MatewnckScreen;
The MatewnckScreen struct contains only private fields and should not be directly accessed.
MatewnckScreen * matewnck_screen_get_default (void
);
Gets the default MatewnckScreen on the default display.
Returns : |
the default MatewnckScreen. The returned MatewnckScreen is owned by libmatewnck and must not be referenced or unreferenced. [transfer none] |
MatewnckScreen * matewnck_screen_get (int index
);
Gets the MatewnckScreen for a given screen on the default display.
|
screen number, starting from 0. |
Returns : |
the MatewnckScreen for screen index , or NULL
if no such screen exists. The returned MatewnckScreen is owned by libmatewnck and
must not be referenced or unreferenced. [transfer none]
|
MatewnckScreen * matewnck_screen_get_for_root (gulong root_window_id
);
Gets the MatewnckScreen for the root window at root_window_id
, or
NULL
if no MatewnckScreen exists for this root window.
This function does not work if matewnck_screen_get()
was not called for the
sought MatewnckScreen before, and returns NULL
.
|
an X window ID. |
Returns : |
the MatewnckScreen for the root window at
root_window_id , or NULL . The returned MatewnckScreen is owned by libmatewnck and
must not be referenced or unreferenced. [transfer none]
|
int matewnck_screen_get_number (MatewnckScreen *screen
);
Gets the index of screen
on the display to which it belongs. The first
MatewnckScreen has an index of 0.
|
a MatewnckScreen. |
Returns : |
the index of space on screen , or -1 on errors. |
Since 2.20
int matewnck_screen_get_width (MatewnckScreen *screen
);
Gets the width of screen
.
|
a MatewnckScreen. |
Returns : |
the width of screen . |
int matewnck_screen_get_height (MatewnckScreen *screen
);
Gets the height of screen
.
|
a MatewnckScreen. |
Returns : |
the height of screen . |
void matewnck_screen_force_update (MatewnckScreen *screen
);
Synchronously and immediately updates the list of MatewnckWindow on screen
.
This bypasses the standard update mechanism, where the list of MatewnckWindow
is updated in the idle loop.
This is usually a bad idea for both performance and correctness reasons (to get things right, you need to write model-view code that tracks changes, not get a static list of open windows). However, this function can be useful for small applications that just do something and then exit.
|
a MatewnckScreen. |
const char * matewnck_screen_get_window_manager_name (MatewnckScreen *screen
);
Gets the name of the window manager.
|
a MatewnckScreen. |
Returns : |
the name of the window manager, or NULL if the window manager
does not comply with the EWMH
specification. |
Since 2.20
gboolean matewnck_screen_net_wm_supports (MatewnckScreen *screen
,const char *atom
);
Gets whether the window manager for screen
supports a certain hint from
the Extended
Window Manager Hints specification (EWMH).
When using this function, keep in mind that the window manager can change
over time; so you should not use this function in a way that impacts
persistent application state. A common bug is that your application can
start up before the window manager does when the user logs in, and before
the window manager starts matewnck_screen_net_wm_supports()
will return FALSE
for every property.
See also gdk_x11_screen_supports_net_wm_hint()
in GDK.
|
a MatewnckScreen. |
|
a property atom. |
Returns : |
TRUE if the window manager for screen supports the atom
hint, FALSE otherwise. |
MatewnckWindow * matewnck_screen_get_active_window (MatewnckScreen *screen
);
Gets the active MatewnckWindow on screen
. May return NULL
sometimes, since
not all window managers guarantee that a window is always active.
|
a MatewnckScreen. |
Returns : |
the active MatewnckWindow on screen , or NULL .
The returned MatewnckWindow is owned by libmatewnck and must not be referenced or
unreferenced. [transfer none]
|
MatewnckWindow * matewnck_screen_get_previously_active_window
(MatewnckScreen *screen
);
Gets the previously active MatewnckWindow on screen
. May return NULL
sometimes, since not all window managers guarantee that a window is always
active.
|
a MatewnckScreen. |
Returns : |
the previously active MatewnckWindow on screen ,
or NULL . The returned MatewnckWindow is owned by libmatewnck and must not be
referenced or unreferenced. [transfer none]
|
Since 2.8
GList * matewnck_screen_get_windows (MatewnckScreen *screen
);
Gets the list of MatewnckWindow on screen
. The list is not in a defined
order, but should be "stable" (windows should not be reordered in it).
However, the stability of the list is established by the window manager, so
don't blame libmatewnck if it breaks down.
|
a MatewnckScreen. |
Returns : |
the list of
MatewnckWindow on screen , or NULL if there is no window on screen . The list
should not be modified nor freed, as it is owned by screen . [element-type MatewnckWindow][transfer none]
|
GList * matewnck_screen_get_windows_stacked (MatewnckScreen *screen
);
Gets the list of MatewnckWindow on screen
in bottom-to-top order.
|
a MatewnckScreen. |
Returns : |
the list of
MatewnckWindow in stacking order on screen , or NULL if there is no window on
screen . The list should not be modified nor freed, as it is owned by
screen . [element-type MatewnckWindow][transfer none]
|
MatewnckWorkspace * matewnck_screen_get_active_workspace (MatewnckScreen *screen
);
Gets the active MatewnckWorkspace on screen
. May return NULL
sometimes,
if libmatewnck is in a weird state due to the asynchronous nature of the
interaction with the window manager.
|
a MatewnckScreen. |
Returns : |
the active MatewnckWorkspace on screen , or
NULL . The returned MatewnckWorkspace is owned by libmatewnck and must not be
referenced or unreferenced. [transfer none]
|
GList * matewnck_screen_get_workspaces (MatewnckScreen *screen
);
Gets the list of MatewnckWorkspace on screen
. The list is ordered: the
first element in the list is the first MatewnckWorkspace, etc..
|
a MatewnckScreen. |
Returns : |
the list of
MatewnckWorkspace on screen . The list should not be modified nor freed, as it
is owned by screen . [element-type MatewnckWorkspace][transfer none]
|
Since 2.20
MatewnckWorkspace * matewnck_screen_get_workspace (MatewnckScreen *screen
,int workspace
);
Gets the MatewnckWorkspace numbered workspace
on screen
.
|
a MatewnckScreen. |
|
a workspace index, starting from 0. |
Returns : |
the MatewnckWorkspace numbered workspace on
screen , or NULL if no such workspace exists. The returned MatewnckWorkspace
is owned by libmatewnck and must not be referenced or unreferenced. [transfer none]
|
int matewnck_screen_get_workspace_index (MatewnckScreen *screen
,MatewnckWorkspace *space
);
matewnck_screen_get_workspace_index
has been deprecated since version 2.20 and should not be used in newly-written code. Use matewnck_workspace_get_number()
instead.
Gets the index of space
on screen
. The first MatewnckWorkspace has an
index of 0. See also matewnck_workspace_get_number()
.
|
a MatewnckScreen. |
|
a MatewnckWorkspace. |
Returns : |
the index of space on screen , or -1 on errors. |
Since 2.14
typedef enum { MATEWNCK_MOTION_UP = -1, MATEWNCK_MOTION_DOWN = -2, MATEWNCK_MOTION_LEFT = -3, MATEWNCK_MOTION_RIGHT = -4 } MatewnckMotionDirection;
Type defining a direction in which to search a neighbor MatewnckWorkspace.
search a neighbor MatewnckWorkspace above another MatewnckWorkspace. | |
search a neighbor MatewnckWorkspace below another MatewnckWorkspace. | |
search a neighbor MatewnckWorkspace at the left of another MatewnckWorkspace. | |
search a neighbor MatewnckWorkspace at the right of another MatewnckWorkspace. |
Since 2.14
MatewnckWorkspace * matewnck_screen_get_workspace_neighbor (MatewnckScreen *screen
,MatewnckWorkspace *space
,MatewnckMotionDirection direction
);
matewnck_screen_get_workspace_neighbor
has been deprecated since version 2.20 and should not be used in newly-written code. Use matewnck_workspace_get_neighbor()
instead.
Gets the neighbor MatewnckWorkspace of space
in the direction
direction on
screen
.
|
a MatewnckScreen. |
|
a MatewnckWorkspace. |
|
direction in which to search the neighbor. |
Returns : |
the neighbor MatewnckWorkspace of space in the
direction direction on screen , or NULL if no such neighbor MatewnckWorkspace
exists. The returned MatewnckWorkspace is owned by libmatewnck and must not be
referenced or unreferenced. [transfer none]
|
Since 2.14
int matewnck_screen_get_workspace_count (MatewnckScreen *screen
);
Gets the number of MatewnckWorkspace on screen
.
|
a MatewnckScreen. |
Returns : |
the number of MatewnckWorkspace on screen . |
void matewnck_screen_change_workspace_count (MatewnckScreen *screen
,int count
);
Asks the window manager to change the number of MatewnckWorkspace on screen
.
|
a MatewnckScreen. |
|
the number of MatewnckWorkspace to request. |
Since 2.2
int matewnck_screen_try_set_workspace_layout (MatewnckScreen *screen
,int current_token
,int rows
,int columns
);
Tries to modify the layout of MatewnckWorkspace on screen
. To do this, tries
to acquire ownership of the layout. If the current process is the owner of
the layout, current_token
is used to determine if the caller is the owner
(there might be more than one part of the same process trying to set the
layout). Since no more than one application should set this property of
screen
at a time, setting the layout is not guaranteed to work.
If rows
is 0, the actual number of rows will be determined based on
columns
and the number of MatewnckWorkspace. If columns
is 0, the actual
number of columns will be determined based on rows
and the number of
MatewnckWorkspace. rows
and columns
must not be 0 at the same time.
You have to release the ownership of the layout with
matewnck_screen_release_workspace_layout()
when you do not need it anymore.
|
a MatewnckScreen. |
|
a token. Use 0 if you do not called
matewnck_screen_try_set_workspace_layout() before, or if you did not keep the
old token. |
|
the number of rows to use for the MatewnckWorkspace layout. |
|
the number of columns to use for the MatewnckWorkspace layout. |
Returns : |
a token to use for future calls to
matewnck_screen_try_set_workspace_layout() and to
matewnck_screen_release_workspace_layout() , or 0 if the layout could not be set. |
void matewnck_screen_release_workspace_layout (MatewnckScreen *screen
,int current_token
);
Releases the ownership of the layout of MatewnckWorkspace on screen
.
current_token
is used to verify that the caller is the owner of the layout.
If the verification fails, nothing happens.
|
a MatewnckScreen. |
|
the token obtained through
matewnck_screen_try_set_workspace_layout() . |
struct MatewnckWorkspaceLayout { int rows; int cols; int *grid; int grid_area; int current_row; int current_col; };
MatewnckWorkspaceLayout
has been deprecated since version 2.20 and should not be used in newly-written code.
The MatewnckWorkspaceLayout struct contains information about the layout of MatewnckWorkspace on a MatewnckScreen, and the exact position of a specific MatewnckWorkspace.
number of rows in the layout grid. | |
number of columns in the layout grid. | |
array of size grid_area containing the index (starting from 0) of
the MatewnckWorkspace for each position in the layout grid, or -1 if the
position does not correspond to any MatewnckWorkspace. |
|
size of the grid containing all MatewnckWorkspace. This can be bigger than the number of MatewnckWorskpace because the grid might not be filled. | |
row of the specific MatewnckWorkspace, starting from 0. | |
column of the specific MatewnckWorkspace, starting from 0. |
Since 2.12
void matewnck_screen_calc_workspace_layout (MatewnckScreen *screen
,int num_workspaces
,int space_index
,MatewnckWorkspaceLayout *layout
);
matewnck_screen_calc_workspace_layout
has been deprecated since version 2.20 and should not be used in newly-written code.
Calculates the layout of MatewnckWorkspace, with additional information like
the row and column of the MatewnckWorkspace with index space_index
.
|
a MatewnckScreen. |
|
the number of MatewnckWorkspace on screen , or -1 to let
matewnck_screen_calc_workspace_layout() find this number. |
|
the index of a Workspace. |
|
return location for the layout of MatewnckWorkspace with additional information. |
Since 2.12
void matewnck_screen_free_workspace_layout (MatewnckWorkspaceLayout *layout
);
matewnck_screen_free_workspace_layout
has been deprecated since version 2.20 and should not be used in newly-written code.
Frees the content of layout
. This does not free layout
itself, so you
might want to free layout
yourself after calling this.
|
a MatewnckWorkspaceLayout. |
Since 2.12
void matewnck_screen_move_viewport (MatewnckScreen *screen
,int x
,int y
);
Asks the window manager to move the viewport of the current MatewnckWorkspace
on screen
.
|
a MatewnckScreen. |
|
X offset in pixels of viewport. |
|
Y offset in pixels of viewport. |
Since 2.4
gulong matewnck_screen_get_background_pixmap (MatewnckScreen *screen
);
Gets the X window ID of the background pixmap of screen
.
|
a MatewnckScreen. |
Returns : |
the X window ID of the background pixmap of screen . |
gboolean matewnck_screen_get_showing_desktop (MatewnckScreen *screen
);
Gets whether screen
is in the "showing the desktop" mode. This mode is
changed when a "showing-desktop-changed" signal gets emitted.
|
a MatewnckScreen. |
Returns : |
TRUE if window is fullscreen, FALSE otherwise. |
Since 2.2
void matewnck_screen_toggle_showing_desktop (MatewnckScreen *screen
,gboolean show
);
Asks the window manager to set the "showing the desktop" mode on screen
according to show
.
|
a MatewnckScreen. |
|
whether to activate the "showing the desktop" mode on screen . |
Since 2.2
"active-window-changed"
signalvoid user_function (MatewnckScreen *screen,
MatewnckWindow *previously_active_window,
gpointer user_data) : Run Last
Emitted when the active window on screen
has changed.
|
the MatewnckScreen which emitted the signal. |
|
the previously active MatewnckWindow before this change. |
|
user data set when the signal handler was connected. |
"active-workspace-changed"
signalvoid user_function (MatewnckScreen *screen,
MatewnckWorkspace *previously_active_space,
gpointer user_data) : Run Last
Emitted when the active workspace on screen
has changed.
|
the MatewnckScreen which emitted the signal. |
|
the previously active MatewnckWorkspace before this change. |
|
user data set when the signal handler was connected. |
"application-closed"
signalvoid user_function (MatewnckScreen *screen,
MatewnckApplication *app,
gpointer user_data) : Run Last
Emitted when a MatewnckApplication is closed on screen
.
|
the MatewnckScreen which emitted the signal. |
|
the closed MatewnckApplication. |
|
user data set when the signal handler was connected. |
"application-opened"
signalvoid user_function (MatewnckScreen *screen,
MatewnckApplication *app,
gpointer user_data) : Run Last
Emitted when a new MatewnckApplication is opened on screen
.
|
the MatewnckScreen which emitted the signal. |
|
the opened MatewnckApplication. |
|
user data set when the signal handler was connected. |
"background-changed"
signalvoid user_function (MatewnckScreen *screen,
gpointer user_data) : Run Last
Emitted when the background on the root window of screen
has changed.
|
the MatewnckScreen which emitted the signal. |
|
user data set when the signal handler was connected. |
"class-group-closed"
signalvoid user_function (MatewnckScreen *screen,
MatewnckClassGroup *class_group,
gpointer user_data) : Run Last
Emitted when a MatewnckClassGroup is closed on screen
.
|
the MatewnckScreen which emitted the signal. |
|
the closed MatewnckClassGroup. |
|
user data set when the signal handler was connected. |
Since 2.20
"class-group-opened"
signalvoid user_function (MatewnckScreen *screen,
MatewnckClassGroup *class_group,
gpointer user_data) : Run Last
Emitted when a new MatewnckClassGroup is opened on screen
.
|
the MatewnckScreen which emitted the signal. |
|
the opened MatewnckClassGroup. |
|
user data set when the signal handler was connected. |
Since 2.20
"showing-desktop-changed"
signalvoid user_function (MatewnckScreen *screen,
gpointer user_data) : Run Last
Emitted when "showing the desktop" mode of screen
is toggled.
|
the MatewnckScreen which emitted the signal. |
|
user data set when the signal handler was connected. |
Since 2.20
"viewports-changed"
signalvoid user_function (MatewnckScreen *screen,
gpointer user_data) : Run Last
Emitted when a viewport position has changed in a MatewnckWorkspace of
screen
or when a MatewnckWorkspace of screen
gets or loses its viewport.
|
the MatewnckScreen which emitted the signal. |
|
user data set when the signal handler was connected. |
Since 2.20
"window-closed"
signalvoid user_function (MatewnckScreen *screen,
MatewnckWindow *window,
gpointer user_data) : Run Last
Emitted when a MatewnckWindow is closed on screen
.
|
the MatewnckScreen which emitted the signal. |
|
the closed MatewnckWindow. |
|
user data set when the signal handler was connected. |
"window-manager-changed"
signalvoid user_function (MatewnckScreen *screen,
gpointer user_data) : Run Last
Emitted when the window manager on screen
has changed.
|
the MatewnckScreen which emitted the signal. |
|
user data set when the signal handler was connected. |
Since 2.20
"window-opened"
signalvoid user_function (MatewnckScreen *screen,
MatewnckWindow *window,
gpointer user_data) : Run Last
Emitted when a new MatewnckWindow is opened on screen
.
|
the MatewnckScreen which emitted the signal. |
|
the opened MatewnckWindow. |
|
user data set when the signal handler was connected. |
"window-stacking-changed"
signalvoid user_function (MatewnckScreen *screen,
gpointer user_data) : Run Last
Emitted when the stacking order of MatewnckWindow on screen
has changed.
|
the MatewnckScreen which emitted the signal. |
|
user data set when the signal handler was connected. |
"workspace-created"
signalvoid user_function (MatewnckScreen *screen,
MatewnckWorkspace *space,
gpointer user_data) : Run Last
Emitted when a MatewnckWorkspace is created on screen
.
|
the MatewnckScreen which emitted the signal. |
|
the workspace that has been created. |
|
user data set when the signal handler was connected. |
"workspace-destroyed"
signalvoid user_function (MatewnckScreen *screen,
MatewnckWorkspace *space,
gpointer user_data) : Run Last
Emitted when a MatewnckWorkspace is destroyed on screen
.
|
the MatewnckScreen which emitted the signal. |
|
the workspace that has been destroyed. |
|
user data set when the signal handler was connected. |