diff --git a/lib/screenshooter-actions.c b/lib/screenshooter-actions.c index a96dc37..651d240 100644 --- a/lib/screenshooter-actions.c +++ b/lib/screenshooter-actions.c @@ -136,6 +136,7 @@ take_screenshot_idle (ScreenshotData *sd) sd->screenshot = screenshooter_capture_screenshot (sd->region, sd->delay, sd->show_mouse, + sd->show_border, sd->plugin); if (sd->screenshot != NULL) diff --git a/lib/screenshooter-capture.c b/lib/screenshooter-capture.c index 0bc664d..be37bf1 100644 --- a/lib/screenshooter-capture.c +++ b/lib/screenshooter-capture.c @@ -1329,7 +1329,8 @@ static GdkPixbuf * @region: the region to be screenshoted. It can be FULLSCREEN, * ACTIVE_WINDOW or SELECT. * @delay: the delay before the screenshot is captured, in seconds. - * @mouse: whether the mouse pointer should be displayed on the screenshot. + * @show_mouse: whether the mouse pointer should be displayed on the screenshot. + * @show_border: whether the window border should be displayed on the screenshot. * * Captures a screenshot with the given options. If @region is FULLSCREEN, * the screenshot is captured after @delay seconds. If @region is @@ -1340,6 +1341,8 @@ static GdkPixbuf * * @show_mouse is only taken into account when @region is FULLSCREEN * or ACTIVE_WINDOW. + * + * @show_border is only taken into account when @region is ACTIVE_WINDOW. * * Return value: a #GdkPixbuf containing the screenshot or %NULL * (if @region is SELECT, the user can cancel the operation). @@ -1347,6 +1350,7 @@ static GdkPixbuf GdkPixbuf *screenshooter_capture_screenshot (gint region, gint delay, gboolean show_mouse, + gboolean show_border, gboolean plugin) { GdkPixbuf *screenshot = NULL; @@ -1391,7 +1395,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS { TRACE ("Get the screenshot of the given window"); - screenshot = get_window_screenshot (window, show_mouse, border); + screenshot = get_window_screenshot (window, show_mouse, show_border && border); if (needs_unref) g_object_unref (window); diff --git a/lib/screenshooter-capture.h b/lib/screenshooter-capture.h index 2af4a01..13ad1a6 100644 --- a/lib/screenshooter-capture.h +++ b/lib/screenshooter-capture.h @@ -44,6 +44,7 @@ GdkPixbuf *screenshooter_capture_screenshot (gint region, gint delay, gboolean show_mouse, + gboolean show_border, gboolean plugin); #endif diff --git a/lib/screenshooter-dialogs.c b/lib/screenshooter-dialogs.c index b706adf..9b599b6 100644 --- a/lib/screenshooter-dialogs.c +++ b/lib/screenshooter-dialogs.c @@ -118,7 +118,7 @@ static void cb_active_window_toggled (GtkToggleButton *tb, ScreenshotData *sd) -/* Set the captured when the button is toggled */ +/* Set the captured area when the button is toggled */ static void cb_rectangle_toggled (GtkToggleButton *tb, ScreenshotData *sd) { if (gtk_toggle_button_get_active (tb)) @@ -127,6 +127,17 @@ static void cb_rectangle_toggled (GtkToggleButton *tb, ScreenshotData *sd) +/* Set whether the window border should be captured when the button is toggled */ +static void cb_show_border_toggled (GtkToggleButton *tb, ScreenshotData *sd) +{ + if (gtk_toggle_button_get_active (tb)) + sd->show_border = 1; + else + sd->show_border = 0; +} + + + /* Set whether the mouse should be captured when the button is toggled */ static void cb_show_mouse_toggled (GtkToggleButton *tb, ScreenshotData *sd) { @@ -649,7 +660,7 @@ GtkWidget *screenshooter_region_dialog_new (ScreenshotData *sd, gboolean plugin) *fullscreen_button, *rectangle_button; - GtkWidget *show_mouse_checkbox; + GtkWidget *show_mouse_checkbox, *show_border_checkbox; GtkWidget *delay_main_box, *delay_box, *delay_label, *delay_alignment; GtkWidget *delay_spinner_box, *delay_spinner, *seconds_label; @@ -808,12 +819,30 @@ GtkWidget *screenshooter_region_dialog_new (ScreenshotData *sd, gboolean plugin) _("Display the mouse pointer on the screenshot")); gtk_box_pack_start (GTK_BOX (area_box), show_mouse_checkbox, FALSE, - FALSE, 5); + FALSE, 0); g_signal_connect (G_OBJECT (show_mouse_checkbox), "toggled", G_CALLBACK (cb_show_mouse_toggled), sd); g_signal_connect (G_OBJECT (rectangle_button), "toggled", G_CALLBACK (cb_toggle_set_insensi), show_mouse_checkbox); + /* Create show border checkbox */ + show_border_checkbox = + gtk_check_button_new_with_label (_("Capture the window border")); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (show_border_checkbox), + (sd->show_border == 1)); + gtk_widget_set_sensitive (show_border_checkbox, (sd->region == ACTIVE_WINDOW)); + gtk_widget_set_tooltip_text (show_border_checkbox, + _("Display the mouse pointer on the screenshot")); + gtk_box_pack_start (GTK_BOX (area_box), + show_border_checkbox, FALSE, + FALSE, 0); + g_signal_connect (G_OBJECT (show_border_checkbox), "toggled", + G_CALLBACK (cb_show_border_toggled), sd); + g_signal_connect (G_OBJECT (fullscreen_button), "toggled", + G_CALLBACK (cb_toggle_set_insensi), show_border_checkbox); + g_signal_connect (G_OBJECT (rectangle_button), "toggled", + G_CALLBACK (cb_toggle_set_insensi), show_border_checkbox); + /* Create the main box for the delay stuff */ delay_main_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); gtk_grid_attach (GTK_GRID (layout_grid), delay_main_box, 1, 0, 1, 1); diff --git a/lib/screenshooter-global.h b/lib/screenshooter-global.h index 6280298..9e3a92b 100644 --- a/lib/screenshooter-global.h +++ b/lib/screenshooter-global.h @@ -44,6 +44,7 @@ typedef struct gint region; gint show_save_dialog; gint show_mouse; + gint show_border; gint delay; gint action; gboolean plugin; diff --git a/lib/screenshooter-utils.c b/lib/screenshooter-utils.c index 8e3cfa5..f81b653 100644 --- a/lib/screenshooter-utils.c +++ b/lib/screenshooter-utils.c @@ -119,6 +119,7 @@ screenshooter_read_rc_file (const gchar *file, ScreenshotData *sd) gint region = FULLSCREEN; gint action = SAVE; gint show_mouse = 1; + gint show_border = 1; gboolean timestamp = TRUE; gchar *screenshot_dir = g_strdup (default_uri); gchar *title = g_strdup (_("Screenshot")); @@ -139,6 +140,7 @@ screenshooter_read_rc_file (const gchar *file, ScreenshotData *sd) region = xfce_rc_read_int_entry (rc, "region", FULLSCREEN); action = xfce_rc_read_int_entry (rc, "action", SAVE); show_mouse = xfce_rc_read_int_entry (rc, "show_mouse", 1); + show_border = xfce_rc_read_int_entry (rc, "show_border", 1); timestamp = xfce_rc_read_bool_entry (rc, "timestamp", TRUE); g_free (app); @@ -168,6 +170,7 @@ screenshooter_read_rc_file (const gchar *file, ScreenshotData *sd) sd->region = region; sd->action = action; sd->show_mouse = show_mouse; + sd->show_border = show_border; sd->timestamp = timestamp; sd->screenshot_dir = screenshot_dir; sd->title = title; diff --git a/src/main.c b/src/main.c index a07f4b8..8209d5f 100644 --- a/src/main.c +++ b/src/main.c @@ -33,6 +33,7 @@ gboolean window = FALSE; gboolean region = FALSE; gboolean fullscreen = FALSE; gboolean mouse = FALSE; +gboolean no_border = FALSE; gboolean clipboard = FALSE; gboolean upload_imgur = FALSE; gchar *screenshot_dir = NULL; @@ -64,6 +65,11 @@ static GOptionEntry entries[] = N_("Display the mouse on the screenshot"), NULL }, + { + "no-border", 0, G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, &no_border, + N_("Hides the window border on the screenshot"), + NULL + }, { "open", 'o', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_STRING, &application, N_("Application to open the screenshot"), @@ -270,6 +276,9 @@ int main (int argc, char **argv) /* Whether to display the mouse pointer on the screenshot */ mouse ? (sd->show_mouse = 1) : (sd->show_mouse = 0); + /* Whether to display the window border on the screenshot */ + no_border ? (sd->show_border = 0) : (sd->show_border = 1); + sd->delay = delay; if (application != NULL)