From 37d05d248e80432556e1942a896b9a63e1a99649 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Fri, 27 Mar 2015 15:32:37 +0000 Subject: [PATCH] Resolves: gnome#745909 grab/ungrab keyboard for menus --- ...45909-grab-ungrab-keyboard-for-menus.patch | 100 ++++++++++++++++++ libreoffice.spec | 1 + 2 files changed, 101 insertions(+) create mode 100644 0001-gnome-745909-grab-ungrab-keyboard-for-menus.patch diff --git a/0001-gnome-745909-grab-ungrab-keyboard-for-menus.patch b/0001-gnome-745909-grab-ungrab-keyboard-for-menus.patch new file mode 100644 index 0000000..2932cfb --- /dev/null +++ b/0001-gnome-745909-grab-ungrab-keyboard-for-menus.patch @@ -0,0 +1,100 @@ +From 27e0fee7da99f3df722668d132bc034bef421514 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= +Date: Fri, 27 Mar 2015 15:28:28 +0000 +Subject: [PATCH] gnome#745909 grab/ungrab keyboard for menus + +Change-Id: Id0593e1c9af79084ae798f26a0be37c57d254227 +--- + vcl/inc/unx/gtk/gtkframe.hxx | 3 ++- + vcl/unx/gtk/window/gtksalframe.cxx | 39 ++++++++++++++++++++++++++++++++++++-- + 2 files changed, 39 insertions(+), 3 deletions(-) + +diff --git a/vcl/inc/unx/gtk/gtkframe.hxx b/vcl/inc/unx/gtk/gtkframe.hxx +index d514411..2eb0634 100644 +--- a/vcl/inc/unx/gtk/gtkframe.hxx ++++ b/vcl/inc/unx/gtk/gtkframe.hxx +@@ -328,7 +328,8 @@ public: + // and false else; if true was returned the event should + // be swallowed + bool Dispatch( const XEvent* pEvent ); +- void grabPointer( bool bGrab, bool bOwnerEvents = false ); ++ void grabPointer(bool bGrab, bool bOwnerEvents = false); ++ void grabKeyboard(bool bGrab); + + GtkSalDisplay* getDisplay(); + GdkDisplay* getGdkDisplay(); +diff --git a/vcl/unx/gtk/window/gtksalframe.cxx b/vcl/unx/gtk/window/gtksalframe.cxx +index aa94c26..1b8bdc5 100644 +--- a/vcl/unx/gtk/window/gtksalframe.cxx ++++ b/vcl/unx/gtk/window/gtksalframe.cxx +@@ -1864,7 +1864,13 @@ void GtkSalFrame::Show( bool bVisible, bool bNoActivate ) + { + m_nFloats++; + if( ! getDisplay()->GetCaptureFrame() && m_nFloats == 1 ) +- grabPointer( true, true ); ++ { ++ grabPointer(true, true); ++ GtkSalFrame *pKeyboardFrame = this; ++ while (pKeyboardFrame->m_pParent) ++ pKeyboardFrame = pKeyboardFrame->m_pParent; ++ pKeyboardFrame->grabKeyboard(true); ++ } + // #i44068# reset parent's IM context + if( m_pParent ) + m_pParent->EndExtTextInput(0); +@@ -1878,7 +1884,13 @@ void GtkSalFrame::Show( bool bVisible, bool bNoActivate ) + { + m_nFloats--; + if( ! getDisplay()->GetCaptureFrame() && m_nFloats == 0) +- grabPointer( false ); ++ { ++ GtkSalFrame *pKeyboardFrame = this; ++ while (pKeyboardFrame->m_pParent) ++ pKeyboardFrame = pKeyboardFrame->m_pParent; ++ pKeyboardFrame->grabKeyboard(false); ++ grabPointer(false); ++ } + } + gtk_widget_hide( m_pWindow ); + if( m_pIMHandler ) +@@ -2762,7 +2774,9 @@ void GtkSalFrame::grabPointer( bool bGrab, bool bOwnerEvents ) + { + // Two GdkDisplays may be open + if( !pEnv || !*pEnv ) ++ { + gdk_display_pointer_ungrab( getGdkDisplay(), GDK_CURRENT_TIME); ++ } + } + } + #else +@@ -2771,6 +2785,27 @@ void GtkSalFrame::grabPointer( bool bGrab, bool bOwnerEvents ) + #endif + } + ++void GtkSalFrame::grabKeyboard( bool bGrab ) ++{ ++#if !GTK_CHECK_VERSION(3,0,0) ++ if( m_pWindow ) ++ { ++ if( bGrab ) ++ { ++ gdk_keyboard_grab(widget_get_window(m_pWindow), true, ++ GDK_CURRENT_TIME); ++ } ++ else ++ { ++ gdk_keyboard_ungrab(GDK_CURRENT_TIME); ++ } ++ } ++#else ++ (void)bGrab; ++ //FIXME: No GrabKeyboard implementation for gtk3 ... ++#endif ++} ++ + void GtkSalFrame::CaptureMouse( bool bCapture ) + { + getDisplay()->CaptureMouse( bCapture ? this : NULL ); +-- +1.9.3 + diff --git a/libreoffice.spec b/libreoffice.spec index c29993d..79e6aae 100644 --- a/libreoffice.spec +++ b/libreoffice.spec @@ -320,6 +320,7 @@ Patch23: 0002-propagate-user-set-CFLAGS-to-build.patch Patch24: 0001-gdk-pixbuf-xlib-2.0-gdk-pixbuf-2.0.patch Patch25: 0001-Resolves-rhbz-1204244-group-sdb-windows-together-as-.patch Patch26: 0001-Resolves-tdf-90256-repair-invalid-docking-positions.patch +Patch27: 0001-gnome-745909-grab-ungrab-keyboard-for-menus.patch %define instdir %{_libdir} %define baseinstdir %{instdir}/libreoffice