diff options
Diffstat (limited to 'libmate-desktop/libmateui')
-rw-r--r-- | libmate-desktop/libmateui/Makefile.am | 10 | ||||
-rw-r--r-- | libmate-desktop/libmateui/mate-bg-crossfade.h | 78 | ||||
-rw-r--r-- | libmate-desktop/libmateui/mate-bg.h | 139 | ||||
-rw-r--r-- | libmate-desktop/libmateui/mate-desktop-thumbnail.h | 114 | ||||
-rw-r--r-- | libmate-desktop/libmateui/mate-rr-config.h | 131 | ||||
-rw-r--r-- | libmate-desktop/libmateui/mate-rr-labeler.h | 53 | ||||
-rw-r--r-- | libmate-desktop/libmateui/mate-rr.h | 177 |
7 files changed, 702 insertions, 0 deletions
diff --git a/libmate-desktop/libmateui/Makefile.am b/libmate-desktop/libmateui/Makefile.am new file mode 100644 index 0000000..ca42525 --- /dev/null +++ b/libmate-desktop/libmateui/Makefile.am @@ -0,0 +1,10 @@ +libmateui_desktopdir = $(includedir)/mate-desktop-2.0/libmateui +libmateui_desktop_HEADERS = \ + mate-bg.h \ + mate-bg-crossfade.h \ + mate-desktop-thumbnail.h \ + mate-rr.h \ + mate-rr-config.h \ + mate-rr-labeler.h + +-include $(top_srcdir)/git.mk diff --git a/libmate-desktop/libmateui/mate-bg-crossfade.h b/libmate-desktop/libmateui/mate-bg-crossfade.h new file mode 100644 index 0000000..6da8795 --- /dev/null +++ b/libmate-desktop/libmateui/mate-bg-crossfade.h @@ -0,0 +1,78 @@ +/* mate-bg-crossfade.h - fade window background between two pixmaps + + Copyright 2008, Red Hat, Inc. + + This file is part of the Mate Library. + + The Mate Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The Mate Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the Mate Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. + + Author: Ray Strode <[email protected]> +*/ + +#ifndef __MATE_BG_CROSSFADE_H__ +#define __MATE_BG_CROSSFADE_H__ + +#ifndef MATE_DESKTOP_USE_UNSTABLE_API +#error MateBGCrossfade is unstable API. You must define MATE_DESKTOP_USE_UNSTABLE_API before including mate-bg-crossfade.h +#endif + +#include <gdk/gdk.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#define MATE_TYPE_BG_CROSSFADE (mate_bg_crossfade_get_type ()) +#define MATE_BG_CROSSFADE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MATE_TYPE_BG_CROSSFADE, MateBGCrossfade)) +#define MATE_BG_CROSSFADE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MATE_TYPE_BG_CROSSFADE, MateBGCrossfadeClass)) +#define MATE_IS_BG_CROSSFADE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MATE_TYPE_BG_CROSSFADE)) +#define MATE_IS_BG_CROSSFADE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MATE_TYPE_BG_CROSSFADE)) +#define MATE_BG_CROSSFADE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MATE_TYPE_BG_CROSSFADE, MateBGCrossfadeClass)) + +typedef struct _MateBGCrossfadePrivate MateBGCrossfadePrivate; +typedef struct _MateBGCrossfade MateBGCrossfade; +typedef struct _MateBGCrossfadeClass MateBGCrossfadeClass; + +struct _MateBGCrossfade +{ + GObject parent_object; + + MateBGCrossfadePrivate *priv; +}; + +struct _MateBGCrossfadeClass +{ + GObjectClass parent_class; + + void (* finished) (MateBGCrossfade *fade, GdkWindow *window); +}; + +GType mate_bg_crossfade_get_type (void); +MateBGCrossfade *mate_bg_crossfade_new (int width, int height); +gboolean mate_bg_crossfade_set_start_pixmap (MateBGCrossfade *fade, + GdkPixmap *pixmap); +gboolean mate_bg_crossfade_set_end_pixmap (MateBGCrossfade *fade, + GdkPixmap *pixmap); +void mate_bg_crossfade_start (MateBGCrossfade *fade, + GdkWindow *window); +gboolean mate_bg_crossfade_is_started (MateBGCrossfade *fade); +void mate_bg_crossfade_stop (MateBGCrossfade *fade); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/libmate-desktop/libmateui/mate-bg.h b/libmate-desktop/libmateui/mate-bg.h new file mode 100644 index 0000000..0506d86 --- /dev/null +++ b/libmate-desktop/libmateui/mate-bg.h @@ -0,0 +1,139 @@ +/* mate-bg.h - + + Copyright 2007, Red Hat, Inc. + + This file is part of the Mate Library. + + The Mate Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The Mate Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the Mate Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. + + Author: Soren Sandmann <[email protected]> +*/ + +#ifndef __MATE_BG_H__ +#define __MATE_BG_H__ + +#ifndef MATE_DESKTOP_USE_UNSTABLE_API +#error MateBG is unstable API. You must define MATE_DESKTOP_USE_UNSTABLE_API before including mate-bg.h +#endif + +#include <gdk/gdk.h> +#include <mateconf/mateconf-client.h> +#include <libmateui/mate-desktop-thumbnail.h> +#include <libmateui/mate-bg-crossfade.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#define MATE_TYPE_BG (mate_bg_get_type ()) +#define MATE_BG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MATE_TYPE_BG, MateBG)) +#define MATE_BG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MATE_TYPE_BG, MateBGClass)) +#define MATE_IS_BG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MATE_TYPE_BG)) +#define MATE_IS_BG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MATE_TYPE_BG)) +#define MATE_BG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MATE_TYPE_BG, MateBGClass)) + +#define MATE_BG_KEY_DIR "/desktop/mate/background" + +typedef struct _MateBG MateBG; +typedef struct _MateBGClass MateBGClass; + +typedef enum { + MATE_BG_COLOR_SOLID, + MATE_BG_COLOR_H_GRADIENT, + MATE_BG_COLOR_V_GRADIENT +} MateBGColorType; + +typedef enum { + MATE_BG_PLACEMENT_TILED, + MATE_BG_PLACEMENT_ZOOMED, + MATE_BG_PLACEMENT_CENTERED, + MATE_BG_PLACEMENT_SCALED, + MATE_BG_PLACEMENT_FILL_SCREEN, + MATE_BG_PLACEMENT_SPANNED +} MateBGPlacement; + +GType mate_bg_get_type (void); +MateBG * mate_bg_new (void); +void mate_bg_load_from_preferences (MateBG *bg, + MateConfClient *client); +void mate_bg_save_to_preferences (MateBG *bg, + MateConfClient *client); +/* Setters */ +void mate_bg_set_filename (MateBG *bg, + const char *filename); +void mate_bg_set_placement (MateBG *bg, + MateBGPlacement placement); +void mate_bg_set_color (MateBG *bg, + MateBGColorType type, + GdkColor *primary, + GdkColor *secondary); +/* Getters */ +MateBGPlacement mate_bg_get_placement (MateBG *bg); +void mate_bg_get_color (MateBG *bg, + MateBGColorType *type, + GdkColor *primary, + GdkColor *secondary); +const gchar * mate_bg_get_filename (MateBG *bg); + +/* Drawing and thumbnailing */ +void mate_bg_draw (MateBG *bg, + GdkPixbuf *dest, + GdkScreen *screen, + gboolean is_root); +GdkPixmap * mate_bg_create_pixmap (MateBG *bg, + GdkWindow *window, + int width, + int height, + gboolean root); +gboolean mate_bg_get_image_size (MateBG *bg, + MateDesktopThumbnailFactory *factory, + int best_width, + int best_height, + int *width, + int *height); +GdkPixbuf * mate_bg_create_thumbnail (MateBG *bg, + MateDesktopThumbnailFactory *factory, + GdkScreen *screen, + int dest_width, + int dest_height); +gboolean mate_bg_is_dark (MateBG *bg, + int dest_width, + int dest_height); +gboolean mate_bg_has_multiple_sizes (MateBG *bg); +gboolean mate_bg_changes_with_time (MateBG *bg); +GdkPixbuf * mate_bg_create_frame_thumbnail (MateBG *bg, + MateDesktopThumbnailFactory *factory, + GdkScreen *screen, + int dest_width, + int dest_height, + int frame_num); + +/* Set a pixmap as root - not a MateBG method. At some point + * if we decide to stabilize the API then we may want to make + * these object methods, drop mate_bg_create_pixmap, etc. + */ +void mate_bg_set_pixmap_as_root (GdkScreen *screen, + GdkPixmap *pixmap); + +MateBGCrossfade *mate_bg_set_pixmap_as_root_with_crossfade (GdkScreen *screen, + GdkPixmap *pixmap); +GdkPixmap *mate_bg_get_pixmap_from_root (GdkScreen *screen); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/libmate-desktop/libmateui/mate-desktop-thumbnail.h b/libmate-desktop/libmateui/mate-desktop-thumbnail.h new file mode 100644 index 0000000..cc59a10 --- /dev/null +++ b/libmate-desktop/libmateui/mate-desktop-thumbnail.h @@ -0,0 +1,114 @@ +/* + * mate-thumbnail.h: Utilities for handling thumbnails + * + * Copyright (C) 2002 Red Hat, Inc. + * + * This file is part of the Mate Library. + * + * The Mate Library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * The Mate Library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with the Mate Library; see the file COPYING.LIB. If not, + * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + * + * Author: Alexander Larsson <[email protected]> + */ + +#ifndef MATE_DESKTOP_THUMBNAIL_H +#define MATE_DESKTOP_THUMBNAIL_H + +#ifndef MATE_DESKTOP_USE_UNSTABLE_API +#error MateDesktopThumbnail is unstable API. You must define MATE_DESKTOP_USE_UNSTABLE_API before including mate-desktop-thumbnail.h +#endif + +#include <glib.h> +#include <glib-object.h> +#include <time.h> +#include <gdk-pixbuf/gdk-pixbuf.h> + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + MATE_DESKTOP_THUMBNAIL_SIZE_NORMAL, + MATE_DESKTOP_THUMBNAIL_SIZE_LARGE +} MateDesktopThumbnailSize; + +#define MATE_DESKTOP_TYPE_THUMBNAIL_FACTORY (mate_desktop_thumbnail_factory_get_type ()) +#define MATE_DESKTOP_THUMBNAIL_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MATE_DESKTOP_TYPE_THUMBNAIL_FACTORY, MateDesktopThumbnailFactory)) +#define MATE_DESKTOP_THUMBNAIL_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MATE_DESKTOP_TYPE_THUMBNAIL_FACTORY, MateDesktopThumbnailFactoryClass)) +#define MATE_DESKTOP_IS_THUMBNAIL_FACTORY(obj) (G_TYPE_INSTANCE_CHECK_TYPE ((obj), MATE_DESKTOP_TYPE_THUMBNAIL_FACTORY)) +#define MATE_DESKTOP_IS_THUMBNAIL_FACTORY_CLASS(klass) (G_TYPE_CLASS_CHECK_CLASS_TYPE ((klass), MATE_DESKTOP_TYPE_THUMBNAIL_FACTORY)) + +typedef struct _MateDesktopThumbnailFactory MateDesktopThumbnailFactory; +typedef struct _MateDesktopThumbnailFactoryClass MateDesktopThumbnailFactoryClass; +typedef struct _MateDesktopThumbnailFactoryPrivate MateDesktopThumbnailFactoryPrivate; + +struct _MateDesktopThumbnailFactory { + GObject parent; + + MateDesktopThumbnailFactoryPrivate *priv; +}; + +struct _MateDesktopThumbnailFactoryClass { + GObjectClass parent; +}; + +GType mate_desktop_thumbnail_factory_get_type (void); +MateDesktopThumbnailFactory *mate_desktop_thumbnail_factory_new (MateDesktopThumbnailSize size); + +char * mate_desktop_thumbnail_factory_lookup (MateDesktopThumbnailFactory *factory, + const char *uri, + time_t mtime); + +gboolean mate_desktop_thumbnail_factory_has_valid_failed_thumbnail (MateDesktopThumbnailFactory *factory, + const char *uri, + time_t mtime); +gboolean mate_desktop_thumbnail_factory_can_thumbnail (MateDesktopThumbnailFactory *factory, + const char *uri, + const char *mime_type, + time_t mtime); +GdkPixbuf * mate_desktop_thumbnail_factory_generate_thumbnail (MateDesktopThumbnailFactory *factory, + const char *uri, + const char *mime_type); +void mate_desktop_thumbnail_factory_save_thumbnail (MateDesktopThumbnailFactory *factory, + GdkPixbuf *thumbnail, + const char *uri, + time_t original_mtime); +void mate_desktop_thumbnail_factory_create_failed_thumbnail (MateDesktopThumbnailFactory *factory, + const char *uri, + time_t mtime); + + +/* Thumbnailing utils: */ +gboolean mate_desktop_thumbnail_has_uri (GdkPixbuf *pixbuf, + const char *uri); +gboolean mate_desktop_thumbnail_is_valid (GdkPixbuf *pixbuf, + const char *uri, + time_t mtime); +char * mate_desktop_thumbnail_md5 (const char *uri); +char * mate_desktop_thumbnail_path_for_uri (const char *uri, + MateDesktopThumbnailSize size); + + +/* Pixbuf utils */ + +GdkPixbuf *mate_desktop_thumbnail_scale_down_pixbuf (GdkPixbuf *pixbuf, + int dest_width, + int dest_height); + +#ifdef __cplusplus +} +#endif + +#endif /* MATE_DESKTOP_THUMBNAIL_H */ diff --git a/libmate-desktop/libmateui/mate-rr-config.h b/libmate-desktop/libmateui/mate-rr-config.h new file mode 100644 index 0000000..1ed31c8 --- /dev/null +++ b/libmate-desktop/libmateui/mate-rr-config.h @@ -0,0 +1,131 @@ +/* mate-rr-config.h + * + * Copyright 2007, 2008, Red Hat, Inc. + * + * This file is part of the Mate Library. + * + * The Mate Library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * The Mate Library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with the Mate Library; see the file COPYING.LIB. If not, + * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + * + * Author: Soren Sandmann <[email protected]> + */ +#ifndef MATE_RR_CONFIG_H +#define MATE_RR_CONFIG_H + +#ifndef MATE_DESKTOP_USE_UNSTABLE_API +#error mate-rr-config.h is unstable API. You must define MATE_DESKTOP_USE_UNSTABLE_API before including mate-rr-config.h +#endif + +#include <libmateui/mate-rr.h> +#include <glib.h> + +typedef struct MateOutputInfo MateOutputInfo; +typedef struct MateRRConfig MateRRConfig; + +/* FIXME: + * + * This structure is a Frankenstein monster where all of the fields + * are generated by the system, but some of them can be changed by + * the client. + */ + +struct MateOutputInfo +{ + char * name; + + gboolean on; /* whether there is a CRTC assigned to this output (i.e. a signal is being sent to it) */ + int width; + int height; + int rate; + int x; + int y; + MateRRRotation rotation; + + gboolean connected; /* whether the output is physically connected to a monitor */ + char vendor[4]; + guint product; + guint serial; + double aspect; + int pref_width; + int pref_height; + char * display_name; + gboolean primary; + + gpointer user_data; +}; + +struct MateRRConfig +{ + /* "clone" means that at least two outputs are at (0, 0) offset and they + * have the same width/height. Those outputs are of course connected and on + * (i.e. they have a CRTC assigned). + */ + gboolean clone; + + MateOutputInfo ** outputs; +}; + +MateRRConfig *mate_rr_config_new_current (MateRRScreen *screen); +MateRRConfig *mate_rr_config_new_stored (MateRRScreen *screen, + GError **error); +void mate_rr_config_free (MateRRConfig *configuration); +gboolean mate_rr_config_match (MateRRConfig *config1, + MateRRConfig *config2); +gboolean mate_rr_config_equal (MateRRConfig *config1, + MateRRConfig *config2); +gboolean mate_rr_config_save (MateRRConfig *configuration, + GError **error); +void mate_rr_config_sanitize (MateRRConfig *configuration); + +#ifndef MATE_DISABLE_DEPRECATED +gboolean mate_rr_config_apply (MateRRConfig *configuration, + MateRRScreen *screen, + GError **error); +#endif + +gboolean mate_rr_config_apply_with_time (MateRRConfig *configuration, + MateRRScreen *screen, + guint32 timestamp, + GError **error); + +#ifndef MATE_DISABLE_DEPRECATED +gboolean mate_rr_config_apply_stored (MateRRScreen *screen, + GError **error); +#endif + +#ifndef MATE_DISABLE_DEPRECATED +gboolean mate_rr_config_apply_from_filename (MateRRScreen *screen, + const char *filename, + GError **error); +#endif + +gboolean mate_rr_config_apply_from_filename_with_time (MateRRScreen *screen, + const char *filename, + guint32 timestamp, + GError **error); + +gboolean mate_rr_config_applicable (MateRRConfig *configuration, + MateRRScreen *screen, + GError **error); + +char *mate_rr_config_get_backup_filename (void); +char *mate_rr_config_get_intended_filename (void); + +/* A utility function that isn't really in the spirit of this file, but I don't + * don't know a better place for it. + */ +MateRRMode **mate_rr_create_clone_modes (MateRRScreen *screen); + +#endif diff --git a/libmate-desktop/libmateui/mate-rr-labeler.h b/libmate-desktop/libmateui/mate-rr-labeler.h new file mode 100644 index 0000000..0bcbe71 --- /dev/null +++ b/libmate-desktop/libmateui/mate-rr-labeler.h @@ -0,0 +1,53 @@ +/* mate-rr-labeler.h - Utility to label monitors to identify them + * while they are being configured. + * + * Copyright 2008, Novell, Inc. + * + * This file is part of the Mate Library. + * + * The Mate Library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * The Mate Library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with the Mate Library; see the file COPYING.LIB. If not, + * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + * + * Author: Federico Mena-Quintero <[email protected]> + */ + +#ifndef MATE_RR_LABELER_H +#define MATE_RR_LABELER_H + +#ifndef MATE_DESKTOP_USE_UNSTABLE_API +#error MateRR is unstable API. You must define MATE_DESKTOP_USE_UNSTABLE_API before including materr.h +#endif + +#include <libmateui/mate-rr-config.h> + +#define MATE_TYPE_RR_LABELER (mate_rr_labeler_get_type ()) +#define MATE_RR_LABELER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MATE_TYPE_RR_LABELER, MateRRLabeler)) +#define MATE_RR_LABELER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MATE_TYPE_RR_LABELER, MateRRLabelerClass)) +#define MATE_IS_RR_LABELER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MATE_TYPE_RR_LABELER)) +#define MATE_IS_RR_LABELER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MATE_TYPE_RR_LABELER)) +#define MATE_RR_LABELER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MATE_TYPE_RR_LABELER, MateRRLabelerClass)) + +typedef struct _MateRRLabeler MateRRLabeler; +typedef struct _MateRRLabelerClass MateRRLabelerClass; + +GType mate_rr_labeler_get_type (void); + +MateRRLabeler *mate_rr_labeler_new (MateRRConfig *config); + +void mate_rr_labeler_hide (MateRRLabeler *labeler); + +void mate_rr_labeler_get_color_for_output (MateRRLabeler *labeler, MateOutputInfo *output, GdkColor *color_out); + +#endif diff --git a/libmate-desktop/libmateui/mate-rr.h b/libmate-desktop/libmateui/mate-rr.h new file mode 100644 index 0000000..ab780e0 --- /dev/null +++ b/libmate-desktop/libmateui/mate-rr.h @@ -0,0 +1,177 @@ +/* randrwrap.h + * + * Copyright 2007, 2008, Red Hat, Inc. + * + * This file is part of the Mate Library. + * + * The Mate Library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * The Mate Library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with the Mate Library; see the file COPYING.LIB. If not, + * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + * + * Author: Soren Sandmann <[email protected]> + */ +#ifndef RANDR_WRAP_H +#define RANDR_WRAP_H + +#ifndef MATE_DESKTOP_USE_UNSTABLE_API +#error MateRR is unstable API. You must define MATE_DESKTOP_USE_UNSTABLE_API before including materr.h +#endif + +#include <glib.h> +#include <gdk/gdk.h> + +typedef struct MateRRScreen MateRRScreen; +typedef struct MateRROutput MateRROutput; +typedef struct MateRRCrtc MateRRCrtc; +typedef struct MateRRMode MateRRMode; + +typedef void (* MateRRScreenChanged) (MateRRScreen *screen, gpointer data); + +typedef enum +{ + MATE_RR_ROTATION_0 = (1 << 0), + MATE_RR_ROTATION_90 = (1 << 1), + MATE_RR_ROTATION_180 = (1 << 2), + MATE_RR_ROTATION_270 = (1 << 3), + MATE_RR_REFLECT_X = (1 << 4), + MATE_RR_REFLECT_Y = (1 << 5) +} MateRRRotation; + +/* Error codes */ + +#define MATE_RR_ERROR (mate_rr_error_quark ()) + +GQuark mate_rr_error_quark (void); + +typedef enum { + MATE_RR_ERROR_UNKNOWN, /* generic "fail" */ + MATE_RR_ERROR_NO_RANDR_EXTENSION, /* RANDR extension is not present */ + MATE_RR_ERROR_RANDR_ERROR, /* generic/undescribed error from the underlying XRR API */ + MATE_RR_ERROR_BOUNDS_ERROR, /* requested bounds of a CRTC are outside the maximum size */ + MATE_RR_ERROR_CRTC_ASSIGNMENT, /* could not assign CRTCs to outputs */ + MATE_RR_ERROR_NO_MATCHING_CONFIG, /* none of the saved configurations matched the current configuration */ +} MateRRError; + +#define MATE_RR_CONNECTOR_TYPE_PANEL "Panel" /* This is a laptop's built-in LCD */ + +/* MateRRScreen */ +MateRRScreen * mate_rr_screen_new (GdkScreen *screen, + MateRRScreenChanged callback, + gpointer data, + GError **error); +void mate_rr_screen_destroy (MateRRScreen *screen); +MateRROutput **mate_rr_screen_list_outputs (MateRRScreen *screen); +MateRRCrtc ** mate_rr_screen_list_crtcs (MateRRScreen *screen); +MateRRMode ** mate_rr_screen_list_modes (MateRRScreen *screen); +MateRRMode ** mate_rr_screen_list_clone_modes (MateRRScreen *screen); +void mate_rr_screen_set_size (MateRRScreen *screen, + int width, + int height, + int mm_width, + int mm_height); +MateRRCrtc * mate_rr_screen_get_crtc_by_id (MateRRScreen *screen, + guint32 id); +gboolean mate_rr_screen_refresh (MateRRScreen *screen, + GError **error); +MateRROutput * mate_rr_screen_get_output_by_id (MateRRScreen *screen, + guint32 id); +MateRROutput * mate_rr_screen_get_output_by_name (MateRRScreen *screen, + const char *name); +void mate_rr_screen_get_ranges (MateRRScreen *screen, + int *min_width, + int *max_width, + int *min_height, + int *max_height); +void mate_rr_screen_get_timestamps (MateRRScreen *screen, + guint32 *change_timestamp_ret, + guint32 *config_timestamp_ret); + +void mate_rr_screen_set_primary_output (MateRRScreen *screen, + MateRROutput *output); + +/* MateRROutput */ +guint32 mate_rr_output_get_id (MateRROutput *output); +const char * mate_rr_output_get_name (MateRROutput *output); +gboolean mate_rr_output_is_connected (MateRROutput *output); +int mate_rr_output_get_size_inches (MateRROutput *output); +int mate_rr_output_get_width_mm (MateRROutput *outout); +int mate_rr_output_get_height_mm (MateRROutput *output); +const guint8 * mate_rr_output_get_edid_data (MateRROutput *output); +MateRRCrtc ** mate_rr_output_get_possible_crtcs (MateRROutput *output); +MateRRMode * mate_rr_output_get_current_mode (MateRROutput *output); +MateRRCrtc * mate_rr_output_get_crtc (MateRROutput *output); +const char * mate_rr_output_get_connector_type (MateRROutput *output); +gboolean mate_rr_output_is_laptop (MateRROutput *output); +void mate_rr_output_get_position (MateRROutput *output, + int *x, + int *y); +gboolean mate_rr_output_can_clone (MateRROutput *output, + MateRROutput *clone); +MateRRMode ** mate_rr_output_list_modes (MateRROutput *output); +MateRRMode * mate_rr_output_get_preferred_mode (MateRROutput *output); +gboolean mate_rr_output_supports_mode (MateRROutput *output, + MateRRMode *mode); +gboolean mate_rr_output_get_is_primary (MateRROutput *output); + +/* MateRRMode */ +guint32 mate_rr_mode_get_id (MateRRMode *mode); +guint mate_rr_mode_get_width (MateRRMode *mode); +guint mate_rr_mode_get_height (MateRRMode *mode); +int mate_rr_mode_get_freq (MateRRMode *mode); + +/* MateRRCrtc */ +guint32 mate_rr_crtc_get_id (MateRRCrtc *crtc); + +#ifndef MATE_DISABLE_DEPRECATED +gboolean mate_rr_crtc_set_config (MateRRCrtc *crtc, + int x, + int y, + MateRRMode *mode, + MateRRRotation rotation, + MateRROutput **outputs, + int n_outputs, + GError **error); +#endif + +gboolean mate_rr_crtc_set_config_with_time (MateRRCrtc *crtc, + guint32 timestamp, + int x, + int y, + MateRRMode *mode, + MateRRRotation rotation, + MateRROutput **outputs, + int n_outputs, + GError **error); +gboolean mate_rr_crtc_can_drive_output (MateRRCrtc *crtc, + MateRROutput *output); +MateRRMode * mate_rr_crtc_get_current_mode (MateRRCrtc *crtc); +void mate_rr_crtc_get_position (MateRRCrtc *crtc, + int *x, + int *y); +MateRRRotation mate_rr_crtc_get_current_rotation (MateRRCrtc *crtc); +MateRRRotation mate_rr_crtc_get_rotations (MateRRCrtc *crtc); +gboolean mate_rr_crtc_supports_rotation (MateRRCrtc *crtc, + MateRRRotation rotation); + +gboolean mate_rr_crtc_get_gamma (MateRRCrtc *crtc, + int *size, + unsigned short **red, + unsigned short **green, + unsigned short **blue); +void mate_rr_crtc_set_gamma (MateRRCrtc *crtc, + int size, + unsigned short *red, + unsigned short *green, + unsigned short *blue); +#endif |