|
|
225774 |
From 89a5825eb20bfa91b91055e5a3dfe6445e6b9bd2 Mon Sep 17 00:00:00 2001
|
|
|
225774 |
From: raveit65 <mate@raveit.de>
|
|
|
225774 |
Date: Fri, 11 Jun 2021 21:26:40 +0200
|
|
|
225774 |
Subject: [PATCH] Revert "pager: do not change workspace size from
|
|
|
225774 |
size_allocate"
|
|
|
225774 |
|
|
|
225774 |
This reverts commit 3456b747b6381f17d48629dd8fdd4d511e739b10.
|
|
|
225774 |
---
|
|
|
225774 |
libwnck/pager.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++++
|
|
|
225774 |
1 file changed, 59 insertions(+)
|
|
|
225774 |
|
|
|
225774 |
diff --git a/libwnck/pager.c b/libwnck/pager.c
|
|
|
225774 |
index c769d62..a563a4d 100644
|
|
|
225774 |
--- a/libwnck/pager.c
|
|
|
225774 |
+++ b/libwnck/pager.c
|
|
|
225774 |
@@ -122,6 +122,8 @@ static void wnck_pager_get_preferred_height_for_width (GtkWidget *widget,
|
|
|
225774 |
int width,
|
|
|
225774 |
int *minimum_height,
|
|
|
225774 |
int *natural_height);
|
|
|
225774 |
+static void wnck_pager_size_allocate (GtkWidget *widget,
|
|
|
225774 |
+ GtkAllocation *allocation);
|
|
|
225774 |
static gboolean wnck_pager_draw (GtkWidget *widget,
|
|
|
225774 |
cairo_t *cr);
|
|
|
225774 |
static gboolean wnck_pager_button_press (GtkWidget *widget,
|
|
|
225774 |
@@ -247,6 +249,7 @@ wnck_pager_class_init (WnckPagerClass *klass)
|
|
|
225774 |
widget_class->get_preferred_width_for_height = wnck_pager_get_preferred_width_for_height;
|
|
|
225774 |
widget_class->get_preferred_height = wnck_pager_get_preferred_height;
|
|
|
225774 |
widget_class->get_preferred_height_for_width = wnck_pager_get_preferred_height_for_width;
|
|
|
225774 |
+ widget_class->size_allocate = wnck_pager_size_allocate;
|
|
|
225774 |
widget_class->draw = wnck_pager_draw;
|
|
|
225774 |
widget_class->button_press_event = wnck_pager_button_press;
|
|
|
225774 |
widget_class->button_release_event = wnck_pager_button_release;
|
|
|
225774 |
@@ -684,6 +687,62 @@ wnck_pager_get_preferred_height_for_width (GtkWidget *widget,
|
|
|
225774 |
*natural_height = *minimum_height = MAX (height, 0);
|
|
|
225774 |
}
|
|
|
225774 |
|
|
|
225774 |
+static gboolean
|
|
|
225774 |
+_wnck_pager_queue_resize (gpointer data)
|
|
|
225774 |
+{
|
|
|
225774 |
+ gtk_widget_queue_resize (GTK_WIDGET (data));
|
|
|
225774 |
+ return FALSE;
|
|
|
225774 |
+}
|
|
|
225774 |
+
|
|
|
225774 |
+static void
|
|
|
225774 |
+wnck_pager_size_allocate (GtkWidget *widget,
|
|
|
225774 |
+ GtkAllocation *allocation)
|
|
|
225774 |
+{
|
|
|
225774 |
+ WnckPager *pager;
|
|
|
225774 |
+ int workspace_size;
|
|
|
225774 |
+ GtkBorder padding;
|
|
|
225774 |
+ int width;
|
|
|
225774 |
+ int height;
|
|
|
225774 |
+
|
|
|
225774 |
+ pager = WNCK_PAGER (widget);
|
|
|
225774 |
+
|
|
|
225774 |
+ width = allocation->width;
|
|
|
225774 |
+ height = allocation->height;
|
|
|
225774 |
+
|
|
|
225774 |
+ _wnck_pager_get_padding (pager, &padding);
|
|
|
225774 |
+ width -= padding.left + padding.right;
|
|
|
225774 |
+ height -= padding.top + padding.bottom;
|
|
|
225774 |
+
|
|
|
225774 |
+ g_assert (pager->priv->n_rows > 0);
|
|
|
225774 |
+
|
|
|
225774 |
+ if (pager->priv->orientation == GTK_ORIENTATION_VERTICAL)
|
|
|
225774 |
+ {
|
|
|
225774 |
+ if (pager->priv->show_all_workspaces)
|
|
|
225774 |
+ workspace_size = (width - (pager->priv->n_rows - 1)) / pager->priv->n_rows;
|
|
|
225774 |
+ else
|
|
|
225774 |
+ workspace_size = width;
|
|
|
225774 |
+ }
|
|
|
225774 |
+ else
|
|
|
225774 |
+ {
|
|
|
225774 |
+ if (pager->priv->show_all_workspaces)
|
|
|
225774 |
+ workspace_size = (height - (pager->priv->n_rows - 1))/ pager->priv->n_rows;
|
|
|
225774 |
+ else
|
|
|
225774 |
+ workspace_size = height;
|
|
|
225774 |
+ }
|
|
|
225774 |
+
|
|
|
225774 |
+ workspace_size = MAX (workspace_size, 1);
|
|
|
225774 |
+
|
|
|
225774 |
+ if (workspace_size != pager->priv->workspace_size)
|
|
|
225774 |
+ {
|
|
|
225774 |
+ pager->priv->workspace_size = workspace_size;
|
|
|
225774 |
+ g_idle_add (_wnck_pager_queue_resize, pager);
|
|
|
225774 |
+ return;
|
|
|
225774 |
+ }
|
|
|
225774 |
+
|
|
|
225774 |
+ GTK_WIDGET_CLASS (wnck_pager_parent_class)->size_allocate (widget,
|
|
|
225774 |
+ allocation);
|
|
|
225774 |
+}
|
|
|
225774 |
+
|
|
|
225774 |
static void
|
|
|
225774 |
get_workspace_rect (WnckPager *pager,
|
|
|
225774 |
int space,
|
|
|
225774 |
--
|
|
|
225774 |
2.31.1
|
|
|
225774 |
|