diff options
Diffstat (limited to 'vcl/inc')
-rw-r--r-- | vcl/inc/unx/gtk/gtkbackend.hxx | 8 | ||||
-rw-r--r-- | vcl/inc/unx/gtk/gtkdata.hxx | 12 | ||||
-rw-r--r-- | vcl/inc/unx/gtk/gtkframe.hxx | 33 | ||||
-rw-r--r-- | vcl/inc/unx/gtk/gtkgdi.hxx | 9 | ||||
-rw-r--r-- | vcl/inc/unx/gtk/gtkinst.hxx | 22 | ||||
-rw-r--r-- | vcl/inc/unx/gtk/gtkobject.hxx | 2 | ||||
-rw-r--r-- | vcl/inc/unx/gtk/gtksalmenu.hxx | 2 | ||||
-rw-r--r-- | vcl/inc/unx/gtk/gtksys.hxx | 4 |
8 files changed, 86 insertions, 6 deletions
diff --git a/vcl/inc/unx/gtk/gtkbackend.hxx b/vcl/inc/unx/gtk/gtkbackend.hxx index 288311b41fca..03b2e021313b 100644 --- a/vcl/inc/unx/gtk/gtkbackend.hxx +++ b/vcl/inc/unx/gtk/gtkbackend.hxx @@ -12,11 +12,19 @@ #include <gtk/gtk.h> #if defined(GDK_WINDOWING_X11) +#if GTK_CHECK_VERSION(4, 0, 0) +#include <gdk/x11/gdkx.h> +#else #include <gdk/gdkx.h> +#endif bool DLSYM_GDK_IS_X11_DISPLAY(GdkDisplay* pDisplay); #endif #if defined(GDK_WINDOWING_WAYLAND) +#if GTK_CHECK_VERSION(4, 0, 0) +#include <gdk/wayland/gdkwayland.h> +#else #include <gdk/gdkwayland.h> +#endif bool DLSYM_GDK_IS_WAYLAND_DISPLAY(GdkDisplay* pDisplay); #endif diff --git a/vcl/inc/unx/gtk/gtkdata.hxx b/vcl/inc/unx/gtk/gtkdata.hxx index 976412cfb6d5..2a741e855b94 100644 --- a/vcl/inc/unx/gtk/gtkdata.hxx +++ b/vcl/inc/unx/gtk/gtkdata.hxx @@ -21,9 +21,13 @@ #define INCLUDED_VCL_INC_UNX_GTK_GTKDATA_HXX #define GLIB_DISABLE_DEPRECATION_WARNINGS +#include <gtk/gtk.h> #include <gdk/gdk.h> +#if GTK_CHECK_VERSION(4,0,0) +#include <gdk/x11/gdkx.h> +#else #include <gdk/gdkx.h> -#include <gtk/gtk.h> +#endif #include <com/sun/star/accessibility/XAccessibleContext.hpp> #include <com/sun/star/accessibility/XAccessibleEventListener.hpp> @@ -42,10 +46,12 @@ namespace com::sun::star::accessibility { class XAccessibleEventListener; } class GtkSalDisplay; class DocumentFocusListener; +#if !GTK_CHECK_VERSION(4,0,0) inline ::Window widget_get_xid(GtkWidget *widget) { return GDK_WINDOW_XID(gtk_widget_get_window(widget)); } +#endif class GtkSalTimer final : public SalTimer { @@ -182,11 +188,13 @@ public: SalX11Screen GetDefaultXScreen() { return m_pSys->GetDisplayDefaultXScreen(); } Size GetScreenSize( int nDisplayScreen ); - GdkFilterReturn filterGdkEvent( GdkXEvent* sys_event ); void startupNotificationCompleted() { m_bStartupCompleted = true; } +#if !GTK_CHECK_VERSION(4,0,0) + GdkFilterReturn filterGdkEvent( GdkXEvent* sys_event ); void screenSizeChanged( GdkScreen const * ); void monitorsChanged( GdkScreen const * ); +#endif virtual void TriggerUserEventProcessing() override; virtual void TriggerAllUserEventsProcessed() override; diff --git a/vcl/inc/unx/gtk/gtkframe.hxx b/vcl/inc/unx/gtk/gtkframe.hxx index f2e2386f7971..ab54f8fe3254 100644 --- a/vcl/inc/unx/gtk/gtkframe.hxx +++ b/vcl/inc/unx/gtk/gtkframe.hxx @@ -22,9 +22,10 @@ #include <cairo.h> #include <gdk/gdk.h> -#include <gdk/gdkx.h> #include <gtk/gtk.h> +#if !GTK_CHECK_VERSION(4,0,0) #include <gtk/gtkx.h> +#endif #include <gdk/gdkkeysyms.h> #include <salframe.hxx> @@ -63,6 +64,7 @@ class GtkSalFrame final : public SalFrame struct IMHandler { +#if !GTK_CHECK_VERSION(4, 0, 0) // Not all GTK Input Methods swallow key release // events. Since they swallow the key press events and we // are left with the key release events, we need to @@ -125,9 +127,12 @@ class GtkSalFrame final : public SalFrame ; } }; +#endif GtkSalFrame* m_pFrame; +#if !GTK_CHECK_VERSION(4, 0, 0) std::list< PreviousKeyPress > m_aPrevKeyPresses; +#endif int m_nPrevKeyPresses; // avoid using size() GtkIMContext* m_pIMContext; bool m_bFocused; @@ -142,7 +147,9 @@ class GtkSalFrame final : public SalFrame void deleteIMContext(); void updateIMSpotLocation(); void endExtTextInput( EndExtTextInputFlags nFlags ); +#if !GTK_CHECK_VERSION(4, 0, 0) bool handleKeyEvent( GdkEventKey* pEvent ); +#endif void focusChanged( bool bFocusIn ); void doCallEndExtTextInput(); @@ -163,16 +170,22 @@ class GtkSalFrame final : public SalFrame GtkWidget* m_pWindow; GtkHeaderBar* m_pHeaderBar; GtkGrid* m_pTopLevelGrid; +#if !GTK_CHECK_VERSION(4, 0, 0) GtkEventBox* m_pEventBox; +#endif GtkFixed* m_pFixedContainer; +#if !GTK_CHECK_VERSION(4, 0, 0) GdkWindow* m_pForeignParent; GdkNativeWindow m_aForeignParentWindow; GdkWindow* m_pForeignTopLevel; GdkNativeWindow m_aForeignTopLevelWindow; +#endif SalFrameStyleFlags m_nStyle; GtkSalFrame* m_pParent; std::list< GtkSalFrame* > m_aChildren; +#if !GTK_CHECK_VERSION(4, 0, 0) GdkWindowState m_nState; +#endif SystemEnvData m_aSystemData; std::unique_ptr<GtkSalGraphics> m_pGraphics; bool m_bGraphics; @@ -208,12 +221,14 @@ class GtkSalFrame final : public SalFrame GtkSalMenu* m_pSalMenu; +#if !GTK_CHECK_VERSION(4, 0, 0) #if ENABLE_DBUS && ENABLE_GIO private: friend void ensure_dbus_setup(GdkWindow* gdkWindow, GtkSalFrame* pSalFrame); friend void on_registrar_available (GDBusConnection*, const gchar*, const gchar*, gpointer); friend void on_registrar_unavailable (GDBusConnection*, const gchar*, gpointer); #endif +#endif guint m_nWatcherId; void Init( SalFrame* pParent, SalFrameStyleFlags nStyle ); @@ -221,6 +236,7 @@ class GtkSalFrame final : public SalFrame void InitCommon(); void InvalidateGraphics(); +#if !GTK_CHECK_VERSION(4, 0, 0) // signals static gboolean signalButton( GtkWidget*, GdkEventButton*, gpointer ); static void signalStyleUpdated(GtkWidget*, gpointer); @@ -258,6 +274,7 @@ class GtkSalFrame final : public SalFrame static gboolean signalScroll( GtkWidget*, GdkEvent*, gpointer ); static gboolean signalCrossing( GtkWidget*, GdkEventCrossing*, gpointer ); static void signalDestroy( GtkWidget*, gpointer ); +#endif void Center(); void SetDefaultSize(); @@ -271,7 +288,9 @@ class GtkSalFrame final : public SalFrame bool bSendRelease ); +#if !GTK_CHECK_VERSION(4, 0, 0) static GdkNativeWindow findTopLevelSystemWindow( GdkNativeWindow aWindow ); +#endif static int m_nFloats; @@ -338,7 +357,9 @@ public: static GdkDisplay* getGdkDisplay(); GtkWidget* getWindow() const { return m_pWindow; } GtkFixed* getFixedContainer() const { return m_pFixedContainer; } +#if !GTK_CHECK_VERSION(4, 0, 0) GtkEventBox* getEventBox() const { return m_pEventBox; } +#endif GtkWidget* getMouseEventWidget() const; GtkGrid* getTopLevelGridWidget() const { return m_pTopLevelGrid; } const SalX11Screen& getXScreenNumber() const { return m_nXScreen; } @@ -373,15 +394,19 @@ public: m_pDragSource = nullptr; } +#if !GTK_CHECK_VERSION(4, 0, 0) void startDrag(gint nButton, gint nDragOriginX, gint nDragOriginY, GdkDragAction sourceActions, GtkTargetList* pTargetList); +#endif void closePopup(); void addGrabLevel(); void removeGrabLevel(); +#if !GTK_CHECK_VERSION(4, 0, 0) void nopaint_container_resize_children(GtkContainer*); +#endif void LaunchAsyncScroll(GdkEvent const * pEvent); DECL_LINK(AsyncScroll, Timer *, void); @@ -515,12 +540,16 @@ public: static void UpdateLastInputEventTime(guint32 nUserInputTime); static sal_uInt16 GetMouseModCode(guint nState); static sal_uInt16 GetKeyCode(guint nKeyVal); +#if !GTK_CHECK_VERSION(4, 0, 0) static guint GetKeyValFor(GdkKeymap* pKeyMap, guint16 hardware_keycode, guint8 group); +#endif static sal_uInt16 GetKeyModCode(guint nState); static GdkEvent* makeFakeKeyPress(GtkWidget* pWidget); +#if !GTK_CHECK_VERSION(4, 0, 0) static SalWheelMouseEvent GetWheelEvent(const GdkEventScroll& rEvent); static gboolean NativeWidgetHelpPressed(GtkAccelGroup*, GObject*, guint, GdkModifierType, gpointer pFrame); +#endif static OUString GetPreeditDetails(GtkIMContext* pIMContext, std::vector<ExtTextInputAttr>& rInputFlags, sal_Int32& rCursorPos, sal_uInt8& rCursorFlags); static Selection CalcDeleteSurroundingSelection(const OUString& rSurroundingText, sal_Int32 nCursorIndex, int nOffset, int nChars); @@ -531,12 +560,14 @@ public: #define OOO_TYPE_FIXED ooo_fixed_get_type() +#if !GTK_CHECK_VERSION(4, 0, 0) extern "C" { GType ooo_fixed_get_type(); AtkObject* ooo_fixed_get_accessible(GtkWidget *obj); } // extern "C" +#endif #if !GTK_CHECK_VERSION(3, 22, 0) enum GdkAnchorHints diff --git a/vcl/inc/unx/gtk/gtkgdi.hxx b/vcl/inc/unx/gtk/gtkgdi.hxx index 5ff7a562af82..44bcec7fd5d6 100644 --- a/vcl/inc/unx/gtk/gtkgdi.hxx +++ b/vcl/inc/unx/gtk/gtkgdi.hxx @@ -98,6 +98,7 @@ class GtkSalGraphics : public SvpSalGraphics GtkSalFrame * const mpFrame; protected: +#if !GTK_CHECK_VERSION(4, 0, 0) bool isNativeControlSupported(ControlType, ControlPart) override; virtual bool drawNativeControl( ControlType nType, ControlPart nPart, const tools::Rectangle& rControlRegion, @@ -111,6 +112,7 @@ protected: const OUString& rCaption, tools::Rectangle &rNativeBoundingRegion, tools::Rectangle &rNativeContentRegion ) override; +#endif bool updateSettings(AllSettings&) override; void handleDamage(const tools::Rectangle&) override; @@ -118,11 +120,9 @@ public: GtkSalGraphics( GtkSalFrame *pFrame, GtkWidget *pWindow ); #if ENABLE_CAIRO_CANVAS - virtual bool SupportsCairo() const override; virtual cairo::SurfaceSharedPtr CreateSurface(const cairo::CairoSurfaceSharedPtr& rSurface) const override; virtual cairo::SurfaceSharedPtr CreateSurface(const OutputDevice& rRefDevice, int x, int y, int width, int height) const override; - #endif void WidgetQueueDraw() const; @@ -132,7 +132,9 @@ public: virtual OUString getRenderBackendName() const override { return "gtk3svp"; } GtkStyleContext* createStyleContext(GtkControlPart ePart); +#if !GTK_CHECK_VERSION(4, 0, 0) GtkStyleContext* makeContext(GtkWidgetPath *pPath, GtkStyleContext *pParent); +#endif private: GtkWidget *mpWindow; static GtkStyleContext *mpWindowStyle; @@ -201,6 +203,7 @@ private: static GtkStyleContext *mpSeparatorMenuItemStyle; static GtkStyleContext *mpSeparatorMenuItemSeparatorStyle; +#if !GTK_CHECK_VERSION(4, 0, 0) static tools::Rectangle NWGetScrollButtonRect( ControlPart nPart, tools::Rectangle aAreaRect ); static tools::Rectangle NWGetSpinButtonRect( ControlPart nPart, tools::Rectangle aAreaRect); static tools::Rectangle NWGetComboBoxButtonRect(ControlType nType, ControlPart nPart, tools::Rectangle aAreaRect); @@ -234,7 +237,7 @@ private: static void PaintRadio(cairo_t *cr, GtkStyleContext *context, const tools::Rectangle& rControlRectangle, bool bInMenu); - +#endif static bool style_loaded; }; diff --git a/vcl/inc/unx/gtk/gtkinst.hxx b/vcl/inc/unx/gtk/gtkinst.hxx index 565a72c90a9d..ce3e1232be6a 100644 --- a/vcl/inc/unx/gtk/gtkinst.hxx +++ b/vcl/inc/unx/gtk/gtkinst.hxx @@ -53,6 +53,11 @@ public: class GtkSalFrame; +#if GTK_CHECK_VERSION(4, 0, 0) +gint gtk_dialog_run(GtkDialog *dialog); +#endif + +#if !GTK_CHECK_VERSION(4, 0, 0) struct VclToGtkHelper { std::vector<css::datatransfer::DataFlavor> aInfoToFlavor; @@ -62,13 +67,16 @@ struct VclToGtkHelper private: GtkTargetEntry makeGtkTargetEntry(const css::datatransfer::DataFlavor& rFlavor); }; +#endif class GtkTransferable : public cppu::WeakImplHelper<css::datatransfer::XTransferable> { +#if !GTK_CHECK_VERSION(4, 0, 0) protected: std::map<OUString, GdkAtom> m_aMimeTypeToAtom; std::vector<css::datatransfer::DataFlavor> getTransferDataFlavorsAsVector(GdkAtom *targets, gint n_targets); +#endif public: virtual css::uno::Any SAL_CALL getTransferData(const css::datatransfer::DataFlavor& rFlavor) override = 0; @@ -87,7 +95,9 @@ class GtkInstDropTarget final : public cppu::WeakComponentImplHelper<css::datatr GtkSalFrame* m_pFrame; GtkDnDTransferable* m_pFormatConversionRequest; bool m_bActive; +#if !GTK_CHECK_VERSION(4, 0, 0) bool m_bInDrag; +#endif sal_Int8 m_nDefaultActions; std::vector<css::uno::Reference<css::datatransfer::dnd::XDropTargetListener>> m_aListeners; public: @@ -122,10 +132,12 @@ public: m_pFormatConversionRequest = pRequest; } +#if !GTK_CHECK_VERSION(4, 0, 0) gboolean signalDragDrop(GtkWidget* pWidget, GdkDragContext* context, gint x, gint y, guint time); gboolean signalDragMotion(GtkWidget* pWidget, GdkDragContext* context, gint x, gint y, guint time); void signalDragDropReceived(GtkWidget* pWidget, GdkDragContext* context, gint x, gint y, GtkSelectionData* data, guint ttype, guint time); void signalDragLeave(GtkWidget* pWidget, GdkDragContext* context, guint time); +#endif }; class GtkInstDragSource final : public cppu::WeakComponentImplHelper<css::datatransfer::dnd::XDragSource, @@ -136,7 +148,9 @@ class GtkInstDragSource final : public cppu::WeakComponentImplHelper<css::datatr GtkSalFrame* m_pFrame; css::uno::Reference<css::datatransfer::dnd::XDragSourceListener> m_xListener; css::uno::Reference<css::datatransfer::XTransferable> m_xTrans; +#if !GTK_CHECK_VERSION(4, 0, 0) VclToGtkHelper m_aConversionHelper; +#endif public: GtkInstDragSource() : WeakComponentImplHelper(m_aMutex) @@ -147,7 +161,9 @@ public: void set_datatransfer(const css::uno::Reference<css::datatransfer::XTransferable>& rTrans, const css::uno::Reference<css::datatransfer::dnd::XDragSourceListener>& rListener); +#if !GTK_CHECK_VERSION(4, 0, 0) std::vector<GtkTargetEntry> FormatsToGtk(const css::uno::Sequence<css::datatransfer::DataFlavor> &rFormats); +#endif void setActiveDragSource(); @@ -173,8 +189,10 @@ public: void dragFailed(); void dragDelete(); +#if !GTK_CHECK_VERSION(4, 0, 0) void dragEnd(GdkDragContext* context); void dragDataGet(GtkSelectionData *data, guint info); +#endif // For LibreOffice internal D&D we provide the Transferable without Gtk // intermediaries as a shortcut, see tdf#100097 for how dbaccess depends on this @@ -226,9 +244,11 @@ public: virtual css::uno::Reference< css::uno::XInterface > CreateDragSource() override; virtual css::uno::Reference< css::uno::XInterface > CreateDropTarget() override; virtual OpenGLContext* CreateOpenGLContext() override; +#if !GTK_CHECK_VERSION(4, 0, 0) virtual weld::Builder* CreateBuilder(weld::Widget* pParent, const OUString& rUIRoot, const OUString& rUIFile) override; virtual weld::Builder* CreateInterimBuilder(vcl::Window* pParent, const OUString& rUIRoot, const OUString& rUIFile, bool bAllowCycleFocusOut, sal_uInt64 nLOKWindowId = 0) override; +#endif virtual weld::MessageDialog* CreateMessageDialog(weld::Widget* pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage) override; virtual weld::Window* GetFrameWeld(const css::uno::Reference<css::awt::XWindow>& rWindow) override; @@ -242,7 +262,9 @@ public: private: GtkSalTimer *m_pTimer; +#if !GTK_CHECK_VERSION(4, 0, 0) std::unordered_map< GdkAtom, css::uno::Reference<css::uno::XInterface> > m_aClipboards; +#endif bool IsTimerExpired(); bool bNeedsInit; cairo_font_options_t* m_pLastCairoFontOptions; diff --git a/vcl/inc/unx/gtk/gtkobject.hxx b/vcl/inc/unx/gtk/gtkobject.hxx index 8b37492e61cf..ee063873980a 100644 --- a/vcl/inc/unx/gtk/gtkobject.hxx +++ b/vcl/inc/unx/gtk/gtkobject.hxx @@ -50,8 +50,10 @@ public: private: // signals +#if !GTK_CHECK_VERSION(4, 0, 0) static gboolean signalButton( GtkWidget*, GdkEventButton*, gpointer ); static gboolean signalFocus( GtkWidget*, GdkEventFocus*, gpointer ); +#endif }; // this attempts to clip the hosted native window using gdk_window_shape_combine_region diff --git a/vcl/inc/unx/gtk/gtksalmenu.hxx b/vcl/inc/unx/gtk/gtksalmenu.hxx index 8af690d20a9d..e55cb791e90c 100644 --- a/vcl/inc/unx/gtk/gtksalmenu.hxx +++ b/vcl/inc/unx/gtk/gtksalmenu.hxx @@ -125,7 +125,9 @@ public: void CreateMenuBarWidget(); void DestroyMenuBarWidget(); +#if !GTK_CHECK_VERSION(4, 0, 0) gboolean SignalKey(GdkEventKey const * pEvent); +#endif void ReturnFocus(); virtual bool ShowNativePopupMenu(FloatingWindow * pWin, const tools::Rectangle& rRect, FloatWinPopupFlags nFlags) override; diff --git a/vcl/inc/unx/gtk/gtksys.hxx b/vcl/inc/unx/gtk/gtksys.hxx index fa6879c2125b..ef0376bebf86 100644 --- a/vcl/inc/unx/gtk/gtksys.hxx +++ b/vcl/inc/unx/gtk/gtksys.hxx @@ -17,8 +17,10 @@ class GtkSalSystem final : public SalGenericSystem { GdkDisplay *mpDisplay; +#if !GTK_CHECK_VERSION(4,0,0) // Number of monitors for every active screen. std::deque<std::pair<GdkScreen*, int> > maScreenMonitors; +#endif public: GtkSalSystem(); virtual ~GtkSalSystem() override; @@ -35,10 +37,12 @@ public: { return getXScreenFromDisplayScreen( GetDisplayBuiltInScreen() ); } SalX11Screen getXScreenFromDisplayScreen(unsigned int nDisplayScreen); void countScreenMonitors(); +#if !GTK_CHECK_VERSION(4,0,0) // We have a 'screen' number that is combined from screen-idx + monitor-idx int getScreenIdxFromPtr (GdkScreen *pScreen); int getScreenMonitorIdx (GdkScreen *pScreen, int nX, int nY); GdkScreen *getScreenMonitorFromIdx (int nIdx, gint &nMonitor); +#endif }; #endif // INCLUDED_VCL_INC_UNX_GTK_GTKSYS_HXX |