bump product version to 7.2.5.1
[LibreOffice.git] / vcl / inc / unx / gtk / gtkframe.hxx
blobfd4ab4af66da0b1287f1ee5090d041c22b966b6b
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_VCL_INC_UNX_GTK_GTKFRAME_HXX
21 #define INCLUDED_VCL_INC_UNX_GTK_GTKFRAME_HXX
23 #include <cairo.h>
24 #include <gdk/gdk.h>
25 #include <gtk/gtk.h>
26 #if !GTK_CHECK_VERSION(4,0,0)
27 #include <gtk/gtkx.h>
28 #endif
29 #include <gdk/gdkkeysyms.h>
31 #include <salframe.hxx>
32 #include <vcl/idle.hxx>
33 #include <vcl/sysdata.hxx>
34 #include <unx/saltype.h>
35 #include <unx/screensaverinhibitor.hxx>
37 #include <tools/link.hxx>
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>
44 #include <list>
45 #include <vector>
47 #include <config_dbus.h>
48 #include <config_gio.h>
50 #include <headless/svpgdi.hxx>
52 #include "gtkdata.hxx"
54 class GtkSalGraphics;
55 class GtkSalDisplay;
57 typedef sal_uIntPtr GdkNativeWindow;
58 class GtkInstDropTarget;
59 class GtkInstDragSource;
60 class GtkDnDTransferable;
62 class GtkSalMenu;
64 class GtkSalFrame final : public SalFrame
66 struct IMHandler
69 #if !GTK_CHECK_VERSION(4, 0, 0)
70 // Not all GTK Input Methods swallow key release
71 // events. Since they swallow the key press events and we
72 // are left with the key release events, we need to
73 // manually swallow those. To do this, we keep a list of
74 // the previous 10 key press events in each GtkSalFrame
75 // and when we get a key release that matches one of the
76 // key press events in our list, we swallow it.
77 struct PreviousKeyPress
79 GdkWindow *window;
80 gint8 send_event;
81 guint32 time;
82 guint state;
83 guint keyval;
84 guint16 hardware_keycode;
85 guint8 group;
87 PreviousKeyPress (GdkEventKey *event)
88 : window (nullptr),
89 send_event (0),
90 time (0),
91 state (0),
92 keyval (0),
93 hardware_keycode (0),
94 group (0)
96 if (event)
98 window = event->window;
99 send_event = event->send_event;
100 time = event->time;
101 state = event->state;
102 keyval = event->keyval;
103 hardware_keycode = event->hardware_keycode;
104 group = event->group;
108 PreviousKeyPress( const PreviousKeyPress& rPrev )
109 : window( rPrev.window ),
110 send_event( rPrev.send_event ),
111 time( rPrev.time ),
112 state( rPrev.state ),
113 keyval( rPrev.keyval ),
114 hardware_keycode( rPrev.hardware_keycode ),
115 group( rPrev.group )
118 bool operator== (GdkEventKey const *event) const
120 return (event != nullptr)
121 && (event->window == window)
122 && (event->send_event == send_event)
123 // ignore non-Gdk state bits, e.g., these used by IBus
124 && ((event->state & GDK_MODIFIER_MASK) == (state & GDK_MODIFIER_MASK))
125 && (event->keyval == keyval)
126 && (event->hardware_keycode == hardware_keycode)
127 && (event->group == group)
128 && (event->time - time < 300)
132 #endif
134 GtkSalFrame* m_pFrame;
135 #if !GTK_CHECK_VERSION(4, 0, 0)
136 std::list< PreviousKeyPress > m_aPrevKeyPresses;
137 #endif
138 int m_nPrevKeyPresses; // avoid using size()
139 GtkIMContext* m_pIMContext;
140 bool m_bFocused;
141 bool m_bPreeditJustChanged;
142 SalExtTextInputEvent m_aInputEvent;
143 std::vector< ExtTextInputAttr > m_aInputFlags;
145 IMHandler( GtkSalFrame* );
146 ~IMHandler();
148 void createIMContext();
149 void deleteIMContext();
150 void updateIMSpotLocation();
151 void endExtTextInput( EndExtTextInputFlags nFlags );
152 #if !GTK_CHECK_VERSION(4, 0, 0)
153 bool handleKeyEvent( GdkEventKey* pEvent );
154 #endif
155 void focusChanged( bool bFocusIn );
157 void doCallEndExtTextInput();
158 void sendEmptyCommit();
160 static void signalIMCommit( GtkIMContext*, gchar*, gpointer );
161 static gboolean signalIMDeleteSurrounding( GtkIMContext*, gint, gint, gpointer );
162 static void signalIMPreeditChanged( GtkIMContext*, gpointer );
163 static void signalIMPreeditEnd( GtkIMContext*, gpointer );
164 static void signalIMPreeditStart( GtkIMContext*, gpointer );
165 static gboolean signalIMRetrieveSurrounding( GtkIMContext*, gpointer );
167 friend struct IMHandler;
169 friend class GtkSalObjectWidgetClip;
171 SalX11Screen m_nXScreen;
172 GtkWidget* m_pWindow;
173 GtkHeaderBar* m_pHeaderBar;
174 GtkGrid* m_pTopLevelGrid;
175 #if !GTK_CHECK_VERSION(4, 0, 0)
176 GtkEventBox* m_pEventBox;
177 GtkFixed* m_pFixedContainer;
178 GtkFixed* m_pDrawingArea;
179 #else
180 GtkOverlay* m_pOverlay;
181 GtkFixed* m_pFixedContainer;
182 GtkDrawingArea* m_pDrawingArea;
183 GtkEventControllerKey* m_pKeyController;
184 #endif
185 #if !GTK_CHECK_VERSION(4, 0, 0)
186 GdkWindow* m_pForeignParent;
187 GdkNativeWindow m_aForeignParentWindow;
188 GdkWindow* m_pForeignTopLevel;
189 GdkNativeWindow m_aForeignTopLevelWindow;
190 #endif
191 SalFrameStyleFlags m_nStyle;
192 GtkSalFrame* m_pParent;
193 std::list< GtkSalFrame* > m_aChildren;
194 GdkToplevelState m_nState;
195 SystemEnvData m_aSystemData;
196 std::unique_ptr<GtkSalGraphics> m_pGraphics;
197 bool m_bGraphics;
198 ModKeyFlags m_nKeyModifiers;
199 PointerStyle m_ePointerStyle;
200 ScreenSaverInhibitor m_ScreenSaverInhibitor;
201 gulong m_nSetFocusSignalId;
202 bool m_bFullscreen;
203 bool m_bSpanMonitorsWhenFullscreen;
204 bool m_bDefaultPos;
205 bool m_bDefaultSize;
206 bool m_bTooltipBlocked;
207 OUString m_sWMClass;
209 std::unique_ptr<IMHandler> m_pIMHandler;
211 Size m_aMaxSize;
212 Size m_aMinSize;
213 tools::Rectangle m_aRestorePosSize;
215 OUString m_aTooltip;
216 tools::Rectangle m_aHelpArea;
217 tools::Rectangle m_aFloatRect;
218 FloatWinPopupFlags m_nFloatFlags;
219 bool m_bFloatPositioned;
220 tools::Long m_nWidthRequest;
221 tools::Long m_nHeightRequest;
222 cairo_region_t* m_pRegion;
223 GtkInstDropTarget* m_pDropTarget;
224 GtkInstDragSource* m_pDragSource;
225 bool m_bGeometryIsProvisional;
226 bool m_bIconSetWhileUnmapped;
228 GtkSalMenu* m_pSalMenu;
230 #if ENABLE_DBUS && ENABLE_GIO
231 private:
232 friend void on_registrar_available (GDBusConnection*, const gchar*, const gchar*, gpointer);
233 friend void on_registrar_unavailable (GDBusConnection*, const gchar*, gpointer);
234 #endif
235 guint m_nWatcherId;
237 void Init( SalFrame* pParent, SalFrameStyleFlags nStyle );
238 void Init( SystemParentData* pSysData );
239 void InitCommon();
240 void InvalidateGraphics();
242 #if !GTK_CHECK_VERSION(4, 0, 0)
243 // signals
244 static gboolean signalButton( GtkWidget*, GdkEventButton*, gpointer );
245 static void signalStyleUpdated(GtkWidget*, gpointer);
246 #endif
247 void DrawingAreaResized(GtkWidget* pWidget, int nWidth, int nHeight);
248 void DrawingAreaDraw(cairo_t *cr);
249 #if !GTK_CHECK_VERSION(4, 0, 0)
250 static gboolean signalDraw( GtkWidget*, cairo_t *cr, gpointer );
251 static void sizeAllocated(GtkWidget*, GdkRectangle *pAllocation, gpointer frame);
252 #else
253 static void signalDraw(GtkDrawingArea*, cairo_t *cr, int width, int height, gpointer);
254 static void sizeAllocated(GtkWidget*, int nWidth, int nHeight, gpointer frame);
255 #endif
256 static void signalRealize(GtkWidget*, gpointer frame);
257 static gboolean signalTooltipQuery(GtkWidget*, gint x, gint y,
258 gboolean keyboard_mode, GtkTooltip *tooltip,
259 gpointer frame);
260 #if !GTK_CHECK_VERSION(4, 0, 0)
261 static gboolean signalDragMotion(GtkWidget *widget, GdkDragContext *context, gint x, gint y,
262 guint time, gpointer frame);
263 static gboolean signalDragDrop(GtkWidget* widget, GdkDragContext *context, gint x, gint y,
264 guint time, gpointer frame);
265 static void signalDragDropReceived(GtkWidget *widget, GdkDragContext *context, gint x, gint y,
266 GtkSelectionData *data, guint ttype, guint time, gpointer frame);
267 static void signalDragLeave(GtkWidget *widget, GdkDragContext *context, guint time, gpointer frame);
269 static gboolean signalDragFailed(GtkWidget *widget, GdkDragContext *context, GtkDragResult result, gpointer frame);
270 static void signalDragDelete(GtkWidget *widget, GdkDragContext *context, gpointer frame);
271 static void signalDragEnd(GtkWidget *widget, GdkDragContext *context, gpointer frame);
272 static void signalDragDataGet(GtkWidget* widget, GdkDragContext* context, GtkSelectionData *data, guint info,
273 guint time, gpointer frame);
275 #endif
276 static void gestureSwipe(GtkGestureSwipe* gesture, gdouble velocity_x, gdouble velocity_y, gpointer frame);
277 static void gestureLongPress(GtkGestureLongPress* gesture, gdouble x, gdouble y, gpointer frame);
278 bool DrawingAreaButton(SalEvent nEventType, int nEventX, int nEventY, int nButton, guint32 nTime, guint nState);
279 #if GTK_CHECK_VERSION(4, 0, 0)
280 static void gesturePressed(GtkGestureClick* gesture, int n_press, gdouble x, gdouble y, gpointer frame);
281 static void gestureReleased(GtkGestureClick* gesture, int n_press, gdouble x, gdouble y, gpointer frame);
282 void gestureButton(GtkGestureClick* gesture, SalEvent nEventType, gdouble x, gdouble y);
283 #endif
284 void DrawingAreaFocusInOut(SalEvent nEventType);
285 #if GTK_CHECK_VERSION(4, 0, 0)
286 static void signalFocusEnter(GtkEventControllerFocus* pController, gpointer frame);
287 static void signalFocusLeave(GtkEventControllerFocus* pController, gpointer frame);
288 #else
289 static gboolean signalFocus( GtkWidget*, GdkEventFocus*, gpointer );
290 #endif
291 #if !GTK_CHECK_VERSION(4, 0, 0)
292 static void signalSetFocus( GtkWindow* pWindow, GtkWidget* pWidget, gpointer frame );
293 #endif
294 void WindowMap();
295 void WindowUnmap();
296 bool WindowCloseRequest();
297 void DrawingAreaMotion(int nEventX, int nEventY, guint32 nTime, guint nState);
298 void DrawingAreaCrossing(SalEvent nEventType, int nEventX, int nEventY, guint32 nTime, guint nState);
299 bool DrawingAreaKey(SalEvent nEventType, guint keyval, guint keycode, guint32 nTime, guint nState);
300 void DrawingAreaScroll(double delta_x, double delta_y, int nEventX, int nEventY, guint32 nTime, guint nState);
301 #if GTK_CHECK_VERSION(4, 0, 0)
302 static void signalMap( GtkWidget*, gpointer );
303 static void signalUnmap( GtkWidget*, gpointer );
305 static gboolean signalDelete( GtkWidget*, gpointer );
307 static void signalMotion(GtkEventControllerMotion *controller, double x, double y, gpointer);
309 static gboolean signalScroll(GtkEventControllerScroll* pController, double delta_x, double delta_y, gpointer);
311 static void signalEnter(GtkEventControllerMotion *controller, double x, double y, gpointer);
312 static void signalLeave(GtkEventControllerMotion *controller, gpointer);
314 static gboolean signalKeyPressed(GtkEventControllerKey *controller, guint keyval, guint keycode, GdkModifierType state, gpointer);
315 static gboolean signalKeyReleased(GtkEventControllerKey *controller, guint keyval, guint keycode, GdkModifierType state, gpointer);
316 #else
317 static gboolean signalMap( GtkWidget*, GdkEvent*, gpointer );
318 static gboolean signalUnmap( GtkWidget*, GdkEvent*, gpointer );
320 static gboolean signalDelete( GtkWidget*, GdkEvent*, gpointer );
322 static gboolean signalMotion( GtkWidget*, GdkEventMotion*, gpointer );
324 static gboolean signalScroll( GtkWidget*, GdkEvent*, gpointer );
326 static gboolean signalCrossing( GtkWidget*, GdkEventCrossing*, gpointer );
328 static gboolean signalKey( GtkWidget*, GdkEventKey*, gpointer );
329 #endif
330 #if !GTK_CHECK_VERSION(4, 0, 0)
331 static gboolean signalConfigure( GtkWidget*, GdkEventConfigure*, gpointer );
332 static gboolean signalWindowState( GtkWidget*, GdkEvent*, gpointer );
333 #endif
334 static void signalDestroy( GtkWidget*, gpointer );
336 void Center();
337 void SetDefaultSize();
339 bool doKeyCallback( guint state,
340 guint keyval,
341 guint16 hardware_keycode,
342 guint8 group,
343 sal_Unicode aOrigCode,
344 bool bDown,
345 bool bSendRelease
348 #if !GTK_CHECK_VERSION(4, 0, 0)
349 static GdkNativeWindow findTopLevelSystemWindow( GdkNativeWindow aWindow );
350 #endif
352 static int m_nFloats;
354 bool isFloatGrabWindow() const
356 return
357 (m_nStyle & SalFrameStyleFlags::FLOAT) && // only a float can be floatgrab
358 !(m_nStyle & SalFrameStyleFlags::TOOLTIP) && // tool tips are not
359 !(m_nStyle & SalFrameStyleFlags::OWNERDRAWDECORATION); // toolbars are also not
362 bool isChild( bool bPlug = true, bool bSysChild = true )
364 SalFrameStyleFlags nMask = SalFrameStyleFlags::NONE;
365 if( bPlug )
366 nMask |= SalFrameStyleFlags::PLUG;
367 if( bSysChild )
368 nMask |= SalFrameStyleFlags::SYSTEMCHILD;
369 return bool(m_nStyle & nMask);
372 //call gtk_window_resize
373 void window_resize(tools::Long nWidth, tools::Long nHeight);
374 //call gtk_widget_set_size_request
375 void widget_set_size_request(tools::Long nWidth, tools::Long nHeight);
377 void resizeWindow( tools::Long nWidth, tools::Long nHeight );
378 void moveWindow( tools::Long nX, tools::Long nY );
380 Size calcDefaultSize();
382 void setMinMaxSize();
384 void AllocateFrame();
385 void TriggerPaintEvent();
387 void updateWMClass();
389 enum class SetType { RetainSize, Fullscreen, UnFullscreen };
391 void SetScreen( unsigned int nNewScreen, SetType eType, tools::Rectangle const *pSize = nullptr );
393 void SetIcon(const char* pIcon);
395 bool HandleMenubarMnemonic(guint eState, guint nKeyval);
397 public:
398 cairo_surface_t* m_pSurface;
399 basegfx::B2IVector m_aFrameSize;
400 DamageHandler m_aDamageHandler;
401 std::vector<GdkEvent*> m_aPendingScrollEvents;
402 #if !GTK_CHECK_VERSION(4, 0, 0)
403 Idle m_aSmoothScrollIdle;
404 #endif
405 int m_nGrabLevel;
406 bool m_bSalObjectSetPosSize;
407 GtkSalFrame( SalFrame* pParent, SalFrameStyleFlags nStyle );
408 GtkSalFrame( SystemParentData* pSysData );
410 guint m_nMenuExportId;
411 guint m_nActionGroupExportId;
412 guint m_nHudAwarenessId;
413 std::vector<gulong> m_aMouseSignalIds;
415 void grabPointer(bool bGrab, bool bKeyboardAlso, bool bOwnerEvents);
417 static GtkSalDisplay* getDisplay();
418 static GdkDisplay* getGdkDisplay();
419 GtkWidget* getWindow() const { return m_pWindow; }
420 GtkFixed* getFixedContainer() const { return GTK_FIXED(m_pFixedContainer); }
421 GtkWidget* getMouseEventWidget() const;
422 GtkGrid* getTopLevelGridWidget() const { return m_pTopLevelGrid; }
423 const SalX11Screen& getXScreenNumber() const { return m_nXScreen; }
424 int GetDisplayScreen() const { return maGeometry.nDisplayScreenNumber; }
425 void updateScreenNumber();
427 cairo_t* getCairoContext() const;
428 void damaged(sal_Int32 nExtentsLeft, sal_Int32 nExtentsTop,
429 sal_Int32 nExtentsRight, sal_Int32 nExtentsBottom) const;
431 void registerDropTarget(GtkInstDropTarget* pDropTarget)
433 assert(!m_pDropTarget);
434 m_pDropTarget = pDropTarget;
437 void deregisterDropTarget(GtkInstDropTarget const * pDropTarget)
439 assert(m_pDropTarget == pDropTarget); (void)pDropTarget;
440 m_pDropTarget = nullptr;
443 void registerDragSource(GtkInstDragSource* pDragSource)
445 assert(!m_pDragSource);
446 m_pDragSource = pDragSource;
449 void deregisterDragSource(GtkInstDragSource const * pDragSource)
451 assert(m_pDragSource == pDragSource); (void)pDragSource;
452 m_pDragSource = nullptr;
455 #if !GTK_CHECK_VERSION(4, 0, 0)
456 void startDrag(gint nButton, gint nDragOriginX, gint nDragOriginY,
457 GdkDragAction sourceActions, GtkTargetList* pTargetList);
458 #endif
460 void closePopup();
462 void addGrabLevel();
463 void removeGrabLevel();
465 #if !GTK_CHECK_VERSION(4, 0, 0)
466 void nopaint_container_resize_children(GtkContainer*);
468 void LaunchAsyncScroll(GdkEvent const * pEvent);
469 DECL_LINK(AsyncScroll, Timer *, void);
470 #endif
472 virtual ~GtkSalFrame() override;
474 // SalGraphics or NULL, but two Graphics for all SalFrames
475 // must be returned
476 virtual SalGraphics* AcquireGraphics() override;
477 virtual void ReleaseGraphics( SalGraphics* pGraphics ) override;
479 // Event must be destroyed, when Frame is destroyed
480 // When Event is called, SalInstance::Yield() must be returned
481 virtual bool PostEvent(std::unique_ptr<ImplSVEvent> pData) override;
483 virtual void SetTitle( const OUString& rTitle ) override;
484 virtual void SetIcon( sal_uInt16 nIcon ) override;
485 virtual void SetMenu( SalMenu *pSalMenu ) override;
486 SalMenu* GetMenu();
487 virtual void DrawMenuBar() override;
488 void EnsureAppMenuWatch();
490 virtual void SetExtendedFrameStyle( SalExtStyle nExtStyle ) override;
491 // Before the window is visible, a resize event
492 // must be sent with the correct size
493 virtual void Show( bool bVisible, bool bNoActivate = false ) override;
494 // Set ClientSize and Center the Window to the desktop
495 // and send/post a resize message
496 virtual void SetMinClientSize( tools::Long nWidth, tools::Long nHeight ) override;
497 virtual void SetMaxClientSize( tools::Long nWidth, tools::Long nHeight ) override;
498 virtual void SetPosSize( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, sal_uInt16 nFlags ) override;
499 virtual void GetClientSize( tools::Long& rWidth, tools::Long& rHeight ) override;
500 virtual void GetWorkArea( tools::Rectangle& rRect ) override;
501 virtual SalFrame* GetParent() const override;
502 virtual void SetWindowState( const SalFrameState* pState ) override;
503 virtual bool GetWindowState( SalFrameState* pState ) override;
504 virtual void ShowFullScreen( bool bFullScreen, sal_Int32 nDisplay ) override;
505 // Enable/Disable ScreenSaver, SystemAgents, ...
506 virtual void StartPresentation( bool bStart ) override;
507 // Show Window over all other Windows
508 virtual void SetAlwaysOnTop( bool bOnTop ) override;
510 // Window to top and grab focus
511 virtual void ToTop( SalFrameToTop nFlags ) override;
513 // this function can call with the same
514 // pointer style
515 virtual void SetPointer( PointerStyle ePointerStyle ) override;
516 virtual void CaptureMouse( bool bMouse ) override;
517 virtual void GrabFocus() override;
518 virtual void SetPointerPos( tools::Long nX, tools::Long nY ) override;
520 // flush output buffer
521 using SalFrame::Flush;
522 virtual void Flush() override;
523 // flush output buffer, wait till outstanding operations are done
525 virtual void SetInputContext( SalInputContext* pContext ) override;
526 virtual void EndExtTextInput( EndExtTextInputFlags nFlags ) override;
528 virtual OUString GetKeyName( sal_uInt16 nKeyCode ) override;
529 virtual bool MapUnicodeToKeyCode( sal_Unicode aUnicode, LanguageType aLangType, vcl::KeyCode& rKeyCode ) override;
531 // returns the input language used for the last key stroke
532 // may be LANGUAGE_DONTKNOW if not supported by the OS
533 virtual LanguageType GetInputLanguage() override;
535 virtual void UpdateSettings( AllSettings& rSettings ) override;
537 virtual void Beep() override;
539 // returns system data (most prominent: window handle)
540 virtual const SystemEnvData* GetSystemData() const override;
542 virtual void ResolveWindowHandle(SystemEnvData& rData) const override;
544 // get current modifier and button mask
545 virtual SalPointerState GetPointerState() override;
547 virtual KeyIndicatorState GetIndicatorState() override;
549 virtual void SimulateKeyPress( sal_uInt16 nKeyCode ) override;
551 // set new parent window
552 virtual void SetParent( SalFrame* pNewParent ) override;
553 // reparent window to act as a plugin; implementation
554 // may choose to use a new system window internally
555 // return false to indicate failure
556 virtual void SetPluginParent( SystemParentData* pNewParent ) override;
558 virtual void SetScreenNumber( unsigned int ) override;
559 virtual void SetApplicationID( const OUString &rWMClass ) override;
561 // shaped system windows
562 // set clip region to none (-> rectangular windows, normal state)
563 virtual void ResetClipRegion() override;
564 // start setting the clipregion consisting of nRects rectangles
565 virtual void BeginSetClipRegion( sal_uInt32 nRects ) override;
566 // add a rectangle to the clip region
567 virtual void UnionClipRegion( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight ) override;
568 // done setting up the clipregion
569 virtual void EndSetClipRegion() override;
571 virtual void PositionByToolkit(const tools::Rectangle& rRect, FloatWinPopupFlags nFlags) override;
572 virtual void SetModal(bool bModal) override;
573 virtual bool GetModal() const override;
574 void HideTooltip();
575 void BlockTooltip();
576 void UnblockTooltip();
577 virtual bool ShowTooltip(const OUString& rHelpText, const tools::Rectangle& rHelpArea) override;
578 virtual void* ShowPopover(const OUString& rHelpText, vcl::Window* pParent, const tools::Rectangle& rHelpArea, QuickHelpFlags nFlags) override;
579 virtual bool UpdatePopover(void* nId, const OUString& rHelpText, vcl::Window* pParent, const tools::Rectangle& rHelpArea) override;
580 virtual bool HidePopover(void* nId) override;
581 virtual weld::Window* GetFrameWeld() const override;
583 static GtkSalFrame *getFromWindow( GtkWidget *pWindow );
585 static sal_uIntPtr GetNativeWindowHandle(GtkWidget *pWidget);
587 //Call the usual SalFrame Callback, but catch uno exceptions and delegate
588 //to GtkSalData to rethrow them after the gsignal is processed when its safe
589 //to do so again in our own code after the g_main_context_iteration call
590 //which triggers the gsignals.
591 bool CallCallbackExc(SalEvent nEvent, const void* pEvent) const;
593 // call gtk_widget_queue_draw on the drawing widget
594 void queue_draw();
596 static void KeyCodeToGdkKey(const vcl::KeyCode& rKeyCode,
597 guint* pGdkKeyCode, GdkModifierType *pGdkModifiers);
599 static guint32 GetLastInputEventTime();
600 static void UpdateLastInputEventTime(guint32 nUserInputTime);
601 static sal_uInt16 GetMouseModCode(guint nState);
602 static sal_uInt16 GetKeyCode(guint nKeyVal);
603 #if !GTK_CHECK_VERSION(4, 0, 0)
604 static guint GetKeyValFor(GdkKeymap* pKeyMap, guint16 hardware_keycode, guint8 group);
605 #endif
606 static sal_uInt16 GetKeyModCode(guint nState);
607 static GdkEvent* makeFakeKeyPress(GtkWidget* pWidget);
608 #if !GTK_CHECK_VERSION(4, 0, 0)
609 static SalWheelMouseEvent GetWheelEvent(const GdkEventScroll& rEvent);
610 static gboolean NativeWidgetHelpPressed(GtkAccelGroup*, GObject*, guint,
611 GdkModifierType, gpointer pFrame);
612 #endif
613 static OUString GetPreeditDetails(GtkIMContext* pIMContext, std::vector<ExtTextInputAttr>& rInputFlags, sal_Int32& rCursorPos, sal_uInt8& rCursorFlags);
614 static Selection CalcDeleteSurroundingSelection(const OUString& rSurroundingText, sal_Int32 nCursorIndex, int nOffset, int nChars);
616 void DisallowCycleFocusOut();
617 bool IsCycleFocusOutDisallowed() const;
618 void AllowCycleFocusOut();
621 #define OOO_TYPE_FIXED ooo_fixed_get_type()
623 #if !GTK_CHECK_VERSION(4, 0, 0)
624 extern "C" {
626 GType ooo_fixed_get_type();
627 AtkObject* ooo_fixed_get_accessible(GtkWidget *obj);
629 } // extern "C"
630 #endif
632 #if !GTK_CHECK_VERSION(3, 22, 0)
633 enum GdkAnchorHints
635 GDK_ANCHOR_FLIP_X = 1 << 0,
636 GDK_ANCHOR_FLIP_Y = 1 << 1,
637 GDK_ANCHOR_SLIDE_X = 1 << 2,
638 GDK_ANCHOR_SLIDE_Y = 1 << 3,
639 GDK_ANCHOR_RESIZE_X = 1 << 4,
640 GDK_ANCHOR_RESIZE_Y = 1 << 5,
641 GDK_ANCHOR_FLIP = GDK_ANCHOR_FLIP_X | GDK_ANCHOR_FLIP_Y,
642 GDK_ANCHOR_SLIDE = GDK_ANCHOR_SLIDE_X | GDK_ANCHOR_SLIDE_Y,
643 GDK_ANCHOR_RESIZE = GDK_ANCHOR_RESIZE_X | GDK_ANCHOR_RESIZE_Y
645 #endif
647 #endif // INCLUDED_VCL_INC_UNX_GTK_GTKFRAME_HXX
649 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */