20#ifndef INCLUDED_VCL_INC_UNX_GTK_GTKFRAME_HXX
21#define INCLUDED_VCL_INC_UNX_GTK_GTKFRAME_HXX
26#if !GTK_CHECK_VERSION(4,0,0)
29#include <gdk/gdkkeysyms.h>
39#include <com/sun/star/awt/XTopWindow.hpp>
40#include <com/sun/star/datatransfer/DataFlavor.hpp>
41#include <com/sun/star/datatransfer/dnd/XDragSource.hpp>
42#include <com/sun/star/datatransfer/dnd/XDropTarget.hpp>
47#include <config_dbus.h>
48#include <config_gio.h>
60class GtkDnDTransferable;
71#if !GTK_CHECK_VERSION(4, 0, 0)
103 state =
event->state;
106 group =
event->group;
122 return (event !=
nullptr)
123 && (
event->window ==
window)
126 && ((
event->state & GDK_MODIFIER_MASK) == (
state & GDK_MODIFIER_MASK))
127 && (event->keyval ==
keyval)
129 && (event->group ==
group)
130 && (
event->time -
time < 300)
137#if !GTK_CHECK_VERSION(4, 0, 0)
154#if !GTK_CHECK_VERSION(4, 0, 0)
177#if !GTK_CHECK_VERSION(4, 0, 0)
182 GtkOverlay* m_pOverlay;
185 GtkEventControllerKey* m_pKeyController;
186 gulong m_nSettingChangedSignalId;
193#if !GTK_CHECK_VERSION(4, 0, 0)
237#if ENABLE_DBUS && ENABLE_GIO
239 friend void on_registrar_available (
GDBusConnection*,
const gchar*,
const gchar*, gpointer);
240 friend void on_registrar_unavailable (
GDBusConnection*,
const gchar*, gpointer);
250#if !GTK_CHECK_VERSION(4, 0, 0)
258#if !GTK_CHECK_VERSION(4, 0, 0)
262 static void signalDraw(GtkDrawingArea*,
cairo_t *cr,
int width,
int height, gpointer);
267 gboolean keyboard_mode, GtkTooltip *tooltip,
269#if GTK_CHECK_VERSION(4, 0, 0)
270 static GdkDragAction
signalDragMotion(GtkDropTargetAsync *dest, GdkDrop *drop,
double x,
double y, gpointer frame);
271 static void signalDragLeave(GtkDropTargetAsync *dest, GdkDrop *drop, gpointer frame);
272 static gboolean
signalDragDrop(GtkDropTargetAsync* context, GdkDrop* drop,
double x,
double y, gpointer frame);
274 static void signalDragFailed(GdkDrag* drag, GdkDragCancelReason reason, gpointer frame);
279 guint time, gpointer frame);
281 guint time, gpointer frame);
283 GtkSelectionData *data, guint
ttype, guint time, gpointer frame);
290 guint time, gpointer frame);
293 static void gestureSwipe(GtkGestureSwipe* gesture, gdouble velocity_x, gdouble velocity_y, gpointer frame);
294 static void gestureLongPress(GtkGestureLongPress* gesture, gdouble x, gdouble y, gpointer frame);
296#if GTK_CHECK_VERSION(4, 0, 0)
297 static void gesturePressed(GtkGestureClick* gesture,
int n_press, gdouble x, gdouble y, gpointer frame);
298 static void gestureReleased(GtkGestureClick* gesture,
int n_press, gdouble x, gdouble y, gpointer frame);
299 void gestureButton(GtkGestureClick* gesture,
SalEvent nEventType, gdouble x, gdouble y);
302#if GTK_CHECK_VERSION(4, 0, 0)
303 static void signalFocusEnter(GtkEventControllerFocus* pController, gpointer frame);
304 static void signalFocusLeave(GtkEventControllerFocus* pController, gpointer frame);
308#if !GTK_CHECK_VERSION(4, 0, 0)
311 static void signalSetFocus(GtkWindow* pWindow, GParamSpec* pSpec, gpointer frame);
318 void DrawingAreaScroll(
double delta_x,
double delta_y,
int nEventX,
int nEventY, guint32 nTime, guint nState);
319#if GTK_CHECK_VERSION(4, 0, 0)
320 bool DrawingAreaKey(GtkEventControllerKey* pController,
SalEvent nEventType, guint keyval, guint keycode, guint nState);
327 static void signalMotion(GtkEventControllerMotion *controller,
double x,
double y, gpointer);
329 static gboolean
signalScroll(GtkEventControllerScroll* pController,
double delta_x,
double delta_y, gpointer);
331 static void signalEnter(GtkEventControllerMotion *controller,
double x,
double y, gpointer);
332 static void signalLeave(GtkEventControllerMotion *controller, gpointer);
334 static gboolean signalKeyPressed(GtkEventControllerKey *controller, guint keyval, guint keycode, GdkModifierType state, gpointer);
335 static gboolean signalKeyReleased(GtkEventControllerKey *controller, guint keyval, guint keycode, GdkModifierType state, gpointer);
363#if !GTK_CHECK_VERSION(4, 0, 0)
373 guint16 hardware_keycode,
380#if !GTK_CHECK_VERSION(4, 0, 0)
394 bool isChild(
bool bPlug =
true,
bool bSysChild =
true )
421 enum class SetType { RetainSize, Fullscreen, UnFullscreen };
440#if !GTK_CHECK_VERSION(4, 0, 0)
453 void grabPointer(
bool bGrab,
bool bKeyboardAlso,
bool bOwnerEvents);
466 void damaged(sal_Int32 nExtentsLeft, sal_Int32 nExtentsTop,
467 sal_Int32 nExtentsRight, sal_Int32 nExtentsBottom)
const;
493 void startDrag(
const css::datatransfer::dnd::DragGestureEvent& rEvent,
494 const css::uno::Reference<css::datatransfer::XTransferable>& rTrans,
496 GdkDragAction sourceActions);
503#if !GTK_CHECK_VERSION(4, 0, 0)
519 virtual bool PostEvent(std::unique_ptr<ImplSVEvent> pData)
override;
521 virtual void SetTitle(
const OUString& rTitle )
override;
522 virtual void SetIcon( sal_uInt16 nIcon )
override;
530 virtual void Show(
bool bVisible,
bool bNoActivate =
false )
override;
637 guint* pGdkKeyCode, GdkModifierType *pGdkModifiers);
643#if !GTK_CHECK_VERSION(4, 0, 0)
644 static guint
GetKeyValFor(GdkKeymap* pKeyMap, guint16 hardware_keycode, guint8 group);
648#if !GTK_CHECK_VERSION(4, 0, 0)
651 GdkModifierType, gpointer pFrame);
653 static OUString
GetPreeditDetails(GtkIMContext* pIMContext, std::vector<ExtTextInputAttr>& rInputFlags, sal_Int32& rCursorPos,
sal_uInt8& rCursorFlags);
655#if GTK_CHECK_VERSION(4, 0, 0)
656 gboolean event_controller_scroll_forward(GtkEventControllerScroll* pController,
double delta_x,
double delta_y);
673#if !GTK_CHECK_VERSION(4, 0, 0)
679#if !GTK_CHECK_VERSION(3, 22, 0)
struct _cairo_surface cairo_surface_t
DECL_LINK(AsyncScroll, Timer *, void)
bool doKeyCallback(guint state, guint keyval, guint16 hardware_keycode, guint8 group, sal_Unicode aOrigCode, bool bDown, bool bSendRelease)
bool m_bIconSetWhileUnmapped
static bool signalRotateBegin(GtkGesture *, GdkEventSequence *, gpointer)
GtkEventBox * m_pEventBox
static void UpdateLastInputEventTime(guint32 nUserInputTime)
virtual void SetTitle(const OUString &rTitle) override
void ListenPortalSettings()
GDBusProxy * m_pSessionManager
void SetIcon(const char *pIcon)
std::vector< GdkEvent * > m_aPendingScrollEvents
virtual void UnionClipRegion(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight) override
virtual void SetPointer(PointerStyle ePointerStyle) override
DamageHandler m_aDamageHandler
virtual ~GtkSalFrame() override
virtual void UpdateSettings(AllSettings &rSettings) override
virtual void Beep() override
bool m_bSalObjectSetPosSize
static void KeyCodeToGdkKey(const vcl::KeyCode &rKeyCode, guint *pGdkKeyCode, GdkModifierType *pGdkModifiers)
virtual void SimulateKeyPress(sal_uInt16 nKeyCode) override
std::unique_ptr< GtkSalGraphics > m_pGraphics
GdkWindow * m_pForeignTopLevel
virtual void GetWorkArea(tools::Rectangle &rRect) override
virtual weld::Window * GetFrameWeld() const override
virtual void PositionByToolkit(const tools::Rectangle &rRect, FloatWinPopupFlags nFlags) override
void widget_set_size_request(tools::Long nWidth, tools::Long nHeight)
FloatWinPopupFlags m_nFloatFlags
void ListenSessionManager()
guint m_nActionGroupExportId
void deregisterDragSource(GtkInstDragSource const *pDragSource)
static void sizeAllocated(GtkWidget *, GdkRectangle *pAllocation, gpointer frame)
static guint GetKeyValFor(GdkKeymap *pKeyMap, guint16 hardware_keycode, guint8 group)
GtkInstDropTarget * m_pDropTarget
GtkSalFrame(SystemParentData *pSysData)
virtual void SetInputContext(SalInputContext *pContext) override
bool DrawingAreaButton(SalEvent nEventType, int nEventX, int nEventY, int nButton, guint32 nTime, guint nState)
static sal_uInt16 GetKeyCode(guint nKeyVal)
bool isChild(bool bPlug=true, bool bSysChild=true)
void damaged(sal_Int32 nExtentsLeft, sal_Int32 nExtentsTop, sal_Int32 nExtentsRight, sal_Int32 nExtentsBottom) const
static GtkSalFrame * getFromWindow(GtkWidget *pWindow)
void grabPointer(bool bGrab, bool bKeyboardAlso, bool bOwnerEvents)
virtual SalGraphics * AcquireGraphics() override
static gboolean signalConfigure(GtkWidget *, GdkEventConfigure *, gpointer)
static gboolean signalKey(GtkWidget *, GdkEventKey *, gpointer)
static gboolean signalDelete(GtkWidget *, GdkEvent *, gpointer)
GdkNativeWindow m_aForeignTopLevelWindow
static void signalSetFocus(GtkWindow *pWindow, GtkWidget *pWidget, gpointer frame)
virtual bool HidePopover(void *nId) override
gulong m_nPortalSettingChangedSignalId
bool m_bGeometryIsProvisional
void DrawingAreaCrossing(SalEvent nEventType, int nEventX, int nEventY, guint32 nTime, guint nState)
void DisallowCycleFocusOut()
void SetScreen(unsigned int nNewScreen, SetType eType, tools::Rectangle const *pSize=nullptr)
void SessionManagerInhibit(bool bStart, ApplicationInhibitFlags eType, std::u16string_view sReason, const char *application_id)
GtkGrid * getTopLevelGridWidget() const
void DrawingAreaFocusInOut(SalEvent nEventType)
static gboolean signalDragDrop(GtkWidget *widget, GdkDragContext *context, gint x, gint y, guint time, gpointer frame)
bool HandleMenubarMnemonic(guint eState, guint nKeyval)
basegfx::B2IVector m_aFrameSize
static gboolean signalDragMotion(GtkWidget *widget, GdkDragContext *context, gint x, gint y, guint time, gpointer frame)
static bool signalZoomEnd(GtkGesture *, GdkEventSequence *, gpointer)
static sal_uInt16 GetMouseModCode(guint nState)
GtkHeaderBar * m_pHeaderBar
static void signalDestroy(GtkWidget *, gpointer)
void window_resize(tools::Long nWidth, tools::Long nHeight)
virtual void ResolveWindowHandle(SystemEnvData &rData) const override
GtkInstDragSource * m_pDragSource
void DrawingAreaMotion(int nEventX, int nEventY, guint32 nTime, guint nState)
static gboolean signalDragFailed(GtkWidget *widget, GdkDragContext *context, GtkDragResult result, gpointer frame)
void registerDropTarget(GtkInstDropTarget *pDropTarget)
static gboolean signalScroll(GtkWidget *, GdkEvent *, gpointer)
bool CallCallbackExc(SalEvent nEvent, const void *pEvent) const
virtual OUString GetKeyName(sal_uInt16 nKeyCode) override
static OUString GetPreeditDetails(GtkIMContext *pIMContext, std::vector< ExtTextInputAttr > &rInputFlags, sal_Int32 &rCursorPos, sal_uInt8 &rCursorFlags)
GtkWidget * getMouseEventWidget() const
tools::Rectangle m_aRestorePosSize
SalFrameStyleFlags m_nStyle
virtual SalFrame * GetParent() const override
virtual void SetPluginParent(SystemParentData *pNewParent) override
virtual void BeginSetClipRegion(sal_uInt32 nRects) override
static GdkEvent * makeFakeKeyPress(GtkWidget *pWidget)
virtual void SetWindowState(const vcl::WindowData *) override
virtual void Flush() override
GtkFixed * m_pDrawingArea
gulong m_nSetFocusSignalId
void updateScreenNumber()
static gboolean NativeWidgetHelpPressed(GtkAccelGroup *, GObject *, guint, GdkModifierType, gpointer pFrame)
static bool signalRotateUpdate(GtkGesture *, GdkEventSequence *, gpointer)
virtual void SetMaxClientSize(tools::Long nWidth, tools::Long nHeight) override
std::vector< gulong > m_aMouseSignalIds
const SalX11Screen & getXScreenNumber() const
std::unique_ptr< IMHandler > m_pIMHandler
static bool signalZoomBegin(GtkGesture *, GdkEventSequence *, gpointer)
virtual void ToTop(SalFrameToTop nFlags) override
virtual bool ShowTooltip(const OUString &rHelpText, const tools::Rectangle &rHelpArea) override
int GetDisplayScreen() const
virtual void SetExtendedFrameStyle(SalExtStyle nExtStyle) override
void registerDragSource(GtkInstDragSource *pDragSource)
virtual void SetParent(SalFrame *pNewParent) override
static GtkSalDisplay * getDisplay()
virtual bool GetUseReducedAnimation() const override
tools::Long m_nWidthRequest
tools::Rectangle m_aFloatRect
static sal_uInt16 GetKeyModCode(guint nState)
void SetColorScheme(GVariant *variant)
static void signalRealize(GtkWidget *, gpointer frame)
GdkToplevelState m_nState
tools::Rectangle m_aHelpArea
static bool signalZoomUpdate(GtkGesture *, GdkEventSequence *, gpointer)
void nopaint_container_resize_children(GtkContainer *)
static gboolean signalWindowState(GtkWidget *, GdkEvent *, gpointer)
void EnsureAppMenuWatch()
virtual void ReleaseGraphics(SalGraphics *pGraphics) override
virtual SalPointerState GetPointerState() override
virtual void SetApplicationID(const OUString &rWMClass) override
virtual void GrabFocus() override
static void signalStyleUpdated(GtkWidget *, gpointer)
static gboolean signalFocus(GtkWidget *, GdkEventFocus *, gpointer)
gulong m_nSessionClientSignalId
cairo_t * getCairoContext() const
virtual void CaptureMouse(bool bMouse) override
virtual bool UpdatePopover(void *nId, const OUString &rHelpText, vcl::Window *pParent, const tools::Rectangle &rHelpArea) override
static void gestureLongPress(GtkGestureLongPress *gesture, gdouble x, gdouble y, gpointer frame)
virtual void SetIcon(sal_uInt16 nIcon) override
cairo_region_t * m_pRegion
virtual void EndSetClipRegion() override
static void signalDragDelete(GtkWidget *widget, GdkDragContext *context, gpointer frame)
PointerStyle m_ePointerStyle
std::list< GtkSalFrame * > m_aChildren
static gboolean signalDraw(GtkWidget *, cairo_t *cr, gpointer)
void Init(SalFrame *pParent, SalFrameStyleFlags nStyle)
static guint32 GetLastInputEventTime()
void startDrag(const css::datatransfer::dnd::DragGestureEvent &rEvent, const css::uno::Reference< css::datatransfer::XTransferable > &rTrans, VclToGtkHelper &rConversionHelper, GdkDragAction sourceActions)
static void signalDragEnd(GtkWidget *widget, GdkDragContext *context, gpointer frame)
static bool signalRotateEnd(GtkGesture *, GdkEventSequence *, gpointer)
virtual const SystemEnvData * GetSystemData() const override
static gboolean signalTooltipQuery(GtkWidget *, gint x, gint y, gboolean keyboard_mode, GtkTooltip *tooltip, gpointer frame)
void UpdateGeometryFromEvent(int x_root, int y_root, int nEventX, int nEventY)
virtual LanguageType GetInputLanguage() override
SessionManagerInhibitor m_SessionManagerInhibitor
cairo_surface_t * m_pSurface
const cairo_font_options_t * get_font_options()
static gboolean signalMotion(GtkWidget *, GdkEventMotion *, gpointer)
void DrawingAreaResized(GtkWidget *pWidget, int nWidth, int nHeight)
virtual KeyIndicatorState GetIndicatorState() override
virtual void SetPointerPos(tools::Long nX, tools::Long nY) override
static SalWheelMouseEvent GetWheelEvent(const GdkEventScroll &rEvent)
void InvalidateGraphics()
void Init(SystemParentData *pSysData)
GdkWindow * m_pForeignParent
GDBusProxy * m_pSettingsPortal
virtual void GetClientSize(tools::Long &rWidth, tools::Long &rHeight) override
GtkGrid * m_pTopLevelGrid
virtual void SetModal(bool bModal) override
virtual bool GetModal() const override
virtual void SetMenu(SalMenu *pSalMenu) override
virtual bool MapUnicodeToKeyCode(sal_Unicode aUnicode, LanguageType aLangType, vcl::KeyCode &rKeyCode) override
virtual bool GetWindowState(vcl::WindowData *) override
static void signalDragDataGet(GtkWidget *widget, GdkDragContext *context, GtkSelectionData *data, guint info, guint time, gpointer frame)
void resizeWindow(tools::Long nWidth, tools::Long nHeight)
void AllowCycleFocusOut()
SystemEnvData m_aSystemData
GdkNativeWindow m_aForeignParentWindow
bool WindowCloseRequest()
virtual bool PostEvent(std::unique_ptr< ImplSVEvent > pData) override
virtual bool GetUseDarkMode() const override
static gboolean signalUnmap(GtkWidget *, GdkEvent *, gpointer)
virtual void SetPosSize(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, sal_uInt16 nFlags) override
virtual void SetMinClientSize(tools::Long nWidth, tools::Long nHeight) override
virtual void EndExtTextInput(EndExtTextInputFlags nFlags) override
static gboolean signalButton(GtkWidget *, GdkEventButton *, gpointer)
virtual void * ShowPopover(const OUString &rHelpText, vcl::Window *pParent, const tools::Rectangle &rHelpArea, QuickHelpFlags nFlags) override
void LaunchAsyncScroll(GdkEvent const *pEvent)
void DrawingAreaDraw(cairo_t *cr)
tools::Long m_nHeightRequest
static void signalDragDropReceived(GtkWidget *widget, GdkDragContext *context, gint x, gint y, GtkSelectionData *data, guint ttype, guint time, gpointer frame)
GtkFixed * m_pFixedContainer
virtual void UpdateDarkMode() override
bool isFloatGrabWindow() const
GtkFixed * getFixedContainer() const
void moveWindow(tools::Long nX, tools::Long nY)
virtual void SetAlwaysOnTop(bool bOnTop) override
virtual void ShowFullScreen(bool bFullScreen, sal_Int32 nDisplay) override
virtual void Show(bool bVisible, bool bNoActivate=false) override
virtual void SetScreenNumber(unsigned int) override
void deregisterDropTarget(GtkInstDropTarget const *pDropTarget)
static gboolean signalMap(GtkWidget *, GdkEvent *, gpointer)
static sal_uIntPtr GetNativeWindowHandle(GtkWidget *pWidget)
bool IsCycleFocusOutDisallowed() const
virtual void ResetClipRegion() override
void DrawingAreaScroll(double delta_x, double delta_y, int nEventX, int nEventY, guint32 nTime, guint nState)
static gboolean signalCrossing(GtkWidget *, GdkEventCrossing *, gpointer)
static void gestureSwipe(GtkGestureSwipe *gesture, gdouble velocity_x, gdouble velocity_y, gpointer frame)
static GdkNativeWindow findTopLevelSystemWindow(GdkNativeWindow aWindow)
GtkWidget * getWindow() const
virtual void StartPresentation(bool bStart) override
GDBusProxy * m_pSessionClient
ModKeyFlags m_nKeyModifiers
static void signalDragLeave(GtkWidget *widget, GdkDragContext *context, guint time, gpointer frame)
static GdkDisplay * getGdkDisplay()
GtkSalFrame(SalFrame *pParent, SalFrameStyleFlags nStyle)
An idle is a timer to be scheduled immediately.
unsigned int screen() const
A SalFrame is a system window (e.g. an X11 window).
SalFrameGeometry maGeometry
absolute, unmirrored values
struct _GDBusProxy GDBusProxy
struct _GDBusConnection GDBusConnection
GdkWindowState GdkToplevelState
AtkObject * ooo_fixed_get_accessible(GtkWidget *obj)
sal_uIntPtr GdkNativeWindow
GType ooo_fixed_get_type()
struct _GtkWidget GtkWidget
struct _cairo_font_options cairo_font_options_t
PreviousKeyPress(const PreviousKeyPress &rPrev)
bool operator==(GdkEventKey const *event) const
PreviousKeyPress(GdkEventKey *event)
SalExtTextInputEvent m_aInputEvent
static void signalIMPreeditEnd(GtkIMContext *, gpointer)
bool m_bPreeditJustChanged
GtkIMContext * m_pIMContext
static void signalIMCommit(GtkIMContext *, gchar *, gpointer)
void doCallEndExtTextInput()
std::vector< ExtTextInputAttr > m_aInputFlags
void updateIMSpotLocation()
static void signalIMPreeditChanged(GtkIMContext *, gpointer)
bool handleKeyEvent(GdkEventKey *pEvent)
static void signalIMPreeditStart(GtkIMContext *, gpointer)
static gboolean signalIMDeleteSurrounding(GtkIMContext *, gint, gint, gpointer)
static gboolean signalIMRetrieveSurrounding(GtkIMContext *, gpointer)
void focusChanged(bool bFocusIn)
std::list< PreviousKeyPress > m_aPrevKeyPresses
void endExtTextInput(EndExtTextInputFlags nFlags)