[Libreoffice-commits] .: Branch 'feature/unitymenus' - vcl/inc vcl/unx

Antonio Fernandez afernandez at kemper.freedesktop.org
Tue Aug 14 03:24:35 PDT 2012


 vcl/inc/unx/gtk/gtksalmenu.hxx    |    1 -
 vcl/unx/gtk/window/gtksalmenu.cxx |   22 ++++++++++++++++------
 2 files changed, 16 insertions(+), 7 deletions(-)

New commits:
commit 02f0ab10969751353bd850f9704da7ef975b6926
Author: Antonio Fernandez <antonio.fernandez at aentos.es>
Date:   Tue Aug 14 11:22:57 2012 +0100

    Fixed a regression with popup menus. Added a method to update menu every sec.
    
    Change-Id: I419a304f2c90d07ee7a5365e0397040b7eb953d7

diff --git a/vcl/inc/unx/gtk/gtksalmenu.hxx b/vcl/inc/unx/gtk/gtksalmenu.hxx
index d0ce612..78ec7a1 100644
--- a/vcl/inc/unx/gtk/gtksalmenu.hxx
+++ b/vcl/inc/unx/gtk/gtksalmenu.hxx
@@ -88,7 +88,6 @@ public:
     virtual void                SetAccelerator( unsigned nPos, SalMenuItem* pSalMenuItem, const KeyCode& rKeyCode, const rtl::OUString& rKeyName );
     virtual void                GetSystemMenuData( SystemMenuData* pData );
     virtual void                SetItemCommand( unsigned nPos, SalMenuItem* pSalMenuItem, const rtl::OUString& aCommandStr );
-    virtual bool                ShowNativePopupMenu(FloatingWindow * pWin, const Rectangle& rRect, sal_uLong nFlags);
     virtual void                Freeze();
 
     virtual void                SetMenu( Menu* pMenu ) { mpVCLMenu = pMenu; }
diff --git a/vcl/unx/gtk/window/gtksalmenu.cxx b/vcl/unx/gtk/window/gtksalmenu.cxx
index 0c78997..642f2b8 100644
--- a/vcl/unx/gtk/window/gtksalmenu.cxx
+++ b/vcl/unx/gtk/window/gtksalmenu.cxx
@@ -202,6 +202,7 @@ GtkSalMenu::GtkSalMenu( sal_Bool bMenuBar ) :
 
 GtkSalMenu::~GtkSalMenu()
 {
+    // FIXME: Not sure if we need to unset X Properties.
     if ( mpFrame ) {
         GtkWidget *widget = GTK_WIDGET( mpFrame->getWindow() );
         GdkWindow *gdkWindow = gtk_widget_get_window( widget );
@@ -241,7 +242,7 @@ GtkSalMenu::~GtkSalMenu()
 
 sal_Bool GtkSalMenu::VisibleMenuBar()
 {
-    return sal_False;
+    return sal_True;
 }
 
 void GtkSalMenu::InsertItem( SalMenuItem* pSalMenuItem, unsigned nPos )
@@ -284,6 +285,16 @@ void GtkSalMenu::SetSubMenu( SalMenuItem* pSalMenuItem, SalMenu* pSubMenu, unsig
     }
 }
 
+void updateNativeMenu( GtkSalMenu* pMenu );
+
+gboolean GenerateMenu(gpointer user_data) {
+    cout << "Generating menu..." << endl;
+    GtkSalMenu* pSalMenu = static_cast< GtkSalMenu* >( user_data );
+    updateNativeMenu( pSalMenu );
+
+    return TRUE;
+}
+
 void GtkSalMenu::SetFrame( const SalFrame* pFrame )
 {
     mpFrame = static_cast<const GtkSalFrame*>( pFrame );
@@ -306,6 +317,10 @@ void GtkSalMenu::SetFrame( const SalFrame* pFrame )
 
         // Try to publish the menu with the right bus data.
         Freeze();
+
+        // Refresh the menu every second.
+        // This code is a workaround until required modifications in Gtk+ are available.
+//        g_timeout_add( 1000, GenerateMenu, this );
     }
 }
 
@@ -391,11 +406,6 @@ void GtkSalMenu::GetSystemMenuData( SystemMenuData* pData )
 {
 }
 
-bool GtkSalMenu::ShowNativePopupMenu(FloatingWindow * pWin, const Rectangle& rRect, sal_uLong nFlags)
-{
-    return TRUE;
-}
-
 void updateNativeMenu( GtkSalMenu* pMenu ) {
     if ( pMenu ) {
         for ( sal_uInt16 i = 0; i < pMenu->GetItemCount(); i++ ) {


More information about the Libreoffice-commits mailing list