Fix keyboard indicator size

This commit is contained in:
Matthias Clasen 2011-04-05 11:10:53 -04:00
parent 97c61e7749
commit 327afa2730
2 changed files with 53 additions and 2 deletions

View File

@ -0,0 +1,46 @@
From b922ecd4777d80524e91644c98c46f6ed3577f1f Mon Sep 17 00:00:00 2001
From: Matthias Clasen <mclasen@redhat.com>
Date: Tue, 5 Apr 2011 11:06:13 -0400
Subject: [PATCH] Status icon: fix size problems
There are bugs in both the notification area and in GtkStatusIcon
when it comes to size allocation. This patch tries to work around
them in a way that makes the keyboard indicator come up with a
reasonable size initially, and not resize when clicked.
https://bugzilla.gnome.org/show_bug.cgi?id=642703
---
libgnomekbd/gkbd-status.c | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/libgnomekbd/gkbd-status.c b/libgnomekbd/gkbd-status.c
index 276fe54..2f5b41f 100644
--- a/libgnomekbd/gkbd-status.c
+++ b/libgnomekbd/gkbd-status.c
@@ -393,6 +393,12 @@ void
gkbd_status_reinit_ui (GkbdStatus * gki)
{
gkbd_status_set_current_page (gki);
+ /* To work around combined bugs in notification-area
+ * and GtkStatusIcon, reshow the icon here, to ensure
+ * size changes are picked up.
+ */
+ gtk_status_icon_set_visible (GTK_STATUS_ICON (gki), FALSE);
+ gtk_status_icon_set_visible (GTK_STATUS_ICON (gki), TRUE);
}
/* Should be called once for all widgets */
@@ -509,6 +515,11 @@ static void
gkbd_status_size_changed (GkbdStatus * gki, gint size)
{
xkl_debug (150, "Size changed to %d\n", size);
+ /* Ignore the initial size 200 that we get before
+ * we are embedded
+ */
+ if (!gtk_status_icon_is_embedded (GTK_STATUS_ICON (gki)))
+ return;
if (globals.current_height != size) {
globals.current_height = size;
globals.current_width = size * 3 / 2;
--
1.7.4.2

View File

@ -1,6 +1,6 @@
Name: libgnomekbd
Version: 3.0.0
Release: 1%{?dist}
Release: 2%{?dist}
Summary: A keyboard configuration library
Group: System Environment/Libraries
@ -11,6 +11,7 @@ Source0: http://download.gnome.org/sources/libgnomekbd/3.0/libgnomekbd-%{
# https://bugzilla.gnome.org/show_bug.cgi?id=642703
Patch0: libgnomekbd-colors.patch
Patch1: 0001-Status-icon-fix-size-problems.patch
BuildRequires: gtk3-devel >= 3.0.0
BuildRequires: cairo-devel
@ -54,7 +55,8 @@ of the keyboard indicator applet.
%prep
%setup -q
%patch0 -p1 -b colors
%patch0 -p1 -b .colors
%patch1 -p1 -b .size
%build
%configure --disable-static \
@ -126,6 +128,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor >&/dev/null || :
%changelog
* Tue Apr 5 2011 Matthias Clasen <mclasen@redhat.com> - 3.0.0-2
- Fix size of keyboard indicator in fallback mode
* Mon Apr 4 2011 Matthias Clasen <mclasen@redhat.com> - 3.0.0-1
- Update to 3.0.0