/[packages]/updates/5/libreoffice/current/SOURCES/0001-gtk3-use-native-GtkPopover-for-calc-formula-prompt-e.patch
ViewVC logotype

Contents of /updates/5/libreoffice/current/SOURCES/0001-gtk3-use-native-GtkPopover-for-calc-formula-prompt-e.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1142835 - (show annotations) (download)
Mon Aug 21 23:46:24 2017 UTC (6 years, 7 months ago) by neoclust
File size: 23516 byte(s)
New version 5.1.5
1 From adc7dcad8ea2748e69dba5bf46ccc67fa7a4dcb0 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
3 Date: Wed, 17 Feb 2016 10:47:16 +0000
4 Subject: [PATCH] gtk3: use native GtkPopover for calc formula prompt, etc
5
6 ---
7 include/vcl/help.hxx | 31 +++++-----
8 sc/source/ui/app/inputhdl.cxx | 14 ++---
9 sc/source/ui/app/inputwin.cxx | 7 ++-
10 sc/source/ui/view/tabview4.cxx | 6 +-
11 sd/source/ui/slidesorter/view/SlsToolTip.cxx | 5 +-
12 sd/source/ui/view/viewoverlaymanager.cxx | 10 +--
13 svtools/source/brwbox/datwin.cxx | 12 +---
14 svtools/source/brwbox/datwin.hxx | 2 -
15 svtools/source/table/tabledatawindow.cxx | 16 +----
16 svtools/source/table/tabledatawindow.hxx | 1 -
17 sw/source/uibase/docvw/edtwin.cxx | 9 ++-
18 vcl/inc/salframe.hxx | 21 ++++++-
19 vcl/inc/unx/gtk/gtkframe.hxx | 3 +
20 vcl/source/app/help.cxx | 36 ++++++++---
21 vcl/unx/gtk3/gtk3gtkframe.cxx | 93 ++++++++++++++++++++++++++++
22 15 files changed, 189 insertions(+), 77 deletions(-)
23
24 diff --git a/include/vcl/help.hxx b/include/vcl/help.hxx
25 index 4d226a8..9ffd2f8 100644
26 --- a/include/vcl/help.hxx
27 +++ b/include/vcl/help.hxx
28 @@ -43,18 +43,16 @@ enum class QuickHelpFlags
29 Bottom = 0x0020,
30 NoAutoPos = Left | Center | Right | Top | VCenter | Bottom,
31 CtrlText = 0x0040,
32 -/// force the existent tip window to be re-positioned, even if the previous incarnation has the same text. Applies to ShowBallon and ShowQuickHelp.
33 - ForceReposition = 0x0080,
34 /// no delay when opening the quick help. Applies to ShowBallon and ShowQuickHelp
35 - NoDelay = 0x0100,
36 -/// force balloon-style in ShowTip
37 - TipStyleBalloon = 0x0200,
38 - NoEvadePointer = 0x4000,
39 - BiDiRtl = 0x8000,
40 + NoDelay = 0x0080,
41 +/// force balloon-style in ShowPopover
42 + TipStyleBalloon = 0x0100,
43 + NoEvadePointer = 0x0200,
44 + BiDiRtl = 0x0400,
45 };
46 namespace o3tl
47 {
48 - template<> struct typed_flags<QuickHelpFlags> : is_typed_flags<QuickHelpFlags, 0xc3ff> {};
49 + template<> struct typed_flags<QuickHelpFlags> : is_typed_flags<QuickHelpFlags, 0x7ff> {};
50 }
51
52 #define OOO_HELP_INDEX ".help:index"
53 @@ -105,14 +103,15 @@ public:
54
55 static void HideBalloonAndQuickHelp();
56
57 - static sal_uLong ShowTip( vcl::Window* pParent,
58 - const Rectangle& rScreenRect,
59 - const OUString& rText, QuickHelpFlags nStyle = QuickHelpFlags::NONE );
60 - static void UpdateTip( sal_uLong nId,
61 - vcl::Window* pParent,
62 - const Rectangle& rScreenRect,
63 - const OUString& rText );
64 - static void HideTip( sal_uLong nId );
65 + static sal_uLong ShowPopover(vcl::Window* pParent,
66 + const Rectangle& rScreenRect,
67 + const OUString& rText,
68 + QuickHelpFlags nStyle = QuickHelpFlags::NONE);
69 + static void UpdatePopover(sal_uLong nId,
70 + vcl::Window* pParent,
71 + const Rectangle& rScreenRect,
72 + const OUString& rText);
73 + static void HidePopover(vcl::Window* pParent, sal_uLong nId);
74 };
75
76 #endif // INCLUDED_VCL_HELP_HXX
77 diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
78 index 2395cba..0a65d88 100644
79 --- a/sc/source/ui/app/inputhdl.cxx
80 +++ b/sc/source/ui/app/inputhdl.cxx
81 @@ -782,9 +782,8 @@ void ScInputHandler::HideTip()
82 {
83 if ( nTipVisible )
84 {
85 - if (pTipVisibleParent)
86 - pTipVisibleParent->RemoveEventListener( LINK( this, ScInputHandler, ShowHideTipVisibleParentListener ) );
87 - Help::HideTip( nTipVisible );
88 + pTipVisibleParent->RemoveEventListener( LINK( this, ScInputHandler, ShowHideTipVisibleParentListener ) );
89 + Help::HidePopover(pTipVisibleParent, nTipVisible );
90 nTipVisible = 0;
91 pTipVisibleParent = nullptr;
92 }
93 @@ -794,9 +793,8 @@ void ScInputHandler::HideTipBelow()
94 {
95 if ( nTipVisibleSec )
96 {
97 - if (pTipVisibleSecParent)
98 - pTipVisibleSecParent->RemoveEventListener( LINK( this, ScInputHandler, ShowHideTipVisibleSecParentListener ) );
99 - Help::HideTip( nTipVisibleSec );
100 + pTipVisibleSecParent->RemoveEventListener( LINK( this, ScInputHandler, ShowHideTipVisibleSecParentListener ) );
101 + Help::HidePopover(pTipVisibleSecParent, nTipVisibleSec);
102 nTipVisibleSec = 0;
103 pTipVisibleSecParent = nullptr;
104 }
105 @@ -977,7 +975,7 @@ void ScInputHandler::ShowTip( const OUString& rText )
106 Rectangle aRect( aPos, aPos );
107
108 QuickHelpFlags nAlign = QuickHelpFlags::Left|QuickHelpFlags::Bottom;
109 - nTipVisible = Help::ShowTip(pTipVisibleParent, aRect, rText, nAlign);
110 + nTipVisible = Help::ShowPopover(pTipVisibleParent, aRect, rText, nAlign);
111 pTipVisibleParent->AddEventListener( LINK( this, ScInputHandler, ShowHideTipVisibleParentListener ) );
112 }
113 }
114 @@ -1001,7 +999,7 @@ void ScInputHandler::ShowTipBelow( const OUString& rText )
115 aPos = pTipVisibleSecParent->OutputToScreenPixel( aPos );
116 Rectangle aRect( aPos, aPos );
117 QuickHelpFlags nAlign = QuickHelpFlags::Left | QuickHelpFlags::Top | QuickHelpFlags::NoEvadePointer;
118 - nTipVisibleSec = Help::ShowTip(pTipVisibleSecParent, aRect, rText, nAlign);
119 + nTipVisibleSec = Help::ShowPopover(pTipVisibleSecParent, aRect, rText, nAlign);
120 pTipVisibleSecParent->AddEventListener( LINK( this, ScInputHandler, ShowHideTipVisibleSecParentListener ) );
121 }
122 }
123 diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
124 index cd15f3d..5be068e 100644
125 --- a/sc/source/ui/app/inputwin.cxx
126 +++ b/sc/source/ui/app/inputwin.cxx
127 @@ -2220,7 +2220,10 @@ void ScPosWnd::HideTip()
128 {
129 if ( nTipVisible )
130 {
131 - Help::HideTip( nTipVisible );
132 + vcl::Window* pWin = GetSubEdit();
133 + if (!pWin)
134 + pWin = this;
135 + Help::HidePopover(pWin, nTipVisible);
136 nTipVisible = 0;
137 }
138 }
139 @@ -2328,7 +2331,7 @@ void ScPosWnd::Modify()
140
141 OUString aText = ScGlobal::GetRscString( nStrId );
142 QuickHelpFlags nAlign = QuickHelpFlags::Left|QuickHelpFlags::Bottom;
143 - nTipVisible = Help::ShowTip(pWin, aRect, aText, nAlign);
144 + nTipVisible = Help::ShowPopover(pWin, aRect, aText, nAlign);
145 }
146 }
147 }
148 diff --git a/sc/source/ui/view/tabview4.cxx b/sc/source/ui/view/tabview4.cxx
149 index 1067f7f..1607ab3 100644
150 --- a/sc/source/ui/view/tabview4.cxx
151 +++ b/sc/source/ui/view/tabview4.cxx
152 @@ -39,7 +39,9 @@ void ScTabView::HideTip()
153 {
154 if ( nTipVisible )
155 {
156 - Help::HideTip( nTipVisible );
157 + ScSplitPos eWhich = aViewData.GetActivePart();
158 + vcl::Window* pWin = pGridWin[eWhich];
159 + Help::HidePopover(pWin, nTipVisible);
160 nTipVisible = 0;
161 }
162 }
163 @@ -92,7 +94,7 @@ void ScTabView::ShowRefTip()
164 //! Test, ob geaendert ??
165
166 HideTip();
167 - nTipVisible = Help::ShowTip( pWin, aRect, aHelp, nFlags );
168 + nTipVisible = Help::ShowPopover(pWin, aRect, aHelp, nFlags);
169 bDone = true;
170 }
171 }
172 diff --git a/sd/source/ui/slidesorter/view/SlsToolTip.cxx b/sd/source/ui/slidesorter/view/SlsToolTip.cxx
173 index 0ec9298..64f7dd0 100644
174 --- a/sd/source/ui/slidesorter/view/SlsToolTip.cxx
175 +++ b/sd/source/ui/slidesorter/view/SlsToolTip.cxx
176 @@ -134,7 +134,7 @@ void ToolTip::DoShow()
177 // the preview). Therefore we use a little trick and place the tool
178 // tip at the top of a rectangle that is placed below the preview.
179 aBox.Move(aOffset.X(), aOffset.Y() + aBox.GetHeight() + 3);
180 - mnHelpWindowHandle = Help::ShowTip(
181 + mnHelpWindowHandle = Help::ShowPopover(
182 pWindow,
183 aBox,
184 msCurrentHelpText,
185 @@ -146,7 +146,8 @@ bool ToolTip::Hide()
186 {
187 if (mnHelpWindowHandle>0)
188 {
189 - Help::HideTip(mnHelpWindowHandle);
190 + sd::Window *pWindow (mrSlideSorter.GetContentWindow());
191 + Help::HidePopover(pWindow, mnHelpWindowHandle);
192 mnHelpWindowHandle = 0;
193 return true;
194 }
195 diff --git a/sd/source/ui/view/viewoverlaymanager.cxx b/sd/source/ui/view/viewoverlaymanager.cxx
196 index b97a7d7..426e56a 100644
197 --- a/sd/source/ui/view/viewoverlaymanager.cxx
198 +++ b/sd/source/ui/view/viewoverlaymanager.cxx
199 @@ -146,7 +146,6 @@ private:
200
201 int mnHighlightId;
202 Size maImageSize;
203 - sal_uLong mnTip;
204 };
205
206 ImageButtonHdl::ImageButtonHdl( const SmartTagReference& xTag /*, sal_uInt16 nSID, const Image& rImage, const Image& rImageMO*/, const Point& rPnt )
207 @@ -154,7 +153,6 @@ ImageButtonHdl::ImageButtonHdl( const SmartTagReference& xTag /*, sal_uInt16 nSI
208 , mxTag( dynamic_cast< ChangePlaceholderTag* >( xTag.get() ) )
209 , mnHighlightId( -1 )
210 , maImageSize( 42, 42 )
211 -, mnTip( 0 )
212 {
213 }
214
215 @@ -165,11 +163,7 @@ ImageButtonHdl::~ImageButtonHdl()
216
217 void ImageButtonHdl::HideTip()
218 {
219 - if( mnTip )
220 - {
221 - Help::HideTip( mnTip );
222 - mnTip = 0;
223 - }
224 + Help::HideBalloonAndQuickHelp();
225 }
226
227 void ImageButtonHdl::onMouseEnter(const MouseEvent& rMEvt)
228 @@ -201,7 +195,7 @@ void ImageButtonHdl::onMouseEnter(const MouseEvent& rMEvt)
229
230 OUString aHelpText( aResId );
231 Rectangle aScreenRect( pDev->LogicToPixel( GetPos() ), maImageSize );
232 - mnTip = Help::ShowTip( static_cast< vcl::Window* >( pHdlList->GetView()->GetFirstOutputDevice() ), aScreenRect, aHelpText ) ;
233 + Help::ShowQuickHelp(static_cast< vcl::Window* >( pHdlList->GetView()->GetFirstOutputDevice() ), aScreenRect, aHelpText);
234 }
235 Touch();
236 }
237 diff --git a/svtools/source/brwbox/datwin.cxx b/svtools/source/brwbox/datwin.cxx
238 index aec67c3..19fe7e5 100644
239 --- a/svtools/source/brwbox/datwin.cxx
240 +++ b/svtools/source/brwbox/datwin.cxx
241 @@ -734,25 +734,17 @@ void BrowserScrollBar::Tracking( const TrackingEvent& rTEvt )
242 aTip += OUString::number(GetRangeMax());
243
244 Rectangle aRect(GetPointerPosPixel(), Size(GetTextWidth(aTip), GetTextHeight()));
245 - if ( _nTip )
246 - Help::UpdateTip( _nTip, this, aRect, aTip );
247 - else
248 - _nTip = Help::ShowTip( this, aRect, aTip );
249 + Help::ShowQuickHelp(this, aRect, aTip);
250 _nLastPos = nPos;
251 }
252
253 ScrollBar::Tracking( rTEvt );
254 }
255
256 -
257 -
258 void BrowserScrollBar::EndScroll()
259 {
260 - if ( _nTip )
261 - Help::HideTip( _nTip );
262 - _nTip = 0;
263 + Help::HideBalloonAndQuickHelp();
264 ScrollBar::EndScroll();
265 }
266
267 -
268 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
269 diff --git a/svtools/source/brwbox/datwin.hxx b/svtools/source/brwbox/datwin.hxx
270 index c3aa74b..8ff5122 100644
271 --- a/svtools/source/brwbox/datwin.hxx
272 +++ b/svtools/source/brwbox/datwin.hxx
273 @@ -184,7 +184,6 @@ protected:
274
275 class BrowserScrollBar: public ScrollBar
276 {
277 - sal_uLong _nTip;
278 sal_uLong _nLastPos;
279 VclPtr<BrowserDataWin> _pDataWin;
280
281 @@ -192,7 +191,6 @@ public:
282 BrowserScrollBar( vcl::Window* pParent, WinBits nStyle,
283 BrowserDataWin *pDataWin )
284 : ScrollBar( pParent, nStyle ),
285 - _nTip( 0 ),
286 _nLastPos( ULONG_MAX ),
287 _pDataWin( pDataWin )
288 {}
289 diff --git a/svtools/source/table/tabledatawindow.cxx b/svtools/source/table/tabledatawindow.cxx
290 index 79ee86c..8240f5f 100644
291 --- a/svtools/source/table/tabledatawindow.cxx
292 +++ b/svtools/source/table/tabledatawindow.cxx
293 @@ -33,7 +33,6 @@ namespace svt { namespace table
294 TableDataWindow::TableDataWindow( TableControl_Impl& _rTableControl )
295 :Window( &_rTableControl.getAntiImpl() )
296 ,m_rTableControl( _rTableControl )
297 - ,m_nTipWindowHandle( 0 )
298 {
299 // by default, use the background as determined by the style settings
300 const Color aWindowColor( GetSettings().GetStyleSettings().GetFieldColor() );
301 @@ -123,12 +122,7 @@ namespace svt { namespace table
302 GetOutputSizePixel()
303 );
304
305 - if ( m_nTipWindowHandle )
306 - {
307 - Help::UpdateTip( m_nTipWindowHandle, this, aControlScreenRect, sHelpText );
308 - }
309 - else
310 - m_nTipWindowHandle = Help::ShowTip( this, aControlScreenRect, sHelpText, nHelpStyle );
311 + Help::ShowQuickHelp(this, aControlScreenRect, sHelpText, nHelpStyle);
312 }
313 else
314 {
315 @@ -137,17 +131,11 @@ namespace svt { namespace table
316 }
317 }
318
319 -
320 void TableDataWindow::impl_hideTipWindow()
321 {
322 - if ( m_nTipWindowHandle != 0 )
323 - {
324 - Help::HideTip( m_nTipWindowHandle );
325 - m_nTipWindowHandle = 0;
326 - }
327 + Help::HideBalloonAndQuickHelp();
328 }
329
330 -
331 void TableDataWindow::MouseMove( const MouseEvent& rMEvt )
332 {
333 if ( rMEvt.IsLeaveWindow() )
334 diff --git a/svtools/source/table/tabledatawindow.hxx b/svtools/source/table/tabledatawindow.hxx
335 index 6507147..708d509 100644
336 --- a/svtools/source/table/tabledatawindow.hxx
337 +++ b/svtools/source/table/tabledatawindow.hxx
338 @@ -38,7 +38,6 @@ namespace svt { namespace table
339 private:
340 TableControl_Impl& m_rTableControl;
341 Link<LinkParamNone*,void> m_aSelectHdl;
342 - sal_uLong m_nTipWindowHandle;
343
344 public:
345 explicit TableDataWindow( TableControl_Impl& _rTableControl );
346 diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx
347 index 48ccdf2..b4e5d20 100644
348 --- a/sw/source/uibase/docvw/edtwin.cxx
349 +++ b/sw/source/uibase/docvw/edtwin.cxx
350 @@ -5950,9 +5950,9 @@ void QuickHelpData::Start( SwWrtShell& rSh, sal_uInt16 nWrdLen )
351 Point aPt( rWin.OutputToScreenPixel( rWin.LogicToPixel(
352 rSh.GetCharRect().Pos() )));
353 aPt.Y() -= 3;
354 - nTipId = Help::ShowTip( &rWin, Rectangle( aPt, Size( 1, 1 )),
355 + nTipId = Help::ShowPopover(&rWin, Rectangle( aPt, Size( 1, 1 )),
356 m_aHelpStrings[ nCurArrPos ],
357 - QuickHelpFlags::Left | QuickHelpFlags::Bottom );
358 + QuickHelpFlags::Left | QuickHelpFlags::Bottom);
359 }
360 else
361 {
362 @@ -5985,7 +5985,10 @@ void QuickHelpData::Stop( SwWrtShell& rSh )
363 if( !m_bIsTip )
364 rSh.DeleteExtTextInput( nullptr, false );
365 else if( nTipId )
366 - Help::HideTip( nTipId );
367 + {
368 + vcl::Window& rWin = rSh.GetView().GetEditWin();
369 + Help::HidePopover(&rWin, nTipId);
370 + }
371 ClearContent();
372 }
373
374 diff --git a/vcl/inc/salframe.hxx b/vcl/inc/salframe.hxx
375 index c08486f..0a34503 100644
376 --- a/vcl/inc/salframe.hxx
377 +++ b/vcl/inc/salframe.hxx
378 @@ -33,6 +33,7 @@
379 #include <vcl/impdel.hxx>
380 #include <rtl/ustring.hxx>
381 #include <vcl/keycod.hxx>
382 +#include <vcl/help.hxx>
383 #include <vcl/window.hxx>
384 #include <vcl/vclptr.hxx>
385 #include <o3tl/typed_flags_set.hxx>
386 @@ -243,7 +244,25 @@ public:
387 }
388
389 // return true to indicate tooltips are shown natively, false otherwise
390 - virtual bool ShowTooltip(const OUString& /*rHelpText*/, const Rectangle& /*rHelpArea*/ )
391 + virtual bool ShowTooltip(const OUString& /*rHelpText*/, const Rectangle& /*rHelpArea*/)
392 + {
393 + return false;
394 + }
395 +
396 + // return !0 to indicate popovers are shown natively, 0 otherwise
397 + virtual sal_uIntPtr ShowPopover(const OUString& /*rHelpText*/, const Rectangle& /*rHelpArea*/, QuickHelpFlags /*nFlags*/)
398 + {
399 + return 0;
400 + }
401 +
402 + // return true to indicate popovers are shown natively, false otherwise
403 + virtual bool UpdatePopover(sal_uIntPtr /*nId*/, const OUString& /*rHelpText*/, const Rectangle& /*rHelpArea*/)
404 + {
405 + return false;
406 + }
407 +
408 + // return true to indicate popovers are shown natively, false otherwise
409 + virtual bool HidePopover(sal_uIntPtr /*nId*/)
410 {
411 return false;
412 }
413 diff --git a/vcl/inc/unx/gtk/gtkframe.hxx b/vcl/inc/unx/gtk/gtkframe.hxx
414 index 8be480f..d5aa627 100644
415 --- a/vcl/inc/unx/gtk/gtkframe.hxx
416 +++ b/vcl/inc/unx/gtk/gtkframe.hxx
417 @@ -520,6 +520,9 @@ public:
418 #if GTK_CHECK_VERSION(3,0,0)
419 virtual void SetModal(bool bModal) override;
420 virtual bool ShowTooltip(const OUString& rHelpText, const Rectangle& rHelpArea) override;
421 + virtual sal_uIntPtr ShowPopover(const OUString& rHelpText, const Rectangle& rHelpArea, QuickHelpFlags nFlags) override;
422 + virtual bool UpdatePopover(sal_uIntPtr nId, const OUString& rHelpText, const Rectangle& rHelpArea) override;
423 + virtual bool HidePopover(sal_uIntPtr nId) override;
424 #endif
425
426 static GtkSalFrame *getFromWindow( GtkWindow *pWindow );
427 diff --git a/vcl/source/app/help.cxx b/vcl/source/app/help.cxx
428 index 19570ce..e29d9ee 100644
429 --- a/vcl/source/app/help.cxx
430 +++ b/vcl/source/app/help.cxx
431 @@ -191,23 +191,37 @@ void Help::HideBalloonAndQuickHelp()
432 ImplDestroyHelpWindow( bIsVisible );
433 }
434
435 -sal_uIntPtr Help::ShowTip( vcl::Window* pParent, const Rectangle& rScreenRect,
436 - const OUString& rText, QuickHelpFlags nStyle )
437 +sal_uIntPtr Help::ShowPopover(vcl::Window* pParent, const Rectangle& rScreenRect,
438 + const OUString& rText, QuickHelpFlags nStyle)
439 {
440 + sal_uIntPtr nId = pParent->ImplGetFrame()->ShowPopover(rText, rScreenRect, nStyle);
441 + if (nId)
442 + {
443 + //popovers are handled natively, return early
444 + return nId;
445 + }
446 +
447 sal_uInt16 nHelpWinStyle = ( nStyle & QuickHelpFlags::TipStyleBalloon ) ? HELPWINSTYLE_BALLOON : HELPWINSTYLE_QUICK;
448 VclPtrInstance<HelpTextWindow> pHelpWin( pParent, rText, nHelpWinStyle, nStyle );
449
450 - sal_uIntPtr nId = reinterpret_cast< sal_uIntPtr >( pHelpWin.get() );
451 - UpdateTip( nId, pParent, rScreenRect, rText );
452 + nId = reinterpret_cast< sal_uIntPtr >( pHelpWin.get() );
453 + UpdatePopover(nId, pParent, rScreenRect, rText);
454
455 pHelpWin->ShowHelp( HELPDELAY_NONE );
456 return nId;
457 }
458
459 -void Help::UpdateTip( sal_uIntPtr nId, vcl::Window* pParent, const Rectangle& rScreenRect, const OUString& rText )
460 +void Help::UpdatePopover(sal_uIntPtr nId, vcl::Window* pParent, const Rectangle& rScreenRect,
461 + const OUString& rText)
462 {
463 + if (pParent->ImplGetFrame()->UpdatePopover(nId, rText, rScreenRect))
464 + {
465 + //popovers are handled natively, return early
466 + return;
467 + }
468 +
469 HelpTextWindow* pHelpWin = reinterpret_cast< HelpTextWindow* >( nId );
470 - ENSURE_OR_RETURN_VOID( pHelpWin != nullptr, "Help::UpdateTip: invalid ID!" );
471 + ENSURE_OR_RETURN_VOID( pHelpWin != nullptr, "Help::UpdatePopover: invalid ID!" );
472
473 Size aSz = pHelpWin->CalcOutSize();
474 pHelpWin->SetOutputSizePixel( aSz );
475 @@ -218,8 +232,14 @@ void Help::UpdateTip( sal_uIntPtr nId, vcl::Window* pParent, const Rectangle& rS
476 pHelpWin->Invalidate();
477 }
478
479 -void Help::HideTip( sal_uLong nId )
480 +void Help::HidePopover(vcl::Window* pParent, sal_uLong nId)
481 {
482 + if (pParent->ImplGetFrame()->HidePopover(nId))
483 + {
484 + //popovers are handled natively, return early
485 + return;
486 + }
487 +
488 VclPtr<HelpTextWindow> pHelpWin = reinterpret_cast<HelpTextWindow*>(nId);
489 vcl::Window* pFrameWindow = pHelpWin->ImplGetFrameWindow();
490 pHelpWin->Hide();
491 @@ -498,7 +518,7 @@ void ImplShowHelpWindow( vcl::Window* pParent, sal_uInt16 nHelpWinStyle, QuickHe
492 else
493 {
494 bool const bTextChanged = rHelpText != pHelpWin->GetHelpText();
495 - if ( bTextChanged || ( nStyle & QuickHelpFlags::ForceReposition ) )
496 + if (bTextChanged)
497 {
498 vcl::Window * pWindow = pHelpWin->GetParent()->ImplGetFrameWindow();
499 Rectangle aInvRect( pHelpWin->GetWindowExtentsRelative( pWindow ) );
500 diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
501 index f5443e7..db2c25d 100644
502 --- a/vcl/unx/gtk3/gtk3gtkframe.cxx
503 +++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
504 @@ -2464,6 +2464,99 @@ bool GtkSalFrame::ShowTooltip(const OUString& rHelpText, const Rectangle& rHelpA
505 return true;
506 }
507
508 +#if GTK_CHECK_VERSION(3,12,0)
509 +namespace
510 +{
511 + void set_pointing_to(GtkPopover *pPopOver, const Rectangle& rHelpArea)
512 + {
513 + GdkRectangle aRect;
514 + aRect.x = rHelpArea.Left();
515 + aRect.y = rHelpArea.Top();
516 + aRect.width = 1;
517 + aRect.height = 1;
518 +
519 + GtkPositionType ePos = gtk_popover_get_position(pPopOver);
520 + switch (ePos)
521 + {
522 + case GTK_POS_BOTTOM:
523 + case GTK_POS_TOP:
524 + aRect.width = rHelpArea.GetWidth();
525 + break;
526 + case GTK_POS_RIGHT:
527 + case GTK_POS_LEFT:
528 + aRect.height = rHelpArea.GetHeight();
529 + break;
530 + }
531 +
532 + gtk_popover_set_pointing_to(pPopOver, &aRect);
533 + }
534 +}
535 +#endif
536 +
537 +sal_uIntPtr GtkSalFrame::ShowPopover(const OUString& rHelpText, const Rectangle& rHelpArea, QuickHelpFlags nFlags)
538 +{
539 +#if GTK_CHECK_VERSION(3,12,0)
540 + GtkWidget *pWidget = gtk_popover_new(getMouseEventWidget());
541 + OString sUTF = OUStringToOString(rHelpText, RTL_TEXTENCODING_UTF8);
542 + GtkWidget *pLabel = gtk_label_new(sUTF.getStr());
543 + gtk_container_add(GTK_CONTAINER(pWidget), pLabel);
544 +
545 + if (nFlags & QuickHelpFlags::Top)
546 + gtk_popover_set_position(GTK_POPOVER(pWidget), GTK_POS_BOTTOM);
547 + else if (nFlags & QuickHelpFlags::Bottom)
548 + gtk_popover_set_position(GTK_POPOVER(pWidget), GTK_POS_TOP);
549 + else if (nFlags & QuickHelpFlags::Left)
550 + gtk_popover_set_position(GTK_POPOVER(pWidget), GTK_POS_RIGHT);
551 + else if (nFlags & QuickHelpFlags::Right)
552 + gtk_popover_set_position(GTK_POPOVER(pWidget), GTK_POS_LEFT);
553 +
554 + set_pointing_to(GTK_POPOVER(pWidget), rHelpArea);
555 +
556 + gtk_popover_set_modal(GTK_POPOVER(pWidget), false);
557 +
558 + gtk_widget_show_all(pWidget);
559 +
560 + return reinterpret_cast<sal_uIntPtr>(pWidget);
561 +#else
562 + (void)rHelpText;
563 + (void)rHelpArea;
564 + (void)nFlags;
565 + return 0;
566 +#endif
567 +}
568 +
569 +bool GtkSalFrame::UpdatePopover(sal_uIntPtr nId, const OUString& rHelpText, const Rectangle& rHelpArea)
570 +{
571 +#if GTK_CHECK_VERSION(3,12,0)
572 + GtkWidget *pWidget = reinterpret_cast<GtkWidget*>(nId);
573 +
574 + set_pointing_to(GTK_POPOVER(pWidget), rHelpArea);
575 +
576 + GtkWidget *pLabel = gtk_bin_get_child(GTK_BIN(pWidget));
577 + OString sUTF = OUStringToOString(rHelpText, RTL_TEXTENCODING_UTF8);
578 + gtk_label_set_text(GTK_LABEL(pLabel), sUTF.getStr());
579 +
580 + return true;
581 +#else
582 + (void)nId;
583 + (void)rHelpText;
584 + (void)rHelpArea;
585 + return false
586 +#endif
587 +}
588 +
589 +bool GtkSalFrame::HidePopover(sal_uIntPtr nId)
590 +{
591 +#if GTK_CHECK_VERSION(3,12,0)
592 + GtkWidget *pWidget = reinterpret_cast<GtkWidget*>(nId);
593 + gtk_widget_destroy(pWidget);
594 + return true;
595 +#else
596 + (void)nId;
597 + return false;
598 +#endif
599 +}
600 +
601 gboolean GtkSalFrame::signalButton( GtkWidget*, GdkEventButton* pEvent, gpointer frame )
602 {
603 UpdateLastInputEventTime(pEvent->time);
604 --
605 2.7.4
606

  ViewVC Help
Powered by ViewVC 1.1.30