[gnome-screenshot/wip/exalm/cleanup-cli: 2/3] Remove support for removing window border



commit c9bf485a81add1dbffe1956dae7097bfb03f7838
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Fri Apr 3 03:20:54 2020 +0500

    Remove support for removing window border
    
    All Wayland applications are using client-side decorations. Even on X11,
    most GNOME applications are using them, so this option doesn't have any
    effects in majority of cases. Since !7, it's not exposed in GUI either.
    
    To simplify the code, just remove it.
    
    Deprecate --include-border and --remove-border CLI options, print a
    warning when they are in use. Update the manpage.
    
    Remove the corresponding gsettings key.

 data/gnome-screenshot.1                     |  6 ++++--
 data/org.gnome.gnome-screenshot.gschema.xml |  5 -----
 src/screenshot-application.c                |  4 ++--
 src/screenshot-config.c                     | 19 +++++++------------
 src/screenshot-config.h                     |  1 -
 src/screenshot-utils.c                      | 25 +++++--------------------
 6 files changed, 18 insertions(+), 42 deletions(-)
---
diff --git a/data/gnome-screenshot.1 b/data/gnome-screenshot.1
index c2acd50..4627b79 100644
--- a/data/gnome-screenshot.1
+++ b/data/gnome-screenshot.1
@@ -22,10 +22,12 @@ screen.
 Grab an area of the screen instead of the entire screen.
 .TP
 \fB-b, --include-border\fR
-Include the window border within the screenshot.
+Include the window border within the screenshot. Note: This option is deprecated
+and window border is always included.
 .TP
 \fB-B, --remove-border\fR
-Remove the window border from the screenshot.
+Remove the window border from the screenshot. Note: This option is deprecated
+and window border is always included.
 .TP
 \fB-p, --include-pointer\fR
 Include the pointer with the screenshot.
diff --git a/data/org.gnome.gnome-screenshot.gschema.xml b/data/org.gnome.gnome-screenshot.gschema.xml
index b998853..ffb6075 100644
--- a/data/org.gnome.gnome-screenshot.gschema.xml
+++ b/data/org.gnome.gnome-screenshot.gschema.xml
@@ -26,11 +26,6 @@
       <summary>Last save directory</summary>
       <description>The last directory a screenshot was saved in interactive mode.</description>
     </key>
-    <key name="include-border" type="b">
-      <default>true</default>
-      <summary>Include Border</summary>
-      <description>Include the window manager border along with the screenshot</description>
-    </key>
     <key name="include-pointer" type="b">
       <default>false</default>
       <summary>Include Pointer</summary>
diff --git a/src/screenshot-application.c b/src/screenshot-application.c
index b7fa93c..11c367c 100644
--- a/src/screenshot-application.c
+++ b/src/screenshot-application.c
@@ -609,8 +609,8 @@ static const GOptionEntry entries[] = {
   { "clipboard", 'c', 0, G_OPTION_ARG_NONE, NULL, N_("Send the grab directly to the clipboard"), NULL },
   { "window", 'w', 0, G_OPTION_ARG_NONE, NULL, N_("Grab a window instead of the entire screen"), NULL },
   { "area", 'a', 0, G_OPTION_ARG_NONE, NULL, N_("Grab an area of the screen instead of the entire screen"), 
NULL },
-  { "include-border", 'b', 0, G_OPTION_ARG_NONE, NULL, N_("Include the window border with the screenshot"), 
NULL },
-  { "remove-border", 'B', 0, G_OPTION_ARG_NONE, NULL, N_("Remove the window border from the screenshot"), 
NULL },
+  { "include-border", 'b', 0, G_OPTION_ARG_NONE, NULL, N_("Include the window border with the screenshot. 
This option is deprecated and window border is always included"), NULL },
+  { "remove-border", 'B', 0, G_OPTION_ARG_NONE, NULL, N_("Remove the window border from the screenshot. This 
option is deprecated and window border is always included"), NULL },
   { "include-pointer", 'p', 0, G_OPTION_ARG_NONE, NULL, N_("Include the pointer with the screenshot"), NULL 
},
   { "delay", 'd', 0, G_OPTION_ARG_INT, NULL, N_("Take screenshot after specified delay [in seconds]"), 
N_("seconds") },
   { "border-effect", 'e', 0, G_OPTION_ARG_STRING, NULL, N_("Effect to add to the border (shadow, border, 
vintage or none)"), N_("effect") },
diff --git a/src/screenshot-config.c b/src/screenshot-config.c
index 62fd2cc..3852d0e 100644
--- a/src/screenshot-config.c
+++ b/src/screenshot-config.c
@@ -28,7 +28,6 @@
 
 #define BORDER_EFFECT_KEY       "border-effect"
 #define DELAY_KEY               "delay"
-#define INCLUDE_BORDER_KEY      "include-border"
 #define INCLUDE_POINTER_KEY     "include-pointer"
 #define INCLUDE_ICC_PROFILE     "include-icc-profile"
 #define AUTO_SAVE_DIRECTORY_KEY "auto-save-directory"
@@ -51,9 +50,6 @@ screenshot_load_config (void)
   config->delay =
     g_settings_get_int (config->settings,
                         DELAY_KEY);
-  config->include_border =
-    g_settings_get_boolean (config->settings,
-                            INCLUDE_BORDER_KEY);
   config->include_pointer =
     g_settings_get_boolean (config->settings,
                             INCLUDE_POINTER_KEY);
@@ -89,8 +85,6 @@ screenshot_save_config (void)
   if (!c->interactive)
     return;
 
-  g_settings_set_boolean (c->settings,
-                          INCLUDE_BORDER_KEY, c->include_border);
   g_settings_set_boolean (c->settings,
                           INCLUDE_POINTER_KEY, c->include_pointer);
   g_settings_set_string (c->settings,
@@ -121,6 +115,13 @@ screenshot_config_parse_command_line (gboolean clipboard_arg,
 
   screenshot_config->interactive = interactive_arg;
 
+  if (include_border_arg)
+    g_warning ("Option --include-border is deprecated and will be removed in "
+               "gnome-screenshot 3.38.0. Window border is always included.");
+  if (disable_border_arg)
+    g_warning ("Option --remove-border is deprecated and will be removed in "
+               "gnome-screenshot 3.38.0. Window border is always included.");
+
   if (screenshot_config->interactive)
     {
       if (clipboard_arg)
@@ -132,10 +133,6 @@ screenshot_config_parse_command_line (gboolean clipboard_arg,
 
       if (delay_arg > 0)
         screenshot_config->delay = delay_arg;
-      if (include_border_arg)
-        screenshot_config->include_border = TRUE;
-      if (disable_border_arg)
-        screenshot_config->include_border = FALSE;
 
       g_free (screenshot_config->border_effect);
       screenshot_config->border_effect = g_strdup ("none");
@@ -148,8 +145,6 @@ screenshot_config_parse_command_line (gboolean clipboard_arg,
                                AUTO_SAVE_DIRECTORY_KEY);
 
       screenshot_config->delay = delay_arg;
-      screenshot_config->include_border = include_border_arg;
-      screenshot_config->include_border = !disable_border_arg;
       screenshot_config->include_pointer = include_pointer_arg;
       screenshot_config->copy_to_clipboard = clipboard_arg;
       if (file_arg != NULL)
diff --git a/src/screenshot-config.h b/src/screenshot-config.h
index f765aaf..d7175c3 100644
--- a/src/screenshot-config.h
+++ b/src/screenshot-config.h
@@ -39,7 +39,6 @@ typedef struct {
   gboolean include_pointer;
   gboolean include_icc_profile;
 
-  gboolean include_border;
   gchar *border_effect;
 
   guint delay;
diff --git a/src/screenshot-utils.c b/src/screenshot-utils.c
index 9ad46c5..c3a7024 100644
--- a/src/screenshot-utils.c
+++ b/src/screenshot-utils.c
@@ -223,8 +223,7 @@ mask_monitors (GdkPixbuf *pixbuf, GdkWindow *root_window)
 }
 
 static void
-screenshot_fallback_get_window_rect_coords (GdkWindow *window,
-                                            gboolean include_border,
+screenshot_fallback_get_window_rect_coords (GdkWindow    *window,
                                             GdkRectangle *real_coordinates_out,
                                             GdkRectangle *screenshot_coordinates_out)
 {
@@ -232,17 +231,7 @@ screenshot_fallback_get_window_rect_coords (GdkWindow *window,
   gint width, height;
   GdkRectangle real_coordinates;
 
-  if (include_border)
-    {
-      gdk_window_get_frame_extents (window, &real_coordinates);
-    }
-  else
-    {
-      real_coordinates.width = gdk_window_get_width (window);
-      real_coordinates.height = gdk_window_get_height (window);
-
-      gdk_window_get_origin (window, &real_coordinates.x, &real_coordinates.y);
-    }
+  gdk_window_get_frame_extents (window, &real_coordinates);
 
   x_orig = real_coordinates.x;
   y_orig = real_coordinates.y;
@@ -324,10 +313,7 @@ screenshot_fallback_fire_flash (GdkWindow *window,
   if (rectangle != NULL)
     rect = *rectangle;
   else
-    screenshot_fallback_get_window_rect_coords (window,
-                                                screenshot_config->include_border,
-                                                NULL,
-                                                &rect);
+    screenshot_fallback_get_window_rect_coords (window, NULL, &rect);
 
   flash = cheese_flash_new ();
   cheese_flash_fire (flash, &rect);
@@ -397,7 +383,6 @@ screenshot_fallback_get_pixbuf (GdkRectangle *rectangle)
   window = screenshot_fallback_find_current_window ();
 
   screenshot_fallback_get_window_rect_coords (window,
-                                              screenshot_config->include_border,
                                               &real_coords,
                                               &screenshot_coords);
 
@@ -438,7 +423,7 @@ screenshot_fallback_get_pixbuf (GdkRectangle *rectangle)
     mask_monitors (screenshot, root);
 
 #ifdef HAVE_X11_EXTENSIONS_SHAPE_H
-  if (screenshot_config->include_border && (wm != None))
+  if (wm != None)
     {
       XRectangle *rectangles;
       int rectangle_count, rectangle_order, i;
@@ -615,7 +600,7 @@ screenshot_shell_get_pixbuf (GdkRectangle *rectangle)
     {
       method_name = "ScreenshotWindow";
       method_params = g_variant_new ("(bbbs)",
-                                     screenshot_config->include_border,
+                                     TRUE,
                                      screenshot_config->include_pointer,
                                      TRUE, /* flash */
                                      filename);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]