CinnamonGlobal

CinnamonGlobal

Synopsis

struct              CinnamonGlobalClass;
CinnamonGlobal *    cinnamon_global_get                 (void);
ClutterStage *      cinnamon_global_get_stage           (CinnamonGlobal *global);
MetaScreen *        cinnamon_global_get_screen          (CinnamonGlobal *global);
GdkScreen *         cinnamon_global_get_gdk_screen      (CinnamonGlobal *global);
MetaDisplay *       cinnamon_global_get_display         (CinnamonGlobal *global);
GList *             cinnamon_global_get_window_actors   (CinnamonGlobal *global);
GSettings *         cinnamon_global_get_settings        (CinnamonGlobal *global);
guint32             cinnamon_global_get_current_time    (CinnamonGlobal *global);
pid_t               cinnamon_global_get_pid             (void);
gchar *             cinnamon_global_get_md5_for_string  (const gchar *string);
gint64              cinnamon_global_get_last_gc_end_time
                                                        (CinnamonGlobal *global);
void                cinnamon_global_dump_gjs_stack      (CinnamonGlobal *global);
gboolean            cinnamon_global_begin_modal         (CinnamonGlobal *global,
                                                         guint32 timestamp,
                                                         MetaModalOptions options);
void                cinnamon_global_end_modal           (CinnamonGlobal *global,
                                                         guint32 timestamp);
enum                CinnamonStageInputMode;
void                cinnamon_global_set_stage_input_mode
                                                        (CinnamonGlobal *global,
                                                         CinnamonStageInputMode mode);
void                cinnamon_global_set_stage_input_region
                                                        (CinnamonGlobal *global,
                                                         GSList *rectangles);
enum                CinnamonCursor;
void                cinnamon_global_set_cursor          (CinnamonGlobal *global,
                                                         CinnamonCursor type);
void                cinnamon_global_unset_cursor        (CinnamonGlobal *global);
guint32             cinnamon_global_create_pointer_barrier
                                                        (CinnamonGlobal *global,
                                                         int x1,
                                                         int y1,
                                                         int x2,
                                                         int y2,
                                                         int directions);
void                cinnamon_global_destroy_pointer_barrier
                                                        (CinnamonGlobal *global,
                                                         guint32 barrier);
void                cinnamon_global_get_pointer         (CinnamonGlobal *global,
                                                         int *x,
                                                         int *y,
                                                         ClutterModifierType *mods);
void                cinnamon_global_set_pointer         (CinnamonGlobal *global,
                                                         int x,
                                                         int y);
void                cinnamon_global_get_memory_info     (CinnamonGlobal *global,
                                                         CinnamonJSMemoryInfo *meminfo);
void                cinnamon_global_begin_work          (CinnamonGlobal *global);
void                cinnamon_global_end_work            (CinnamonGlobal *global);
void                (*CinnamonLeisureFunction)          (gpointer data);
void                cinnamon_global_run_at_leisure      (CinnamonGlobal *global,
                                                         CinnamonLeisureFunction func,
                                                         gpointer user_data,
                                                         GDestroyNotify notify);
void                cinnamon_global_sync_pointer        (CinnamonGlobal *global);
GAppLaunchContext * cinnamon_global_create_app_launch_context
                                                        (CinnamonGlobal *global);
void                cinnamon_global_notify_error        (CinnamonGlobal *global,
                                                         const char *msg,
                                                         const char *details);
void                cinnamon_global_init_xdnd           (CinnamonGlobal *global);
void                cinnamon_global_shutdown            (void);
void                cinnamon_global_reexec_self         (CinnamonGlobal *global);
void                cinnamon_global_segfault            (CinnamonGlobal *global);

Object Hierarchy

  GEnum
   +----CinnamonStageInputMode
  GEnum
   +----CinnamonCursor

Description

Details

struct CinnamonGlobalClass

struct CinnamonGlobalClass {
  GObjectClass parent_class;
};

cinnamon_global_get ()

CinnamonGlobal *    cinnamon_global_get                 (void);

Gets the singleton global object that represents the desktop.

Returns :

the singleton global object. [transfer none]

cinnamon_global_get_stage ()

ClutterStage *      cinnamon_global_get_stage           (CinnamonGlobal *global);

Returns :

The default ClutterStage. [transfer none]

cinnamon_global_get_screen ()

MetaScreen *        cinnamon_global_get_screen          (CinnamonGlobal *global);

Returns :

The default MetaScreen. [transfer none]

cinnamon_global_get_gdk_screen ()

GdkScreen *         cinnamon_global_get_gdk_screen      (CinnamonGlobal *global);

Returns :

Gdk screen object for Cinnamon. [transfer none]

cinnamon_global_get_display ()

MetaDisplay *       cinnamon_global_get_display         (CinnamonGlobal *global);

Returns :

The default MetaDisplay. [transfer none]

cinnamon_global_get_window_actors ()

GList *             cinnamon_global_get_window_actors   (CinnamonGlobal *global);

Gets the list of MetaWindowActor for the plugin's screen

Returns :

the list of windows. [element-type Meta.WindowActor][transfer none]

cinnamon_global_get_settings ()

GSettings *         cinnamon_global_get_settings        (CinnamonGlobal *global);

Get the global GSettings instance.

global :

A CinnamonGlobal

Returns :

The GSettings object. [transfer none]

cinnamon_global_get_current_time ()

guint32             cinnamon_global_get_current_time    (CinnamonGlobal *global);

global :

A CinnamonGlobal

Returns :

the current X server time from the current Clutter, Gdk, or X event. If called from outside an event handler, this may return Clutter.CURRENT_TIME (aka 0), or it may return a slightly out-of-date timestamp.

cinnamon_global_get_pid ()

pid_t               cinnamon_global_get_pid             (void);

Returns :

the pid of the cinnamon process.

cinnamon_global_get_md5_for_string ()

gchar *             cinnamon_global_get_md5_for_string  (const gchar *string);

Returns :

the MD5 sum for the given string

cinnamon_global_get_last_gc_end_time ()

gint64              cinnamon_global_get_last_gc_end_time
                                                        (CinnamonGlobal *global);

global :

A CinnamonGlobal

Returns :

The timestamp of the last js garbage collection.

cinnamon_global_dump_gjs_stack ()

void                cinnamon_global_dump_gjs_stack      (CinnamonGlobal *global);

Prints out the gjs stack

global :

A CinnamonGlobal

cinnamon_global_begin_modal ()

gboolean            cinnamon_global_begin_modal         (CinnamonGlobal *global,
                                                         guint32 timestamp,
                                                         MetaModalOptions options);

Grabs the keyboard and mouse to the stage window. The stage will receive all keyboard and mouse events until cinnamon_global_end_modal() is called. This is used to implement "modes" for Cinnamon, such as the overview mode or the "looking glass" debug overlay, that block application and normal key shortcuts.

global :

a CinnamonGlobal

Returns :

value: TRUE if we succesfully entered the mode. FALSE if we couldn't enter the mode. Failure may occur because an application has the pointer or keyboard grabbed, because Muffin is in a mode itself like moving a window or alt-Tab window selection, or because cinnamon_global_begin_modal() was previouly called.

cinnamon_global_end_modal ()

void                cinnamon_global_end_modal           (CinnamonGlobal *global,
                                                         guint32 timestamp);

Undoes the effect of cinnamon_global_begin_modal().

global :

a CinnamonGlobal

enum CinnamonStageInputMode

typedef enum {
  CINNAMON_STAGE_INPUT_MODE_NONREACTIVE,
  CINNAMON_STAGE_INPUT_MODE_NORMAL,
  CINNAMON_STAGE_INPUT_MODE_FOCUSED,
  CINNAMON_STAGE_INPUT_MODE_FULLSCREEN
} CinnamonStageInputMode;

CINNAMON_STAGE_INPUT_MODE_NONREACTIVE

CINNAMON_STAGE_INPUT_MODE_NORMAL

CINNAMON_STAGE_INPUT_MODE_FOCUSED

CINNAMON_STAGE_INPUT_MODE_FULLSCREEN


cinnamon_global_set_stage_input_mode ()

void                cinnamon_global_set_stage_input_mode
                                                        (CinnamonGlobal *global,
                                                         CinnamonStageInputMode mode);

Sets the input mode of the stage; when mode is CINNAMON_STAGE_INPUT_MODE_NONREACTIVE, then the stage does not absorb any clicks, but just passes them through to underlying windows. When it is CINNAMON_STAGE_INPUT_MODE_NORMAL, then the stage accepts clicks in the region defined by cinnamon_global_set_stage_input_region() but passes through clicks outside that region. When it is CINNAMON_STAGE_INPUT_MODE_FULLSCREEN, the stage absorbs all input.

When the input mode is CINNAMON_STAGE_INPUT_MODE_FOCUSED, the pointer is handled as with CINNAMON_STAGE_INPUT_MODE_NORMAL, but additionally the stage window has the keyboard focus. If the stage loses the focus (eg, because the user clicked into a window) the input mode will revert to CINNAMON_STAGE_INPUT_MODE_NORMAL.

Note that whenever a muffin-internal Gtk widget has a pointer grab, Cinnamon behaves as though it was in CINNAMON_STAGE_INPUT_MODE_NONREACTIVE, to ensure that the widget gets any clicks it is expecting.

global :

the CinnamonGlobal

mode :

the stage input mode

cinnamon_global_set_stage_input_region ()

void                cinnamon_global_set_stage_input_region
                                                        (CinnamonGlobal *global,
                                                         GSList *rectangles);

Sets the area of the stage that is responsive to mouse clicks when the stage mode is CINNAMON_STAGE_INPUT_MODE_NORMAL (but does not change the current stage mode).

global :

the CinnamonGlobal

rectangles :

a list of MetaRectangle describing the input region. [element-type Meta.Rectangle]

enum CinnamonCursor

typedef enum {
  CINNAMON_CURSOR_DND_IN_DRAG,
  CINNAMON_CURSOR_DND_UNSUPPORTED_TARGET,
  CINNAMON_CURSOR_DND_MOVE,
  CINNAMON_CURSOR_DND_COPY,
  CINNAMON_CURSOR_POINTING_HAND,
  CINNAMON_CURSOR_RESIZE_BOTTOM,
  CINNAMON_CURSOR_RESIZE_TOP,
  CINNAMON_CURSOR_RESIZE_LEFT,
  CINNAMON_CURSOR_RESIZE_RIGHT,
  CINNAMON_CURSOR_RESIZE_BOTTOM_RIGHT,
  CINNAMON_CURSOR_RESIZE_BOTTOM_LEFT,
  CINNAMON_CURSOR_RESIZE_TOP_RIGHT,
  CINNAMON_CURSOR_RESIZE_TOP_LEFT,
  CINNAMON_CURSOR_CROSSHAIR,
  CINNAMON_CURSOR_TEXT
} CinnamonCursor;

CINNAMON_CURSOR_DND_IN_DRAG

CINNAMON_CURSOR_DND_UNSUPPORTED_TARGET

CINNAMON_CURSOR_DND_MOVE

CINNAMON_CURSOR_DND_COPY

CINNAMON_CURSOR_POINTING_HAND

CINNAMON_CURSOR_RESIZE_BOTTOM

CINNAMON_CURSOR_RESIZE_TOP

CINNAMON_CURSOR_RESIZE_LEFT

CINNAMON_CURSOR_RESIZE_RIGHT

CINNAMON_CURSOR_RESIZE_BOTTOM_RIGHT

CINNAMON_CURSOR_RESIZE_BOTTOM_LEFT

CINNAMON_CURSOR_RESIZE_TOP_RIGHT

CINNAMON_CURSOR_RESIZE_TOP_LEFT

CINNAMON_CURSOR_CROSSHAIR

CINNAMON_CURSOR_TEXT


cinnamon_global_set_cursor ()

void                cinnamon_global_set_cursor          (CinnamonGlobal *global,
                                                         CinnamonCursor type);

Set the cursor on the stage window.

global :

A CinnamonGlobal

type :

the type of the cursor

cinnamon_global_unset_cursor ()

void                cinnamon_global_unset_cursor        (CinnamonGlobal *global);

Unset the cursor on the stage window.

global :

A CinnamonGlobal

cinnamon_global_create_pointer_barrier ()

guint32             cinnamon_global_create_pointer_barrier
                                                        (CinnamonGlobal *global,
                                                         int x1,
                                                         int y1,
                                                         int x2,
                                                         int y2,
                                                         int directions);

If supported by X creates a pointer barrier.

global :

a CinnamonGlobal

x1 :

left X coordinate

y1 :

top Y coordinate

x2 :

right X coordinate

y2 :

bottom Y coordinate

directions :

The directions we're allowed to pass through

Returns :

value you can pass to cinnamon_global_destroy_pointer_barrier()

cinnamon_global_destroy_pointer_barrier ()

void                cinnamon_global_destroy_pointer_barrier
                                                        (CinnamonGlobal *global,
                                                         guint32 barrier);

Destroys the barrier created by cinnamon_global_create_pointer_barrier().

global :

a CinnamonGlobal

barrier :

a pointer barrier

cinnamon_global_get_pointer ()

void                cinnamon_global_get_pointer         (CinnamonGlobal *global,
                                                         int *x,
                                                         int *y,
                                                         ClutterModifierType *mods);

Gets the pointer coordinates and current modifier key state. This is a wrapper around gdk_display_get_pointer() that strips out any un-declared modifier flags, to make gjs happy; see https://bugzilla.gnome.org/show_bug.cgi?id=597292.

global :

the CinnamonGlobal

x :

the X coordinate of the pointer, in global coordinates. [out]

y :

the Y coordinate of the pointer, in global coordinates. [out]

mods :

the current set of modifier keys that are pressed down. [out]

cinnamon_global_set_pointer ()

void                cinnamon_global_set_pointer         (CinnamonGlobal *global,
                                                         int x,
                                                         int y);

Sets the pointer coordinates. This is a wrapper around gdk_device_warp().

global :

the CinnamonGlobal

x :

the X coordinate of the pointer, in global coordinates. [in]

y :

the Y coordinate of the pointer, in global coordinates. [in]

cinnamon_global_get_memory_info ()

void                cinnamon_global_get_memory_info     (CinnamonGlobal *global,
                                                         CinnamonJSMemoryInfo *meminfo);

global :

A CinnamonGlobal

meminfo :

Output location for memory information. [out caller-allocates]

Returns :

a generic pointer to the GjsContext. [transfer none]

cinnamon_global_begin_work ()

void                cinnamon_global_begin_work          (CinnamonGlobal *global);

Marks that we are currently doing work. This is used to to track whether we are busy for the purposes of cinnamon_global_run_at_leisure(). A count is kept and cinnamon_global_end_work() must be called exactly as many times as cinnamon_global_begin_work().

global :

the CinnamonGlobal

cinnamon_global_end_work ()

void                cinnamon_global_end_work            (CinnamonGlobal *global);

Marks the end of work that we started with cinnamon_global_begin_work(). If no other work is ongoing and functions have been added with cinnamon_global_run_at_leisure(), they will be run at the next opportunity.

global :

the CinnamonGlobal

CinnamonLeisureFunction ()

void                (*CinnamonLeisureFunction)          (gpointer data);

cinnamon_global_run_at_leisure ()

void                cinnamon_global_run_at_leisure      (CinnamonGlobal *global,
                                                         CinnamonLeisureFunction func,
                                                         gpointer user_data,
                                                         GDestroyNotify notify);

Schedules a function to be called the next time Cinnamon is idle. Idle means here no animations, no redrawing, and no ongoing background work. Since there is currently no way to hook into the Clutter master clock and know when is running, the implementation here is somewhat approximation. Animations done through Cinnamon's Tweener module will be handled properly, but other animations may be detected as terminating early if they can be drawn fast enough so that the event loop goes idle between frames.

The intent of this function is for performance measurement runs where a number of actions should be run serially and each action is timed individually. Using this function for other purposes will interfere with the ability to use it for performance measurement so should be avoided.

global :

the CinnamonGlobal

func :

function to call at leisure

user_data :

data to pass to func

notify :

function to call to free user_data

cinnamon_global_sync_pointer ()

void                cinnamon_global_sync_pointer        (CinnamonGlobal *global);

Ensures that clutter is aware of the current pointer position, causing enter and leave events to be emitted if the pointer moved behind our back (ie, during a pointer grab).

global :

the CinnamonGlobal

cinnamon_global_create_app_launch_context ()

GAppLaunchContext * cinnamon_global_create_app_launch_context
                                                        (CinnamonGlobal *global);

Create a GAppLaunchContext set up with the correct timestamp, and targeted to activate on the current workspace.

global :

A CinnamonGlobal

Returns :

A new GAppLaunchContext. [transfer full]

cinnamon_global_notify_error ()

void                cinnamon_global_notify_error        (CinnamonGlobal *global,
                                                         const char *msg,
                                                         const char *details);

Show a system error notification. Use this function when a user-initiated action results in a non-fatal problem from causes that may not be under system control. For example, an application crash.

global :

a CinnamonGlobal

msg :

Error message

details :

Error details

cinnamon_global_init_xdnd ()

void                cinnamon_global_init_xdnd           (CinnamonGlobal *global);

Enables tracking of Xdnd events

global :

the CinnamonGlobal

cinnamon_global_shutdown ()

void                cinnamon_global_shutdown            (void);

cinnamon_global_reexec_self ()

void                cinnamon_global_reexec_self         (CinnamonGlobal *global);

Restart the current process. Only intended for development purposes.

global :

A CinnamonGlobal

cinnamon_global_segfault ()

void                cinnamon_global_segfault            (CinnamonGlobal *global);

Crashes Cinnamon by causing a segfault

global :

the CinnamonGlobal