[gtkhtml3/f17] Add patch for Red Hat bug #829915 (input freeze in editor, for Emoticons)
Milan Crha
mcrha at fedoraproject.org
Tue Jun 12 08:56:28 UTC 2012
commit 87ba1a3d3b8d4f51f8b1b716bc8fcfd13a3f6cd3
Author: Milan Crha <mcrha at redhat.com>
Date: Tue Jun 12 10:56:18 2012 +0200
Add patch for Red Hat bug #829915 (input freeze in editor, for Emoticons)
gtkhtml-4.4.2-fix-input-freeze2.patch | 109 +++++++++++++++++++++++++++++++++
gtkhtml3.spec | 7 ++-
2 files changed, 115 insertions(+), 1 deletions(-)
---
diff --git a/gtkhtml-4.4.2-fix-input-freeze2.patch b/gtkhtml-4.4.2-fix-input-freeze2.patch
new file mode 100644
index 0000000..3a6a8a9
--- /dev/null
+++ b/gtkhtml-4.4.2-fix-input-freeze2.patch
@@ -0,0 +1,109 @@
+diff --git a/components/editor/gtkhtml-face-tool-button.c b/components/editor/gtkhtml-face-tool-button.c
+index 84c36d2..6316154 100644
+--- a/components/editor/gtkhtml-face-tool-button.c
++++ b/components/editor/gtkhtml-face-tool-button.c
+@@ -53,6 +53,8 @@ struct _GtkhtmlFaceToolButtonPrivate {
+
+ guint popup_shown : 1;
+ guint popup_in_progress : 1;
++ GdkDevice *grab_keyboard;
++ GdkDevice *grab_mouse;
+ };
+
+ static gpointer parent_class;
+@@ -325,7 +327,12 @@ face_tool_button_popup (GtkhtmlFaceToolButton *button)
+ {
+ GtkToggleToolButton *tool_button;
+ GdkWindow *window;
+- GdkGrabStatus status;
++ gboolean grab_status;
++ GdkDevice *device, *mouse, *keyboard;
++ guint32 activate_time;
++
++ device = gtk_get_current_event_device ();
++ g_return_if_fail (device != NULL);
+
+ if (!gtk_widget_get_realized (GTK_WIDGET (button)))
+ return;
+@@ -333,6 +340,15 @@ face_tool_button_popup (GtkhtmlFaceToolButton *button)
+ if (button->priv->popup_shown)
+ return;
+
++ activate_time = gtk_get_current_event_time ();
++ if (gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD) {
++ keyboard = device;
++ mouse = gdk_device_get_associated_device (device);
++ } else {
++ keyboard = gdk_device_get_associated_device (device);
++ mouse = device;
++ }
++
+ /* Position the window over the button. */
+ face_tool_button_reposition_window (button);
+
+@@ -346,22 +362,28 @@ face_tool_button_popup (GtkhtmlFaceToolButton *button)
+
+ /* Try to grab the pointer and keyboard. */
+ window = gtk_widget_get_window (button->priv->window);
+- status = gdk_pointer_grab (
+- window, TRUE,
+- GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
+- GDK_POINTER_MOTION_MASK, NULL, NULL, GDK_CURRENT_TIME);
+- if (status == GDK_GRAB_SUCCESS) {
+- status = gdk_keyboard_grab (window, TRUE, GDK_CURRENT_TIME);
+- if (status != GDK_GRAB_SUCCESS)
+- gdk_display_pointer_ungrab (
+- gdk_window_get_display (window),
+- GDK_CURRENT_TIME);
+- }
+-
+- if (status == GDK_GRAB_SUCCESS)
+- gtk_grab_add (button->priv->window);
+- else
++ grab_status = !keyboard ||
++ gdk_device_grab (keyboard, window,
++ GDK_OWNERSHIP_WINDOW, TRUE,
++ GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK,
++ NULL, activate_time) == GDK_GRAB_SUCCESS;
++ if (grab_status) {
++ grab_status = !mouse ||
++ gdk_device_grab (mouse, window,
++ GDK_OWNERSHIP_WINDOW, TRUE,
++ GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK,
++ NULL, activate_time) == GDK_GRAB_SUCCESS;
++ if (!grab_status && keyboard)
++ gdk_device_ungrab (keyboard, activate_time);
++ }
++
++ if (grab_status) {
++ gtk_device_grab_add (button->priv->window, mouse, TRUE);
++ button->priv->grab_keyboard = keyboard;
++ button->priv->grab_mouse = mouse;
++ } else {
+ gtk_widget_hide (button->priv->window);
++ }
+ }
+
+ static void
+@@ -376,12 +398,20 @@ face_tool_button_popdown (GtkhtmlFaceToolButton *button)
+ return;
+
+ /* Hide the pop-up. */
+- gtk_grab_remove (button->priv->window);
++ gtk_device_grab_remove (button->priv->window, button->priv->grab_mouse);
+ gtk_widget_hide (button->priv->window);
+
+ /* Deactivate the tool button. */
+ tool_button = GTK_TOGGLE_TOOL_BUTTON (button);
+ gtk_toggle_tool_button_set_active (tool_button, FALSE);
++
++ if (button->priv->grab_keyboard)
++ gdk_device_ungrab (button->priv->grab_keyboard, GDK_CURRENT_TIME);
++ if (button->priv->grab_mouse)
++ gdk_device_ungrab (button->priv->grab_mouse, GDK_CURRENT_TIME);
++
++ button->priv->grab_keyboard = NULL;
++ button->priv->grab_mouse = NULL;
+ }
+
+ static GtkhtmlFace *
diff --git a/gtkhtml3.spec b/gtkhtml3.spec
index dbc4477..9a365b9 100644
--- a/gtkhtml3.spec
+++ b/gtkhtml3.spec
@@ -5,7 +5,7 @@
Name: gtkhtml3
Version: 4.4.2
-Release: 2%{?dist}
+Release: 3%{?dist}
Group: System Environment/Libraries
Summary: GtkHTML library
License: LGPLv2+ and GPLv2
@@ -15,6 +15,7 @@ Source: http://download.gnome.org/sources/gtkhtml/4.4/gtkhtml-%{version}.tar.xz
### Patches ###
Patch01: gtkhtml-4.4.2-fix-input-freeze.patch
+Patch02: gtkhtml-4.4.2-fix-input-freeze2.patch
### Build Dependencies ###
@@ -46,6 +47,7 @@ developing applications that use %{name}.
%prep
%setup -q -n gtkhtml-%{version}
%patch01 -p1 -b .fix-input-freeze
+%patch02 -p1 -b .fix-input-freeze2
%build
autoreconf -fi
@@ -78,6 +80,9 @@ find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';'
%{_libdir}/pkgconfig/*.pc
%changelog
+* Tue Jun 12 2012 Milan Crha <mcrha at redhat.com> - 4.4.2-3
+- Add patch for Red Hat bug #829915 (input freeze in editor, for Emoticons)
+
* Fri Jun 08 2012 Milan Crha <mcrha at redhat.com> - 4.4.2-2
- Add patch for Red Hat bug #829915 (input freeze in editor)
More information about the scm-commits
mailing list