LibreOffice Module vcl (master) 1
gtkframe.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#ifndef INCLUDED_VCL_INC_UNX_GTK_GTKFRAME_HXX
21#define INCLUDED_VCL_INC_UNX_GTK_GTKFRAME_HXX
22
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>
30
31#include <salframe.hxx>
32#include <vcl/idle.hxx>
33#include <vcl/sysdata.hxx>
34#include <unx/saltype.h>
36
37#include <tools/link.hxx>
38
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>
43
44#include <list>
45#include <vector>
46
47#include <config_dbus.h>
48#include <config_gio.h>
49
50#include <headless/svpgdi.hxx>
51
52#include "gtkdata.hxx"
53
54class GtkSalGraphics;
55class GtkSalDisplay;
56
57typedef sal_uIntPtr GdkNativeWindow;
60class GtkDnDTransferable;
61
62class GtkSalMenu;
63
64struct VclToGtkHelper;
65
66class GtkSalFrame final : public SalFrame
67{
68 struct IMHandler
69 {
70
71#if !GTK_CHECK_VERSION(4, 0, 0)
72 // Not all GTK Input Methods swallow key release
73 // events. Since they swallow the key press events and we
74 // are left with the key release events, we need to
75 // manually swallow those. To do this, we keep a list of
76 // the previous 10 key press events in each GtkSalFrame
77 // and when we get a key release that matches one of the
78 // key press events in our list, we swallow it.
80 {
81 GdkWindow *window;
83 guint32 time;
84 guint state;
85 guint keyval;
87 guint8 group;
88
89 PreviousKeyPress (GdkEventKey *event)
90 : window (nullptr),
91 send_event (0),
92 time (0),
93 state (0),
94 keyval (0),
96 group (0)
97 {
98 if (event)
99 {
100 window = event->window;
101 send_event = event->send_event;
102 time = event->time;
103 state = event->state;
104 keyval = event->keyval;
105 hardware_keycode = event->hardware_keycode;
106 group = event->group;
107 }
108 }
109
111 : window( rPrev.window ),
112 send_event( rPrev.send_event ),
113 time( rPrev.time ),
114 state( rPrev.state ),
115 keyval( rPrev.keyval ),
117 group( rPrev.group )
118 {}
119
120 bool operator== (GdkEventKey const *event) const
121 {
122 return (event != nullptr)
123 && (event->window == window)
124 && (event->send_event == send_event)
125 // ignore non-Gdk state bits, e.g., these used by IBus
126 && ((event->state & GDK_MODIFIER_MASK) == (state & GDK_MODIFIER_MASK))
127 && (event->keyval == keyval)
128 && (event->hardware_keycode == hardware_keycode)
129 && (event->group == group)
130 && (event->time - time < 300)
131 ;
132 }
133 };
134#endif
135
137#if !GTK_CHECK_VERSION(4, 0, 0)
138 std::list< PreviousKeyPress > m_aPrevKeyPresses;
139#endif
140 int m_nPrevKeyPresses; // avoid using size()
141 GtkIMContext* m_pIMContext;
145 std::vector< ExtTextInputAttr > m_aInputFlags;
146
149
154#if !GTK_CHECK_VERSION(4, 0, 0)
155 bool handleKeyEvent( GdkEventKey* pEvent );
156#endif
157 void focusChanged( bool bFocusIn );
158
161
162 static void signalIMCommit( GtkIMContext*, gchar*, gpointer );
163 static gboolean signalIMDeleteSurrounding( GtkIMContext*, gint, gint, gpointer );
164 static void signalIMPreeditChanged( GtkIMContext*, gpointer );
165 static void signalIMPreeditEnd( GtkIMContext*, gpointer );
166 static void signalIMPreeditStart( GtkIMContext*, gpointer );
167 static gboolean signalIMRetrieveSurrounding( GtkIMContext*, gpointer );
168 };
169 friend struct IMHandler;
170
172
175 GtkHeaderBar* m_pHeaderBar;
177#if !GTK_CHECK_VERSION(4, 0, 0)
178 GtkEventBox* m_pEventBox;
180 GtkFixed* m_pDrawingArea;
181#else
182 GtkOverlay* m_pOverlay;
183 GtkFixed* m_pFixedContainer;
184 GtkDrawingArea* m_pDrawingArea;
185 GtkEventControllerKey* m_pKeyController;
186 gulong m_nSettingChangedSignalId;
187#endif
193#if !GTK_CHECK_VERSION(4, 0, 0)
198#endif
201 std::list< GtkSalFrame* > m_aChildren;
204 std::unique_ptr<GtkSalGraphics> m_pGraphics;
214 OUString m_sWMClass;
215
216 std::unique_ptr<IMHandler> m_pIMHandler;
217
221
222 OUString m_aTooltip;
229 cairo_region_t* m_pRegion;
234
236
237#if ENABLE_DBUS && ENABLE_GIO
238 private:
239 friend void on_registrar_available (GDBusConnection*, const gchar*, const gchar*, gpointer);
240 friend void on_registrar_unavailable (GDBusConnection*, const gchar*, gpointer);
241#endif
243
244 void Init( SalFrame* pParent, SalFrameStyleFlags nStyle );
245 void Init( SystemParentData* pSysData );
248
249 // signals
250#if !GTK_CHECK_VERSION(4, 0, 0)
251 static gboolean signalButton( GtkWidget*, GdkEventButton*, gpointer );
252 static void signalStyleUpdated(GtkWidget*, gpointer);
253#else
254 static void signalStyleUpdated(GtkWidget*, const gchar* pSetting, pointer);
255#endif
256 void DrawingAreaResized(GtkWidget* pWidget, int nWidth, int nHeight);
258#if !GTK_CHECK_VERSION(4, 0, 0)
259 static gboolean signalDraw( GtkWidget*, cairo_t *cr, gpointer );
260 static void sizeAllocated(GtkWidget*, GdkRectangle *pAllocation, gpointer frame);
261#else
262 static void signalDraw(GtkDrawingArea*, cairo_t *cr, int width, int height, gpointer);
263 static void sizeAllocated(GtkWidget*, int nWidth, int nHeight, gpointer frame);
264#endif
265 static void signalRealize(GtkWidget*, gpointer frame);
266 static gboolean signalTooltipQuery(GtkWidget*, gint x, gint y,
267 gboolean keyboard_mode, GtkTooltip *tooltip,
268 gpointer frame);
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);
273
274 static void signalDragFailed(GdkDrag* drag, GdkDragCancelReason reason, gpointer frame);
275 static void signalDragDelete(GdkDrag* drag, gpointer frame);
276 static void signalDragEnd(GdkDrag* drag, gpointer frame);
277#else
278 static gboolean signalDragMotion(GtkWidget *widget, GdkDragContext *context, gint x, gint y,
279 guint time, gpointer frame);
280 static gboolean signalDragDrop(GtkWidget* widget, GdkDragContext *context, gint x, gint y,
281 guint time, gpointer frame);
282 static void signalDragDropReceived(GtkWidget *widget, GdkDragContext *context, gint x, gint y,
283 GtkSelectionData *data, guint ttype, guint time, gpointer frame);
284 static void signalDragLeave(GtkWidget *widget, GdkDragContext *context, guint time, gpointer frame);
285
286 static gboolean signalDragFailed(GtkWidget *widget, GdkDragContext *context, GtkDragResult result, gpointer frame);
287 static void signalDragDelete(GtkWidget *widget, GdkDragContext *context, gpointer frame);
288 static void signalDragEnd(GtkWidget *widget, GdkDragContext *context, gpointer frame);
289 static void signalDragDataGet(GtkWidget* widget, GdkDragContext* context, GtkSelectionData *data, guint info,
290 guint time, gpointer frame);
291
292#endif
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);
295 bool DrawingAreaButton(SalEvent nEventType, int nEventX, int nEventY, int nButton, guint32 nTime, guint nState);
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);
300#endif
302#if GTK_CHECK_VERSION(4, 0, 0)
303 static void signalFocusEnter(GtkEventControllerFocus* pController, gpointer frame);
304 static void signalFocusLeave(GtkEventControllerFocus* pController, gpointer frame);
305#else
306 static gboolean signalFocus( GtkWidget*, GdkEventFocus*, gpointer );
307#endif
308#if !GTK_CHECK_VERSION(4, 0, 0)
309 static void signalSetFocus(GtkWindow* pWindow, GtkWidget* pWidget, gpointer frame);
310#else
311 static void signalSetFocus(GtkWindow* pWindow, GParamSpec* pSpec, gpointer frame);
312#endif
313 void WindowMap();
316 void DrawingAreaMotion(int nEventX, int nEventY, guint32 nTime, guint nState);
317 void DrawingAreaCrossing(SalEvent nEventType, int nEventX, int nEventY, guint32 nTime, guint nState);
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);
321
322 static void signalMap(GtkWidget*, gpointer);
323 static void signalUnmap(GtkWidget*, gpointer);
324
325 static gboolean signalDelete(GtkWidget*, gpointer);
326
327 static void signalMotion(GtkEventControllerMotion *controller, double x, double y, gpointer);
328
329 static gboolean signalScroll(GtkEventControllerScroll* pController, double delta_x, double delta_y, gpointer);
330
331 static void signalEnter(GtkEventControllerMotion *controller, double x, double y, gpointer);
332 static void signalLeave(GtkEventControllerMotion *controller, gpointer);
333
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);
336
337 static void signalWindowState(GdkToplevel*, GParamSpec*, gpointer);
338#else
339 static gboolean signalMap( GtkWidget*, GdkEvent*, gpointer );
340 static gboolean signalUnmap( GtkWidget*, GdkEvent*, gpointer );
341
342 static gboolean signalDelete( GtkWidget*, GdkEvent*, gpointer );
343
344 static gboolean signalMotion( GtkWidget*, GdkEventMotion*, gpointer );
345
346 static gboolean signalScroll( GtkWidget*, GdkEvent*, gpointer );
347
348 static gboolean signalCrossing( GtkWidget*, GdkEventCrossing*, gpointer );
349
350 static gboolean signalKey( GtkWidget*, GdkEventKey*, gpointer );
351
352 static gboolean signalWindowState( GtkWidget*, GdkEvent*, gpointer );
353#endif
354
355 static bool signalZoomBegin(GtkGesture*, GdkEventSequence*, gpointer);
356 static bool signalZoomUpdate(GtkGesture*, GdkEventSequence*, gpointer);
357 static bool signalZoomEnd(GtkGesture*, GdkEventSequence*, gpointer);
358
359 static bool signalRotateBegin(GtkGesture*, GdkEventSequence*, gpointer);
360 static bool signalRotateUpdate(GtkGesture*, GdkEventSequence*, gpointer);
361 static bool signalRotateEnd(GtkGesture*, GdkEventSequence*, gpointer);
362
363#if !GTK_CHECK_VERSION(4, 0, 0)
364 static gboolean signalConfigure( GtkWidget*, GdkEventConfigure*, gpointer );
365#endif
366 static void signalDestroy( GtkWidget*, gpointer );
367
368 void Center();
370
371 bool doKeyCallback( guint state,
372 guint keyval,
373 guint16 hardware_keycode,
374 guint8 group,
375 sal_Unicode aOrigCode,
376 bool bDown,
377 bool bSendRelease
378 );
379
380#if !GTK_CHECK_VERSION(4, 0, 0)
382#endif
383
384 static int m_nFloats;
385
386 bool isFloatGrabWindow() const
387 {
388 return
389 (m_nStyle & SalFrameStyleFlags::FLOAT) && // only a float can be floatgrab
390 !(m_nStyle & SalFrameStyleFlags::TOOLTIP) && // tool tips are not
391 !(m_nStyle & SalFrameStyleFlags::OWNERDRAWDECORATION); // toolbars are also not
392 }
393
394 bool isChild( bool bPlug = true, bool bSysChild = true )
395 {
397 if( bPlug )
399 if( bSysChild )
401 return bool(m_nStyle & nMask);
402 }
403
404 //call gtk_window_resize
405 void window_resize(tools::Long nWidth, tools::Long nHeight);
406 //call gtk_widget_set_size_request
408
409 void resizeWindow( tools::Long nWidth, tools::Long nHeight );
411
413
415
418
420
421 enum class SetType { RetainSize, Fullscreen, UnFullscreen };
422
423 void SetScreen( unsigned int nNewScreen, SetType eType, tools::Rectangle const *pSize = nullptr );
424
425 void SetIcon(const char* pIcon);
426
427 bool HandleMenubarMnemonic(guint eState, guint nKeyval);
428
430
432
433 void UpdateGeometryFromEvent(int x_root, int y_root, int nEventX, int nEventY);
434
435public:
439 std::vector<GdkEvent*> m_aPendingScrollEvents;
440#if !GTK_CHECK_VERSION(4, 0, 0)
442#endif
447
451 std::vector<gulong> m_aMouseSignalIds;
452
453 void grabPointer(bool bGrab, bool bKeyboardAlso, bool bOwnerEvents);
454
456 static GdkDisplay* getGdkDisplay();
457 GtkWidget* getWindow() const { return m_pWindow; }
458 GtkFixed* getFixedContainer() const { return GTK_FIXED(m_pFixedContainer); }
460 GtkGrid* getTopLevelGridWidget() const { return m_pTopLevelGrid; }
461 const SalX11Screen& getXScreenNumber() const { return m_nXScreen; }
462 int GetDisplayScreen() const { return maGeometry.screen(); }
464
466 void damaged(sal_Int32 nExtentsLeft, sal_Int32 nExtentsTop,
467 sal_Int32 nExtentsRight, sal_Int32 nExtentsBottom) const;
468
470 {
471 assert(!m_pDropTarget);
472 m_pDropTarget = pDropTarget;
473 }
474
475 void deregisterDropTarget(GtkInstDropTarget const * pDropTarget)
476 {
477 assert(m_pDropTarget == pDropTarget); (void)pDropTarget;
478 m_pDropTarget = nullptr;
479 }
480
482 {
483 assert(!m_pDragSource);
484 m_pDragSource = pDragSource;
485 }
486
487 void deregisterDragSource(GtkInstDragSource const * pDragSource)
488 {
489 assert(m_pDragSource == pDragSource); (void)pDragSource;
490 m_pDragSource = nullptr;
491 }
492
493 void startDrag(const css::datatransfer::dnd::DragGestureEvent& rEvent,
494 const css::uno::Reference<css::datatransfer::XTransferable>& rTrans,
495 VclToGtkHelper& rConversionHelper,
496 GdkDragAction sourceActions);
497
499
502
503#if !GTK_CHECK_VERSION(4, 0, 0)
505
506 void LaunchAsyncScroll(GdkEvent const * pEvent);
507 DECL_LINK(AsyncScroll, Timer *, void);
508#endif
509
510 virtual ~GtkSalFrame() override;
511
512 // SalGraphics or NULL, but two Graphics for all SalFrames
513 // must be returned
514 virtual SalGraphics* AcquireGraphics() override;
515 virtual void ReleaseGraphics( SalGraphics* pGraphics ) override;
516
517 // Event must be destroyed, when Frame is destroyed
518 // When Event is called, SalInstance::Yield() must be returned
519 virtual bool PostEvent(std::unique_ptr<ImplSVEvent> pData) override;
520
521 virtual void SetTitle( const OUString& rTitle ) override;
522 virtual void SetIcon( sal_uInt16 nIcon ) override;
523 virtual void SetMenu( SalMenu *pSalMenu ) override;
526
527 virtual void SetExtendedFrameStyle( SalExtStyle nExtStyle ) override;
528 // Before the window is visible, a resize event
529 // must be sent with the correct size
530 virtual void Show( bool bVisible, bool bNoActivate = false ) override;
531 // Set ClientSize and Center the Window to the desktop
532 // and send/post a resize message
533 virtual void SetMinClientSize( tools::Long nWidth, tools::Long nHeight ) override;
534 virtual void SetMaxClientSize( tools::Long nWidth, tools::Long nHeight ) override;
535 virtual void SetPosSize( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, sal_uInt16 nFlags ) override;
536 virtual void GetClientSize( tools::Long& rWidth, tools::Long& rHeight ) override;
537 virtual void GetWorkArea( tools::Rectangle& rRect ) override;
538 virtual SalFrame* GetParent() const override;
539 virtual void SetWindowState(const vcl::WindowData*) override;
540 virtual bool GetWindowState(vcl::WindowData*) override;
541 virtual void ShowFullScreen( bool bFullScreen, sal_Int32 nDisplay ) override;
542 // Enable/Disable ScreenSaver, SystemAgents, ...
543 virtual void StartPresentation( bool bStart ) override;
544 // Show Window over all other Windows
545 virtual void SetAlwaysOnTop( bool bOnTop ) override;
546
547 // Window to top and grab focus
548 virtual void ToTop( SalFrameToTop nFlags ) override;
549
550 // this function can call with the same
551 // pointer style
552 virtual void SetPointer( PointerStyle ePointerStyle ) override;
553 virtual void CaptureMouse( bool bMouse ) override;
554 virtual void GrabFocus() override;
555 virtual void SetPointerPos( tools::Long nX, tools::Long nY ) override;
556
557 // flush output buffer
558 using SalFrame::Flush;
559 virtual void Flush() override;
560 // flush output buffer, wait till outstanding operations are done
561
562 virtual void SetInputContext( SalInputContext* pContext ) override;
563 virtual void EndExtTextInput( EndExtTextInputFlags nFlags ) override;
564
565 virtual OUString GetKeyName( sal_uInt16 nKeyCode ) override;
566 virtual bool MapUnicodeToKeyCode( sal_Unicode aUnicode, LanguageType aLangType, vcl::KeyCode& rKeyCode ) override;
567
568 // returns the input language used for the last key stroke
569 // may be LANGUAGE_DONTKNOW if not supported by the OS
570 virtual LanguageType GetInputLanguage() override;
571
572 virtual void UpdateSettings( AllSettings& rSettings ) override;
573
574 virtual void Beep() override;
575
576 // returns system data (most prominent: window handle)
577 virtual const SystemEnvData* GetSystemData() const override;
578
579 virtual void ResolveWindowHandle(SystemEnvData& rData) const override;
580
581 // get current modifier and button mask
583
585
586 virtual void SimulateKeyPress( sal_uInt16 nKeyCode ) override;
587
588 // set new parent window
589 virtual void SetParent( SalFrame* pNewParent ) override;
590 // reparent window to act as a plugin; implementation
591 // may choose to use a new system window internally
592 // return false to indicate failure
593 virtual void SetPluginParent( SystemParentData* pNewParent ) override;
594
595 virtual void SetScreenNumber( unsigned int ) override;
596 virtual void SetApplicationID( const OUString &rWMClass ) override;
597
598 // shaped system windows
599 // set clip region to none (-> rectangular windows, normal state)
600 virtual void ResetClipRegion() override;
601 // start setting the clipregion consisting of nRects rectangles
602 virtual void BeginSetClipRegion( sal_uInt32 nRects ) override;
603 // add a rectangle to the clip region
604 virtual void UnionClipRegion( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight ) override;
605 // done setting up the clipregion
606 virtual void EndSetClipRegion() override;
607
608 virtual void PositionByToolkit(const tools::Rectangle& rRect, FloatWinPopupFlags nFlags) override;
609 virtual void SetModal(bool bModal) override;
610 virtual bool GetModal() const override;
614 virtual bool ShowTooltip(const OUString& rHelpText, const tools::Rectangle& rHelpArea) override;
615 virtual void* ShowPopover(const OUString& rHelpText, vcl::Window* pParent, const tools::Rectangle& rHelpArea, QuickHelpFlags nFlags) override;
616 virtual bool UpdatePopover(void* nId, const OUString& rHelpText, vcl::Window* pParent, const tools::Rectangle& rHelpArea) override;
617 virtual bool HidePopover(void* nId) override;
618 virtual weld::Window* GetFrameWeld() const override;
619 virtual void UpdateDarkMode() override;
620 virtual bool GetUseDarkMode() const override;
621 virtual bool GetUseReducedAnimation() const override;
622
624
625 static sal_uIntPtr GetNativeWindowHandle(GtkWidget *pWidget);
626
627 //Call the usual SalFrame Callback, but catch uno exceptions and delegate
628 //to GtkSalData to rethrow them after the gsignal is processed when its safe
629 //to do so again in our own code after the g_main_context_iteration call
630 //which triggers the gsignals.
631 bool CallCallbackExc(SalEvent nEvent, const void* pEvent) const;
632
633 // call gtk_widget_queue_draw on the drawing widget
635
636 static void KeyCodeToGdkKey(const vcl::KeyCode& rKeyCode,
637 guint* pGdkKeyCode, GdkModifierType *pGdkModifiers);
638
639 static guint32 GetLastInputEventTime();
640 static void UpdateLastInputEventTime(guint32 nUserInputTime);
641 static sal_uInt16 GetMouseModCode(guint nState);
642 static sal_uInt16 GetKeyCode(guint nKeyVal);
643#if !GTK_CHECK_VERSION(4, 0, 0)
644 static guint GetKeyValFor(GdkKeymap* pKeyMap, guint16 hardware_keycode, guint8 group);
645#endif
646 static sal_uInt16 GetKeyModCode(guint nState);
647 static GdkEvent* makeFakeKeyPress(GtkWidget* pWidget);
648#if !GTK_CHECK_VERSION(4, 0, 0)
649 static SalWheelMouseEvent GetWheelEvent(const GdkEventScroll& rEvent);
650 static gboolean NativeWidgetHelpPressed(GtkAccelGroup*, GObject*, guint,
651 GdkModifierType, gpointer pFrame);
652#endif
653 static OUString GetPreeditDetails(GtkIMContext* pIMContext, std::vector<ExtTextInputAttr>& rInputFlags, sal_Int32& rCursorPos, sal_uInt8& rCursorFlags);
654
655#if GTK_CHECK_VERSION(4, 0, 0)
656 gboolean event_controller_scroll_forward(GtkEventControllerScroll* pController, double delta_x, double delta_y);
657#endif
658
660
661 void SetColorScheme(GVariant* variant);
662
663 void SessionManagerInhibit(bool bStart, ApplicationInhibitFlags eType, std::u16string_view sReason, const char* application_id);
664
668};
669
670extern "C" {
671
673#if !GTK_CHECK_VERSION(4, 0, 0)
675#endif
676
677} // extern "C"
678
679#if !GTK_CHECK_VERSION(3, 22, 0)
681{
692#endif
693
694#endif // INCLUDED_VCL_INC_UNX_GTK_GTKFRAME_HXX
695
696/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
struct _cairo_surface cairo_surface_t
Definition: CairoCommon.hxx:46
struct _cairo cairo_t
Definition: CairoCommon.hxx:45
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
Definition: gtkframe.hxx:233
static bool signalRotateBegin(GtkGesture *, GdkEventSequence *, gpointer)
GtkEventBox * m_pEventBox
Definition: gtkframe.hxx:178
static void UpdateLastInputEventTime(guint32 nUserInputTime)
void HideTooltip()
virtual void SetTitle(const OUString &rTitle) override
void ListenPortalSettings()
GDBusProxy * m_pSessionManager
Definition: gtkframe.hxx:191
void SetIcon(const char *pIcon)
std::vector< GdkEvent * > m_aPendingScrollEvents
Definition: gtkframe.hxx:439
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
Definition: gtkframe.hxx:438
virtual ~GtkSalFrame() override
void InitCommon()
virtual void UpdateSettings(AllSettings &rSettings) override
virtual void Beep() override
bool m_bSalObjectSetPosSize
Definition: gtkframe.hxx:444
static void KeyCodeToGdkKey(const vcl::KeyCode &rKeyCode, guint *pGdkKeyCode, GdkModifierType *pGdkModifiers)
void closePopup()
virtual void SimulateKeyPress(sal_uInt16 nKeyCode) override
bool m_bDefaultPos
Definition: gtkframe.hxx:211
std::unique_ptr< GtkSalGraphics > m_pGraphics
Definition: gtkframe.hxx:204
GdkWindow * m_pForeignTopLevel
Definition: gtkframe.hxx:196
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)
Idle m_aSmoothScrollIdle
Definition: gtkframe.hxx:441
FloatWinPopupFlags m_nFloatFlags
Definition: gtkframe.hxx:225
void WindowMap()
void ListenSessionManager()
guint m_nActionGroupExportId
Definition: gtkframe.hxx:449
void deregisterDragSource(GtkInstDragSource const *pDragSource)
Definition: gtkframe.hxx:487
static void sizeAllocated(GtkWidget *, GdkRectangle *pAllocation, gpointer frame)
void BlockTooltip()
static guint GetKeyValFor(GdkKeymap *pKeyMap, guint16 hardware_keycode, guint8 group)
GtkInstDropTarget * m_pDropTarget
Definition: gtkframe.hxx:230
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)
Definition: gtkframe.hxx:394
SalMenu * GetMenu()
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
Definition: gtkframe.hxx:197
static void signalSetFocus(GtkWindow *pWindow, GtkWidget *pWidget, gpointer frame)
guint m_nHudAwarenessId
Definition: gtkframe.hxx:450
virtual bool HidePopover(void *nId) override
OUString m_aTooltip
Definition: gtkframe.hxx:222
gulong m_nPortalSettingChangedSignalId
Definition: gtkframe.hxx:188
bool m_bGeometryIsProvisional
Definition: gtkframe.hxx:232
void DrawingAreaCrossing(SalEvent nEventType, int nEventX, int nEventY, guint32 nTime, guint nState)
void DisallowCycleFocusOut()
SalX11Screen m_nXScreen
Definition: gtkframe.hxx:173
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
Definition: gtkframe.hxx:460
bool m_bGraphics
Definition: gtkframe.hxx:205
void DrawingAreaFocusInOut(SalEvent nEventType)
static gboolean signalDragDrop(GtkWidget *widget, GdkDragContext *context, gint x, gint y, guint time, gpointer frame)
int m_nGrabLevel
Definition: gtkframe.hxx:443
bool HandleMenubarMnemonic(guint eState, guint nKeyval)
basegfx::B2IVector m_aFrameSize
Definition: gtkframe.hxx:437
GtkWidget * m_pWindow
Definition: gtkframe.hxx:174
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
Definition: gtkframe.hxx:175
static void signalDestroy(GtkWidget *, gpointer)
void window_resize(tools::Long nWidth, tools::Long nHeight)
Size m_aMaxSize
Definition: gtkframe.hxx:218
virtual void ResolveWindowHandle(SystemEnvData &rData) const override
GtkInstDragSource * m_pDragSource
Definition: gtkframe.hxx:231
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)
Definition: gtkframe.hxx:469
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)
void UnblockTooltip()
GtkWidget * getMouseEventWidget() const
tools::Rectangle m_aRestorePosSize
Definition: gtkframe.hxx:220
SalFrameStyleFlags m_nStyle
Definition: gtkframe.hxx:199
virtual SalFrame * GetParent() const override
virtual void SetPluginParent(SystemParentData *pNewParent) override
void Center()
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
Definition: gtkframe.hxx:180
void WindowUnmap()
OUString m_sWMClass
Definition: gtkframe.hxx:214
gulong m_nSetFocusSignalId
Definition: gtkframe.hxx:209
void updateScreenNumber()
static gboolean NativeWidgetHelpPressed(GtkAccelGroup *, GObject *, guint, GdkModifierType, gpointer pFrame)
bool m_bFloatPositioned
Definition: gtkframe.hxx:226
static bool signalRotateUpdate(GtkGesture *, GdkEventSequence *, gpointer)
virtual void SetMaxClientSize(tools::Long nWidth, tools::Long nHeight) override
std::vector< gulong > m_aMouseSignalIds
Definition: gtkframe.hxx:451
const SalX11Screen & getXScreenNumber() const
Definition: gtkframe.hxx:461
guint m_nMenuExportId
Definition: gtkframe.hxx:448
std::unique_ptr< IMHandler > m_pIMHandler
Definition: gtkframe.hxx:216
bool m_bFullscreen
Definition: gtkframe.hxx:210
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
Definition: gtkframe.hxx:462
virtual void SetExtendedFrameStyle(SalExtStyle nExtStyle) override
void registerDragSource(GtkInstDragSource *pDragSource)
Definition: gtkframe.hxx:481
virtual void SetParent(SalFrame *pNewParent) override
static GtkSalDisplay * getDisplay()
virtual bool GetUseReducedAnimation() const override
tools::Long m_nWidthRequest
Definition: gtkframe.hxx:227
tools::Rectangle m_aFloatRect
Definition: gtkframe.hxx:224
static sal_uInt16 GetKeyModCode(guint nState)
void SetColorScheme(GVariant *variant)
static void signalRealize(GtkWidget *, gpointer frame)
void TriggerPaintEvent()
GdkToplevelState m_nState
Definition: gtkframe.hxx:202
tools::Rectangle m_aHelpArea
Definition: gtkframe.hxx:223
static bool signalZoomUpdate(GtkGesture *, GdkEventSequence *, gpointer)
void nopaint_container_resize_children(GtkContainer *)
static gboolean signalWindowState(GtkWidget *, GdkEvent *, gpointer)
bool m_bDefaultSize
Definition: gtkframe.hxx:212
void EnsureAppMenuWatch()
bool m_bTooltipBlocked
Definition: gtkframe.hxx:213
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
Definition: gtkframe.hxx:190
cairo_t * getCairoContext() const
Size m_aMinSize
Definition: gtkframe.hxx:219
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)
void addGrabLevel()
virtual void SetIcon(sal_uInt16 nIcon) override
void SetDefaultSize()
cairo_region_t * m_pRegion
Definition: gtkframe.hxx:229
virtual void EndSetClipRegion() override
static void signalDragDelete(GtkWidget *widget, GdkDragContext *context, gpointer frame)
PointerStyle m_ePointerStyle
Definition: gtkframe.hxx:207
std::list< GtkSalFrame * > m_aChildren
Definition: gtkframe.hxx:201
static gboolean signalDraw(GtkWidget *, cairo_t *cr, gpointer)
static int m_nFloats
Definition: gtkframe.hxx:384
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
Definition: gtkframe.hxx:208
cairo_surface_t * m_pSurface
Definition: gtkframe.hxx:436
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
Definition: gtkframe.hxx:194
GDBusProxy * m_pSettingsPortal
Definition: gtkframe.hxx:189
virtual void GetClientSize(tools::Long &rWidth, tools::Long &rHeight) override
GtkGrid * m_pTopLevelGrid
Definition: gtkframe.hxx:176
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
Definition: gtkframe.hxx:203
Size calcDefaultSize()
GdkNativeWindow m_aForeignParentWindow
Definition: gtkframe.hxx:195
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)
void updateWMClass()
void AllocateFrame()
virtual void * ShowPopover(const OUString &rHelpText, vcl::Window *pParent, const tools::Rectangle &rHelpArea, QuickHelpFlags nFlags) override
void LaunchAsyncScroll(GdkEvent const *pEvent)
void queue_draw()
void DrawingAreaDraw(cairo_t *cr)
tools::Long m_nHeightRequest
Definition: gtkframe.hxx:228
static void signalDragDropReceived(GtkWidget *widget, GdkDragContext *context, gint x, gint y, GtkSelectionData *data, guint ttype, guint time, gpointer frame)
GtkFixed * m_pFixedContainer
Definition: gtkframe.hxx:179
virtual void UpdateDarkMode() override
bool isFloatGrabWindow() const
Definition: gtkframe.hxx:386
GtkFixed * getFixedContainer() const
Definition: gtkframe.hxx:458
GtkSalFrame * m_pParent
Definition: gtkframe.hxx:200
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)
Definition: gtkframe.hxx:475
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)
void setMinMaxSize()
static void gestureSwipe(GtkGestureSwipe *gesture, gdouble velocity_x, gdouble velocity_y, gpointer frame)
static GdkNativeWindow findTopLevelSystemWindow(GdkNativeWindow aWindow)
GtkWidget * getWindow() const
Definition: gtkframe.hxx:457
void removeGrabLevel()
guint m_nWatcherId
Definition: gtkframe.hxx:242
virtual void StartPresentation(bool bStart) override
GDBusProxy * m_pSessionClient
Definition: gtkframe.hxx:192
ModKeyFlags m_nKeyModifiers
Definition: gtkframe.hxx:206
static void signalDragLeave(GtkWidget *widget, GdkDragContext *context, guint time, gpointer frame)
static GdkDisplay * getGdkDisplay()
GtkSalMenu * m_pSalMenu
Definition: gtkframe.hxx:235
GtkSalFrame(SalFrame *pParent, SalFrameStyleFlags nStyle)
An idle is a timer to be scheduled immediately.
Definition: idle.hxx:35
unsigned int screen() const
Definition: salgeom.hxx:65
A SalFrame is a system window (e.g. an X11 window).
Definition: salframe.hxx:115
virtual void Flush()=0
SalFrameGeometry maGeometry
absolute, unmirrored values
Definition: salframe.hxx:127
Definition: timer.hxx:27
struct _GDBusProxy GDBusProxy
Definition: cpdmgr.hxx:29
struct _GDBusConnection GDBusConnection
Definition: cpdmgr.hxx:30
GdkWindowState GdkToplevelState
Definition: gtkdata.hxx:54
AtkObject * ooo_fixed_get_accessible(GtkWidget *obj)
sal_uIntPtr GdkNativeWindow
Definition: gtkframe.hxx:55
GType ooo_fixed_get_type()
GdkAnchorHints
Definition: gtkframe.hxx:681
@ GDK_ANCHOR_FLIP_X
Definition: gtkframe.hxx:682
@ GDK_ANCHOR_FLIP
Definition: gtkframe.hxx:688
@ GDK_ANCHOR_SLIDE_X
Definition: gtkframe.hxx:684
@ GDK_ANCHOR_SLIDE
Definition: gtkframe.hxx:689
@ GDK_ANCHOR_RESIZE_X
Definition: gtkframe.hxx:686
@ GDK_ANCHOR_FLIP_Y
Definition: gtkframe.hxx:683
@ GDK_ANCHOR_RESIZE_Y
Definition: gtkframe.hxx:687
@ GDK_ANCHOR_RESIZE
Definition: gtkframe.hxx:690
@ GDK_ANCHOR_SLIDE_Y
Definition: gtkframe.hxx:685
struct _GtkWidget GtkWidget
ttype
QuickHelpFlags
Definition: help.hxx:33
KeyIndicatorState
Definition: keycodes.hxx:187
ModKeyFlags
Definition: keycodes.hxx:166
long Long
PointerStyle
Definition: ptrstyle.hxx:26
sal_uInt64 SalExtStyle
Definition: salframe.hxx:95
SalFrameToTop
Definition: salframe.hxx:43
SalFrameStyleFlags
Definition: salframe.hxx:65
struct _cairo_font_options cairo_font_options_t
Definition: salinst.hxx:73
SalEvent
Definition: salwtype.hxx:46
ApplicationInhibitFlags
PreviousKeyPress(const PreviousKeyPress &rPrev)
Definition: gtkframe.hxx:110
bool operator==(GdkEventKey const *event) const
Definition: gtkframe.hxx:120
SalExtTextInputEvent m_aInputEvent
Definition: gtkframe.hxx:144
static void signalIMPreeditEnd(GtkIMContext *, gpointer)
GtkIMContext * m_pIMContext
Definition: gtkframe.hxx:141
static void signalIMCommit(GtkIMContext *, gchar *, gpointer)
std::vector< ExtTextInputAttr > m_aInputFlags
Definition: gtkframe.hxx:145
IMHandler(GtkSalFrame *)
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)
GtkSalFrame * m_pFrame
Definition: gtkframe.hxx:136
void focusChanged(bool bFocusIn)
std::list< PreviousKeyPress > m_aPrevKeyPresses
Definition: gtkframe.hxx:138
void endExtTextInput(EndExtTextInputFlags nFlags)
unsigned char sal_uInt8
sal_uInt16 sal_Unicode
FloatWinPopupFlags
Definition: vclenum.hxx:323
EndExtTextInputFlags
Definition: window.hxx:346