hack for now
Change-Id: I62673e60ac8785c74fc4f97ad76bcb02c7e28941
This commit is contained in:
@@ -27,9 +27,8 @@
|
|||||||
#ifndef _GLIBCXX_CDTOR_CALLABI // new in GCC 4.7 cxxabi.h
|
#ifndef _GLIBCXX_CDTOR_CALLABI // new in GCC 4.7 cxxabi.h
|
||||||
#define _GLIBCXX_CDTOR_CALLABI
|
#define _GLIBCXX_CDTOR_CALLABI
|
||||||
#endif
|
#endif
|
||||||
#include <unwind.h>
|
|
||||||
|
|
||||||
#include "config_cxxabi.h"
|
#include "config_gcc.h"
|
||||||
#include <uno/any2.h>
|
#include <uno/any2.h>
|
||||||
#include "uno/mapping.h"
|
#include "uno/mapping.h"
|
||||||
|
|
||||||
@@ -38,7 +37,15 @@ namespace CPPU_CURRENT_NAMESPACE
|
|||||||
|
|
||||||
void dummy_can_throw_anything( char const * );
|
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
|
struct __cxa_exception
|
||||||
{
|
{
|
||||||
@@ -80,17 +87,17 @@ struct __cxa_eh_globals
|
|||||||
// __cxa_allocate_exception and __cxa_throw, though they do not have the
|
// __cxa_allocate_exception and __cxa_throw, though they do not have the
|
||||||
// additional problem of an incompletely declared return type:
|
// 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(); }
|
namespace __cxxabiv1 { extern "C" void * __cxa_get_globals() throw(); }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION
|
#if !HAVE_GCC_CXXABI_H_CXA_ALLOCATE_EXCEPTION
|
||||||
namespace __cxxabiv1 {
|
namespace __cxxabiv1 {
|
||||||
extern "C" void * __cxa_allocate_exception(std::size_t thrown_size) throw();
|
extern "C" void * __cxa_allocate_exception(std::size_t thrown_size) throw();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !HAVE_CXXABI_H_CXA_THROW
|
#if !HAVE_GCC_CXXABI_H_CXA_THROW
|
||||||
namespace __cxxabiv1 {
|
namespace __cxxabiv1 {
|
||||||
extern "C" void __cxa_throw(
|
extern "C" void __cxa_throw(
|
||||||
void * thrown_exception, void * tinfo, void (* dest)(void *))
|
void * thrown_exception, void * tinfo, void (* dest)(void *))
|
||||||
|
@@ -81,7 +81,7 @@ static OUString toUNOname( char const * p )
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
static void _GLIBCXX_CDTOR_CALLABI deleteException( void * pExc )
|
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;
|
typelib_TypeDescription * pTD = nullptr;
|
||||||
OUString unoName( toUNOname( header->exceptionType->name() ) );
|
OUString unoName( toUNOname( header->exceptionType->name() ) );
|
||||||
::typelib_typedescription_getByName( &pTD, unoName.pData );
|
::typelib_typedescription_getByName( &pTD, unoName.pData );
|
||||||
@@ -138,7 +138,7 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp )
|
|||||||
__cxxabiv1::__cxa_throw( pCppExc, rtti, deleteException );
|
__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)
|
if (! header)
|
||||||
{
|
{
|
||||||
|
@@ -27,129 +27,101 @@
|
|||||||
#ifndef _GLIBCXX_CDTOR_CALLABI // new in GCC 4.7 cxxabi.h
|
#ifndef _GLIBCXX_CDTOR_CALLABI // new in GCC 4.7 cxxabi.h
|
||||||
#define _GLIBCXX_CDTOR_CALLABI
|
#define _GLIBCXX_CDTOR_CALLABI
|
||||||
#endif
|
#endif
|
||||||
#include <unwind.h>
|
|
||||||
|
|
||||||
#include "config_cxxabi.h"
|
#include "config_gcc.h"
|
||||||
#include "uno/any2.h"
|
#include "uno/any2.h"
|
||||||
#include "uno/mapping.h"
|
#include "uno/mapping.h"
|
||||||
|
|
||||||
#if !HAVE_CXXABI_H_CLASS_TYPE_INFO
|
#ifdef _LIBCPP_VERSION
|
||||||
// <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
|
|
||||||
|
|
||||||
#if !HAVE_CXXABI_H_SI_CLASS_TYPE_INFO
|
namespace __cxxabiv1
|
||||||
// <https://mentorembedded.github.io/cxx-abi/abi.html>,
|
{
|
||||||
// libstdc++-v3/libsupc++/cxxabi.h:
|
struct __class_type_info : public std::type_info
|
||||||
namespace __cxxabiv1 {
|
{
|
||||||
class __si_class_type_info: public __class_type_info {
|
explicit __class_type_info( const char *__n ) : type_info( __n ) { }
|
||||||
public:
|
virtual ~__class_type_info();
|
||||||
__class_type_info const * __base_type;
|
};
|
||||||
explicit __si_class_type_info(
|
|
||||||
char const * n, __class_type_info const *base):
|
struct __si_class_type_info : public __class_type_info
|
||||||
__class_type_info(n), __base_type(base) {}
|
{
|
||||||
~__si_class_type_info() override;
|
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();
|
||||||
#endif
|
const __class_type_info *__base_type;
|
||||||
|
};
|
||||||
|
|
||||||
|
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 *) );
|
||||||
|
}
|
||||||
|
|
||||||
#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
|
#else
|
||||||
long __offset_flags;
|
|
||||||
#endif
|
|
||||||
enum __offset_flags_masks {
|
|
||||||
__virtual_mask = 0x1,
|
|
||||||
__public_mask = 0x2,
|
|
||||||
__offset_shift = 8
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !HAVE_CXXABI_H_VMI_CLASS_TYPE_INFO
|
namespace CPPU_CURRENT_NAMESPACE
|
||||||
// <https://mentorembedded.github.io/cxx-abi/abi.html>,
|
{
|
||||||
// libstdc++-v3/libsupc++/cxxabi.h:
|
|
||||||
namespace __cxxabiv1 {
|
// ----- following decl from libstdc++-v3/libsupc++/unwind-cxx.h and unwind.h
|
||||||
class __vmi_class_type_info: public __class_type_info {
|
|
||||||
public:
|
struct _Unwind_Exception
|
||||||
unsigned int __flags;
|
{
|
||||||
unsigned int __base_count;
|
unsigned exception_class __attribute__((__mode__(__DI__)));
|
||||||
__base_class_type_info __base_info[1];
|
void * exception_cleanup;
|
||||||
enum __flags_masks {
|
unsigned private_1 __attribute__((__mode__(__word__)));
|
||||||
__non_diamond_repeat_mask = 0x1,
|
unsigned private_2 __attribute__((__mode__(__word__)));
|
||||||
__diamond_shaped_mask = 0x2,
|
} __attribute__((__aligned__));
|
||||||
__flags_unknown_mask = 0x10
|
|
||||||
};
|
struct __cxa_exception
|
||||||
explicit __vmi_class_type_info(char const * n, int flags):
|
{
|
||||||
__class_type_info(n), __flags(flags), __base_count(0) {}
|
::std::type_info *exceptionType;
|
||||||
~__vmi_class_type_info() override;
|
void (*exceptionDestructor)(void *);
|
||||||
};
|
|
||||||
}
|
::std::unexpected_handler unexpectedHandler;
|
||||||
#endif
|
::std::terminate_handler terminateHandler;
|
||||||
|
|
||||||
|
__cxa_exception *nextException;
|
||||||
|
|
||||||
#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;
|
|
||||||
int handlerCount;
|
int handlerCount;
|
||||||
|
|
||||||
int handlerSwitchValue;
|
int handlerSwitchValue;
|
||||||
char const * actionRecord;
|
const unsigned char *actionRecord;
|
||||||
char const * languageSpecificData;
|
const unsigned char *languageSpecificData;
|
||||||
void * catchTemp;
|
void *catchTemp;
|
||||||
void * adjustedPtr;
|
void *adjustedPtr;
|
||||||
|
|
||||||
_Unwind_Exception unwindHeader;
|
_Unwind_Exception unwindHeader;
|
||||||
};
|
};
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !HAVE_CXXABI_H_CXA_EH_GLOBALS
|
struct __cxa_eh_globals
|
||||||
// <https://mentorembedded.github.io/cxx-abi/abi-eh.html>:
|
{
|
||||||
namespace __cxxabiv1 {
|
__cxa_exception *caughtExceptions;
|
||||||
struct __cxa_eh_globals {
|
|
||||||
__cxa_exception * caughtExceptions;
|
|
||||||
unsigned int uncaughtExceptions;
|
unsigned int uncaughtExceptions;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// __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
|
#endif
|
||||||
|
|
||||||
#if !HAVE_CXXABI_H_CXA_GET_GLOBALS
|
#if !HAVE_GCC_CXXABI_H_CXA_ALLOCATE_EXCEPTION
|
||||||
namespace __cxxabiv1 {
|
|
||||||
extern "C" __cxa_eh_globals * __cxa_get_globals() throw();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION
|
|
||||||
namespace __cxxabiv1 {
|
namespace __cxxabiv1 {
|
||||||
extern "C" void * __cxa_allocate_exception(std::size_t thrown_size) throw();
|
extern "C" void * __cxa_allocate_exception(std::size_t thrown_size) throw();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !HAVE_CXXABI_H_CXA_THROW
|
#if !HAVE_GCC_CXXABI_H_CXA_THROW
|
||||||
namespace __cxxabiv1 {
|
namespace __cxxabiv1 {
|
||||||
extern "C" void __cxa_throw(
|
extern "C" void __cxa_throw(
|
||||||
void * thrown_exception, void * tinfo, void (* dest)(void *))
|
void * thrown_exception, void * tinfo, void (* dest)(void *))
|
||||||
@@ -157,6 +129,8 @@ extern "C" void __cxa_throw(
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
extern "C" void privateSnippetExecutor( ... );
|
extern "C" void privateSnippetExecutor( ... );
|
||||||
|
|
||||||
namespace CPPU_CURRENT_NAMESPACE
|
namespace CPPU_CURRENT_NAMESPACE
|
||||||
@@ -166,7 +140,11 @@ void raiseException(
|
|||||||
uno_Any * pUnoExc, uno_Mapping * pUno2Cpp );
|
uno_Any * pUnoExc, uno_Mapping * pUno2Cpp );
|
||||||
|
|
||||||
void fillUnoException(
|
void fillUnoException(
|
||||||
|
#ifdef _LIBCPP_VERSION
|
||||||
__cxxabiv1::__cxa_exception * header, uno_Any *, uno_Mapping * pCpp2Uno );
|
__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: */
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||||
|
@@ -294,9 +294,17 @@ static void cpp_call(
|
|||||||
catch (...)
|
catch (...)
|
||||||
{
|
{
|
||||||
// fill uno exception
|
// fill uno exception
|
||||||
|
#ifdef _LIBCPP_VERSION
|
||||||
CPPU_CURRENT_NAMESPACE::fillUnoException(
|
CPPU_CURRENT_NAMESPACE::fillUnoException(
|
||||||
__cxxabiv1::__cxa_get_globals()->caughtExceptions,
|
reinterpret_cast< __cxxabiv1::__cxa_eh_globals * >(
|
||||||
|
__cxxabiv1::__cxa_get_globals())->caughtExceptions,
|
||||||
*ppUnoExc, pThis->getBridge()->getCpp2Uno());
|
*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
|
// temporary params
|
||||||
for ( ; nTempIndices--; )
|
for ( ; nTempIndices--; )
|
||||||
|
@@ -28,7 +28,6 @@
|
|||||||
#include "rtl/strbuf.hxx"
|
#include "rtl/strbuf.hxx"
|
||||||
#include "rtl/ustrbuf.hxx"
|
#include "rtl/ustrbuf.hxx"
|
||||||
#include <sal/log.hxx>
|
#include <sal/log.hxx>
|
||||||
#include <osl/mutex.hxx>
|
|
||||||
|
|
||||||
#include "com/sun/star/uno/Any.hxx"
|
#include "com/sun/star/uno/Any.hxx"
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
@@ -171,9 +171,6 @@ class GtkSalFrame : public SalFrame
|
|||||||
|
|
||||||
SalX11Screen m_nXScreen;
|
SalX11Screen m_nXScreen;
|
||||||
GtkWidget* m_pWindow;
|
GtkWidget* m_pWindow;
|
||||||
#if GTK_CHECK_VERSION(3,0,0)
|
|
||||||
GtkGrid* m_pTopLevelGrid;
|
|
||||||
#endif
|
|
||||||
GtkEventBox* m_pEventBox;
|
GtkEventBox* m_pEventBox;
|
||||||
GtkFixed* m_pFixedContainer;
|
GtkFixed* m_pFixedContainer;
|
||||||
GdkWindow* m_pForeignParent;
|
GdkWindow* m_pForeignParent;
|
||||||
@@ -372,9 +369,6 @@ public:
|
|||||||
GtkFixed* getFixedContainer() const { return m_pFixedContainer; }
|
GtkFixed* getFixedContainer() const { return m_pFixedContainer; }
|
||||||
GtkEventBox* getEventBox() const { return m_pEventBox; }
|
GtkEventBox* getEventBox() const { return m_pEventBox; }
|
||||||
GtkWidget* getMouseEventWidget() const;
|
GtkWidget* getMouseEventWidget() const;
|
||||||
#if GTK_CHECK_VERSION(3,0,0)
|
|
||||||
GtkGrid* getTopLevelGridWidget() const { return m_pTopLevelGrid; }
|
|
||||||
#endif
|
|
||||||
GdkWindow* getForeignParent() const { return m_pForeignParent; }
|
GdkWindow* getForeignParent() const { return m_pForeignParent; }
|
||||||
GdkNativeWindow getForeignParentWindow() const { return m_aForeignParentWindow; }
|
GdkNativeWindow getForeignParentWindow() const { return m_aForeignParentWindow; }
|
||||||
GdkWindow* getForeignTopLevel() const { return m_pForeignTopLevel; }
|
GdkWindow* getForeignTopLevel() const { return m_pForeignTopLevel; }
|
||||||
|
@@ -44,11 +44,7 @@ static gchar* GetCommandForItem(GtkSalMenuItem* pSalMenuItem)
|
|||||||
|
|
||||||
bool GtkSalMenu::PrepUpdate()
|
bool GtkSalMenu::PrepUpdate()
|
||||||
{
|
{
|
||||||
#if GTK_CHECK_VERSION(3,0,0)
|
|
||||||
return mpMenuModel && mpActionGroup;
|
|
||||||
#else
|
|
||||||
return bUnityMode && mpMenuModel && mpActionGroup;
|
return bUnityMode && mpMenuModel && mpActionGroup;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -325,94 +321,13 @@ void GtkSalMenu::Update()
|
|||||||
ImplUpdate(false, !pMenu->mbMenuBar);
|
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,
|
bool GtkSalMenu::ShowNativePopupMenu(FloatingWindow* pWin, const Rectangle& rRect,
|
||||||
FloatWinPopupFlags nFlags)
|
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)pWin;
|
||||||
(void)rRect;
|
(void)rRect;
|
||||||
(void)nFlags;
|
(void)nFlags;
|
||||||
return false;
|
return false;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -483,11 +398,7 @@ GtkSalMenu::~GtkSalMenu()
|
|||||||
|
|
||||||
bool GtkSalMenu::VisibleMenuBar()
|
bool GtkSalMenu::VisibleMenuBar()
|
||||||
{
|
{
|
||||||
#if GTK_CHECK_VERSION(3,0,0)
|
|
||||||
return mbMenuBar;
|
|
||||||
#else
|
|
||||||
return mbMenuBar && bUnityMode;
|
return mbMenuBar && bUnityMode;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GtkSalMenu::InsertItem( SalMenuItem* pSalMenuItem, unsigned nPos )
|
void GtkSalMenu::InsertItem( SalMenuItem* pSalMenuItem, unsigned nPos )
|
||||||
@@ -527,69 +438,11 @@ void GtkSalMenu::SetSubMenu( SalMenuItem* pSalMenuItem, SalMenu* pSubMenu, unsig
|
|||||||
SetNeedsUpdate();
|
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)
|
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)bShow;
|
||||||
(void)mpMenuBarContainerWidget;
|
(void)mpMenuBarContainerWidget;
|
||||||
(void)mpCloseButton;
|
(void)mpCloseButton;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Typically when the menubar is deactivated we want the focus to return
|
//Typically when the menubar is deactivated we want the focus to return
|
||||||
@@ -667,56 +520,14 @@ bool GtkSalMenu::TakeFocus()
|
|||||||
return true;
|
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()
|
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;
|
(void)mpMenuBarContainerWidget;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GtkSalMenu::DestroyMenuBarWidget()
|
void GtkSalMenu::DestroyMenuBarWidget()
|
||||||
{
|
{
|
||||||
#if GTK_CHECK_VERSION(3,0,0)
|
|
||||||
if (mpMenuBarContainerWidget)
|
|
||||||
{
|
|
||||||
gtk_widget_destroy(mpMenuBarContainerWidget);
|
|
||||||
mpMenuBarContainerWidget = nullptr;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
(void)mpMenuBarContainerWidget;
|
(void)mpMenuBarContainerWidget;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GtkSalMenu::SetFrame(const SalFrame* pFrame)
|
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 );
|
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
|
const GtkSalFrame* GtkSalMenu::GetFrame() const
|
||||||
|
@@ -819,8 +819,6 @@ GtkSalFrame::~GtkSalFrame()
|
|||||||
gtk_widget_destroy( GTK_WIDGET( m_pFixedContainer ) );
|
gtk_widget_destroy( GTK_WIDGET( m_pFixedContainer ) );
|
||||||
if( m_pEventBox )
|
if( m_pEventBox )
|
||||||
gtk_widget_destroy( GTK_WIDGET(m_pEventBox) );
|
gtk_widget_destroy( GTK_WIDGET(m_pEventBox) );
|
||||||
if( m_pTopLevelGrid )
|
|
||||||
gtk_widget_destroy( GTK_WIDGET(m_pTopLevelGrid) );
|
|
||||||
{
|
{
|
||||||
SolarMutexGuard aGuard;
|
SolarMutexGuard aGuard;
|
||||||
#if defined ENABLE_GMENU_INTEGRATION
|
#if defined ENABLE_GMENU_INTEGRATION
|
||||||
@@ -966,15 +964,13 @@ void GtkSalFrame::InitCommon()
|
|||||||
m_aDamageHandler.handle = this;
|
m_aDamageHandler.handle = this;
|
||||||
m_aDamageHandler.damaged = ::damaged;
|
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());
|
m_pEventBox = GTK_EVENT_BOX(gtk_event_box_new());
|
||||||
gtk_widget_add_events( GTK_WIDGET(m_pEventBox),
|
gtk_widget_add_events( GTK_WIDGET(m_pEventBox),
|
||||||
GDK_ALL_EVENTS_MASK );
|
GDK_ALL_EVENTS_MASK );
|
||||||
gtk_widget_set_vexpand(GTK_WIDGET(m_pEventBox), true);
|
gtk_widget_set_vexpand(GTK_WIDGET(m_pEventBox), true);
|
||||||
gtk_widget_set_hexpand(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,
|
// add the fixed container child,
|
||||||
// fixed is needed since we have to position plugin windows
|
// fixed is needed since we have to position plugin windows
|
||||||
@@ -1074,7 +1070,7 @@ void GtkSalFrame::InitCommon()
|
|||||||
);
|
);
|
||||||
|
|
||||||
// show the widgets
|
// 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
|
// realize the window, we need an XWindow id
|
||||||
gtk_widget_realize( m_pWindow );
|
gtk_widget_realize( m_pWindow );
|
||||||
@@ -3462,7 +3458,6 @@ void GtkSalFrame::signalDestroy( GtkWidget* pObj, gpointer frame )
|
|||||||
{
|
{
|
||||||
pThis->m_pFixedContainer = nullptr;
|
pThis->m_pFixedContainer = nullptr;
|
||||||
pThis->m_pEventBox = nullptr;
|
pThis->m_pEventBox = nullptr;
|
||||||
pThis->m_pTopLevelGrid = nullptr;
|
|
||||||
pThis->m_pWindow = nullptr;
|
pThis->m_pWindow = nullptr;
|
||||||
pThis->InvalidateGraphics();
|
pThis->InvalidateGraphics();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user