diff options
-rw-r--r-- | capplets/display/display-capplet.ui | 489 | ||||
-rw-r--r-- | capplets/display/xrandr-capplet.c | 57 |
2 files changed, 289 insertions, 257 deletions
diff --git a/capplets/display/display-capplet.ui b/capplets/display/display-capplet.ui index 5e0a5d0a8..09672824d 100644 --- a/capplets/display/display-capplet.ui +++ b/capplets/display/display-capplet.ui @@ -4,318 +4,329 @@ <!-- interface-naming-policy toplevel-contextual --> <object class="GtkDialog" id="dialog"> <property name="border_width">5</property> - <property name="title" translatable="yes">Display Preferences</property> + <property name="title" translatable="yes">Monitor Preferences</property> <property name="type_hint">dialog</property> <property name="has_separator">False</property> <child internal-child="vbox"> <object class="GtkVBox" id="dialog-vbox1"> <property name="visible">True</property> + <property name="orientation">vertical</property> <property name="spacing">2</property> <child> - <object class="GtkVBox" id="vbox1"> + <object class="GtkTable" id="table2"> <property name="visible">True</property> - <property name="border_width">5</property> - <property name="spacing">12</property> + <property name="n_rows">2</property> + <property name="n_columns">2</property> + <property name="column_spacing">12</property> + <property name="row_spacing">12</property> <child> - <object class="GtkLabel" id="label6"> - <property name="visible">True</property> - <property name="label" translatable="yes">Drag the monitors to set their place</property> - <attributes> - <attribute name="style" value="italic"/> - </attributes> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkAlignment" id="align"> - <property name="visible">True</property> - <child> - <placeholder/> - </child> - </object> - <packing> - <property name="position">1</property> - </packing> - </child> - <child> - <object class="GtkHBox" id="hbox1"> + <object class="GtkVBox" id="vbox3"> <property name="visible">True</property> + <property name="orientation">vertical</property> + <property name="spacing">12</property> <child> - <object class="GtkCheckButton" id="clone_checkbox"> - <property name="label" translatable="yes">_Mirror screens</property> + <object class="GtkAlignment" id="align"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="use_underline">True</property> - <property name="draw_indicator">True</property> + <child> + <placeholder/> + </child> </object> <packing> - <property name="expand">False</property> - <property name="fill">False</property> <property name="position">0</property> </packing> </child> <child> - <object class="GtkButton" id="detect_displays_button"> - <property name="label" translatable="yes">_Detect Monitors</property> + <object class="GtkHBox" id="hbox1"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="use_underline">True</property> + <property name="spacing">12</property> + <child> + <object class="GtkCheckButton" id="clone_checkbox"> + <property name="label" translatable="yes">Sa_me image in all monitors</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="use_underline">True</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkButton" id="detect_displays_button"> + <property name="label" translatable="yes">_Detect monitors</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="use_underline">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="pack_type">end</property> + <property name="position">1</property> + </packing> + </child> </object> <packing> <property name="expand">False</property> <property name="fill">False</property> - <property name="pack_type">end</property> <property name="position">1</property> </packing> </child> </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">2</property> - </packing> </child> <child> - <object class="GtkEventBox" id="current_monitor_event_box"> + <object class="GtkVBox" id="vbox4"> <property name="visible">True</property> + <property name="orientation">vertical</property> <child> - <object class="GtkLabel" id="current_monitor_label"> + <object class="GtkLabel" id="label8"> <property name="visible">True</property> <property name="xalign">0</property> - <property name="label" translatable="yes">Monitor</property> + <property name="label" translatable="yes">Panel icon</property> <attributes> <attribute name="weight" value="bold"/> </attributes> </object> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">3</property> - </packing> - </child> - <child> - <object class="GtkTable" id="table1"> - <property name="visible">True</property> - <property name="n_rows">3</property> - <property name="n_columns">5</property> - <property name="column_spacing">12</property> - <property name="row_spacing">6</property> - <child> - <object class="GtkCheckButton" id="panel_checkbox"> - <property name="label" translatable="yes">Include _panel</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="use_underline">True</property> - <property name="draw_indicator">True</property> - </object> - <packing> - <property name="left_attach">3</property> - <property name="right_attach">5</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_options">GTK_SHRINK | GTK_FILL</property> - <property name="y_options"></property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label2"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">_Resolution:</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">resolution_combo</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_options">GTK_SHRINK | GTK_FILL</property> - <property name="y_options"></property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label3"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Re_fresh rate:</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">refresh_combo</property> - </object> <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> - <property name="x_options">GTK_SHRINK | GTK_FILL</property> - <property name="y_options"></property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label5"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">R_otation:</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">rotation_combo</property> - </object> - <packing> - <property name="left_attach">3</property> - <property name="right_attach">4</property> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> - <property name="x_options">GTK_SHRINK | GTK_FILL</property> - <property name="y_options"></property> - </packing> - </child> - <child> - <object class="GtkComboBox" id="resolution_combo"> - <property name="visible">True</property> - </object> - <packing> - <property name="left_attach">2</property> - <property name="right_attach">3</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property> - <property name="y_options"></property> - </packing> - </child> - <child> - <object class="GtkComboBox" id="refresh_combo"> - <property name="visible">True</property> - </object> - <packing> - <property name="left_attach">2</property> - <property name="right_attach">3</property> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> - <property name="y_options"></property> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">0</property> </packing> </child> <child> - <object class="GtkComboBox" id="rotation_combo"> + <object class="GtkAlignment" id="alignment2"> <property name="visible">True</property> - <property name="model">liststore1</property> + <property name="left_padding">12</property> <child> - <object class="GtkCellRendererText" id="cellrenderertext1"/> - <attributes> - <attribute name="text">0</attribute> - </attributes> + <object class="GtkCheckButton" id="show_notification_icon"> + <property name="label" translatable="yes">_Show monitors in panel</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="use_underline">True</property> + <property name="draw_indicator">True</property> + </object> </child> </object> <packing> - <property name="left_attach">4</property> - <property name="right_attach">5</property> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> - <property name="y_options"></property> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">1</property> </packing> </child> + </object> + <packing> + <property name="right_attach">2</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> + </packing> + </child> + <child> + <object class="GtkAlignment" id="alignment1"> + <property name="visible">True</property> + <property name="xalign">0</property> + <property name="yalign">0</property> <child> - <object class="GtkAlignment" id="alignment1"> + <object class="GtkTable" id="table1"> <property name="visible">True</property> - <property name="left_padding">12</property> + <property name="n_rows">6</property> + <property name="n_columns">2</property> + <property name="column_spacing">12</property> + <property name="row_spacing">6</property> <child> - <placeholder/> + <object class="GtkLabel" id="label2"> + <property name="visible">True</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">_Resolution:</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">resolution_combo</property> + </object> + <packing> + <property name="top_attach">2</property> + <property name="bottom_attach">3</property> + <property name="x_options">GTK_FILL</property> + <property name="y_options"></property> + </packing> </child> - </object> - <packing> - <property name="bottom_attach">3</property> - <property name="y_options">GTK_FILL</property> - </packing> - </child> - <child> - <object class="GtkHBox" id="hbox2"> - <property name="visible">True</property> - <property name="spacing">12</property> <child> - <object class="GtkRadioButton" id="monitor_on_radio"> - <property name="label" translatable="yes">On</property> + <object class="GtkLabel" id="label3"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">Re_fresh rate:</property> <property name="use_underline">True</property> - <property name="draw_indicator">True</property> + <property name="mnemonic_widget">refresh_combo</property> </object> <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">0</property> + <property name="top_attach">3</property> + <property name="bottom_attach">4</property> + <property name="x_options">GTK_FILL</property> + <property name="y_options"></property> + </packing> + </child> + <child> + <object class="GtkComboBox" id="resolution_combo"> + <property name="visible">True</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">2</property> + <property name="bottom_attach">3</property> + <property name="y_options"></property> + </packing> + </child> + <child> + <object class="GtkComboBox" id="refresh_combo"> + <property name="visible">True</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">3</property> + <property name="bottom_attach">4</property> + <property name="y_options"></property> + </packing> + </child> + <child> + <object class="GtkHBox" id="hbox2"> + <property name="visible">True</property> + <property name="spacing">12</property> + <child> + <object class="GtkRadioButton" id="monitor_on_radio"> + <property name="label" translatable="yes">On</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="use_underline">True</property> + <property name="active">True</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkRadioButton" id="monitor_off_radio"> + <property name="label" translatable="yes">Off</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="use_underline">True</property> + <property name="draw_indicator">True</property> + <property name="group">monitor_on_radio</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="right_attach">2</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> + <property name="y_options"></property> </packing> </child> <child> - <object class="GtkRadioButton" id="monitor_off_radio"> - <property name="label" translatable="yes">Off</property> + <object class="GtkEventBox" id="current_monitor_event_box"> <property name="visible">True</property> + <child> + <object class="GtkLabel" id="current_monitor_label"> + <property name="visible">True</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">Monitor</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> + </child> + </object> + <packing> + <property name="right_attach">2</property> + <property name="y_options"></property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label5"> + <property name="visible">True</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">R_otation:</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">rotation_combo</property> + </object> + <packing> + <property name="top_attach">4</property> + <property name="bottom_attach">5</property> + <property name="x_options">GTK_FILL</property> + <property name="y_options"></property> + </packing> + </child> + <child> + <object class="GtkComboBox" id="rotation_combo"> + <property name="visible">True</property> + <property name="model">liststore1</property> + <child> + <object class="GtkCellRendererText" id="cellrenderertext1"/> + <attributes> + <attribute name="text">0</attribute> + </attributes> + </child> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">4</property> + <property name="bottom_attach">5</property> + <property name="y_options"></property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="panel_checkbox"> + <property name="label" translatable="yes">Include _panel</property> <property name="can_focus">True</property> <property name="receives_default">False</property> <property name="use_underline">True</property> <property name="draw_indicator">True</property> - <property name="group">monitor_on_radio</property> </object> <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">1</property> + <property name="top_attach">5</property> + <property name="bottom_attach">6</property> + <property name="x_options">GTK_FILL</property> + <property name="y_options"></property> + </packing> + </child> + <child> + <object class="GtkAlignment" id="alignment4"> + <property name="visible">True</property> + <child> + <placeholder/> + </child> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">5</property> + <property name="bottom_attach">6</property> + <property name="x_options"></property> + <property name="y_options"></property> </packing> </child> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">5</property> - <property name="x_options">GTK_FILL</property> - <property name="y_options">GTK_FILL</property> - </packing> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="position">4</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label8"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Panel icon</property> - <attributes> - <attribute name="weight" value="bold"/> - </attributes> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">5</property> - </packing> - </child> - <child> - <object class="GtkAlignment" id="alignment2"> - <property name="visible">True</property> - <property name="left_padding">12</property> - <child> - <object class="GtkCheckButton" id="show_notification_icon"> - <property name="label" translatable="yes">_Show displays in panel</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="use_underline">True</property> - <property name="draw_indicator">True</property> </object> </child> </object> <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">6</property> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="x_options"></property> + <property name="y_options">GTK_FILL</property> </packing> </child> </object> diff --git a/capplets/display/xrandr-capplet.c b/capplets/display/xrandr-capplet.c index 4d39b023a..aa5917a4a 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 "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_FLEUR); + 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 the movement cursor 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, @@ -2360,11 +2382,10 @@ 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 */ - 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); |