From fd55cee48a6fa2fd5ee312923abe2c2893f519f8 Mon Sep 17 00:00:00 2001 From: infirit Date: Sat, 8 Nov 2014 00:59:16 +0100 Subject: Turn GnomeRRConfig and GnomeOutputInfo into GObjects Based on gnome-desktop commits: 1d1f8ef64f404eccb29d384a75939701327e8e77 2c7a2e90fee98ff61e530098bc962a65dec670bc 7436f759bec00d87f597ef0b6945da8fa8969e85 From: Giovanni Campagna Gnome Bug: https://bugzilla.gnome.org/show_bug.cgi?id=630913 --- libmate-desktop/mate-rr-config.h | 190 +++++++++++++++++++++------------------ 1 file changed, 102 insertions(+), 88 deletions(-) (limited to 'libmate-desktop/mate-rr-config.h') diff --git a/libmate-desktop/mate-rr-config.h b/libmate-desktop/mate-rr-config.h index 2216eda..cd343ab 100644 --- a/libmate-desktop/mate-rr-config.h +++ b/libmate-desktop/mate-rr-config.h @@ -1,6 +1,8 @@ /* mate-rr-config.h + * -*- c-basic-offset: 4 -*- * * Copyright 2007, 2008, Red Hat, Inc. + * Copyright 2010 Giovanni Campagna * * This file is part of the Mate Library. * @@ -30,108 +32,120 @@ #include "mate-rr.h" #include +#include -typedef struct MateOutputInfo MateOutputInfo; -typedef struct MateRRConfig MateRRConfig; +typedef struct MateRROutputInfoPrivate MateRROutputInfoPrivate; +typedef struct MateRRConfigPrivate MateRRConfigPrivate; -/* 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. - */ +typedef struct +{ + GObject parent; -struct MateOutputInfo + /*< private >*/ + MateRROutputInfoPrivate *priv; +} MateRROutputInfo; + +typedef struct { - 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; -}; - -#define MATE_RR_TYPE_OUTPUT_INFO (mate_rr_output_info_get_type()) -#define MATE_RR_TYPE_CONFIG (mate_rr_config_get_type()) + GObjectClass parent_class; +} MateRROutputInfoClass; + +#define MATE_TYPE_RR_OUTPUT_INFO (mate_rr_output_info_get_type()) +#define MATE_RR_OUTPUT_INFO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MATE_TYPE_RR_OUTPUT_INFO, MateRROutputInfo)) +#define MATE_IS_RR_OUTPUT_INFO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MATE_TYPE_RR_OUTPUT_INFO)) +#define MATE_RR_OUTPUT_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MATE_TYPE_RR_OUTPUT_INFO, MateRROutputInfoClass)) +#define MATE_IS_RR_OUTPUT_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MATE_TYPE_RR_OUTPUT_INFO)) +#define MATE_RR_OUTPUT_INFO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MATE_TYPE_RR_OUTPUT_INFO, MateRROutputInfoClass)) + GType mate_rr_output_info_get_type (void); -GType mate_rr_config_get_type (void); -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); -gboolean mate_rr_config_ensure_primary (MateRRConfig *configuration); - -#ifndef MATE_DISABLE_DEPRECATED -gboolean mate_rr_config_apply (MateRRConfig *configuration, - MateRRScreen *screen, - GError **error); -#endif +char *mate_rr_output_info_get_name (MateRROutputInfo *self); -gboolean mate_rr_config_apply_with_time (MateRRConfig *configuration, - MateRRScreen *screen, - guint32 timestamp, - GError **error); +gboolean mate_rr_output_info_get_active (MateRROutputInfo *self); +void mate_rr_output_info_set_active (MateRROutputInfo *self, gboolean active); -#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, +void mate_rr_output_info_get_geometry (MateRROutputInfo *self, int *x, int *y, int *width, int *height); +void mate_rr_output_info_set_geometry (MateRROutputInfo *self, int x, int y, int width, int height); + +int mate_rr_output_info_get_refresh_rate (MateRROutputInfo *self); +void mate_rr_output_info_set_refresh_rate (MateRROutputInfo *self, int rate); + +MateRRRotation mate_rr_output_info_get_rotation (MateRROutputInfo *self); +void mate_rr_output_info_set_rotation (MateRROutputInfo *self, MateRRRotation rotation); + +gboolean mate_rr_output_info_get_connected (MateRROutputInfo *self); +void mate_rr_output_info_get_vendor (MateRROutputInfo *self, gchar* vendor); +guint mate_rr_output_info_get_product (MateRROutputInfo *self); +guint mate_rr_output_info_get_serial (MateRROutputInfo *self); +double mate_rr_output_info_get_aspect_ratio (MateRROutputInfo *self); +char *mate_rr_output_info_get_display_name (MateRROutputInfo *self); + +gboolean mate_rr_output_info_get_primary (MateRROutputInfo *self); +void mate_rr_output_info_set_primary (MateRROutputInfo *self, gboolean primary); + +int mate_rr_output_info_get_preferred_width (MateRROutputInfo *self); +int mate_rr_output_info_get_preferred_height (MateRROutputInfo *self); + +typedef struct +{ + GObject parent; + + /*< private >*/ + MateRRConfigPrivate *priv; +} MateRRConfig; + +typedef struct +{ + GObjectClass parent_class; +} MateRRConfigClass; + +#define MATE_TYPE_RR_CONFIG (mate_rr_config_get_type()) +#define MATE_RR_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MATE_TYPE_RR_CONFIG, MateRRConfig)) +#define MATE_IS_RR_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MATE_TYPE_RR_CONFIG)) +#define MATE_RR_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MATE_TYPE_RR_CONFIG, MateRRConfigClass)) +#define MATE_IS_RR_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MATE_TYPE_RR_CONFIG)) +#define MATE_RR_CONFIG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MATE_TYPE_RR_CONFIG, MateRRConfigClass)) + +GType mate_rr_config_get_type (void); + +MateRRConfig *mate_rr_config_new_current (MateRRScreen *screen, + GError **error); +MateRRConfig *mate_rr_config_new_stored (MateRRScreen *screen, + GError **error); +gboolean mate_rr_config_load_current (MateRRConfig *self, + GError **error); +gboolean mate_rr_config_load_filename (MateRRConfig *self, + const gchar *filename, + GError **error); +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); +gboolean mate_rr_config_ensure_primary (MateRRConfig *configuration); + +gboolean mate_rr_config_apply_with_time (MateRRConfig *configuration, + MateRRScreen *screen, + guint32 timestamp, 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_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); -gboolean mate_rr_config_applicable (MateRRConfig *configuration, - MateRRScreen *screen, - GError **error); +gboolean mate_rr_config_get_clone (MateRRConfig *configuration); +void mate_rr_config_set_clone (MateRRConfig *configuration, gboolean clone); +MateRROutputInfo **mate_rr_config_get_outputs (MateRRConfig *configuration); 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 -- cgit v1.2.1