From 1492fe3458e85df2ad9e2c855d8d3f272da24479 Mon Sep 17 00:00:00 2001 From: Federico Mena Quintero Date: Fri, 12 Feb 2010 13:15:57 -0600 Subject: [PATCH 1/7] Relayout the display capplet's window We move the per-monitor's widgets to the right of the FooScrollArea. This makes the dialog fit even in 640x480 displays, and makes it more obvious that the monitor's controls actually refer to the selected monitor. Signed-off-by: Federico Mena Quintero --- capplets/display/display-capplet.ui | 530 +++++++++++++++------------- 1 file changed, 287 insertions(+), 243 deletions(-) diff --git a/capplets/display/display-capplet.ui b/capplets/display/display-capplet.ui index 5e0a5d0a8..1e6a0c154 100644 --- a/capplets/display/display-capplet.ui +++ b/capplets/display/display-capplet.ui @@ -10,236 +10,38 @@ True + vertical 2 - + True - 5 - 12 + 3 + 2 + 12 + 12 - - True - Drag the monitors to set their place - - - - - - False - False - 0 - - - - + True + vertical + 12 - - - - - 1 - - - - - True - - - _Mirror screens + True - True - False - True - True - - - False - False - 0 - - - - - _Detect Monitors - True - True - False - True - - - False - False - end - 1 - - - - - False - False - 2 - - - - - True - - - True - 0 - Monitor - - - - - - - - False - False - 3 - - - - - True - 3 - 5 - 12 - 6 - - - Include _panel - True - False - True - True - - - 3 - 5 - 1 - 2 - GTK_SHRINK | GTK_FILL - - - - - - True - 0 - _Resolution: - True - resolution_combo - - - 1 - 2 - 1 - 2 - GTK_SHRINK | GTK_FILL - - - - - - True - 0 - Re_fresh rate: - True - refresh_combo - - - 1 - 2 - 2 - 3 - GTK_SHRINK | GTK_FILL - - - - - - True - 0 - R_otation: - True - rotation_combo - - - 3 - 4 - 2 - 3 - GTK_SHRINK | GTK_FILL - - - - - - True - - - 2 - 3 - 1 - 2 - GTK_EXPAND | GTK_SHRINK | GTK_FILL - - - - - - True - - - 2 - 3 - 2 - 3 - - - - - - True - liststore1 - - - - 0 - - - - - 4 - 5 - 2 - 3 - - - - - - True - 12 - 3 - GTK_FILL + 0 - + True 12 - - On + + _Mirror screens True True False @@ -253,69 +55,311 @@ - - Off + + _Detect Monitors True True - False + True True - True - monitor_on_radio False False + end 1 - 1 - 5 - GTK_FILL - GTK_FILL + False + False + 1 - False - 4 + 1 + 2 - + True - 0 - Panel icon - - - + vertical + + + True + 0 + Panel icon + + + + + + False + False + 0 + + + + + True + 12 + + + _Show displays in panel + True + True + False + True + True + + + + + False + False + 1 + + - False - False - 5 + 2 + 2 + 3 - + True - 12 + 0 + 0 - - _Show displays in panel + True - True - False - True - True + 6 + 2 + 12 + 6 + + + True + 0 + _Resolution: + True + resolution_combo + + + 2 + 3 + GTK_FILL + + + + + + True + 0 + Re_fresh rate: + True + refresh_combo + + + 3 + 4 + GTK_FILL + + + + + + True + + + 1 + 2 + 2 + 3 + + + + + + True + + + 1 + 2 + 3 + 4 + + + + + + True + 12 + + + On + True + True + False + True + True + True + + + False + False + 0 + + + + + Off + True + True + False + True + True + monitor_on_radio + + + False + False + 1 + + + + + 2 + 1 + 2 + + + + + + True + + + True + 0 + Monitor + + + + + + + + 2 + + + + + + True + 0 + R_otation: + True + rotation_combo + + + 4 + 5 + GTK_FILL + + + + + + True + liststore1 + + + + 0 + + + + + 1 + 2 + 4 + 5 + + + + + + Include _panel + True + False + True + True + + + 5 + 6 + GTK_FILL + + + + + + True + + + + + + 1 + 2 + 5 + 6 + + + + - False - False - 6 + 1 + 2 + 1 + 2 + + GTK_FILL + + + + + True + 0 + Drag the monitors to set their place + + + + + + + + + + + True + + + + + + 1 + 2 + + From d43cb0cd8ccb1705ef29d33e67d930d406a9d818 Mon Sep 17 00:00:00 2001 From: Federico Mena Quintero Date: Fri, 12 Feb 2010 13:28:39 -0600 Subject: [PATCH 2/7] Set the mouse cursor to a hand when an output is draggable This should make it more obvious that outputs are in fact draggable in the FooScrollArea, and it will let us remove the ugly label with instructions for how to drag the monitors. Signed-off-by: Federico Mena Quintero --- capplets/display/xrandr-capplet.c | 50 ++++++++++++++++++++++--------- 1 file changed, 36 insertions(+), 14 deletions(-) diff --git a/capplets/display/xrandr-capplet.c b/capplets/display/xrandr-capplet.c index 4d39b023a..b1d6bea5b 100644 --- a/capplets/display/xrandr-capplet.c +++ b/capplets/display/xrandr-capplet.c @@ -1464,6 +1464,30 @@ compare_snaps (gconstpointer v1, gconstpointer v2) } } +/* Sets a mouse cursor for a widget's window. As a hack, you can pass + * GDK_BLANK_CURSOR to mean "set the cursor to NULL" (i.e. reset the widget's + * window's cursor to its default). + */ +static void +set_cursor (GtkWidget *widget, GdkCursorType type) +{ + GdkCursor *cursor; + GdkWindow *window; + + if (type == GDK_BLANK_CURSOR) + cursor = NULL; + else + cursor = gdk_cursor_new_for_display (gtk_widget_get_display (widget), type); + + window = gtk_widget_get_window (widget); + + if (window) + gdk_window_set_cursor (window, cursor); + + if (cursor) + gdk_cursor_unref (cursor); +} + static void on_output_event (FooScrollArea *area, FooScrollAreaEvent *event, @@ -1472,6 +1496,13 @@ on_output_event (FooScrollArea *area, GnomeOutputInfo *output = data; App *app = g_object_get_data (G_OBJECT (area), "app"); + /* If the mouse is inside the outputs, set the cursor to a hand. See + * on_canvas_event() for where we reset the cursor to the default if it + * exits the outputs' area. + */ + if (!app->current_configuration->clone && get_n_connected (app) > 1) + set_cursor (GTK_WIDGET (area), GDK_HAND1); + if (event->type == FOO_BUTTON_PRESS) { GrabInfo *info; @@ -1570,24 +1601,17 @@ on_output_event (FooScrollArea *area, } } -#if 0 static void on_canvas_event (FooScrollArea *area, FooScrollAreaEvent *event, gpointer data) { - App *app = g_object_get_data (G_OBJECT (area), "app"); - - if (event->type == FOO_BUTTON_PRESS) - { - app->current_output = NULL; - - rebuild_gui (app); - - foo_scroll_area_invalidate (area); - } + /* If the mouse exits the outputs, reset the cursor to the default. See + * on_output_event() for where we set the cursor to a hand if it is over one + * of the outputs. + */ + set_cursor (GTK_WIDGET (area), GDK_BLANK_CURSOR); } -#endif static PangoLayout * get_display_name (App *app, @@ -1631,9 +1655,7 @@ paint_background (FooScrollArea *area, cairo_fill_preserve (cr); -#if 0 foo_scroll_area_add_input_from_fill (area, cr, on_canvas_event, NULL); -#endif cairo_set_source_rgb (cr, widget->style->dark[GTK_STATE_SELECTED].red / 65535.0, From 49e441ce7c976fc1719be987f84c4ff48a964ac0 Mon Sep 17 00:00:00 2001 From: Federico Mena Quintero Date: Fri, 12 Feb 2010 13:29:55 -0600 Subject: [PATCH 3/7] Remove the label with instructions for how to drag the monitors The changing mouse cursor now makes the label superfluous. Hopefully. Signed-off-by: Federico Mena Quintero --- capplets/display/display-capplet.ui | 39 +++-------------------------- 1 file changed, 3 insertions(+), 36 deletions(-) diff --git a/capplets/display/display-capplet.ui b/capplets/display/display-capplet.ui index 1e6a0c154..76b3c45c0 100644 --- a/capplets/display/display-capplet.ui +++ b/capplets/display/display-capplet.ui @@ -15,7 +15,7 @@ True - 3 + 2 2 12 12 @@ -77,10 +77,6 @@ - - 1 - 2 - @@ -125,8 +121,8 @@ 2 - 2 - 3 + 1 + 2 @@ -329,39 +325,10 @@ 1 2 - 1 - 2 GTK_FILL - - - True - 0 - Drag the monitors to set their place - - - - - - - - - - - True - - - - - - 1 - 2 - - - - 1 From b06684e157e1a8da97476c2c1b8c308d503edd4a Mon Sep 17 00:00:00 2001 From: Federico Mena Quintero Date: Fri, 12 Feb 2010 13:55:19 -0600 Subject: [PATCH 4/7] Remove hack to shrink the FooScrollArea if the screen is too small The new window fits in 640x480 without any adjustments to the size of the FooScrollArea, so we don't need to adjust that size anymore. Signed-off-by: Federico Mena Quintero --- capplets/display/xrandr-capplet.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/capplets/display/xrandr-capplet.c b/capplets/display/xrandr-capplet.c index b1d6bea5b..2756e52e0 100644 --- a/capplets/display/xrandr-capplet.c +++ b/capplets/display/xrandr-capplet.c @@ -2383,10 +2383,7 @@ run_application (App *app) g_object_set_data (G_OBJECT (app->area), "app", app); /* FIXME: this should be computed dynamically */ - if (gdk_screen_get_height (gdk_screen_get_default ()) <= 600) - foo_scroll_area_set_min_size (FOO_SCROLL_AREA (app->area), -1, 150); - else - foo_scroll_area_set_min_size (FOO_SCROLL_AREA (app->area), -1, 200); + foo_scroll_area_set_min_size (FOO_SCROLL_AREA (app->area), -1, 200); gtk_widget_show (app->area); g_signal_connect (app->area, "paint", G_CALLBACK (on_area_paint), app); From 188d5bfefb58fe4b084e77848d5fce868c9064c9 Mon Sep 17 00:00:00 2001 From: Federico Mena Quintero Date: Tue, 16 Feb 2010 15:09:06 -0600 Subject: [PATCH 5/7] Use a cross-with-arrows instead of a hand for the cursor Cross-with-arrows means 'you can move me', while hand means 'you can click me' in this day and age. Pointed out by Ka-Hing Cheung Signed-off-by: Federico Mena Quintero --- capplets/display/xrandr-capplet.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/capplets/display/xrandr-capplet.c b/capplets/display/xrandr-capplet.c index 2756e52e0..e478d8222 100644 --- a/capplets/display/xrandr-capplet.c +++ b/capplets/display/xrandr-capplet.c @@ -1496,12 +1496,12 @@ on_output_event (FooScrollArea *area, GnomeOutputInfo *output = data; App *app = g_object_get_data (G_OBJECT (area), "app"); - /* If the mouse is inside the outputs, set the cursor to a hand. See + /* If the mouse is inside the outputs, set the cursor to "you can move me". See * on_canvas_event() for where we reset the cursor to the default if it * exits the outputs' area. */ if (!app->current_configuration->clone && get_n_connected (app) > 1) - set_cursor (GTK_WIDGET (area), GDK_HAND1); + set_cursor (GTK_WIDGET (area), GDK_FLEUR); if (event->type == FOO_BUTTON_PRESS) { @@ -1607,8 +1607,8 @@ on_canvas_event (FooScrollArea *area, gpointer data) { /* If the mouse exits the outputs, reset the cursor to the default. See - * on_output_event() for where we set the cursor to a hand if it is over one - * of the outputs. + * on_output_event() for where we set the cursor to the movement cursor if + * it is over one of the outputs. */ set_cursor (GTK_WIDGET (area), GDK_BLANK_CURSOR); } From bbb7a64c2afd90bffc0ef5f4ee9dfacae360898d Mon Sep 17 00:00:00 2001 From: Federico Mena Quintero Date: Wed, 17 Feb 2010 17:17:17 -0600 Subject: [PATCH 6/7] Add a tooltip about how to select/drag the monitors Now that the label with instructions is gone, let's have a tooltip with better instructions. Signed-off-by: Federico Mena Quintero --- capplets/display/xrandr-capplet.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/capplets/display/xrandr-capplet.c b/capplets/display/xrandr-capplet.c index e478d8222..aa5917a4a 100644 --- a/capplets/display/xrandr-capplet.c +++ b/capplets/display/xrandr-capplet.c @@ -2382,6 +2382,8 @@ run_application (App *app) g_object_set_data (G_OBJECT (app->area), "app", app); + gtk_widget_set_tooltip_text (app->area, _("Select a monitor to change its properties; drag it to rearrange its placement.")); + /* FIXME: this should be computed dynamically */ foo_scroll_area_set_min_size (FOO_SCROLL_AREA (app->area), -1, 200); gtk_widget_show (app->area); From 38bd064505ced868c4c899ffe55e9681e7ea0c8c Mon Sep 17 00:00:00 2001 From: Federico Mena Quintero Date: Wed, 17 Feb 2010 17:30:04 -0600 Subject: [PATCH 7/7] Use just "monitors", not displays/screens/monitors for wording. Also, clarify the label of the "mirror screens" checkbox. Signed-off-by: Federico Mena Quintero --- capplets/display/display-capplet.ui | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/capplets/display/display-capplet.ui b/capplets/display/display-capplet.ui index 76b3c45c0..09672824d 100644 --- a/capplets/display/display-capplet.ui +++ b/capplets/display/display-capplet.ui @@ -4,7 +4,7 @@ 5 - Display Preferences + Monitor Preferences dialog False @@ -41,7 +41,7 @@ 12 - _Mirror screens + Sa_me image in all monitors True True False @@ -56,7 +56,7 @@ - _Detect Monitors + _Detect monitors True True True @@ -103,7 +103,7 @@ 12 - _Show displays in panel + _Show monitors in panel True True False