summaryrefslogtreecommitdiff
path: root/plugins/xrandr
diff options
context:
space:
mode:
authorinfirit <[email protected]>2014-07-09 12:31:43 +0200
committerinfirit <[email protected]>2014-11-30 18:26:14 +0100
commit849d1330149a0429bda6944a2daf0390cfae583e (patch)
treeea574458ea7d711309ae6c5f8e3d017135c18244 /plugins/xrandr
parent2d1ef43c9ba6e41a173dff81485441613cf518b6 (diff)
downloadmate-settings-daemon-849d1330149a0429bda6944a2daf0390cfae583e.tar.bz2
mate-settings-daemon-849d1330149a0429bda6944a2daf0390cfae583e.tar.xz
Adapt to mate-desktop API changes
Based on gnome-settings-daemon commit 8fb7dd9c4dc6da34b4b2961c6212b91d6342152a From: Giovanni Campagna <[email protected]> MateRRScreen, MateRRConfig and MateRROutputInfo have been turned into GObjects. Adapt to that.
Diffstat (limited to 'plugins/xrandr')
-rw-r--r--plugins/xrandr/msd-xrandr-manager.c314
1 files changed, 166 insertions, 148 deletions
diff --git a/plugins/xrandr/msd-xrandr-manager.c b/plugins/xrandr/msd-xrandr-manager.c
index 3629afe..6330d72 100644
--- a/plugins/xrandr/msd-xrandr-manager.c
+++ b/plugins/xrandr/msd-xrandr-manager.c
@@ -135,7 +135,7 @@ static void status_icon_popup_menu (MsdXrandrManager *manager, guint button, gui
static void run_display_capplet (GtkWidget *widget);
static void get_allowed_rotations_for_output (MateRRConfig *config,
MateRRScreen *rr_screen,
- MateOutputInfo *output,
+ MateRROutputInfo *output,
int *out_num_rotations,
MateRRRotation *out_rotations);
@@ -193,27 +193,32 @@ log_msg (const char *format, ...)
}
static void
-log_output (MateOutputInfo *output)
+log_output (MateRROutputInfo *output)
{
- log_msg (" %s: ", output->name ? output->name : "unknown");
+ gchar *name = mate_rr_output_info_get_name (output);
+ gchar *display_name = mate_rr_output_info_get_display_name (output);
- if (output->connected) {
- if (output->on) {
+ log_msg (" %s: ", name ? name : "unknown");
+
+ if (mate_rr_output_info_get_connected (output)) {
+ if (mate_rr_output_info_get_active (output)) {
+ int x, y, width, height;
+ mate_rr_output_info_get_geometry (output, &x, &y, &width, &height);
log_msg ("%dx%d@%d +%d+%d",
- output->width,
- output->height,
- output->rate,
- output->x,
- output->y);
+ width,
+ height,
+ mate_rr_output_info_get_refresh_rate (output),
+ x,
+ y);
} else
log_msg ("off");
} else
log_msg ("disconnected");
- if (output->display_name)
- log_msg (" (%s)", output->display_name);
+ if (display_name)
+ log_msg (" (%s)", display_name);
- if (output->primary)
+ if (mate_rr_output_info_get_primary (output))
log_msg (" (primary output)");
log_msg ("\n");
@@ -223,11 +228,12 @@ static void
log_configuration (MateRRConfig *config)
{
int i;
+ MateRROutputInfo **outputs = mate_rr_config_get_outputs (config);
- log_msg (" cloned: %s\n", config->clone ? "yes" : "no");
+ log_msg (" cloned: %s\n", mate_rr_config_get_clone (config) ? "yes" : "no");
- for (i = 0; config->outputs[i] != NULL; i++)
- log_output (config->outputs[i]);
+ for (i = 0; outputs[i] != NULL; i++)
+ log_output (outputs[i]);
if (i == 0)
log_msg (" no outputs!\n");
@@ -254,7 +260,7 @@ log_screen (MateRRScreen *screen)
if (!log_file)
return;
- config = mate_rr_config_new_current (screen);
+ config = mate_rr_config_new_current (screen, NULL);
mate_rr_screen_get_ranges (screen, &min_w, &max_w, &min_h, &max_h);
mate_rr_screen_get_timestamps (screen, &change_timestamp, &config_timestamp);
@@ -267,7 +273,7 @@ log_screen (MateRRScreen *screen)
config_timestamp);
log_configuration (config);
- mate_rr_config_free (config);
+ g_object_unref (config);
}
static void
@@ -635,11 +641,11 @@ msd_xrandr_manager_2_apply_configuration (MsdXrandrManager *manager,
#include "msd-xrandr-manager-glue.h"
static gboolean
-is_laptop (MateRRScreen *screen, MateOutputInfo *output)
+is_laptop (MateRRScreen *screen, MateRROutputInfo *output)
{
MateRROutput *rr_output;
- rr_output = mate_rr_screen_get_output_by_name (screen, output->name);
+ rr_output = mate_rr_screen_get_output_by_name (screen, mate_rr_output_info_get_name (output));
return mate_rr_output_is_laptop (rr_output);
}
@@ -679,20 +685,25 @@ get_clone_size (MateRRScreen *screen, int *width, int *height)
}
static void
-print_output (MateOutputInfo *info)
+print_output (MateRROutputInfo *info)
{
- g_print (" Output: %s attached to %s\n", info->display_name, info->name);
- g_print (" status: %s\n", info->on ? "on" : "off");
- g_print (" width: %d\n", info->width);
- g_print (" height: %d\n", info->height);
- g_print (" rate: %d\n", info->rate);
- g_print (" position: %d %d\n", info->x, info->y);
+ int x, y, width, height;
+
+ g_print (" Output: %s attached to %s\n", mate_rr_output_info_get_display_name (info), mate_rr_output_info_get_name (info));
+ g_print (" status: %s\n", mate_rr_output_info_get_active (info) ? "on" : "off");
+
+ mate_rr_output_info_get_geometry (info, &x, &y, &width, &height);
+ g_print (" width: %d\n", width);
+ g_print (" height: %d\n", height);
+ g_print (" rate: %d\n", mate_rr_output_info_get_refresh_rate (info));
+ g_print (" position: %d %d\n", x, y);
}
static void
print_configuration (MateRRConfig *config, const char *header)
{
int i;
+ MateRROutputInfo **outputs;
g_print ("=== %s Configuration ===\n", header);
if (!config) {
@@ -700,17 +711,21 @@ print_configuration (MateRRConfig *config, const char *header)
return;
}
- for (i = 0; config->outputs[i] != NULL; ++i)
- print_output (config->outputs[i]);
+ outputs = mate_rr_config_get_outputs (config);
+ for (i = 0; outputs[i] != NULL; ++i)
+ print_output (outputs[i]);
}
static gboolean
config_is_all_off (MateRRConfig *config)
{
int j;
+ MateRROutputInfo **outputs;
+
+ outputs = mate_rr_config_get_outputs (config);
- for (j = 0; config->outputs[j] != NULL; ++j) {
- if (config->outputs[j]->on) {
+ for (j = 0; outputs[j] != NULL; ++j) {
+ if (mate_rr_output_info_get_active (outputs[j])) {
return FALSE;
}
}
@@ -722,21 +737,23 @@ static MateRRConfig *
make_clone_setup (MateRRScreen *screen)
{
MateRRConfig *result;
+ MateRROutputInfo **outputs;
int width, height;
int i;
if (!get_clone_size (screen, &width, &height))
return NULL;
- result = mate_rr_config_new_current (screen);
+ result = mate_rr_config_new_current (screen, NULL);
+ outputs = mate_rr_config_get_outputs (result);
- for (i = 0; result->outputs[i] != NULL; ++i) {
- MateOutputInfo *info = result->outputs[i];
+ for (i = 0; outputs[i] != NULL; ++i) {
+ MateRROutputInfo *info = outputs[i];
- info->on = FALSE;
- if (info->connected) {
+ mate_rr_output_info_set_active (info, FALSE);
+ if (mate_rr_output_info_get_connected (info)) {
MateRROutput *output =
- mate_rr_screen_get_output_by_name (screen, info->name);
+ mate_rr_screen_get_output_by_name (screen, mate_rr_output_info_get_name (info));
MateRRMode **modes = mate_rr_output_list_modes (output);
int j;
int best_rate = 0;
@@ -756,19 +773,16 @@ make_clone_setup (MateRRScreen *screen)
}
if (best_rate > 0) {
- info->on = TRUE;
- info->width = width;
- info->height = height;
- info->rate = best_rate;
- info->rotation = MATE_RR_ROTATION_0;
- info->x = 0;
- info->y = 0;
+ mate_rr_output_info_set_active (info, TRUE);
+ mate_rr_output_info_set_rotation (info, MATE_RR_ROTATION_0);
+ mate_rr_output_info_set_refresh_rate (info, best_rate);
+ mate_rr_output_info_set_geometry (info, 0, 0, width, height);
}
}
}
if (config_is_all_off (result)) {
- mate_rr_config_free (result);
+ g_object_unref (result);
result = NULL;
}
@@ -827,20 +841,17 @@ find_best_mode (MateRROutput *output)
static gboolean
turn_on (MateRRScreen *screen,
- MateOutputInfo *info,
+ MateRROutputInfo *info,
int x, int y)
{
- MateRROutput *output = mate_rr_screen_get_output_by_name (screen, info->name);
+ MateRROutput *output = mate_rr_screen_get_output_by_name (screen, mate_rr_output_info_get_name (info));
MateRRMode *mode = find_best_mode (output);
if (mode) {
- info->on = TRUE;
- info->x = x;
- info->y = y;
- info->width = mate_rr_mode_get_width (mode);
- info->height = mate_rr_mode_get_height (mode);
- info->rotation = MATE_RR_ROTATION_0;
- info->rate = mate_rr_mode_get_freq (mode);
+ mate_rr_output_info_set_active (info, TRUE);
+ mate_rr_output_info_set_geometry (info, x, y, mate_rr_mode_get_width (mode), mate_rr_mode_get_height (mode));
+ mate_rr_output_info_set_rotation (info, MATE_RR_ROTATION_0);
+ mate_rr_output_info_set_refresh_rate (info, mate_rr_mode_get_freq (mode));
return TRUE;
}
@@ -852,26 +863,27 @@ static MateRRConfig *
make_laptop_setup (MateRRScreen *screen)
{
/* Turn on the laptop, disable everything else */
- MateRRConfig *result = mate_rr_config_new_current (screen);
+ MateRRConfig *result = mate_rr_config_new_current (screen, NULL);
+ MateRROutputInfo **outputs = mate_rr_config_get_outputs (result);
int i;
- for (i = 0; result->outputs[i] != NULL; ++i) {
- MateOutputInfo *info = result->outputs[i];
+ for (i = 0; outputs[i] != NULL; ++i) {
+ MateRROutputInfo *info = outputs[i];
if (is_laptop (screen, info)) {
if (!turn_on (screen, info, 0, 0)) {
- mate_rr_config_free (result);
+ g_object_unref (G_OBJECT (result));
result = NULL;
break;
}
}
else {
- info->on = FALSE;
+ mate_rr_output_info_set_active (info, FALSE);
}
}
if (result && config_is_all_off (result)) {
- mate_rr_config_free (result);
+ g_object_unref (G_OBJECT (result));
result = NULL;
}
@@ -885,10 +897,13 @@ make_laptop_setup (MateRRScreen *screen)
}
static int
-turn_on_and_get_rightmost_offset (MateRRScreen *screen, MateOutputInfo *info, int x)
+turn_on_and_get_rightmost_offset (MateRRScreen *screen, MateRROutputInfo *info, int x)
{
- if (turn_on (screen, info, x, 0))
- x += info->width;
+ if (turn_on (screen, info, x, 0)) {
+ int width;
+ mate_rr_output_info_get_geometry (info, NULL, NULL, &width, NULL);
+ x += width;
+ }
return x;
}
@@ -899,27 +914,28 @@ make_xinerama_setup (MateRRScreen *screen)
/* Turn on everything that has a preferred mode, and
* position it from left to right
*/
- MateRRConfig *result = mate_rr_config_new_current (screen);
+ MateRRConfig *result = mate_rr_config_new_current (screen, NULL);
+ MateRROutputInfo **outputs = mate_rr_config_get_outputs (result);
int i;
int x;
x = 0;
- for (i = 0; result->outputs[i] != NULL; ++i) {
- MateOutputInfo *info = result->outputs[i];
+ for (i = 0; outputs[i] != NULL; ++i) {
+ MateRROutputInfo *info = outputs[i];
if (is_laptop (screen, info))
x = turn_on_and_get_rightmost_offset (screen, info, x);
}
- for (i = 0; result->outputs[i] != NULL; ++i) {
- MateOutputInfo *info = result->outputs[i];
+ for (i = 0; outputs[i] != NULL; ++i) {
+ MateRROutputInfo *info = outputs[i];
- if (info->connected && !is_laptop (screen, info))
+ if (mate_rr_output_info_get_connected (info) && !is_laptop (screen, info))
x = turn_on_and_get_rightmost_offset (screen, info, x);
}
if (config_is_all_off (result)) {
- mate_rr_config_free (result);
+ g_object_unref (G_OBJECT (result));
result = NULL;
}
@@ -935,23 +951,24 @@ make_other_setup (MateRRScreen *screen)
* from (0, 0)
*/
- MateRRConfig *result = mate_rr_config_new_current (screen);
+ MateRRConfig *result = mate_rr_config_new_current (screen, NULL);
+ MateRROutputInfo **outputs = mate_rr_config_get_outputs (result);
int i;
- for (i = 0; result->outputs[i] != NULL; ++i) {
- MateOutputInfo *info = result->outputs[i];
+ for (i = 0; outputs[i] != NULL; ++i) {
+ MateRROutputInfo *info = outputs[i];
if (is_laptop (screen, info)) {
- info->on = FALSE;
+ mate_rr_output_info_set_active (info, FALSE);
}
else {
- if (info->connected)
+ if (mate_rr_output_info_get_connected (info))
turn_on (screen, info, 0, 0);
}
}
if (config_is_all_off (result)) {
- mate_rr_config_free (result);
+ g_object_unref (G_OBJECT (result));
result = NULL;
}
@@ -987,7 +1004,7 @@ sanitize (MsdXrandrManager *manager, GPtrArray *array)
if (this && other && mate_rr_config_equal (this, other)) {
g_debug ("removing duplicate configuration");
- mate_rr_config_free (this);
+ g_object_unref (this);
array->pdata[j] = NULL;
break;
}
@@ -999,7 +1016,7 @@ sanitize (MsdXrandrManager *manager, GPtrArray *array)
if (config && config_is_all_off (config)) {
g_debug ("removing configuration as all outputs are off");
- mate_rr_config_free (array->pdata[i]);
+ g_object_unref (array->pdata[i]);
array->pdata[i] = NULL;
}
}
@@ -1019,7 +1036,7 @@ sanitize (MsdXrandrManager *manager, GPtrArray *array)
g_debug ("removing configuration which is not applicable because %s", error->message);
g_error_free (error);
- mate_rr_config_free (config);
+ g_object_unref (config);
array->pdata[i] = NULL;
}
}
@@ -1060,14 +1077,14 @@ generate_fn_f7_configs (MsdXrandrManager *mgr)
int i;
for (i = 0; mgr->priv->fn_f7_configs[i] != NULL; ++i)
- mate_rr_config_free (mgr->priv->fn_f7_configs[i]);
+ g_object_unref (mgr->priv->fn_f7_configs[i]);
g_free (mgr->priv->fn_f7_configs);
mgr->priv->fn_f7_configs = NULL;
mgr->priv->current_fn_f7_config = -1;
}
- g_ptr_array_add (array, mate_rr_config_new_current (screen));
+ g_ptr_array_add (array, mate_rr_config_new_current (screen, NULL));
g_ptr_array_add (array, make_clone_setup (screen));
g_ptr_array_add (array, make_xinerama_setup (screen));
g_ptr_array_add (array, make_laptop_setup (screen));
@@ -1156,7 +1173,7 @@ handle_fn_f7 (MsdXrandrManager *mgr, guint32 timestamp)
log_configurations (priv->fn_f7_configs);
}
- current = mate_rr_config_new_current (screen);
+ current = mate_rr_config_new_current (screen, NULL);
if (priv->fn_f7_configs &&
(!mate_rr_config_match (current, priv->fn_f7_configs[0]) ||
@@ -1169,7 +1186,7 @@ handle_fn_f7 (MsdXrandrManager *mgr, guint32 timestamp)
log_configurations (priv->fn_f7_configs);
}
- mate_rr_config_free (current);
+ g_object_unref (current);
if (priv->fn_f7_configs) {
guint32 server_timestamp;
@@ -1218,17 +1235,15 @@ handle_fn_f7 (MsdXrandrManager *mgr, guint32 timestamp)
g_debug ("done handling fn-f7");
}
-static MateOutputInfo *
+static MateRROutputInfo *
get_laptop_output_info (MateRRScreen *screen, MateRRConfig *config)
{
int i;
+ MateRROutputInfo **outputs = mate_rr_config_get_outputs (config);
- for (i = 0; config->outputs[i] != NULL; i++) {
- MateOutputInfo *info;
-
- info = config->outputs[i];
- if (is_laptop (screen, info))
- return info;
+ for (i = 0; outputs[i] != NULL; i++) {
+ if (is_laptop (screen, outputs[i]))
+ return outputs[i];
}
return NULL;
@@ -1288,7 +1303,7 @@ handle_rotate_windows (MsdXrandrManager *mgr, guint32 timestamp)
MsdXrandrManagerPrivate *priv = mgr->priv;
MateRRScreen *screen = priv->rw_screen;
MateRRConfig *current;
- MateOutputInfo *rotatable_output_info;
+ MateRROutputInfo *rotatable_output_info;
int num_allowed_rotations;
MateRRRotation allowed_rotations;
MateRRRotation next_rotation;
@@ -1297,7 +1312,7 @@ handle_rotate_windows (MsdXrandrManager *mgr, guint32 timestamp)
/* Which output? */
- current = mate_rr_config_new_current (screen);
+ current = mate_rr_config_new_current (screen, NULL);
rotatable_output_info = get_laptop_output_info (screen, current);
if (rotatable_output_info == NULL) {
@@ -1308,21 +1323,21 @@ handle_rotate_windows (MsdXrandrManager *mgr, guint32 timestamp)
/* Which rotation? */
get_allowed_rotations_for_output (current, priv->rw_screen, rotatable_output_info, &num_allowed_rotations, &allowed_rotations);
- next_rotation = get_next_rotation (allowed_rotations, rotatable_output_info->rotation);
+ next_rotation = get_next_rotation (allowed_rotations, mate_rr_output_info_get_rotation (rotatable_output_info));
- if (next_rotation == rotatable_output_info->rotation) {
+ if (next_rotation == mate_rr_output_info_get_rotation (rotatable_output_info)) {
g_debug ("No rotations are supported other than the current one; XF86RotateWindows key will do nothing");
goto out;
}
/* Rotate */
- rotatable_output_info->rotation = next_rotation;
+ mate_rr_output_info_set_rotation (rotatable_output_info, next_rotation);
apply_configuration_and_display_error (mgr, current, timestamp);
out:
- mate_rr_config_free (current);
+ g_object_unref (current);
}
static GdkFilterReturn
@@ -1368,6 +1383,7 @@ auto_configure_outputs (MsdXrandrManager *manager, guint32 timestamp)
{
MsdXrandrManagerPrivate *priv = manager->priv;
MateRRConfig *config;
+ MateRROutputInfo **outputs;
int i;
GList *just_turned_on;
GList *l;
@@ -1375,7 +1391,7 @@ auto_configure_outputs (MsdXrandrManager *manager, guint32 timestamp)
GError *error;
gboolean applicable;
- config = mate_rr_config_new_current (priv->rw_screen);
+ config = mate_rr_config_new_current (priv->rw_screen, NULL);
/* For outputs that are connected and on (i.e. they have a CRTC assigned
* to them, so they are getting a signal), we leave them as they are
@@ -1390,16 +1406,17 @@ auto_configure_outputs (MsdXrandrManager *manager, guint32 timestamp)
*/
just_turned_on = NULL;
+ outputs = mate_rr_config_get_outputs (config);
- for (i = 0; config->outputs[i] != NULL; i++) {
- MateOutputInfo *output = config->outputs[i];
+ for (i = 0; outputs[i] != NULL; i++) {
+ MateRROutputInfo *output = outputs[i];
- if (output->connected && !output->on) {
- output->on = TRUE;
- output->rotation = MATE_RR_ROTATION_0;
+ if (mate_rr_output_info_get_connected (output) && !mate_rr_output_info_get_active (output)) {
+ mate_rr_output_info_set_active (output, TRUE);
+ mate_rr_output_info_set_rotation (output, MATE_RR_ROTATION_0);
just_turned_on = g_list_prepend (just_turned_on, GINT_TO_POINTER (i));
- } else if (!output->connected && output->on)
- output->on = FALSE;
+ } else if (!mate_rr_output_info_get_connected (output) && mate_rr_output_info_get_active (output))
+ mate_rr_output_info_set_active (output, FALSE);
}
/* Now, lay out the outputs from left to right. Put first the outputs
@@ -1410,40 +1427,39 @@ auto_configure_outputs (MsdXrandrManager *manager, guint32 timestamp)
/* First, outputs that remained on */
- for (i = 0; config->outputs[i] != NULL; i++) {
- MateOutputInfo *output = config->outputs[i];
+ for (i = 0; outputs[i] != NULL; i++) {
+ MateRROutputInfo *output = outputs[i];
if (g_list_find (just_turned_on, GINT_TO_POINTER (i)))
continue;
- if (output->on) {
- g_assert (output->connected);
+ if (mate_rr_output_info_get_active (output)) {
+ int width, height;
+ g_assert (mate_rr_output_info_get_connected (output));
- output->x = x;
- output->y = 0;
+ mate_rr_output_info_get_geometry (output, NULL, NULL, &width, &height);
+ mate_rr_output_info_set_geometry (output, x, 0, width, height);
- x += output->width;
+ x += width;
}
}
/* Second, outputs that were newly-turned on */
for (l = just_turned_on; l; l = l->next) {
- MateOutputInfo *output;
+ MateRROutputInfo *output;
+ int width;
i = GPOINTER_TO_INT (l->data);
- output = config->outputs[i];
-
- g_assert (output->on && output->connected);
+ output = outputs[i];
- output->x = x;
- output->y = 0;
+ g_assert (mate_rr_output_info_get_active (output) && mate_rr_output_info_get_connected (output));
/* since the output was off, use its preferred width/height (it doesn't have a real width/height yet) */
- output->width = output->pref_width;
- output->height = output->pref_height;
+ width = mate_rr_output_info_get_preferred_width (output);
+ mate_rr_output_info_set_geometry (output, x, 0, width, mate_rr_output_info_get_preferred_height (output));
- x += output->width;
+ x += width;
}
/* Check if we have a large enough framebuffer size. If not, turn off
@@ -1454,7 +1470,7 @@ auto_configure_outputs (MsdXrandrManager *manager, guint32 timestamp)
l = just_turned_on;
while (1) {
- MateOutputInfo *output;
+ MateRROutputInfo *output;
gboolean is_bounds_error;
error = NULL;
@@ -1473,8 +1489,8 @@ auto_configure_outputs (MsdXrandrManager *manager, guint32 timestamp)
i = GPOINTER_TO_INT (l->data);
l = l->next;
- output = config->outputs[i];
- output->on = FALSE;
+ output = outputs[i];
+ mate_rr_output_info_set_active (output, FALSE);
} else
break;
}
@@ -1485,7 +1501,7 @@ auto_configure_outputs (MsdXrandrManager *manager, guint32 timestamp)
apply_configuration_and_display_error (manager, config, timestamp);
g_list_free (just_turned_on);
- mate_rr_config_free (config);
+ g_object_unref (config);
/* Finally, even though we did a best-effort job in sanitizing the
* outputs, we don't know the physical layout of the monitors. We'll
@@ -1658,7 +1674,7 @@ status_icon_popup_menu_selection_done_cb (GtkMenuShell *menu_shell, gpointer dat
g_object_unref (priv->labeler);
priv->labeler = NULL;
- mate_rr_config_free (priv->configuration);
+ g_object_unref (priv->configuration);
priv->configuration = NULL;
}
@@ -1680,7 +1696,7 @@ output_title_label_expose_event_cb (GtkWidget *widget, GdkEventExpose *event, gp
{
MsdXrandrManager *manager = MSD_XRANDR_MANAGER (data);
struct MsdXrandrManagerPrivate *priv = manager->priv;
- MateOutputInfo *output;
+ MateRROutputInfo *output;
GdkColor color;
#if !GTK_CHECK_VERSION (3, 0, 0)
cairo_t *cr;
@@ -1794,7 +1810,7 @@ title_item_size_allocate_cb (GtkWidget *widget, GtkAllocation *allocation, gpoin
}
static GtkWidget *
-make_menu_item_for_output_title (MsdXrandrManager *manager, MateOutputInfo *output)
+make_menu_item_for_output_title (MsdXrandrManager *manager, MateRROutputInfo *output)
{
GtkWidget *item;
GtkWidget *label;
@@ -1806,7 +1822,7 @@ make_menu_item_for_output_title (MsdXrandrManager *manager, MateOutputInfo *outp
g_signal_connect (item, "size-allocate",
G_CALLBACK (title_item_size_allocate_cb), NULL);
- str = g_markup_printf_escaped ("<b>%s</b>", output->display_name);
+ str = g_markup_printf_escaped ("<b>%s</b>", mate_rr_output_info_get_display_name (output));
label = gtk_label_new (NULL);
gtk_label_set_markup (GTK_LABEL (label), str);
g_free (str);
@@ -1852,7 +1868,7 @@ make_menu_item_for_output_title (MsdXrandrManager *manager, MateOutputInfo *outp
static void
get_allowed_rotations_for_output (MateRRConfig *config,
MateRRScreen *rr_screen,
- MateOutputInfo *output,
+ MateRROutputInfo *output,
int *out_num_rotations,
MateRRRotation *out_rotations)
{
@@ -1862,7 +1878,7 @@ get_allowed_rotations_for_output (MateRRConfig *config,
*out_num_rotations = 0;
*out_rotations = 0;
- current_rotation = output->rotation;
+ current_rotation = mate_rr_output_info_get_rotation (output);
/* Yay for brute force */
@@ -1871,7 +1887,7 @@ get_allowed_rotations_for_output (MateRRConfig *config,
rotation_to_test = possible_rotations[i];
- output->rotation = rotation_to_test;
+ mate_rr_output_info_set_rotation (output, rotation_to_test);
if (mate_rr_config_applicable (config, rr_screen, NULL)) { /* NULL-GError */
(*out_num_rotations)++;
@@ -1879,12 +1895,12 @@ get_allowed_rotations_for_output (MateRRConfig *config,
}
}
- output->rotation = current_rotation;
+ mate_rr_output_info_set_rotation (output, current_rotation);
if (*out_num_rotations == 0 || *out_rotations == 0) {
g_warning ("Huh, output %p says it doesn't support any rotations, and yet it has a current rotation?", output);
*out_num_rotations = 1;
- *out_rotations = output->rotation;
+ *out_rotations = mate_rr_output_info_get_rotation (output);
}
}
@@ -1922,15 +1938,15 @@ ensure_current_configuration_is_saved (void)
* that there *will* be a backup file in the end.
*/
- rr_screen = mate_rr_screen_new (gdk_screen_get_default (), NULL, NULL, NULL); /* NULL-GError */
+ rr_screen = mate_rr_screen_new (gdk_screen_get_default (), NULL); /* NULL-GError */
if (!rr_screen)
return;
- rr_config = mate_rr_config_new_current (rr_screen);
+ rr_config = mate_rr_config_new_current (rr_screen, NULL);
mate_rr_config_save (rr_config, NULL); /* NULL-GError */
- mate_rr_config_free (rr_config);
- mate_rr_screen_destroy (rr_screen);
+ g_object_unref (rr_config);
+ g_object_unref (rr_screen);
}
static void
@@ -1938,7 +1954,7 @@ output_rotation_item_activate_cb (GtkCheckMenuItem *item, gpointer data)
{
MsdXrandrManager *manager = MSD_XRANDR_MANAGER (data);
struct MsdXrandrManagerPrivate *priv = manager->priv;
- MateOutputInfo *output;
+ MateRROutputInfo *output;
MateRRRotation rotation;
GError *error;
@@ -1951,7 +1967,7 @@ output_rotation_item_activate_cb (GtkCheckMenuItem *item, gpointer data)
output = g_object_get_data (G_OBJECT (item), "output");
rotation = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (item), "rotation"));
- output->rotation = rotation;
+ mate_rr_output_info_set_rotation (output, rotation);
error = NULL;
if (!mate_rr_config_save (priv->configuration, &error)) {
@@ -1966,7 +1982,7 @@ output_rotation_item_activate_cb (GtkCheckMenuItem *item, gpointer data)
}
static void
-add_items_for_rotations (MsdXrandrManager *manager, MateOutputInfo *output, MateRRRotation allowed_rotations)
+add_items_for_rotations (MsdXrandrManager *manager, MateRROutputInfo *output, MateRRRotation allowed_rotations)
{
typedef struct {
MateRRRotation rotation;
@@ -2017,7 +2033,7 @@ add_items_for_rotations (MsdXrandrManager *manager, MateOutputInfo *output, Mate
group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (item));
- if (rot == output->rotation) {
+ if (rot == mate_rr_output_info_get_rotation (output)) {
active_item = item;
active_item_activate_id = activate_id;
}
@@ -2037,7 +2053,7 @@ add_items_for_rotations (MsdXrandrManager *manager, MateOutputInfo *output, Mate
}
static void
-add_rotation_items_for_output (MsdXrandrManager *manager, MateOutputInfo *output)
+add_rotation_items_for_output (MsdXrandrManager *manager, MateRROutputInfo *output)
{
struct MsdXrandrManagerPrivate *priv = manager->priv;
int num_rotations;
@@ -2052,7 +2068,7 @@ add_rotation_items_for_output (MsdXrandrManager *manager, MateOutputInfo *output
}
static void
-add_menu_items_for_output (MsdXrandrManager *manager, MateOutputInfo *output)
+add_menu_items_for_output (MsdXrandrManager *manager, MateRROutputInfo *output)
{
struct MsdXrandrManagerPrivate *priv = manager->priv;
GtkWidget *item;
@@ -2068,10 +2084,12 @@ add_menu_items_for_outputs (MsdXrandrManager *manager)
{
struct MsdXrandrManagerPrivate *priv = manager->priv;
int i;
+ MateRROutputInfo **outputs;
- for (i = 0; priv->configuration->outputs[i] != NULL; i++) {
- if (priv->configuration->outputs[i]->connected)
- add_menu_items_for_output (manager, priv->configuration->outputs[i]);
+ outputs = mate_rr_config_get_outputs (priv->configuration);
+ for (i = 0; outputs[i] != NULL; i++) {
+ if (mate_rr_output_info_get_connected (outputs[i]))
+ add_menu_items_for_output (manager, outputs[i]);
}
}
@@ -2082,7 +2100,7 @@ status_icon_popup_menu (MsdXrandrManager *manager, guint button, guint32 timesta
GtkWidget *item;
g_assert (priv->configuration == NULL);
- priv->configuration = mate_rr_config_new_current (priv->rw_screen);
+ priv->configuration = mate_rr_config_new_current (priv->rw_screen, NULL);
g_assert (priv->labeler == NULL);
priv->labeler = mate_rr_labeler_new (priv->configuration);
@@ -2230,7 +2248,7 @@ apply_default_boot_configuration (MsdXrandrManager *mgr, guint32 timestamp)
if (config) {
apply_configuration_and_display_error (mgr, config, timestamp);
- mate_rr_config_free (config);
+ g_object_unref (config);
}
}