bump product version to 7.2.5.1
[LibreOffice.git] / vcl / inc / unx / salframe.h
blob1107ac9feb71c615ae7b01fe26f8de66f205b9d4
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_SALFRAME_H
21 #define INCLUDED_VCL_INC_UNX_SALFRAME_H
23 #include <X11/Xlib.h>
25 #include <unx/saltype.h>
26 #include <unx/saldisp.hxx>
27 #include <unx/screensaverinhibitor.hxx>
28 #include <salframe.hxx>
29 #include <salwtype.hxx>
30 #include <salinst.hxx>
32 #include <vcl/ptrstyle.hxx>
33 #include <vcl/sysdata.hxx>
34 #include <vcl/timer.hxx>
35 #include <vclpluginapi.h>
37 #include <list>
39 class X11SalGraphics;
40 class SalI18N_InputContext;
42 namespace vcl_sal { class WMAdaptor; class NetWMAdaptor; class GnomeWMAdaptor; }
44 // X11SalFrame
45 enum class X11ShowState
47 Unknown = -1,
48 Minimized = 0,
49 Normal = 1,
50 Hidden = 2
53 enum class WMWindowType
55 Normal,
56 ModelessDialogue,
57 Utility,
58 Splash,
59 Toolbar,
60 Dock
63 class X11SalFrame final : public SalFrame
65 friend class vcl_sal::WMAdaptor;
66 friend class vcl_sal::NetWMAdaptor;
67 friend class vcl_sal::GnomeWMAdaptor;
69 X11SalFrame* mpParent; // pointer to parent frame
70 // which should never obscure this frame
71 bool mbTransientForRoot;
72 std::list< X11SalFrame* > maChildren; // List of child frames
74 SalDisplay *pDisplay_;
75 SalX11Screen m_nXScreen;
76 ::Window mhWindow;
77 ::Window mhShellWindow;
78 ::Window mhForeignParent;
79 // window to fall back to when no longer in fullscreen mode
80 ::Window mhStackingWindow;
81 // window to listen for CirculateNotify events
83 Cursor hCursor_;
84 int nCaptured_; // is captured
86 std::unique_ptr<X11SalGraphics> pGraphics_; // current frame graphics
87 std::unique_ptr<X11SalGraphics> pFreeGraphics_; // first free frame graphics
89 bool mbSendExtKeyModChange;
90 ModKeyFlags mnExtKeyMod;
92 X11ShowState nShowState_; // show state
93 int nWidth_; // client width
94 int nHeight_; // client height
95 tools::Rectangle maRestorePosSize;
96 SalFrameStyleFlags nStyle_;
97 SalExtStyle mnExtStyle;
98 bool bAlwaysOnTop_;
99 bool bViewable_;
100 bool bMapped_;
101 bool bDefaultPosition_; // client is centered initially
102 bool m_bXEmbed;
103 int nVisibility_;
104 int m_nWorkArea;
105 bool m_bSetFocusOnMap;
107 ScreenSaverInhibitor maScreenSaverInhibitor;
108 tools::Rectangle maPaintRegion;
110 Timer maAlwaysOnTopRaiseTimer;
112 // data for WMAdaptor
113 WMWindowType meWindowType;
114 bool mbMaximizedVert;
115 bool mbMaximizedHorz;
116 bool mbFullScreen;
118 // icon id
119 int mnIconID;
121 OUString m_aTitle;
123 OUString m_sWMClass;
125 SystemEnvData maSystemChildData;
127 std::unique_ptr<SalI18N_InputContext> mpInputContext;
128 Bool mbInputFocus;
130 std::vector<XRectangle> m_vClipRectangles;
132 bool mPendingSizeEvent;
134 void GetPosSize( tools::Rectangle &rPosSize );
135 void SetSize ( const Size &rSize );
136 void Center();
137 void SetPosSize( const tools::Rectangle &rPosSize );
138 void Minimize();
139 void Maximize();
140 void Restore();
142 void RestackChildren( ::Window* pTopLevelWindows, int nTopLevelWindows );
143 void RestackChildren();
145 bool HandleKeyEvent ( XKeyEvent *pEvent );
146 bool HandleMouseEvent ( XEvent *pEvent );
147 bool HandleFocusEvent ( XFocusChangeEvent const *pEvent );
148 bool HandleExposeEvent ( XEvent const *pEvent );
149 bool HandleSizeEvent ( XConfigureEvent *pEvent );
150 bool HandleStateEvent ( XPropertyEvent const *pEvent );
151 bool HandleReparentEvent ( XReparentEvent *pEvent );
152 bool HandleClientMessage ( XClientMessageEvent*pEvent );
154 DECL_LINK( HandleAlwaysOnTopRaise, Timer*, void );
156 void createNewWindow( ::Window aParent, SalX11Screen nXScreen = SalX11Screen( -1 ) );
157 void updateScreenNumber();
159 void setXEmbedInfo();
160 void askForXEmbedFocus( sal_Int32 i_nTimeCode );
162 void updateWMClass();
163 public:
164 X11SalFrame( SalFrame* pParent, SalFrameStyleFlags nSalFrameStyle, SystemParentData const * pSystemParent = nullptr );
165 virtual ~X11SalFrame() override;
167 bool Dispatch( XEvent *pEvent );
168 void Init( SalFrameStyleFlags nSalFrameStyle, SalX11Screen nScreen,
169 SystemParentData const * pParentData, bool bUseGeometry = false );
171 SalDisplay* GetDisplay() const
173 return pDisplay_;
175 Display *GetXDisplay() const
177 return pDisplay_->GetDisplay();
179 const SalX11Screen& GetScreenNumber() const { return m_nXScreen; }
180 ::Window GetWindow() const { return mhWindow; }
181 ::Window GetShellWindow() const { return mhShellWindow; }
182 ::Window GetForeignParent() const { return mhForeignParent; }
183 ::Window GetStackingWindow() const { return mhStackingWindow; }
184 void Close() const { CallCallback( SalEvent::Close, nullptr ); }
185 SalFrameStyleFlags GetStyle() const { return nStyle_; }
187 Cursor GetCursor() const { return hCursor_; }
188 bool IsCaptured() const { return nCaptured_ == 1; }
189 #if !defined(__synchronous_extinput__)
190 void HandleExtTextEvent (XClientMessageEvent const *pEvent);
191 #endif
192 bool IsOverrideRedirect() const;
193 bool IsChildWindow() const { return bool(nStyle_ & (SalFrameStyleFlags::PLUG|SalFrameStyleFlags::SYSTEMCHILD)); }
194 bool IsSysChildWindow() const { return bool(nStyle_ & SalFrameStyleFlags::SYSTEMCHILD); }
195 bool IsFloatGrabWindow() const;
196 SalI18N_InputContext* getInputContext() const { return mpInputContext.get(); }
197 bool hasFocus() const { return mbInputFocus; }
199 void beginUnicodeSequence();
200 bool appendUnicodeSequence( sal_Unicode );
201 bool endUnicodeSequence();
203 virtual SalGraphics* AcquireGraphics() override;
204 virtual void ReleaseGraphics( SalGraphics* pGraphics ) override;
206 // call with true to clear graphics (setting None as drawable)
207 // call with false to setup graphics with window (GetWindow())
208 virtual void updateGraphics( bool bClear );
210 virtual bool PostEvent(std::unique_ptr<ImplSVEvent> pData) override;
212 virtual void SetTitle( const OUString& rTitle ) override;
213 virtual void SetIcon( sal_uInt16 nIcon ) override;
214 virtual void SetMenu( SalMenu* pMenu ) override;
215 virtual void DrawMenuBar() override;
217 virtual void SetExtendedFrameStyle( SalExtStyle nExtStyle ) override;
218 virtual void Show( bool bVisible, bool bNoActivate = false ) override;
219 virtual void SetMinClientSize( tools::Long nWidth, tools::Long nHeight ) override;
220 virtual void SetMaxClientSize( tools::Long nWidth, tools::Long nHeight ) override;
221 virtual void SetPosSize( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, sal_uInt16 nFlags ) override;
222 virtual void GetClientSize( tools::Long& rWidth, tools::Long& rHeight ) override;
223 virtual void GetWorkArea( tools::Rectangle& rRect ) override;
224 virtual SalFrame* GetParent() const override;
225 virtual void SetWindowState( const SalFrameState* pState ) override;
226 virtual bool GetWindowState( SalFrameState* pState ) override;
227 virtual void ShowFullScreen( bool bFullScreen, sal_Int32 nMonitor ) override;
228 virtual void StartPresentation( bool bStart ) override;
229 virtual void SetAlwaysOnTop( bool bOnTop ) override;
230 virtual void ToTop( SalFrameToTop nFlags ) override;
231 virtual void SetPointer( PointerStyle ePointerStyle ) override;
232 virtual void CaptureMouse( bool bMouse ) override;
233 virtual void SetPointerPos( tools::Long nX, tools::Long nY ) override;
234 using SalFrame::Flush;
235 virtual void Flush() override;
236 virtual void SetInputContext( SalInputContext* pContext ) override;
237 virtual void EndExtTextInput( EndExtTextInputFlags nFlags ) override;
238 virtual OUString GetKeyName( sal_uInt16 nKeyCode ) override;
239 virtual bool MapUnicodeToKeyCode( sal_Unicode aUnicode, LanguageType aLangType, vcl::KeyCode& rKeyCode ) override;
240 virtual LanguageType GetInputLanguage() override;
241 virtual void UpdateSettings( AllSettings& rSettings ) override;
242 virtual void Beep() override;
243 virtual const SystemEnvData* GetSystemData() const override;
244 virtual SalPointerState GetPointerState() override;
245 virtual KeyIndicatorState GetIndicatorState() override;
246 virtual void SimulateKeyPress( sal_uInt16 nKeyCode ) override;
247 virtual void SetParent( SalFrame* pNewParent ) override;
248 virtual void SetPluginParent( SystemParentData* pNewParent ) override;
250 virtual void SetScreenNumber( unsigned int ) override;
251 virtual void SetApplicationID( const OUString &rWMClass ) override;
253 // shaped system windows
254 // set clip region to none (-> rectangular windows, normal state)
255 virtual void ResetClipRegion() override;
256 // start setting the clipregion consisting of nRects rectangles
257 virtual void BeginSetClipRegion( sal_uInt32 nRects ) override;
258 // add a rectangle to the clip region
259 virtual void UnionClipRegion( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight ) override;
260 // done setting up the clipregion
261 virtual void EndSetClipRegion() override;
263 /// @internal
264 void setPendingSizeEvent();
267 #endif // INCLUDED_VCL_INC_UNX_SALFRAME_H
269 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */