[gnome-applets/wip/muktupavels/window-picker: 2/2] window-picker: do not set size hints




commit 72f9ea7625236b33a20be8046a7cb92a5744da82
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Mon May 3 22:00:37 2021 +0300

    window-picker: do not set size hints
    
    This mostly reverts commit 89826bbfb8567719a6bda84a1655a30817002bf0.
    
    Original bug is fixed in gnome-panel 3.41.1 and size hints will be
    removed in near future. Applets and/or widgets should use minimum
    and natural sizes instead.

 configure.ac                            |  2 +-
 gnome-applets/window-picker/wp-applet.c | 48 +--------------------------------
 2 files changed, 2 insertions(+), 48 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index e0b66376e..1980cd4d8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -68,7 +68,7 @@ dnl ***************************************************************************
 GTK_REQUIRED=3.20.0
 GLIB_REQUIRED=2.44.0
 GIO_REQUIRED=2.26.0
-LIBGNOME_PANEL_REQUIRED=3.37.0
+LIBGNOME_PANEL_REQUIRED=3.41.1
 LIBGTOP_REQUIRED=2.11.92
 LIBWNCK_REQUIRED=3.14.1
 LIBNOTIFY_REQUIRED=0.7
diff --git a/gnome-applets/window-picker/wp-applet.c b/gnome-applets/window-picker/wp-applet.c
index cba992f14..d282851d1 100644
--- a/gnome-applets/window-picker/wp-applet.c
+++ b/gnome-applets/window-picker/wp-applet.c
@@ -37,7 +37,6 @@
 
 #define SETTINGS_SCHEMA "org.gnome.gnome-applets.window-picker-applet"
 #define TITLE_BUTTON_SPACE 6
-#define CONTAINER_SPACING 10
 
 struct _WpApplet
 {
@@ -194,47 +193,6 @@ wp_applet_contructed (GObject *object)
   gtk_widget_show_all (GTK_WIDGET (applet));
 }
 
-static void
-wp_applet_size_allocate (GtkWidget     *widget,
-                         GtkAllocation *allocation)
-{
-  WpApplet *applet;
-  GpApplet *panel_applet;
-  GtkOrientation orientation;
-  gint size_hints[2];
-  gint size;
-
-  GTK_WIDGET_CLASS (wp_applet_parent_class)->size_allocate (widget, allocation);
-
-  applet = WP_APPLET (widget);
-  panel_applet = GP_APPLET (widget);
-
-  orientation = gp_applet_get_orientation (panel_applet);
-
-  if (orientation == GTK_ORIENTATION_HORIZONTAL)
-    gtk_widget_get_preferred_width_for_height (applet->tasks, allocation->height, NULL, &size);
-  else
-    gtk_widget_get_preferred_height_for_width (applet->tasks, allocation->width, NULL, &size);
-
-  size_hints[0] = size;
-  size_hints[1] = 0;
-
-  if (gtk_widget_is_visible (applet->title))
-    {
-      if (orientation == GTK_ORIENTATION_HORIZONTAL)
-        gtk_widget_get_preferred_width (applet->title, NULL, &size);
-      else
-        gtk_widget_get_preferred_height (applet->title, NULL, &size);
-
-      if (size != 0)
-        size_hints[0] += CONTAINER_SPACING;
-
-      size_hints[0] += size;
-    }
-
-  gp_applet_set_size_hints (panel_applet, size_hints, 2, 0);
-}
-
 static void
 wp_applet_dispose (GObject *object)
 {
@@ -330,15 +288,11 @@ static void
 wp_applet_class_init (WpAppletClass *applet_class)
 {
   GObjectClass *object_class;
-  GtkWidgetClass *widget_class;
   GpAppletClass *panel_applet_class;
 
   object_class = G_OBJECT_CLASS (applet_class);
-  widget_class = GTK_WIDGET_CLASS (applet_class);
   panel_applet_class = GP_APPLET_CLASS (applet_class);
 
-  widget_class->size_allocate = wp_applet_size_allocate;
-
   object_class->dispose = wp_applet_dispose;
   object_class->set_property = wp_applet_set_property;
   object_class->get_property = wp_applet_get_property;
@@ -378,7 +332,7 @@ wp_applet_init (WpApplet *applet)
 
   gp_applet_set_flags (panel_applet, flags);
 
-  applet->container = gtk_box_new (orientation, CONTAINER_SPACING);
+  applet->container = gtk_box_new (orientation, 10);
   gtk_container_add (GTK_CONTAINER (applet), applet->container);
 }
 


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