cool#10630 lok doc sign: fix Impress sign line when picking a certificate
[LibreOffice.git] / vcl / inc / unx / gtk / gtkframe.hxx
blob41790d893dba67bf56c5ba1baa7aecc7c2ae092f
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 #pragma once
22 #include <cairo.h>
23 #include <gdk/gdk.h>
24 #include <gtk/gtk.h>
25 #if !GTK_CHECK_VERSION(4,0,0)
26 #include <gtk/gtkx.h>
27 #endif
28 #include <gdk/gdkkeysyms.h>
30 #include <salframe.hxx>
31 #include <vcl/idle.hxx>
32 #include <vcl/sysdata.hxx>
33 #include <unx/saltype.h>
34 #include <unx/sessioninhibitor.hxx>
36 #include <tools/link.hxx>
38 #include <com/sun/star/awt/XTopWindow.hpp>
39 #include <com/sun/star/datatransfer/DataFlavor.hpp>
40 #include <com/sun/star/datatransfer/dnd/XDragSource.hpp>
41 #include <com/sun/star/datatransfer/dnd/XDropTarget.hpp>
43 #include <list>
44 #include <vector>
46 #include <config_dbus.h>
47 #include <config_gio.h>
49 #include <headless/svpgdi.hxx>
51 #include "gtkdata.hxx"
53 class GtkSalGraphics;
54 class GtkSalDisplay;
56 typedef sal_uIntPtr GdkNativeWindow;
57 class GtkInstDropTarget;
58 class GtkInstDragSource;
59 class GtkDnDTransferable;
61 class GtkSalMenu;
63 struct VclToGtkHelper;
65 class GtkSalFrame final : public SalFrame
67 struct IMHandler
70 #if !GTK_CHECK_VERSION(4, 0, 0)
71 // Not all GTK Input Methods swallow key release
72 // events. Since they swallow the key press events and we
73 // are left with the key release events, we need to
74 // manually swallow those. To do this, we keep a list of
75 // the previous 10 key press events in each GtkSalFrame
76 // and when we get a key release that matches one of the
77 // key press events in our list, we swallow it.
78 struct PreviousKeyPress
80 GdkWindow *window;
81 gint8 send_event;
82 guint32 time;
83 guint state;
84 guint keyval;
85 guint16 hardware_keycode;
86 guint8 group;
88 PreviousKeyPress (GdkEventKey *event)
89 : window (nullptr),
90 send_event (0),
91 time (0),
92 state (0),
93 keyval (0),
94 hardware_keycode (0),
95 group (0)
97 if (event)
99 window = event->window;
100 send_event = event->send_event;
101 time = event->time;
102 state = event->state;
103 keyval = event->keyval;
104 hardware_keycode = event->hardware_keycode;
105 group = event->group;
109 PreviousKeyPress( const PreviousKeyPress& rPrev )
110 : window( rPrev.window ),
111 send_event( rPrev.send_event ),
112 time( rPrev.time ),
113 state( rPrev.state ),
114 keyval( rPrev.keyval ),
115 hardware_keycode( rPrev.hardware_keycode ),
116 group( rPrev.group )
119 bool operator== (GdkEventKey const *event) const
121 return (event != nullptr)
122 && (event->window == window)
123 && (event->send_event == send_event)
124 // ignore non-Gdk state bits, e.g., these used by IBus
125 && ((event->state & GDK_MODIFIER_MASK) == (state & GDK_MODIFIER_MASK))
126 && (event->keyval == keyval)
127 && (event->hardware_keycode == hardware_keycode)
128 && (event->group == group)
129 && (event->time - time < 300)
133 #endif
135 GtkSalFrame* m_pFrame;
136 #if !GTK_CHECK_VERSION(4, 0, 0)
137 std::list< PreviousKeyPress > m_aPrevKeyPresses;
138 #endif
139 int m_nPrevKeyPresses; // avoid using size()
140 GtkIMContext* m_pIMContext;
141 bool m_bFocused;
142 bool m_bPreeditJustChanged;
143 SalExtTextInputEvent m_aInputEvent;
144 std::vector< ExtTextInputAttr > m_aInputFlags;
146 IMHandler( GtkSalFrame* );
147 ~IMHandler();
149 void createIMContext();
150 void deleteIMContext();
151 void updateIMSpotLocation();
152 void endExtTextInput( EndExtTextInputFlags nFlags );
153 #if !GTK_CHECK_VERSION(4, 0, 0)
154 bool handleKeyEvent( GdkEventKey* pEvent );
155 #endif
156 void focusChanged( bool bFocusIn );
158 void doCallEndExtTextInput();
159 void sendEmptyCommit();
161 static void signalIMCommit( GtkIMContext*, gchar*, gpointer );
162 static gboolean signalIMDeleteSurrounding( GtkIMContext*, gint, gint, gpointer );
163 static void signalIMPreeditChanged( GtkIMContext*, gpointer );
164 static void signalIMPreeditEnd( GtkIMContext*, gpointer );
165 static void signalIMPreeditStart( GtkIMContext*, gpointer );
166 static gboolean signalIMRetrieveSurrounding( GtkIMContext*, gpointer );
168 friend struct IMHandler;
170 friend class GtkSalObjectWidgetClip;
172 SalX11Screen m_nXScreen;
173 GtkWidget* m_pWindow;
174 GtkHeaderBar* m_pHeaderBar;
175 GtkGrid* m_pTopLevelGrid;
176 #if !GTK_CHECK_VERSION(4, 0, 0)
177 GtkEventBox* m_pEventBox;
178 GtkFixed* m_pFixedContainer;
179 GtkFixed* m_pDrawingArea;
180 #else
181 GtkOverlay* m_pOverlay;
182 GtkFixed* m_pFixedContainer;
183 GtkDrawingArea* m_pDrawingArea;
184 GtkEventControllerKey* m_pKeyController;
185 gulong m_nSettingChangedSignalId;
186 #endif
187 gulong m_nPortalSettingChangedSignalId;
188 GDBusProxy* m_pSettingsPortal;
189 gulong m_nSessionClientSignalId;
190 GDBusProxy* m_pSessionManager;
191 GDBusProxy* m_pSessionClient;
192 #if !GTK_CHECK_VERSION(4, 0, 0)
193 GdkWindow* m_pForeignParent;
194 GdkNativeWindow m_aForeignParentWindow;
195 GdkWindow* m_pForeignTopLevel;
196 GdkNativeWindow m_aForeignTopLevelWindow;
197 #endif
198 SalFrameStyleFlags m_nStyle;
199 GtkSalFrame* m_pParent;
200 std::list< GtkSalFrame* > m_aChildren;
201 GdkToplevelState m_nState;
202 SystemEnvData m_aSystemData;
203 std::unique_ptr<GtkSalGraphics> m_pGraphics;
204 bool m_bGraphics;
205 ModKeyFlags m_nKeyModifiers;
206 PointerStyle m_ePointerStyle;
207 SessionManagerInhibitor m_SessionManagerInhibitor;
208 gulong m_nSetFocusSignalId;
209 bool m_bFullscreen;
210 bool m_bDefaultPos;
211 bool m_bDefaultSize;
212 bool m_bTooltipBlocked;
213 OUString m_sWMClass;
215 std::unique_ptr<IMHandler> m_pIMHandler;
217 Size m_aMaxSize;
218 Size m_aMinSize;
219 tools::Rectangle m_aRestorePosSize;
221 OUString m_aTooltip;
222 tools::Rectangle m_aHelpArea;
223 tools::Rectangle m_aFloatRect;
224 FloatWinPopupFlags m_nFloatFlags;
225 bool m_bFloatPositioned;
226 tools::Long m_nWidthRequest;
227 tools::Long m_nHeightRequest;
228 cairo_region_t* m_pRegion;
229 GtkInstDropTarget* m_pDropTarget;
230 GtkInstDragSource* m_pDragSource;
231 bool m_bGeometryIsProvisional;
232 bool m_bIconSetWhileUnmapped;
234 GtkSalMenu* m_pSalMenu;
236 #if ENABLE_DBUS && ENABLE_GIO
237 private:
238 friend void on_registrar_available (GDBusConnection*, const gchar*, const gchar*, gpointer);
239 friend void on_registrar_unavailable (GDBusConnection*, const gchar*, gpointer);
240 #endif
241 guint m_nWatcherId;
243 void Init( SalFrame* pParent, SalFrameStyleFlags nStyle );
244 void Init( SystemParentData* pSysData );
245 void InitCommon();
246 void InvalidateGraphics();
248 // signals
249 #if !GTK_CHECK_VERSION(4, 0, 0)
250 static gboolean signalButton( GtkWidget*, GdkEventButton*, gpointer );
251 static void signalStyleUpdated(GtkWidget*, gpointer);
252 #else
253 static void signalStyleUpdated(GtkWidget*, const gchar* pSetting, gpointer);
254 #endif
255 void DrawingAreaResized(GtkWidget* pWidget, int nWidth, int nHeight);
256 void DrawingAreaDraw(cairo_t *cr);
257 #if !GTK_CHECK_VERSION(4, 0, 0)
258 static gboolean signalDraw( GtkWidget*, cairo_t *cr, gpointer );
259 static void sizeAllocated(GtkWidget*, GdkRectangle *pAllocation, gpointer frame);
260 #else
261 static void signalDraw(GtkDrawingArea*, cairo_t *cr, int width, int height, gpointer);
262 static void sizeAllocated(GtkWidget*, int nWidth, int nHeight, gpointer frame);
263 #endif
264 static void signalRealize(GtkWidget*, gpointer frame);
265 static gboolean signalTooltipQuery(GtkWidget*, gint x, gint y,
266 gboolean keyboard_mode, GtkTooltip *tooltip,
267 gpointer frame);
268 #if GTK_CHECK_VERSION(4, 0, 0)
269 static GdkDragAction signalDragMotion(GtkDropTargetAsync *dest, GdkDrop *drop, double x, double y, gpointer frame);
270 static void signalDragLeave(GtkDropTargetAsync *dest, GdkDrop *drop, gpointer frame);
271 static gboolean signalDragDrop(GtkDropTargetAsync* context, GdkDrop* drop, double x, double y, gpointer frame);
273 static void signalDragFailed(GdkDrag* drag, GdkDragCancelReason reason, gpointer frame);
274 static void signalDragDelete(GdkDrag* drag, gpointer frame);
275 static void signalDragEnd(GdkDrag* drag, gpointer frame);
276 #else
277 static gboolean signalDragMotion(GtkWidget *widget, GdkDragContext *context, gint x, gint y,
278 guint time, gpointer frame);
279 static gboolean signalDragDrop(GtkWidget* widget, GdkDragContext *context, gint x, gint y,
280 guint time, gpointer frame);
281 static void signalDragDropReceived(GtkWidget *widget, GdkDragContext *context, gint x, gint y,
282 GtkSelectionData *data, guint ttype, guint time, gpointer frame);
283 static void signalDragLeave(GtkWidget *widget, GdkDragContext *context, guint time, gpointer frame);
285 static gboolean signalDragFailed(GtkWidget *widget, GdkDragContext *context, GtkDragResult result, gpointer frame);
286 static void signalDragDelete(GtkWidget *widget, GdkDragContext *context, gpointer frame);
287 static void signalDragEnd(GtkWidget *widget, GdkDragContext *context, gpointer frame);
288 static void signalDragDataGet(GtkWidget* widget, GdkDragContext* context, GtkSelectionData *data, guint info,
289 guint time, gpointer frame);
291 #endif
292 static void gestureSwipe(GtkGestureSwipe* gesture, gdouble velocity_x, gdouble velocity_y, gpointer frame);
293 static void gestureLongPress(GtkGestureLongPress* gesture, gdouble x, gdouble y, gpointer frame);
294 bool DrawingAreaButton(SalEvent nEventType, int nEventX, int nEventY, int nButton, guint32 nTime, guint nState);
295 #if GTK_CHECK_VERSION(4, 0, 0)
296 static void gesturePressed(GtkGestureClick* gesture, int n_press, gdouble x, gdouble y, gpointer frame);
297 static void gestureReleased(GtkGestureClick* gesture, int n_press, gdouble x, gdouble y, gpointer frame);
298 void gestureButton(GtkGestureClick* gesture, SalEvent nEventType, gdouble x, gdouble y);
299 #endif
300 void DrawingAreaFocusInOut(SalEvent nEventType);
301 #if GTK_CHECK_VERSION(4, 0, 0)
302 static void signalFocusEnter(GtkEventControllerFocus* pController, gpointer frame);
303 static void signalFocusLeave(GtkEventControllerFocus* pController, gpointer frame);
304 #else
305 static gboolean signalFocus( GtkWidget*, GdkEventFocus*, gpointer );
306 #endif
307 #if !GTK_CHECK_VERSION(4, 0, 0)
308 static void signalSetFocus(GtkWindow* pWindow, GtkWidget* pWidget, gpointer frame);
309 #else
310 static void signalSetFocus(GtkWindow* pWindow, GParamSpec* pSpec, gpointer frame);
311 #endif
312 void WindowMap();
313 void WindowUnmap();
314 bool WindowCloseRequest();
315 void DrawingAreaMotion(int nEventX, int nEventY, guint32 nTime, guint nState);
316 void DrawingAreaCrossing(SalEvent nEventType, int nEventX, int nEventY, guint32 nTime, guint nState);
317 void DrawingAreaScroll(double delta_x, double delta_y, int nEventX, int nEventY, guint32 nTime, guint nState);
318 #if GTK_CHECK_VERSION(4, 0, 0)
319 bool DrawingAreaKey(GtkEventControllerKey* pController, SalEvent nEventType, guint keyval, guint keycode, guint nState);
321 static void signalMap(GtkWidget*, gpointer);
322 static void signalUnmap(GtkWidget*, gpointer);
324 static gboolean signalDelete(GtkWidget*, gpointer);
326 static void signalMotion(GtkEventControllerMotion *controller, double x, double y, gpointer);
328 static gboolean signalScroll(GtkEventControllerScroll* pController, double delta_x, double delta_y, gpointer);
330 static void signalEnter(GtkEventControllerMotion *controller, double x, double y, gpointer);
331 static void signalLeave(GtkEventControllerMotion *controller, gpointer);
333 static gboolean signalKeyPressed(GtkEventControllerKey *controller, guint keyval, guint keycode, GdkModifierType state, gpointer);
334 static gboolean signalKeyReleased(GtkEventControllerKey *controller, guint keyval, guint keycode, GdkModifierType state, gpointer);
336 static void signalWindowState(GdkToplevel*, GParamSpec*, gpointer);
337 #else
338 static gboolean signalMap( GtkWidget*, GdkEvent*, gpointer );
339 static gboolean signalUnmap( GtkWidget*, GdkEvent*, gpointer );
341 static gboolean signalDelete( GtkWidget*, GdkEvent*, gpointer );
343 static gboolean signalMotion( GtkWidget*, GdkEventMotion*, gpointer );
345 static gboolean signalScroll( GtkWidget*, GdkEvent*, gpointer );
347 static gboolean signalCrossing( GtkWidget*, GdkEventCrossing*, gpointer );
349 static gboolean signalKey( GtkWidget*, GdkEventKey*, gpointer );
351 static gboolean signalWindowState( GtkWidget*, GdkEvent*, gpointer );
352 #endif
354 static bool signalZoomBegin(GtkGesture*, GdkEventSequence*, gpointer);
355 static bool signalZoomUpdate(GtkGesture*, GdkEventSequence*, gpointer);
356 static bool signalZoomEnd(GtkGesture*, GdkEventSequence*, gpointer);
358 static bool signalRotateBegin(GtkGesture*, GdkEventSequence*, gpointer);
359 static bool signalRotateUpdate(GtkGesture*, GdkEventSequence*, gpointer);
360 static bool signalRotateEnd(GtkGesture*, GdkEventSequence*, gpointer);
362 #if !GTK_CHECK_VERSION(4, 0, 0)
363 static gboolean signalConfigure( GtkWidget*, GdkEventConfigure*, gpointer );
364 #endif
365 static void signalDestroy( GtkWidget*, gpointer );
367 void Center();
368 void SetDefaultSize();
370 bool doKeyCallback( guint state,
371 guint keyval,
372 guint16 hardware_keycode,
373 guint8 group,
374 sal_Unicode aOrigCode,
375 bool bDown,
376 bool bSendRelease
379 #if !GTK_CHECK_VERSION(4, 0, 0)
380 static GdkNativeWindow findTopLevelSystemWindow( GdkNativeWindow aWindow );
381 #endif
383 static int m_nFloats;
385 bool isFloatGrabWindow() const
387 return
388 (m_nStyle & SalFrameStyleFlags::FLOAT) && // only a float can be floatgrab
389 !(m_nStyle & SalFrameStyleFlags::TOOLTIP) && // tool tips are not
390 !(m_nStyle & SalFrameStyleFlags::OWNERDRAWDECORATION); // toolbars are also not
393 bool isChild( bool bPlug = true, bool bSysChild = true )
395 SalFrameStyleFlags nMask = SalFrameStyleFlags::NONE;
396 if( bPlug )
397 nMask |= SalFrameStyleFlags::PLUG;
398 if( bSysChild )
399 nMask |= SalFrameStyleFlags::SYSTEMCHILD;
400 return bool(m_nStyle & nMask);
403 //call gtk_window_resize
404 void window_resize(tools::Long nWidth, tools::Long nHeight);
405 //call gtk_widget_set_size_request
406 void widget_set_size_request(tools::Long nWidth, tools::Long nHeight);
408 void resizeWindow( tools::Long nWidth, tools::Long nHeight );
409 void moveWindow( tools::Long nX, tools::Long nY );
411 Size calcDefaultSize();
413 void setMinMaxSize();
415 void AllocateFrame();
416 void TriggerPaintEvent();
418 void updateWMClass();
420 enum class SetType { RetainSize, Fullscreen, UnFullscreen };
422 void SetScreen( unsigned int nNewScreen, SetType eType, tools::Rectangle const *pSize = nullptr );
424 void SetIcon(const char* pIcon);
426 bool HandleMenubarMnemonic(guint eState, guint nKeyval);
428 void ListenPortalSettings();
430 void ListenSessionManager();
432 void UpdateGeometryFromEvent(int x_root, int y_root, int nEventX, int nEventY);
434 public:
435 cairo_surface_t* m_pSurface;
436 basegfx::B2IVector m_aFrameSize;
437 DamageHandler m_aDamageHandler;
438 std::vector<GdkEvent*> m_aPendingScrollEvents;
439 #if !GTK_CHECK_VERSION(4, 0, 0)
440 Idle m_aSmoothScrollIdle;
441 #endif
442 int m_nGrabLevel;
443 bool m_bSalObjectSetPosSize;
444 GtkSalFrame( SalFrame* pParent, SalFrameStyleFlags nStyle );
445 GtkSalFrame( SystemParentData* pSysData );
447 guint m_nMenuExportId;
448 guint m_nActionGroupExportId;
449 guint m_nHudAwarenessId;
450 std::vector<gulong> m_aMouseSignalIds;
452 void grabPointer(bool bGrab, bool bKeyboardAlso, bool bOwnerEvents);
454 static GtkSalDisplay* getDisplay();
455 static GdkDisplay* getGdkDisplay();
456 GtkWidget* getWindow() const { return m_pWindow; }
457 GtkFixed* getFixedContainer() const { return GTK_FIXED(m_pFixedContainer); }
458 GtkWidget* getMouseEventWidget() const;
459 GtkGrid* getTopLevelGridWidget() const { return m_pTopLevelGrid; }
460 const SalX11Screen& getXScreenNumber() const { return m_nXScreen; }
461 int GetDisplayScreen() const { return maGeometry.screen(); }
462 void updateScreenNumber();
464 cairo_t* getCairoContext() const;
465 void damaged(sal_Int32 nExtentsLeft, sal_Int32 nExtentsTop,
466 sal_Int32 nExtentsRight, sal_Int32 nExtentsBottom) const;
468 void registerDropTarget(GtkInstDropTarget* pDropTarget)
470 assert(!m_pDropTarget);
471 m_pDropTarget = pDropTarget;
474 void deregisterDropTarget(GtkInstDropTarget const * pDropTarget)
476 assert(m_pDropTarget == pDropTarget); (void)pDropTarget;
477 m_pDropTarget = nullptr;
480 void registerDragSource(GtkInstDragSource* pDragSource)
482 assert(!m_pDragSource);
483 m_pDragSource = pDragSource;
486 void deregisterDragSource(GtkInstDragSource const * pDragSource)
488 assert(m_pDragSource == pDragSource); (void)pDragSource;
489 m_pDragSource = nullptr;
492 void startDrag(const css::datatransfer::dnd::DragGestureEvent& rEvent,
493 const css::uno::Reference<css::datatransfer::XTransferable>& rTrans,
494 VclToGtkHelper& rConversionHelper,
495 GdkDragAction sourceActions);
497 void closePopup();
499 void addGrabLevel();
500 void removeGrabLevel();
502 #if !GTK_CHECK_VERSION(4, 0, 0)
503 void nopaint_container_resize_children(GtkContainer*);
505 void LaunchAsyncScroll(GdkEvent const * pEvent);
506 DECL_LINK(AsyncScroll, Timer *, void);
507 #endif
509 virtual ~GtkSalFrame() override;
511 // SalGraphics or NULL, but two Graphics for all SalFrames
512 // must be returned
513 virtual SalGraphics* AcquireGraphics() override;
514 virtual void ReleaseGraphics( SalGraphics* pGraphics ) override;
516 // Event must be destroyed, when Frame is destroyed
517 // When Event is called, SalInstance::Yield() must be returned
518 virtual bool PostEvent(std::unique_ptr<ImplSVEvent> pData) override;
520 virtual void SetTitle( const OUString& rTitle ) override;
521 virtual void SetIcon( sal_uInt16 nIcon ) override;
522 virtual void SetMenu( SalMenu *pSalMenu ) override;
523 SalMenu* GetMenu();
524 void EnsureAppMenuWatch();
526 virtual void SetExtendedFrameStyle( SalExtStyle nExtStyle ) override;
527 // Before the window is visible, a resize event
528 // must be sent with the correct size
529 virtual void Show( bool bVisible, bool bNoActivate = false ) override;
530 // Set ClientSize and Center the Window to the desktop
531 // and send/post a resize message
532 virtual void SetMinClientSize( tools::Long nWidth, tools::Long nHeight ) override;
533 virtual void SetMaxClientSize( tools::Long nWidth, tools::Long nHeight ) override;
534 virtual void SetPosSize( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, sal_uInt16 nFlags ) override;
535 virtual void GetClientSize( tools::Long& rWidth, tools::Long& rHeight ) override;
536 virtual void GetWorkArea( AbsoluteScreenPixelRectangle& rRect ) override;
537 virtual SalFrame* GetParent() const override;
538 virtual void SetWindowState(const vcl::WindowData*) override;
539 virtual bool GetWindowState(vcl::WindowData*) override;
540 virtual void ShowFullScreen( bool bFullScreen, sal_Int32 nDisplay ) override;
541 // Enable/Disable ScreenSaver, SystemAgents, ...
542 virtual void StartPresentation( bool bStart ) override;
543 // Show Window over all other Windows
544 virtual void SetAlwaysOnTop( bool bOnTop ) override;
546 // Window to top and grab focus
547 virtual void ToTop( SalFrameToTop nFlags ) override;
549 // this function can call with the same
550 // pointer style
551 virtual void SetPointer( PointerStyle ePointerStyle ) override;
552 virtual void CaptureMouse( bool bMouse ) override;
553 virtual void GrabFocus() override;
554 virtual void SetPointerPos( tools::Long nX, tools::Long nY ) override;
556 // flush output buffer
557 using SalFrame::Flush;
558 virtual void Flush() override;
559 // flush output buffer, wait till outstanding operations are done
561 virtual void SetInputContext( SalInputContext* pContext ) override;
562 virtual void EndExtTextInput( EndExtTextInputFlags nFlags ) override;
564 virtual OUString GetKeyName( sal_uInt16 nKeyCode ) override;
565 virtual bool MapUnicodeToKeyCode( sal_Unicode aUnicode, LanguageType aLangType, vcl::KeyCode& rKeyCode ) override;
567 // returns the input language used for the last key stroke
568 // may be LANGUAGE_DONTKNOW if not supported by the OS
569 virtual LanguageType GetInputLanguage() override;
571 virtual void UpdateSettings( AllSettings& rSettings ) override;
573 virtual void Beep() override;
575 // returns system data (most prominent: window handle)
576 virtual const SystemEnvData& GetSystemData() const override;
578 virtual void ResolveWindowHandle(SystemEnvData& rData) const override;
580 // get current modifier and button mask
581 virtual SalPointerState GetPointerState() override;
583 virtual KeyIndicatorState GetIndicatorState() override;
585 virtual void SimulateKeyPress( sal_uInt16 nKeyCode ) override;
587 // set new parent window
588 virtual void SetParent( SalFrame* pNewParent ) override;
589 // reparent window to act as a plugin; implementation
590 // may choose to use a new system window internally
591 // return false to indicate failure
592 virtual void SetPluginParent( SystemParentData* pNewParent ) override;
594 virtual void SetScreenNumber( unsigned int ) override;
595 virtual void SetApplicationID( const OUString &rWMClass ) override;
597 // shaped system windows
598 // set clip region to none (-> rectangular windows, normal state)
599 virtual void ResetClipRegion() override;
600 // start setting the clipregion consisting of nRects rectangles
601 virtual void BeginSetClipRegion( sal_uInt32 nRects ) override;
602 // add a rectangle to the clip region
603 virtual void UnionClipRegion( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight ) override;
604 // done setting up the clipregion
605 virtual void EndSetClipRegion() override;
607 virtual void PositionByToolkit(const tools::Rectangle& rRect, FloatWinPopupFlags nFlags) override;
608 virtual void SetModal(bool bModal) override;
609 void HideTooltip();
610 void BlockTooltip();
611 void UnblockTooltip();
612 virtual bool ShowTooltip(const OUString& rHelpText, const tools::Rectangle& rHelpArea) override;
613 virtual void* ShowPopover(const OUString& rHelpText, vcl::Window* pParent, const tools::Rectangle& rHelpArea, QuickHelpFlags nFlags) override;
614 virtual bool UpdatePopover(void* nId, const OUString& rHelpText, vcl::Window* pParent, const tools::Rectangle& rHelpArea) override;
615 virtual bool HidePopover(void* nId) override;
616 virtual weld::Window* GetFrameWeld() const override;
617 virtual void UpdateDarkMode() override;
618 virtual bool GetUseDarkMode() const override;
619 virtual bool GetUseReducedAnimation() const override;
621 static GtkSalFrame *getFromWindow( GtkWidget *pWindow );
623 static sal_uIntPtr GetNativeWindowHandle(GtkWidget *pWidget);
625 //Call the usual SalFrame Callback, but catch uno exceptions and delegate
626 //to GtkSalData to rethrow them after the gsignal is processed when its safe
627 //to do so again in our own code after the g_main_context_iteration call
628 //which triggers the gsignals.
629 bool CallCallbackExc(SalEvent nEvent, const void* pEvent) const;
631 // call gtk_widget_queue_draw on the drawing widget
632 void queue_draw();
634 static void KeyCodeToGdkKey(const vcl::KeyCode& rKeyCode,
635 guint* pGdkKeyCode, GdkModifierType *pGdkModifiers);
637 static guint32 GetLastInputEventTime();
638 static void UpdateLastInputEventTime(guint32 nUserInputTime);
639 static sal_uInt16 GetMouseModCode(guint nState);
640 static sal_uInt16 GetKeyCode(guint nKeyVal);
641 #if !GTK_CHECK_VERSION(4, 0, 0)
642 static guint GetKeyValFor(GdkKeymap* pKeyMap, guint16 hardware_keycode, guint8 group);
643 #endif
644 static sal_uInt16 GetKeyModCode(guint nState);
645 static GdkEvent* makeFakeKeyPress(GtkWidget* pWidget);
646 #if !GTK_CHECK_VERSION(4, 0, 0)
647 static SalWheelMouseEvent GetWheelEvent(const GdkEventScroll& rEvent);
648 static gboolean NativeWidgetHelpPressed(GtkAccelGroup*, GObject*, guint,
649 GdkModifierType, gpointer pFrame);
650 #endif
651 static OUString GetPreeditDetails(GtkIMContext* pIMContext, std::vector<ExtTextInputAttr>& rInputFlags, sal_Int32& rCursorPos, sal_uInt8& rCursorFlags);
653 #if GTK_CHECK_VERSION(4, 0, 0)
654 gboolean event_controller_scroll_forward(GtkEventControllerScroll* pController, double delta_x, double delta_y);
655 #endif
657 const cairo_font_options_t* get_font_options();
659 void SetColorScheme(GVariant* variant);
661 void SessionManagerInhibit(bool bStart, ApplicationInhibitFlags eType, std::u16string_view sReason, const char* application_id);
663 void DisallowCycleFocusOut();
664 bool IsCycleFocusOutDisallowed() const;
665 void AllowCycleFocusOut();
668 extern "C" {
670 GType ooo_fixed_get_type();
671 #if !GTK_CHECK_VERSION(4, 0, 0)
672 AtkObject* ooo_fixed_get_accessible(GtkWidget *obj);
673 #endif
675 } // extern "C"
677 #if !GTK_CHECK_VERSION(3, 22, 0)
678 enum GdkAnchorHints
680 GDK_ANCHOR_FLIP_X = 1 << 0,
681 GDK_ANCHOR_FLIP_Y = 1 << 1,
682 GDK_ANCHOR_SLIDE_X = 1 << 2,
683 GDK_ANCHOR_SLIDE_Y = 1 << 3,
684 GDK_ANCHOR_RESIZE_X = 1 << 4,
685 GDK_ANCHOR_RESIZE_Y = 1 << 5,
686 GDK_ANCHOR_FLIP = GDK_ANCHOR_FLIP_X | GDK_ANCHOR_FLIP_Y,
687 GDK_ANCHOR_SLIDE = GDK_ANCHOR_SLIDE_X | GDK_ANCHOR_SLIDE_Y,
688 GDK_ANCHOR_RESIZE = GDK_ANCHOR_RESIZE_X | GDK_ANCHOR_RESIZE_Y
690 #endif
693 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */