[Libreoffice-commits] core.git: 2 commits - bridges/source editeng/source include/editeng vcl/inc vcl/unx
Caolán McNamara
caolanm at redhat.com
Tue Jul 19 21:34:36 UTC 2016
bridges/source/cpp_uno/gcc3_linux_intel/share.hxx | 19 +
bridges/source/cpp_uno/gcc3_linux_x86-64/except.cxx | 4
bridges/source/cpp_uno/gcc3_linux_x86-64/share.hxx | 172 +++++++---------
bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx | 10
bridges/source/cpp_uno/msvc_win32_intel/except.cxx | 1
editeng/source/items/numitem.cxx | 25 --
include/editeng/numitem.hxx | 8
vcl/inc/unx/gtk/gtkframe.hxx | 6
vcl/unx/gtk/gtksalmenu.cxx | 196 -------------------
vcl/unx/gtk3/gtk3gtkframe.cxx | 9
10 files changed, 105 insertions(+), 345 deletions(-)
New commits:
commit 8617010b851e000f336cf647f207557b5eeab8b7
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Jul 19 21:47:29 2016 +0100
Resolves: tdf#97404 outline space wrong on second level
Revert "tdf#42788: FORMATTING - Numbering/ordered list"
This reverts commit 6517141b6233c5f9667031bc92f66109fddf5b76.
https://gerrit.libreoffice.org/#/c/23006/ was apparently
intended to revert this, but it never was
Then there was https://gerrit.libreoffice.org/#/c/23427/
which was an attempt to improve it but it was abandoned
Then there was https://gerrit.libreoffice.org/#/c/23542/
whichw as another attempt to improve it, but it was too
abandoned.
all of which leaves us worse than when we started with
a pile of unhappy abandoned efforts and cruddy indent
Change-Id: I8b3666a957339030d5a946a2b387f452e7fb0099
diff --git a/editeng/source/items/numitem.cxx b/editeng/source/items/numitem.cxx
index 2f2a80a..3c3fa19 100644
--- a/editeng/source/items/numitem.cxx
+++ b/editeng/source/items/numitem.cxx
@@ -151,7 +151,6 @@ SvxNumberFormat::SvxNumberFormat( sal_Int16 eType,
SvxNumPositionAndSpaceMode ePositionAndSpaceMode )
: SvxNumberType(eType),
eNumAdjust(SVX_ADJUST_LEFT),
- mbNumAdjustChanged(false),
nInclUpperLevels(0),
nStart(1),
cBullet(SVX_DEF_BULLET),
@@ -181,8 +180,7 @@ SvxNumberFormat::SvxNumberFormat(const SvxNumberFormat& rFormat) :
}
SvxNumberFormat::SvxNumberFormat( SvStream &rStream )
- : mbNumAdjustChanged(false)
- , nStart(0)
+ : nStart(0)
, nBulletRelSize(100)
, nFirstLineOffset(0)
, nAbsLSpace(0)
@@ -245,26 +243,6 @@ SvxNumberFormat::~SvxNumberFormat()
delete pBulletFont;
}
-void SvxNumberFormat::SetNumberingType(sal_Int16 nSet)
-{
- if(!mbNumAdjustChanged)
- {
- // Right align Roman numbers, tdf#42788
- if(nSet == SVX_NUM_ROMAN_UPPER || nSet == SVX_NUM_ROMAN_LOWER)
- eNumAdjust = SVX_ADJUST_RIGHT;
- else if (eNumAdjust == SVX_ADJUST_RIGHT && (GetNumberingType() == SVX_NUM_ROMAN_UPPER || GetNumberingType() == SVX_NUM_ROMAN_LOWER))
- eNumAdjust = SVX_ADJUST_LEFT;
- }
-
- SvxNumberType::SetNumberingType(nSet);
-}
-
-void SvxNumberFormat::SetNumAdjust(SvxAdjust eSet)
-{
- eNumAdjust = eSet;
- mbNumAdjustChanged = true;
-}
-
void SvxNumberFormat::Store(SvStream &rStream, FontToSubsFontConverter pConverter)
{
if(pConverter && pBulletFont)
@@ -338,7 +316,6 @@ SvxNumberFormat& SvxNumberFormat::operator=( const SvxNumberFormat& rFormat )
SvxNumberType::SetNumberingType(rFormat.GetNumberingType());
eNumAdjust = rFormat.eNumAdjust ;
- mbNumAdjustChanged = rFormat.mbNumAdjustChanged;
nInclUpperLevels = rFormat.nInclUpperLevels ;
nStart = rFormat.nStart ;
cBullet = rFormat.cBullet ;
diff --git a/include/editeng/numitem.hxx b/include/editeng/numitem.hxx
index 13ffac0..e87b74f 100644
--- a/include/editeng/numitem.hxx
+++ b/include/editeng/numitem.hxx
@@ -60,12 +60,12 @@ class EDITENG_DLLPUBLIC SvxNumberType
public:
explicit SvxNumberType(sal_Int16 nType = css::style::NumberingType::ARABIC);
SvxNumberType(const SvxNumberType& rType);
- virtual ~SvxNumberType();
+ ~SvxNumberType();
OUString GetNumStr( sal_uLong nNo ) const;
OUString GetNumStr( sal_uLong nNo, const css::lang::Locale& rLocale ) const;
- virtual void SetNumberingType(sal_Int16 nSet) {nNumType = nSet;}
+ void SetNumberingType(sal_Int16 nSet) {nNumType = nSet;}
sal_Int16 GetNumberingType() const {return nNumType;}
void SetShowSymbol(bool bSet) {bShowSymbol = bSet;}
@@ -99,7 +99,6 @@ private:
OUString sSuffix;
SvxAdjust eNumAdjust;
- bool mbNumAdjustChanged;
sal_uInt8 nInclUpperLevels; // Take over numbers from the previous level.
sal_uInt16 nStart; // Start of counting
@@ -155,8 +154,7 @@ public:
bool operator==( const SvxNumberFormat& ) const;
bool operator!=( const SvxNumberFormat& rFmt) const {return !(*this == rFmt);}
- void SetNumberingType(sal_Int16 nSet) override;
- void SetNumAdjust(SvxAdjust eSet);
+ void SetNumAdjust(SvxAdjust eSet) {eNumAdjust = eSet;}
SvxAdjust GetNumAdjust() const {return eNumAdjust;}
void SetPrefix(const OUString& rSet) { sPrefix = rSet;}
const OUString& GetPrefix() const { return sPrefix;}
commit f5792667cafef77cc4c142f4261f8b64280bc0fe
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Jul 19 15:12:55 2016 +0100
hack for now
Change-Id: I62673e60ac8785c74fc4f97ad76bcb02c7e28941
diff --git a/bridges/source/cpp_uno/gcc3_linux_intel/share.hxx b/bridges/source/cpp_uno/gcc3_linux_intel/share.hxx
index f97e81e..512ae6d 100644
--- a/bridges/source/cpp_uno/gcc3_linux_intel/share.hxx
+++ b/bridges/source/cpp_uno/gcc3_linux_intel/share.hxx
@@ -27,9 +27,8 @@
#ifndef _GLIBCXX_CDTOR_CALLABI // new in GCC 4.7 cxxabi.h
#define _GLIBCXX_CDTOR_CALLABI
#endif
-#include <unwind.h>
-#include "config_cxxabi.h"
+#include "config_gcc.h"
#include <uno/any2.h>
#include "uno/mapping.h"
@@ -38,7 +37,15 @@ namespace CPPU_CURRENT_NAMESPACE
void dummy_can_throw_anything( char const * );
-// ----- following decl from libstdc++-v3/libsupc++/unwind-cxx.h
+// ----- following decl from libstdc++-v3/libsupc++/unwind-cxx.h and unwind.h
+
+struct _Unwind_Exception
+{
+ unsigned exception_class __attribute__((__mode__(__DI__)));
+ void * exception_cleanup;
+ unsigned private_1 __attribute__((__mode__(__word__)));
+ unsigned private_2 __attribute__((__mode__(__word__)));
+} __attribute__((__aligned__));
struct __cxa_exception
{
@@ -80,17 +87,17 @@ struct __cxa_eh_globals
// __cxa_allocate_exception and __cxa_throw, though they do not have the
// additional problem of an incompletely declared return type:
-#if !HAVE_CXXABI_H_CXA_GET_GLOBALS
+#if !HAVE_GCC_CXXABI_H_CXA_GET_GLOBALS
namespace __cxxabiv1 { extern "C" void * __cxa_get_globals() throw(); }
#endif
-#if !HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION
+#if !HAVE_GCC_CXXABI_H_CXA_ALLOCATE_EXCEPTION
namespace __cxxabiv1 {
extern "C" void * __cxa_allocate_exception(std::size_t thrown_size) throw();
}
#endif
-#if !HAVE_CXXABI_H_CXA_THROW
+#if !HAVE_GCC_CXXABI_H_CXA_THROW
namespace __cxxabiv1 {
extern "C" void __cxa_throw(
void * thrown_exception, void * tinfo, void (* dest)(void *))
diff --git a/bridges/source/cpp_uno/gcc3_linux_x86-64/except.cxx b/bridges/source/cpp_uno/gcc3_linux_x86-64/except.cxx
index 04d13e80..5efd7cb 100644
--- a/bridges/source/cpp_uno/gcc3_linux_x86-64/except.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_x86-64/except.cxx
@@ -81,7 +81,7 @@ static OUString toUNOname( char const * p )
extern "C" {
static void _GLIBCXX_CDTOR_CALLABI deleteException( void * pExc )
{
- __cxxabiv1::__cxa_exception const * header = (static_cast<__cxxabiv1::__cxa_exception const *>(pExc) - 1);
+ __cxa_exception const * header = (static_cast<__cxa_exception const *>(pExc) - 1);
typelib_TypeDescription * pTD = nullptr;
OUString unoName( toUNOname( header->exceptionType->name() ) );
::typelib_typedescription_getByName( &pTD, unoName.pData );
@@ -138,7 +138,7 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp )
__cxxabiv1::__cxa_throw( pCppExc, rtti, deleteException );
}
-void fillUnoException( __cxxabiv1::__cxa_exception * header, uno_Any * pUnoExc, uno_Mapping * pCpp2Uno )
+void fillUnoException( __cxa_exception * header, uno_Any * pUnoExc, uno_Mapping * pCpp2Uno )
{
if (! header)
{
diff --git a/bridges/source/cpp_uno/gcc3_linux_x86-64/share.hxx b/bridges/source/cpp_uno/gcc3_linux_x86-64/share.hxx
index bac7ef6..96ddfc0 100644
--- a/bridges/source/cpp_uno/gcc3_linux_x86-64/share.hxx
+++ b/bridges/source/cpp_uno/gcc3_linux_x86-64/share.hxx
@@ -27,129 +27,101 @@
#ifndef _GLIBCXX_CDTOR_CALLABI // new in GCC 4.7 cxxabi.h
#define _GLIBCXX_CDTOR_CALLABI
#endif
-#include <unwind.h>
-#include "config_cxxabi.h"
+#include "config_gcc.h"
#include "uno/any2.h"
#include "uno/mapping.h"
-#if !HAVE_CXXABI_H_CLASS_TYPE_INFO
-// <https://mentorembedded.github.io/cxx-abi/abi.html>,
-// libstdc++-v3/libsupc++/cxxabi.h:
-namespace __cxxabiv1 {
-class __class_type_info: public std::type_info {
-public:
- explicit __class_type_info(char const * n): type_info(n) {}
- ~__class_type_info() override;
-};
-}
-#endif
+#ifdef _LIBCPP_VERSION
-#if !HAVE_CXXABI_H_SI_CLASS_TYPE_INFO
-// <https://mentorembedded.github.io/cxx-abi/abi.html>,
-// libstdc++-v3/libsupc++/cxxabi.h:
-namespace __cxxabiv1 {
-class __si_class_type_info: public __class_type_info {
-public:
- __class_type_info const * __base_type;
- explicit __si_class_type_info(
- char const * n, __class_type_info const *base):
- __class_type_info(n), __base_type(base) {}
- ~__si_class_type_info() override;
-};
-}
-#endif
-
-#if !HAVE_CXXABI_H_BASE_CLASS_TYPE_INFO
-// <https://mentorembedded.github.io/cxx-abi/abi.html>,
-// libstdc++-v3/libsupc++/cxxabi.h:
-namespace __cxxabiv1 {
-struct __base_class_type_info {
- __class_type_info const * __base_type;
-#if defined _GLIBCXX_LLP64
- long long __offset_flags;
-#else
- long __offset_flags;
-#endif
- enum __offset_flags_masks {
- __virtual_mask = 0x1,
- __public_mask = 0x2,
- __offset_shift = 8
+namespace __cxxabiv1
+{
+ struct __class_type_info : public std::type_info
+ {
+ explicit __class_type_info( const char *__n ) : type_info( __n ) { }
+ virtual ~__class_type_info();
};
-};
-}
-#endif
-#if !HAVE_CXXABI_H_VMI_CLASS_TYPE_INFO
-// <https://mentorembedded.github.io/cxx-abi/abi.html>,
-// libstdc++-v3/libsupc++/cxxabi.h:
-namespace __cxxabiv1 {
-class __vmi_class_type_info: public __class_type_info {
-public:
- unsigned int __flags;
- unsigned int __base_count;
- __base_class_type_info __base_info[1];
- enum __flags_masks {
- __non_diamond_repeat_mask = 0x1,
- __diamond_shaped_mask = 0x2,
- __flags_unknown_mask = 0x10
+ struct __si_class_type_info : public __class_type_info
+ {
+ explicit __si_class_type_info( const char *__n, const __class_type_info *__b ) :
+ __class_type_info( __n ), __base_type( __b ) { }
+ virtual ~__si_class_type_info();
+ const __class_type_info *__base_type;
};
- explicit __vmi_class_type_info(char const * n, int flags):
- __class_type_info(n), __flags(flags), __base_count(0) {}
- ~__vmi_class_type_info() override;
-};
+
+extern "C" void *__cxa_allocate_exception( std::size_t thrown_size ) _NOEXCEPT;
+
+extern "C" _LIBCPP_NORETURN void __cxa_throw(
+ void *thrown_exception, std::type_info *tinfo, void (*dest) (void *) );
}
-#endif
-#if !HAVE_CXXABI_H_CXA_EH_GLOBALS
-// <https://mentorembedded.github.io/cxx-abi/abi-eh.html>,
-// libcxxabi/src/cxa_exception.hpp:
-namespace __cxxabiv1 {
-struct __cxa_exception {
-#if defined _LIBCPPABI_VERSION // detect libc++abi
-#if defined __LP64__ || LIBCXXABI_ARM_EHABI
- std::size_t referenceCount;
-#endif
-#endif
- std::type_info * exceptionType;
- void (* exceptionDestructor)(void *);
- std::unexpected_handler unexpectedHandler;
- std::terminate_handler terminateHandler;
- __cxa_exception * nextException;
+#else
+
+namespace CPPU_CURRENT_NAMESPACE
+{
+
+// ----- following decl from libstdc++-v3/libsupc++/unwind-cxx.h and unwind.h
+
+struct _Unwind_Exception
+{
+ unsigned exception_class __attribute__((__mode__(__DI__)));
+ void * exception_cleanup;
+ unsigned private_1 __attribute__((__mode__(__word__)));
+ unsigned private_2 __attribute__((__mode__(__word__)));
+} __attribute__((__aligned__));
+
+struct __cxa_exception
+{
+ ::std::type_info *exceptionType;
+ void (*exceptionDestructor)(void *);
+
+ ::std::unexpected_handler unexpectedHandler;
+ ::std::terminate_handler terminateHandler;
+
+ __cxa_exception *nextException;
+
int handlerCount;
+
int handlerSwitchValue;
- char const * actionRecord;
- char const * languageSpecificData;
- void * catchTemp;
- void * adjustedPtr;
+ const unsigned char *actionRecord;
+ const unsigned char *languageSpecificData;
+ void *catchTemp;
+ void *adjustedPtr;
+
_Unwind_Exception unwindHeader;
};
-}
-#endif
-#if !HAVE_CXXABI_H_CXA_EH_GLOBALS
-// <https://mentorembedded.github.io/cxx-abi/abi-eh.html>:
-namespace __cxxabiv1 {
-struct __cxa_eh_globals {
- __cxa_exception * caughtExceptions;
+struct __cxa_eh_globals
+{
+ __cxa_exception *caughtExceptions;
unsigned int uncaughtExceptions;
};
-}
-#endif
-#if !HAVE_CXXABI_H_CXA_GET_GLOBALS
-namespace __cxxabiv1 {
-extern "C" __cxa_eh_globals * __cxa_get_globals() throw();
}
+
+// __cxa_get_globals is exported from libstdc++ since GCC 3.4.0 (CXXABI_1.3),
+// but it is only declared in cxxabi.h (in namespace __cxxabiv1) since
+// GCC 4.7.0. It returns a pointer to a struct __cxa_eh_globals, but that
+// struct is only incompletely declared even in the GCC 4.7.0 cxxabi.h.
+// Therefore, provide a declaration here for old GCC (libstdc++, really) version
+// that returns a void pointer, and in the code calling it always cast to the
+// above fake definition of CPPU_CURRENT_NAMESPACE::__cxa_eh_globals (which
+// hopefully keeps matching the real definition in libstdc++); similarly for
+// __cxa_allocate_exception and __cxa_throw, though they do not have the
+// additional problem of an incompletely declared return type:
+
+#if !HAVE_GCC_CXXABI_H_CXA_GET_GLOBALS
+namespace __cxxabiv1 { extern "C" void * __cxa_get_globals() throw(); }
#endif
-#if !HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION
+#if !HAVE_GCC_CXXABI_H_CXA_ALLOCATE_EXCEPTION
namespace __cxxabiv1 {
extern "C" void * __cxa_allocate_exception(std::size_t thrown_size) throw();
}
#endif
-#if !HAVE_CXXABI_H_CXA_THROW
+#if !HAVE_GCC_CXXABI_H_CXA_THROW
namespace __cxxabiv1 {
extern "C" void __cxa_throw(
void * thrown_exception, void * tinfo, void (* dest)(void *))
@@ -157,6 +129,8 @@ extern "C" void __cxa_throw(
}
#endif
+#endif
+
extern "C" void privateSnippetExecutor( ... );
namespace CPPU_CURRENT_NAMESPACE
@@ -166,7 +140,11 @@ void raiseException(
uno_Any * pUnoExc, uno_Mapping * pUno2Cpp );
void fillUnoException(
+#ifdef _LIBCPP_VERSION
__cxxabiv1::__cxa_exception * header, uno_Any *, uno_Mapping * pCpp2Uno );
+#else
+ __cxa_exception * header, uno_Any *, uno_Mapping * pCpp2Uno );
+#endif
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx
index 71e76a9..f65ac57 100644
--- a/bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx
@@ -294,9 +294,17 @@ static void cpp_call(
catch (...)
{
// fill uno exception
+#ifdef _LIBCPP_VERSION
CPPU_CURRENT_NAMESPACE::fillUnoException(
- __cxxabiv1::__cxa_get_globals()->caughtExceptions,
+ reinterpret_cast< __cxxabiv1::__cxa_eh_globals * >(
+ __cxxabiv1::__cxa_get_globals())->caughtExceptions,
*ppUnoExc, pThis->getBridge()->getCpp2Uno());
+#else
+ fillUnoException(
+ reinterpret_cast< CPPU_CURRENT_NAMESPACE::__cxa_eh_globals * >(
+ __cxxabiv1::__cxa_get_globals())->caughtExceptions,
+ *ppUnoExc, pThis->getBridge()->getCpp2Uno());
+#endif
// temporary params
for ( ; nTempIndices--; )
diff --git a/bridges/source/cpp_uno/msvc_win32_intel/except.cxx b/bridges/source/cpp_uno/msvc_win32_intel/except.cxx
index d6c6271..8dd8810 100644
--- a/bridges/source/cpp_uno/msvc_win32_intel/except.cxx
+++ b/bridges/source/cpp_uno/msvc_win32_intel/except.cxx
@@ -28,7 +28,6 @@
#include "rtl/strbuf.hxx"
#include "rtl/ustrbuf.hxx"
#include <sal/log.hxx>
-#include <osl/mutex.hxx>
#include "com/sun/star/uno/Any.hxx"
#include <unordered_map>
diff --git a/vcl/inc/unx/gtk/gtkframe.hxx b/vcl/inc/unx/gtk/gtkframe.hxx
index 3748847..b9514c0 100644
--- a/vcl/inc/unx/gtk/gtkframe.hxx
+++ b/vcl/inc/unx/gtk/gtkframe.hxx
@@ -171,9 +171,6 @@ class GtkSalFrame : public SalFrame
SalX11Screen m_nXScreen;
GtkWidget* m_pWindow;
-#if GTK_CHECK_VERSION(3,0,0)
- GtkGrid* m_pTopLevelGrid;
-#endif
GtkEventBox* m_pEventBox;
GtkFixed* m_pFixedContainer;
GdkWindow* m_pForeignParent;
@@ -372,9 +369,6 @@ public:
GtkFixed* getFixedContainer() const { return m_pFixedContainer; }
GtkEventBox* getEventBox() const { return m_pEventBox; }
GtkWidget* getMouseEventWidget() const;
-#if GTK_CHECK_VERSION(3,0,0)
- GtkGrid* getTopLevelGridWidget() const { return m_pTopLevelGrid; }
-#endif
GdkWindow* getForeignParent() const { return m_pForeignParent; }
GdkNativeWindow getForeignParentWindow() const { return m_aForeignParentWindow; }
GdkWindow* getForeignTopLevel() const { return m_pForeignTopLevel; }
diff --git a/vcl/unx/gtk/gtksalmenu.cxx b/vcl/unx/gtk/gtksalmenu.cxx
index 75c19c3..961d658 100644
--- a/vcl/unx/gtk/gtksalmenu.cxx
+++ b/vcl/unx/gtk/gtksalmenu.cxx
@@ -44,11 +44,7 @@ static gchar* GetCommandForItem(GtkSalMenuItem* pSalMenuItem)
bool GtkSalMenu::PrepUpdate()
{
-#if GTK_CHECK_VERSION(3,0,0)
- return mpMenuModel && mpActionGroup;
-#else
return bUnityMode && mpMenuModel && mpActionGroup;
-#endif
}
/*
@@ -325,94 +321,13 @@ void GtkSalMenu::Update()
ImplUpdate(false, !pMenu->mbMenuBar);
}
-#if GTK_CHECK_VERSION(3,0,0)
-static void MenuPositionFunc(GtkMenu* menu, gint* x, gint* y, gboolean* push_in, gpointer user_data)
-{
- Point *pPos = static_cast<Point*>(user_data);
- *x = pPos->X();
- if (gtk_widget_get_default_direction() == GTK_TEXT_DIR_RTL)
- {
- GtkRequisition natural_size;
- gtk_widget_get_preferred_size(GTK_WIDGET(menu), nullptr, &natural_size);
- *x -= natural_size.width;
- }
- *y = pPos->Y();
- *push_in = false;
-}
-#endif
-
bool GtkSalMenu::ShowNativePopupMenu(FloatingWindow* pWin, const Rectangle& rRect,
FloatWinPopupFlags nFlags)
{
-#if GTK_CHECK_VERSION(3,0,0)
- guint nButton;
- guint32 nTime;
-
- //typically there is an event, and we can then distinguish if this was
- //launched from the keyboard (gets auto-mnemoniced) or the mouse (which
- //doesn't)
- GdkEvent *pEvent = gtk_get_current_event();
- if (pEvent)
- {
- gdk_event_get_button(pEvent, &nButton);
- nTime = gdk_event_get_time(pEvent);
- }
- else
- {
- nButton = 0;
- nTime = GtkSalFrame::GetLastInputEventTime();
- }
-
- VclPtr<vcl::Window> xParent = pWin->ImplGetWindowImpl()->mpRealParent;
- mpFrame = static_cast<GtkSalFrame*>(xParent->ImplGetFrame());
-
- // do the same strange semantics as vcl popup windows to arrive at a frame geometry
- // in mirrored UI case; best done by actually executing the same code
- sal_uInt16 nArrangeIndex;
- Point aPos = FloatingWindow::ImplCalcPos(pWin, rRect, nFlags, nArrangeIndex);
- aPos = FloatingWindow::ImplConvertToAbsPos(xParent, aPos);
-
- GLOActionGroup* pActionGroup = g_lo_action_group_new();
- mpActionGroup = G_ACTION_GROUP(pActionGroup);
- mpMenuModel = G_MENU_MODEL(g_lo_menu_new());
- // Generate the main menu structure, populates mpMenuModel
- UpdateFull();
-
- GtkWidget *pWidget = gtk_menu_new_from_model(mpMenuModel);
- gtk_menu_attach_to_widget(GTK_MENU(pWidget), mpFrame->getMouseEventWidget(), nullptr);
-
- gtk_widget_insert_action_group(mpFrame->getMouseEventWidget(), "win", mpActionGroup);
-
- //run in a sub main loop because we need to keep vcl PopupMenu alive to use
- //it during DispatchCommand, returning now to the outer loop causes the
- //launching PopupMenu to be destroyed, instead run the subloop here
- //until the gtk menu is destroyed
- GMainLoop* pLoop = g_main_loop_new(nullptr, true);
- g_signal_connect_swapped(G_OBJECT(pWidget), "deactivate", G_CALLBACK(g_main_loop_quit), pLoop);
- gtk_menu_popup(GTK_MENU(pWidget), nullptr, nullptr, MenuPositionFunc,
- &aPos, nButton, nTime);
- if (g_main_loop_is_running(pLoop))
- {
- gdk_threads_leave();
- g_main_loop_run(pLoop);
- gdk_threads_enter();
- }
- g_main_loop_unref(pLoop);
-
- gtk_widget_insert_action_group(mpFrame->getMouseEventWidget(), "win", nullptr);
-
- gtk_widget_destroy(pWidget);
-
- g_object_unref(mpActionGroup);
- ClearActionGroupAndMenuModel();
-
- return true;
-#else
(void)pWin;
(void)rRect;
(void)nFlags;
return false;
-#endif
}
/*
@@ -483,11 +398,7 @@ GtkSalMenu::~GtkSalMenu()
bool GtkSalMenu::VisibleMenuBar()
{
-#if GTK_CHECK_VERSION(3,0,0)
- return mbMenuBar;
-#else
return mbMenuBar && bUnityMode;
-#endif
}
void GtkSalMenu::InsertItem( SalMenuItem* pSalMenuItem, unsigned nPos )
@@ -527,69 +438,11 @@ void GtkSalMenu::SetSubMenu( SalMenuItem* pSalMenuItem, SalMenu* pSubMenu, unsig
SetNeedsUpdate();
}
-#if GTK_CHECK_VERSION(3,0,0)
-static void CloseMenuBar(GtkWidget *, gpointer pMenu)
-{
- Application::PostUserEvent(static_cast<MenuBar*>(pMenu)->GetCloseButtonClickHdl());
-}
-#endif
-
void GtkSalMenu::ShowCloseButton(bool bShow)
{
-#if GTK_CHECK_VERSION(3,0,0)
- assert(mbMenuBar);
- MenuBar *pVclMenuBar = static_cast<MenuBar*>(mpVCLMenu.get());
- if (!bShow)
- {
- if (mpCloseButton)
- gtk_widget_destroy(mpCloseButton);
- return;
- }
-
- mpCloseButton = gtk_button_new();
- g_signal_connect(mpCloseButton, "clicked", G_CALLBACK(CloseMenuBar), pVclMenuBar);
-
- gtk_button_set_relief(GTK_BUTTON(mpCloseButton), GTK_RELIEF_NONE);
- gtk_button_set_focus_on_click(GTK_BUTTON(mpCloseButton), false);
- gtk_widget_set_can_focus(mpCloseButton, false);
-
- GtkStyleContext *pButtonContext = gtk_widget_get_style_context(GTK_WIDGET(mpCloseButton));
-
- GtkCssProvider *pProvider = gtk_css_provider_new();
- const gchar data[] = "* { "
- "padding: 0;"
- "margin-left: 8px;"
- "margin-right: 8px;"
- "min-width: 18px;"
- "min-height: 18px;"
- "}";
- gtk_css_provider_load_from_data(pProvider, data, -1, nullptr);
- gtk_style_context_add_provider(pButtonContext,
- GTK_STYLE_PROVIDER(pProvider),
- GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
-
- gtk_style_context_add_class(pButtonContext, "flat");
- gtk_style_context_add_class(pButtonContext, "small-button");
-
- GIcon* icon = g_themed_icon_new_with_default_fallbacks("window-close-symbolic");
- GtkWidget* image = gtk_image_new_from_gicon(icon, GTK_ICON_SIZE_MENU);
- gtk_widget_show(image);
- g_object_unref(icon);
-
- OUString sToolTip(VclResId(SV_HELPTEXT_CLOSEDOCUMENT));
- gtk_widget_set_tooltip_text(mpCloseButton,
- OUStringToOString(sToolTip, RTL_TEXTENCODING_UTF8).getStr());
-
- gtk_widget_set_valign(mpCloseButton, GTK_ALIGN_CENTER);
-
- gtk_container_add(GTK_CONTAINER(mpCloseButton), image);
- gtk_grid_attach(GTK_GRID(mpMenuBarContainerWidget), GTK_WIDGET(mpCloseButton), 1, 0, 1, 1);
- gtk_widget_show_all(mpCloseButton);
-#else
(void)bShow;
(void)mpMenuBarContainerWidget;
(void)mpCloseButton;
-#endif
}
//Typically when the menubar is deactivated we want the focus to return
@@ -667,56 +520,14 @@ bool GtkSalMenu::TakeFocus()
return true;
}
-#if GTK_CHECK_VERSION(3,0,0)
-
-static void MenuBarReturnFocus(GtkMenuShell*, gpointer menu)
-{
- GtkSalMenu* pMenu = static_cast<GtkSalMenu*>(menu);
- pMenu->ReturnFocus();
-}
-
-static gboolean MenuBarSignalKey(GtkWidget*, GdkEventKey* pEvent, gpointer menu)
-{
- GtkSalMenu* pMenu = static_cast<GtkSalMenu*>(menu);
- return pMenu->SignalKey(pEvent);
-}
-
-#endif
-
void GtkSalMenu::CreateMenuBarWidget()
{
-#if GTK_CHECK_VERSION(3,0,0)
- GtkGrid* pGrid = mpFrame->getTopLevelGridWidget();
- mpMenuBarContainerWidget = gtk_grid_new();
-
- gtk_widget_set_hexpand(GTK_WIDGET(mpMenuBarContainerWidget), true);
- gtk_grid_insert_row(pGrid, 0);
- gtk_grid_attach(pGrid, mpMenuBarContainerWidget, 0, 0, 1, 1);
-
- mpMenuBarWidget = gtk_menu_bar_new_from_model(mpMenuModel);
- gtk_widget_insert_action_group(mpMenuBarWidget, "win", mpActionGroup);
- gtk_widget_set_hexpand(GTK_WIDGET(mpMenuBarWidget), true);
- gtk_grid_attach(GTK_GRID(mpMenuBarContainerWidget), mpMenuBarWidget, 0, 0, 1, 1);
- g_signal_connect(G_OBJECT(mpMenuBarWidget), "deactivate", G_CALLBACK(MenuBarReturnFocus), this);
- g_signal_connect(G_OBJECT(mpMenuBarWidget), "key-press-event", G_CALLBACK(MenuBarSignalKey), this);
-
- gtk_widget_show_all(mpMenuBarContainerWidget);
-#else
(void)mpMenuBarContainerWidget;
-#endif
}
void GtkSalMenu::DestroyMenuBarWidget()
{
-#if GTK_CHECK_VERSION(3,0,0)
- if (mpMenuBarContainerWidget)
- {
- gtk_widget_destroy(mpMenuBarContainerWidget);
- mpMenuBarContainerWidget = nullptr;
- }
-#else
(void)mpMenuBarContainerWidget;
-#endif
}
void GtkSalMenu::SetFrame(const SalFrame* pFrame)
@@ -759,13 +570,6 @@ void GtkSalMenu::SetFrame(const SalFrame* pFrame)
g_lo_menu_insert_section( pMenuModel, 0, nullptr, mpMenuModel );
-#if GTK_CHECK_VERSION(3,0,0)
- if (!bUnityMode)
- {
- DestroyMenuBarWidget();
- CreateMenuBarWidget();
- }
-#endif
}
const GtkSalFrame* GtkSalMenu::GetFrame() const
diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
index adafe8b..4973c70 100644
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
@@ -819,8 +819,6 @@ GtkSalFrame::~GtkSalFrame()
gtk_widget_destroy( GTK_WIDGET( m_pFixedContainer ) );
if( m_pEventBox )
gtk_widget_destroy( GTK_WIDGET(m_pEventBox) );
- if( m_pTopLevelGrid )
- gtk_widget_destroy( GTK_WIDGET(m_pTopLevelGrid) );
{
SolarMutexGuard aGuard;
#if defined ENABLE_GMENU_INTEGRATION
@@ -966,15 +964,13 @@ void GtkSalFrame::InitCommon()
m_aDamageHandler.handle = this;
m_aDamageHandler.damaged = ::damaged;
- m_pTopLevelGrid = GTK_GRID(gtk_grid_new());
- gtk_container_add(GTK_CONTAINER(m_pWindow), GTK_WIDGET(m_pTopLevelGrid));
m_pEventBox = GTK_EVENT_BOX(gtk_event_box_new());
gtk_widget_add_events( GTK_WIDGET(m_pEventBox),
GDK_ALL_EVENTS_MASK );
gtk_widget_set_vexpand(GTK_WIDGET(m_pEventBox), true);
gtk_widget_set_hexpand(GTK_WIDGET(m_pEventBox), true);
- gtk_grid_attach(m_pTopLevelGrid, GTK_WIDGET(m_pEventBox), 0, 0, 1, 1);
+ gtk_container_add(GTK_CONTAINER(m_pWindow), GTK_WIDGET(m_pEventBox));
// add the fixed container child,
// fixed is needed since we have to position plugin windows
@@ -1074,7 +1070,7 @@ void GtkSalFrame::InitCommon()
);
// show the widgets
- gtk_widget_show_all(GTK_WIDGET(m_pTopLevelGrid));
+ gtk_widget_show_all(GTK_WIDGET(m_pEventBox));
// realize the window, we need an XWindow id
gtk_widget_realize( m_pWindow );
@@ -3462,7 +3458,6 @@ void GtkSalFrame::signalDestroy( GtkWidget* pObj, gpointer frame )
{
pThis->m_pFixedContainer = nullptr;
pThis->m_pEventBox = nullptr;
- pThis->m_pTopLevelGrid = nullptr;
pThis->m_pWindow = nullptr;
pThis->InvalidateGraphics();
}
More information about the Libreoffice-commits
mailing list