summaryrefslogtreecommitdiff
path: root/capplets
diff options
context:
space:
mode:
Diffstat (limited to 'capplets')
-rw-r--r--capplets/display/mate-display-properties-install-systemwide.c8
-rw-r--r--capplets/display/scrollarea.c45
-rw-r--r--capplets/display/xrandr-capplet.c473
3 files changed, 267 insertions, 259 deletions
diff --git a/capplets/display/mate-display-properties-install-systemwide.c b/capplets/display/mate-display-properties-install-systemwide.c
index 993791c1..ece7016f 100644
--- a/capplets/display/mate-display-properties-install-systemwide.c
+++ b/capplets/display/mate-display-properties-install-systemwide.c
@@ -75,8 +75,8 @@ static gboolean
copy_file (int source_fd, int dest_fd)
{
char buf[1024];
- int num_read;
- int num_written;
+ ssize_t num_read;
+ ssize_t num_written;
while (TRUE) {
char *p;
@@ -94,7 +94,7 @@ copy_file (int source_fd, int dest_fd)
p = buf;
while (num_read > 0) {
- num_written = write (dest_fd, p, num_read);
+ num_written = write (dest_fd, p, (size_t) num_read);
if (num_written == -1) {
if (errno == EINTR)
continue;
@@ -133,7 +133,7 @@ main (int argc, char **argv)
const char *source_filename;
const char *dest_name;
const char *pkexec_uid_str;
- int pkexec_uid;
+ unsigned int pkexec_uid;
struct stat statbuf;
int err;
int source_fd;
diff --git a/capplets/display/scrollarea.c b/capplets/display/scrollarea.c
index 01961443..5690a475 100644
--- a/capplets/display/scrollarea.c
+++ b/capplets/display/scrollarea.c
@@ -54,14 +54,14 @@ struct InputRegion
struct AutoScrollInfo
{
- int dx;
- int dy;
- int timeout_id;
- int begin_x;
- int begin_y;
- double res_x;
- double res_y;
- GTimer *timer;
+ int dx;
+ int dy;
+ guint timeout_id;
+ int begin_x;
+ int begin_y;
+ double res_x;
+ double res_y;
+ GTimer *timer;
};
struct FooScrollAreaPrivate
@@ -403,7 +403,7 @@ static void
clear_exposed_input_region (FooScrollArea *area,
cairo_region_t *exposed) /* in canvas coordinates */
{
- int i;
+ guint i;
cairo_region_t *viewport;
GdkRectangle allocation;
@@ -788,7 +788,7 @@ process_event (FooScrollArea *scroll_area,
int y)
{
GtkWidget *widget = GTK_WIDGET (scroll_area);
- int i;
+ guint i;
allocation_to_canvas (scroll_area, &x, &y);
@@ -874,7 +874,7 @@ foo_scroll_area_button_press (GtkWidget *widget,
{
FooScrollArea *area = FOO_SCROLL_AREA (widget);
- process_gdk_event (area, event->x, event->y, (GdkEvent *)event);
+ process_gdk_event (area, (int) event->x, (int) event->y, (GdkEvent *)event);
return TRUE;
}
@@ -885,7 +885,7 @@ foo_scroll_area_button_release (GtkWidget *widget,
{
FooScrollArea *area = FOO_SCROLL_AREA (widget);
- process_gdk_event (area, event->x, event->y, (GdkEvent *)event);
+ process_gdk_event (area, (int) event->x, (int) event->y, (GdkEvent *)event);
return FALSE;
}
@@ -896,7 +896,7 @@ foo_scroll_area_motion (GtkWidget *widget,
{
FooScrollArea *area = FOO_SCROLL_AREA (widget);
- process_gdk_event (area, event->x, event->y, (GdkEvent *)event);
+ process_gdk_event (area, (int) event->x, (int) event->y, (GdkEvent *)event);
return TRUE;
}
@@ -1042,21 +1042,22 @@ foo_scrollbar_adjustment_changed (GtkAdjustment *adj,
gint dx = 0;
gint dy = 0;
GdkRectangle old_viewport, new_viewport;
+ gdouble aux;
+ int offset;
get_viewport (scroll_area, &old_viewport);
+ aux = gtk_adjustment_get_value (adj);
+ offset = (int) aux;
if (adj == scroll_area->priv->hadj)
{
- /* FIXME: do we treat the offset as int or double, and,
- * if int, how do we round?
- */
- dx = (int)gtk_adjustment_get_value (adj) - scroll_area->priv->x_offset;
- scroll_area->priv->x_offset = gtk_adjustment_get_value (adj);
+ dx = offset - scroll_area->priv->x_offset;
+ scroll_area->priv->x_offset = offset;
}
else if (adj == scroll_area->priv->vadj)
{
- dy = (int)gtk_adjustment_get_value (adj) - scroll_area->priv->y_offset;
- scroll_area->priv->y_offset = gtk_adjustment_get_value (adj);
+ dy = offset - scroll_area->priv->y_offset;
+ scroll_area->priv->y_offset = offset;
}
else
{
@@ -1375,8 +1376,8 @@ scroll_idle (gpointer data)
info->res_x = elapsed * info->dx / 0.2;
info->res_y = elapsed * info->dy / 0.2;
- new_x = viewport.x + info->res_x;
- new_y = viewport.y + info->res_y;
+ new_x = viewport.x + (int) info->res_x;
+ new_y = viewport.y + (int) info->res_y;
foo_scroll_area_set_viewport_pos (area, new_x, new_y);
diff --git a/capplets/display/xrandr-capplet.c b/capplets/display/xrandr-capplet.c
index 3b0cb3d5..91a87235 100644
--- a/capplets/display/xrandr-capplet.c
+++ b/capplets/display/xrandr-capplet.c
@@ -97,10 +97,7 @@ static void on_rate_changed (GtkComboBox *box, gpointer data);
static gboolean output_overlaps (MateRROutputInfo *output, MateRRConfig *config);
static void select_current_output_from_dialog_position (App *app);
static void monitor_on_off_toggled_cb (GtkToggleButton *toggle, gpointer data);
-static void get_geometry (MateRROutputInfo *output, int *w, int *h);
static void apply_configuration_returned_cb (GObject *source_object, GAsyncResult *res, gpointer data);
-static gboolean get_clone_size (MateRRScreen *screen, int *width, int *height);
-static gboolean output_info_supports_mode (App *app, MateRROutputInfo *info, int width, int height);
static void
error_message (App *app, const char *primary_text, const char *secondary_text)
@@ -227,10 +224,12 @@ foreach (GtkTreeModel *model,
}
static void
-add_key (GtkWidget *widget,
- const char *text,
- int width, int height, int rate,
- MateRRRotation rotation)
+add_key (GtkWidget *widget,
+ const char *text,
+ guint width,
+ guint height,
+ int rate,
+ MateRRRotation rotation)
{
ForeachInfo info;
GtkComboBox *box = GTK_COMBO_BOX (widget);
@@ -244,8 +243,8 @@ add_key (GtkWidget *widget,
if (!info.found)
{
- GtkTreeIter iter;
- gtk_list_store_insert_with_values (store, &iter, -1,
+ GtkTreeIter iter;
+ gtk_list_store_insert_with_values (store, &iter, -1,
0, text,
1, width,
2, height,
@@ -253,7 +252,6 @@ add_key (GtkWidget *widget,
4, width * height,
5, rotation,
-1);
-
}
}
@@ -316,7 +314,7 @@ rebuild_rotation_combo (App *app)
};
const char *selection;
MateRRRotation current;
- int i;
+ unsigned int i;
clear_combo (app->rotation_combo);
@@ -376,26 +374,31 @@ rebuild_rate_combo (App *app)
best = -1;
for (i = 0; modes[i] != NULL; ++i)
{
- MateRRMode *mode = modes[i];
- int width, height, rate;
- int output_width, output_height;
-
- mate_rr_output_info_get_geometry (app->current_output, NULL, NULL, &output_width, &output_height);
-
- width = mate_rr_mode_get_width (mode);
- height = mate_rr_mode_get_height (mode);
- rate = mate_rr_mode_get_freq (mode);
-
- if (width == output_width &&
- height == output_height)
- {
- add_key (app->refresh_combo,
- idle_free (make_rate_string (rate)),
- 0, 0, rate, -1);
+ MateRRMode *mode = modes[i];
+ guint width;
+ guint height;
+ int rate;
+ int output_width;
+ int output_height;
+
+ mate_rr_output_info_get_geometry (app->current_output, NULL, NULL,
+ &output_width,
+ &output_height);
+
+ width = mate_rr_mode_get_width (mode);
+ height = mate_rr_mode_get_height (mode);
+ rate = mate_rr_mode_get_freq (mode);
+
+ if ((width == (guint) output_width) &&
+ (height == (guint) output_height))
+ {
+ add_key (app->refresh_combo,
+ idle_free (make_rate_string (rate)),
+ 0, 0, rate, -1);
- if (rate > best)
- best = rate;
- }
+ if (rate > best)
+ best = rate;
+ }
}
if (!combo_select (app->refresh_combo, idle_free (make_rate_string (mate_rr_output_info_get_refresh_rate (app->current_output)))))
@@ -417,6 +420,74 @@ count_active_outputs (App *app)
return count;
}
+/* FIXME: this function is copied from mate-settings-daemon/plugins/xrandr/gsd-xrandr-manager.c.
+ * Do we need to put this function in mate-desktop for public use?
+ */
+static gboolean
+get_clone_size (MateRRScreen *screen,
+ guint *width,
+ guint *height)
+{
+ MateRRMode **modes = mate_rr_screen_list_clone_modes (screen);
+ guint best_w = 0;
+ guint best_h = 0;
+ guint i;
+
+ for (i = 0; modes[i] != NULL; ++i) {
+ MateRRMode *mode = modes[i];
+ guint w, h;
+
+ w = mate_rr_mode_get_width (mode);
+ h = mate_rr_mode_get_height (mode);
+
+ if (w * h > best_w * best_h) {
+ best_w = w;
+ best_h = h;
+ }
+ }
+
+ if (best_w > 0 && best_h > 0) {
+ if (width)
+ *width = best_w;
+ if (height)
+ *height = best_h;
+
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+static gboolean
+output_info_supports_mode (App *app,
+ MateRROutputInfo *info,
+ guint width,
+ guint height)
+{
+ MateRROutput *output;
+ MateRRMode **modes;
+ guint i;
+
+ if (!mate_rr_output_info_is_connected (info))
+ return FALSE;
+
+ output = mate_rr_screen_get_output_by_name (app->screen, mate_rr_output_info_get_name (info));
+ if (!output)
+ return FALSE;
+
+ modes = mate_rr_output_list_modes (output);
+
+ for (i = 0; modes[i]; i++) {
+ if ((mate_rr_mode_get_width (modes[i]) == width) &&
+ (mate_rr_mode_get_height (modes[i]) == height))
+ {
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
/* Computes whether "Mirror Screens" (clone mode) is supported based on these criteria:
*
* 1. There is an available size for cloning.
@@ -426,7 +497,8 @@ count_active_outputs (App *app)
static gboolean
mirror_screens_is_supported (App *app)
{
- int clone_width, clone_height;
+ guint clone_width;
+ guint clone_height;
gboolean have_clone_size;
gboolean mirror_is_supported;
@@ -435,20 +507,21 @@ mirror_screens_is_supported (App *app)
have_clone_size = get_clone_size (app->screen, &clone_width, &clone_height);
if (have_clone_size) {
- int i;
- int num_outputs_with_clone_size;
+ guint i;
+ guint num_outputs_with_clone_size = 0;
MateRROutputInfo **outputs = mate_rr_config_get_outputs (app->current_configuration);
- num_outputs_with_clone_size = 0;
-
for (i = 0; outputs[i] != NULL; i++)
{
/* We count the connected outputs that support the clone size. It
* doesn't matter if those outputs aren't actually On currently; we
* will turn them on in on_clone_changed().
*/
- if (mate_rr_output_info_is_connected (outputs[i]) && output_info_supports_mode (app, outputs[i], clone_width, clone_height))
+ if (mate_rr_output_info_is_connected (outputs[i]) &&
+ output_info_supports_mode (app, outputs[i], clone_width, clone_height))
+ {
num_outputs_with_clone_size++;
+ }
}
if (num_outputs_with_clone_size >= 2)
@@ -609,38 +682,41 @@ rebuild_on_off_radios (App *app)
}
static char *
-make_resolution_string (int width, int height)
+make_resolution_string (guint width,
+ guint height)
{
- return g_strdup_printf (_("%d x %d"), width, height);
+ return g_strdup_printf (_("%u x %u"), width, height);
}
static void
-find_best_mode (MateRRMode **modes, int *out_width, int *out_height)
+find_best_mode (MateRRMode **modes,
+ guint *out_width,
+ guint *out_height)
{
- int i;
+ guint i;
*out_width = 0;
*out_height = 0;
for (i = 0; modes[i] != NULL; i++)
{
- int w, h;
+ guint w, h;
- w = mate_rr_mode_get_width (modes[i]);
- h = mate_rr_mode_get_height (modes[i]);
+ w = mate_rr_mode_get_width (modes[i]);
+ h = mate_rr_mode_get_height (modes[i]);
- if (w * h > *out_width * *out_height)
- {
- *out_width = w;
- *out_height = h;
- }
+ if ((w * h) > ((*out_width) * (*out_height)))
+ {
+ *out_width = w;
+ *out_height = h;
+ }
}
}
static void
rebuild_resolution_combo (App *app)
{
- int i;
+ guint i;
MateRRMode **modes;
const char *current;
int output_width, output_height;
@@ -664,24 +740,24 @@ rebuild_resolution_combo (App *app)
for (i = 0; modes[i] != NULL; ++i)
{
- int width, height;
+ guint width, height;
- width = mate_rr_mode_get_width (modes[i]);
- height = mate_rr_mode_get_height (modes[i]);
+ width = mate_rr_mode_get_width (modes[i]);
+ height = mate_rr_mode_get_height (modes[i]);
- add_key (app->resolution_combo,
- idle_free (make_resolution_string (width, height)),
- width, height, 0, -1);
+ add_key (app->resolution_combo,
+ idle_free (make_resolution_string (width, height)),
+ width, height, 0, -1);
}
- current = idle_free (make_resolution_string (output_width, output_height));
+ current = idle_free (make_resolution_string ((guint) output_width, (guint) output_height));
if (!combo_select (app->resolution_combo, current))
{
- int best_w, best_h;
+ guint best_w, best_h;
- find_best_mode (modes, &best_w, &best_h);
- combo_select (app->resolution_combo, idle_free (make_resolution_string (best_w, best_h)));
+ find_best_mode (modes, &best_w, &best_h);
+ combo_select (app->resolution_combo, idle_free (make_resolution_string (best_w, best_h)));
}
}
@@ -791,7 +867,9 @@ select_resolution_for_current_output (App *app)
{
MateRRMode **modes;
int width, height;
+ guint best_w, best_h;
int x, y;
+
mate_rr_output_info_get_geometry (app->current_output, &x, &y, NULL, NULL);
width = mate_rr_output_info_get_preferred_width (app->current_output);
@@ -807,9 +885,8 @@ select_resolution_for_current_output (App *app)
if (!modes)
return;
- find_best_mode (modes, &width, &height);
-
- mate_rr_output_info_set_geometry (app->current_output, x, y, width, height);
+ find_best_mode (modes, &best_w, &best_h);
+ mate_rr_output_info_set_geometry (app->current_output, x, y, (int) best_w, (int) best_w);
}
static void
@@ -972,69 +1049,6 @@ lay_out_outputs_horizontally (App *app)
}
-/* FIXME: this function is copied from mate-settings-daemon/plugins/xrandr/gsd-xrandr-manager.c.
- * Do we need to put this function in mate-desktop for public use?
- */
-static gboolean
-get_clone_size (MateRRScreen *screen, int *width, int *height)
-{
- MateRRMode **modes = mate_rr_screen_list_clone_modes (screen);
- int best_w, best_h;
- int i;
-
- best_w = 0;
- best_h = 0;
-
- for (i = 0; modes[i] != NULL; ++i) {
- MateRRMode *mode = modes[i];
- int w, h;
-
- w = mate_rr_mode_get_width (mode);
- h = mate_rr_mode_get_height (mode);
-
- if (w * h > best_w * best_h) {
- best_w = w;
- best_h = h;
- }
- }
-
- if (best_w > 0 && best_h > 0) {
- if (width)
- *width = best_w;
- if (height)
- *height = best_h;
-
- return TRUE;
- }
-
- return FALSE;
-}
-
-static gboolean
-output_info_supports_mode (App *app, MateRROutputInfo *info, int width, int height)
-{
- MateRROutput *output;
- MateRRMode **modes;
- int i;
-
- if (!mate_rr_output_info_is_connected (info))
- return FALSE;
-
- output = mate_rr_screen_get_output_by_name (app->screen, mate_rr_output_info_get_name (info));
- if (!output)
- return FALSE;
-
- modes = mate_rr_output_list_modes (output);
-
- for (i = 0; modes[i]; i++) {
- if (mate_rr_mode_get_width (modes[i]) == width
- && mate_rr_mode_get_height (modes[i]) == height)
- return TRUE;
- }
-
- return FALSE;
-}
-
static void
on_clone_changed (GtkWidget *box, gpointer data)
{
@@ -1042,63 +1056,62 @@ on_clone_changed (GtkWidget *box, gpointer data)
mate_rr_config_set_clone (app->current_configuration, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (app->clone_checkbox)));
- if (mate_rr_config_get_clone (app->current_configuration))
- {
- int i;
- int width, height;
- MateRROutputInfo **outputs = mate_rr_config_get_outputs (app->current_configuration);
+ if (mate_rr_config_get_clone (app->current_configuration)) {
+ guint i;
+ guint width;
+ guint height;
+ MateRROutputInfo **outputs = mate_rr_config_get_outputs (app->current_configuration);
+
+ for (i = 0; outputs[i]; ++i) {
+ if (mate_rr_output_info_is_connected(outputs[i])) {
+ app->current_output = outputs[i];
+ break;
+ }
+ }
- for (i = 0; outputs[i]; ++i)
- {
- if (mate_rr_output_info_is_connected(outputs[i]))
- {
- app->current_output = outputs[i];
- break;
- }
- }
+ /* Turn on all the connected screens that support the best clone mode.
+ * The user may hit "Mirror Screens", but he shouldn't have to turn on
+ * all the required outputs as well.
+ */
- /* Turn on all the connected screens that support the best clone mode.
- * The user may hit "Mirror Screens", but he shouldn't have to turn on
- * all the required outputs as well.
- */
+ get_clone_size (app->screen, &width, &height);
- get_clone_size (app->screen, &width, &height);
+ for (i = 0; outputs[i]; i++) {
+ int x, y;
- for (i = 0; outputs[i]; i++) {
- int x, y;
- if (output_info_supports_mode (app, outputs[i], width, height)) {
- mate_rr_output_info_set_active (outputs[i], TRUE);
- mate_rr_output_info_get_geometry (outputs[i], &x, &y, NULL, NULL);
- mate_rr_output_info_set_geometry (outputs[i], x, y, width, height);
- }
+ if (output_info_supports_mode (app, outputs[i], width, height)) {
+ mate_rr_output_info_set_active (outputs[i], TRUE);
+ mate_rr_output_info_get_geometry (outputs[i], &x, &y, NULL, NULL);
+ mate_rr_output_info_set_geometry (outputs[i], x, y, (int) width, (int) height);
+ }
}
- }
- else
- {
+ } else {
if (output_overlaps (app->current_output, app->current_configuration))
- lay_out_outputs_horizontally (app);
+ lay_out_outputs_horizontally (app);
}
rebuild_gui (app);
}
+#define SPACE 15
+#define MARGIN 15
+
static void
-get_geometry (MateRROutputInfo *output, int *w, int *h)
+get_geometry (MateRROutputInfo *output,
+ int *w,
+ int *h)
{
MateRRRotation rotation;
- if (mate_rr_output_info_is_active (output))
- {
- mate_rr_output_info_get_geometry (output, NULL, NULL, w, h);
- }
- else
- {
- *h = mate_rr_output_info_get_preferred_height (output);
- *w = mate_rr_output_info_get_preferred_width (output);
+ if (mate_rr_output_info_is_active (output)) {
+ mate_rr_output_info_get_geometry (output, NULL, NULL, w, h);
+ } else {
+ *h = mate_rr_output_info_get_preferred_height (output);
+ *w = mate_rr_output_info_get_preferred_width (output);
}
rotation = mate_rr_output_info_get_rotation (output);
- if ((rotation & MATE_RR_ROTATION_90) || (rotation & MATE_RR_ROTATION_270))
- {
+ if ((rotation & MATE_RR_ROTATION_90) ||
+ (rotation & MATE_RR_ROTATION_270)) {
int tmp;
tmp = *h;
*h = *w;
@@ -1106,48 +1119,46 @@ get_geometry (MateRROutputInfo *output, int *w, int *h)
}
}
-#define SPACE 15
-#define MARGIN 15
-
static GList *
-list_connected_outputs (App *app, int *total_w, int *total_h)
+list_connected_outputs (App *app,
+ int *total_w,
+ int *total_h)
{
- int i, dummy;
+ guint i;
+ int dummy;
GList *result = NULL;
MateRROutputInfo **outputs;
if (!total_w)
- total_w = &dummy;
+ total_w = &dummy;
if (!total_h)
- total_h = &dummy;
+ total_h = &dummy;
*total_w = 0;
*total_h = 0;
outputs = mate_rr_config_get_outputs(app->current_configuration);
- for (i = 0; outputs[i] != NULL; ++i)
- {
- if (mate_rr_output_info_is_connected (outputs[i]))
- {
- int w, h;
+ for (i = 0; outputs[i] != NULL; ++i) {
+ if (mate_rr_output_info_is_connected (outputs[i])) {
+ int w, h;
- result = g_list_prepend (result, outputs[i]);
+ result = g_list_prepend (result, outputs[i]);
- get_geometry (outputs[i], &w, &h);
+ get_geometry (outputs[i], &w, &h);
- *total_w += w;
- *total_h += h;
- }
+ *total_w += w;
+ *total_h += h;
+ }
}
return g_list_reverse (result);
}
-static int
+static guint
get_n_connected (App *app)
{
GList *connected_outputs = list_connected_outputs (app, NULL, NULL);
- int n = g_list_length (connected_outputs);
+ guint n = g_list_length (connected_outputs);
g_list_free (connected_outputs);
@@ -1159,7 +1170,7 @@ compute_scale (App *app)
{
int available_w, available_h;
int total_w, total_h;
- int n_monitors;
+ guint n_monitors;
GdkRectangle viewport;
GList *connected_outputs;
@@ -1171,8 +1182,8 @@ compute_scale (App *app)
g_list_free (connected_outputs);
- available_w = viewport.width - 2 * MARGIN - (n_monitors - 1) * SPACE;
- available_h = viewport.height - 2 * MARGIN - (n_monitors - 1) * SPACE;
+ available_w = viewport.width - 2 * MARGIN - ((int) n_monitors - 1) * SPACE;
+ available_h = viewport.height - 2 * MARGIN - ((int) n_monitors - 1) * SPACE;
return MIN ((double)available_w / total_w, (double)available_h / total_h);
}
@@ -1316,24 +1327,21 @@ add_edge_snaps (Edge *snapper, Edge *snappee, GArray *snaps)
static void
list_snaps (MateRROutputInfo *output, GArray *edges, GArray *snaps)
{
- int i;
+ guint i;
- for (i = 0; i < edges->len; ++i)
- {
- Edge *output_edge = &(g_array_index (edges, Edge, i));
+ for (i = 0; i < edges->len; ++i) {
+ Edge *output_edge = &(g_array_index (edges, Edge, i));
- if (output_edge->output == output)
- {
- int j;
+ if (output_edge->output == output) {
+ guint j;
- for (j = 0; j < edges->len; ++j)
- {
- Edge *edge = &(g_array_index (edges, Edge, j));
+ for (j = 0; j < edges->len; ++j) {
+ Edge *edge = &(g_array_index (edges, Edge, j));
- if (edge->output != output)
+ if (edge->output != output)
add_edge_snaps (output_edge, edge, snaps);
- }
- }
+ }
+ }
}
}
@@ -1373,33 +1381,27 @@ static gboolean
output_is_aligned (MateRROutputInfo *output, GArray *edges)
{
gboolean result = FALSE;
- int i;
+ guint i;
- for (i = 0; i < edges->len; ++i)
- {
- Edge *output_edge = &(g_array_index (edges, Edge, i));
+ for (i = 0; i < edges->len; ++i) {
+ Edge *output_edge = &(g_array_index (edges, Edge, i));
- if (output_edge->output == output)
- {
- int j;
+ if (output_edge->output == output) {
+ guint j;
- for (j = 0; j < edges->len; ++j)
- {
- Edge *edge = &(g_array_index (edges, Edge, j));
+ for (j = 0; j < edges->len; ++j) {
+ Edge *edge = &(g_array_index (edges, Edge, j));
- /* We are aligned if an output edge matches
- * an edge of another output
- */
- if (edge->output != output_edge->output)
- {
- if (edges_align (output_edge, edge))
- {
- result = TRUE;
- goto done;
- }
- }
- }
- }
+ /* We are aligned if an output edge matches
+ * an edge of another output
+ */
+ if ((edge->output != output_edge->output) &&
+ edges_align (output_edge, edge)) {
+ result = TRUE;
+ goto done;
+ }
+ }
+ }
}
done:
@@ -1550,9 +1552,9 @@ set_monitors_tooltip (App *app, gboolean is_dragging)
}
static void
-on_output_event (FooScrollArea *area,
- FooScrollAreaEvent *event,
- gpointer data)
+on_output_event (FooScrollArea *area,
+ FooScrollAreaEvent *event,
+ gpointer data)
{
MateRROutputInfo *output = data;
App *app = g_object_get_data (G_OBJECT (area), "app");
@@ -1600,12 +1602,12 @@ on_output_event (FooScrollArea *area,
int old_x, old_y;
int width, height;
int new_x, new_y;
- int i;
+ guint i;
GArray *edges, *snaps, *new_edges;
mate_rr_output_info_get_geometry (output, &old_x, &old_y, &width, &height);
- new_x = info->output_x + (event->x - info->grab_x) / scale;
- new_y = info->output_y + (event->y - info->grab_y) / scale;
+ new_x = info->output_x + (int) ((double)(event->x - info->grab_x) / scale);
+ new_y = info->output_y + (int) ((double)(event->y - info->grab_y) / scale);
mate_rr_output_info_set_geometry (output, new_x, new_y, width, height);
@@ -1746,7 +1748,9 @@ paint_background (FooScrollArea *area,
}
static void
-paint_output (App *app, cairo_t *cr, int i)
+paint_output (App *app,
+ cairo_t *cr,
+ guint i)
{
int w, h;
double scale = compute_scale (app);
@@ -1898,10 +1902,13 @@ on_area_paint (FooScrollArea *area,
for (list = connected_outputs; list != NULL; list = list->next)
{
- paint_output (app, cr, g_list_position (connected_outputs, list));
+ int pos;
+
+ if ((pos = g_list_position (connected_outputs, list)) != -1)
+ paint_output (app, cr, (guint) pos);
- if (mate_rr_config_get_clone (app->current_configuration))
- break;
+ if (mate_rr_config_get_clone (app->current_configuration))
+ break;
}
}