LibreOffice Module vcl (master)  1
event.cxx
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 #include <vcl/event.hxx>
21 #include <vcl/window.hxx>
22 #include <vcl/dockwin.hxx>
23 #include <vcl/layout.hxx>
25 #include <sal/log.hxx>
26 
27 #include <window.h>
28 #include <svdata.hxx>
29 #include <salframe.hxx>
30 #include <config_features.h>
32 
33 namespace vcl {
34 
36 {
37 }
38 
40 {
41  CompatDataChanged( rDCEvt );
42 
43  vcl::Window* pChild = mpWindowImpl->mpFirstChild;
44  while ( pChild )
45  {
46  pChild->NotifyAllChildren( rDCEvt );
47  pChild = pChild->mpWindowImpl->mpNext;
48  }
49 }
50 
52 {
53  bool bDone = false;
54  if ( mpWindowImpl->mpParent && !ImplIsOverlapWindow() )
55  bDone = mpWindowImpl->mpParent->CompatPreNotify( rNEvt );
56 
57  if ( !bDone )
58  {
59  if( rNEvt.GetType() == MouseNotifyEvent::GETFOCUS )
60  {
61  bool bCompoundFocusChanged = false;
62  if ( mpWindowImpl->mbCompoundControl && !mpWindowImpl->mbCompoundControlHasFocus && HasChildPathFocus() )
63  {
64  mpWindowImpl->mbCompoundControlHasFocus = true;
65  bCompoundFocusChanged = true;
66  }
67 
68  if ( bCompoundFocusChanged || ( rNEvt.GetWindow() == this ) )
70  }
71  else if( rNEvt.GetType() == MouseNotifyEvent::LOSEFOCUS )
72  {
73  bool bCompoundFocusChanged = false;
74  if ( mpWindowImpl->mbCompoundControl && mpWindowImpl->mbCompoundControlHasFocus && !HasChildPathFocus() )
75  {
76  mpWindowImpl->mbCompoundControlHasFocus = false ;
77  bCompoundFocusChanged = true;
78  }
79 
80  if ( bCompoundFocusChanged || ( rNEvt.GetWindow() == this ) )
82  }
83 
84  // #82968# mouse and key events will be notified after processing ( in ImplNotifyKeyMouseCommandEventListeners() )!
85  // see also ImplHandleMouseEvent(), ImplHandleKey()
86 
87  }
88 
89  return bDone;
90 }
91 
92 namespace
93 {
94  bool parentNotDialogControl(Window* pWindow)
95  {
96  vcl::Window* pParent = getNonLayoutParent(pWindow);
97  if (!pParent)
98  return true;
99  return ((pParent->GetStyle() & (WB_DIALOGCONTROL | WB_NODIALOGCONTROL)) != WB_DIALOGCONTROL);
100  }
101 }
102 
104 {
105  bool bRet = false;
106 
107  if (IsDisposed())
108  return false;
109 
110  // check for docking window
111  // but do nothing if window is docked and locked
113  if (pWrapper && ( pWrapper->IsFloatingMode() || !pWrapper->IsLocked() ))
114  {
115  const bool bDockingSupportCrippled = !StyleSettings::GetDockingFloatsSupported();
116 
118  {
119  const MouseEvent* pMEvt = rNEvt.GetMouseEvent();
120  bool bHit = pWrapper->GetDragArea().IsInside( pMEvt->GetPosPixel() );
121  if ( pMEvt->IsLeft() )
122  {
123  if (!bDockingSupportCrippled && pMEvt->IsMod1() && (pMEvt->GetClicks() == 2))
124  {
125  // ctrl double click toggles floating mode
126  pWrapper->SetFloatingMode( !pWrapper->IsFloatingMode() );
127  return true;
128  }
129  else if ( pMEvt->GetClicks() == 1 && bHit)
130  {
131  // allow start docking during mouse move
132  pWrapper->ImplEnableStartDocking();
133  return true;
134  }
135  }
136  }
137  else if ( rNEvt.GetType() == MouseNotifyEvent::MOUSEMOVE )
138  {
139  const MouseEvent* pMEvt = rNEvt.GetMouseEvent();
140  bool bHit = pWrapper->GetDragArea().IsInside( pMEvt->GetPosPixel() );
141  if ( pMEvt->IsLeft() )
142  {
143  // check if a single click initiated this sequence ( ImplStartDockingEnabled() )
144  // check if window is docked and
145  if( pWrapper->ImplStartDockingEnabled() && !pWrapper->IsFloatingMode() &&
146  !pWrapper->IsDocking() && bHit )
147  {
148  Point aPos = pMEvt->GetPosPixel();
149  vcl::Window* pWindow = rNEvt.GetWindow();
150  if ( pWindow != this )
151  {
152  aPos = pWindow->OutputToScreenPixel( aPos );
153  aPos = ScreenToOutputPixel( aPos );
154  }
155  pWrapper->ImplStartDocking( aPos );
156  }
157  return true;
158  }
159  }
160  else if( rNEvt.GetType() == MouseNotifyEvent::KEYINPUT )
161  {
162  const vcl::KeyCode& rKey = rNEvt.GetKeyEvent()->GetKeyCode();
163  if (rKey.GetCode() == KEY_F10 && rKey.GetModifier() &&
164  rKey.IsShift() && rKey.IsMod1() && !bDockingSupportCrippled)
165  {
166  pWrapper->SetFloatingMode( !pWrapper->IsFloatingMode() );
167  /* At this point the floating toolbar frame does not have the
168  * input focus since these frames don't get the focus per default
169  * To enable keyboard handling of this toolbar set the input focus
170  * to the frame. This needs to be done with ToTop since GrabFocus
171  * would not notice any change since "this" already has the focus.
172  */
173  if( pWrapper->IsFloatingMode() )
175  return true;
176  }
177  }
178  }
179 
180  // manage the dialogs
182  {
183  // if the parent also has dialog control activated, the parent takes over control
184  if ( (rNEvt.GetType() == MouseNotifyEvent::KEYINPUT) || (rNEvt.GetType() == MouseNotifyEvent::KEYUP) )
185  {
186  // ScGridWindow has WB_DIALOGCONTROL set, so pressing tab in ScCheckListMenuControl won't
187  // get processed here by the toplevel DockingWindow of ScCheckListMenuControl by
188  // just checking if parentNotDialogControl is true
189  bool bTopLevelFloatingWindow = (pWrapper && pWrapper->IsFloatingMode());
190  if (ImplIsOverlapWindow() || parentNotDialogControl(this) || bTopLevelFloatingWindow)
191  {
192  bRet = ImplDlgCtrl( *rNEvt.GetKeyEvent(), rNEvt.GetType() == MouseNotifyEvent::KEYINPUT );
193  }
194  }
195  else if ( (rNEvt.GetType() == MouseNotifyEvent::GETFOCUS) || (rNEvt.GetType() == MouseNotifyEvent::LOSEFOCUS) )
196  {
198  if ( (rNEvt.GetWindow() == this) && (rNEvt.GetType() == MouseNotifyEvent::GETFOCUS) &&
199  !(GetStyle() & WB_TABSTOP) && !(mpWindowImpl->mnDlgCtrlFlags & DialogControlFlags::WantFocus) )
200  {
202  if ( pFirstChild )
203  pFirstChild->ImplControlFocus();
204  }
205  }
206  }
207 
208  if ( !bRet )
209  {
210  if ( mpWindowImpl->mpParent && !ImplIsOverlapWindow() )
211  bRet = mpWindowImpl->mpParent->CompatNotify( rNEvt );
212  }
213 
214  return bRet;
215 }
216 
217 void Window::CallEventListeners( VclEventId nEvent, void* pData )
218 {
219  VclWindowEvent aEvent( this, nEvent, pData );
220 
221  VclPtr<vcl::Window> xWindow = this;
222 
224 
225  if ( xWindow->IsDisposed() )
226  return;
227 
228  // If maEventListeners is empty, the XVCLWindow has not yet been initialized.
229  // Calling GetComponentInterface will do that.
230  if (mpWindowImpl->maEventListeners.empty() && pData)
231  xWindow->GetComponentInterface();
232 
233  if (!mpWindowImpl->maEventListeners.empty())
234  {
235  // Copy the list, because this can be destroyed when calling a Link...
236  std::vector<Link<VclWindowEvent&,void>> aCopy( mpWindowImpl->maEventListeners );
237  // we use an iterating counter/flag and a set of deleted Link's to avoid O(n^2) behaviour
238  mpWindowImpl->mnEventListenersIteratingCount++;
239  auto& rWindowImpl = *mpWindowImpl;
240  comphelper::ScopeGuard aGuard(
241  [&rWindowImpl, &xWindow]()
242  {
243  if (!xWindow->IsDisposed())
244  {
245  rWindowImpl.mnEventListenersIteratingCount--;
246  if (rWindowImpl.mnEventListenersIteratingCount == 0)
247  rWindowImpl.maEventListenersDeleted.clear();
248  }
249  }
250  );
251  for ( const Link<VclWindowEvent&,void>& rLink : aCopy )
252  {
253  if (xWindow->IsDisposed()) break;
254  // check this hasn't been removed in some re-enterancy scenario fdo#47368
255  if( rWindowImpl.maEventListenersDeleted.find(rLink) == rWindowImpl.maEventListenersDeleted.end() )
256  rLink.Call( aEvent );
257  }
258  }
259 
260  while ( xWindow )
261  {
262 
263  if ( xWindow->IsDisposed() )
264  return;
265 
266  auto& rWindowImpl = *xWindow->mpWindowImpl;
267  if (!rWindowImpl.maChildEventListeners.empty())
268  {
269  // Copy the list, because this can be destroyed when calling a Link...
270  std::vector<Link<VclWindowEvent&,void>> aCopy( rWindowImpl.maChildEventListeners );
271  // we use an iterating counter/flag and a set of deleted Link's to avoid O(n^2) behaviour
272  rWindowImpl.mnChildEventListenersIteratingCount++;
273  comphelper::ScopeGuard aGuard(
274  [&rWindowImpl, &xWindow]()
275  {
276  if (!xWindow->IsDisposed())
277  {
278  rWindowImpl.mnChildEventListenersIteratingCount--;
279  if (rWindowImpl.mnChildEventListenersIteratingCount == 0)
280  rWindowImpl.maChildEventListenersDeleted.clear();
281  }
282  }
283  );
284  for ( const Link<VclWindowEvent&,void>& rLink : aCopy )
285  {
286  if (xWindow->IsDisposed())
287  return;
288  // Check this hasn't been removed in some re-enterancy scenario fdo#47368.
289  if( rWindowImpl.maChildEventListenersDeleted.find(rLink) == rWindowImpl.maChildEventListenersDeleted.end() )
290  rLink.Call( aEvent );
291  }
292  }
293 
294  if ( xWindow->IsDisposed() )
295  return;
296 
297  xWindow = xWindow->GetParent();
298  }
299 }
300 
302 {
303  mpWindowImpl->maEventListeners.push_back( rEventListener );
304 }
305 
307 {
308  if (mpWindowImpl)
309  {
310  auto& rListeners = mpWindowImpl->maEventListeners;
311  rListeners.erase( std::remove(rListeners.begin(), rListeners.end(), rEventListener ), rListeners.end() );
312  if (mpWindowImpl->mnEventListenersIteratingCount)
313  mpWindowImpl->maEventListenersDeleted.insert(rEventListener);
314  }
315 }
316 
318 {
319  mpWindowImpl->maChildEventListeners.push_back( rEventListener );
320 }
321 
323 {
324  if (mpWindowImpl)
325  {
326  auto& rListeners = mpWindowImpl->maChildEventListeners;
327  rListeners.erase( std::remove(rListeners.begin(), rListeners.end(), rEventListener ), rListeners.end() );
328  if (mpWindowImpl->mnChildEventListenersIteratingCount)
329  mpWindowImpl->maChildEventListenersDeleted.insert(rEventListener);
330  }
331 }
332 
333 ImplSVEvent * Window::PostUserEvent( const Link<void*,void>& rLink, void* pCaller, bool bReferenceLink )
334 {
335  std::unique_ptr<ImplSVEvent> pSVEvent(new ImplSVEvent);
336  pSVEvent->mpData = pCaller;
337  pSVEvent->maLink = rLink;
338  pSVEvent->mpWindow = this;
339  pSVEvent->mbCall = true;
340  if (bReferenceLink)
341  {
342  // Double check that this is indeed a vcl::Window instance.
343  assert(dynamic_cast<vcl::Window *>(
344  static_cast<OutputDevice *>(rLink.GetInstance())) ==
345  static_cast<vcl::Window *>(rLink.GetInstance()));
346  pSVEvent->mpInstanceRef = static_cast<vcl::Window *>(rLink.GetInstance());
347  }
348 
349  auto pTmpEvent = pSVEvent.get();
350  if (!mpWindowImpl->mpFrame->PostEvent( std::move(pSVEvent) ))
351  return nullptr;
352  return pTmpEvent;
353 }
354 
356 {
357  SAL_WARN_IF( nUserEvent->mpWindow.get() != this, "vcl",
358  "Window::RemoveUserEvent(): Event doesn't send to this window or is already removed" );
359  SAL_WARN_IF( !nUserEvent->mbCall, "vcl",
360  "Window::RemoveUserEvent(): Event is already removed" );
361 
362  if ( nUserEvent->mpWindow )
363  {
364  nUserEvent->mpWindow = nullptr;
365  }
366 
367  nUserEvent->mbCall = false;
368 }
369 
370 
371 static MouseEvent ImplTranslateMouseEvent( const MouseEvent& rE, vcl::Window const * pSource, vcl::Window const * pDest )
372 {
373  // the mouse event occurred in a different window, we need to translate the coordinates of
374  // the mouse cursor within that (source) window to the coordinates the mouse cursor would
375  // be in the destination window
376  Point aPos = pSource->OutputToScreenPixel( rE.GetPosPixel() );
377  return MouseEvent( pDest->ScreenToOutputPixel( aPos ), rE.GetClicks(), rE.GetMode(), rE.GetButtons(), rE.GetModifier() );
378 }
379 
381 {
382  if( rNEvt.GetType() == MouseNotifyEvent::COMMAND )
383  {
384  const CommandEvent* pCEvt = rNEvt.GetCommandEvent();
385  if ( pCEvt->GetCommand() != CommandEventId::ContextMenu )
386  // non context menu events are not to be notified up the chain
387  // so we return immediately
388  return;
389 
390  if ( mpWindowImpl->mbCompoundControl || ( rNEvt.GetWindow() == this ) )
391  {
392  // not interested: The event listeners are already called in ::Command,
393  // and calling them here a second time doesn't make sense
394  if ( rNEvt.GetWindow() != this )
395  {
396  CommandEvent aCommandEvent;
397 
398  if ( !pCEvt->IsMouseEvent() )
399  {
400  aCommandEvent = *pCEvt;
401  }
402  else
403  {
404  // the mouse event occurred in a different window, we need to translate the coordinates of
405  // the mouse cursor within that window to the coordinates the mouse cursor would be in the
406  // current window
407  vcl::Window* pSource = rNEvt.GetWindow();
408  Point aPos = pSource->OutputToScreenPixel( pCEvt->GetMousePosPixel() );
409  aCommandEvent = CommandEvent( ScreenToOutputPixel( aPos ), pCEvt->GetCommand(), pCEvt->IsMouseEvent(), pCEvt->GetEventData() );
410  }
411 
413  }
414  }
415  }
416 
417  // #82968# notify event listeners for mouse and key events separately and
418  // not in PreNotify ( as for focus listeners )
419  // this allows for processing those events internally first and pass it to
420  // the toolkit later
421 
422  VclPtr<vcl::Window> xWindow = this;
423 
424  if( rNEvt.GetType() == MouseNotifyEvent::MOUSEMOVE )
425  {
426  if ( mpWindowImpl->mbCompoundControl || ( rNEvt.GetWindow() == this ) )
427  {
428  if ( rNEvt.GetWindow() == this )
429  CallEventListeners( VclEventId::WindowMouseMove, const_cast<MouseEvent *>(rNEvt.GetMouseEvent()) );
430  else
431  {
432  MouseEvent aMouseEvent = ImplTranslateMouseEvent( *rNEvt.GetMouseEvent(), rNEvt.GetWindow(), this );
434  }
435  }
436  }
437  else if( rNEvt.GetType() == MouseNotifyEvent::MOUSEBUTTONUP )
438  {
439  if ( mpWindowImpl->mbCompoundControl || ( rNEvt.GetWindow() == this ) )
440  {
441  if ( rNEvt.GetWindow() == this )
442  CallEventListeners( VclEventId::WindowMouseButtonUp, const_cast<MouseEvent *>(rNEvt.GetMouseEvent()) );
443  else
444  {
445  MouseEvent aMouseEvent = ImplTranslateMouseEvent( *rNEvt.GetMouseEvent(), rNEvt.GetWindow(), this );
447  }
448  }
449  }
450  else if( rNEvt.GetType() == MouseNotifyEvent::MOUSEBUTTONDOWN )
451  {
452  if ( mpWindowImpl->mbCompoundControl || ( rNEvt.GetWindow() == this ) )
453  {
454  if ( rNEvt.GetWindow() == this )
455  CallEventListeners( VclEventId::WindowMouseButtonDown, const_cast<MouseEvent *>(rNEvt.GetMouseEvent()) );
456  else
457  {
458  MouseEvent aMouseEvent = ImplTranslateMouseEvent( *rNEvt.GetMouseEvent(), rNEvt.GetWindow(), this );
460  }
461  }
462  }
463  else if( rNEvt.GetType() == MouseNotifyEvent::KEYINPUT )
464  {
465  if ( mpWindowImpl->mbCompoundControl || ( rNEvt.GetWindow() == this ) )
466  CallEventListeners( VclEventId::WindowKeyInput, const_cast<KeyEvent *>(rNEvt.GetKeyEvent()) );
467  }
468  else if( rNEvt.GetType() == MouseNotifyEvent::KEYUP )
469  {
470  if ( mpWindowImpl->mbCompoundControl || ( rNEvt.GetWindow() == this ) )
471  CallEventListeners( VclEventId::WindowKeyUp, const_cast<KeyEvent *>(rNEvt.GetKeyEvent()) );
472  }
473 
474  if ( xWindow->IsDisposed() )
475  return;
476 
477  // #106721# check if we're part of a compound control and notify
478  vcl::Window *pParent = ImplGetParent();
479  while( pParent )
480  {
481  if( pParent->IsCompoundControl() )
482  {
483  pParent->ImplNotifyKeyMouseCommandEventListeners( rNEvt );
484  break;
485  }
486  pParent = pParent->ImplGetParent();
487  }
488 }
489 
491 {
492  mpWindowImpl->mbReallyShown = true;
493  mpWindowImpl->mbInInitShow = true;
495  mpWindowImpl->mbInInitShow = false;
496 
497  vcl::Window* pWindow = mpWindowImpl->mpFirstOverlap;
498  while ( pWindow )
499  {
500  if ( pWindow->mpWindowImpl->mbVisible )
501  pWindow->ImplCallInitShow();
502  pWindow = pWindow->mpWindowImpl->mpNext;
503  }
504 
505  pWindow = mpWindowImpl->mpFirstChild;
506  while ( pWindow )
507  {
508  if ( pWindow->mpWindowImpl->mbVisible )
509  pWindow->ImplCallInitShow();
510  pWindow = pWindow->mpWindowImpl->mpNext;
511  }
512 }
513 
514 
516 {
517  mpWindowImpl->mbCallResize = false;
518 
519  // OpenGL has a charming feature of black clearing the whole window
520  // some legacy code eg. the app-menu has the beautiful feature of
521  // avoiding re-paints when width doesn't change => invalidate all.
522 #if HAVE_FEATURE_OPENGL
524  Invalidate();
525 
526  // Normally we avoid blanking on re-size unless people might notice:
527  else
528 #endif
529  if( GetBackground().IsGradient() )
530  Invalidate();
531 
532  Resize();
533 
534  // #88419# Most classes don't call the base class in Resize() and Move(),
535  // => Call ImpleResize/Move instead of Resize/Move directly...
537 }
538 
540 {
541  mpWindowImpl->mbCallMove = false;
542 
543  if( mpWindowImpl->mbFrame )
544  {
545  // update frame position
546  SalFrame *pParentFrame = nullptr;
547  vcl::Window *pParent = ImplGetParent();
548  while( pParent )
549  {
550  if( pParent->mpWindowImpl->mpFrame != mpWindowImpl->mpFrame )
551  {
552  pParentFrame = pParent->mpWindowImpl->mpFrame;
553  break;
554  }
555  pParent = pParent->GetParent();
556  }
557 
558  SalFrameGeometry g = mpWindowImpl->mpFrame->GetGeometry();
559  mpWindowImpl->maPos = Point( g.nX, g.nY );
560  if( pParentFrame )
561  {
562  g = pParentFrame->GetGeometry();
563  mpWindowImpl->maPos -= Point( g.nX, g.nY );
564  }
565  // the client window and all its subclients have the same position as the borderframe
566  // this is important for floating toolbars where the borderwindow is a floating window
567  // which has another borderwindow (ie the system floating window)
568  vcl::Window *pClientWin = mpWindowImpl->mpClientWindow;
569  while( pClientWin )
570  {
571  pClientWin->mpWindowImpl->maPos = mpWindowImpl->maPos;
572  pClientWin = pClientWin->mpWindowImpl->mpClientWindow;
573  }
574  }
575 
576  Move();
577 
579 }
580 
582  vcl::Window* pOldOverlapWindow )
583 {
584  ImplSVData* pSVData = ImplGetSVData();
585  vcl::Window* pNewRealWindow;
586  vcl::Window* pOldRealWindow;
587  bool bCallActivate = true;
588  bool bCallDeactivate = true;
589 
590  if (!pOldOverlapWindow)
591  {
592  return;
593  }
594 
595  pOldRealWindow = pOldOverlapWindow->ImplGetWindow();
596  if (!pNewOverlapWindow)
597  {
598  return;
599  }
600 
601  pNewRealWindow = pNewOverlapWindow->ImplGetWindow();
602  if ( (pOldRealWindow->GetType() != WindowType::FLOATINGWINDOW) ||
603  pOldRealWindow->GetActivateMode() != ActivateModeFlags::NONE )
604  {
605  if ( (pNewRealWindow->GetType() == WindowType::FLOATINGWINDOW) &&
606  pNewRealWindow->GetActivateMode() == ActivateModeFlags::NONE)
607  {
608  pSVData->mpWinData->mpLastDeacWin = pOldOverlapWindow;
609  bCallDeactivate = false;
610  }
611  }
612  else if ( (pNewRealWindow->GetType() != WindowType::FLOATINGWINDOW) ||
613  pNewRealWindow->GetActivateMode() != ActivateModeFlags::NONE )
614  {
615  if (pSVData->mpWinData->mpLastDeacWin)
616  {
617  if (pSVData->mpWinData->mpLastDeacWin.get() == pNewOverlapWindow)
618  bCallActivate = false;
619  else
620  {
621  vcl::Window* pLastRealWindow = pSVData->mpWinData->mpLastDeacWin->ImplGetWindow();
622  pSVData->mpWinData->mpLastDeacWin->mpWindowImpl->mbActive = false;
623  pSVData->mpWinData->mpLastDeacWin->Deactivate();
624  if (pLastRealWindow != pSVData->mpWinData->mpLastDeacWin.get())
625  {
626  pLastRealWindow->mpWindowImpl->mbActive = true;
627  pLastRealWindow->Activate();
628  }
629  }
630  pSVData->mpWinData->mpLastDeacWin = nullptr;
631  }
632  }
633 
634  if ( bCallDeactivate )
635  {
636  if( pOldOverlapWindow->mpWindowImpl->mbActive )
637  {
638  pOldOverlapWindow->mpWindowImpl->mbActive = false;
639  pOldOverlapWindow->Deactivate();
640  }
641  if ( pOldRealWindow != pOldOverlapWindow )
642  {
643  if( pOldRealWindow->mpWindowImpl->mbActive )
644  {
645  pOldRealWindow->mpWindowImpl->mbActive = false;
646  pOldRealWindow->Deactivate();
647  }
648  }
649  }
650  if ( !bCallActivate || pNewOverlapWindow->mpWindowImpl->mbActive )
651  return;
652 
653  pNewOverlapWindow->mpWindowImpl->mbActive = true;
654  pNewOverlapWindow->Activate();
655 
656  if ( pNewRealWindow != pNewOverlapWindow )
657  {
658  if( ! pNewRealWindow->mpWindowImpl->mbActive )
659  {
660  pNewRealWindow->mpWindowImpl->mbActive = true;
661  pNewRealWindow->Activate();
662  }
663  }
664 }
665 
666 } /* namespace vcl */
667 
668 
670  const void* pEvent )
671 {
672  mpWindow = pWindow;
673  mpData = const_cast<void*>(pEvent);
674  mnEventType = nEventType;
675 }
676 
677 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void Move()
Definition: window.cxx:1827
vcl::Window * ImplGetWindow() const
if this is a proxy return the client, otherwise itself
Definition: window2.cxx:835
const Wallpaper & GetBackground() const
Definition: outdev.hxx:643
ActivateModeFlags GetActivateMode() const
Definition: window2.cxx:1137
SAL_DLLPRIVATE void ImplCallResize()
Definition: event.cxx:515
SalFrameGeometry GetGeometry() const
const CommandEvent * GetCommandEvent() const
Definition: event.hxx:327
void NotifyAllChildren(DataChangedEvent &rDCEvt)
Definition: event.cxx:39
bool IsDocking() const
Definition: dockwin.hxx:153
WinBits const WB_NODIALOGCONTROL
MouseEventModifiers GetMode() const
Definition: event.hxx:121
SAL_DLLPRIVATE void ImplCallMove()
Definition: event.cxx:539
SAL_DLLPRIVATE void ImplCallInitShow()
Definition: event.cxx:490
void ImplStartDocking(const Point &rPos)
Definition: dockmgr.cxx:498
void CompatStateChanged(StateChangedType nStateChange)
Definition: window.cxx:3827
sal_uInt16 GetCode() const
Definition: keycod.hxx:51
virtual void Deactivate()
Definition: window.cxx:1833
void RemoveChildEventListener(const Link< VclWindowEvent &, void > &rEventListener)
Definition: event.cxx:322
const KeyEvent * GetKeyEvent() const
Definition: event.hxx:311
bool HasChildPathFocus(bool bSystemWindow=false) const
Definition: window.cxx:2988
bool IsFloatingMode() const
Definition: dockmgr.cxx:1039
MouseNotifyEvent mnEventType
Definition: event.hxx:296
void * mpData
Definition: event.hxx:295
SAL_DLLPRIVATE bool ImplIsOverlapWindow() const
Definition: window2.cxx:926
sal_uInt16 GetClicks() const
Definition: event.hxx:123
vcl::Window * GetWindow() const
Definition: event.hxx:304
virtual css::uno::Reference< css::awt::XWindowPeer > GetComponentInterface(bool bCreate=true)
Definition: window.cxx:3120
sal_uInt16 GetButtons() const
Definition: event.hxx:144
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
bool IsMouseEvent() const
VclEventId
Definition: vclevent.hxx:37
sal_uInt16 GetModifier() const
Definition: keycod.hxx:54
static bool isVCLOpenGLEnabled()
Returns true if VCL has OpenGL rendering enabled.
void * GetEventData() const
SAL_DLLPRIVATE void ImplControlFocus(GetFocusFlags nFlags=GetFocusFlags::NONE)
Definition: dlgctrl.cxx:516
SAL_DLLPRIVATE vcl::Window * ImplGetDlgWindow(sal_uInt16 n, GetDlgWindowType nType, sal_uInt16 nStart=0, sal_uInt16 nEnd=0xFFFF, sal_uInt16 *pIndex=nullptr)
Definition: dlgctrl.cxx:205
static void ImplCallEventListeners(VclSimpleEvent &rEvent)
Send event to all VCL application event listeners.
Definition: svapp.cxx:760
WinBits const WB_DIALOGCONTROL
ImplSVData * ImplGetSVData()
Definition: svdata.cxx:76
SAL_DLLPRIVATE void ImplDlgCtrlFocusChanged(vcl::Window *pWindow, bool bGetFocus)
Definition: dlgctrl.cxx:1089
SAL_DLLPRIVATE bool ImplDlgCtrl(const KeyEvent &rKEvt, bool bKeyInput)
Definition: dlgctrl.cxx:619
bool mbCall
Definition: svdata.hxx:457
virtual bool PreNotify(NotifyEvent &rNEvt)
Definition: event.cxx:51
virtual bool EventNotify(NotifyEvent &rNEvt)
Definition: event.cxx:103
void ToTop(ToTopFlags nFlags=ToTopFlags::NONE)
Definition: stacking.cxx:420
ImplDockingWindowWrapper.
Definition: dockwin.hxx:70
tools::Long nY
Definition: salgeom.hxx:30
virtual void Invalidate(InvalidateFlags nFlags=InvalidateFlags::NONE)
Definition: paint.cxx:1162
SAL_DLLPRIVATE void ImplNotifyKeyMouseCommandEventListeners(NotifyEvent &rNEvt)
Definition: event.cxx:380
CommandEventId GetCommand() const
std::unique_ptr< WindowImpl > mpWindowImpl
Definition: window.hxx:519
virtual void Resize()
Definition: window.cxx:1829
SAL_DLLPRIVATE vcl::Window * ImplGetParent() const
Definition: window2.cxx:865
MouseNotifyEvent GetType() const
Definition: event.hxx:303
bool IsInside(const Point &rPOINT) const
VclPtr< vcl::Window > mpLastDeacWin
Definition: svdata.hxx:249
sal_uInt16 GetModifier() const
Definition: event.hxx:153
static SAL_DLLPRIVATE void ImplCallFocusChangeActivate(vcl::Window *pNewOverlapWindow, vcl::Window *pOldOverlapWindow)
Definition: event.cxx:581
Point ScreenToOutputPixel(const Point &rPos) const
Definition: window.cxx:2810
constexpr sal_uInt16 KEY_F10
Definition: keycodes.hxx:92
vcl::Window * GetParent() const
Definition: window2.cxx:1097
bool IsCompoundControl() const
Definition: window2.cxx:1193
tools::Long nX
Definition: salgeom.hxx:30
void SetFloatingMode(bool bFloatMode)
Definition: dockmgr.cxx:877
const Point & GetMousePosPixel() const
void AddEventListener(const Link< VclWindowEvent &, void > &rEventListener)
Definition: event.cxx:301
void RemoveUserEvent(ImplSVEvent *nUserEvent)
Definition: event.cxx:355
A SalFrame is a system window (e.g. an X11 window).
Definition: salframe.hxx:112
const vcl::KeyCode & GetKeyCode() const
Definition: event.hxx:54
VclPtr< vcl::Window > mpWindow
Definition: event.hxx:294
bool IsShift() const
Definition: keycod.hxx:56
DockingManager * ImplGetDockingManager()
Definition: svdata.cxx:308
static bool GetDockingFloatsSupported()
#define SAL_WARN_IF(condition, area, stream)
const MouseEvent * GetMouseEvent() const
Definition: event.hxx:319
bool ImplStartDockingEnabled() const
Definition: dockwin.hxx:113
ImplSVEvent * PostUserEvent(const Link< void *, void > &rLink, void *pCaller=nullptr, bool bReferenceLink=false)
Definition: event.cxx:333
ImplDockingWindowWrapper * GetDockingWindowWrapper(const vcl::Window *pWin)
Definition: dockmgr.cxx:278
bool IsLeft() const
Definition: event.hxx:146
bool IsMod1() const
Definition: keycod.hxx:58
bool IsLocked() const
Definition: dockwin.hxx:135
const Point & GetPosPixel() const
Definition: event.hxx:120
virtual void Activate()
Definition: window.cxx:1831
VclPtr< vcl::Window > mpWindow
Definition: svdata.hxx:456
bool IsDisposed() const
Definition: window.cxx:140
WinBits const WB_TABSTOP
NotifyEvent(MouseNotifyEvent nEventType, vcl::Window *pWindow, const void *pEvent=nullptr)
Definition: event.cxx:669
static MouseEvent ImplTranslateMouseEvent(const MouseEvent &rE, vcl::Window const *pSource, vcl::Window const *pDest)
Definition: event.cxx:371
vcl::Window * getNonLayoutParent(vcl::Window *pWindow)
Definition: layout.cxx:2804
WindowType GetType() const
Definition: window2.cxx:974
const tools::Rectangle & GetDragArea() const
Definition: dockwin.hxx:131
reference_type * get() const
Get the body.
Definition: vclptr.hxx:143
void RemoveEventListener(const Link< VclWindowEvent &, void > &rEventListener)
Definition: event.cxx:306
WinBits GetStyle() const
Definition: window2.cxx:953
void CompatDataChanged(const DataChangedEvent &rDCEvt)
Definition: window.cxx:3832
Point OutputToScreenPixel(const Point &rPos) const
Definition: window.cxx:2804
void CallEventListeners(VclEventId nEvent, void *pData=nullptr)
Definition: event.cxx:217
MouseNotifyEvent
Definition: event.hxx:277
AnyEventRef aEvent
void AddChildEventListener(const Link< VclWindowEvent &, void > &rEventListener)
Definition: event.cxx:317
virtual void DataChanged(const DataChangedEvent &rDCEvt)
Definition: event.cxx:35
ImplSVWinData * mpWinData
Definition: svdata.hxx:395
bool IsMod1() const
Definition: event.hxx:157