[Libreoffice-commits] .: 98 commits - framework/inc framework/source vcl/inc vcl/Library_vcl.mk vcl/Library_vclplug_gtk3.mk vcl/Library_vclplug_gtk.mk vcl/source vcl/unx
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Wed Nov 14 04:53:56 PST 2012
framework/inc/classes/menumanager.hxx | 2
framework/inc/uielement/menubarmanager.hxx | 2
framework/source/classes/menumanager.cxx | 4
framework/source/uielement/menubarmanager.cxx | 11
vcl/Library_vcl.mk | 6
vcl/Library_vclplug_gtk.mk | 20
vcl/Library_vclplug_gtk3.mk | 4
vcl/inc/salmenu.hxx | 9
vcl/inc/unx/gtk/gloactiongroup.h | 95 +++
vcl/inc/unx/gtk/glomenu.h | 148 ++++
vcl/inc/unx/gtk/gtkframe.hxx | 12
vcl/inc/unx/gtk/gtkinst.hxx | 5
vcl/inc/unx/gtk/gtksalmenu.hxx | 137 ++++
vcl/inc/unx/gtk/hudawareness.h | 44 +
vcl/inc/unx/salmenu.h | 8
vcl/inc/vcl/menu.hxx | 56 -
vcl/source/window/menu.cxx | 8
vcl/unx/gtk/app/gtkinst.cxx | 34 +
vcl/unx/gtk/window/gloactiongroup.cxx | 421 +++++++++++++
vcl/unx/gtk/window/glomenu.cxx | 666 +++++++++++++++++++++
vcl/unx/gtk/window/gtkframe.cxx | 223 ++++++-
vcl/unx/gtk/window/gtksalmenu.cxx | 813 ++++++++++++++++++++++++++
vcl/unx/gtk/window/hudawareness.cxx | 115 +++
vcl/unx/gtk3/window/gtk3gloactiongroup.cxx | 2
vcl/unx/gtk3/window/gtk3glomenu.cxx | 2
vcl/unx/gtk3/window/gtk3gtksalmenu.cxx | 2
vcl/unx/gtk3/window/gtk3hudawareness.cxx | 1
27 files changed, 2789 insertions(+), 61 deletions(-)
New commits:
commit 349fa28a5998d10b110da1a7fcc6b5b24d5940b1
Author: Michael Meeks <michael.meeks at suse.com>
Date: Wed Nov 14 11:49:08 2012 +0000
cleanup gmenu conditionals, remove redundant casts.
Change-Id: I51ee0f6c8671c914626cf4332408b4e2b4918b47
diff --git a/vcl/inc/unx/gtk/gtksalmenu.hxx b/vcl/inc/unx/gtk/gtksalmenu.hxx
index 05e1af9..03aa700 100644
--- a/vcl/inc/unx/gtk/gtksalmenu.hxx
+++ b/vcl/inc/unx/gtk/gtksalmenu.hxx
@@ -31,7 +31,9 @@
#include <unx/gtk/gtkframe.hxx>
#if defined(ENABLE_DBUS) && defined(ENABLE_GIO)
-# define ENABLE_GMENU_INTEGRATION
+# ifdef GLIB_AVAILABLE_IN_2_32
+# define ENABLE_GMENU_INTEGRATION
+# endif
# include <unx/gtk/glomenu.h>
# include <unx/gtk/gloactiongroup.h>
#else
diff --git a/vcl/unx/gtk/app/gtkinst.cxx b/vcl/unx/gtk/app/gtkinst.cxx
index 38786f7..294fd1a 100644
--- a/vcl/unx/gtk/app/gtkinst.cxx
+++ b/vcl/unx/gtk/app/gtkinst.cxx
@@ -510,49 +510,37 @@ SalBitmap* GtkInstance::CreateSalBitmap()
#endif
}
-#if defined(ENABLE_DBUS) && defined(ENABLE_GIO)
+#ifdef ENABLE_GMENU_INTEGRATION
+
SalMenu* GtkInstance::CreateMenu( sal_Bool bMenuBar, Menu* pVCLMenu )
{
GtkSalMenu* pSalMenu = new GtkSalMenu( bMenuBar );
pSalMenu->SetMenu( pVCLMenu );
-
- return static_cast<SalMenu*>( pSalMenu );
+ return pSalMenu;
}
-#else
-SalMenu* GtkInstance::CreateMenu( sal_Bool, Menu* ) { return NULL; }
-#endif
-#if defined(ENABLE_DBUS) && defined(ENABLE_GIO)
void GtkInstance::DestroyMenu( SalMenu* pMenu )
{
- (void)pMenu;
delete pMenu;
-// OSL_ENSURE( pMenu == 0, "DestroyMenu called with non-native menus" );
}
-#else
-void GtkInstance::DestroyMenu( SalMenu* ) {}
-#endif
-#if defined(ENABLE_DBUS) && defined(ENABLE_GIO)
SalMenuItem* GtkInstance::CreateMenuItem( const SalItemParams* pItemData )
{
- GtkSalMenuItem* pMenuItem = new GtkSalMenuItem( pItemData );
-
- return static_cast<SalMenuItem*>( pMenuItem );
+ return new GtkSalMenuItem( pItemData );
}
-#else
-SalMenuItem* GtkInstance::CreateMenuItem( const SalItemParams* ) { return NULL; }
-#endif
-#if defined(ENABLE_DBUS) && defined(ENABLE_GIO)
void GtkInstance::DestroyMenuItem( SalMenuItem* pItem )
{
- (void)pItem;
delete pItem;
-// OSL_ENSURE( pItem == 0, "DestroyMenu called with non-native menus" );
}
-#else
-void GtkInstance::DestroyMenuItem( SalMenuItem* ) {}
+
+#else // not ENABLE_GMENU_INTEGRATION
+
+SalMenu* GtkInstance::CreateMenu( sal_Bool, Menu* ) { return NULL; }
+void GtkInstance::DestroyMenu( SalMenu* ) {}
+SalMenuItem* GtkInstance::CreateMenuItem( const SalItemParams* ) { return NULL; }
+void GtkInstance::DestroyMenuItem( SalMenuItem* ) {}
+
#endif
SalTimer* GtkInstance::CreateSalTimer()
commit dc3ada4db5f6311aaf3154aed0bba17d96c2af9a
Author: Michael Meeks <michael.meeks at suse.com>
Date: Wed Nov 14 11:39:53 2012 +0000
misc dbus menu integration fixes
Re-declare GMenuModel / GActionGroup if we don't have a recent enough gio.
Fix a number of compile warnings.
use the standard gnumake macros / linking for ENABLE_GIO & ENABLE_DBUS
Initialize GDBusInterfaceVTable cleanly.
Take the Solar Mutex on hud_activated.
Change-Id: Ie0c1d6e75c4be857f0db1adad36418dd1693f63e
diff --git a/vcl/Library_vclplug_gtk.mk b/vcl/Library_vclplug_gtk.mk
index c43173a..41e6037 100644
--- a/vcl/Library_vclplug_gtk.mk
+++ b/vcl/Library_vclplug_gtk.mk
@@ -52,6 +52,7 @@ $(eval $(call gb_Library_use_libraries,vclplug_gtk,\
$(eval $(call gb_Library_use_externals,vclplug_gtk,\
dbus \
+ gio \
gtk \
gthread \
icule \
@@ -103,10 +104,6 @@ $(eval $(call gb_Library_add_exception_objects,vclplug_gtk,\
vcl/unx/gtk/window/glomenu \
vcl/unx/gtk/window/hudawareness \
))
-$(eval $(call gb_Library_add_defs,vclplug_gtk,\
- -DENABLE_GIO=$(ENABLE_GIO) \
- -DENABLE_DBUS=$(ENABLE_DBUS) \
-))
endif
endif
diff --git a/vcl/inc/unx/gtk/gtksalmenu.hxx b/vcl/inc/unx/gtk/gtksalmenu.hxx
index 313da51..05e1af9 100644
--- a/vcl/inc/unx/gtk/gtksalmenu.hxx
+++ b/vcl/inc/unx/gtk/gtksalmenu.hxx
@@ -29,8 +29,19 @@
#include <unx/salmenu.h>
#include <unx/gtk/gtkframe.hxx>
-#include <unx/gtk/glomenu.h>
-#include <unx/gtk/gloactiongroup.h>
+
+#if defined(ENABLE_DBUS) && defined(ENABLE_GIO)
+# define ENABLE_GMENU_INTEGRATION
+# include <unx/gtk/glomenu.h>
+# include <unx/gtk/gloactiongroup.h>
+#else
+# ifndef GLIB_AVAILABLE_IN_2_32
+ typedef void GMenuModel;
+# endif
+# ifndef GLIB_AVAILABLE_IN_2_28
+ typedef void GActionGroup;
+# endif
+#endif
class MenuItemList;
class GtkSalMenuItem;
diff --git a/vcl/inc/unx/gtk/hudawareness.h b/vcl/inc/unx/gtk/hudawareness.h
index 47c5f90..7d6b94f 100644
--- a/vcl/inc/unx/gtk/hudawareness.h
+++ b/vcl/inc/unx/gtk/hudawareness.h
@@ -29,7 +29,6 @@ G_BEGIN_DECLS
typedef void (* HudAwarenessCallback) (gboolean hud_active,
gpointer user_data);
-
guint hud_awareness_register (GDBusConnection *connection,
const gchar *object_path,
HudAwarenessCallback callback,
diff --git a/vcl/unx/gtk/window/gtkframe.cxx b/vcl/unx/gtk/window/gtkframe.cxx
index 0f76ce2..c4fa0df 100644
--- a/vcl/unx/gtk/window/gtkframe.cxx
+++ b/vcl/unx/gtk/window/gtkframe.cxx
@@ -17,7 +17,6 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-
#include <unx/gtk/gtkframe.hxx>
#include <unx/gtk/gtkdata.hxx>
#include <unx/gtk/gtkinst.hxx>
@@ -33,13 +32,11 @@
#include <vcl/svapp.hxx>
#include <vcl/window.hxx>
#if !GTK_CHECK_VERSION(3,0,0)
-#include <unx/x11/xlimits.hxx>
+# include <unx/x11/xlimits.hxx>
#endif
#if defined(ENABLE_DBUS) && defined(ENABLE_GIO)
-#include <unx/gtk/glomenu.h>
-#include <unx/gtk/gloactiongroup.h>
-#include <unx/gtk/gtksalmenu.hxx>
-#include <unx/gtk/hudawareness.h>
+# include <unx/gtk/gtksalmenu.hxx>
+# include <unx/gtk/hudawareness.h>
#endif
#include <gtk/gtk.h>
@@ -61,7 +58,7 @@
#include <algorithm>
#if OSL_DEBUG_LEVEL > 1
-#include <cstdio>
+# include <cstdio>
#endif
#include <com/sun/star/accessibility/XAccessibleContext.hpp>
@@ -511,7 +508,7 @@ gdk_x11_window_set_utf8_property (GdkWindow *window,
// AppMenu watch functions.
-#if defined(ENABLE_DBUS) && defined(ENABLE_GIO)
+#ifdef ENABLE_GMENU_INTEGRATION
static void ObjectDestroyedNotify( gpointer data )
{
if ( data ) {
@@ -523,6 +520,7 @@ static void hud_activated( gboolean hud_active, gpointer user_data )
{
if ( hud_activated )
{
+ SolarMutexGuard aGuard;
GtkSalFrame* pSalFrame = reinterpret_cast< GtkSalFrame* >( user_data );
GtkSalMenu* pSalMenu = reinterpret_cast< GtkSalMenu* >( pSalFrame->GetMenu() );
@@ -555,13 +553,13 @@ gboolean ensure_dbus_setup( gpointer data )
gchar* aDBusMenubarPath = g_strdup_printf( "/window/%lu/menus/menubar", windowId );
// Set window properties.
- g_object_set_data_full( G_OBJECT(gdkWindow), "g-lo-menubar", pMenuModel, ObjectDestroyedNotify);
- g_object_set_data_full( G_OBJECT(gdkWindow), "g-lo-action-group", pActionGroup, ObjectDestroyedNotify);
+ g_object_set_data_full( G_OBJECT( gdkWindow ), "g-lo-menubar", pMenuModel, ObjectDestroyedNotify );
+ g_object_set_data_full( G_OBJECT( gdkWindow ), "g-lo-action-group", pActionGroup, ObjectDestroyedNotify );
- gdk_x11_window_set_utf8_property ( gdkWindow, "_GTK_UNIQUE_BUS_NAME", g_dbus_connection_get_unique_name( pSessionBus ) );
- gdk_x11_window_set_utf8_property ( gdkWindow, "_GTK_APPLICATION_OBJECT_PATH", "" );
- gdk_x11_window_set_utf8_property ( gdkWindow, "_GTK_WINDOW_OBJECT_PATH", aDBusWindowPath );
- gdk_x11_window_set_utf8_property ( gdkWindow, "_GTK_MENUBAR_OBJECT_PATH", aDBusMenubarPath );
+ gdk_x11_window_set_utf8_property( gdkWindow, "_GTK_UNIQUE_BUS_NAME", g_dbus_connection_get_unique_name( pSessionBus ) );
+ gdk_x11_window_set_utf8_property( gdkWindow, "_GTK_APPLICATION_OBJECT_PATH", "" );
+ gdk_x11_window_set_utf8_property( gdkWindow, "_GTK_WINDOW_OBJECT_PATH", aDBusWindowPath );
+ gdk_x11_window_set_utf8_property( gdkWindow, "_GTK_MENUBAR_OBJECT_PATH", aDBusMenubarPath );
// Publish the menu model and the action group.
SAL_INFO("vcl.unity", "exporting menu model at " << pMenuModel << " for window " << windowId);
@@ -576,7 +574,7 @@ gboolean ensure_dbus_setup( gpointer data )
return FALSE;
}
-
+
void on_registrar_available( GDBusConnection * /*connection*/,
const gchar * /*name*/,
const gchar * /*name_owner*/,
@@ -619,7 +617,7 @@ void on_registrar_unavailable( GDBusConnection * /*connection*/,
void GtkSalFrame::EnsureAppMenuWatch()
{
-#if defined(ENABLE_DBUS) && defined(ENABLE_GIO)
+#ifdef ENABLE_GMENU_INTEGRATION
if ( !m_nWatcherId )
{
// Get a DBus session connection.
diff --git a/vcl/unx/gtk/window/hudawareness.cxx b/vcl/unx/gtk/window/hudawareness.cxx
index b36f553..ee5d715 100644
--- a/vcl/unx/gtk/window/hudawareness.cxx
+++ b/vcl/unx/gtk/window/hudawareness.cxx
@@ -19,6 +19,7 @@
* Author: Ryan Lortie <desrt at desrt.ca>
*/
+#include <string.h>
#include <unx/gtk/hudawareness.h>
typedef struct
@@ -30,10 +31,10 @@ typedef struct
} HudAwarenessHandle;
static void
-hud_awareness_method_call (GDBusConnection *connection,
- const gchar *sender,
- const gchar *object_path,
- const gchar *interface_name,
+hud_awareness_method_call (GDBusConnection * /* connection */,
+ const gchar * /* sender */,
+ const gchar * /* object_path */,
+ const gchar * /* interface_name */,
const gchar *method_name,
GVariant *parameters,
GDBusMethodInvocation *invocation,
@@ -53,19 +54,6 @@ hud_awareness_method_call (GDBusConnection *connection,
g_dbus_method_invocation_return_value (invocation, NULL);
}
-static void
-hud_awareness_handle_free (gpointer data)
-{
- HudAwarenessHandle *handle = (HudAwarenessHandle*) data;
-
- g_object_unref (handle->connection);
-
- if (handle->notify)
- (* handle->notify) (handle->user_data);
-
- g_slice_free (HudAwarenessHandle, handle);
-}
-
guint
hud_awareness_register (GDBusConnection *connection,
const gchar *object_path,
@@ -75,15 +63,16 @@ hud_awareness_register (GDBusConnection *connection,
GError **error)
{
static GDBusInterfaceInfo *iface;
- GDBusInterfaceVTable vtable = {
- hud_awareness_method_call
- };
+ GDBusInterfaceVTable vtable;
HudAwarenessHandle *handle;
guint object_id;
+ memset ((void *)&vtable, 0, sizeof (vtable));
+ vtable.method_call = hud_awareness_method_call;
+
if G_UNLIKELY (iface == NULL)
{
- GError *error = NULL;
+ GError *local_error = NULL;
GDBusNodeInfo *info;
info = g_dbus_node_info_new_for_xml ("<node>"
@@ -94,8 +83,8 @@ hud_awareness_register (GDBusConnection *connection,
"</method>"
"</interface>"
"</node>",
- &error);
- g_assert_no_error (error);
+ &local_error);
+ g_assert_no_error (local_error);
iface = g_dbus_node_info_lookup_interface (info, "com.canonical.hud.Awareness");
g_assert (iface != NULL);
}
commit e5e55d450d674bdfde6c86992274d8e22f949eb6
Author: Michael Meeks <michael.meeks at suse.com>
Date: Wed Nov 14 10:58:40 2012 +0000
gbooleans are true if non-zero, bin == TRUE comparisons.
Change-Id: Ieb6c73993b3ef3854d81fdeb81661d75f1fe954f
diff --git a/vcl/unx/gtk/window/gloactiongroup.cxx b/vcl/unx/gtk/window/gloactiongroup.cxx
index 756779a..ac16865 100644
--- a/vcl/unx/gtk/window/gloactiongroup.cxx
+++ b/vcl/unx/gtk/window/gloactiongroup.cxx
@@ -192,7 +192,7 @@ g_lo_action_group_perform_submenu_action (GLOActionGroup *group,
if (pSalMenu != NULL) {
gboolean bState = g_variant_get_boolean (state);
- if (bState == TRUE)
+ if (bState)
pSalMenu->Activate (action_name);
else
pSalMenu->Deactivate (action_name);
@@ -215,7 +215,7 @@ g_lo_action_group_change_state (GActionGroup *group,
if (action != NULL)
{
- if (action->submenu == TRUE)
+ if (action->submenu)
g_lo_action_group_perform_submenu_action (lo_group, action_name, value);
else
{
@@ -229,7 +229,7 @@ g_lo_action_group_change_state (GActionGroup *group,
is_new = TRUE;
}
- if (g_variant_is_of_type (value, action->state_type) == TRUE)
+ if (g_variant_is_of_type (value, action->state_type))
{
if (action->state)
g_variant_unref(action->state);
diff --git a/vcl/unx/gtk/window/gtksalmenu.cxx b/vcl/unx/gtk/window/gtksalmenu.cxx
index 7c1517e..fa4f228 100644
--- a/vcl/unx/gtk/window/gtksalmenu.cxx
+++ b/vcl/unx/gtk/window/gtksalmenu.cxx
@@ -533,11 +533,11 @@ void GtkSalMenu::NativeCheckItem( unsigned nSection, unsigned nItemPos, MenuItem
GVariant *pCurrentState = g_action_group_get_action_state( mpActionGroup, aCommand );
if ( bits & MIB_RADIOCHECK )
- pCheckValue = ( bCheck == TRUE ) ? g_variant_new_string( aCommand ) : g_variant_new_string( "" );
+ pCheckValue = bCheck ? g_variant_new_string( aCommand ) : g_variant_new_string( "" );
else
{
// By default, all checked items are checkmark buttons.
- if ( bCheck == TRUE || ( ( bCheck == FALSE ) && pCurrentState != NULL ) )
+ if ( bCheck || ( !bCheck && pCurrentState != NULL ) )
pCheckValue = g_variant_new_boolean( bCheck );
}
@@ -614,7 +614,7 @@ void GtkSalMenu::NativeSetItemCommand( unsigned nSection,
GVariant *pTarget = NULL;
if ( g_action_group_has_action( mpActionGroup, aCommand ) == FALSE ) {
- if ( ( nBits & MIB_CHECKABLE ) || ( bIsSubmenu == TRUE ) )
+ if ( ( nBits & MIB_CHECKABLE ) || bIsSubmenu )
{
// Item is a checkmark button.
GVariantType* pStateType = g_variant_type_new( (gchar*) G_VARIANT_TYPE_BOOLEAN );
@@ -650,7 +650,7 @@ void GtkSalMenu::NativeSetItemCommand( unsigned nSection,
gchar* aItemCommand = g_strconcat("win.", aCommand, NULL );
- if ( bIsSubmenu == TRUE )
+ if ( bIsSubmenu )
g_lo_menu_set_submenu_action_to_item_in_section( pMenu, nSection, nItemPos, aItemCommand );
else
g_lo_menu_set_action_and_target_value_to_item_in_section( pMenu, nSection, nItemPos, aItemCommand, pTarget );
@@ -676,7 +676,7 @@ GtkSalMenu* GtkSalMenu::GetMenuForItemCommand( gchar* aCommand, gboolean bGetSub
if ( g_strcmp0( aItemCommandStr, aCommand ) == 0 )
{
- pMenu = ( bGetSubmenu == TRUE ) ? pSalItem->mpSubMenu : this;
+ pMenu = bGetSubmenu ? pSalItem->mpSubMenu : this;
break;
}
else
commit f5804cddbc2d103cabf7054905dc1bd59512b9b6
Author: Michael Meeks <michael.meeks at suse.com>
Date: Wed Nov 14 10:51:07 2012 +0000
remove unused prototype
Change-Id: If3deb18695d0bef3545d6aef5e598435996a7207
diff --git a/vcl/inc/unx/gtk/gtksalmenu.hxx b/vcl/inc/unx/gtk/gtksalmenu.hxx
index 53095b8..313da51 100644
--- a/vcl/inc/unx/gtk/gtksalmenu.hxx
+++ b/vcl/inc/unx/gtk/gtksalmenu.hxx
@@ -32,15 +32,9 @@
#include <unx/gtk/glomenu.h>
#include <unx/gtk/gloactiongroup.h>
-
class MenuItemList;
class GtkSalMenuItem;
-
-// Generate the complete structure of a menu.
-//static void GenerateFullMenu( GtkSalMenu* pSalMenu );
-
-
class GtkSalMenu : public SalMenu
{
private:
commit 95493223f2a7198ddc9998c128a1c49e13fccb65
Author: Michael Meeks <michael.meeks at suse.com>
Date: Wed Nov 14 10:48:03 2012 +0000
fix typo with ENABLE_DBUS.
Change-Id: I4955fc9991ee88edde0d332b7e399ef5b807c4cc
diff --git a/vcl/Library_vclplug_gtk.mk b/vcl/Library_vclplug_gtk.mk
index a95ea19..c43173a 100644
--- a/vcl/Library_vclplug_gtk.mk
+++ b/vcl/Library_vclplug_gtk.mk
@@ -105,7 +105,7 @@ $(eval $(call gb_Library_add_exception_objects,vclplug_gtk,\
))
$(eval $(call gb_Library_add_defs,vclplug_gtk,\
-DENABLE_GIO=$(ENABLE_GIO) \
- -DENABLE_DBUS=#(ENABLE_DBUS) \
+ -DENABLE_DBUS=$(ENABLE_DBUS) \
))
endif
endif
commit 041f2fb1059d8ab02abffa0972dad1400a1aa584
Author: Michael Meeks <michael.meeks at suse.com>
Date: Wed Nov 14 10:45:38 2012 +0000
remove redundant commented code.
Change-Id: Ia311bdd148cf4c346c187d3b37964b12cded1212
diff --git a/vcl/inc/salmenu.hxx b/vcl/inc/salmenu.hxx
index 5bea401..77b1cd7 100644
--- a/vcl/inc/salmenu.hxx
+++ b/vcl/inc/salmenu.hxx
@@ -82,7 +82,7 @@ public:
virtual bool AddMenuBarButton( const SalMenuButtonItem& ); // return false if not implemented or failure
virtual void RemoveMenuBarButton( sal_uInt16 nId );
- // FIXME: Make the other VCL native backends to work with these new methods.
+ // TODO: implement show/hide for the Win/Mac VCL native backends
virtual void ShowItem( unsigned nPos, sal_Bool bShow ) { EnableItem( nPos, bShow ); }
// return an empty rectangle if not implemented
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index 7fbc21a..b6606b3 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -1797,10 +1797,7 @@ void Menu::ShowItem( sal_uInt16 nItemId, sal_Bool bVisible )
pData->bVisible = bVisible;
// update native menu
- // as long as there is no support to hide native menu entries, we just disable them
- // TODO: add support to show/hide native menu entries
if( ImplGetSalMenu() )
-// ImplGetSalMenu()->EnableItem( nPos, bVisible );
ImplGetSalMenu()->ShowItem( nPos, bVisible );
}
}
commit 6bea834b4a4cc50b5eb3d53cf685ecb5e5ada315
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Wed Nov 14 09:40:46 2012 +0100
only enable unity integration with enabled dbus and gio
Change-Id: I418e3c57e7c201529020864b1f4677ec4c24e2c8
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index d62af49..57fd4cf 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -97,8 +97,13 @@ $(eval $(call gb_Library_use_externals,vcl,\
icule \
icuuc \
lcms2 \
+))
+
+ifneq ($(ENABLE_GIO),)
+$(eval $(call gb_Library_use_externals,vcl,\
gio \
))
+endif
$(eval $(call gb_Library_add_exception_objects,vcl,\
vcl/source/app/brand \
diff --git a/vcl/Library_vclplug_gtk.mk b/vcl/Library_vclplug_gtk.mk
index a70ce09..a95ea19 100644
--- a/vcl/Library_vclplug_gtk.mk
+++ b/vcl/Library_vclplug_gtk.mk
@@ -89,16 +89,27 @@ $(eval $(call gb_Library_add_exception_objects,vclplug_gtk,\
vcl/unx/gtk/gdi/salnativewidgets-gtk \
vcl/unx/gtk/window/gtkframe \
vcl/unx/gtk/window/gtkobject \
- vcl/unx/gtk/window/gloactiongroup \
- vcl/unx/gtk/window/gtksalmenu \
- vcl/unx/gtk/window/glomenu \
- vcl/unx/gtk/window/hudawareness \
vcl/unx/gtk/fpicker/resourceprovider \
vcl/unx/gtk/fpicker/SalGtkPicker \
vcl/unx/gtk/fpicker/SalGtkFilePicker \
vcl/unx/gtk/fpicker/SalGtkFolderPicker \
))
+ifneq ($(ENABLE_DBUS),)
+ifneq ($(ENABLE_GIO),)
+$(eval $(call gb_Library_add_exception_objects,vclplug_gtk,\
+ vcl/unx/gtk/window/gloactiongroup \
+ vcl/unx/gtk/window/gtksalmenu \
+ vcl/unx/gtk/window/glomenu \
+ vcl/unx/gtk/window/hudawareness \
+))
+$(eval $(call gb_Library_add_defs,vclplug_gtk,\
+ -DENABLE_GIO=$(ENABLE_GIO) \
+ -DENABLE_DBUS=#(ENABLE_DBUS) \
+))
+endif
+endif
+
ifeq ($(ENABLE_GTK_PRINT),TRUE)
$(eval $(call gb_Library_add_exception_objects,vclplug_gtk,\
vcl/unx/gtk/gdi/gtkprintwrapper \
diff --git a/vcl/unx/gtk/app/gtkinst.cxx b/vcl/unx/gtk/app/gtkinst.cxx
index 642d785..38786f7 100644
--- a/vcl/unx/gtk/app/gtkinst.cxx
+++ b/vcl/unx/gtk/app/gtkinst.cxx
@@ -510,6 +510,7 @@ SalBitmap* GtkInstance::CreateSalBitmap()
#endif
}
+#if defined(ENABLE_DBUS) && defined(ENABLE_GIO)
SalMenu* GtkInstance::CreateMenu( sal_Bool bMenuBar, Menu* pVCLMenu )
{
GtkSalMenu* pSalMenu = new GtkSalMenu( bMenuBar );
@@ -517,27 +518,42 @@ SalMenu* GtkInstance::CreateMenu( sal_Bool bMenuBar, Menu* pVCLMenu )
return static_cast<SalMenu*>( pSalMenu );
}
+#else
+SalMenu* GtkInstance::CreateMenu( sal_Bool, Menu* ) { return NULL; }
+#endif
+#if defined(ENABLE_DBUS) && defined(ENABLE_GIO)
void GtkInstance::DestroyMenu( SalMenu* pMenu )
{
(void)pMenu;
delete pMenu;
// OSL_ENSURE( pMenu == 0, "DestroyMenu called with non-native menus" );
}
+#else
+void GtkInstance::DestroyMenu( SalMenu* ) {}
+#endif
+#if defined(ENABLE_DBUS) && defined(ENABLE_GIO)
SalMenuItem* GtkInstance::CreateMenuItem( const SalItemParams* pItemData )
{
GtkSalMenuItem* pMenuItem = new GtkSalMenuItem( pItemData );
return static_cast<SalMenuItem*>( pMenuItem );
}
+#else
+SalMenuItem* GtkInstance::CreateMenuItem( const SalItemParams* ) { return NULL; }
+#endif
+#if defined(ENABLE_DBUS) && defined(ENABLE_GIO)
void GtkInstance::DestroyMenuItem( SalMenuItem* pItem )
{
(void)pItem;
delete pItem;
// OSL_ENSURE( pItem == 0, "DestroyMenu called with non-native menus" );
}
+#else
+void GtkInstance::DestroyMenuItem( SalMenuItem* ) {}
+#endif
SalTimer* GtkInstance::CreateSalTimer()
{
diff --git a/vcl/unx/gtk/window/gtkframe.cxx b/vcl/unx/gtk/window/gtkframe.cxx
index 80e4d19..0f76ce2 100644
--- a/vcl/unx/gtk/window/gtkframe.cxx
+++ b/vcl/unx/gtk/window/gtkframe.cxx
@@ -22,10 +22,6 @@
#include <unx/gtk/gtkdata.hxx>
#include <unx/gtk/gtkinst.hxx>
#include <unx/gtk/gtkgdi.hxx>
-#include <unx/gtk/glomenu.h>
-#include <unx/gtk/gloactiongroup.h>
-#include <unx/gtk/gtksalmenu.hxx>
-#include <unx/gtk/hudawareness.h>
#include <vcl/keycodes.hxx>
#include <unx/wmadaptor.hxx>
#include <unx/sm.hxx>
@@ -39,6 +35,12 @@
#if !GTK_CHECK_VERSION(3,0,0)
#include <unx/x11/xlimits.hxx>
#endif
+#if defined(ENABLE_DBUS) && defined(ENABLE_GIO)
+#include <unx/gtk/glomenu.h>
+#include <unx/gtk/gloactiongroup.h>
+#include <unx/gtk/gtksalmenu.hxx>
+#include <unx/gtk/hudawareness.h>
+#endif
#include <gtk/gtk.h>
#include <tools/prex.h>
@@ -99,7 +101,10 @@ using namespace com::sun::star;
int GtkSalFrame::m_nFloats = 0;
+#if defined(ENABLE_DBUS) && defined(ENABLE_GIO)
static GDBusConnection* pSessionBus = NULL;
+#endif
+
static sal_uInt16 GetKeyModCode( guint state )
{
sal_uInt16 nCode = 0;
@@ -479,7 +484,7 @@ GtkSalFrame::GtkSalFrame( SystemParentData* pSysData )
Init( pSysData );
}
-#if !GTK_CHECK_VERSION(3,0,0)
+#if !GTK_CHECK_VERSION(3,0,0) && defined(ENABLE_DBUS) && defined(ENABLE_GIO)
static void
gdk_x11_window_set_utf8_property (GdkWindow *window,
const gchar *name,
@@ -506,6 +511,7 @@ gdk_x11_window_set_utf8_property (GdkWindow *window,
// AppMenu watch functions.
+#if defined(ENABLE_DBUS) && defined(ENABLE_GIO)
static void ObjectDestroyedNotify( gpointer data )
{
if ( data ) {
@@ -609,9 +615,11 @@ void on_registrar_unavailable( GDBusConnection * /*connection*/,
pGtkSalMenu->Display( sal_False );
}
}
+#endif
void GtkSalFrame::EnsureAppMenuWatch()
{
+#if defined(ENABLE_DBUS) && defined(ENABLE_GIO)
if ( !m_nWatcherId )
{
// Get a DBus session connection.
@@ -634,6 +642,7 @@ void GtkSalFrame::EnsureAppMenuWatch()
}
//ensure_dbus_setup( this );
+#endif
}
GtkSalFrame::~GtkSalFrame()
@@ -679,12 +688,15 @@ GtkSalFrame::~GtkSalFrame()
gtk_widget_destroy( GTK_WIDGET( m_pFixedContainer ) );
{
SolarMutexGuard aGuard;
+#if defined(ENABLE_DBUS) && defined(ENABLE_GIO)
if(m_nWatcherId)
g_bus_unwatch_name(m_nWatcherId);
+#endif
if( m_pWindow )
{
g_object_set_data( G_OBJECT( m_pWindow ), "SalFrame", NULL );
+#if defined(ENABLE_DBUS) && defined(ENABLE_GIO)
if ( pSessionBus )
{
if ( m_nHudAwarenessId )
@@ -694,6 +706,7 @@ GtkSalFrame::~GtkSalFrame()
if ( m_nActionGroupExportId )
g_dbus_connection_unexport_action_group( pSessionBus, m_nActionGroupExportId );
}
+#endif
gtk_widget_destroy( m_pWindow );
}
}
@@ -1124,8 +1137,10 @@ void GtkSalFrame::Init( SalFrame* pParent, sal_uLong nStyle )
#if !GTK_CHECK_VERSION(3,0,0)
if( eWinType == GTK_WINDOW_TOPLEVEL )
{
+#if defined(ENABLE_DBUS) && defined(ENABLE_GIO)
// Enable DBus native menu if available.
ensure_dbus_setup( this );
+#endif
guint32 nUserTime = 0;
if( (nStyle & (SAL_FRAME_STYLE_OWNERDRAWDECORATION|SAL_FRAME_STYLE_TOOLWINDOW)) == 0 )
commit 62a803dc46c1ffb5cba7f094868ce339feeecfda
Author: Antonio Fernandez <antonio.fernandez at aentos.es>
Date: Tue Nov 13 16:38:09 2012 +0000
Removed AbstractMenu class and cleaned up useless code.
Change-Id: I4094302b83342fd42bccad4966b51624215d71ff
diff --git a/framework/inc/classes/menumanager.hxx b/framework/inc/classes/menumanager.hxx
index 8bdbb39..b26ee3f 100644
--- a/framework/inc/classes/menumanager.hxx
+++ b/framework/inc/classes/menumanager.hxx
@@ -72,7 +72,7 @@ class MenuManager : public ThreadHelpBase ,
MenuManager(
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
REFERENCE< XFRAME >& rFrame,
- AbstractMenu* pMenu,
+ Menu* pMenu,
sal_Bool bDelete,
sal_Bool bDeleteChildren );
@@ -84,33 +84,33 @@ class MenuManager : public ThreadHelpBase ,
// XEventListener
virtual void SAL_CALL disposing( const EVENTOBJECT& Source ) throw ( RUNTIMEEXCEPTION );
- DECL_LINK( Select, AbstractMenu * );
+ DECL_LINK( Select, Menu * );
- AbstractMenu* GetMenu() const { return m_pVCLMenu; }
+ Menu* GetMenu() const { return m_pVCLMenu; }
void RemoveListener();
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& getServiceFactory();
- static void UpdateSpecialWindowMenu( AbstractMenu* pMenu ,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,IMutex& _rMutex);
+ static void UpdateSpecialWindowMenu( Menu* pMenu ,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,IMutex& _rMutex);
static void FillMenuImages(
::com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& xFrame,
- AbstractMenu* _pMenu,
+ Menu* _pMenu,
sal_Bool bShowMenuImages
);
protected:
DECL_LINK(Highlight, void *);
- DECL_LINK( Activate, AbstractMenu * );
- DECL_LINK( Deactivate, AbstractMenu * );
+ DECL_LINK( Activate, Menu * );
+ DECL_LINK( Deactivate, Menu * );
private:
- void UpdateSpecialFileMenu( AbstractMenu* pMenu );
- void UpdateSpecialWindowMenu( AbstractMenu* pMenu );
+ void UpdateSpecialFileMenu( Menu* pMenu );
+ void UpdateSpecialWindowMenu( Menu* pMenu );
void ClearMenuDispatch(const EVENTOBJECT& Source = EVENTOBJECT(),bool _bRemoveOnly = true);
void SetHdl();
void AddMenu(PopupMenu* _pPopupMenu,const ::rtl::OUString& _sItemCommand,sal_uInt16 _nItemId,sal_Bool _bDelete,sal_Bool _bDeleteChildren);
- sal_uInt16 FillItemCommand(::rtl::OUString& _rItemCommand, AbstractMenu* _pMenu,sal_uInt16 _nIndex) const;
+ sal_uInt16 FillItemCommand(::rtl::OUString& _rItemCommand, Menu* _pMenu,sal_uInt16 _nIndex) const;
struct MenuItemHandler
@@ -141,7 +141,7 @@ class MenuManager : public ThreadHelpBase ,
sal_Bool m_bIsBookmarkMenu;
sal_Bool m_bShowMenuImages;
::rtl::OUString m_aMenuItemCommand;
- AbstractMenu* m_pVCLMenu;
+ Menu* m_pVCLMenu;
REFERENCE< XFRAME > m_xFrame;
::std::vector< MenuItemHandler* > m_aMenuItemHandlerVector;
diff --git a/framework/inc/uielement/menubarmanager.hxx b/framework/inc/uielement/menubarmanager.hxx
index 07f352b..e708fc3 100644
--- a/framework/inc/uielement/menubarmanager.hxx
+++ b/framework/inc/uielement/menubarmanager.hxx
@@ -111,7 +111,7 @@ class MenuBarManager : public com::sun::star::frame::XStatusListener
const ::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer >& _xURLTransformer,
const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& rDispatchProvider,
const rtl::OUString& aModuleIdentifier,
- AbstractMenu* pMenu,
+ Menu* pMenu,
sal_Bool bDelete,
sal_Bool bDeleteChildren );
@@ -146,22 +146,22 @@ class MenuBarManager : public com::sun::star::frame::XStatusListener
// XSystemDependentMenuPeer
virtual ::com::sun::star::uno::Any SAL_CALL getMenuHandle( const ::com::sun::star::uno::Sequence< sal_Int8 >& ProcessId, sal_Int16 SystemType ) throw (::com::sun::star::uno::RuntimeException);
- DECL_LINK( Select, AbstractMenu * );
+ DECL_LINK( Select, Menu * );
- AbstractMenu* GetMenuBar() const { return m_pVCLMenu; }
+ Menu* GetMenuBar() const { return m_pVCLMenu; }
// Configuration methods
- static void FillMenuWithConfiguration( sal_uInt16& nId, AbstractMenu* pMenu,
+ static void FillMenuWithConfiguration( sal_uInt16& nId, Menu* pMenu,
const ::rtl::OUString& rModuleIdentifier,
const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& rItemContainer,
const ::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer >& rTransformer );
static void FillMenu( sal_uInt16& nId,
- AbstractMenu* pMenu,
+ Menu* pMenu,
const ::rtl::OUString& rModuleIdentifier,
const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& rItemContainer,
const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& rDispatchProvider );
- void FillMenuManager( AbstractMenu* pMenu,
+ void FillMenuManager( Menu* pMenu,
const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame,
const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& rDispatchProvider,
const rtl::OUString& rModuleIdentifier,
@@ -172,8 +172,8 @@ class MenuBarManager : public com::sun::star::frame::XStatusListener
protected:
DECL_LINK(Highlight, void *);
- DECL_LINK( Activate, AbstractMenu * );
- DECL_LINK( Deactivate, AbstractMenu * );
+ DECL_LINK( Activate, Menu * );
+ DECL_LINK( Deactivate, Menu * );
DECL_LINK( AsyncSettingsHdl, Timer * );
void RemoveListener();
@@ -216,16 +216,16 @@ class MenuBarManager : public com::sun::star::frame::XStatusListener
void CreatePicklistArguments(
::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArgsList,
const MenuItemHandler* );
- void CheckAndAddMenuExtension( AbstractMenu* pMenu );
+ void CheckAndAddMenuExtension( Menu* pMenu );
static void impl_RetrieveShortcutsFromConfiguration( const ::com::sun::star::uno::Reference< ::com::sun::star::ui::XAcceleratorConfiguration >& rAccelCfg,
const ::com::sun::star::uno::Sequence< rtl::OUString >& rCommands,
std::vector< MenuItemHandler* >& aMenuShortCuts );
- static void MergeAddonMenus( AbstractMenu* pMenuBar, const MergeMenuInstructionContainer&, const ::rtl::OUString& aModuleIdentifier );
+ static void MergeAddonMenus( Menu* pMenuBar, const MergeMenuInstructionContainer&, const ::rtl::OUString& aModuleIdentifier );
MenuItemHandler* GetMenuItemHandler( sal_uInt16 nItemId );
sal_Bool CreatePopupMenuController( MenuItemHandler* pMenuItemHandler );
void AddMenu(MenuBarManager* pSubMenuManager,const ::rtl::OUString& _sItemCommand,sal_uInt16 _nItemId);
- sal_uInt16 FillItemCommand(::rtl::OUString& _rItemCommand, AbstractMenu* _pMenu,sal_uInt16 _nIndex) const;
+ sal_uInt16 FillItemCommand(::rtl::OUString& _rItemCommand, Menu* _pMenu,sal_uInt16 _nIndex) const;
void Init(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame,AddonMenu* pAddonMenu,sal_Bool bDelete,sal_Bool bDeleteChildren,bool _bHandlePopUp = false);
void SetHdl();
@@ -241,7 +241,7 @@ class MenuBarManager : public com::sun::star::frame::XStatusListener
sal_Bool m_bModuleIdentified;
::rtl::OUString m_aMenuItemCommand;
::rtl::OUString m_aModuleIdentifier;
- AbstractMenu* m_pVCLMenu;
+ Menu* m_pVCLMenu;
::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xFrame;
::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xUICommandLabels;
::com::sun::star::uno::Reference< ::com::sun::star::frame::XUIControllerRegistration > m_xPopupMenuControllerRegistration;
diff --git a/framework/inc/uielement/menubarmerger.hxx b/framework/inc/uielement/menubarmerger.hxx
index f44c91d..57586e7 100644
--- a/framework/inc/uielement/menubarmerger.hxx
+++ b/framework/inc/uielement/menubarmerger.hxx
@@ -51,7 +51,7 @@ enum RPResultInfo
struct ReferencePathInfo
{
- AbstractMenu* pPopupMenu;
+ Menu* pPopupMenu;
sal_uInt16 nPos;
sal_Int32 nLevel;
RPResultInfo eResult;
@@ -64,14 +64,14 @@ class MenuBarMerger
static void RetrieveReferencePath( const ::rtl::OUString&,
std::vector< ::rtl::OUString >& aReferencePath );
- static ReferencePathInfo FindReferencePath( const std::vector< ::rtl::OUString >& aReferencePath, AbstractMenu* pMenu );
+ static ReferencePathInfo FindReferencePath( const std::vector< ::rtl::OUString >& aReferencePath, Menu* pMenu );
static sal_uInt16 FindMenuItem( const ::rtl::OUString& rCmd,
- AbstractMenu* pMenu );
+ Menu* pMenu );
static void GetMenuEntry( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rAddonMenuEntry,
AddonMenuItem& aAddonMenu );
static void GetSubMenu( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > >& rSubMenuEntries,
AddonMenuContainer& rSubMenu );
- static bool ProcessMergeOperation( AbstractMenu* pMenu,
+ static bool ProcessMergeOperation( Menu* pMenu,
sal_uInt16 nPos,
sal_uInt16& rItemId,
const ::rtl::OUString& rMergeCommand,
@@ -86,21 +86,21 @@ class MenuBarMerger
const ::rtl::OUString& rModuleIdentifier,
const AddonMenuContainer& rAddonMenuItems );
static bool ProcessFallbackOperation();
- static bool MergeMenuItems( AbstractMenu* pMenu,
+ static bool MergeMenuItems( Menu* pMenu,
sal_uInt16 nPos,
sal_uInt16 nModIndex,
sal_uInt16& rItemId,
const ::rtl::OUString& rModuleIdentifier,
const AddonMenuContainer& rAddonMenuItems );
- static bool ReplaceMenuItem( AbstractMenu* pMenu,
+ static bool ReplaceMenuItem( Menu* pMenu,
sal_uInt16 nPos,
sal_uInt16& rItemId,
const ::rtl::OUString& rModuleIdentifier,
const AddonMenuContainer& rAddonMenuItems );
- static bool RemoveMenuItems( AbstractMenu* pMenu,
+ static bool RemoveMenuItems( Menu* pMenu,
sal_uInt16 nPos,
const ::rtl::OUString& rMergeCommandParameter );
- static bool CreateSubMenu( AbstractMenu* pSubMenu,
+ static bool CreateSubMenu( Menu* pSubMenu,
sal_uInt16& nItemId,
const ::rtl::OUString& rModuleIdentifier,
const AddonMenuContainer& rAddonSubMenu );
diff --git a/framework/source/classes/menumanager.cxx b/framework/source/classes/menumanager.cxx
index b4befaf..1fc665b 100644
--- a/framework/source/classes/menumanager.cxx
+++ b/framework/source/classes/menumanager.cxx
@@ -120,7 +120,7 @@ const char UNO_COMMAND[] = ".uno:";
MenuManager::MenuManager(
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
- REFERENCE< XFRAME >& rFrame, AbstractMenu* pMenu, sal_Bool bDelete, sal_Bool bDeleteChildren )
+ REFERENCE< XFRAME >& rFrame, Menu* pMenu, sal_Bool bDelete, sal_Bool bDeleteChildren )
:
ThreadHelpBase( &Application::GetSolarMutex() ),
mxServiceFactory(xServiceFactory)
@@ -465,7 +465,7 @@ void SAL_CALL MenuManager::disposing( const EVENTOBJECT& Source ) throw ( RUNTIM
}
-void MenuManager::UpdateSpecialFileMenu( AbstractMenu* pMenu )
+void MenuManager::UpdateSpecialFileMenu( Menu* pMenu )
{
// update picklist
Sequence< Sequence< PropertyValue > > aHistoryList = SvtHistoryOptions().GetList( ePICKLIST );
@@ -631,7 +631,7 @@ void MenuManager::UpdateSpecialFileMenu( AbstractMenu* pMenu )
}
}
-void MenuManager::UpdateSpecialWindowMenu( AbstractMenu* pMenu,const Reference< XMultiServiceFactory >& xServiceFactory,framework::IMutex& _rMutex )
+void MenuManager::UpdateSpecialWindowMenu( Menu* pMenu,const Reference< XMultiServiceFactory >& xServiceFactory,framework::IMutex& _rMutex )
{
// update window list
::std::vector< ::rtl::OUString > aNewWindowListVector;
@@ -745,7 +745,7 @@ void MenuManager::CreatePicklistArguments( Sequence< PropertyValue >& aArgsList,
// vcl handler
//_________________________________________________________________________________________________________________
-IMPL_LINK( MenuManager, Activate, AbstractMenu *, pMenu )
+IMPL_LINK( MenuManager, Activate, Menu *, pMenu )
{
if ( pMenu == m_pVCLMenu )
{
@@ -848,7 +848,7 @@ IMPL_LINK( MenuManager, Activate, AbstractMenu *, pMenu )
}
-IMPL_LINK( MenuManager, Deactivate, AbstractMenu *, pMenu )
+IMPL_LINK( MenuManager, Deactivate, Menu *, pMenu )
{
if ( pMenu == m_pVCLMenu )
m_bActive = sal_False;
@@ -857,7 +857,7 @@ IMPL_LINK( MenuManager, Deactivate, AbstractMenu *, pMenu )
}
-IMPL_LINK( MenuManager, Select, AbstractMenu *, pMenu )
+IMPL_LINK( MenuManager, Select, Menu *, pMenu )
{
URL aTargetURL;
Sequence<PropertyValue> aArgs;
@@ -959,7 +959,7 @@ void MenuManager::AddMenu(PopupMenu* _pPopupMenu,const ::rtl::OUString& _sItemCo
m_aMenuItemHandlerVector.push_back( pMenuItemHandler );
}
-sal_uInt16 MenuManager::FillItemCommand(::rtl::OUString& _rItemCommand, AbstractMenu* _pMenu,sal_uInt16 _nIndex) const
+sal_uInt16 MenuManager::FillItemCommand(::rtl::OUString& _rItemCommand, Menu* _pMenu,sal_uInt16 _nIndex) const
{
sal_uInt16 nItemId = _pMenu->GetItemId( _nIndex );
@@ -973,7 +973,7 @@ sal_uInt16 MenuManager::FillItemCommand(::rtl::OUString& _rItemCommand, Abstract
}
return nItemId;
}
-void MenuManager::FillMenuImages(Reference< XFrame >& _xFrame, AbstractMenu* _pMenu,sal_Bool bShowMenuImages)
+void MenuManager::FillMenuImages(Reference< XFrame >& _xFrame, Menu* _pMenu,sal_Bool bShowMenuImages)
{
AddonsOptions aAddonOptions;
diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx
index 3d287fb..d7ddeb4 100644
--- a/framework/source/uielement/menubarmanager.cxx
+++ b/framework/source/uielement/menubarmanager.cxx
@@ -184,7 +184,7 @@ MenuBarManager::MenuBarManager(
const Reference< XURLTransformer >& _xURLTransformer,
const Reference< XDispatchProvider >& rDispatchProvider,
const rtl::OUString& rModuleIdentifier,
- AbstractMenu* pMenu, sal_Bool bDelete, sal_Bool bDeleteChildren )
+ Menu* pMenu, sal_Bool bDelete, sal_Bool bDeleteChildren )
: ThreadHelpBase( &Application::GetSolarMutex() ), OWeakObject()
, m_bDisposed( sal_False )
, m_bRetrieveImages( sal_False )
@@ -760,7 +760,7 @@ void SAL_CALL MenuBarManager::disposing( const EventObject& Source ) throw ( Run
}
-void MenuBarManager::CheckAndAddMenuExtension( AbstractMenu* pMenu )
+void MenuBarManager::CheckAndAddMenuExtension( Menu* pMenu )
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen at sun.com", "MenuBarManager::CheckAndAddMenuExtension" );
@@ -791,7 +791,7 @@ void MenuBarManager::CheckAndAddMenuExtension( AbstractMenu* pMenu )
}
}
-static void lcl_CheckForChildren(AbstractMenu* pMenu, sal_uInt16 nItemId)
+static void lcl_CheckForChildren(Menu* pMenu, sal_uInt16 nItemId)
{
if (PopupMenu* pThisPopup = pMenu->GetPopupMenu( nItemId ))
pMenu->EnableItem( nItemId, pThisPopup->GetItemCount() ? true : false );
@@ -831,7 +831,7 @@ private:
}
-IMPL_LINK( MenuBarManager, Activate, AbstractMenu *, pMenu )
+IMPL_LINK( MenuBarManager, Activate, Menu *, pMenu )
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen at sun.com", "MenuBarManager::Activate" );
if ( pMenu == m_pVCLMenu )
@@ -1027,14 +1027,11 @@ IMPL_LINK( MenuBarManager, Activate, AbstractMenu *, pMenu )
}
}
- // Freeze the menu
- m_pVCLMenu->Freeze();
-
return 1;
}
-IMPL_LINK( MenuBarManager, Deactivate, AbstractMenu *, pMenu )
+IMPL_LINK( MenuBarManager, Deactivate, Menu *, pMenu )
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen at sun.com", "MenuBarManager::Deactivate" );
if ( pMenu == m_pVCLMenu )
@@ -1051,9 +1048,6 @@ IMPL_LINK( MenuBarManager, Deactivate, AbstractMenu *, pMenu )
}
}
-// pMenu->Freeze();
- m_pVCLMenu->Freeze();
-
return 1;
}
@@ -1073,7 +1067,7 @@ IMPL_LINK( MenuBarManager, AsyncSettingsHdl, Timer*,)
return 0;
}
-IMPL_LINK( MenuBarManager, Select, AbstractMenu *, pMenu )
+IMPL_LINK( MenuBarManager, Select, Menu *, pMenu )
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen at sun.com", "MenuBarManager::Select" );
URL aTargetURL;
@@ -1245,7 +1239,7 @@ sal_Bool MenuBarManager::CreatePopupMenuController( MenuItemHandler* pMenuItemHa
return sal_False;
}
-void MenuBarManager::FillMenuManager( AbstractMenu* pMenu, const Reference< XFrame >& rFrame, const Reference< XDispatchProvider >& rDispatchProvider, const rtl::OUString& rModuleIdentifier, sal_Bool bDelete, sal_Bool bDeleteChildren )
+void MenuBarManager::FillMenuManager( Menu* pMenu, const Reference< XFrame >& rFrame, const Reference< XDispatchProvider >& rDispatchProvider, const rtl::OUString& rModuleIdentifier, sal_Bool bDelete, sal_Bool bDeleteChildren )
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen at sun.com", "MenuBarManager::FillMenuManager" );
m_xFrame = rFrame;
@@ -1690,7 +1684,7 @@ void MenuBarManager::RetrieveImageManagers()
void MenuBarManager::FillMenuWithConfiguration(
sal_uInt16& nId,
- AbstractMenu* pMenu,
+ Menu* pMenu,
const ::rtl::OUString& rModuleIdentifier,
const Reference< XIndexAccess >& rItemContainer,
const Reference< XURLTransformer >& rTransformer )
@@ -1700,7 +1694,7 @@ void MenuBarManager::FillMenuWithConfiguration(
MenuBarManager::FillMenu( nId, pMenu, rModuleIdentifier, rItemContainer, xEmptyDispatchProvider );
// Merge add-on menu entries into the menu bar
- MenuBarManager::MergeAddonMenus( static_cast< AbstractMenu* >( pMenu ),
+ MenuBarManager::MergeAddonMenus( static_cast< Menu* >( pMenu ),
AddonsOptions().GetMergeMenuInstructions(),
rModuleIdentifier );
@@ -1726,7 +1720,7 @@ void MenuBarManager::FillMenuWithConfiguration(
void MenuBarManager::FillMenu(
sal_uInt16& nId,
- AbstractMenu* pMenu,
+ Menu* pMenu,
const rtl::OUString& rModuleIdentifier,
const Reference< XIndexAccess >& rItemContainer,
const Reference< XDispatchProvider >& rDispatchProvider )
@@ -1836,7 +1830,7 @@ void MenuBarManager::FillMenu(
}
void MenuBarManager::MergeAddonMenus(
- AbstractMenu* pMenuBar,
+ Menu* pMenuBar,
const MergeMenuInstructionContainer& aMergeInstructionContainer,
const ::rtl::OUString& rModuleIdentifier )
{
@@ -1861,7 +1855,7 @@ void MenuBarManager::MergeAddonMenus(
MenuBarMerger::GetSubMenu( rMergeInstruction.aMergeMenu, aMergeMenuItems );
// try to find the reference point for our merge operation
- AbstractMenu* pMenu = pMenuBar;
+ Menu* pMenu = pMenuBar;
ReferencePathInfo aResult = MenuBarMerger::FindReferencePath( aMergePath, pMenu );
if ( aResult.eResult == RP_OK )
@@ -1940,7 +1934,7 @@ void MenuBarManager::SetItemContainer( const Reference< XIndexAccess >& rItemCon
sal_uInt16 nId = 1;
// Fill menu bar with container contents
- FillMenuWithConfiguration( nId, (AbstractMenu *)m_pVCLMenu, m_aModuleIdentifier, rItemContainer, m_xURLTransformer );
+ FillMenuWithConfiguration( nId, (Menu *)m_pVCLMenu, m_aModuleIdentifier, rItemContainer, m_xURLTransformer );
// Refill menu manager again
Reference< XDispatchProvider > xDispatchProvider;
@@ -2019,7 +2013,7 @@ void MenuBarManager::AddMenu(MenuBarManager* pSubMenuManager,const ::rtl::OUStri
m_aMenuItemHandlerVector.push_back( pMenuItemHandler );
}
-sal_uInt16 MenuBarManager::FillItemCommand(::rtl::OUString& _rItemCommand, AbstractMenu* _pMenu,sal_uInt16 _nIndex) const
+sal_uInt16 MenuBarManager::FillItemCommand(::rtl::OUString& _rItemCommand, Menu* _pMenu,sal_uInt16 _nIndex) const
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen at sun.com", "MenuBarManager::FillItemCommand" );
sal_uInt16 nItemId = _pMenu->GetItemId( _nIndex );
diff --git a/framework/source/uielement/menubarmerger.cxx b/framework/source/uielement/menubarmerger.cxx
index 213ad89..544c52a 100644
--- a/framework/source/uielement/menubarmerger.cxx
+++ b/framework/source/uielement/menubarmerger.cxx
@@ -96,7 +96,7 @@ void MenuBarMerger::RetrieveReferencePath(
ReferencePathInfo MenuBarMerger::FindReferencePath(
const ::std::vector< ::rtl::OUString >& rReferencePath,
- AbstractMenu* pMenu )
+ Menu* pMenu )
{
sal_uInt32 i( 0 );
const sal_uInt32 nCount( rReferencePath.size() );
@@ -108,7 +108,7 @@ ReferencePathInfo MenuBarMerger::FindReferencePath(
return aResult;
}
- AbstractMenu* pCurrMenu( pMenu );
+ Menu* pCurrMenu( pMenu );
RPResultInfo eResult( RP_OK );
sal_Int32 nLevel( - 1 );
@@ -157,7 +157,7 @@ ReferencePathInfo MenuBarMerger::FindReferencePath(
return aResult;
}
-sal_uInt16 MenuBarMerger::FindMenuItem( const ::rtl::OUString& rCmd, AbstractMenu* pCurrMenu )
+sal_uInt16 MenuBarMerger::FindMenuItem( const ::rtl::OUString& rCmd, Menu* pCurrMenu )
{
for ( sal_uInt16 i = 0; i < pCurrMenu->GetItemCount(); i++ )
{
@@ -173,7 +173,7 @@ sal_uInt16 MenuBarMerger::FindMenuItem( const ::rtl::OUString& rCmd, AbstractMen
}
bool MenuBarMerger::CreateSubMenu(
- AbstractMenu* pSubMenu,
+ Menu* pSubMenu,
sal_uInt16& nItemId,
const ::rtl::OUString& rModuleIdentifier,
const AddonMenuContainer& rAddonSubMenu )
@@ -211,7 +211,7 @@ bool MenuBarMerger::CreateSubMenu(
}
bool MenuBarMerger::MergeMenuItems(
- AbstractMenu* pMenu,
+ Menu* pMenu,
sal_uInt16 nPos,
sal_uInt16 nModIndex,
sal_uInt16& nItemId,
@@ -253,7 +253,7 @@ bool MenuBarMerger::MergeMenuItems(
}
bool MenuBarMerger::ReplaceMenuItem(
- AbstractMenu* pMenu,
+ Menu* pMenu,
sal_uInt16 nPos,
sal_uInt16& rItemId,
const ::rtl::OUString& rModuleIdentifier,
@@ -267,7 +267,7 @@ bool MenuBarMerger::ReplaceMenuItem(
}
bool MenuBarMerger::RemoveMenuItems(
- AbstractMenu* pMenu,
+ Menu* pMenu,
sal_uInt16 nPos,
const ::rtl::OUString& rMergeCommandParameter )
{
@@ -287,7 +287,7 @@ bool MenuBarMerger::RemoveMenuItems(
}
bool MenuBarMerger::ProcessMergeOperation(
- AbstractMenu* pMenu,
+ Menu* pMenu,
sal_uInt16 nPos,
sal_uInt16& nItemId,
const ::rtl::OUString& rMergeCommand,
@@ -336,7 +336,7 @@ bool MenuBarMerger::ProcessFallbackOperation(
}
else if ( rMergeFallback.equalsAsciiL( MERGEFALLBACK_ADDPATH, MERGEFALLBACK_ADDPATH_LEN ))
{
- AbstractMenu* pCurrMenu( aRefPathInfo.pPopupMenu );
+ Menu* pCurrMenu( aRefPathInfo.pPopupMenu );
sal_Int32 nLevel( aRefPathInfo.nLevel );
const sal_Int32 nSize( rReferencePath.size() );
bool bFirstLevel( true );
diff --git a/framework/source/uielement/menubarwrapper.cxx b/framework/source/uielement/menubarwrapper.cxx
index 1804566..cc7032a 100644
--- a/framework/source/uielement/menubarwrapper.cxx
+++ b/framework/source/uielement/menubarwrapper.cxx
@@ -202,8 +202,6 @@ void SAL_CALL MenuBarWrapper::initialize( const Sequence< Any >& aArguments ) th
sal_True );
m_xMenuBarManager = Reference< XComponent >( static_cast< OWeakObject *>( pMenuBarManager ), UNO_QUERY );
-
- pVCLMenuBar->Freeze();
}
// Initialize toolkit menu bar implementation to have awt::XMenuBar for data exchange.
diff --git a/vcl/inc/salmenu.hxx b/vcl/inc/salmenu.hxx
index 13f058c..5bea401 100644
--- a/vcl/inc/salmenu.hxx
+++ b/vcl/inc/salmenu.hxx
@@ -83,9 +83,7 @@ public:
virtual void RemoveMenuBarButton( sal_uInt16 nId );
// FIXME: Make the other VCL native backends to work with these new methods.
- virtual void SetItemCommand( unsigned, SalMenuItem*, const rtl::OUString& ) {}
virtual void ShowItem( unsigned nPos, sal_Bool bShow ) { EnableItem( nPos, bShow ); }
- virtual void Freeze() {}
// return an empty rectangle if not implemented
// return Rectangle( Point( -1, -1 ), Size( 1, 1 ) ) if menu bar buttons implemented
diff --git a/vcl/inc/unx/gtk/gtksalmenu.hxx b/vcl/inc/unx/gtk/gtksalmenu.hxx
index 3fd65d5..53095b8 100644
--- a/vcl/inc/unx/gtk/gtksalmenu.hxx
+++ b/vcl/inc/unx/gtk/gtksalmenu.hxx
@@ -78,8 +78,6 @@ public:
virtual void SetItemImage( unsigned nPos, SalMenuItem* pSalMenuItem, const Image& rImage);
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 void Freeze();
virtual void SetMenu( Menu* pMenu ) { mpVCLMenu = pMenu; }
virtual Menu* GetMenu() { return mpVCLMenu; }
diff --git a/vcl/inc/vcl/menu.hxx b/vcl/inc/vcl/menu.hxx
index 6c12dc6..9bd5c0b 100644
--- a/vcl/inc/vcl/menu.hxx
+++ b/vcl/inc/vcl/menu.hxx
@@ -102,96 +102,6 @@ struct ImplMenuDelData
bool isDeleted() const { return mpMenu == 0; }
};
-// ----------------
-// - AbstractMenu -
-// ----------------
-
-class VCL_DLLPUBLIC AbstractMenu : public Resource
-{
-public:
- virtual ~AbstractMenu() {}
-
- virtual SAL_DLLPRIVATE Window* ImplGetWindow() const = 0;
-
- virtual void InsertItem( sal_uInt16 nItemId, const XubString& rStr,
- MenuItemBits nItemBits = 0,
- sal_uInt16 nPos = MENU_APPEND ) = 0;
- virtual void InsertItem( sal_uInt16 nItemId,
- const XubString& rString, const Image& rImage,
- MenuItemBits nItemBits = 0,
- sal_uInt16 nPos = MENU_APPEND ) = 0;
- virtual void InsertSeparator( sal_uInt16 nPos = MENU_APPEND ) = 0;
- virtual void RemoveItem( sal_uInt16 nPos ) = 0;
- virtual void CopyItem( const Menu& rMenu, sal_uInt16 nPos,
- sal_uInt16 nNewPos = MENU_APPEND ) = 0;
- virtual void Clear() = 0;
-
- virtual void SetMenuFlags( sal_uInt16 nFlags ) = 0;
- virtual sal_uInt16 GetMenuFlags() const = 0;
-
- virtual sal_uInt16 GetItemCount() const = 0;
- virtual sal_uInt16 GetItemId( sal_uInt16 nPos ) const = 0;
- virtual sal_uInt16 GetItemPos( sal_uInt16 nItemId ) const = 0;
- virtual MenuItemType GetItemType( sal_uInt16 nPos ) const = 0;
- virtual sal_uInt16 GetCurItemId() const = 0;
-
- virtual void SetItemBits( sal_uInt16 nItemId, MenuItemBits nBits ) = 0;
- virtual MenuItemBits GetItemBits( sal_uInt16 nItemId ) const = 0;
-
- virtual void SetUserValue( sal_uInt16 nItemId, sal_uLong nValue ) = 0;
- virtual sal_uLong GetUserValue( sal_uInt16 nItemId ) const = 0;
-
- virtual void SetPopupMenu( sal_uInt16 nItemId, PopupMenu* pMenu ) = 0;
- virtual PopupMenu* GetPopupMenu( sal_uInt16 nItemId ) const = 0;
-
- virtual void SetAccelKey( sal_uInt16 nItemId, const KeyCode& rKeyCode ) = 0;
-
- virtual void CheckItem( sal_uInt16 nItemId, sal_Bool bCheck = sal_True ) = 0;
- virtual sal_Bool IsItemChecked( sal_uInt16 nItemId ) const = 0;
-
- virtual void EnableItem( sal_uInt16 nItemId, sal_Bool bEnable = sal_True ) = 0;
- virtual sal_Bool IsItemEnabled( sal_uInt16 nItemId ) const = 0;
-
- virtual void ShowItem( sal_uInt16 nItemId, sal_Bool bVisible = sal_True ) = 0;
- virtual void HideItem( sal_uInt16 nItemId ) = 0;
-
- virtual sal_Bool IsMenuBar() const = 0;
-
- virtual void RemoveDisabledEntries( sal_Bool bCheckPopups = sal_True,
- sal_Bool bRemoveEmptyPopups = sal_False ) = 0;
-
- virtual void SetItemText( sal_uInt16 nItemId, const XubString& rStr ) = 0;
- virtual XubString GetItemText( sal_uInt16 nItemId ) const = 0;
-
- virtual void SetItemImage( sal_uInt16 nItemId, const Image& rImage ) = 0;
- virtual Image GetItemImage( sal_uInt16 nItemId ) const = 0;
-
- virtual void SetItemCommand( sal_uInt16 nItemId, const XubString& rCommand ) = 0;
- virtual const XubString& GetItemCommand( sal_uInt16 nItemId ) const = 0;
-
- virtual void SetTipHelpText( sal_uInt16 nItemId, const XubString& rString ) = 0;
-
- virtual void SetHelpCommand( sal_uInt16 nItemId, const XubString& rString ) = 0;
- virtual const XubString& GetHelpCommand( sal_uInt16 nItemId ) const = 0;
-
- virtual void SetHelpId( sal_uInt16 nItemId, const rtl::OString& rHelpId ) = 0;
- virtual rtl::OString GetHelpId( sal_uInt16 nItemId ) const = 0;
-
- virtual void SetActivateHdl( const Link& rLink ) = 0;
-
- virtual void SetDeactivateHdl( const Link& rLink ) = 0;
-
- virtual void SetHighlightHdl( const Link& rLink ) = 0;
-
- virtual void SetSelectHdl( const Link& rLink ) = 0;
-
- // Returns the system's menu handle if native menus are supported
- // pData must point to a SystemMenuData structure
- virtual sal_Bool GetSystemMenuData( SystemMenuData* pData ) const = 0;
-
- virtual void Freeze(void) = 0;
-};
-
// --------
// - Menu -
// --------
@@ -203,7 +113,7 @@ struct MenuLogo
Color aEndColor;
};
-class VCL_DLLPUBLIC Menu : public AbstractMenu
+class VCL_DLLPUBLIC Menu : public Resource
{
friend class MenuBar;
friend class MenuBarWindow;
@@ -446,8 +356,6 @@ public:
void HighlightItem( sal_uInt16 nItemPos );
void DeHighlight() { HighlightItem( 0xFFFF ); } // MENUITEMPOS_INVALID
-
- void Freeze();
};
// -----------
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index bf220a4..7fbc21a 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -1953,10 +1953,6 @@ void Menu::SetItemCommand( sal_uInt16 nItemId, const String& rCommand )
if ( pData )
pData->aCommandStr = rCommand;
-
- // update native menu
- if( ImplGetSalMenu() && pData->pSalMenuItem )
- ImplGetSalMenu()->SetItemCommand( nPos, pData->pSalMenuItem, rCommand );
}
const XubString& Menu::GetItemCommand( sal_uInt16 nItemId ) const
@@ -3233,15 +3229,6 @@ void Menu::HighlightItem( sal_uInt16 nItemPos )
}
}
-void Menu::Freeze(void)
-{
- SalMenu *pSalMenu = ImplGetSalMenu();
-
- if ( pSalMenu ) {
- pSalMenu->Freeze();
- }
-}
-
// -----------
// - MenuBar -
diff --git a/vcl/unx/gtk/window/gtksalmenu.cxx b/vcl/unx/gtk/window/gtksalmenu.cxx
index 4b9a358..7c1517e 100644
--- a/vcl/unx/gtk/window/gtksalmenu.cxx
+++ b/vcl/unx/gtk/window/gtksalmenu.cxx
@@ -786,18 +786,10 @@ void GtkSalMenu::SetAccelerator( unsigned, SalMenuItem*, const KeyCode&, const r
{
}
-void GtkSalMenu::SetItemCommand( unsigned, SalMenuItem*, const rtl::OUString& )
-{
-}
-
void GtkSalMenu::GetSystemMenuData( SystemMenuData* )
{
}
-void GtkSalMenu::Freeze()
-{
-}
-
// =======================================================================
/*
commit c36c5b516168ea63767e8642c0958edcb4704a1d
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Tue Nov 13 12:16:19 2012 +0100
ImplSelectWithStart is actually already defined
Change-Id: I4bc0f6f9b8f1d87236d19f3757eeeb1f2702552a
diff --git a/vcl/inc/vcl/menu.hxx b/vcl/inc/vcl/menu.hxx
index a0dae64..6c12dc6 100644
--- a/vcl/inc/vcl/menu.hxx
+++ b/vcl/inc/vcl/menu.hxx
@@ -289,10 +289,6 @@ public:
Menu();
Menu( sal_Bool bMenuBar );
SAL_DLLPRIVATE Window* ImplGetWindow() const { return pWindow; }
-#if defined(QUARTZ)
- // ImplSelectWithStart() is used in vcl/aqua/source/window/salnsmenu.mm
- SAL_DLLPRIVATE void ImplSelectWithStart( Menu* pStartMenu = NULL );
-#endif
void ImplSelectWithStart( Menu* pStartMenu = NULL );
public:
commit 221d698c33ee8bb9afad51b2c38c00bf8a28a3ad
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Tue Nov 13 11:58:11 2012 +0100
revert messing with OSX
Change-Id: I53686801301122c7964b9a6cce276845329f784a
diff --git a/vcl/inc/vcl/menu.hxx b/vcl/inc/vcl/menu.hxx
index 2d2adcf..a0dae64 100644
--- a/vcl/inc/vcl/menu.hxx
+++ b/vcl/inc/vcl/menu.hxx
@@ -289,10 +289,10 @@ public:
Menu();
Menu( sal_Bool bMenuBar );
SAL_DLLPRIVATE Window* ImplGetWindow() const { return pWindow; }
-//#if defined(QUARTZ)
-// // ImplSelectWithStart() is used in vcl/aqua/source/window/salnsmenu.mm
-// SAL_DLLPRIVATE void ImplSelectWithStart( Menu* pStartMenu = NULL );
-//#endif
+#if defined(QUARTZ)
+ // ImplSelectWithStart() is used in vcl/aqua/source/window/salnsmenu.mm
+ SAL_DLLPRIVATE void ImplSelectWithStart( Menu* pStartMenu = NULL );
+#endif
void ImplSelectWithStart( Menu* pStartMenu = NULL );
public:
commit 65e769aa4d9ec9a4e68ef1d8a1a3e85c42d2045c
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Tue Nov 13 11:55:51 2012 +0100
more cleanup
Change-Id: Ia8cd81ca5944d3b33ddc684e5a65bedce444f85b
diff --git a/framework/source/uielement/menubarwrapper.cxx b/framework/source/uielement/menubarwrapper.cxx
index b1f781d..1804566 100644
--- a/framework/source/uielement/menubarwrapper.cxx
+++ b/framework/source/uielement/menubarwrapper.cxx
@@ -121,19 +121,6 @@ void SAL_CALL MenuBarWrapper::dispose() throw (::com::sun::star::uno::RuntimeExc
m_bDisposed = sal_True;
}
-//void generateFullMenuBar( MenuBarManager *pMenuBarManager, MenuBar *pMenuBar )
-//{
-// for (int i=0; i < pMenuBar->GetItemCount(); i++)
-// {
-// sal_Int16 nId = pMenuBar->GetItemId( i );
-
-// String aCommandLabel = pMenuBar->GetItemCommand( nId );
-
-// String label = pMenuBarManager->RetrieveLabelFromCommand( aCommandLabel );
-// pMenuBar->SetItemText( nId, label );
-// }
-//}
-
// XInitialization
void SAL_CALL MenuBarWrapper::initialize( const Sequence< Any >& aArguments ) throw ( Exception, RuntimeException )
{
@@ -216,7 +203,6 @@ void SAL_CALL MenuBarWrapper::initialize( const Sequence< Any >& aArguments ) th
m_xMenuBarManager = Reference< XComponent >( static_cast< OWeakObject *>( pMenuBarManager ), UNO_QUERY );
-// pMenuBarManager->GenerateFullMenuHierarchy( pVCLMenuBar );
pVCLMenuBar->Freeze();
}
commit 3f7e72128708b4ea49bcf2777333340a89edea06
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Tue Nov 13 11:54:47 2012 +0100
cleanup line noise
Change-Id: Ief6e0b235a0707a805a0dbe9f0a32136a132dcf0
diff --git a/framework/inc/uielement/menubarwrapper.hxx b/framework/inc/uielement/menubarwrapper.hxx
index 10ef799..47bfcce 100644
--- a/framework/inc/uielement/menubarwrapper.hxx
+++ b/framework/inc/uielement/menubarwrapper.hxx
@@ -76,7 +76,6 @@ class MenuBarWrapper : public UIConfigElementWrapperBase,
private:
virtual void impl_fillNewData();
void fillPopupControllerCache();
-// void GenerateFullMenuBar( MenuBar *pMenuBar );
sal_Bool m_bRefreshPopupControllerCache : 1;
com::sun::star::uno::Reference< com::sun::star::lang::XComponent > m_xMenuBarManager;
commit a5efd0740afc85b2a1fc26a4467f570e75691dcb
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Tue Nov 13 11:18:34 2012 +0100
remove superflous #include
Change-Id: Id49d11b9f88abe14e814c14e8ee8cbb469e029f8
diff --git a/vcl/inc/unx/gtk/gtksalmenu.hxx b/vcl/inc/unx/gtk/gtksalmenu.hxx
index 2da7c88..3fd65d5 100644
--- a/vcl/inc/unx/gtk/gtksalmenu.hxx
+++ b/vcl/inc/unx/gtk/gtksalmenu.hxx
@@ -31,7 +31,6 @@
#include <unx/gtk/gtkframe.hxx>
#include <unx/gtk/glomenu.h>
#include <unx/gtk/gloactiongroup.h>
-#include <vcl/sv.h>
class MenuItemList;
commit 3292fbf3f00afd34cba4da1d00d883a6449e1f39
Author: Antonio Fernandez <antonio.fernandez at aentos.es>
Date: Fri Oct 26 12:58:56 2012 +0100
Menu is fully updated when receiving a HUD activation event.
Change-Id: I4d275bc01ac0baa265d22dcd849020e8f51fc447
diff --git a/vcl/unx/gtk/window/gtkframe.cxx b/vcl/unx/gtk/window/gtkframe.cxx
index 9fa7a5f..80e4d19 100644
--- a/vcl/unx/gtk/window/gtkframe.cxx
+++ b/vcl/unx/gtk/window/gtkframe.cxx
@@ -515,7 +515,14 @@ static void ObjectDestroyedNotify( gpointer data )
static void hud_activated( gboolean hud_active, gpointer user_data )
{
- printf("HUD active state: %d\n", hud_active);
+ if ( hud_activated )
+ {
+ GtkSalFrame* pSalFrame = reinterpret_cast< GtkSalFrame* >( user_data );
+ GtkSalMenu* pSalMenu = reinterpret_cast< GtkSalMenu* >( pSalFrame->GetMenu() );
+
+ if ( pSalMenu )
+ pSalMenu->UpdateFull();
+ }
}
gboolean ensure_dbus_setup( gpointer data )
commit 8a253188410c82f696da7201d28a02d905154e6d
Author: Antonio Fernandez <antonio.fernandez at aentos.es>
Date: Wed Oct 24 17:36:59 2012 +0100
Menu is now subscribed to HUD awareness protocol events.
Change-Id: I0649ac50a93b3b6379642fac4d5d532d46251d72
diff --git a/vcl/inc/unx/gtk/gtkframe.hxx b/vcl/inc/unx/gtk/gtkframe.hxx
index 056585b..6926136 100644
--- a/vcl/inc/unx/gtk/gtkframe.hxx
+++ b/vcl/inc/unx/gtk/gtkframe.hxx
@@ -217,7 +217,6 @@ class GtkSalFrame : public SalFrame
friend void on_registrar_available (GDBusConnection*, const gchar*, const gchar*, gpointer);
friend void on_registrar_unavailable (GDBusConnection*, const gchar*, gpointer);
guint m_nWatcherId;
- guint m_nHudAwarenessId;
void Init( SalFrame* pParent, sal_uLong nStyle );
void Init( SystemParentData* pSysData );
@@ -304,6 +303,7 @@ public:
guint m_nMenuExportId;
guint m_nActionGroupExportId;
+ guint m_nHudAwarenessId;
// dispatches an event, returns true if dispatched
// and false else; if true was returned the event should
diff --git a/vcl/unx/gtk/window/gtkframe.cxx b/vcl/unx/gtk/window/gtkframe.cxx
index 9cce0f8..9fa7a5f 100644
--- a/vcl/unx/gtk/window/gtkframe.cxx
+++ b/vcl/unx/gtk/window/gtkframe.cxx
@@ -513,6 +513,11 @@ static void ObjectDestroyedNotify( gpointer data )
}
}
+static void hud_activated( gboolean hud_active, gpointer user_data )
+{
+ printf("HUD active state: %d\n", hud_active);
+}
+
gboolean ensure_dbus_setup( gpointer data )
{
GtkSalFrame* pSalFrame = reinterpret_cast< GtkSalFrame* >( data );
@@ -549,6 +554,7 @@ gboolean ensure_dbus_setup( gpointer data )
SAL_INFO("vcl.unity", "exporting menu model at " << pMenuModel << " for window " << windowId);
pSalFrame->m_nMenuExportId = g_dbus_connection_export_menu_model (pSessionBus, aDBusMenubarPath, pMenuModel, NULL);
pSalFrame->m_nActionGroupExportId = g_dbus_connection_export_action_group( pSessionBus, aDBusPath, pActionGroup, NULL);
+ pSalFrame->m_nHudAwarenessId = hud_awareness_register( pSessionBus, aDBusMenubarPath, hud_activated, pSalFrame, NULL, NULL );
g_free( aDBusPath );
g_free( aDBusWindowPath );
@@ -674,10 +680,12 @@ GtkSalFrame::~GtkSalFrame()
if ( pSessionBus )
{
- if(m_nMenuExportId)
- g_dbus_connection_unexport_menu_model(pSessionBus, m_nMenuExportId);
- if(m_nActionGroupExportId)
- g_dbus_connection_unexport_action_group(pSessionBus, m_nActionGroupExportId);
+ if ( m_nHudAwarenessId )
+ hud_awareness_unregister( pSessionBus, m_nHudAwarenessId );
+ if ( m_nMenuExportId )
+ g_dbus_connection_unexport_menu_model( pSessionBus, m_nMenuExportId );
+ if ( m_nActionGroupExportId )
+ g_dbus_connection_unexport_action_group( pSessionBus, m_nActionGroupExportId );
}
gtk_widget_destroy( m_pWindow );
}
@@ -795,6 +803,9 @@ void GtkSalFrame::InitCommon()
m_bSetFocusOnMap = false;
m_pSalMenu = NULL;
m_nWatcherId = 0;
+ m_nMenuExportId = 0;
+ m_nActionGroupExportId = 0;
+ m_nHudAwarenessId = 0;
gtk_widget_set_app_paintable( m_pWindow, TRUE );
gtk_widget_set_double_buffered( m_pWindow, FALSE );
@@ -1108,7 +1119,6 @@ void GtkSalFrame::Init( SalFrame* pParent, sal_uLong nStyle )
{
// Enable DBus native menu if available.
ensure_dbus_setup( this );
- //EnsureAppMenuWatch();
guint32 nUserTime = 0;
if( (nStyle & (SAL_FRAME_STYLE_OWNERDRAWDECORATION|SAL_FRAME_STYLE_TOOLWINDOW)) == 0 )
commit e3055bccc7eb59ed898bffa260986c19b6285783
Author: Antonio Fernandez <antonio.fernandez at aentos.es>
Date: Wed Oct 24 17:17:27 2012 +0100
Added missing files for HUD awareness support.
Change-Id: If3544734e8c4a1c632a24976e9340ef84869d22a
diff --git a/vcl/inc/unx/gtk/hudawareness.h b/vcl/inc/unx/gtk/hudawareness.h
new file mode 100644
index 0000000..47c5f90
--- /dev/null
+++ b/vcl/inc/unx/gtk/hudawareness.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright © 2012 Canonical Ltd.
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * licence, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ * USA.
+ *
+ * Author: Ryan Lortie <desrt at desrt.ca>
+ */
+
+#ifndef _hudawareness_h_
+#define _hudawareness_h_
+
+#include <gio/gio.h>
+
+G_BEGIN_DECLS
+
+typedef void (* HudAwarenessCallback) (gboolean hud_active,
+ gpointer user_data);
+
+
+guint hud_awareness_register (GDBusConnection *connection,
+ const gchar *object_path,
+ HudAwarenessCallback callback,
+ gpointer user_data,
+ GDestroyNotify notify,
+ GError **error);
+
+void hud_awareness_unregister (GDBusConnection *connection,
+ guint awareness_id);
+
+G_END_DECLS
+
+#endif /* _hudawareness_h_ */
diff --git a/vcl/unx/gtk/window/hudawareness.cxx b/vcl/unx/gtk/window/hudawareness.cxx
new file mode 100644
index 0000000..b36f553
--- /dev/null
+++ b/vcl/unx/gtk/window/hudawareness.cxx
@@ -0,0 +1,126 @@
+/*
+ * Copyright © 2012 Canonical Ltd.
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * licence, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ * USA.
+ *
+ * Author: Ryan Lortie <desrt at desrt.ca>
+ */
+
+#include <unx/gtk/hudawareness.h>
+
+typedef struct
+{
+ GDBusConnection *connection;
+ HudAwarenessCallback callback;
+ gpointer user_data;
+ GDestroyNotify notify;
+} HudAwarenessHandle;
+
+static void
+hud_awareness_method_call (GDBusConnection *connection,
+ const gchar *sender,
+ const gchar *object_path,
+ const gchar *interface_name,
+ const gchar *method_name,
+ GVariant *parameters,
+ GDBusMethodInvocation *invocation,
+ gpointer user_data)
+{
+ HudAwarenessHandle *handle = (HudAwarenessHandle*) user_data;
+
+ if (g_str_equal (method_name, "HudActiveChanged"))
+ {
+ gboolean active;
+
+ g_variant_get (parameters, "(b)", &active);
+
+ (* handle->callback) (active, handle->user_data);
+ }
+
+ g_dbus_method_invocation_return_value (invocation, NULL);
+}
+
+static void
+hud_awareness_handle_free (gpointer data)
+{
+ HudAwarenessHandle *handle = (HudAwarenessHandle*) data;
+
+ g_object_unref (handle->connection);
+
+ if (handle->notify)
+ (* handle->notify) (handle->user_data);
+
+ g_slice_free (HudAwarenessHandle, handle);
+}
+
+guint
+hud_awareness_register (GDBusConnection *connection,
+ const gchar *object_path,
+ HudAwarenessCallback callback,
+ gpointer user_data,
+ GDestroyNotify notify,
+ GError **error)
+{
+ static GDBusInterfaceInfo *iface;
+ GDBusInterfaceVTable vtable = {
+ hud_awareness_method_call
+ };
+ HudAwarenessHandle *handle;
+ guint object_id;
+
+ if G_UNLIKELY (iface == NULL)
+ {
+ GError *error = NULL;
+ GDBusNodeInfo *info;
+
+ info = g_dbus_node_info_new_for_xml ("<node>"
+ "<interface name='com.canonical.hud.Awareness'>"
+ "<method name='CheckAwareness'/>"
+ "<method name='HudActiveChanged'>"
+ "<arg type='b'/>"
+ "</method>"
+ "</interface>"
+ "</node>",
+ &error);
+ g_assert_no_error (error);
+ iface = g_dbus_node_info_lookup_interface (info, "com.canonical.hud.Awareness");
+ g_assert (iface != NULL);
+ }
+
+ handle = g_slice_new (HudAwarenessHandle);
+
+ object_id = g_dbus_connection_register_object (connection, object_path, iface, &vtable, handle, NULL, error);
+
+ if (object_id == 0)
+ {
+ g_slice_free (HudAwarenessHandle, handle);
+ return 0;
+ }
+
+ handle->connection = (GDBusConnection*) g_object_ref (connection);
+ handle->callback = callback;
+ handle->user_data = user_data;
+ handle->notify = notify;
+
+ return object_id;
+}
+
+void
+hud_awareness_unregister (GDBusConnection *connection,
+ guint subscription_id)
+{
+ g_dbus_connection_unregister_object (connection, subscription_id);
+}
diff --git a/vcl/unx/gtk3/window/gtk3hudawareness.cxx b/vcl/unx/gtk3/window/gtk3hudawareness.cxx
new file mode 100644
index 0000000..1a22211
--- /dev/null
+++ b/vcl/unx/gtk3/window/gtk3hudawareness.cxx
@@ -0,0 +1 @@
+#include "../../gtk/window/hudawareness.cxx"
commit 5339d69bbcebc1d438c3e520acaacada32ace7ab
Author: Antonio Fernandez <antonio.fernandez at aentos.es>
Date: Wed Oct 24 17:15:57 2012 +0100
Added files to implement HUD awareness protocol support.
Change-Id: I1ce292811b0ac53c35b5a9026a1c1a4f4ef02cf4
diff --git a/vcl/Library_vclplug_gtk.mk b/vcl/Library_vclplug_gtk.mk
index 441f004..a70ce09 100644
--- a/vcl/Library_vclplug_gtk.mk
+++ b/vcl/Library_vclplug_gtk.mk
@@ -92,6 +92,7 @@ $(eval $(call gb_Library_add_exception_objects,vclplug_gtk,\
vcl/unx/gtk/window/gloactiongroup \
vcl/unx/gtk/window/gtksalmenu \
vcl/unx/gtk/window/glomenu \
+ vcl/unx/gtk/window/hudawareness \
vcl/unx/gtk/fpicker/resourceprovider \
vcl/unx/gtk/fpicker/SalGtkPicker \
vcl/unx/gtk/fpicker/SalGtkFilePicker \
diff --git a/vcl/Library_vclplug_gtk3.mk b/vcl/Library_vclplug_gtk3.mk
index 4cbafa9..1523b90 100644
--- a/vcl/Library_vclplug_gtk3.mk
+++ b/vcl/Library_vclplug_gtk3.mk
@@ -100,6 +100,7 @@ $(eval $(call gb_Library_add_exception_objects,vclplug_gtk3,\
vcl/unx/gtk3/window/gtk3gtksalmenu \
vcl/unx/gtk3/window/gtk3glomenu \
vcl/unx/gtk3/window/gtk3gloactiongroup \
+ vcl/unx/gtk3/window/gtk3hudawareness \
))
$(eval $(call gb_Library_use_static_libraries,vclplug_gtk3,\
diff --git a/vcl/inc/unx/gtk/gtkframe.hxx b/vcl/inc/unx/gtk/gtkframe.hxx
index cc4451a..056585b 100644
--- a/vcl/inc/unx/gtk/gtkframe.hxx
+++ b/vcl/inc/unx/gtk/gtkframe.hxx
@@ -217,6 +217,7 @@ class GtkSalFrame : public SalFrame
friend void on_registrar_available (GDBusConnection*, const gchar*, const gchar*, gpointer);
friend void on_registrar_unavailable (GDBusConnection*, const gchar*, gpointer);
guint m_nWatcherId;
+ guint m_nHudAwarenessId;
void Init( SalFrame* pParent, sal_uLong nStyle );
void Init( SystemParentData* pSysData );
diff --git a/vcl/unx/gtk/window/gtkframe.cxx b/vcl/unx/gtk/window/gtkframe.cxx
index 56f01e0..9cce0f8 100644
--- a/vcl/unx/gtk/window/gtkframe.cxx
+++ b/vcl/unx/gtk/window/gtkframe.cxx
@@ -25,6 +25,7 @@
#include <unx/gtk/glomenu.h>
#include <unx/gtk/gloactiongroup.h>
#include <unx/gtk/gtksalmenu.hxx>
+#include <unx/gtk/hudawareness.h>
#include <vcl/keycodes.hxx>
#include <unx/wmadaptor.hxx>
#include <unx/sm.hxx>
commit bfb960d67c6af9ac049ed7575f80e3af0513c705
Author: Antonio Fernandez <antonio.fernandez at aentos.es>
Date: Fri Oct 26 13:21:49 2012 +0100
Duplicated commands are now handled properly.
Change-Id: I80dd2d05060dcad3c6375a4e1c7b2109e451169b
diff --git a/vcl/unx/gtk/window/gtksalmenu.cxx b/vcl/unx/gtk/window/gtksalmenu.cxx
index a6295c4..4b9a358 100644
--- a/vcl/unx/gtk/window/gtksalmenu.cxx
+++ b/vcl/unx/gtk/window/gtksalmenu.cxx
@@ -40,10 +40,10 @@
static sal_Bool bMenuVisibility = sal_False;
/*
- * This function generates an alternative command name to avoid name collisions
- * or to give a valid command name to certain menu items.
+ * This function generates the proper command name for all actions, including
+ * duplicated or special ones.
*/
-static gchar* GetCommandForSpecialItem( GtkSalMenuItem* pSalMenuItem )
+static gchar* GetCommandForItem( GtkSalMenuItem* pSalMenuItem, gchar* aCurrentCommand, GActionGroup* pActionGroup )
{
gchar* aCommand = NULL;
@@ -54,15 +54,28 @@ static gchar* GetCommandForSpecialItem( GtkSalMenuItem* pSalMenuItem )
if ( ( nId >= START_ITEMID_WINDOWLIST ) && ( nId <= END_ITEMID_WINDOWLIST ) )
aCommand = g_strdup_printf( "window-%d", nId );
else
- if ( pMenu )
+ {
+ if ( !pMenu )
+ return NULL;
+
+ rtl::OUString aMenuCommand = pMenu->GetItemCommand( nId );
+ gchar* aCommandStr = g_strdup( rtl::OUStringToOString( aMenuCommand, RTL_TEXTENCODING_UTF8 ).getStr() );
+ aCommand = g_strdup( aCommandStr );
+
+ // Some items could have duplicated commands. A new one should be generated.
+ for ( sal_uInt16 i = 2; ; i++ )
{
- rtl::OUString aMenuCommand = pMenu->GetItemCommand( nId );
- MenuItemBits nBits = pMenu->GetItemBits( nId );
+ if ( !g_action_group_has_action( pActionGroup, aCommand )
+ || ( aCurrentCommand && g_strcmp0( aCurrentCommand, aCommand ) == 0 ) )
+ break;
- if ( aMenuCommand.equalsAscii(".uno:Presentation") && nBits == 0 )
- aCommand = g_strdup(".uno:Presentation2");
+ g_free( aCommand );
+ aCommand = g_strdup_printf("%s%d", aCommandStr, i);
}
+ g_free( aCommandStr );
+ }
+
return aCommand;
}
@@ -244,7 +257,6 @@ void RemoveUnusedCommands( GLOActionGroup* pActionGroup, GList* pOldCommandList,
void GtkSalMenu::ImplUpdate( gboolean bRecurse )
{
SolarMutexGuard aGuard;
- //GTK_YIELD_GRAB();
if( !PrepUpdate() )
return;
@@ -304,8 +316,6 @@ void GtkSalMenu::ImplUpdate( gboolean bRecurse )
// Convert internal values to native values.
gboolean bChecked = ( itemChecked == sal_True ) ? TRUE : FALSE;
gboolean bEnabled = ( itemEnabled == sal_True ) ? TRUE : FALSE;
-// gchar* aNativeCommand = g_strdup( rtl::OUStringToOString( aCommand, RTL_TEXTENCODING_UTF8 ).getStr() );
- gchar* aNativeCommand = GetCommandForSpecialItem( pSalMenuItem );
// Store current item command in command list.
gchar *aCurrentCommand = g_lo_menu_get_command_from_item_in_section( pLOMenu, nSection, nItemPos );
@@ -313,24 +323,13 @@ void GtkSalMenu::ImplUpdate( gboolean bRecurse )
if ( aCurrentCommand != NULL )
pOldCommandList = g_list_append( pOldCommandList, aCurrentCommand );
+ // Get the new command for the item.
+ gchar* aNativeCommand = GetCommandForItem( pSalMenuItem, aCurrentCommand, mpActionGroup );
+
// Force updating of native menu labels.
NativeSetItemText( nSection, nItemPos, aText );
NativeSetAccelerator( nSection, nItemPos, nAccelKey, nAccelKey.GetName( GetFrame()->GetWindow() ) );
- // Some items are special, so they have different commands.
-// if ( g_strcmp0( aNativeCommand, "" ) == 0 )
- if ( !aNativeCommand )
- {
-// gchar *aSpecialItemCmd = GetCommandForSpecialItem( pSalMenuItem );
- aNativeCommand = g_strdup( rtl::OUStringToOString( aCommand, RTL_TEXTENCODING_UTF8 ).getStr() );
-
-// if ( aSpecialItemCmd != NULL )
-// {
-// g_free( aNativeCommand );
-// aNativeCommand = aSpecialItemCmd;
-// }
- }
-
if ( g_strcmp0( aNativeCommand, "" ) != 0 && pSalMenuItem->mpSubMenu == NULL )
{
NativeSetItemCommand( nSection, nItemPos, nId, aNativeCommand, itemBits, bChecked, FALSE );
@@ -351,8 +350,6 @@ void GtkSalMenu::ImplUpdate( gboolean bRecurse )
if ( pSubMenuModel == NULL )
{
- //pSubMenuModel = g_lo_menu_new();
- //g_lo_menu_set_submenu_to_item_in_section( pLOMenu, nSection, nItemPos, G_MENU_MODEL( pSubMenuModel ) );
g_lo_menu_new_submenu_in_item_in_section( pLOMenu, nSection, nItemPos );
pSubMenuModel = g_lo_menu_get_submenu_from_item_in_section( pLOMenu, nSection, nItemPos );
}
commit 0b4912b564e63488790b79af17984ac709f0c7ea
Author: Antonio Fernandez <antonio.fernandez at aentos.es>
Date: Mon Oct 22 15:08:52 2012 +0100
Removed pre-definition of class GtkSalMenu.
Change-Id: I56652b6074d0138128178b479503a21e0bcd0c7f
diff --git a/vcl/inc/unx/gtk/gtksalmenu.hxx b/vcl/inc/unx/gtk/gtksalmenu.hxx
index b7d3bdd..2da7c88 100644
--- a/vcl/inc/unx/gtk/gtksalmenu.hxx
+++ b/vcl/inc/unx/gtk/gtksalmenu.hxx
@@ -35,7 +35,6 @@
class MenuItemList;
-class GtkSalMenu;
class GtkSalMenuItem;
commit a6838b9464b2e0935525fc8d2c7a3560c86ed482
Author: Antonio Fernandez <antonio.fernandez at aentos.es>
Date: Mon Oct 22 14:44:50 2012 +0100
Added ImplUpdate method to provide recursive and non-recursive menu updating.
Change-Id: Ifd4b3f0d68f4919a10f97d6681bfd0002fa48c7a
diff --git a/vcl/inc/unx/gtk/gtksalmenu.hxx b/vcl/inc/unx/gtk/gtksalmenu.hxx
index 5b77a29..b7d3bdd 100644
--- a/vcl/inc/unx/gtk/gtksalmenu.hxx
+++ b/vcl/inc/unx/gtk/gtksalmenu.hxx
@@ -59,6 +59,7 @@ private:
GActionGroup* mpActionGroup;
GtkSalMenu* GetMenuForItemCommand( gchar* aCommand, gboolean bGetSubmenu );
+ void ImplUpdate( gboolean bRecurse );
public:
GtkSalMenu( sal_Bool bMenuBar );
diff --git a/vcl/unx/gtk/window/gtksalmenu.cxx b/vcl/unx/gtk/window/gtksalmenu.cxx
index 38a90db..a6295c4 100644
--- a/vcl/unx/gtk/window/gtksalmenu.cxx
+++ b/vcl/unx/gtk/window/gtksalmenu.cxx
@@ -241,7 +241,7 @@ void RemoveUnusedCommands( GLOActionGroup* pActionGroup, GList* pOldCommandList,
}
}
-void GtkSalMenu::Update()
+void GtkSalMenu::ImplUpdate( gboolean bRecurse )
{
SolarMutexGuard aGuard;
//GTK_YIELD_GRAB();
@@ -358,149 +358,17 @@ void GtkSalMenu::Update()
}
g_object_unref( pSubMenuModel );
- }
-
- g_free( aNativeCommand );
-
- ++nItemPos;
- ++validItems;
- }
-
- // Delete extra items in last section.
- RemoveSpareItemsFromNativeMenu( pLOMenu, &pOldCommandList, nSection, validItems );
-
- // Delete extra sections.
- RemoveSpareSectionsFromNativeMenu( pLOMenu, &pOldCommandList, nSection );
-
- // Delete unused commands.
- RemoveUnusedCommands( pActionGroup, pOldCommandList, pNewCommandList );
-}
-void GtkSalMenu::UpdateFull()
-{
- SolarMutexGuard aGuard;
- //GTK_YIELD_GRAB();
-
- if( !PrepUpdate() )
- return;
-
- Menu* pVCLMenu = mpVCLMenu;
- GLOMenu* pLOMenu = G_LO_MENU( mpMenuModel );
- GLOActionGroup* pActionGroup = G_LO_ACTION_GROUP( mpActionGroup );
- GList *pOldCommandList = NULL;
- GList *pNewCommandList = NULL;
-
- sal_uInt16 nLOMenuSize = g_menu_model_get_n_items( G_MENU_MODEL( pLOMenu ) );
-
- if ( nLOMenuSize == 0 )
- g_lo_menu_new_section( pLOMenu, 0, NULL );
-
- sal_Int32 nSection = 0;
- sal_Int32 nItemPos = 0;
- sal_Int32 validItems = 0;
- sal_Int32 nItem;
-
- for ( nItem = 0; nItem < ( sal_Int32 ) GetItemCount(); nItem++ ) {
- if ( IsItemVisible( nItem ) == sal_False )
- continue;
-
- GtkSalMenuItem *pSalMenuItem = GetItemAtPos( nItem );
- sal_uInt16 nId = pSalMenuItem->mnId;
-
- if ( pSalMenuItem->mnType == MENUITEM_SEPARATOR )
- {
- // Delete extra items from current section.
- RemoveSpareItemsFromNativeMenu( pLOMenu, &pOldCommandList, nSection, validItems );
-
- nSection++;
- nItemPos = 0;
- validItems = 0;
-
- if ( nLOMenuSize <= nSection )
+ if ( bRecurse )
{
- g_lo_menu_new_section( pLOMenu, nSection, NULL );
- nLOMenuSize++;
- }
-
- continue;
- }
-
- if ( nItemPos >= g_lo_menu_get_n_items_from_section( pLOMenu, nSection ) )
- g_lo_menu_insert_in_section( pLOMenu, nSection, nItemPos, "EMPTY STRING" );
-
- // Get internal menu item values.
- String aText = pVCLMenu->GetItemText( nId );
- rtl::OUString aCommand( pVCLMenu->GetItemCommand( nId ) );
- sal_Bool itemEnabled = pVCLMenu->IsItemEnabled( nId );
- KeyCode nAccelKey = pVCLMenu->GetAccelKey( nId );
- sal_Bool itemChecked = pVCLMenu->IsItemChecked( nId );
- MenuItemBits itemBits = pVCLMenu->GetItemBits( nId );
-
- // Convert internal values to native values.
- gboolean bChecked = ( itemChecked == sal_True ) ? TRUE : FALSE;
- gboolean bEnabled = ( itemEnabled == sal_True ) ? TRUE : FALSE;
-// gchar* aNativeCommand = g_strdup( rtl::OUStringToOString( aCommand, RTL_TEXTENCODING_UTF8 ).getStr() );
- gchar* aNativeCommand = GetCommandForSpecialItem( pSalMenuItem );
-
- // Store current item command in command list.
- gchar *aCurrentCommand = g_lo_menu_get_command_from_item_in_section( pLOMenu, nSection, nItemPos );
-
- if ( aCurrentCommand != NULL )
- pOldCommandList = g_list_append( pOldCommandList, aCurrentCommand );
-
- // Force updating of native menu labels.
- NativeSetItemText( nSection, nItemPos, aText );
- NativeSetAccelerator( nSection, nItemPos, nAccelKey, nAccelKey.GetName( GetFrame()->GetWindow() ) );
-
- // Some items are special, so they have different commands.
-// if ( g_strcmp0( aNativeCommand, "" ) == 0 )
- if ( !aNativeCommand )
- {
-// gchar *aSpecialItemCmd = GetCommandForSpecialItem( pSalMenuItem );
- aNativeCommand = g_strdup( rtl::OUStringToOString( aCommand, RTL_TEXTENCODING_UTF8 ).getStr() );
+ pSubmenu->SetMenuModel( G_MENU_MODEL( pSubMenuModel ) );
+ pSubmenu->SetActionGroup( G_ACTION_GROUP( pActionGroup ) );
-// if ( aSpecialItemCmd != NULL )
-// {
-// g_free( aNativeCommand );
-// aNativeCommand = aSpecialItemCmd;
-// }
- }
+ pSubmenu->GetMenu()->Activate();
+ pSubmenu->GetMenu()->Deactivate();
- if ( g_strcmp0( aNativeCommand, "" ) != 0 && pSalMenuItem->mpSubMenu == NULL )
- {
- NativeSetItemCommand( nSection, nItemPos, nId, aNativeCommand, itemBits, bChecked, FALSE );
- NativeCheckItem( nSection, nItemPos, itemBits, bChecked );
- NativeSetEnableItem( aNativeCommand, bEnabled );
-
- pNewCommandList = g_list_append( pNewCommandList, g_strdup( aNativeCommand ) );
- }
-
- GtkSalMenu* pSubmenu = pSalMenuItem->mpSubMenu;
-
- if ( pSubmenu && pSubmenu->GetMenu() )
- {
- NativeSetItemCommand( nSection, nItemPos, nId, aNativeCommand, itemBits, FALSE, TRUE );
- pNewCommandList = g_list_append( pNewCommandList, g_strdup( aNativeCommand ) );
-
- GLOMenu* pSubMenuModel = g_lo_menu_get_submenu_from_item_in_section( pLOMenu, nSection, nItemPos );
-
- if ( pSubMenuModel == NULL )
- {
- //pSubMenuModel = g_lo_menu_new();
- //g_lo_menu_set_submenu_to_item_in_section( pLOMenu, nSection, nItemPos, G_MENU_MODEL( pSubMenuModel ) );
- g_lo_menu_new_submenu_in_item_in_section( pLOMenu, nSection, nItemPos );
- pSubMenuModel = g_lo_menu_get_submenu_from_item_in_section( pLOMenu, nSection, nItemPos );
+ pSubmenu->ImplUpdate( bRecurse );
}
-
- g_object_unref( pSubMenuModel );
-
- pSubmenu->SetMenuModel( G_MENU_MODEL( pSubMenuModel ) );
- pSubmenu->SetActionGroup( G_ACTION_GROUP( pActionGroup ) );
-
- pSubmenu->GetMenu()->Activate();
- pSubmenu->GetMenu()->Deactivate();
-
- pSubmenu->UpdateFull();
}
g_free( aNativeCommand );
@@ -519,6 +387,16 @@ void GtkSalMenu::UpdateFull()
RemoveUnusedCommands( pActionGroup, pOldCommandList, pNewCommandList );
}
+void GtkSalMenu::Update()
+{
+ ImplUpdate( FALSE );
+}
+
+void GtkSalMenu::UpdateFull()
+{
+ ImplUpdate( TRUE );
+}
+
/*
* GtkSalMenu
commit 376e6c3d8348cfa0942f2abbdaf6c4a7c70a93b7
Author: Antonio Fernandez <antonio.fernandez at aentos.es>
Date: Mon Oct 22 14:29:14 2012 +0100
Some code refactoring.
Change-Id: I47d9be121898ca66f73488be4b46cc16cc4013a9
diff --git a/vcl/inc/unx/gtk/gtksalmenu.hxx b/vcl/inc/unx/gtk/gtksalmenu.hxx
index 81ff193..5b77a29 100644
--- a/vcl/inc/unx/gtk/gtksalmenu.hxx
+++ b/vcl/inc/unx/gtk/gtksalmenu.hxx
@@ -40,7 +40,7 @@ class GtkSalMenuItem;
// Generate the complete structure of a menu.
-static void GenerateFullMenu( GtkSalMenu* pSalMenu );
+//static void GenerateFullMenu( GtkSalMenu* pSalMenu );
class GtkSalMenu : public SalMenu
@@ -110,7 +110,8 @@ public:
void Deactivate( const gchar* aMenuCommand );
void Display( sal_Bool bVisible );
bool PrepUpdate();
-// void UpdateNativeMenu();
+ void Update(); // Update this menu only.
+ void UpdateFull(); // Update full menu hierarchy from this menu.
};
class GtkSalMenuItem : public SalMenuItem
diff --git a/vcl/unx/gtk/window/gtkframe.cxx b/vcl/unx/gtk/window/gtkframe.cxx
index dbbb088..56f01e0 100644
--- a/vcl/unx/gtk/window/gtkframe.cxx
+++ b/vcl/unx/gtk/window/gtkframe.cxx
@@ -572,7 +572,7 @@ void on_registrar_available( GDBusConnection * /*connection*/,
{
GtkSalMenu* pGtkSalMenu = static_cast<GtkSalMenu*>(pSalMenu);
pGtkSalMenu->Display( sal_True );
- pGtkSalMenu->UpdateNativeMenu();
+ pGtkSalMenu->UpdateFull();
}
}
diff --git a/vcl/unx/gtk/window/gtksalmenu.cxx b/vcl/unx/gtk/window/gtksalmenu.cxx
index d094a4f..38a90db 100644
--- a/vcl/unx/gtk/window/gtksalmenu.cxx
+++ b/vcl/unx/gtk/window/gtksalmenu.cxx
@@ -241,7 +241,7 @@ void RemoveUnusedCommands( GLOActionGroup* pActionGroup, GList* pOldCommandList,
}
}
-void GtkSalMenu::UpdateNativeMenu()
+void GtkSalMenu::Update()
{
SolarMutexGuard aGuard;
//GTK_YIELD_GRAB();
@@ -376,17 +376,17 @@ void GtkSalMenu::UpdateNativeMenu()
RemoveUnusedCommands( pActionGroup, pOldCommandList, pNewCommandList );
}
-static void GenerateFullMenu( GtkSalMenu* pSalMenu )
+void GtkSalMenu::UpdateFull()
{
SolarMutexGuard aGuard;
//GTK_YIELD_GRAB();
- if( !pSalMenu || !pSalMenu->PrepUpdate() )
+ if( !PrepUpdate() )
return;
- Menu* pVCLMenu = pSalMenu->GetMenu();
- GLOMenu* pLOMenu = G_LO_MENU( pSalMenu->GetMenuModel() );
- GLOActionGroup* pActionGroup = G_LO_ACTION_GROUP( pSalMenu->GetActionGroup() );
+ Menu* pVCLMenu = mpVCLMenu;
+ GLOMenu* pLOMenu = G_LO_MENU( mpMenuModel );
+ GLOActionGroup* pActionGroup = G_LO_ACTION_GROUP( mpActionGroup );
GList *pOldCommandList = NULL;
GList *pNewCommandList = NULL;
@@ -400,11 +400,11 @@ static void GenerateFullMenu( GtkSalMenu* pSalMenu )
sal_Int32 validItems = 0;
sal_Int32 nItem;
- for ( nItem = 0; nItem < ( sal_Int32 ) pSalMenu->GetItemCount(); nItem++ ) {
- if ( pSalMenu->IsItemVisible( nItem ) == sal_False )
+ for ( nItem = 0; nItem < ( sal_Int32 ) GetItemCount(); nItem++ ) {
+ if ( IsItemVisible( nItem ) == sal_False )
continue;
- GtkSalMenuItem *pSalMenuItem = pSalMenu->GetItemAtPos( nItem );
+ GtkSalMenuItem *pSalMenuItem = GetItemAtPos( nItem );
sal_uInt16 nId = pSalMenuItem->mnId;
if ( pSalMenuItem->mnType == MENUITEM_SEPARATOR )
@@ -440,7 +440,7 @@ static void GenerateFullMenu( GtkSalMenu* pSalMenu )
gboolean bChecked = ( itemChecked == sal_True ) ? TRUE : FALSE;
gboolean bEnabled = ( itemEnabled == sal_True ) ? TRUE : FALSE;
// gchar* aNativeCommand = g_strdup( rtl::OUStringToOString( aCommand, RTL_TEXTENCODING_UTF8 ).getStr() );
- gchar* aNativeCommand = pSalMenu->GetCommandForSpecialItem( pSalMenuItem );
+ gchar* aNativeCommand = GetCommandForSpecialItem( pSalMenuItem );
// Store current item command in command list.
gchar *aCurrentCommand = g_lo_menu_get_command_from_item_in_section( pLOMenu, nSection, nItemPos );
@@ -449,8 +449,8 @@ static void GenerateFullMenu( GtkSalMenu* pSalMenu )
pOldCommandList = g_list_append( pOldCommandList, aCurrentCommand );
// Force updating of native menu labels.
- pSalMenu->NativeSetItemText( nSection, nItemPos, aText );
- pSalMenu->NativeSetAccelerator( nSection, nItemPos, nAccelKey, nAccelKey.GetName( GetFrame()->GetWindow() ) );
+ NativeSetItemText( nSection, nItemPos, aText );
+ NativeSetAccelerator( nSection, nItemPos, nAccelKey, nAccelKey.GetName( GetFrame()->GetWindow() ) );
// Some items are special, so they have different commands.
// if ( g_strcmp0( aNativeCommand, "" ) == 0 )
@@ -468,9 +468,9 @@ static void GenerateFullMenu( GtkSalMenu* pSalMenu )
if ( g_strcmp0( aNativeCommand, "" ) != 0 && pSalMenuItem->mpSubMenu == NULL )
{
- pSalMenu->NativeSetItemCommand( nSection, nItemPos, nId, aNativeCommand, itemBits, bChecked, FALSE );
- pSalMenu->NativeCheckItem( nSection, nItemPos, itemBits, bChecked );
- pSalMenu->NativeSetEnableItem( aNativeCommand, bEnabled );
+ NativeSetItemCommand( nSection, nItemPos, nId, aNativeCommand, itemBits, bChecked, FALSE );
+ NativeCheckItem( nSection, nItemPos, itemBits, bChecked );
+ NativeSetEnableItem( aNativeCommand, bEnabled );
pNewCommandList = g_list_append( pNewCommandList, g_strdup( aNativeCommand ) );
}
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list