summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorAntonio Fernandez <antonio.fernandez@aentos.es>2012-08-14 11:22:57 +0100
committerBjoern Michaelsen <bjoern.michaelsen@canonical.com>2012-11-14 13:52:42 +0100
commit62f6cf56fde7151a58f12cb05bdbd248cd59c369 (patch)
treed7427c8fda37c3eb5271f760f2ff42922a4463cf /vcl
parentacd0d512e9d06459753c6ab4bf65566995198041 (diff)
Fixed a regression with popup menus. Added a method to update menu every sec.
Change-Id: I419a304f2c90d07ee7a5365e0397040b7eb953d7
Diffstat (limited to 'vcl')
-rw-r--r--vcl/inc/unx/gtk/gtksalmenu.hxx1
-rw-r--r--vcl/unx/gtk/window/gtksalmenu.cxx22
2 files changed, 16 insertions, 7 deletions
diff --git a/vcl/inc/unx/gtk/gtksalmenu.hxx b/vcl/inc/unx/gtk/gtksalmenu.hxx
index d0ce612d254e..78ec7a1cf11e 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 0c78997e9177..642f2b877fd5 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++ ) {