Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
097e8668
Kaydet (Commit)
097e8668
authored
Eki 15, 2012
tarafından
Antonio Fernandez
Kaydeden (comit)
Bjoern Michaelsen
Kas 14, 2012
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Menu is always visible now.
Change-Id: Ia6153c6630af2b04f3b022051aa1f7c48e2bfc1e
üst
ce989d9a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
51 deletions
+41
-51
gtkframe.hxx
vcl/inc/unx/gtk/gtkframe.hxx
+3
-2
gtkframe.cxx
vcl/unx/gtk/window/gtkframe.cxx
+35
-33
gtksalmenu.cxx
vcl/unx/gtk/window/gtksalmenu.cxx
+3
-16
No files found.
vcl/inc/unx/gtk/gtkframe.hxx
Dosyayı görüntüle @
097e8668
...
...
@@ -217,8 +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_nMenuExportId
;
guint
m_nActionGroupExportId
;
void
Init
(
SalFrame
*
pParent
,
sal_uLong
nStyle
);
void
Init
(
SystemParentData
*
pSysData
);
...
...
@@ -303,6 +301,9 @@ public:
GtkSalFrame
(
SalFrame
*
pParent
,
sal_uLong
nStyle
);
GtkSalFrame
(
SystemParentData
*
pSysData
);
guint
m_nMenuExportId
;
guint
m_nActionGroupExportId
;
// dispatches an event, returns true if dispatched
// and false else; if true was returned the event should
// be swallowed
...
...
vcl/unx/gtk/window/gtkframe.cxx
Dosyayı görüntüle @
097e8668
...
...
@@ -512,15 +512,18 @@ static void ObjectDestroyedNotify( gpointer data )
}
}
void
ensure_dbus_setup
(
GdkWindow
*
gdkWindow
,
GtkSalFrame
*
pSalFrame
)
gboolean
ensure_dbus_setup
(
gpointer
data
)
{
GtkSalFrame
*
pSalFrame
=
reinterpret_cast
<
GtkSalFrame
*
>
(
data
);
GdkWindow
*
gdkWindow
=
gtk_widget_get_window
(
pSalFrame
->
getWindow
()
);
if
(
gdkWindow
!=
NULL
&&
g_object_get_data
(
G_OBJECT
(
gdkWindow
),
"g-lo-menubar"
)
==
NULL
)
{
// Get a DBus session connection.
if
(
!
pSessionBus
)
pSessionBus
=
g_bus_get_sync
(
G_BUS_TYPE_SESSION
,
NULL
,
NULL
);
if
(
pSessionBus
==
NULL
)
return
;
if
(
!
pSessionBus
)
return
FALSE
;
// Create menu model and action group attached to this frame.
GMenuModel
*
pMenuModel
=
G_MENU_MODEL
(
g_lo_menu_new
()
);
...
...
@@ -532,11 +535,6 @@ void ensure_dbus_setup( GdkWindow* gdkWindow, GtkSalFrame* pSalFrame )
gchar
*
aDBusWindowPath
=
g_strdup_printf
(
"/window/%lu"
,
windowId
);
gchar
*
aDBusMenubarPath
=
g_strdup_printf
(
"/window/%lu/menus/menubar"
,
windowId
);
// Publish the menu model and the action group.
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
);
// 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
);
...
...
@@ -546,10 +544,17 @@ void ensure_dbus_setup( GdkWindow* gdkWindow, GtkSalFrame* pSalFrame )
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
);
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
);
g_free
(
aDBusPath
);
g_free
(
aDBusWindowPath
);
g_free
(
aDBusMenubarPath
);
}
return
FALSE
;
}
void
on_registrar_available
(
GDBusConnection
*
/*connection*/
,
...
...
@@ -560,9 +565,6 @@ void on_registrar_available( GDBusConnection * /*connection*/,
SolarMutexGuard
aGuard
;
GtkSalFrame
*
pSalFrame
=
reinterpret_cast
<
GtkSalFrame
*
>
(
user_data
);
GdkWindow
*
gdkWindow
=
gtk_widget_get_window
(
pSalFrame
->
getWindow
()
);
ensure_dbus_setup
(
gdkWindow
,
pSalFrame
);
SalMenu
*
pSalMenu
=
pSalFrame
->
GetMenu
();
...
...
@@ -597,32 +599,28 @@ void on_registrar_unavailable( GDBusConnection * /*connection*/,
void
GtkSalFrame
::
EnsureAppMenuWatch
()
{
SolarMutexGuard
aGuard
;
if
(
m_nWatcherId
)
//g_bus_unwatch_name( m_nWatcherId );
return
;
// Get a DBus session connection.
if
(
pSessionBus
==
NULL
)
if
(
!
m_nWatcherId
)
{
pSessionBus
=
g_bus_get_sync
(
G_BUS_TYPE_SESSION
,
NULL
,
NULL
);
// Get a DBus session connection.
if
(
pSessionBus
==
NULL
)
return
;
}
{
pSessionBus
=
g_bus_get_sync
(
G_BUS_TYPE_SESSION
,
NULL
,
NULL
);
if
(
pSessionBus
==
NULL
)
return
;
}
// Publish the menu only if AppMenu registrar is available.
m_nWatcherId
=
g_bus_watch_name_on_connection
(
pSessionBus
,
"com.canonical.AppMenu.Registrar"
,
G_BUS_NAME_WATCHER_FLAGS_NONE
,
on_registrar_available
,
on_registrar_unavailable
,
static_cast
<
GtkSalFrame
*>
(
this
),
NULL
);
// Publish the menu only if AppMenu registrar is available.
m_nWatcherId
=
g_bus_watch_name_on_connection
(
pSessionBus
,
"com.canonical.AppMenu.Registrar"
,
G_BUS_NAME_WATCHER_FLAGS_NONE
,
on_registrar_available
,
on_registrar_unavailable
,
static_cast
<
GtkSalFrame
*>
(
this
),
NULL
);
}
ensure_dbus_setup
(
gtk_widget_get_window
(
GTK_WIDGET
(
m_pWindow
)),
static_cast
<
GtkSalFrame
*>
(
this
)
);
ensure_dbus_setup
(
this
);
}
GtkSalFrame
::~
GtkSalFrame
()
...
...
@@ -1120,6 +1118,10 @@ void GtkSalFrame::Init( SalFrame* pParent, sal_uLong nStyle )
#if !GTK_CHECK_VERSION(3,0,0)
if
(
eWinType
==
GTK_WINDOW_TOPLEVEL
)
{
// 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
)
{
...
...
vcl/unx/gtk/window/gtksalmenu.cxx
Dosyayı görüntüle @
097e8668
...
...
@@ -244,10 +244,10 @@ void RemoveUnusedCommands( GLOActionGroup* pActionGroup, GList* pOldCommandList,
void
GtkSalMenu
::
UpdateNativeMenu
()
{
SolarMutexGuard
aGuard
;
if
(
!
PrepUpdate
()
)
return
;
Menu
*
pVCLMenu
=
mpVCLMenu
;
GLOMenu
*
pLOMenu
=
G_LO_MENU
(
mpMenuModel
);
GLOActionGroup
*
pActionGroup
=
G_LO_ACTION_GROUP
(
mpActionGroup
);
...
...
@@ -431,7 +431,7 @@ void GtkSalMenu::RemoveItem( unsigned nPos )
maItems
.
erase
(
maItems
.
begin
()
+
nPos
);
}
void
GtkSalMenu
::
SetSubMenu
(
SalMenuItem
*
pSalMenuItem
,
SalMenu
*
pSubMenu
,
unsigned
nPos
)
void
GtkSalMenu
::
SetSubMenu
(
SalMenuItem
*
pSalMenuItem
,
SalMenu
*
pSubMenu
,
unsigned
)
{
SolarMutexGuard
aGuard
;
GtkSalMenuItem
*
pItem
=
static_cast
<
GtkSalMenuItem
*
>
(
pSalMenuItem
);
...
...
@@ -455,23 +455,11 @@ void GtkSalMenu::SetFrame( const SalFrame* pFrame )
// if we had a menu on the GtkSalMenu we have to free it as we generate a
// full menu anyway and we might need to reuse an existing model and
// actiongroup
// if(mpMenuModel)
// {
// g_object_unref(G_OBJECT(mpMenuModel));
// mpMenuModel = NULL;
// }
// if(mpActionGroup)
// {
// g_object_unref(G_OBJECT(mpActionGroup));
// mpActionGroup = NULL;
// }
pFrameNonConst
->
SetMenu
(
this
);
mpFrame
=
static_cast
<
const
GtkSalFrame
*
>
(
pFrame
);
pFrameNonConst
->
EnsureAppMenuWatch
();
// Clean menu model and action group if needed.
GObject
*
pWindow
=
G_OBJECT
(
gtk_widget_get_window
(
GTK_WIDGET
(
pFrameNonConst
->
getWindow
()
)
)
);
GObject
*
pWindow
=
G_OBJECT
(
pFrameNonConst
->
getWindow
(
)
);
GLOMenu
*
pMenuModel
=
G_LO_MENU
(
g_object_get_data
(
pWindow
,
"g-lo-menubar"
)
);
GLOActionGroup
*
pActionGroup
=
G_LO_ACTION_GROUP
(
g_object_get_data
(
pWindow
,
"g-lo-action-group"
)
);
...
...
@@ -481,7 +469,6 @@ void GtkSalMenu::SetFrame( const SalFrame* pFrame )
if
(
pActionGroup
)
g_lo_action_group_clear
(
pActionGroup
);
// Generate the main menu structure.
UpdateNativeMenu
();
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment