[libwnck/wip/muktupavels/remove-deprecated-things: 6/14] screen: remove deprecated API




commit 4a59ed160923c85279af70bca80fe8e1821d94d2
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Fri Sep 16 12:31:57 2022 +0300

    screen: remove deprecated API
    
    https://gitlab.gnome.org/GNOME/libwnck/-/issues/150

 doc/libwnck-sections.txt |   6 -
 libwnck/screen.c         | 302 +----------------------------------------------
 libwnck/screen.h         |  53 ---------
 3 files changed, 2 insertions(+), 359 deletions(-)
---
diff --git a/doc/libwnck-sections.txt b/doc/libwnck-sections.txt
index 6fb1139b..f57410f3 100644
--- a/doc/libwnck-sections.txt
+++ b/doc/libwnck-sections.txt
@@ -187,9 +187,6 @@ WnckWorkspaceClass
 <FILE>screen</FILE>
 <TITLE>WnckScreen</TITLE>
 WnckScreen
-wnck_screen_get_default
-wnck_screen_get
-wnck_screen_get_for_root
 wnck_screen_get_number
 wnck_screen_get_width
 wnck_screen_get_height
@@ -207,9 +204,6 @@ wnck_screen_get_workspace_count
 wnck_screen_change_workspace_count
 wnck_screen_try_set_workspace_layout
 wnck_screen_release_workspace_layout
-WnckWorkspaceLayout
-wnck_screen_calc_workspace_layout
-wnck_screen_free_workspace_layout
 wnck_screen_move_viewport
 wnck_screen_get_background_pixmap
 wnck_screen_get_showing_desktop
diff --git a/libwnck/screen.c b/libwnck/screen.c
index 35d33c22..85f49800 100644
--- a/libwnck/screen.c
+++ b/libwnck/screen.c
@@ -21,8 +21,6 @@
  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
  */
 
-#undef WNCK_DISABLE_DEPRECATED
-
 #include <config.h>
 
 #include <glib/gi18n-lib.h>
@@ -531,58 +529,6 @@ _wnck_screen_construct (WnckScreen *screen,
   queue_update (screen);
 }
 
-/**
- * wnck_screen_get:
- * @index: screen number, starting from 0.
- *
- * Gets the #WnckScreen for a given screen on the default display.
- *
- * Return value: (transfer none): the #WnckScreen for screen @index, or %NULL
- * if no such screen exists. The returned #WnckScreen is owned by libwnck and
- * must not be referenced or unreferenced.
- **/
-WnckScreen*
-wnck_screen_get (int index)
-{
-  return wnck_handle_get_screen (_wnck_get_handle (), index);
-}
-
-/**
- * wnck_screen_get_default:
- *
- * Gets the default #WnckScreen on the default display.
- *
- * Return value: (transfer none) (nullable): the default #WnckScreen. The returned
- * #WnckScreen is owned by libwnck and must not be referenced or unreferenced. This
- * can return %NULL if not on X11.
- **/
-WnckScreen*
-wnck_screen_get_default (void)
-{
-  return wnck_handle_get_default_screen (_wnck_get_handle ());
-}
-
-/**
- * wnck_screen_get_for_root:
- * @root_window_id: an X window ID.
- *
- * Gets the #WnckScreen for the root window at @root_window_id, or
- * %NULL if no #WnckScreen exists for this root window.
- *
- * This function does not work if wnck_screen_get() was not called for the
- * sought #WnckScreen before, and returns %NULL.
- *
- * Return value: (transfer none): the #WnckScreen for the root window at
- * @root_window_id, or %NULL. The returned #WnckScreen is owned by libwnck and
- * must not be referenced or unreferenced.
- **/
-WnckScreen*
-wnck_screen_get_for_root (gulong root_window_id)
-{
-  return wnck_handle_get_screen_for_root (_wnck_get_handle (),
-                                          root_window_id);
-}
-
 /**
  * wnck_screen_get_handle:
  * @screen: a #WnckScreen.
@@ -950,250 +896,6 @@ _wnck_screen_process_property_notify (WnckScreen *screen,
     }
 }
 
-/**
- * wnck_screen_calc_workspace_layout:
- * @screen: a #WnckScreen.
- * @num_workspaces: the number of #WnckWorkspace on @screen, or -1 to let
- * wnck_screen_calc_workspace_layout() find this number.
- * @space_index: the index of a #WnckWorkspace.
- * @layout: return location for the layout of #WnckWorkspace with additional
- * information.
- *
- * Calculates the layout of #WnckWorkspace, with additional information like
- * the row and column of the #WnckWorkspace with index @space_index.
- *
- * Since: 2.12
- * Deprecated:2.20:
- */
-/* TODO: when we make this private, remove num_workspaces since we can get it
- * from screen! */
-void
-wnck_screen_calc_workspace_layout (WnckScreen          *screen,
-                                   int                  num_workspaces,
-                                   int                  space_index,
-                                   WnckWorkspaceLayout *layout)
-{
-  int rows, cols;
-  int grid_area;
-  int *grid;
-  int i, r, c;
-  int current_row, current_col;
-
-  g_return_if_fail (WNCK_IS_SCREEN (screen));
-  g_return_if_fail (layout != NULL);
-
-  if (num_workspaces < 0)
-    num_workspaces = wnck_screen_get_workspace_count (screen);
-
-  rows = screen->priv->rows_of_workspaces;
-  cols = screen->priv->columns_of_workspaces;
-
-  if (rows <= 0 && cols <= 0)
-    cols = num_workspaces;
-
-  if (rows <= 0)
-    rows = num_workspaces / cols + ((num_workspaces % cols) > 0 ? 1 : 0);
-  if (cols <= 0)
-    cols = num_workspaces / rows + ((num_workspaces % rows) > 0 ? 1 : 0);
-
-  /* paranoia */
-  if (rows < 1)
-    rows = 1;
-  if (cols < 1)
-    cols = 1;
-
-  g_assert (rows != 0 && cols != 0);
-
-  grid_area = rows * cols;
-
-  grid = g_new (int, grid_area);
-
-  current_row = -1;
-  current_col = -1;
-  i = 0;
-
-  switch (screen->priv->starting_corner)
-    {
-    case WNCK_LAYOUT_CORNER_TOPLEFT:
-      if (screen->priv->vertical_workspaces)
-        {
-          c = 0;
-          while (c < cols)
-            {
-              r = 0;
-              while (r < rows)
-                {
-                  grid[r*cols+c] = i;
-                  ++i;
-                  ++r;
-                }
-              ++c;
-            }
-        }
-      else
-        {
-          r = 0;
-          while (r < rows)
-            {
-              c = 0;
-              while (c < cols)
-                {
-                  grid[r*cols+c] = i;
-                  ++i;
-                  ++c;
-                }
-              ++r;
-            }
-        }
-      break;
-    case WNCK_LAYOUT_CORNER_TOPRIGHT:
-      if (screen->priv->vertical_workspaces)
-        {
-          c = cols - 1;
-          while (c >= 0)
-            {
-              r = 0;
-              while (r < rows)
-                {
-                  grid[r*cols+c] = i;
-                  ++i;
-                  ++r;
-                }
-              --c;
-            }
-        }
-      else
-        {
-          r = 0;
-          while (r < rows)
-            {
-              c = cols - 1;
-              while (c >= 0)
-                {
-                  grid[r*cols+c] = i;
-                  ++i;
-                  --c;
-                }
-              ++r;
-            }
-        }
-      break;
-    case WNCK_LAYOUT_CORNER_BOTTOMLEFT:
-      if (screen->priv->vertical_workspaces)
-        {
-          c = 0;
-          while (c < cols)
-            {
-              r = rows - 1;
-              while (r >= 0)
-                {
-                  grid[r*cols+c] = i;
-                  ++i;
-                  --r;
-                }
-              ++c;
-            }
-        }
-      else
-        {
-          r = rows - 1;
-          while (r >= 0)
-            {
-              c = 0;
-              while (c < cols)
-                {
-                  grid[r*cols+c] = i;
-                  ++i;
-                  ++c;
-                }
-              --r;
-            }
-        }
-      break;
-    case WNCK_LAYOUT_CORNER_BOTTOMRIGHT:
-      if (screen->priv->vertical_workspaces)
-        {
-          c = cols - 1;
-          while (c >= 0)
-            {
-              r = rows - 1;
-              while (r >= 0)
-                {
-                  grid[r*cols+c] = i;
-                  ++i;
-                  --r;
-                }
-              --c;
-            }
-        }
-      else
-        {
-          r = rows - 1;
-          while (r >= 0)
-            {
-              c = cols - 1;
-              while (c >= 0)
-                {
-                  grid[r*cols+c] = i;
-                  ++i;
-                  --c;
-                }
-              --r;
-            }
-        }
-      break;
-    default:
-      break;
-    }
-
-  current_row = 0;
-  current_col = 0;
-  r = 0;
-  while (r < rows)
-    {
-      c = 0;
-      while (c < cols)
-        {
-          if (grid[r*cols+c] == space_index)
-            {
-              current_row = r;
-              current_col = c;
-            }
-          else if (grid[r*cols+c] >= num_workspaces)
-            {
-              /* flag nonexistent spaces with -1 */
-              grid[r*cols+c] = -1;
-            }
-          ++c;
-        }
-      ++r;
-    }
-  layout->rows = rows;
-  layout->cols = cols;
-  layout->grid = grid;
-  layout->grid_area = grid_area;
-  layout->current_row = current_row;
-  layout->current_col = current_col;
-}
-
-/**
- * wnck_screen_free_workspace_layout:
- * @layout: a #WnckWorkspaceLayout.
- *
- * Frees the content of @layout. This does not free @layout itself, so you
- * might want to free @layout yourself after calling this.
- *
- * Since: 2.12
- * Deprecated:2.20:
- */
-void
-wnck_screen_free_workspace_layout (WnckWorkspaceLayout *layout)
-{
-  g_return_if_fail (layout != NULL);
-
-  g_free (layout->grid);
-}
-
 static void
 set_active_window (WnckScreen *screen,
                    WnckWindow *window)
@@ -2434,8 +2136,8 @@ _wnck_screen_get_xscreen (WnckScreen *screen)
  */
 /* TODO: when we are sure about this API, add this function,
  * WnckLayoutOrientation, WnckLayoutCorner and a "layout-changed" signal. But
- * to make it really better, use a WnckScreenLayout struct. We might also want
- * to wait for deprecation of WnckWorkspaceLayout. */
+ * to make it really better, use a WnckScreenLayout struct.
+ */
 void
 _wnck_screen_get_workspace_layout (WnckScreen             *screen,
                                    _WnckLayoutOrientation *orientation,
diff --git a/libwnck/screen.h b/libwnck/screen.h
index 9fca17b9..f376d9f7 100644
--- a/libwnck/screen.h
+++ b/libwnck/screen.h
@@ -120,40 +120,6 @@ struct _WnckScreenClass
   void (* pad6) (void);
 };
 
-#ifndef WNCK_DISABLE_DEPRECATED
-typedef struct _WnckWorkspaceLayout WnckWorkspaceLayout;
-
-/**
- * WnckWorkspaceLayout:
- * @rows: number of rows in the layout grid.
- * @cols: number of columns in the layout grid.
- * @grid: array of size @grid_area containing the index (starting from 0) of
- * the #WnckWorkspace for each position in the layout grid, or -1 if the
- * position does not correspond to any #WnckWorkspace.
- * @grid_area: size of the grid containing all #WnckWorkspace. This can be
- * bigger than the number of #WnckWorkspace because the grid might not be
- * filled.
- * @current_row: row of the specific #WnckWorkspace, starting from 0.
- * @current_col: column of the specific #WnckWorkspace, starting from 0.
- *
- * The #WnckWorkspaceLayout struct contains information about the layout of
- * #WnckWorkspace on a #WnckScreen, and the exact position of a specific
- * #WnckWorkspace.
- *
- * Since: 2.12
- * Deprecated:2.20:
- */
-struct _WnckWorkspaceLayout
-{
-  int rows;
-  int cols;
-  int *grid;
-  int grid_area;
-  int current_row;
-  int current_col;
-};
-#endif /* WNCK_DISABLE_DEPRECATED */
-
 /**
  * WnckLayoutOrientation:
  * @WNCK_LAYOUT_ORIENTATION_HORIZONTAL: the #WnckWorkspace are laid out in
@@ -194,15 +160,6 @@ typedef enum
 
 GType wnck_screen_get_type (void) G_GNUC_CONST;
 
-G_DEPRECATED_FOR(wnck_handle_get_default_screen)
-WnckScreen*    wnck_screen_get_default              (void);
-
-G_DEPRECATED_FOR(wnck_handle_get_screen)
-WnckScreen*    wnck_screen_get                      (int         index);
-
-G_DEPRECATED_FOR(wnck_handle_get_screen_for_root)
-WnckScreen*    wnck_screen_get_for_root             (gulong      root_window_id);
-
 WnckHandle*    wnck_screen_get_handle               (WnckScreen *screen);
 
 int            wnck_screen_get_number               (WnckScreen *screen);
@@ -241,16 +198,6 @@ int            wnck_screen_try_set_workspace_layout (WnckScreen *screen,
                                                      int         columns);
 void           wnck_screen_release_workspace_layout (WnckScreen *screen,
                                                      int         current_token);
-#ifndef WNCK_DISABLE_DEPRECATED
-G_DEPRECATED
-void           wnck_screen_calc_workspace_layout    (WnckScreen          *screen,
-                                                     int                  num_workspaces,
-                                                     int                  space_index,
-                                                     WnckWorkspaceLayout *layout);
-G_DEPRECATED
-void           wnck_screen_free_workspace_layout (WnckWorkspaceLayout *layout);
-#endif /* WNCK_DISABLE_DEPRECATED */
-
 
 G_END_DECLS
 


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