summaryrefslogtreecommitdiff
path: root/vcl/unx
diff options
context:
space:
mode:
Diffstat (limited to 'vcl/unx')
-rw-r--r--vcl/unx/generic/app/i18n_ic.cxx86
-rw-r--r--vcl/unx/generic/app/i18n_im.cxx44
-rw-r--r--vcl/unx/generic/app/randrwrapper.cxx68
-rw-r--r--vcl/unx/generic/app/saldata.cxx58
-rw-r--r--vcl/unx/generic/app/saldisp.cxx154
-rw-r--r--vcl/unx/generic/app/sm.cxx50
-rw-r--r--vcl/unx/generic/app/wmadaptor.cxx712
-rw-r--r--vcl/unx/generic/dtrans/X11_droptarget.cxx42
-rw-r--r--vcl/unx/generic/dtrans/X11_selection.cxx296
-rw-r--r--vcl/unx/generic/dtrans/bmp.cxx28
-rw-r--r--vcl/unx/generic/fontmanager/fontconfig.cxx24
-rw-r--r--vcl/unx/generic/fontmanager/helper.cxx24
-rw-r--r--vcl/unx/generic/gdi/gdiimpl.cxx135
-rw-r--r--vcl/unx/generic/gdi/salbmp.cxx31
-rw-r--r--vcl/unx/generic/gdi/salgdi.cxx24
-rw-r--r--vcl/unx/generic/glyphs/freetype_glyphcache.cxx30
-rw-r--r--vcl/unx/generic/print/common_gfx.cxx116
-rw-r--r--vcl/unx/generic/print/genprnpsp.cxx56
-rw-r--r--vcl/unx/generic/print/prtsetup.cxx68
-rw-r--r--vcl/unx/generic/printer/cupsmgr.cxx22
-rw-r--r--vcl/unx/generic/printer/jobdata.cxx30
-rw-r--r--vcl/unx/generic/printer/ppdparser.cxx159
-rw-r--r--vcl/unx/generic/window/salframe.cxx320
-rw-r--r--vcl/unx/generic/window/screensaverinhibitor.cxx24
-rw-r--r--vcl/unx/gtk3/a11y/gtk3atklistener.cxx100
-rw-r--r--vcl/unx/gtk3/a11y/gtk3atkutil.cxx44
-rw-r--r--vcl/unx/gtk3/gtk3gloactiongroup.cxx36
-rw-r--r--vcl/unx/gtk3/gtk3gtkframe.cxx434
-rw-r--r--vcl/unx/gtk3/gtk3gtkinst.cxx222
-rw-r--r--vcl/unx/gtk3/gtk3gtkobject.cxx58
-rw-r--r--vcl/unx/gtk3/gtk3gtksalmenu.cxx38
-rw-r--r--vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx42
-rw-r--r--vcl/unx/gtk3/gtk3salprn-gtk.cxx68
33 files changed, 1824 insertions, 1819 deletions
diff --git a/vcl/unx/generic/app/i18n_ic.cxx b/vcl/unx/generic/app/i18n_ic.cxx
index 6f94fe938818..8f1a814233ea 100644
--- a/vcl/unx/generic/app/i18n_ic.cxx
+++ b/vcl/unx/generic/app/i18n_ic.cxx
@@ -363,23 +363,23 @@ SalI18N_InputContext::Unmap()
void
SalI18N_InputContext::Map( SalFrame *pFrame )
{
- if( mbUseable )
+ if( !mbUseable )
+ return;
+
+ if( !pFrame )
+ return;
+
+ if ( maContext == nullptr )
{
- if( pFrame )
- {
- if ( maContext == nullptr )
- {
- SalI18N_InputMethod *pInputMethod;
- pInputMethod = vcl_sal::getSalDisplay(GetGenericUnixSalData())->GetInputMethod();
+ SalI18N_InputMethod *pInputMethod;
+ pInputMethod = vcl_sal::getSalDisplay(GetGenericUnixSalData())->GetInputMethod();
- maContext = XCreateIC( pInputMethod->GetMethod(),
- XNVaNestedList, mpAttributes,
- nullptr );
- }
- if( maClientData.pFrame != pFrame )
- SetICFocus( pFrame );
- }
+ maContext = XCreateIC( pInputMethod->GetMethod(),
+ XNVaNestedList, mpAttributes,
+ nullptr );
}
+ if( maClientData.pFrame != pFrame )
+ SetICFocus( pFrame );
}
// Handle DestroyCallbacks
@@ -541,28 +541,28 @@ SalI18N_InputContext::UpdateSpotLocation()
void
SalI18N_InputContext::SetICFocus( SalFrame* pFocusFrame )
{
- if ( mbUseable && (maContext != nullptr) )
- {
- maClientData.pFrame = pFocusFrame;
+ if ( !(mbUseable && (maContext != nullptr)) )
+ return;
- const SystemEnvData* pEnv = pFocusFrame->GetSystemData();
- ::Window aClientWindow = pEnv->aShellWindow;
- ::Window aFocusWindow = pEnv->aWindow;
+ maClientData.pFrame = pFocusFrame;
- XSetICValues( maContext,
- XNFocusWindow, aFocusWindow,
- XNClientWindow, aClientWindow,
- nullptr );
+ const SystemEnvData* pEnv = pFocusFrame->GetSystemData();
+ ::Window aClientWindow = pEnv->aShellWindow;
+ ::Window aFocusWindow = pEnv->aWindow;
- if( maClientData.aInputEv.mpTextAttr )
- {
- sendEmptyCommit(pFocusFrame);
- // begin preedit again
- vcl_sal::getSalDisplay(GetGenericUnixSalData())->SendInternalEvent( pFocusFrame, &maClientData.aInputEv, SalEvent::ExtTextInput );
- }
+ XSetICValues( maContext,
+ XNFocusWindow, aFocusWindow,
+ XNClientWindow, aClientWindow,
+ nullptr );
- XSetICFocus( maContext );
+ if( maClientData.aInputEv.mpTextAttr )
+ {
+ sendEmptyCommit(pFocusFrame);
+ // begin preedit again
+ vcl_sal::getSalDisplay(GetGenericUnixSalData())->SendInternalEvent( pFocusFrame, &maClientData.aInputEv, SalEvent::ExtTextInput );
}
+
+ XSetICFocus( maContext );
}
void
@@ -583,20 +583,20 @@ SalI18N_InputContext::UnsetICFocus()
void
SalI18N_InputContext::EndExtTextInput()
{
- if ( mbUseable && (maContext != nullptr) && maClientData.pFrame )
+ if ( !mbUseable || (maContext == nullptr) || !maClientData.pFrame )
+ return;
+
+ vcl::DeletionListener aDel( maClientData.pFrame );
+ // delete preedit in sal (commit an empty string)
+ sendEmptyCommit( maClientData.pFrame );
+ if( ! aDel.isDeleted() )
{
- vcl::DeletionListener aDel( maClientData.pFrame );
- // delete preedit in sal (commit an empty string)
- sendEmptyCommit( maClientData.pFrame );
- if( ! aDel.isDeleted() )
+ // mark previous preedit state again (will e.g. be sent at focus gain)
+ maClientData.aInputEv.mpTextAttr = maClientData.aInputFlags.data();
+ if( static_cast<X11SalFrame*>(maClientData.pFrame)->hasFocus() )
{
- // mark previous preedit state again (will e.g. be sent at focus gain)
- maClientData.aInputEv.mpTextAttr = maClientData.aInputFlags.data();
- if( static_cast<X11SalFrame*>(maClientData.pFrame)->hasFocus() )
- {
- // begin preedit again
- vcl_sal::getSalDisplay(GetGenericUnixSalData())->SendInternalEvent( maClientData.pFrame, &maClientData.aInputEv, SalEvent::ExtTextInput );
- }
+ // begin preedit again
+ vcl_sal::getSalDisplay(GetGenericUnixSalData())->SendInternalEvent( maClientData.pFrame, &maClientData.aInputEv, SalEvent::ExtTextInput );
}
}
}
diff --git a/vcl/unx/generic/app/i18n_im.cxx b/vcl/unx/generic/app/i18n_im.cxx
index a9e9fb42fb87..6a655ca39ea1 100644
--- a/vcl/unx/generic/app/i18n_im.cxx
+++ b/vcl/unx/generic/app/i18n_im.cxx
@@ -192,35 +192,35 @@ SalI18N_InputMethod::SetLocale()
{
// check whether we want an Input Method engine, if we don't we
// do not need to set the locale
- if ( mbUseable )
+ if ( !mbUseable )
+ return;
+
+ char *locale = SetSystemLocale( "" );
+ if ( (!IsXWindowCompatibleLocale(locale)) || IsPosixLocale(locale) )
{
- char *locale = SetSystemLocale( "" );
- if ( (!IsXWindowCompatibleLocale(locale)) || IsPosixLocale(locale) )
- {
- osl_setThreadTextEncoding (RTL_TEXTENCODING_ISO_8859_1);
- locale = SetSystemLocale( "en_US" );
+ osl_setThreadTextEncoding (RTL_TEXTENCODING_ISO_8859_1);
+ locale = SetSystemLocale( "en_US" );
#ifdef __sun
- SetSystemEnvironment( "en_US" );
+ SetSystemEnvironment( "en_US" );
#endif
- if (! IsXWindowCompatibleLocale(locale))
- {
- locale = SetSystemLocale( "C" );
+ if (! IsXWindowCompatibleLocale(locale))
+ {
+ locale = SetSystemLocale( "C" );
#ifdef __sun
- SetSystemEnvironment( "C" );
+ SetSystemEnvironment( "C" );
#endif
- if (! IsXWindowCompatibleLocale(locale))
- mbUseable = False;
- }
+ if (! IsXWindowCompatibleLocale(locale))
+ mbUseable = False;
}
+ }
- // must not fail if mbUseable since XSupportsLocale() asserts success
- if ( mbUseable && XSetLocaleModifiers("") == nullptr )
- {
- SAL_WARN("vcl.app",
- "I18N: Can't set X modifiers for locale \""
- << locale << "\".");
- mbUseable = False;
- }
+ // must not fail if mbUseable since XSupportsLocale() asserts success
+ if ( mbUseable && XSetLocaleModifiers("") == nullptr )
+ {
+ SAL_WARN("vcl.app",
+ "I18N: Can't set X modifiers for locale \""
+ << locale << "\".");
+ mbUseable = False;
}
}
diff --git a/vcl/unx/generic/app/randrwrapper.cxx b/vcl/unx/generic/app/randrwrapper.cxx
index ad884435cb36..431c70ae37af 100644
--- a/vcl/unx/generic/app/randrwrapper.cxx
+++ b/vcl/unx/generic/app/randrwrapper.cxx
@@ -131,47 +131,47 @@ void SalDisplay::processRandREvent( XEvent* pEvent )
{
#ifdef USE_RANDR
XConfigureEvent* pCnfEvent=reinterpret_cast<XConfigureEvent*>(pEvent);
- if( pWrapper && pWrapper->XRRRootToScreen(GetDisplay(),pCnfEvent->window) != -1 )
+ if( !pWrapper || pWrapper->XRRRootToScreen(GetDisplay(),pCnfEvent->window) == -1 )
+ return;
+
+ int nRet = pWrapper->XRRUpdateConfiguration( pEvent );
+ if( nRet != 1 || pEvent->type == ConfigureNotify) // this should then be a XRRScreenChangeNotifyEvent
+ return;
+
+ // update screens
+ bool bNotify = false;
+ for(ScreenData & rScreen : m_aScreens)
{
- int nRet = pWrapper->XRRUpdateConfiguration( pEvent );
- if( nRet == 1 && pEvent->type != ConfigureNotify) // this should then be a XRRScreenChangeNotifyEvent
+ if( rScreen.m_bInit )
{
- // update screens
- bool bNotify = false;
- for(ScreenData & rScreen : m_aScreens)
- {
- if( rScreen.m_bInit )
- {
- XRRScreenConfiguration *pConfig = nullptr;
- XRRScreenSize *pSizes = nullptr;
- int nSizes = 0;
- Rotation nRot = 0;
- SizeID nId = 0;
-
- pConfig = pWrapper->XRRGetScreenInfo( GetDisplay(), rScreen.m_aRoot );
- nId = pWrapper->XRRConfigCurrentConfiguration( pConfig, &nRot );
- pSizes = pWrapper->XRRConfigSizes( pConfig, &nSizes );
- XRRScreenSize *pTargetSize = pSizes + nId;
-
- bNotify = bNotify ||
- rScreen.m_aSize.Width() != pTargetSize->width ||
- rScreen.m_aSize.Height() != pTargetSize->height;
-
- rScreen.m_aSize = Size( pTargetSize->width, pTargetSize->height );
-
- pWrapper->XRRFreeScreenConfigInfo( pConfig );
+ XRRScreenConfiguration *pConfig = nullptr;
+ XRRScreenSize *pSizes = nullptr;
+ int nSizes = 0;
+ Rotation nRot = 0;
+ SizeID nId = 0;
+
+ pConfig = pWrapper->XRRGetScreenInfo( GetDisplay(), rScreen.m_aRoot );
+ nId = pWrapper->XRRConfigCurrentConfiguration( pConfig, &nRot );
+ pSizes = pWrapper->XRRConfigSizes( pConfig, &nSizes );
+ XRRScreenSize *pTargetSize = pSizes + nId;
+
+ bNotify = bNotify ||
+ rScreen.m_aSize.Width() != pTargetSize->width ||
+ rScreen.m_aSize.Height() != pTargetSize->height;
+
+ rScreen.m_aSize = Size( pTargetSize->width, pTargetSize->height );
+
+ pWrapper->XRRFreeScreenConfigInfo( pConfig );
#if OSL_DEBUG_LEVEL > 1
- SAL_INFO("vcl.app", "screen " << nId
- << " changed to size " << (int)pTargetSize->width
- << "x" << (int)pTargetSize->height);
+ SAL_INFO("vcl.app", "screen " << nId
+ << " changed to size " << (int)pTargetSize->width
+ << "x" << (int)pTargetSize->height);
#endif
- }
- }
- if( bNotify )
- emitDisplayChanged();
}
}
+ if( bNotify )
+ emitDisplayChanged();
#else
(void)this;
(void)pEvent;
diff --git a/vcl/unx/generic/app/saldata.cxx b/vcl/unx/generic/app/saldata.cxx
index 1b58c7dab0f2..c5a97ee4d5cd 100644
--- a/vcl/unx/generic/app/saldata.cxx
+++ b/vcl/unx/generic/app/saldata.cxx
@@ -318,39 +318,39 @@ SalXLib::SalXLib()
m_pDisplay = nullptr;
m_pTimeoutFDS[0] = m_pTimeoutFDS[1] = -1;
- if (pipe (m_pTimeoutFDS) != -1)
- {
- // initialize 'wakeup' pipe.
- int flags;
+ if (pipe (m_pTimeoutFDS) == -1)
+ return;
- // set close-on-exec descriptor flag.
- if ((flags = fcntl (m_pTimeoutFDS[0], F_GETFD)) != -1)
- {
- flags |= FD_CLOEXEC;
- (void)fcntl(m_pTimeoutFDS[0], F_SETFD, flags);
- }
- if ((flags = fcntl (m_pTimeoutFDS[1], F_GETFD)) != -1)
- {
- flags |= FD_CLOEXEC;
- (void)fcntl(m_pTimeoutFDS[1], F_SETFD, flags);
- }
+ // initialize 'wakeup' pipe.
+ int flags;
- // set non-blocking I/O flag.
- if ((flags = fcntl (m_pTimeoutFDS[0], F_GETFL)) != -1)
- {
- flags |= O_NONBLOCK;
- (void)fcntl(m_pTimeoutFDS[0], F_SETFL, flags);
- }
- if ((flags = fcntl (m_pTimeoutFDS[1], F_GETFL)) != -1)
- {
- flags |= O_NONBLOCK;
- (void)fcntl(m_pTimeoutFDS[1], F_SETFL, flags);
- }
+ // set close-on-exec descriptor flag.
+ if ((flags = fcntl (m_pTimeoutFDS[0], F_GETFD)) != -1)
+ {
+ flags |= FD_CLOEXEC;
+ (void)fcntl(m_pTimeoutFDS[0], F_SETFD, flags);
+ }
+ if ((flags = fcntl (m_pTimeoutFDS[1], F_GETFD)) != -1)
+ {
+ flags |= FD_CLOEXEC;
+ (void)fcntl(m_pTimeoutFDS[1], F_SETFD, flags);
+ }
- // insert [0] into read descriptor set.
- FD_SET( m_pTimeoutFDS[0], &aReadFDS_ );
- nFDs_ = m_pTimeoutFDS[0] + 1;
+ // set non-blocking I/O flag.
+ if ((flags = fcntl (m_pTimeoutFDS[0], F_GETFL)) != -1)
+ {
+ flags |= O_NONBLOCK;
+ (void)fcntl(m_pTimeoutFDS[0], F_SETFL, flags);
+ }
+ if ((flags = fcntl (m_pTimeoutFDS[1], F_GETFL)) != -1)
+ {
+ flags |= O_NONBLOCK;
+ (void)fcntl(m_pTimeoutFDS[1], F_SETFL, flags);
}
+
+ // insert [0] into read descriptor set.
+ FD_SET( m_pTimeoutFDS[0], &aReadFDS_ );
+ nFDs_ = m_pTimeoutFDS[0] + 1;
}
SalXLib::~SalXLib()
diff --git a/vcl/unx/generic/app/saldisp.cxx b/vcl/unx/generic/app/saldisp.cxx
index 679014cd53be..1b029e031f64 100644
--- a/vcl/unx/generic/app/saldisp.cxx
+++ b/vcl/unx/generic/app/saldisp.cxx
@@ -712,21 +712,21 @@ unsigned int GetKeySymMask(Display* dpy, KeySym nKeySym)
void SalDisplay::SimulateKeyPress( sal_uInt16 nKeyCode )
{
- if (nKeyCode == KEY_CAPSLOCK)
- {
- Display* dpy = GetDisplay();
- if (!InitXkb(dpy))
- return;
+ if (nKeyCode != KEY_CAPSLOCK)
+ return;
- unsigned int nMask = GetKeySymMask(dpy, XK_Caps_Lock);
- XkbStateRec xkbState;
- XkbGetState(dpy, XkbUseCoreKbd, &xkbState);
- unsigned int nCapsLockState = xkbState.locked_mods & nMask;
- if (nCapsLockState)
- XkbLockModifiers (dpy, XkbUseCoreKbd, nMask, 0);
- else
- XkbLockModifiers (dpy, XkbUseCoreKbd, nMask, nMask);
- }
+ Display* dpy = GetDisplay();
+ if (!InitXkb(dpy))
+ return;
+
+ unsigned int nMask = GetKeySymMask(dpy, XK_Caps_Lock);
+ XkbStateRec xkbState;
+ XkbGetState(dpy, XkbUseCoreKbd, &xkbState);
+ unsigned int nCapsLockState = xkbState.locked_mods & nMask;
+ if (nCapsLockState)
+ XkbLockModifiers (dpy, XkbUseCoreKbd, nMask, 0);
+ else
+ XkbLockModifiers (dpy, XkbUseCoreKbd, nMask, nMask);
}
KeyIndicatorState SalDisplay::GetIndicatorState() const
@@ -2288,28 +2288,28 @@ void SalDisplay::InitXinerama()
return; // multiple screens mean no xinerama
}
#if defined(USE_XINERAMA_XORG)
- if( XineramaIsActive( pDisp_ ) )
+ if( !XineramaIsActive( pDisp_ ) )
+ return;
+
+ int nFramebuffers = 1;
+ XineramaScreenInfo* pScreens = XineramaQueryScreens( pDisp_, &nFramebuffers );
+ if( !pScreens )
+ return;
+
+ if( nFramebuffers > 1 )
{
- int nFramebuffers = 1;
- XineramaScreenInfo* pScreens = XineramaQueryScreens( pDisp_, &nFramebuffers );
- if( pScreens )
+ m_aXineramaScreens = std::vector<tools::Rectangle>();
+ m_aXineramaScreenIndexMap = std::vector<int>(nFramebuffers);
+ for( int i = 0; i < nFramebuffers; i++ )
{
- if( nFramebuffers > 1 )
- {
- m_aXineramaScreens = std::vector<tools::Rectangle>();
- m_aXineramaScreenIndexMap = std::vector<int>(nFramebuffers);
- for( int i = 0; i < nFramebuffers; i++ )
- {
- addXineramaScreenUnique( i, pScreens[i].x_org,
- pScreens[i].y_org,
- pScreens[i].width,
- pScreens[i].height );
- }
- m_bXinerama = m_aXineramaScreens.size() > 1;
- }
- XFree( pScreens );
+ addXineramaScreenUnique( i, pScreens[i].x_org,
+ pScreens[i].y_org,
+ pScreens[i].width,
+ pScreens[i].height );
}
+ m_bXinerama = m_aXineramaScreens.size() > 1;
}
+ XFree( pScreens );
#endif
#if OSL_DEBUG_LEVEL > 1
if( m_bXinerama )
@@ -2395,61 +2395,61 @@ SalVisual::SalVisual():
SalVisual::SalVisual( const XVisualInfo* pXVI )
{
*static_cast<XVisualInfo*>(this) = *pXVI;
- if( GetClass() == TrueColor )
- {
- nRedShift_ = sal_Shift( red_mask );
- nGreenShift_ = sal_Shift( green_mask );
- nBlueShift_ = sal_Shift( blue_mask );
-
- nRedBits_ = sal_significantBits( red_mask );
- nGreenBits_ = sal_significantBits( green_mask );
- nBlueBits_ = sal_significantBits( blue_mask );
-
- if( GetDepth() == 24 )
- if( red_mask == 0xFF0000 )
- if( green_mask == 0xFF00 )
- if( blue_mask == 0xFF )
- eRGBMode_ = SalRGB::RGB;
- else
- eRGBMode_ = SalRGB::otherSalRGB;
- else if( blue_mask == 0xFF00 )
- if( green_mask == 0xFF )
- eRGBMode_ = SalRGB::RBG;
- else
- eRGBMode_ = SalRGB::otherSalRGB;
+ if( GetClass() != TrueColor )
+ return;
+
+ nRedShift_ = sal_Shift( red_mask );
+ nGreenShift_ = sal_Shift( green_mask );
+ nBlueShift_ = sal_Shift( blue_mask );
+
+ nRedBits_ = sal_significantBits( red_mask );
+ nGreenBits_ = sal_significantBits( green_mask );
+ nBlueBits_ = sal_significantBits( blue_mask );
+
+ if( GetDepth() == 24 )
+ if( red_mask == 0xFF0000 )
+ if( green_mask == 0xFF00 )
+ if( blue_mask == 0xFF )
+ eRGBMode_ = SalRGB::RGB;
else
eRGBMode_ = SalRGB::otherSalRGB;
- else if( green_mask == 0xFF0000 )
- if( red_mask == 0xFF00 )
- if( blue_mask == 0xFF )
- eRGBMode_ = SalRGB::GRB;
- else
- eRGBMode_ = SalRGB::otherSalRGB;
- else if( blue_mask == 0xFF00 )
- if( red_mask == 0xFF )
- eRGBMode_ = SalRGB::GBR;
- else
- eRGBMode_ = SalRGB::otherSalRGB;
+ else if( blue_mask == 0xFF00 )
+ if( green_mask == 0xFF )
+ eRGBMode_ = SalRGB::RBG;
else
eRGBMode_ = SalRGB::otherSalRGB;
- else if( blue_mask == 0xFF0000 )
- if( red_mask == 0xFF00 )
- if( green_mask == 0xFF )
- eRGBMode_ = SalRGB::BRG;
- else
- eRGBMode_ = SalRGB::otherSalRGB;
- else if( green_mask == 0xFF00 )
- if( red_mask == 0xFF )
- eRGBMode_ = SalRGB::BGR;
- else
- eRGBMode_ = SalRGB::otherSalRGB;
+ else
+ eRGBMode_ = SalRGB::otherSalRGB;
+ else if( green_mask == 0xFF0000 )
+ if( red_mask == 0xFF00 )
+ if( blue_mask == 0xFF )
+ eRGBMode_ = SalRGB::GRB;
+ else
+ eRGBMode_ = SalRGB::otherSalRGB;
+ else if( blue_mask == 0xFF00 )
+ if( red_mask == 0xFF )
+ eRGBMode_ = SalRGB::GBR;
+ else
+ eRGBMode_ = SalRGB::otherSalRGB;
+ else
+ eRGBMode_ = SalRGB::otherSalRGB;
+ else if( blue_mask == 0xFF0000 )
+ if( red_mask == 0xFF00 )
+ if( green_mask == 0xFF )
+ eRGBMode_ = SalRGB::BRG;
+ else
+ eRGBMode_ = SalRGB::otherSalRGB;
+ else if( green_mask == 0xFF00 )
+ if( red_mask == 0xFF )
+ eRGBMode_ = SalRGB::BGR;
else
eRGBMode_ = SalRGB::otherSalRGB;
else
eRGBMode_ = SalRGB::otherSalRGB;
else
eRGBMode_ = SalRGB::otherSalRGB;
- }
+ else
+ eRGBMode_ = SalRGB::otherSalRGB;
}
// Converts the order of bytes of a Pixel into bytes of a Color
diff --git a/vcl/unx/generic/app/sm.cxx b/vcl/unx/generic/app/sm.cxx
index 30ff437a263a..7827f01eec35 100644
--- a/vcl/unx/generic/app/sm.cxx
+++ b/vcl/unx/generic/app/sm.cxx
@@ -450,20 +450,20 @@ void SessionManagerClient::saveDone()
{
SAL_INFO("vcl.sm", "SessionManagerClient::saveDone");
- if( m_pSmcConnection )
- {
- assert(m_xICEConnectionObserver);
- osl::MutexGuard g(m_xICEConnectionObserver->m_ICEMutex);
- //SmcSetProperties( m_pSmcConnection, 1, &ppSmProps[ eCloneCommand ] );
- // this message-handling is now equal to kate and plasma desktop
- SmcSetProperties( m_pSmcConnection, 1, &ppSmProps[ eRestartCommand ] );
- SmcDeleteProperties( m_pSmcConnection, 1, &ppSmDel[ eDiscardCommand ] );
- SmcSetProperties( m_pSmcConnection, 1, &ppSmProps[ eRestartStyleHint ] );
-
- SmcSaveYourselfDone( m_pSmcConnection, True );
- SAL_INFO("vcl.sm.debug", " sent SmRestartHint = " << (*pSmRestartHint) );
- m_bDocSaveDone = true;
- }
+ if( !m_pSmcConnection )
+ return;
+
+ assert(m_xICEConnectionObserver);
+ osl::MutexGuard g(m_xICEConnectionObserver->m_ICEMutex);
+ //SmcSetProperties( m_pSmcConnection, 1, &ppSmProps[ eCloneCommand ] );
+ // this message-handling is now equal to kate and plasma desktop
+ SmcSetProperties( m_pSmcConnection, 1, &ppSmProps[ eRestartCommand ] );
+ SmcDeleteProperties( m_pSmcConnection, 1, &ppSmDel[ eDiscardCommand ] );
+ SmcSetProperties( m_pSmcConnection, 1, &ppSmProps[ eRestartStyleHint ] );
+
+ SmcSaveYourselfDone( m_pSmcConnection, True );
+ SAL_INFO("vcl.sm.debug", " sent SmRestartHint = " << (*pSmRestartHint) );
+ m_bDocSaveDone = true;
}
void SessionManagerClient::open(SalSession * pSession)
@@ -553,19 +553,19 @@ void SessionManagerClient::close()
{
SAL_INFO("vcl.sm", "SessionManagerClient::close");
- if( m_pSmcConnection )
+ if( !m_pSmcConnection )
+ return;
+
+ SAL_INFO("vcl.sm.debug", " attempting SmcCloseConnection");
+ assert(m_xICEConnectionObserver);
{
- SAL_INFO("vcl.sm.debug", " attempting SmcCloseConnection");
- assert(m_xICEConnectionObserver);
- {
- osl::MutexGuard g(m_xICEConnectionObserver->m_ICEMutex);
- SmcCloseConnection( m_pSmcConnection, 0, nullptr );
- SAL_INFO("vcl.sm", " SmcCloseConnection closed");
- }
- m_xICEConnectionObserver->deactivate();
- m_xICEConnectionObserver.reset();
- m_pSmcConnection = nullptr;
+ osl::MutexGuard g(m_xICEConnectionObserver->m_ICEMutex);
+ SmcCloseConnection( m_pSmcConnection, 0, nullptr );
+ SAL_INFO("vcl.sm", " SmcCloseConnection closed");
}
+ m_xICEConnectionObserver->deactivate();
+ m_xICEConnectionObserver.reset();
+ m_pSmcConnection = nullptr;
}
bool SessionManagerClient::queryInteraction()
diff --git a/vcl/unx/generic/app/wmadaptor.cxx b/vcl/unx/generic/app/wmadaptor.cxx
index 8304efbf226d..cc38683fe0e5 100644
--- a/vcl/unx/generic/app/wmadaptor.cxx
+++ b/vcl/unx/generic/app/wmadaptor.cxx
@@ -286,37 +286,37 @@ WMAdaptor::WMAdaptor( SalDisplay* pDisplay ) :
}
}
}
- if( m_aWMName.isEmpty() )
+ if( !m_aWMName.isEmpty() )
+ return;
+
+ Atom aTTAPlatform = XInternAtom( m_pDisplay, "TTA_CLIENT_PLATFORM", True );
+ if( aTTAPlatform == None ||
+ XGetWindowProperty( m_pDisplay,
+ m_pSalDisplay->GetRootWindow( m_pSalDisplay->GetDefaultXScreen() ),
+ aTTAPlatform,
+ 0, 32,
+ False,
+ XA_STRING,
+ &aRealType,
+ &nFormat,
+ &nItems,
+ &nBytesLeft,
+ &pProperty ) != 0 )
+ return;
+
+ if( aRealType == XA_STRING )
{
- Atom aTTAPlatform = XInternAtom( m_pDisplay, "TTA_CLIENT_PLATFORM", True );
- if( aTTAPlatform != None &&
- XGetWindowProperty( m_pDisplay,
- m_pSalDisplay->GetRootWindow( m_pSalDisplay->GetDefaultXScreen() ),
- aTTAPlatform,
- 0, 32,
- False,
- XA_STRING,
- &aRealType,
- &nFormat,
- &nItems,
- &nBytesLeft,
- &pProperty ) == 0 )
- {
- if( aRealType == XA_STRING )
- {
- m_aWMName = "Tarantella";
- // #i62319# pretend that AlwaysOnTop works since
- // the alwaysontop workaround in salframe.cxx results
- // in a raise/lower loop on a Windows tarantella client
- // FIXME: this property contains an identification string that
- // in theory should be good enough to recognize running on a
- // Windows client; however this string does not seem to be
- // documented as well as the property itself.
- m_bEnableAlwaysOnTopWorks = true;
- }
- XFree( pProperty );
- }
+ m_aWMName = "Tarantella";
+ // #i62319# pretend that AlwaysOnTop works since
+ // the alwaysontop workaround in salframe.cxx results
+ // in a raise/lower loop on a Windows tarantella client
+ // FIXME: this property contains an identification string that
+ // in theory should be good enough to recognize running on a
+ // Windows client; however this string does not seem to be
+ // documented as well as the property itself.
+ m_bEnableAlwaysOnTopWorks = true;
}
+ XFree( pProperty );
}
/*
@@ -1066,104 +1066,104 @@ void NetWMAdaptor::setWMName( X11SalFrame* pFrame, const OUString& rWMName ) con
*/
void NetWMAdaptor::setNetWMState( X11SalFrame* pFrame ) const
{
- if( m_aWMAtoms[ NET_WM_STATE ] )
+ if( !(m_aWMAtoms[ NET_WM_STATE ]) )
+ return;
+
+ Atom aStateAtoms[ 10 ];
+ int nStateAtoms = 0;
+
+ // set NET_WM_STATE_MODAL
+ if( pFrame->mbMaximizedVert
+ && m_aWMAtoms[ NET_WM_STATE_MAXIMIZED_VERT ] )
+ aStateAtoms[ nStateAtoms++ ] = m_aWMAtoms[ NET_WM_STATE_MAXIMIZED_VERT ];
+ if( pFrame->mbMaximizedHorz
+ && m_aWMAtoms[ NET_WM_STATE_MAXIMIZED_HORZ ] )
+ aStateAtoms[ nStateAtoms++ ] = m_aWMAtoms[ NET_WM_STATE_MAXIMIZED_HORZ ];
+ if( pFrame->bAlwaysOnTop_ && m_aWMAtoms[ NET_WM_STATE_STAYS_ON_TOP ] )
+ aStateAtoms[ nStateAtoms++ ] = m_aWMAtoms[ NET_WM_STATE_STAYS_ON_TOP ];
+ if( pFrame->mbShaded && m_aWMAtoms[ NET_WM_STATE_SHADED ] )
+ aStateAtoms[ nStateAtoms++ ] = m_aWMAtoms[ NET_WM_STATE_SHADED ];
+ if( pFrame->mbFullScreen && m_aWMAtoms[ NET_WM_STATE_FULLSCREEN ] )
+ aStateAtoms[ nStateAtoms++ ] = m_aWMAtoms[ NET_WM_STATE_FULLSCREEN ];
+ if( pFrame->meWindowType == WMWindowType::Utility && m_aWMAtoms[ NET_WM_STATE_SKIP_TASKBAR ] )
+ aStateAtoms[ nStateAtoms++ ] = m_aWMAtoms[ NET_WM_STATE_SKIP_TASKBAR ];
+
+ if( nStateAtoms )
{
- Atom aStateAtoms[ 10 ];
- int nStateAtoms = 0;
-
- // set NET_WM_STATE_MODAL
- if( pFrame->mbMaximizedVert
- && m_aWMAtoms[ NET_WM_STATE_MAXIMIZED_VERT ] )
- aStateAtoms[ nStateAtoms++ ] = m_aWMAtoms[ NET_WM_STATE_MAXIMIZED_VERT ];
- if( pFrame->mbMaximizedHorz
- && m_aWMAtoms[ NET_WM_STATE_MAXIMIZED_HORZ ] )
- aStateAtoms[ nStateAtoms++ ] = m_aWMAtoms[ NET_WM_STATE_MAXIMIZED_HORZ ];
- if( pFrame->bAlwaysOnTop_ && m_aWMAtoms[ NET_WM_STATE_STAYS_ON_TOP ] )
- aStateAtoms[ nStateAtoms++ ] = m_aWMAtoms[ NET_WM_STATE_STAYS_ON_TOP ];
- if( pFrame->mbShaded && m_aWMAtoms[ NET_WM_STATE_SHADED ] )
- aStateAtoms[ nStateAtoms++ ] = m_aWMAtoms[ NET_WM_STATE_SHADED ];
- if( pFrame->mbFullScreen && m_aWMAtoms[ NET_WM_STATE_FULLSCREEN ] )
- aStateAtoms[ nStateAtoms++ ] = m_aWMAtoms[ NET_WM_STATE_FULLSCREEN ];
- if( pFrame->meWindowType == WMWindowType::Utility && m_aWMAtoms[ NET_WM_STATE_SKIP_TASKBAR ] )
- aStateAtoms[ nStateAtoms++ ] = m_aWMAtoms[ NET_WM_STATE_SKIP_TASKBAR ];
-
- if( nStateAtoms )
- {
- XChangeProperty( m_pDisplay,
- pFrame->GetShellWindow(),
- m_aWMAtoms[ NET_WM_STATE ],
- XA_ATOM,
- 32,
- PropModeReplace,
- reinterpret_cast<unsigned char*>(aStateAtoms),
- nStateAtoms
- );
- }
- else
- XDeleteProperty( m_pDisplay,
- pFrame->GetShellWindow(),
- m_aWMAtoms[ NET_WM_STATE ] );
- if( pFrame->mbMaximizedHorz
- && pFrame->mbMaximizedVert
- && ! ( pFrame->nStyle_ & SalFrameStyleFlags::SIZEABLE ) )
- {
- /*
- * for maximizing use NorthWestGravity (including decoration)
- */
- XSizeHints hints;
- long supplied;
- bool bHint = false;
- if( XGetWMNormalHints( m_pDisplay,
- pFrame->GetShellWindow(),
- &hints,
- &supplied ) )
- {
- bHint = true;
- hints.flags |= PWinGravity;
- hints.win_gravity = NorthWestGravity;
- XSetWMNormalHints( m_pDisplay,
- pFrame->GetShellWindow(),
- &hints );
- XSync( m_pDisplay, False );
- }
+ XChangeProperty( m_pDisplay,
+ pFrame->GetShellWindow(),
+ m_aWMAtoms[ NET_WM_STATE ],
+ XA_ATOM,
+ 32,
+ PropModeReplace,
+ reinterpret_cast<unsigned char*>(aStateAtoms),
+ nStateAtoms
+ );
+ }
+ else
+ XDeleteProperty( m_pDisplay,
+ pFrame->GetShellWindow(),
+ m_aWMAtoms[ NET_WM_STATE ] );
+ if( !(pFrame->mbMaximizedHorz
+ && pFrame->mbMaximizedVert
+ && ! ( pFrame->nStyle_ & SalFrameStyleFlags::SIZEABLE )) )
+ return;
- // SetPosSize necessary to set width/height, min/max w/h
- sal_Int32 nCurrent = 0;
- /*
- * get current desktop here if work areas have different size
- * (does this happen on any platform ?)
- */
- if( ! m_bEqualWorkAreas )
- {
- nCurrent = getCurrentWorkArea();
- if( nCurrent < 0 )
- nCurrent = 0;
- }
- tools::Rectangle aPosSize = m_aWMWorkAreas[nCurrent];
- const SalFrameGeometry& rGeom( pFrame->GetUnmirroredGeometry() );
- aPosSize = tools::Rectangle( Point( aPosSize.Left() + rGeom.nLeftDecoration,
- aPosSize.Top() + rGeom.nTopDecoration ),
- Size( aPosSize.GetWidth()
- - rGeom.nLeftDecoration
- - rGeom.nRightDecoration,
- aPosSize.GetHeight()
- - rGeom.nTopDecoration
- - rGeom.nBottomDecoration )
- );
- pFrame->SetPosSize( aPosSize );
-
- /*
- * reset gravity hint to static gravity
- * (this should not move window according to ICCCM)
- */
- if( bHint && pFrame->nShowState_ != SHOWSTATE_UNKNOWN )
- {
- hints.win_gravity = StaticGravity;
- XSetWMNormalHints( m_pDisplay,
- pFrame->GetShellWindow(),
- &hints );
- }
- }
+ /*
+ * for maximizing use NorthWestGravity (including decoration)
+ */
+ XSizeHints hints;
+ long supplied;
+ bool bHint = false;
+ if( XGetWMNormalHints( m_pDisplay,
+ pFrame->GetShellWindow(),
+ &hints,
+ &supplied ) )
+ {
+ bHint = true;
+ hints.flags |= PWinGravity;
+ hints.win_gravity = NorthWestGravity;
+ XSetWMNormalHints( m_pDisplay,
+ pFrame->GetShellWindow(),
+ &hints );
+ XSync( m_pDisplay, False );
+ }
+
+ // SetPosSize necessary to set width/height, min/max w/h
+ sal_Int32 nCurrent = 0;
+ /*
+ * get current desktop here if work areas have different size
+ * (does this happen on any platform ?)
+ */
+ if( ! m_bEqualWorkAreas )
+ {
+ nCurrent = getCurrentWorkArea();
+ if( nCurrent < 0 )
+ nCurrent = 0;
+ }
+ tools::Rectangle aPosSize = m_aWMWorkAreas[nCurrent];
+ const SalFrameGeometry& rGeom( pFrame->GetUnmirroredGeometry() );
+ aPosSize = tools::Rectangle( Point( aPosSize.Left() + rGeom.nLeftDecoration,
+ aPosSize.Top() + rGeom.nTopDecoration ),
+ Size( aPosSize.GetWidth()
+ - rGeom.nLeftDecoration
+ - rGeom.nRightDecoration,
+ aPosSize.GetHeight()
+ - rGeom.nTopDecoration
+ - rGeom.nBottomDecoration )
+ );
+ pFrame->SetPosSize( aPosSize );
+
+ /*
+ * reset gravity hint to static gravity
+ * (this should not move window according to ICCCM)
+ */
+ if( bHint && pFrame->nShowState_ != SHOWSTATE_UNKNOWN )
+ {
+ hints.win_gravity = StaticGravity;
+ XSetWMNormalHints( m_pDisplay,
+ pFrame->GetShellWindow(),
+ &hints );
}
}
@@ -1173,87 +1173,87 @@ void NetWMAdaptor::setNetWMState( X11SalFrame* pFrame ) const
*/
void GnomeWMAdaptor::setGnomeWMState( X11SalFrame* pFrame ) const
{
- if( m_aWMAtoms[ WIN_STATE ] )
- {
- sal_uInt32 nWinWMState = 0;
+ if( !(m_aWMAtoms[ WIN_STATE ]) )
+ return;
- if( pFrame->mbMaximizedVert )
- nWinWMState |= 1 << 2;
- if( pFrame->mbMaximizedHorz )
- nWinWMState |= 1 << 3;
- if( pFrame->mbShaded )
- nWinWMState |= 1 << 5;
+ sal_uInt32 nWinWMState = 0;
- XChangeProperty( m_pDisplay,
- pFrame->GetShellWindow(),
- m_aWMAtoms[ WIN_STATE ],
- XA_CARDINAL,
- 32,
- PropModeReplace,
- reinterpret_cast<unsigned char*>(&nWinWMState),
- 1
- );
- if( pFrame->mbMaximizedHorz
- && pFrame->mbMaximizedVert
- && ! ( pFrame->nStyle_ & SalFrameStyleFlags::SIZEABLE ) )
- {
- /*
- * for maximizing use NorthWestGravity (including decoration)
- */
- XSizeHints hints;
- long supplied;
- bool bHint = false;
- if( XGetWMNormalHints( m_pDisplay,
- pFrame->GetShellWindow(),
- &hints,
- &supplied ) )
- {
- bHint = true;
- hints.flags |= PWinGravity;
- hints.win_gravity = NorthWestGravity;
- XSetWMNormalHints( m_pDisplay,
- pFrame->GetShellWindow(),
- &hints );
- XSync( m_pDisplay, False );
- }
+ if( pFrame->mbMaximizedVert )
+ nWinWMState |= 1 << 2;
+ if( pFrame->mbMaximizedHorz )
+ nWinWMState |= 1 << 3;
+ if( pFrame->mbShaded )
+ nWinWMState |= 1 << 5;
- // SetPosSize necessary to set width/height, min/max w/h
- sal_Int32 nCurrent = 0;
- /*
- * get current desktop here if work areas have different size
- * (does this happen on any platform ?)
- */
- if( ! m_bEqualWorkAreas )
- {
- nCurrent = getCurrentWorkArea();
- if( nCurrent < 0 )
- nCurrent = 0;
- }
- tools::Rectangle aPosSize = m_aWMWorkAreas[nCurrent];
- const SalFrameGeometry& rGeom( pFrame->GetUnmirroredGeometry() );
- aPosSize = tools::Rectangle( Point( aPosSize.Left() + rGeom.nLeftDecoration,
- aPosSize.Top() + rGeom.nTopDecoration ),
- Size( aPosSize.GetWidth()
- - rGeom.nLeftDecoration
- - rGeom.nRightDecoration,
- aPosSize.GetHeight()
- - rGeom.nTopDecoration
- - rGeom.nBottomDecoration )
- );
- pFrame->SetPosSize( aPosSize );
-
- /*
- * reset gravity hint to static gravity
- * (this should not move window according to ICCCM)
- */
- if( bHint && pFrame->nShowState_ != SHOWSTATE_UNKNOWN )
- {
- hints.win_gravity = StaticGravity;
- XSetWMNormalHints( m_pDisplay,
- pFrame->GetShellWindow(),
- &hints );
- }
- }
+ XChangeProperty( m_pDisplay,
+ pFrame->GetShellWindow(),
+ m_aWMAtoms[ WIN_STATE ],
+ XA_CARDINAL,
+ 32,
+ PropModeReplace,
+ reinterpret_cast<unsigned char*>(&nWinWMState),
+ 1
+ );
+ if( !(pFrame->mbMaximizedHorz
+ && pFrame->mbMaximizedVert
+ && ! ( pFrame->nStyle_ & SalFrameStyleFlags::SIZEABLE )) )
+ return;
+
+ /*
+ * for maximizing use NorthWestGravity (including decoration)
+ */
+ XSizeHints hints;
+ long supplied;
+ bool bHint = false;
+ if( XGetWMNormalHints( m_pDisplay,
+ pFrame->GetShellWindow(),
+ &hints,
+ &supplied ) )
+ {
+ bHint = true;
+ hints.flags |= PWinGravity;
+ hints.win_gravity = NorthWestGravity;
+ XSetWMNormalHints( m_pDisplay,
+ pFrame->GetShellWindow(),
+ &hints );
+ XSync( m_pDisplay, False );
+ }
+
+ // SetPosSize necessary to set width/height, min/max w/h
+ sal_Int32 nCurrent = 0;
+ /*
+ * get current desktop here if work areas have different size
+ * (does this happen on any platform ?)
+ */
+ if( ! m_bEqualWorkAreas )
+ {
+ nCurrent = getCurrentWorkArea();
+ if( nCurrent < 0 )
+ nCurrent = 0;
+ }
+ tools::Rectangle aPosSize = m_aWMWorkAreas[nCurrent];
+ const SalFrameGeometry& rGeom( pFrame->GetUnmirroredGeometry() );
+ aPosSize = tools::Rectangle( Point( aPosSize.Left() + rGeom.nLeftDecoration,
+ aPosSize.Top() + rGeom.nTopDecoration ),
+ Size( aPosSize.GetWidth()
+ - rGeom.nLeftDecoration
+ - rGeom.nRightDecoration,
+ aPosSize.GetHeight()
+ - rGeom.nTopDecoration
+ - rGeom.nBottomDecoration )
+ );
+ pFrame->SetPosSize( aPosSize );
+
+ /*
+ * reset gravity hint to static gravity
+ * (this should not move window according to ICCCM)
+ */
+ if( bHint && pFrame->nShowState_ != SHOWSTATE_UNKNOWN )
+ {
+ hints.win_gravity = StaticGravity;
+ XSetWMNormalHints( m_pDisplay,
+ pFrame->GetShellWindow(),
+ &hints );
}
}
@@ -1660,32 +1660,32 @@ void WMAdaptor::enableAlwaysOnTop( X11SalFrame*, bool /*bEnable*/ ) const
void NetWMAdaptor::enableAlwaysOnTop( X11SalFrame* pFrame, bool bEnable ) const
{
pFrame->bAlwaysOnTop_ = bEnable;
- if( m_aWMAtoms[ NET_WM_STATE_STAYS_ON_TOP ] )
+ if( !(m_aWMAtoms[ NET_WM_STATE_STAYS_ON_TOP ]) )
+ return;
+
+ if( pFrame->bMapped_ )
{
- if( pFrame->bMapped_ )
- {
- // window already mapped, send WM a message
- XEvent aEvent;
- aEvent.type = ClientMessage;
- aEvent.xclient.display = m_pDisplay;
- aEvent.xclient.window = pFrame->GetShellWindow();
- aEvent.xclient.message_type = m_aWMAtoms[ NET_WM_STATE ];
- aEvent.xclient.format = 32;
- aEvent.xclient.data.l[0] = bEnable ? 1 : 0;
- aEvent.xclient.data.l[1] = m_aWMAtoms[ NET_WM_STATE_STAYS_ON_TOP ];
- aEvent.xclient.data.l[2] = 0;
- aEvent.xclient.data.l[3] = 0;
- aEvent.xclient.data.l[4] = 0;
- XSendEvent( m_pDisplay,
- m_pSalDisplay->GetRootWindow( pFrame->GetScreenNumber() ),
- False,
- SubstructureNotifyMask | SubstructureRedirectMask,
- &aEvent
- );
- }
- else
- setNetWMState( pFrame );
+ // window already mapped, send WM a message
+ XEvent aEvent;
+ aEvent.type = ClientMessage;
+ aEvent.xclient.display = m_pDisplay;
+ aEvent.xclient.window = pFrame->GetShellWindow();
+ aEvent.xclient.message_type = m_aWMAtoms[ NET_WM_STATE ];
+ aEvent.xclient.format = 32;
+ aEvent.xclient.data.l[0] = bEnable ? 1 : 0;
+ aEvent.xclient.data.l[1] = m_aWMAtoms[ NET_WM_STATE_STAYS_ON_TOP ];
+ aEvent.xclient.data.l[2] = 0;
+ aEvent.xclient.data.l[3] = 0;
+ aEvent.xclient.data.l[4] = 0;
+ XSendEvent( m_pDisplay,
+ m_pSalDisplay->GetRootWindow( pFrame->GetScreenNumber() ),
+ False,
+ SubstructureNotifyMask | SubstructureRedirectMask,
+ &aEvent
+ );
}
+ else
+ setNetWMState( pFrame );
}
/*
@@ -1694,42 +1694,42 @@ void NetWMAdaptor::enableAlwaysOnTop( X11SalFrame* pFrame, bool bEnable ) const
void GnomeWMAdaptor::enableAlwaysOnTop( X11SalFrame* pFrame, bool bEnable ) const
{
pFrame->bAlwaysOnTop_ = bEnable;
- if( m_aWMAtoms[ WIN_LAYER ] )
+ if( !(m_aWMAtoms[ WIN_LAYER ]) )
+ return;
+
+ if( pFrame->bMapped_ )
{
- if( pFrame->bMapped_ )
- {
- // window already mapped, send WM a message
- XEvent aEvent;
- aEvent.type = ClientMessage;
- aEvent.xclient.display = m_pDisplay;
- aEvent.xclient.window = pFrame->GetShellWindow();
- aEvent.xclient.message_type = m_aWMAtoms[ WIN_LAYER ];
- aEvent.xclient.format = 32;
- aEvent.xclient.data.l[0] = bEnable ? 6 : 4;
- aEvent.xclient.data.l[1] = 0;
- aEvent.xclient.data.l[2] = 0;
- aEvent.xclient.data.l[3] = 0;
- aEvent.xclient.data.l[4] = 0;
- XSendEvent( m_pDisplay,
- m_pSalDisplay->GetRootWindow( pFrame->GetScreenNumber() ),
- False,
- SubstructureNotifyMask | SubstructureRedirectMask,
- &aEvent
- );
- }
- else
- {
- sal_uInt32 nNewLayer = bEnable ? 6 : 4;
- XChangeProperty( m_pDisplay,
- pFrame->GetShellWindow(),
- m_aWMAtoms[ WIN_LAYER ],
- XA_CARDINAL,
- 32,
- PropModeReplace,
- reinterpret_cast<unsigned char*>(&nNewLayer),
- 1
- );
- }
+ // window already mapped, send WM a message
+ XEvent aEvent;
+ aEvent.type = ClientMessage;
+ aEvent.xclient.display = m_pDisplay;
+ aEvent.xclient.window = pFrame->GetShellWindow();
+ aEvent.xclient.message_type = m_aWMAtoms[ WIN_LAYER ];
+ aEvent.xclient.format = 32;
+ aEvent.xclient.data.l[0] = bEnable ? 6 : 4;
+ aEvent.xclient.data.l[1] = 0;
+ aEvent.xclient.data.l[2] = 0;
+ aEvent.xclient.data.l[3] = 0;
+ aEvent.xclient.data.l[4] = 0;
+ XSendEvent( m_pDisplay,
+ m_pSalDisplay->GetRootWindow( pFrame->GetScreenNumber() ),
+ False,
+ SubstructureNotifyMask | SubstructureRedirectMask,
+ &aEvent
+ );
+ }
+ else
+ {
+ sal_uInt32 nNewLayer = bEnable ? 6 : 4;
+ XChangeProperty( m_pDisplay,
+ pFrame->GetShellWindow(),
+ m_aWMAtoms[ WIN_LAYER ],
+ XA_CARDINAL,
+ 32,
+ PropModeReplace,
+ reinterpret_cast<unsigned char*>(&nNewLayer),
+ 1
+ );
}
}
@@ -1738,22 +1738,22 @@ void GnomeWMAdaptor::enableAlwaysOnTop( X11SalFrame* pFrame, bool bEnable ) cons
*/
void WMAdaptor::changeReferenceFrame( X11SalFrame* pFrame, X11SalFrame const * pReferenceFrame ) const
{
- if( ! ( pFrame->nStyle_ & SalFrameStyleFlags::PLUG )
+ if( !(! ( pFrame->nStyle_ & SalFrameStyleFlags::PLUG )
&& ! pFrame->IsOverrideRedirect()
- && ! pFrame->IsFloatGrabWindow()
+ && ! pFrame->IsFloatGrabWindow())
)
+ return;
+
+ ::Window aTransient = pFrame->pDisplay_->GetRootWindow( pFrame->GetScreenNumber() );
+ pFrame->mbTransientForRoot = true;
+ if( pReferenceFrame )
{
- ::Window aTransient = pFrame->pDisplay_->GetRootWindow( pFrame->GetScreenNumber() );
- pFrame->mbTransientForRoot = true;
- if( pReferenceFrame )
- {
- aTransient = pReferenceFrame->GetShellWindow();
- pFrame->mbTransientForRoot = false;
- }
- XSetTransientForHint( m_pDisplay,
- pFrame->GetShellWindow(),
- aTransient );
+ aTransient = pReferenceFrame->GetShellWindow();
+ pFrame->mbTransientForRoot = false;
}
+ XSetTransientForHint( m_pDisplay,
+ pFrame->GetShellWindow(),
+ aTransient );
}
/*
@@ -1918,38 +1918,38 @@ void WMAdaptor::shade( X11SalFrame*, bool /*bToShaded*/ ) const
*/
void NetWMAdaptor::shade( X11SalFrame* pFrame, bool bToShaded ) const
{
- if( m_aWMAtoms[ NET_WM_STATE ]
+ if( !(m_aWMAtoms[ NET_WM_STATE ]
&& m_aWMAtoms[ NET_WM_STATE_SHADED ]
- && ( pFrame->nStyle_ & ~SalFrameStyleFlags::DEFAULT )
+ && ( pFrame->nStyle_ & ~SalFrameStyleFlags::DEFAULT ))
)
+ return;
+
+ pFrame->mbShaded = bToShaded;
+ if( pFrame->bMapped_ )
{
- pFrame->mbShaded = bToShaded;
- if( pFrame->bMapped_ )
- {
- // window already mapped, send WM a message
- XEvent aEvent;
- aEvent.type = ClientMessage;
- aEvent.xclient.display = m_pDisplay;
- aEvent.xclient.window = pFrame->GetShellWindow();
- aEvent.xclient.message_type = m_aWMAtoms[ NET_WM_STATE ];
- aEvent.xclient.format = 32;
- aEvent.xclient.data.l[0] = bToShaded ? 1 : 0;
- aEvent.xclient.data.l[1] = m_aWMAtoms[ NET_WM_STATE_SHADED ];
- aEvent.xclient.data.l[2] = 0;
- aEvent.xclient.data.l[3] = 0;
- aEvent.xclient.data.l[4] = 0;
- XSendEvent( m_pDisplay,
- m_pSalDisplay->GetRootWindow( pFrame->GetScreenNumber() ),
- False,
- SubstructureNotifyMask | SubstructureRedirectMask,
- &aEvent
- );
- }
- else
- {
- // window not mapped yet, set _NET_WM_STATE directly
- setNetWMState( pFrame );
- }
+ // window already mapped, send WM a message
+ XEvent aEvent;
+ aEvent.type = ClientMessage;
+ aEvent.xclient.display = m_pDisplay;
+ aEvent.xclient.window = pFrame->GetShellWindow();
+ aEvent.xclient.message_type = m_aWMAtoms[ NET_WM_STATE ];
+ aEvent.xclient.format = 32;
+ aEvent.xclient.data.l[0] = bToShaded ? 1 : 0;
+ aEvent.xclient.data.l[1] = m_aWMAtoms[ NET_WM_STATE_SHADED ];
+ aEvent.xclient.data.l[2] = 0;
+ aEvent.xclient.data.l[3] = 0;
+ aEvent.xclient.data.l[4] = 0;
+ XSendEvent( m_pDisplay,
+ m_pSalDisplay->GetRootWindow( pFrame->GetScreenNumber() ),
+ False,
+ SubstructureNotifyMask | SubstructureRedirectMask,
+ &aEvent
+ );
+ }
+ else
+ {
+ // window not mapped yet, set _NET_WM_STATE directly
+ setNetWMState( pFrame );
}
}
@@ -1958,33 +1958,33 @@ void NetWMAdaptor::shade( X11SalFrame* pFrame, bool bToShaded ) const
*/
void GnomeWMAdaptor::shade( X11SalFrame* pFrame, bool bToShaded ) const
{
- if( m_aWMAtoms[ WIN_STATE ] )
+ if( !(m_aWMAtoms[ WIN_STATE ]) )
+ return;
+
+ pFrame->mbShaded = bToShaded;
+ if( pFrame->bMapped_ )
{
- pFrame->mbShaded = bToShaded;
- if( pFrame->bMapped_ )
- {
- // window already mapped, send WM a message
- XEvent aEvent;
- aEvent.type = ClientMessage;
- aEvent.xclient.display = m_pDisplay;
- aEvent.xclient.window = pFrame->GetShellWindow();
- aEvent.xclient.message_type = m_aWMAtoms[ WIN_STATE ];
- aEvent.xclient.format = 32;
- aEvent.xclient.data.l[0] = (1<<5);
- aEvent.xclient.data.l[1] = bToShaded ? (1<<5) : 0;
- aEvent.xclient.data.l[2] = 0;
- aEvent.xclient.data.l[3] = 0;
- aEvent.xclient.data.l[4] = 0;
- XSendEvent( m_pDisplay,
- m_pSalDisplay->GetRootWindow( pFrame->GetScreenNumber() ),
- False,
- SubstructureNotifyMask | SubstructureRedirectMask,
- &aEvent
- );
- }
- else
- setGnomeWMState( pFrame );
+ // window already mapped, send WM a message
+ XEvent aEvent;
+ aEvent.type = ClientMessage;
+ aEvent.xclient.display = m_pDisplay;
+ aEvent.xclient.window = pFrame->GetShellWindow();
+ aEvent.xclient.message_type = m_aWMAtoms[ WIN_STATE ];
+ aEvent.xclient.format = 32;
+ aEvent.xclient.data.l[0] = (1<<5);
+ aEvent.xclient.data.l[1] = bToShaded ? (1<<5) : 0;
+ aEvent.xclient.data.l[2] = 0;
+ aEvent.xclient.data.l[3] = 0;
+ aEvent.xclient.data.l[4] = 0;
+ XSendEvent( m_pDisplay,
+ m_pSalDisplay->GetRootWindow( pFrame->GetScreenNumber() ),
+ False,
+ SubstructureNotifyMask | SubstructureRedirectMask,
+ &aEvent
+ );
}
+ else
+ setGnomeWMState( pFrame );
}
/*
@@ -2236,19 +2236,19 @@ void NetWMAdaptor::setUserTime( X11SalFrame* i_pFrame, long i_nUserTime ) const
*/
void WMAdaptor::setPID( X11SalFrame const * i_pFrame ) const
{
- if( m_aWMAtoms[NET_WM_PID] )
- {
- long nPID = static_cast<long>(getpid());
- XChangeProperty( m_pDisplay,
- i_pFrame->GetShellWindow(),
- m_aWMAtoms[NET_WM_PID],
- XA_CARDINAL,
- 32,
- PropModeReplace,
- reinterpret_cast<unsigned char*>(&nPID),
- 1
- );
- }
+ if( !(m_aWMAtoms[NET_WM_PID]) )
+ return;
+
+ long nPID = static_cast<long>(getpid());
+ XChangeProperty( m_pDisplay,
+ i_pFrame->GetShellWindow(),
+ m_aWMAtoms[NET_WM_PID],
+ XA_CARDINAL,
+ 32,
+ PropModeReplace,
+ reinterpret_cast<unsigned char*>(&nPID),
+ 1
+ );
}
/*
@@ -2263,21 +2263,21 @@ void WMAdaptor::setClientMachine( X11SalFrame const * i_pFrame ) const
void WMAdaptor::answerPing( X11SalFrame const * i_pFrame, XClientMessageEvent const * i_pEvent ) const
{
- if( m_aWMAtoms[NET_WM_PING] &&
- i_pEvent->message_type == m_aWMAtoms[ WM_PROTOCOLS ] &&
- static_cast<Atom>(i_pEvent->data.l[0]) == m_aWMAtoms[ NET_WM_PING ] )
- {
- XEvent aEvent;
- aEvent.xclient = *i_pEvent;
- aEvent.xclient.window = m_pSalDisplay->GetRootWindow( i_pFrame->GetScreenNumber() );
- XSendEvent( m_pDisplay,
- m_pSalDisplay->GetRootWindow( i_pFrame->GetScreenNumber() ),
- False,
- SubstructureNotifyMask | SubstructureRedirectMask,
- &aEvent
- );
- XFlush( m_pDisplay );
- }
+ if( !m_aWMAtoms[NET_WM_PING] ||
+ i_pEvent->message_type != m_aWMAtoms[ WM_PROTOCOLS ] ||
+ static_cast<Atom>(i_pEvent->data.l[0]) != m_aWMAtoms[ NET_WM_PING ] )
+ return;
+
+ XEvent aEvent;
+ aEvent.xclient = *i_pEvent;
+ aEvent.xclient.window = m_pSalDisplay->GetRootWindow( i_pFrame->GetScreenNumber() );
+ XSendEvent( m_pDisplay,
+ m_pSalDisplay->GetRootWindow( i_pFrame->GetScreenNumber() ),
+ False,
+ SubstructureNotifyMask | SubstructureRedirectMask,
+ &aEvent
+ );
+ XFlush( m_pDisplay );
}
void WMAdaptor::activateWindow( X11SalFrame const *pFrame, Time nTimestamp )
diff --git a/vcl/unx/generic/dtrans/X11_droptarget.cxx b/vcl/unx/generic/dtrans/X11_droptarget.cxx
index 72f8dff00d9e..745e695a7a14 100644
--- a/vcl/unx/generic/dtrans/X11_droptarget.cxx
+++ b/vcl/unx/generic/dtrans/X11_droptarget.cxx
@@ -47,28 +47,28 @@ DropTarget::~DropTarget()
void DropTarget::initialize( const Sequence< Any >& arguments )
{
- if( arguments.getLength() > 1 )
+ if( arguments.getLength() <= 1 )
+ return;
+
+ OUString aDisplayName;
+ Reference< XDisplayConnection > xConn;
+ arguments.getConstArray()[0] >>= xConn;
+ if( xConn.is() )
+ {
+ Any aIdentifier;
+ aIdentifier >>= aDisplayName;
+ }
+
+ m_xSelectionManager = &SelectionManager::get( aDisplayName );
+ m_xSelectionManager->initialize( arguments );
+
+ if( m_xSelectionManager->getDisplay() ) // #136582# sanity check
{
- OUString aDisplayName;
- Reference< XDisplayConnection > xConn;
- arguments.getConstArray()[0] >>= xConn;
- if( xConn.is() )
- {
- Any aIdentifier;
- aIdentifier >>= aDisplayName;
- }
-
- m_xSelectionManager = &SelectionManager::get( aDisplayName );
- m_xSelectionManager->initialize( arguments );
-
- if( m_xSelectionManager->getDisplay() ) // #136582# sanity check
- {
- sal_IntPtr aWindow = None;
- arguments.getConstArray()[1] >>= aWindow;
- m_xSelectionManager->registerDropTarget( aWindow, this );
- m_aTargetWindow = aWindow;
- m_bActive = true;
- }
+ sal_IntPtr aWindow = None;
+ arguments.getConstArray()[1] >>= aWindow;
+ m_xSelectionManager->registerDropTarget( aWindow, this );
+ m_aTargetWindow = aWindow;
+ m_bActive = true;
}
}
diff --git a/vcl/unx/generic/dtrans/X11_selection.cxx b/vcl/unx/generic/dtrans/X11_selection.cxx
index 20321c9915c2..4be75f23ee56 100644
--- a/vcl/unx/generic/dtrans/X11_selection.cxx
+++ b/vcl/unx/generic/dtrans/X11_selection.cxx
@@ -345,113 +345,113 @@ void SelectionManager::initialize( const Sequence< Any >& arguments )
m_xDisplayConnection->addEventHandler( Any(), this, ~0 );
}
- if( ! m_pDisplay )
+ if( m_pDisplay )
+ return;
+
+ OUString aUDisplay;
+ if( m_xDisplayConnection.is() )
{
- OUString aUDisplay;
- if( m_xDisplayConnection.is() )
- {
- Any aIdentifier = m_xDisplayConnection->getIdentifier();
- aIdentifier >>= aUDisplay;
- }
+ Any aIdentifier = m_xDisplayConnection->getIdentifier();
+ aIdentifier >>= aUDisplay;
+ }
- OString aDisplayName( OUStringToOString( aUDisplay, RTL_TEXTENCODING_ISO_8859_1 ) );
+ OString aDisplayName( OUStringToOString( aUDisplay, RTL_TEXTENCODING_ISO_8859_1 ) );
- m_pDisplay = XOpenDisplay( aDisplayName.isEmpty() ? nullptr : aDisplayName.getStr());
+ m_pDisplay = XOpenDisplay( aDisplayName.isEmpty() ? nullptr : aDisplayName.getStr());
+
+ if( !m_pDisplay )
+ return;
- if( m_pDisplay )
- {
#ifdef SYNCHRONIZE
- XSynchronize( m_pDisplay, True );
+ XSynchronize( m_pDisplay, True );
#endif
- // special targets
- m_nTARGETSAtom = getAtom( "TARGETS" );
- m_nTIMESTAMPAtom = getAtom( "TIMESTAMP" );
- m_nTEXTAtom = getAtom( "TEXT" );
- m_nINCRAtom = getAtom( "INCR" );
- m_nCOMPOUNDAtom = getAtom( "COMPOUND_TEXT" );
- m_nMULTIPLEAtom = getAtom( "MULTIPLE" );
- m_nImageBmpAtom = getAtom( "image/bmp" );
-
- // Atoms for Xdnd protocol
- m_nXdndAware = getAtom( "XdndAware" );
- m_nXdndEnter = getAtom( "XdndEnter" );
- m_nXdndLeave = getAtom( "XdndLeave" );
- m_nXdndPosition = getAtom( "XdndPosition" );
- m_nXdndStatus = getAtom( "XdndStatus" );
- m_nXdndDrop = getAtom( "XdndDrop" );
- m_nXdndFinished = getAtom( "XdndFinished" );
- m_nXdndSelection = getAtom( "XdndSelection" );
- m_nXdndTypeList = getAtom( "XdndTypeList" );
- m_nXdndProxy = getAtom( "XdndProxy" );
- m_nXdndActionCopy = getAtom( "XdndActionCopy" );
- m_nXdndActionMove = getAtom( "XdndActionMove" );
- m_nXdndActionLink = getAtom( "XdndActionLink" );
- m_nXdndActionAsk = getAtom( "XdndActionAsk" );
-
- // initialize map with member none
- m_aAtomToString[ 0 ]= "None";
- m_aAtomToString[ XA_PRIMARY ] = "PRIMARY";
-
- // create a (invisible) message window
- m_aWindow = XCreateSimpleWindow( m_pDisplay, DefaultRootWindow( m_pDisplay ),
- 10, 10, 10, 10, 0, 0, 1 );
-
- // initialize threshold for incremental transfers
- // ICCCM says it should be smaller that the max request size
- // which in turn is guaranteed to be at least 16k bytes
- m_nIncrementalThreshold = XMaxRequestSize( m_pDisplay ) - 1024;
-
- if( m_aWindow )
- {
- // initialize default cursors
- m_aMoveCursor = createCursor( movedata_curs_bits,
- movedata_mask_bits,
- movedata_curs_width,
- movedata_curs_height,
- movedata_curs_x_hot,
- movedata_curs_y_hot );
- m_aCopyCursor = createCursor( copydata_curs_bits,
- copydata_mask_bits,
- copydata_curs_width,
- copydata_curs_height,
- copydata_curs_x_hot,
- copydata_curs_y_hot );
- m_aLinkCursor = createCursor( linkdata_curs_bits,
- linkdata_mask_bits,
- linkdata_curs_width,
- linkdata_curs_height,
- linkdata_curs_x_hot,
- linkdata_curs_y_hot );
- m_aNoneCursor = createCursor( nodrop_curs_bits,
- nodrop_mask_bits,
- nodrop_curs_width,
- nodrop_curs_height,
- nodrop_curs_x_hot,
- nodrop_curs_y_hot );
-
- // just interested in SelectionClear/Notify/Request and PropertyChange
- XSelectInput( m_pDisplay, m_aWindow, PropertyChangeMask );
- // create the transferable for Drag operations
- m_xDropTransferable = new X11Transferable( *this, m_nXdndSelection );
- registerHandler( m_nXdndSelection, *this );
-
- m_aThread = osl_createSuspendedThread( call_SelectionManager_run, this );
- if( m_aThread )
- osl_resumeThread( m_aThread );
+ // special targets
+ m_nTARGETSAtom = getAtom( "TARGETS" );
+ m_nTIMESTAMPAtom = getAtom( "TIMESTAMP" );
+ m_nTEXTAtom = getAtom( "TEXT" );
+ m_nINCRAtom = getAtom( "INCR" );
+ m_nCOMPOUNDAtom = getAtom( "COMPOUND_TEXT" );
+ m_nMULTIPLEAtom = getAtom( "MULTIPLE" );
+ m_nImageBmpAtom = getAtom( "image/bmp" );
+
+ // Atoms for Xdnd protocol
+ m_nXdndAware = getAtom( "XdndAware" );
+ m_nXdndEnter = getAtom( "XdndEnter" );
+ m_nXdndLeave = getAtom( "XdndLeave" );
+ m_nXdndPosition = getAtom( "XdndPosition" );
+ m_nXdndStatus = getAtom( "XdndStatus" );
+ m_nXdndDrop = getAtom( "XdndDrop" );
+ m_nXdndFinished = getAtom( "XdndFinished" );
+ m_nXdndSelection = getAtom( "XdndSelection" );
+ m_nXdndTypeList = getAtom( "XdndTypeList" );
+ m_nXdndProxy = getAtom( "XdndProxy" );
+ m_nXdndActionCopy = getAtom( "XdndActionCopy" );
+ m_nXdndActionMove = getAtom( "XdndActionMove" );
+ m_nXdndActionLink = getAtom( "XdndActionLink" );
+ m_nXdndActionAsk = getAtom( "XdndActionAsk" );
+
+ // initialize map with member none
+ m_aAtomToString[ 0 ]= "None";
+ m_aAtomToString[ XA_PRIMARY ] = "PRIMARY";
+
+ // create a (invisible) message window
+ m_aWindow = XCreateSimpleWindow( m_pDisplay, DefaultRootWindow( m_pDisplay ),
+ 10, 10, 10, 10, 0, 0, 1 );
+
+ // initialize threshold for incremental transfers
+ // ICCCM says it should be smaller that the max request size
+ // which in turn is guaranteed to be at least 16k bytes
+ m_nIncrementalThreshold = XMaxRequestSize( m_pDisplay ) - 1024;
+
+ if( !m_aWindow )
+ return;
+
+ // initialize default cursors
+ m_aMoveCursor = createCursor( movedata_curs_bits,
+ movedata_mask_bits,
+ movedata_curs_width,
+ movedata_curs_height,
+ movedata_curs_x_hot,
+ movedata_curs_y_hot );
+ m_aCopyCursor = createCursor( copydata_curs_bits,
+ copydata_mask_bits,
+ copydata_curs_width,
+ copydata_curs_height,
+ copydata_curs_x_hot,
+ copydata_curs_y_hot );
+ m_aLinkCursor = createCursor( linkdata_curs_bits,
+ linkdata_mask_bits,
+ linkdata_curs_width,
+ linkdata_curs_height,
+ linkdata_curs_x_hot,
+ linkdata_curs_y_hot );
+ m_aNoneCursor = createCursor( nodrop_curs_bits,
+ nodrop_mask_bits,
+ nodrop_curs_width,
+ nodrop_curs_height,
+ nodrop_curs_x_hot,
+ nodrop_curs_y_hot );
+
+ // just interested in SelectionClear/Notify/Request and PropertyChange
+ XSelectInput( m_pDisplay, m_aWindow, PropertyChangeMask );
+ // create the transferable for Drag operations
+ m_xDropTransferable = new X11Transferable( *this, m_nXdndSelection );
+ registerHandler( m_nXdndSelection, *this );
+
+ m_aThread = osl_createSuspendedThread( call_SelectionManager_run, this );
+ if( m_aThread )
+ osl_resumeThread( m_aThread );
#if OSL_DEBUG_LEVEL > 1
- else
- SAL_WARN("vcl.unx.dtrans", "SelectionManager::initialize: "
- << "creation of dispatch thread failed !.");
+ else
+ SAL_WARN("vcl.unx.dtrans", "SelectionManager::initialize: "
+ << "creation of dispatch thread failed !.");
#endif
- if (pipe(m_EndThreadPipe) != 0) {
+ if (pipe(m_EndThreadPipe) != 0) {
#if OSL_DEBUG_LEVEL > 1
- SAL_WARN("vcl.unx.dtrans", "Failed to create endThreadPipe.");
+ SAL_WARN("vcl.unx.dtrans", "Failed to create endThreadPipe.");
#endif
- m_EndThreadPipe[0] = m_EndThreadPipe[1] = 0;
- }
- }
- }
+ m_EndThreadPipe[0] = m_EndThreadPipe[1] = 0;
}
}
@@ -492,29 +492,29 @@ SelectionManager::~SelectionManager()
SAL_INFO("vcl.unx.dtrans", "shutting down SelectionManager.");
#endif
- if( m_pDisplay )
- {
- deregisterHandler( m_nXdndSelection );
- // destroy message window
- if( m_aWindow )
- XDestroyWindow( m_pDisplay, m_aWindow );
- // release cursors
- if (m_aMoveCursor != None)
- XFreeCursor(m_pDisplay, m_aMoveCursor);
- if (m_aCopyCursor != None)
- XFreeCursor(m_pDisplay, m_aCopyCursor);
- if (m_aLinkCursor != None)
- XFreeCursor(m_pDisplay, m_aLinkCursor);
- if (m_aNoneCursor != None)
- XFreeCursor(m_pDisplay, m_aNoneCursor);
-
- // paranoia setting, the drag thread should have
- // done that already
- XUngrabPointer( m_pDisplay, CurrentTime );
- XUngrabKeyboard( m_pDisplay, CurrentTime );
+ if( !m_pDisplay )
+ return;
- XCloseDisplay( m_pDisplay );
- }
+ deregisterHandler( m_nXdndSelection );
+ // destroy message window
+ if( m_aWindow )
+ XDestroyWindow( m_pDisplay, m_aWindow );
+ // release cursors
+ if (m_aMoveCursor != None)
+ XFreeCursor(m_pDisplay, m_aMoveCursor);
+ if (m_aCopyCursor != None)
+ XFreeCursor(m_pDisplay, m_aCopyCursor);
+ if (m_aLinkCursor != None)
+ XFreeCursor(m_pDisplay, m_aLinkCursor);
+ if (m_aNoneCursor != None)
+ XFreeCursor(m_pDisplay, m_aNoneCursor);
+
+ // paranoia setting, the drag thread should have
+ // done that already
+ XUngrabPointer( m_pDisplay, CurrentTime );
+ XUngrabKeyboard( m_pDisplay, CurrentTime );
+
+ XCloseDisplay( m_pDisplay );
}
SelectionAdaptor* SelectionManager::getAdaptor( Atom selection )
@@ -2919,44 +2919,44 @@ bool SelectionManager::handleDragEvent( XEvent const & rMessage )
void SelectionManager::accept( sal_Int8 dragOperation, ::Window aDropWindow )
{
- if( aDropWindow == m_aCurrentDropWindow )
- {
+ if( aDropWindow != m_aCurrentDropWindow )
+ return;
+
#if OSL_DEBUG_LEVEL > 1
- SAL_INFO("vcl.unx.dtrans", "accept: " << std::hex << dragOperation);
+ SAL_INFO("vcl.unx.dtrans", "accept: " << std::hex << dragOperation);
#endif
- Atom nAction = None;
- dragOperation &= (DNDConstants::ACTION_MOVE | DNDConstants::ACTION_COPY | DNDConstants::ACTION_LINK);
- if( dragOperation & DNDConstants::ACTION_MOVE )
- nAction = m_nXdndActionMove;
- else if( dragOperation & DNDConstants::ACTION_COPY )
- nAction = m_nXdndActionCopy;
- else if( dragOperation & DNDConstants::ACTION_LINK )
- nAction = m_nXdndActionLink;
- m_bLastDropAccepted = true;
- sendDragStatus( nAction );
- }
+ Atom nAction = None;
+ dragOperation &= (DNDConstants::ACTION_MOVE | DNDConstants::ACTION_COPY | DNDConstants::ACTION_LINK);
+ if( dragOperation & DNDConstants::ACTION_MOVE )
+ nAction = m_nXdndActionMove;
+ else if( dragOperation & DNDConstants::ACTION_COPY )
+ nAction = m_nXdndActionCopy;
+ else if( dragOperation & DNDConstants::ACTION_LINK )
+ nAction = m_nXdndActionLink;
+ m_bLastDropAccepted = true;
+ sendDragStatus( nAction );
}
void SelectionManager::reject( ::Window aDropWindow )
{
- if( aDropWindow == m_aCurrentDropWindow )
- {
+ if( aDropWindow != m_aCurrentDropWindow )
+ return;
+
#if OSL_DEBUG_LEVEL > 1
- SAL_INFO("vcl.unx.dtrans", "reject.");
+ SAL_INFO("vcl.unx.dtrans", "reject.");
#endif
- m_bLastDropAccepted = false;
- sendDragStatus( None );
- if( m_bDropSent && m_xDragSourceListener.is() )
- {
- DragSourceDropEvent dsde;
- dsde.Source = static_cast< OWeakObject* >(this);
- dsde.DragSourceContext = new DragSourceContext( m_aDropWindow, *this );
- dsde.DragSource = static_cast< XDragSource* >(this);
- dsde.DropAction = DNDConstants::ACTION_NONE;
- dsde.DropSuccess = false;
- m_xDragSourceListener->dragDropEnd( dsde );
- m_xDragSourceListener.clear();
- }
+ m_bLastDropAccepted = false;
+ sendDragStatus( None );
+ if( m_bDropSent && m_xDragSourceListener.is() )
+ {
+ DragSourceDropEvent dsde;
+ dsde.Source = static_cast< OWeakObject* >(this);
+ dsde.DragSourceContext = new DragSourceContext( m_aDropWindow, *this );
+ dsde.DragSource = static_cast< XDragSource* >(this);
+ dsde.DropAction = DNDConstants::ACTION_NONE;
+ dsde.DropSuccess = false;
+ m_xDragSourceListener->dragDropEnd( dsde );
+ m_xDragSourceListener.clear();
}
}
diff --git a/vcl/unx/generic/dtrans/bmp.cxx b/vcl/unx/generic/dtrans/bmp.cxx
index 7f0111a614e4..0b5f6f85c236 100644
--- a/vcl/unx/generic/dtrans/bmp.cxx
+++ b/vcl/unx/generic/dtrans/bmp.cxx
@@ -401,20 +401,20 @@ PixmapHolder::PixmapHolder( Display* pDisplay )
<< std::showbase << std::hex
<< m_aColormap);
#endif
- if( m_aInfo.c_class == TrueColor )
- {
- int nRedShift2(0);
- int nGreenShift2(0);
- int nBlueShift2(0);
- int nRedSig, nGreenSig, nBlueSig;
- getShift( m_aInfo.red_mask, m_nRedShift, nRedSig, nRedShift2 );
- getShift( m_aInfo.green_mask, m_nGreenShift, nGreenSig, nGreenShift2 );
- getShift( m_aInfo.blue_mask, m_nBlueShift, nBlueSig, nBlueShift2 );
-
- m_nBlueShift2Mask = nBlueShift2 ? ~static_cast<unsigned long>((1<<nBlueShift2)-1) : ~0L;
- m_nGreenShift2Mask = nGreenShift2 ? ~static_cast<unsigned long>((1<<nGreenShift2)-1) : ~0L;
- m_nRedShift2Mask = nRedShift2 ? ~static_cast<unsigned long>((1<<nRedShift2)-1) : ~0L;
- }
+ if( m_aInfo.c_class != TrueColor )
+ return;
+
+ int nRedShift2(0);
+ int nGreenShift2(0);
+ int nBlueShift2(0);
+ int nRedSig, nGreenSig, nBlueSig;
+ getShift( m_aInfo.red_mask, m_nRedShift, nRedSig, nRedShift2 );
+ getShift( m_aInfo.green_mask, m_nGreenShift, nGreenSig, nGreenShift2 );
+ getShift( m_aInfo.blue_mask, m_nBlueShift, nBlueSig, nBlueShift2 );
+
+ m_nBlueShift2Mask = nBlueShift2 ? ~static_cast<unsigned long>((1<<nBlueShift2)-1) : ~0L;
+ m_nGreenShift2Mask = nGreenShift2 ? ~static_cast<unsigned long>((1<<nGreenShift2)-1) : ~0L;
+ m_nRedShift2Mask = nRedShift2 ? ~static_cast<unsigned long>((1<<nRedShift2)-1) : ~0L;
}
PixmapHolder::~PixmapHolder()
diff --git a/vcl/unx/generic/fontmanager/fontconfig.cxx b/vcl/unx/generic/fontmanager/fontconfig.cxx
index dea4cd548949..d8cc1db16849 100644
--- a/vcl/unx/generic/fontmanager/fontconfig.cxx
+++ b/vcl/unx/generic/fontmanager/fontconfig.cxx
@@ -726,20 +726,20 @@ static void addtopattern(FcPattern *pPattern,
}
FcPatternAddInteger(pPattern, FC_WIDTH, nWidth);
}
- if( ePitch != PITCH_DONTKNOW )
+ if( ePitch == PITCH_DONTKNOW )
+ return;
+
+ int nSpacing = FC_PROPORTIONAL;
+ switch( ePitch )
{
- int nSpacing = FC_PROPORTIONAL;
- switch( ePitch )
- {
- case PITCH_FIXED: nSpacing = FC_MONO;break;
- case PITCH_VARIABLE: nSpacing = FC_PROPORTIONAL;break;
- default:
- break;
- }
- FcPatternAddInteger(pPattern, FC_SPACING, nSpacing);
- if (nSpacing == FC_MONO)
- FcPatternAddString(pPattern, FC_FAMILY, reinterpret_cast<FcChar8 const *>("monospace"));
+ case PITCH_FIXED: nSpacing = FC_MONO;break;
+ case PITCH_VARIABLE: nSpacing = FC_PROPORTIONAL;break;
+ default:
+ break;
}
+ FcPatternAddInteger(pPattern, FC_SPACING, nSpacing);
+ if (nSpacing == FC_MONO)
+ FcPatternAddString(pPattern, FC_FAMILY, reinterpret_cast<FcChar8 const *>("monospace"));
}
namespace
diff --git a/vcl/unx/generic/fontmanager/helper.cxx b/vcl/unx/generic/fontmanager/helper.cxx
index c28753e33b35..79b772c39d6e 100644
--- a/vcl/unx/generic/fontmanager/helper.cxx
+++ b/vcl/unx/generic/fontmanager/helper.cxx
@@ -153,20 +153,20 @@ void psp::getPrinterPathList( std::vector< OUString >& rPathList, const char* pS
}
#endif
- if( rPathList.empty() )
+ if( !rPathList.empty() )
+ return;
+
+ // last resort: next to program file (mainly for setup)
+ OUString aExe;
+ if( osl_getExecutableFile( &aExe.pData ) == osl_Process_E_None )
{
- // last resort: next to program file (mainly for setup)
- OUString aExe;
- if( osl_getExecutableFile( &aExe.pData ) == osl_Process_E_None )
+ INetURLObject aDir( aExe );
+ aDir.removeSegment();
+ aExe = aDir.GetMainURL( INetURLObject::DecodeMechanism::NONE );
+ OUString aSysPath;
+ if( osl_getSystemPathFromFileURL( aExe.pData, &aSysPath.pData ) == osl_File_E_None )
{
- INetURLObject aDir( aExe );
- aDir.removeSegment();
- aExe = aDir.GetMainURL( INetURLObject::DecodeMechanism::NONE );
- OUString aSysPath;
- if( osl_getSystemPathFromFileURL( aExe.pData, &aSysPath.pData ) == osl_File_E_None )
- {
- rPathList.push_back( aSysPath );
- }
+ rPathList.push_back( aSysPath );
}
}
}
diff --git a/vcl/unx/generic/gdi/gdiimpl.cxx b/vcl/unx/generic/gdi/gdiimpl.cxx
index 6310b6ba99fa..a348b752dc89 100644
--- a/vcl/unx/generic/gdi/gdiimpl.cxx
+++ b/vcl/unx/generic/gdi/gdiimpl.cxx
@@ -102,19 +102,20 @@ namespace
//fdo#33455 and fdo#80160 handle 1 bit depth pngs with palette entries
//to set fore/back colors
SalBitmap& rBitmap = const_cast<SalBitmap&>(rSalBitmap);
- if (BitmapBuffer* pBitmapBuffer = rBitmap.AcquireBuffer(BitmapAccessMode::Read))
+ BitmapBuffer* pBitmapBuffer = rBitmap.AcquireBuffer(BitmapAccessMode::Read);
+ if (!pBitmapBuffer)
+ return;
+
+ const BitmapPalette& rPalette = pBitmapBuffer->maPalette;
+ if (rPalette.GetEntryCount() == 2)
{
- const BitmapPalette& rPalette = pBitmapBuffer->maPalette;
- if (rPalette.GetEntryCount() == 2)
- {
- const BitmapColor aWhite(rPalette[rPalette.GetBestIndex(COL_WHITE)]);
- rValues.foreground = rColMap.GetPixel(aWhite);
+ const BitmapColor aWhite(rPalette[rPalette.GetBestIndex(COL_WHITE)]);
+ rValues.foreground = rColMap.GetPixel(aWhite);
- const BitmapColor aBlack(rPalette[rPalette.GetBestIndex(COL_BLACK)]);
- rValues.background = rColMap.GetPixel(aBlack);
- }
- rBitmap.ReleaseBuffer(pBitmapBuffer, BitmapAccessMode::Read);
+ const BitmapColor aBlack(rPalette[rPalette.GetBestIndex(COL_BLACK)]);
+ rValues.background = rColMap.GetPixel(aBlack);
}
+ rBitmap.ReleaseBuffer(pBitmapBuffer, BitmapAccessMode::Read);
}
}
@@ -925,19 +926,19 @@ void X11SalGraphicsImpl::drawMask( const SalTwoRect& rPosAry,
void X11SalGraphicsImpl::ResetClipRegion()
{
- if( mrParent.mpClipRegion )
- {
- mbPenGC = false;
- mbBrushGC = false;
- mbCopyGC = false;
- mbInvertGC = false;
- mbInvert50GC = false;
- mbStippleGC = false;
- mbTrackingGC = false;
+ if( !mrParent.mpClipRegion )
+ return;
- XDestroyRegion( mrParent.mpClipRegion );
- mrParent.mpClipRegion = nullptr;
- }
+ mbPenGC = false;
+ mbBrushGC = false;
+ mbCopyGC = false;
+ mbInvertGC = false;
+ mbInvert50GC = false;
+ mbStippleGC = false;
+ mbTrackingGC = false;
+
+ XDestroyRegion( mrParent.mpClipRegion );
+ mrParent.mpClipRegion = nullptr;
}
bool X11SalGraphicsImpl::setClipRegion( const vcl::Region& i_rClip )
@@ -1036,32 +1037,32 @@ void X11SalGraphicsImpl::SetFillColor()
void X11SalGraphicsImpl::SetFillColor( Color nColor )
{
- if( mnBrushColor != nColor )
- {
- mbDitherBrush = false;
- mnBrushColor = nColor;
- mnBrushPixel = mrParent.GetPixel( nColor );
- if( TrueColor != mrParent.GetColormap().GetVisual().GetClass()
- && mrParent.GetColormap().GetColor( mnBrushPixel ) != mnBrushColor
- && nColor != Color( 0x00, 0x00, 0x00 ) // black
- && nColor != Color( 0x00, 0x00, 0x80 ) // blue
- && nColor != Color( 0x00, 0x80, 0x00 ) // green
- && nColor != Color( 0x00, 0x80, 0x80 ) // cyan
- && nColor != Color( 0x80, 0x00, 0x00 ) // red
- && nColor != Color( 0x80, 0x00, 0x80 ) // magenta
- && nColor != Color( 0x80, 0x80, 0x00 ) // brown
- && nColor != Color( 0x80, 0x80, 0x80 ) // gray
- && nColor != Color( 0xC0, 0xC0, 0xC0 ) // light gray
- && nColor != Color( 0x00, 0x00, 0xFF ) // light blue
- && nColor != Color( 0x00, 0xFF, 0x00 ) // light green
- && nColor != Color( 0x00, 0xFF, 0xFF ) // light cyan
- && nColor != Color( 0xFF, 0x00, 0x00 ) // light red
- && nColor != Color( 0xFF, 0x00, 0xFF ) // light magenta
- && nColor != Color( 0xFF, 0xFF, 0x00 ) // light brown
- && nColor != Color( 0xFF, 0xFF, 0xFF ) )
- mbDitherBrush = mrParent.GetDitherPixmap(nColor);
- mbBrushGC = false;
- }
+ if( mnBrushColor == nColor )
+ return;
+
+ mbDitherBrush = false;
+ mnBrushColor = nColor;
+ mnBrushPixel = mrParent.GetPixel( nColor );
+ if( TrueColor != mrParent.GetColormap().GetVisual().GetClass()
+ && mrParent.GetColormap().GetColor( mnBrushPixel ) != mnBrushColor
+ && nColor != Color( 0x00, 0x00, 0x00 ) // black
+ && nColor != Color( 0x00, 0x00, 0x80 ) // blue
+ && nColor != Color( 0x00, 0x80, 0x00 ) // green
+ && nColor != Color( 0x00, 0x80, 0x80 ) // cyan
+ && nColor != Color( 0x80, 0x00, 0x00 ) // red
+ && nColor != Color( 0x80, 0x00, 0x80 ) // magenta
+ && nColor != Color( 0x80, 0x80, 0x00 ) // brown
+ && nColor != Color( 0x80, 0x80, 0x80 ) // gray
+ && nColor != Color( 0xC0, 0xC0, 0xC0 ) // light gray
+ && nColor != Color( 0x00, 0x00, 0xFF ) // light blue
+ && nColor != Color( 0x00, 0xFF, 0x00 ) // light green
+ && nColor != Color( 0x00, 0xFF, 0xFF ) // light cyan
+ && nColor != Color( 0xFF, 0x00, 0x00 ) // light red
+ && nColor != Color( 0xFF, 0x00, 0xFF ) // light magenta
+ && nColor != Color( 0xFF, 0xFF, 0x00 ) // light brown
+ && nColor != Color( 0xFF, 0xFF, 0xFF ) )
+ mbDitherBrush = mrParent.GetDitherPixmap(nColor);
+ mbBrushGC = false;
}
void X11SalGraphicsImpl::SetROPLineColor( SalROPColor nROPColor )
@@ -1124,29 +1125,29 @@ void X11SalGraphicsImpl::drawPixel( long nX, long nY )
void X11SalGraphicsImpl::drawPixel( long nX, long nY, Color nColor )
{
- if( nColor != SALCOLOR_NONE )
- {
- Display *pDisplay = mrParent.GetXDisplay();
+ if( nColor == SALCOLOR_NONE )
+ return;
- if( (mnPenColor == SALCOLOR_NONE) && !mbPenGC )
- {
- SetLineColor( nColor );
- XDrawPoint( pDisplay, mrParent.GetDrawable(), SelectPen(), nX, nY );
- mnPenColor = SALCOLOR_NONE;
- mbPenGC = False;
- }
- else
- {
- GC pGC = SelectPen();
+ Display *pDisplay = mrParent.GetXDisplay();
+
+ if( (mnPenColor == SALCOLOR_NONE) && !mbPenGC )
+ {
+ SetLineColor( nColor );
+ XDrawPoint( pDisplay, mrParent.GetDrawable(), SelectPen(), nX, nY );
+ mnPenColor = SALCOLOR_NONE;
+ mbPenGC = False;
+ }
+ else
+ {
+ GC pGC = SelectPen();
- if( nColor != mnPenColor )
- XSetForeground( pDisplay, pGC, mrParent.GetPixel( nColor ) );
+ if( nColor != mnPenColor )
+ XSetForeground( pDisplay, pGC, mrParent.GetPixel( nColor ) );
- XDrawPoint( pDisplay, mrParent.GetDrawable(), pGC, nX, nY );
+ XDrawPoint( pDisplay, mrParent.GetDrawable(), pGC, nX, nY );
- if( nColor != mnPenColor )
- XSetForeground( pDisplay, pGC, mnPenPixel );
- }
+ if( nColor != mnPenColor )
+ XSetForeground( pDisplay, pGC, mnPenPixel );
}
}
diff --git a/vcl/unx/generic/gdi/salbmp.cxx b/vcl/unx/generic/gdi/salbmp.cxx
index 01a5e7637827..b0a3f3cfcab0 100644
--- a/vcl/unx/generic/gdi/salbmp.cxx
+++ b/vcl/unx/generic/gdi/salbmp.cxx
@@ -852,25 +852,26 @@ ImplSalDDB::ImplSalDDB( XImage* pImage, Drawable aDrawable,
SalDisplay* pSalDisp = vcl_sal::getSalDisplay(GetGenericUnixSalData());
Display* pXDisp = pSalDisp->GetDisplay();
- if( (maPixmap = limitXCreatePixmap( pXDisp, aDrawable, ImplGetWidth(), ImplGetHeight(), ImplGetDepth() )) )
- {
- XGCValues aValues;
- GC aGC;
- int nValues = GCFunction;
+ maPixmap = limitXCreatePixmap( pXDisp, aDrawable, ImplGetWidth(), ImplGetHeight(), ImplGetDepth() );
+ if (!maPixmap)
+ return;
- aValues.function = GXcopy;
+ XGCValues aValues;
+ GC aGC;
+ int nValues = GCFunction;
- if( 1 == mnDepth )
- {
- nValues |= ( GCForeground | GCBackground );
- aValues.foreground = 1;
- aValues.background = 0;
- }
+ aValues.function = GXcopy;
- aGC = XCreateGC( pXDisp, maPixmap, nValues, &aValues );
- XPutImage( pXDisp, maPixmap, aGC, pImage, 0, 0, 0, 0, maTwoRect.mnDestWidth, maTwoRect.mnDestHeight );
- XFreeGC( pXDisp, aGC );
+ if( 1 == mnDepth )
+ {
+ nValues |= ( GCForeground | GCBackground );
+ aValues.foreground = 1;
+ aValues.background = 0;
}
+
+ aGC = XCreateGC( pXDisp, maPixmap, nValues, &aValues );
+ XPutImage( pXDisp, maPixmap, aGC, pImage, 0, 0, 0, 0, maTwoRect.mnDestWidth, maTwoRect.mnDestHeight );
+ XFreeGC( pXDisp, aGC );
}
ImplSalDDB::ImplSalDDB(
diff --git a/vcl/unx/generic/gdi/salgdi.cxx b/vcl/unx/generic/gdi/salgdi.cxx
index 3ecbe013a88d..4b2632087e7d 100644
--- a/vcl/unx/generic/gdi/salgdi.cxx
+++ b/vcl/unx/generic/gdi/salgdi.cxx
@@ -320,20 +320,20 @@ void X11SalGraphics::GetResolution( sal_Int32 &rDPIX, sal_Int32 &rDPIY ) // cons
}
// #i12705# equalize x- and y-resolution if they are close enough
- if( rDPIX != rDPIY )
- {
- // different x- and y- resolutions are usually artifacts of
- // a wrongly calculated screen size.
+ if( rDPIX == rDPIY )
+ return;
+
+ // different x- and y- resolutions are usually artifacts of
+ // a wrongly calculated screen size.
#ifdef DEBUG
- SAL_INFO("vcl.gdi", "Forcing Resolution from "
- << std::hex << rDPIX
- << std::dec << rDPIX
- << " to "
- << std::hex << rDPIY
- << std::dec << rDPIY);
+ SAL_INFO("vcl.gdi", "Forcing Resolution from "
+ << std::hex << rDPIX
+ << std::dec << rDPIX
+ << " to "
+ << std::hex << rDPIY
+ << std::dec << rDPIY);
#endif
- rDPIX = rDPIY; // y-resolution is more trustworthy
- }
+ rDPIX = rDPIY; // y-resolution is more trustworthy
}
sal_uInt16 X11SalGraphics::GetBitCount() const
diff --git a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx
index 885978ed1889..9ddf206572ac 100644
--- a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx
+++ b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx
@@ -203,25 +203,25 @@ FT_FaceRec_* FreetypeFontInfo::GetFaceFT()
void FreetypeFont::SetFontVariationsOnHBFont(hb_font_t* pHbFace) const
{
sal_uInt32 nFaceVariation = mxFontInfo->GetFontFaceVariation();
- if (maFaceFT && nFaceVariation)
+ if (!(maFaceFT && nFaceVariation))
+ return;
+
+ FT_MM_Var *pFtMMVar;
+ if (FT_Get_MM_Var(maFaceFT, &pFtMMVar) != 0)
+ return;
+
+ if (nFaceVariation <= pFtMMVar->num_namedstyles)
{
- FT_MM_Var *pFtMMVar;
- if (FT_Get_MM_Var(maFaceFT, &pFtMMVar) == 0)
+ FT_Var_Named_Style *instance = &pFtMMVar->namedstyle[nFaceVariation - 1];
+ std::vector<hb_variation_t> aVariations(pFtMMVar->num_axis);
+ for (FT_UInt i = 0; i < pFtMMVar->num_axis; ++i)
{
- if (nFaceVariation <= pFtMMVar->num_namedstyles)
- {
- FT_Var_Named_Style *instance = &pFtMMVar->namedstyle[nFaceVariation - 1];
- std::vector<hb_variation_t> aVariations(pFtMMVar->num_axis);
- for (FT_UInt i = 0; i < pFtMMVar->num_axis; ++i)
- {
- aVariations[i].tag = pFtMMVar->axis[i].tag;
- aVariations[i].value = instance->coords[i] / 65536.0;
- }
- hb_font_set_variations(pHbFace, aVariations.data(), aVariations.size());
- }
- dlFT_Done_MM_Var(aLibFT, pFtMMVar);
+ aVariations[i].tag = pFtMMVar->axis[i].tag;
+ aVariations[i].value = instance->coords[i] / 65536.0;
}
+ hb_font_set_variations(pHbFace, aVariations.data(), aVariations.size());
}
+ dlFT_Done_MM_Var(aLibFT, pFtMMVar);
}
void FreetypeFontInfo::ReleaseFaceFT()
diff --git a/vcl/unx/generic/print/common_gfx.cxx b/vcl/unx/generic/print/common_gfx.cxx
index b6c92e49c84a..3938dfdebbea 100644
--- a/vcl/unx/generic/print/common_gfx.cxx
+++ b/vcl/unx/generic/print/common_gfx.cxx
@@ -476,49 +476,49 @@ PrinterGfx::DrawPolyLineBezier (sal_uInt32 nPoints, const Point* pPath, const Po
const sal_uInt32 nBezString= 1024;
char pString[nBezString];
- if ( nPoints > 1 && maLineColor.Is() && pPath )
- {
- PSSetColor (maLineColor);
- PSSetColor ();
- PSSetLineWidth ();
+ if ( nPoints <= 1 || !maLineColor.Is() || !pPath )
+ return;
- snprintf(pString, nBezString, "%li %li moveto\n", pPath[0].X(), pPath[0].Y());
- WritePS(mpPageBody, pString);
+ PSSetColor (maLineColor);
+ PSSetColor ();
+ PSSetLineWidth ();
+
+ snprintf(pString, nBezString, "%li %li moveto\n", pPath[0].X(), pPath[0].Y());
+ WritePS(mpPageBody, pString);
- // Handle the drawing of mixed lines mixed with curves
- // - a normal point followed by a normal point is a line
- // - a normal point followed by 2 control points and a normal point is a curve
- for (unsigned int i=1; i<nPoints;)
+ // Handle the drawing of mixed lines mixed with curves
+ // - a normal point followed by a normal point is a line
+ // - a normal point followed by 2 control points and a normal point is a curve
+ for (unsigned int i=1; i<nPoints;)
+ {
+ if (pFlgAry[i] != PolyFlags::Control) //If the next point is a PolyFlags::Normal, we're drawing a line
+ {
+ snprintf(pString, nBezString, "%li %li lineto\n", pPath[i].X(), pPath[i].Y());
+ i++;
+ }
+ else //Otherwise we're drawing a spline
{
- if (pFlgAry[i] != PolyFlags::Control) //If the next point is a PolyFlags::Normal, we're drawing a line
+ if (i+2 >= nPoints)
+ return; //Error: wrong sequence of control/normal points somehow
+ if ((pFlgAry[i] == PolyFlags::Control) && (pFlgAry[i+1] == PolyFlags::Control) &&
+ (pFlgAry[i+2] != PolyFlags::Control))
{
- snprintf(pString, nBezString, "%li %li lineto\n", pPath[i].X(), pPath[i].Y());
- i++;
+ snprintf(pString, nBezString, "%li %li %li %li %li %li curveto\n",
+ pPath[i].X(), pPath[i].Y(),
+ pPath[i+1].X(), pPath[i+1].Y(),
+ pPath[i+2].X(), pPath[i+2].Y());
}
- else //Otherwise we're drawing a spline
+ else
{
- if (i+2 >= nPoints)
- return; //Error: wrong sequence of control/normal points somehow
- if ((pFlgAry[i] == PolyFlags::Control) && (pFlgAry[i+1] == PolyFlags::Control) &&
- (pFlgAry[i+2] != PolyFlags::Control))
- {
- snprintf(pString, nBezString, "%li %li %li %li %li %li curveto\n",
- pPath[i].X(), pPath[i].Y(),
- pPath[i+1].X(), pPath[i+1].Y(),
- pPath[i+2].X(), pPath[i+2].Y());
- }
- else
- {
- OSL_FAIL( "PrinterGfx::DrawPolyLineBezier: Strange output" );
- }
- i+=3;
+ OSL_FAIL( "PrinterGfx::DrawPolyLineBezier: Strange output" );
}
- WritePS(mpPageBody, pString);
+ i+=3;
}
-
- // now draw outlines
- WritePS (mpPageBody, "stroke\n");
+ WritePS(mpPageBody, pString);
}
+
+ // now draw outlines
+ WritePS (mpPageBody, "stroke\n");
}
void
@@ -683,34 +683,34 @@ PrinterGfx::PSSetColor ()
{
PrinterColor& rColor( maVirtualStatus.maColor );
- if( currentState().maColor != rColor )
- {
- currentState().maColor = rColor;
+ if( currentState().maColor == rColor )
+ return;
- OStringBuffer pBuffer;
+ currentState().maColor = rColor;
- if( mbColor )
- {
- psp::getValueOfDouble (pBuffer,
- static_cast<double>(rColor.GetRed()) / 255.0, 5);
- psp::appendStr (" ", pBuffer);
- psp::getValueOfDouble (pBuffer,
- static_cast<double>(rColor.GetGreen()) / 255.0, 5);
- psp::appendStr (" ", pBuffer);
- psp::getValueOfDouble (pBuffer,
- static_cast<double>(rColor.GetBlue()) / 255.0, 5);
- psp::appendStr (" setrgbcolor\n", pBuffer );
- }
- else
- {
- Color aColor( rColor.GetRed(), rColor.GetGreen(), rColor.GetBlue() );
- sal_uInt8 nCol = aColor.GetLuminance();
- psp::getValueOfDouble( pBuffer, static_cast<double>(nCol) / 255.0, 5 );
- psp::appendStr( " setgray\n", pBuffer );
- }
+ OStringBuffer pBuffer;
- WritePS (mpPageBody, pBuffer.makeStringAndClear());
+ if( mbColor )
+ {
+ psp::getValueOfDouble (pBuffer,
+ static_cast<double>(rColor.GetRed()) / 255.0, 5);
+ psp::appendStr (" ", pBuffer);
+ psp::getValueOfDouble (pBuffer,
+ static_cast<double>(rColor.GetGreen()) / 255.0, 5);
+ psp::appendStr (" ", pBuffer);
+ psp::getValueOfDouble (pBuffer,
+ static_cast<double>(rColor.GetBlue()) / 255.0, 5);
+ psp::appendStr (" setrgbcolor\n", pBuffer );
}
+ else
+ {
+ Color aColor( rColor.GetRed(), rColor.GetGreen(), rColor.GetBlue() );
+ sal_uInt8 nCol = aColor.GetLuminance();
+ psp::getValueOfDouble( pBuffer, static_cast<double>(nCol) / 255.0, 5 );
+ psp::appendStr( " setgray\n", pBuffer );
+ }
+
+ WritePS (mpPageBody, pBuffer.makeStringAndClear());
}
void
diff --git a/vcl/unx/generic/print/genprnpsp.cxx b/vcl/unx/generic/print/genprnpsp.cxx
index 5cfb5dcb7e11..18caa2e8f413 100644
--- a/vcl/unx/generic/print/genprnpsp.cxx
+++ b/vcl/unx/generic/print/genprnpsp.cxx
@@ -352,22 +352,22 @@ static bool createPdf( const OUString& rToFile, const OUString& rFromFile, const
void SalGenericInstance::configurePspInfoPrinter(PspSalInfoPrinter *pPrinter,
SalPrinterQueueInfo const * pQueueInfo, ImplJobSetup* pJobSetup)
{
- if( pJobSetup )
- {
- PrinterInfoManager& rManager( PrinterInfoManager::get() );
- PrinterInfo aInfo( rManager.getPrinterInfo( pQueueInfo->maPrinterName ) );
- pPrinter->m_aJobData = aInfo;
- pPrinter->m_aPrinterGfx.Init( pPrinter->m_aJobData );
-
- if( pJobSetup->GetDriverData() )
- JobData::constructFromStreamBuffer( pJobSetup->GetDriverData(),
- pJobSetup->GetDriverDataLen(), aInfo );
-
- pJobSetup->SetSystem( JOBSETUP_SYSTEM_UNIX );
- pJobSetup->SetPrinterName( pQueueInfo->maPrinterName );
- pJobSetup->SetDriver( aInfo.m_aDriverName );
- copyJobDataToJobSetup( pJobSetup, aInfo );
- }
+ if( !pJobSetup )
+ return;
+
+ PrinterInfoManager& rManager( PrinterInfoManager::get() );
+ PrinterInfo aInfo( rManager.getPrinterInfo( pQueueInfo->maPrinterName ) );
+ pPrinter->m_aJobData = aInfo;
+ pPrinter->m_aPrinterGfx.Init( pPrinter->m_aJobData );
+
+ if( pJobSetup->GetDriverData() )
+ JobData::constructFromStreamBuffer( pJobSetup->GetDriverData(),
+ pJobSetup->GetDriverDataLen(), aInfo );
+
+ pJobSetup->SetSystem( JOBSETUP_SYSTEM_UNIX );
+ pJobSetup->SetPrinterName( pQueueInfo->maPrinterName );
+ pJobSetup->SetDriver( aInfo.m_aDriverName );
+ copyJobDataToJobSetup( pJobSetup, aInfo );
}
SalInfoPrinter* SalGenericInstance::CreateInfoPrinter( SalPrinterQueueInfo* pQueueInfo,
@@ -451,20 +451,20 @@ void PspSalInfoPrinter::InitPaperFormats( const ImplJobSetup* )
m_aPaperFormats.clear();
m_bPapersInit = true;
- if( m_aJobData.m_pParser )
+ if( !m_aJobData.m_pParser )
+ return;
+
+ const PPDKey* pKey = m_aJobData.m_pParser->getKey( "PageSize" );
+ if( pKey )
{
- const PPDKey* pKey = m_aJobData.m_pParser->getKey( "PageSize" );
- if( pKey )
+ int nValues = pKey->countValues();
+ for( int i = 0; i < nValues; i++ )
{
- int nValues = pKey->countValues();
- for( int i = 0; i < nValues; i++ )
- {
- const PPDValue* pValue = pKey->getValue( i );
- int nWidth = 0, nHeight = 0;
- m_aJobData.m_pParser->getPaperDimension( pValue->m_aOption, nWidth, nHeight );
- PaperInfo aInfo(PtTo10Mu( nWidth ), PtTo10Mu( nHeight ));
- m_aPaperFormats.push_back( aInfo );
- }
+ const PPDValue* pValue = pKey->getValue( i );
+ int nWidth = 0, nHeight = 0;
+ m_aJobData.m_pParser->getPaperDimension( pValue->m_aOption, nWidth, nHeight );
+ PaperInfo aInfo(PtTo10Mu( nWidth ), PtTo10Mu( nHeight ));
+ m_aPaperFormats.push_back( aInfo );
}
}
}
diff --git a/vcl/unx/generic/print/prtsetup.cxx b/vcl/unx/generic/print/prtsetup.cxx
index fae6a155220e..5ad90b7b878e 100644
--- a/vcl/unx/generic/print/prtsetup.cxx
+++ b/vcl/unx/generic/print/prtsetup.cxx
@@ -199,21 +199,21 @@ void RTSPaperPage::update()
m_xSlotBox->set_sensitive( false );
}
- if ( m_pParent->m_aJobData.meSetupMode == PrinterSetupMode::SingleJob )
- {
- m_xCbFromSetup->show();
+ if ( m_pParent->m_aJobData.meSetupMode != PrinterSetupMode::SingleJob )
+ return;
- if ( m_pParent->m_aJobData.m_bPapersizeFromSetup )
- m_xCbFromSetup->set_active(m_pParent->m_aJobData.m_bPapersizeFromSetup);
- // disable those, unless user wants to use papersize from printer prefs
- // as they have no influence on what's going to be printed anyway
- else
- {
- m_xPaperText->set_sensitive( false );
- m_xPaperBox->set_sensitive( false );
- m_xOrientText->set_sensitive( false );
- m_xOrientBox->set_sensitive( false );
- }
+ m_xCbFromSetup->show();
+
+ if ( m_pParent->m_aJobData.m_bPapersizeFromSetup )
+ m_xCbFromSetup->set_active(m_pParent->m_aJobData.m_bPapersizeFromSetup);
+ // disable those, unless user wants to use papersize from printer prefs
+ // as they have no influence on what's going to be printed anyway
+ else
+ {
+ m_xPaperText->set_sensitive( false );
+ m_xPaperBox->set_sensitive( false );
+ m_xOrientText->set_sensitive( false );
+ m_xOrientBox->set_sensitive( false );
}
}
@@ -335,28 +335,28 @@ RTSDevicePage::RTSDevicePage(weld::Widget* pPage, RTSDialog* pParent)
m_xDepthBox->set_active(1);
// fill ppd boxes
- if( m_pParent->m_aJobData.m_pParser )
+ if( !m_pParent->m_aJobData.m_pParser )
+ return;
+
+ for( int i = 0; i < m_pParent->m_aJobData.m_pParser->getKeys(); i++ )
{
- for( int i = 0; i < m_pParent->m_aJobData.m_pParser->getKeys(); i++ )
+ const PPDKey* pKey = m_pParent->m_aJobData.m_pParser->getKey( i );
+
+ // skip options already shown somewhere else
+ // also skip options from the "InstallableOptions" PPD group
+ // Options in that group define hardware features that are not
+ // job-specific and should better be handled in the system-wide
+ // printer configuration. Keyword is defined in PPD specification
+ // (version 4.3), section 5.4.
+ if( pKey->isUIKey() &&
+ pKey->getKey() != "PageSize" &&
+ pKey->getKey() != "InputSlot" &&
+ pKey->getKey() != "PageRegion" &&
+ pKey->getKey() != "Duplex" &&
+ pKey->getGroup() != "InstallableOptions")
{
- const PPDKey* pKey = m_pParent->m_aJobData.m_pParser->getKey( i );
-
- // skip options already shown somewhere else
- // also skip options from the "InstallableOptions" PPD group
- // Options in that group define hardware features that are not
- // job-specific and should better be handled in the system-wide
- // printer configuration. Keyword is defined in PPD specification
- // (version 4.3), section 5.4.
- if( pKey->isUIKey() &&
- pKey->getKey() != "PageSize" &&
- pKey->getKey() != "InputSlot" &&
- pKey->getKey() != "PageRegion" &&
- pKey->getKey() != "Duplex" &&
- pKey->getGroup() != "InstallableOptions")
- {
- OUString aEntry( m_pParent->m_aJobData.m_pParser->translateKey( pKey->getKey() ) );
- m_xPPDKeyBox->append(OUString::number(reinterpret_cast<sal_Int64>(pKey)), aEntry);
- }
+ OUString aEntry( m_pParent->m_aJobData.m_pParser->translateKey( pKey->getKey() ) );
+ m_xPPDKeyBox->append(OUString::number(reinterpret_cast<sal_Int64>(pKey)), aEntry);
}
}
}
diff --git a/vcl/unx/generic/printer/cupsmgr.cxx b/vcl/unx/generic/printer/cupsmgr.cxx
index f5a50345a210..dbbb26666ba5 100644
--- a/vcl/unx/generic/printer/cupsmgr.cxx
+++ b/vcl/unx/generic/printer/cupsmgr.cxx
@@ -235,19 +235,19 @@ void CUPSManager::runDests()
if( (p_http=httpConnectEncrypt(
cupsServer(),
ippPort(),
- cupsEncryption())) != nullptr )
- {
- int nDests = cupsGetDests2(p_http, &pDests);
- SAL_INFO("vcl.unx.print", "came out of cupsGetDests");
+ cupsEncryption())) == nullptr )
+ return;
- osl::MutexGuard aGuard( m_aCUPSMutex );
- m_nDests = nDests;
- m_pDests = pDests;
- m_bNewDests = true;
- SAL_INFO("vcl.unx.print", "finished cupsGetDests");
+ int nDests = cupsGetDests2(p_http, &pDests);
+ SAL_INFO("vcl.unx.print", "came out of cupsGetDests");
- httpClose(p_http);
- }
+ osl::MutexGuard aGuard( m_aCUPSMutex );
+ m_nDests = nDests;
+ m_pDests = pDests;
+ m_bNewDests = true;
+ SAL_INFO("vcl.unx.print", "finished cupsGetDests");
+
+ httpClose(p_http);
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
diff --git a/vcl/unx/generic/printer/jobdata.cxx b/vcl/unx/generic/printer/jobdata.cxx
index 362305beac11..5bbeceba0036 100644
--- a/vcl/unx/generic/printer/jobdata.cxx
+++ b/vcl/unx/generic/printer/jobdata.cxx
@@ -64,23 +64,23 @@ void JobData::setCollate( bool bCollate )
return;
}
const PPDParser* pParser = m_aContext.getParser();
- if( pParser )
+ if( !pParser )
+ return;
+
+ const PPDKey* pKey = pParser->getKey( "Collate" );
+ if( !pKey )
+ return;
+
+ const PPDValue* pVal = nullptr;
+ if( bCollate )
+ pVal = pKey->getValue( "True" );
+ else
{
- const PPDKey* pKey = pParser->getKey( "Collate" );
- if( pKey )
- {
- const PPDValue* pVal = nullptr;
- if( bCollate )
- pVal = pKey->getValue( "True" );
- else
- {
- pVal = pKey->getValue( "False" );
- if( ! pVal )
- pVal = pKey->getValue( "None" );
- }
- m_aContext.setValue( pKey, pVal );
- }
+ pVal = pKey->getValue( "False" );
+ if( ! pVal )
+ pVal = pKey->getValue( "None" );
}
+ m_aContext.setValue( pKey, pVal );
}
void JobData::setPaper( int i_nWidth, int i_nHeight )
diff --git a/vcl/unx/generic/printer/ppdparser.cxx b/vcl/unx/generic/printer/ppdparser.cxx
index d949441db608..35d0c960cf07 100644
--- a/vcl/unx/generic/printer/ppdparser.cxx
+++ b/vcl/unx/generic/printer/ppdparser.cxx
@@ -307,27 +307,28 @@ void PPDDecompressStream::Open( const OUString& i_rFile )
mpFileStream->Seek( 0 );
// check for compress'ed or gzip'ed file
- if( aLine.getLength() > 1 && static_cast<unsigned char>(aLine[0]) == 0x1f
- && static_cast<unsigned char>(aLine[1]) == 0x8b /* check for gzip */ )
+ if( aLine.getLength() <= 1 ||
+ static_cast<unsigned char>(aLine[0]) != 0x1f ||
+ static_cast<unsigned char>(aLine[1]) != 0x8b /* check for gzip */ )
+ return;
+
+ // so let's try to decompress the stream
+ mpMemStream.reset( new SvMemoryStream( 4096, 4096 ) );
+ ZCodec aCodec;
+ aCodec.BeginCompression( ZCODEC_DEFAULT_COMPRESSION, /*gzLib*/true );
+ long nComp = aCodec.Decompress( *mpFileStream, *mpMemStream );
+ aCodec.EndCompression();
+ if( nComp < 0 )
{
- // so let's try to decompress the stream
- mpMemStream.reset( new SvMemoryStream( 4096, 4096 ) );
- ZCodec aCodec;
- aCodec.BeginCompression( ZCODEC_DEFAULT_COMPRESSION, /*gzLib*/true );
- long nComp = aCodec.Decompress( *mpFileStream, *mpMemStream );
- aCodec.EndCompression();
- if( nComp < 0 )
- {
- // decompression failed, must be an uncompressed stream after all
- mpMemStream.reset();
- mpFileStream->Seek( 0 );
- }
- else
- {
- // compression successful, can get rid of file stream
- mpFileStream.reset();
- mpMemStream->Seek( 0 );
- }
+ // decompression failed, must be an uncompressed stream after all
+ mpMemStream.reset();
+ mpFileStream->Seek( 0 );
+ }
+ else
+ {
+ // compression successful, can get rid of file stream
+ mpFileStream.reset();
+ mpMemStream->Seek( 0 );
}
}
@@ -387,49 +388,49 @@ void PPDParser::scanPPDDir( const OUString& rDir )
PPDCache &rPPDCache = thePPDCache::get();
osl::Directory aDir( rDir );
- if ( aDir.open() == osl::FileBase::E_None )
- {
- osl::DirectoryItem aItem;
+ if ( aDir.open() != osl::FileBase::E_None )
+ return;
- INetURLObject aPPDDir(rDir);
- while( aDir.getNextItem( aItem ) == osl::FileBase::E_None )
+ osl::DirectoryItem aItem;
+
+ INetURLObject aPPDDir(rDir);
+ while( aDir.getNextItem( aItem ) == osl::FileBase::E_None )
+ {
+ osl::FileStatus aStatus( osl_FileStatus_Mask_FileName );
+ if( aItem.getFileStatus( aStatus ) == osl::FileBase::E_None )
{
- osl::FileStatus aStatus( osl_FileStatus_Mask_FileName );
- if( aItem.getFileStatus( aStatus ) == osl::FileBase::E_None )
- {
- OUString aFileURL, aFileName;
- osl::FileStatus::Type eType = osl::FileStatus::Unknown;
- OUString aURL = rDir + "/" + aStatus.getFileName();
+ OUString aFileURL, aFileName;
+ osl::FileStatus::Type eType = osl::FileStatus::Unknown;
+ OUString aURL = rDir + "/" + aStatus.getFileName();
- if(resolveLink( aURL, aFileURL, aFileName, eType ) == osl::FileBase::E_None)
+ if(resolveLink( aURL, aFileURL, aFileName, eType ) == osl::FileBase::E_None)
+ {
+ if( eType == osl::FileStatus::Regular )
{
- if( eType == osl::FileStatus::Regular )
- {
- INetURLObject aPPDFile = aPPDDir;
- aPPDFile.Append( aFileName );
+ INetURLObject aPPDFile = aPPDDir;
+ aPPDFile.Append( aFileName );
- // match extension
- for(const suffix_t & rSuffix : pSuffixes)
+ // match extension
+ for(const suffix_t & rSuffix : pSuffixes)
+ {
+ if( aFileName.getLength() > rSuffix.nSuffixLen )
{
- if( aFileName.getLength() > rSuffix.nSuffixLen )
+ if( aFileName.endsWithIgnoreAsciiCaseAsciiL( rSuffix.pSuffix, rSuffix.nSuffixLen ) )
{
- if( aFileName.endsWithIgnoreAsciiCaseAsciiL( rSuffix.pSuffix, rSuffix.nSuffixLen ) )
- {
- (*rPPDCache.pAllPPDFiles)[ aFileName.copy( 0, aFileName.getLength() - rSuffix.nSuffixLen ) ] = aPPDFile.PathToFileName();
- break;
- }
+ (*rPPDCache.pAllPPDFiles)[ aFileName.copy( 0, aFileName.getLength() - rSuffix.nSuffixLen ) ] = aPPDFile.PathToFileName();
+ break;
}
}
}
- else if( eType == osl::FileStatus::Directory )
- {
- scanPPDDir( aFileURL );
- }
+ }
+ else if( eType == osl::FileStatus::Directory )
+ {
+ scanPPDDir( aFileURL );
}
}
}
- aDir.close();
}
+ aDir.close();
}
void PPDParser::initPPDFiles(PPDCache &rPPDCache)
@@ -447,21 +448,21 @@ void PPDParser::initPPDFiles(PPDCache &rPPDCache)
INetURLObject aPPDDir( path, INetProtocol::File, INetURLObject::EncodeMechanism::All );
scanPPDDir( aPPDDir.GetMainURL( INetURLObject::DecodeMechanism::NONE ) );
}
- if( rPPDCache.pAllPPDFiles->find( OUString( "SGENPRT" ) ) == rPPDCache.pAllPPDFiles->end() )
+ if( rPPDCache.pAllPPDFiles->find( OUString( "SGENPRT" ) ) != rPPDCache.pAllPPDFiles->end() )
+ return;
+
+ // last try: search in directory of executable (mainly for setup)
+ OUString aExe;
+ if( osl_getExecutableFile( &aExe.pData ) == osl_Process_E_None )
{
- // last try: search in directory of executable (mainly for setup)
- OUString aExe;
- if( osl_getExecutableFile( &aExe.pData ) == osl_Process_E_None )
- {
- INetURLObject aDir( aExe );
- aDir.removeSegment();
- SAL_INFO("vcl.unx.print", "scanning last chance dir: "
- << aDir.GetMainURL(INetURLObject::DecodeMechanism::NONE));
- scanPPDDir( aDir.GetMainURL( INetURLObject::DecodeMechanism::NONE ) );
- SAL_INFO("vcl.unx.print", "SGENPRT "
- << (rPPDCache.pAllPPDFiles->find("SGENPRT") ==
- rPPDCache.pAllPPDFiles->end() ? "not found" : "found"));
- }
+ INetURLObject aDir( aExe );
+ aDir.removeSegment();
+ SAL_INFO("vcl.unx.print", "scanning last chance dir: "
+ << aDir.GetMainURL(INetURLObject::DecodeMechanism::NONE));
+ scanPPDDir( aDir.GetMainURL( INetURLObject::DecodeMechanism::NONE ) );
+ SAL_INFO("vcl.unx.print", "SGENPRT "
+ << (rPPDCache.pAllPPDFiles->find("SGENPRT") ==
+ rPPDCache.pAllPPDFiles->end() ? "not found" : "found"));
}
}
@@ -1964,23 +1965,23 @@ void PPDContext::getPageSize( OUString& rPaper, int& rWidth, int& rHeight ) cons
rPaper = "A4";
rWidth = 595;
rHeight = 842;
- if( m_pParser )
+ if( !m_pParser )
+ return;
+
+ const PPDKey* pKey = m_pParser->getKey( "PageSize" );
+ if( !pKey )
+ return;
+
+ const PPDValue* pValue = getValue( pKey );
+ if( pValue )
{
- const PPDKey* pKey = m_pParser->getKey( "PageSize" );
- if( pKey )
- {
- const PPDValue* pValue = getValue( pKey );
- if( pValue )
- {
- rPaper = pValue->m_aOption;
- m_pParser->getPaperDimension( rPaper, rWidth, rHeight );
- }
- else
- {
- rPaper = m_pParser->getDefaultPaperDimension();
- m_pParser->getDefaultPaperDimension( rWidth, rHeight );
- }
- }
+ rPaper = pValue->m_aOption;
+ m_pParser->getPaperDimension( rPaper, rWidth, rHeight );
+ }
+ else
+ {
+ rPaper = m_pParser->getDefaultPaperDimension();
+ m_pParser->getDefaultPaperDimension( rWidth, rHeight );
}
}
diff --git a/vcl/unx/generic/window/salframe.cxx b/vcl/unx/generic/window/salframe.cxx
index f2423ed0310b..f87796f99ecd 100644
--- a/vcl/unx/generic/window/salframe.cxx
+++ b/vcl/unx/generic/window/salframe.cxx
@@ -144,20 +144,20 @@ bool X11SalFrame::IsFloatGrabWindow() const
void X11SalFrame::setXEmbedInfo()
{
- if( m_bXEmbed )
- {
- long aInfo[2];
- aInfo[0] = 1; // XEMBED protocol version
- aInfo[1] = (bMapped_ ? 1 : 0); // XEMBED_MAPPED
- XChangeProperty( pDisplay_->GetDisplay(),
- mhWindow,
- pDisplay_->getWMAdaptor()->getAtom( WMAdaptor::XEMBED_INFO ),
- pDisplay_->getWMAdaptor()->getAtom( WMAdaptor::XEMBED_INFO ),
- 32,
- PropModeReplace,
- reinterpret_cast<unsigned char*>(aInfo),
- SAL_N_ELEMENTS(aInfo) );
- }
+ if( !m_bXEmbed )
+ return;
+
+ long aInfo[2];
+ aInfo[0] = 1; // XEMBED protocol version
+ aInfo[1] = (bMapped_ ? 1 : 0); // XEMBED_MAPPED
+ XChangeProperty( pDisplay_->GetDisplay(),
+ mhWindow,
+ pDisplay_->getWMAdaptor()->getAtom( WMAdaptor::XEMBED_INFO ),
+ pDisplay_->getWMAdaptor()->getAtom( WMAdaptor::XEMBED_INFO ),
+ 32,
+ PropModeReplace,
+ reinterpret_cast<unsigned char*>(aInfo),
+ SAL_N_ELEMENTS(aInfo) );
}
void X11SalFrame::askForXEmbedFocus( sal_Int32 i_nTimeCode )
@@ -1115,50 +1115,52 @@ void X11SalFrame::SetIcon( sal_uInt16 nIcon )
void X11SalFrame::SetMaxClientSize( long nWidth, long nHeight )
{
- if( ! IsChildWindow() )
- {
- if( GetShellWindow() && (nStyle_ & (SalFrameStyleFlags::FLOAT|SalFrameStyleFlags::OWNERDRAWDECORATION) ) != SalFrameStyleFlags::FLOAT )
- {
- XSizeHints* pHints = XAllocSizeHints();
- long nSupplied = 0;
- XGetWMNormalHints( GetXDisplay(),
- GetShellWindow(),
- pHints,
- &nSupplied
- );
- pHints->max_width = nWidth;
- pHints->max_height = nHeight;
- pHints->flags |= PMaxSize;
- XSetWMNormalHints( GetXDisplay(),
- GetShellWindow(),
- pHints );
- XFree( pHints );
- }
- }
+ if( IsChildWindow() )
+ return;
+
+ if( !GetShellWindow() ||
+ (nStyle_ & (SalFrameStyleFlags::FLOAT|SalFrameStyleFlags::OWNERDRAWDECORATION) ) == SalFrameStyleFlags::FLOAT )
+ return;
+
+ XSizeHints* pHints = XAllocSizeHints();
+ long nSupplied = 0;
+ XGetWMNormalHints( GetXDisplay(),
+ GetShellWindow(),
+ pHints,
+ &nSupplied
+ );
+ pHints->max_width = nWidth;
+ pHints->max_height = nHeight;
+ pHints->flags |= PMaxSize;
+ XSetWMNormalHints( GetXDisplay(),
+ GetShellWindow(),
+ pHints );
+ XFree( pHints );
}
void X11SalFrame::SetMinClientSize( long nWidth, long nHeight )
{
- if( ! IsChildWindow() )
- {
- if( GetShellWindow() && (nStyle_ & (SalFrameStyleFlags::FLOAT|SalFrameStyleFlags::OWNERDRAWDECORATION) ) != SalFrameStyleFlags::FLOAT )
- {
- XSizeHints* pHints = XAllocSizeHints();
- long nSupplied = 0;
- XGetWMNormalHints( GetXDisplay(),
- GetShellWindow(),
- pHints,
- &nSupplied
- );
- pHints->min_width = nWidth;
- pHints->min_height = nHeight;
- pHints->flags |= PMinSize;
- XSetWMNormalHints( GetXDisplay(),
- GetShellWindow(),
- pHints );
- XFree( pHints );
- }
- }
+ if( IsChildWindow() )
+ return;
+
+ if( !GetShellWindow() ||
+ (nStyle_ & (SalFrameStyleFlags::FLOAT|SalFrameStyleFlags::OWNERDRAWDECORATION) ) == SalFrameStyleFlags::FLOAT )
+ return;
+
+ XSizeHints* pHints = XAllocSizeHints();
+ long nSupplied = 0;
+ XGetWMNormalHints( GetXDisplay(),
+ GetShellWindow(),
+ pHints,
+ &nSupplied
+ );
+ pHints->min_width = nWidth;
+ pHints->min_height = nHeight;
+ pHints->flags |= PMinSize;
+ XSetWMNormalHints( GetXDisplay(),
+ GetShellWindow(),
+ pHints );
+ XFree( pHints );
}
// Show + Pos (x,y,z) + Size (width,height)
@@ -1756,41 +1758,41 @@ void X11SalFrame::SetWindowState( const SalFrameState *pState )
}
// request for status change
- if (pState->mnMask & WindowStateMask::State)
+ if (!(pState->mnMask & WindowStateMask::State))
+ return;
+
+ if (pState->mnState & WindowStateState::Maximized)
{
- if (pState->mnState & WindowStateState::Maximized)
+ nShowState_ = SHOWSTATE_NORMAL;
+ if( ! (pState->mnState & (WindowStateState::MaximizedHorz|WindowStateState::MaximizedVert) ) )
+ Maximize();
+ else
{
- nShowState_ = SHOWSTATE_NORMAL;
- if( ! (pState->mnState & (WindowStateState::MaximizedHorz|WindowStateState::MaximizedVert) ) )
- Maximize();
- else
- {
- bool bHorz(pState->mnState & WindowStateState::MaximizedHorz);
- bool bVert(pState->mnState & WindowStateState::MaximizedVert);
- GetDisplay()->getWMAdaptor()->maximizeFrame( this, bHorz, bVert );
- }
- maRestorePosSize.SetLeft( pState->mnX );
- maRestorePosSize.SetTop( pState->mnY );
- maRestorePosSize.SetRight( maRestorePosSize.Left() + pState->mnWidth );
- maRestorePosSize.SetRight( maRestorePosSize.Left() + pState->mnHeight );
+ bool bHorz(pState->mnState & WindowStateState::MaximizedHorz);
+ bool bVert(pState->mnState & WindowStateState::MaximizedVert);
+ GetDisplay()->getWMAdaptor()->maximizeFrame( this, bHorz, bVert );
}
- else if( mbMaximizedHorz || mbMaximizedVert )
- GetDisplay()->getWMAdaptor()->maximizeFrame( this, false, false );
+ maRestorePosSize.SetLeft( pState->mnX );
+ maRestorePosSize.SetTop( pState->mnY );
+ maRestorePosSize.SetRight( maRestorePosSize.Left() + pState->mnWidth );
+ maRestorePosSize.SetRight( maRestorePosSize.Left() + pState->mnHeight );
+ }
+ else if( mbMaximizedHorz || mbMaximizedVert )
+ GetDisplay()->getWMAdaptor()->maximizeFrame( this, false, false );
- if (pState->mnState & WindowStateState::Minimized)
- {
- if (nShowState_ == SHOWSTATE_UNKNOWN)
- nShowState_ = SHOWSTATE_NORMAL;
- Minimize();
- }
- if (pState->mnState & WindowStateState::Normal)
- {
- if (nShowState_ != SHOWSTATE_NORMAL)
- Restore();
- }
- if (pState->mnState & WindowStateState::Rollup)
- GetDisplay()->getWMAdaptor()->shade( this, true );
+ if (pState->mnState & WindowStateState::Minimized)
+ {
+ if (nShowState_ == SHOWSTATE_UNKNOWN)
+ nShowState_ = SHOWSTATE_NORMAL;
+ Minimize();
}
+ if (pState->mnState & WindowStateState::Normal)
+ {
+ if (nShowState_ != SHOWSTATE_NORMAL)
+ Restore();
+ }
+ if (pState->mnState & WindowStateState::Rollup)
+ GetDisplay()->getWMAdaptor()->shade( this, true );
}
bool X11SalFrame::GetWindowState( SalFrameState* pState )
@@ -1860,45 +1862,45 @@ void X11SalFrame::GetPosSize( tools::Rectangle &rPosSize )
void X11SalFrame::SetSize( const Size &rSize )
{
- if( !rSize.IsEmpty() )
+ if( rSize.IsEmpty() )
+ return;
+
+ if( ! ( nStyle_ & SalFrameStyleFlags::SIZEABLE )
+ && ! IsChildWindow()
+ && ( nStyle_ & (SalFrameStyleFlags::FLOAT|SalFrameStyleFlags::OWNERDRAWDECORATION) ) != SalFrameStyleFlags::FLOAT )
{
- if( ! ( nStyle_ & SalFrameStyleFlags::SIZEABLE )
- && ! IsChildWindow()
- && ( nStyle_ & (SalFrameStyleFlags::FLOAT|SalFrameStyleFlags::OWNERDRAWDECORATION) ) != SalFrameStyleFlags::FLOAT )
- {
- XSizeHints* pHints = XAllocSizeHints();
- long nSupplied = 0;
- XGetWMNormalHints( GetXDisplay(),
- GetShellWindow(),
- pHints,
- &nSupplied
- );
- pHints->min_width = rSize.Width();
- pHints->min_height = rSize.Height();
- pHints->max_width = rSize.Width();
- pHints->max_height = rSize.Height();
- pHints->flags |= PMinSize | PMaxSize;
- XSetWMNormalHints( GetXDisplay(),
- GetShellWindow(),
- pHints );
- XFree( pHints );
- }
- XResizeWindow( GetXDisplay(), IsSysChildWindow() ? GetWindow() : GetShellWindow(), rSize.Width(), rSize.Height() );
- if( GetWindow() != GetShellWindow() )
- {
- if( nStyle_ & SalFrameStyleFlags::PLUG )
- XMoveResizeWindow( GetXDisplay(), GetWindow(), 0, 0, rSize.Width(), rSize.Height() );
- else
- XResizeWindow( GetXDisplay(), GetWindow(), rSize.Width(), rSize.Height() );
- }
+ XSizeHints* pHints = XAllocSizeHints();
+ long nSupplied = 0;
+ XGetWMNormalHints( GetXDisplay(),
+ GetShellWindow(),
+ pHints,
+ &nSupplied
+ );
+ pHints->min_width = rSize.Width();
+ pHints->min_height = rSize.Height();
+ pHints->max_width = rSize.Width();
+ pHints->max_height = rSize.Height();
+ pHints->flags |= PMinSize | PMaxSize;
+ XSetWMNormalHints( GetXDisplay(),
+ GetShellWindow(),
+ pHints );
+ XFree( pHints );
+ }
+ XResizeWindow( GetXDisplay(), IsSysChildWindow() ? GetWindow() : GetShellWindow(), rSize.Width(), rSize.Height() );
+ if( GetWindow() != GetShellWindow() )
+ {
+ if( nStyle_ & SalFrameStyleFlags::PLUG )
+ XMoveResizeWindow( GetXDisplay(), GetWindow(), 0, 0, rSize.Width(), rSize.Height() );
+ else
+ XResizeWindow( GetXDisplay(), GetWindow(), rSize.Width(), rSize.Height() );
+ }
- maGeometry.nWidth = rSize.Width();
- maGeometry.nHeight = rSize.Height();
+ maGeometry.nWidth = rSize.Width();
+ maGeometry.nHeight = rSize.Height();
- // allow the external status window to reposition
- if (mbInputFocus && mpInputContext != nullptr)
- mpInputContext->SetICFocus ( this );
- }
+ // allow the external status window to reposition
+ if (mbInputFocus && mpInputContext != nullptr)
+ mpInputContext->SetICFocus ( this );
}
void X11SalFrame::SetPosSize( const tools::Rectangle &rPosSize )
@@ -3389,58 +3391,58 @@ bool X11SalFrame::HandleExposeEvent( XEvent const *pEvent )
void X11SalFrame::RestackChildren( ::Window* pTopLevelWindows, int nTopLevelWindows )
{
- if( !maChildren.empty() )
- {
- int nWindow = nTopLevelWindows;
- while( nWindow-- )
- if( pTopLevelWindows[nWindow] == GetStackingWindow() )
- break;
- if( nWindow < 0 )
- return;
+ if( maChildren.empty() )
+ return;
- for (auto const& child : maChildren)
+ int nWindow = nTopLevelWindows;
+ while( nWindow-- )
+ if( pTopLevelWindows[nWindow] == GetStackingWindow() )
+ break;
+ if( nWindow < 0 )
+ return;
+
+ for (auto const& child : maChildren)
+ {
+ if( child->bMapped_ )
{
- if( child->bMapped_ )
+ int nChild = nWindow;
+ while( nChild-- )
{
- int nChild = nWindow;
- while( nChild-- )
+ if( pTopLevelWindows[nChild] == child->GetStackingWindow() )
{
- if( pTopLevelWindows[nChild] == child->GetStackingWindow() )
- {
- // if a child is behind its parent, place it above the
- // parent (for insane WMs like Dtwm and olwm)
- XWindowChanges aCfg;
- aCfg.sibling = GetStackingWindow();
- aCfg.stack_mode = Above;
- XConfigureWindow( GetXDisplay(), child->GetStackingWindow(), CWSibling|CWStackMode, &aCfg );
- break;
- }
+ // if a child is behind its parent, place it above the
+ // parent (for insane WMs like Dtwm and olwm)
+ XWindowChanges aCfg;
+ aCfg.sibling = GetStackingWindow();
+ aCfg.stack_mode = Above;
+ XConfigureWindow( GetXDisplay(), child->GetStackingWindow(), CWSibling|CWStackMode, &aCfg );
+ break;
}
}
}
- for (auto const& child : maChildren)
- {
- child->RestackChildren( pTopLevelWindows, nTopLevelWindows );
- }
+ }
+ for (auto const& child : maChildren)
+ {
+ child->RestackChildren( pTopLevelWindows, nTopLevelWindows );
}
}
void X11SalFrame::RestackChildren()
{
- if( !maChildren.empty() )
+ if( maChildren.empty() )
+ return;
+
+ ::Window aRoot, aParent, *pChildren = nullptr;
+ unsigned int nChildren;
+ if( XQueryTree( GetXDisplay(),
+ GetDisplay()->GetRootWindow( m_nXScreen ),
+ &aRoot,
+ &aParent,
+ &pChildren,
+ &nChildren ) )
{
- ::Window aRoot, aParent, *pChildren = nullptr;
- unsigned int nChildren;
- if( XQueryTree( GetXDisplay(),
- GetDisplay()->GetRootWindow( m_nXScreen ),
- &aRoot,
- &aParent,
- &pChildren,
- &nChildren ) )
- {
- RestackChildren( pChildren, nChildren );
- XFree( pChildren );
- }
+ RestackChildren( pChildren, nChildren );
+ XFree( pChildren );
}
}
diff --git a/vcl/unx/generic/window/screensaverinhibitor.cxx b/vcl/unx/generic/window/screensaverinhibitor.cxx
index 4cb4e273794b..0b499e638ecb 100644
--- a/vcl/unx/generic/window/screensaverinhibitor.cxx
+++ b/vcl/unx/generic/window/screensaverinhibitor.cxx
@@ -55,20 +55,20 @@ void ScreenSaverInhibitor::inhibit( bool bInhibit, const OUString& sReason,
inhibitFDO( bInhibit, appname, aReason.getStr() );
inhibitFDOPM( bInhibit, appname, aReason.getStr() );
- if ( bIsX11 )
+ if ( !bIsX11 )
+ return;
+
+ if (pDisplay)
{
- if (pDisplay)
- {
- inhibitXScreenSaver( bInhibit, *pDisplay );
- inhibitXAutoLock( bInhibit, *pDisplay );
- inhibitDPMS( bInhibit, *pDisplay );
- }
+ inhibitXScreenSaver( bInhibit, *pDisplay );
+ inhibitXAutoLock( bInhibit, *pDisplay );
+ inhibitDPMS( bInhibit, *pDisplay );
+ }
- if (xid)
- {
- inhibitGSM( bInhibit, appname, aReason.getStr(), *xid );
- inhibitMSM( bInhibit, appname, aReason.getStr(), *xid );
- }
+ if (xid)
+ {
+ inhibitGSM( bInhibit, appname, aReason.getStr(), *xid );
+ inhibitMSM( bInhibit, appname, aReason.getStr(), *xid );
}
}
diff --git a/vcl/unx/gtk3/a11y/gtk3atklistener.cxx b/vcl/unx/gtk3/a11y/gtk3atklistener.cxx
index 8606b7bde5ab..b4c2dfcadf38 100644
--- a/vcl/unx/gtk3/a11y/gtk3atklistener.cxx
+++ b/vcl/unx/gtk3/a11y/gtk3atklistener.cxx
@@ -98,21 +98,21 @@ extern "C" {
// XEventListener implementation
void AtkListener::disposing( const lang::EventObject& )
{
- if( mpWrapper )
- {
- AtkObject *atk_obj = ATK_OBJECT( mpWrapper );
+ if( !mpWrapper )
+ return;
- // Release all interface references to avoid shutdown problems with
- // global mutex
- atk_object_wrapper_dispose( mpWrapper );
+ AtkObject *atk_obj = ATK_OBJECT( mpWrapper );
- g_idle_add( reinterpret_cast<GSourceFunc>(idle_defunc_state_change),
- g_object_ref( G_OBJECT( atk_obj ) ) );
+ // Release all interface references to avoid shutdown problems with
+ // global mutex
+ atk_object_wrapper_dispose( mpWrapper );
- // Release the wrapper object so that it can vanish ..
- g_object_unref( mpWrapper );
- mpWrapper = nullptr;
- }
+ g_idle_add( reinterpret_cast<GSourceFunc>(idle_defunc_state_change),
+ g_object_ref( G_OBJECT( atk_obj ) ) );
+
+ // Release the wrapper object so that it can vanish ..
+ g_object_unref( mpWrapper );
+ mpWrapper = nullptr;
}
/*****************************************************************************/
@@ -134,32 +134,32 @@ void AtkListener::updateChildList(
m_aChildList.clear();
uno::Reference< accessibility::XAccessibleStateSet > xStateSet = pContext->getAccessibleStateSet();
- if( xStateSet.is()
+ if( !(xStateSet.is()
&& !xStateSet->contains(accessibility::AccessibleStateType::DEFUNC)
- && !xStateSet->contains(accessibility::AccessibleStateType::MANAGES_DESCENDANTS) )
+ && !xStateSet->contains(accessibility::AccessibleStateType::MANAGES_DESCENDANTS)) )
+ return;
+
+ css::uno::Reference<css::accessibility::XAccessibleContext3> xContext3(pContext, css::uno::UNO_QUERY);
+ if (xContext3.is())
{
- css::uno::Reference<css::accessibility::XAccessibleContext3> xContext3(pContext, css::uno::UNO_QUERY);
- if (xContext3.is())
- {
- m_aChildList = comphelper::sequenceToContainer<std::vector<css::uno::Reference< css::accessibility::XAccessible >>>(xContext3->getAccessibleChildren());
- }
- else
+ m_aChildList = comphelper::sequenceToContainer<std::vector<css::uno::Reference< css::accessibility::XAccessible >>>(xContext3->getAccessibleChildren());
+ }
+ else
+ {
+ sal_Int32 nChildren = pContext->getAccessibleChildCount();
+ m_aChildList.resize(nChildren);
+ for(sal_Int32 n = 0; n < nChildren; n++)
{
- sal_Int32 nChildren = pContext->getAccessibleChildCount();
- m_aChildList.resize(nChildren);
- for(sal_Int32 n = 0; n < nChildren; n++)
+ try
{
- try
- {
- m_aChildList[n] = pContext->getAccessibleChild(n);
- }
- catch (lang::IndexOutOfBoundsException const&)
- {
- sal_Int32 nChildren2 = pContext->getAccessibleChildCount();
- assert(nChildren2 <= n && "consistency?");
- m_aChildList.resize(std::min(nChildren2, n));
- break;
- }
+ m_aChildList[n] = pContext->getAccessibleChild(n);
+ }
+ catch (lang::IndexOutOfBoundsException const&)
+ {
+ sal_Int32 nChildren2 = pContext->getAccessibleChildCount();
+ assert(nChildren2 <= n && "consistency?");
+ m_aChildList.resize(std::min(nChildren2, n));
+ break;
}
}
}
@@ -212,25 +212,25 @@ void AtkListener::handleChildRemoved(
// 0. child, which breaks somehow on vanishing list boxes.
// Ignoring "remove" events for objects not in the m_aChildList
// for now.
- if( nIndex >= 0 )
- {
- uno::Reference<accessibility::XAccessibleEventBroadcaster> xBroadcaster(
- rxChild->getAccessibleContext(), uno::UNO_QUERY);
+ if( nIndex < 0 )
+ return;
- if (xBroadcaster.is())
- {
- uno::Reference<accessibility::XAccessibleEventListener> xListener(this);
- xBroadcaster->removeAccessibleEventListener(xListener);
- }
+ uno::Reference<accessibility::XAccessibleEventBroadcaster> xBroadcaster(
+ rxChild->getAccessibleContext(), uno::UNO_QUERY);
- updateChildList(rxParent);
+ if (xBroadcaster.is())
+ {
+ uno::Reference<accessibility::XAccessibleEventListener> xListener(this);
+ xBroadcaster->removeAccessibleEventListener(xListener);
+ }
- AtkObject * pChild = atk_object_wrapper_ref( rxChild, false );
- if( pChild )
- {
- atk_object_wrapper_remove_child( mpWrapper, pChild, nIndex );
- g_object_unref( pChild );
- }
+ updateChildList(rxParent);
+
+ AtkObject * pChild = atk_object_wrapper_ref( rxChild, false );
+ if( pChild )
+ {
+ atk_object_wrapper_remove_child( mpWrapper, pChild, nIndex );
+ g_object_unref( pChild );
}
}
diff --git a/vcl/unx/gtk3/a11y/gtk3atkutil.cxx b/vcl/unx/gtk3/a11y/gtk3atkutil.cxx
index 699f9aee1695..978c28e47df0 100644
--- a/vcl/unx/gtk3/a11y/gtk3atkutil.cxx
+++ b/vcl/unx/gtk3/a11y/gtk3atkutil.cxx
@@ -317,20 +317,20 @@ void DocumentFocusListener::attachRecursive(
// If not already done, add the broadcaster to the list and attach as listener.
const uno::Reference< uno::XInterface >& xInterface = xBroadcaster;
- if( m_aRefList.insert(xInterface).second )
- {
- xBroadcaster->addAccessibleEventListener(static_cast< accessibility::XAccessibleEventListener *>(this));
+ if( !m_aRefList.insert(xInterface).second )
+ return;
- if( ! xStateSet->contains(accessibility::AccessibleStateType::MANAGES_DESCENDANTS ) )
+ xBroadcaster->addAccessibleEventListener(static_cast< accessibility::XAccessibleEventListener *>(this));
+
+ if( ! xStateSet->contains(accessibility::AccessibleStateType::MANAGES_DESCENDANTS ) )
+ {
+ sal_Int32 n, nmax = xContext->getAccessibleChildCount();
+ for( n = 0; n < nmax; n++ )
{
- sal_Int32 n, nmax = xContext->getAccessibleChildCount();
- for( n = 0; n < nmax; n++ )
- {
- uno::Reference< accessibility::XAccessible > xChild( xContext->getAccessibleChild( n ) );
+ uno::Reference< accessibility::XAccessible > xChild( xContext->getAccessibleChild( n ) );
- if( xChild.is() )
- attachRecursive(xChild);
- }
+ if( xChild.is() )
+ attachRecursive(xChild);
}
}
}
@@ -370,20 +370,20 @@ void DocumentFocusListener::detachRecursive(
{
uno::Reference< accessibility::XAccessibleEventBroadcaster > xBroadcaster(xContext, uno::UNO_QUERY);
- if( xBroadcaster.is() && 0 < m_aRefList.erase(xBroadcaster) )
- {
- xBroadcaster->removeAccessibleEventListener(static_cast< accessibility::XAccessibleEventListener *>(this));
+ if( !xBroadcaster.is() || 0 >= m_aRefList.erase(xBroadcaster) )
+ return;
- if( ! xStateSet->contains(accessibility::AccessibleStateType::MANAGES_DESCENDANTS ) )
+ xBroadcaster->removeAccessibleEventListener(static_cast< accessibility::XAccessibleEventListener *>(this));
+
+ if( ! xStateSet->contains(accessibility::AccessibleStateType::MANAGES_DESCENDANTS ) )
+ {
+ sal_Int32 n, nmax = xContext->getAccessibleChildCount();
+ for( n = 0; n < nmax; n++ )
{
- sal_Int32 n, nmax = xContext->getAccessibleChildCount();
- for( n = 0; n < nmax; n++ )
- {
- uno::Reference< accessibility::XAccessible > xChild( xContext->getAccessibleChild( n ) );
+ uno::Reference< accessibility::XAccessible > xChild( xContext->getAccessibleChild( n ) );
- if( xChild.is() )
- detachRecursive(xChild);
- }
+ if( xChild.is() )
+ detachRecursive(xChild);
}
}
}
diff --git a/vcl/unx/gtk3/gtk3gloactiongroup.cxx b/vcl/unx/gtk3/gtk3gloactiongroup.cxx
index c6d5eaf03fc5..1b64da0ffaf1 100644
--- a/vcl/unx/gtk3/gtk3gloactiongroup.cxx
+++ b/vcl/unx/gtk3/gtk3gloactiongroup.cxx
@@ -282,32 +282,32 @@ g_lo_action_group_insert_stateful (GLOActionGroup *group,
GLOAction* old_action = G_LO_ACTION (g_hash_table_lookup (group->priv->table, action_name));
- if (old_action == nullptr || old_action->item_id != item_id)
- {
- if (old_action != nullptr)
- g_lo_action_group_remove (group, action_name);
+ if (old_action != nullptr && old_action->item_id == item_id)
+ return;
- GLOAction* action = g_lo_action_new();
+ if (old_action != nullptr)
+ g_lo_action_group_remove (group, action_name);
- g_hash_table_insert (group->priv->table, g_strdup (action_name), action);
+ GLOAction* action = g_lo_action_new();
- action->item_id = item_id;
- action->submenu = submenu;
+ g_hash_table_insert (group->priv->table, g_strdup (action_name), action);
- if (parameter_type)
- action->parameter_type = const_cast<GVariantType*>(parameter_type);
+ action->item_id = item_id;
+ action->submenu = submenu;
+
+ if (parameter_type)
+ action->parameter_type = const_cast<GVariantType*>(parameter_type);
- if (state_type)
- action->state_type = const_cast<GVariantType*>(state_type);
+ if (state_type)
+ action->state_type = const_cast<GVariantType*>(state_type);
- if (state_hint)
- action->state_hint = g_variant_ref_sink (state_hint);
+ if (state_hint)
+ action->state_hint = g_variant_ref_sink (state_hint);
- if (state)
- action->state = g_variant_ref_sink (state);
+ if (state)
+ action->state = g_variant_ref_sink (state);
- g_action_group_action_added (G_ACTION_GROUP (group), action_name);
- }
+ g_action_group_action_added (G_ACTION_GROUP (group), action_name);
}
static void
diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
index 7f2ce207ea7a..6bae76eab3fc 100644
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
@@ -597,26 +597,26 @@ void on_registrar_unavailable( GDBusConnection * /*connection*/,
void GtkSalFrame::EnsureAppMenuWatch()
{
- if ( !m_nWatcherId )
- {
- // Get a DBus session connection.
- if ( pSessionBus == nullptr )
- {
- pSessionBus = g_bus_get_sync( G_BUS_TYPE_SESSION, nullptr, nullptr );
+ if ( m_nWatcherId )
+ return;
- if ( pSessionBus == nullptr )
- return;
- }
+ // Get a DBus session connection.
+ if ( pSessionBus == nullptr )
+ {
+ pSessionBus = g_bus_get_sync( G_BUS_TYPE_SESSION, nullptr, nullptr );
- // Publish the menu only if AppMenu registrar is available.
- m_nWatcherId = g_bus_watch_name_on_connection( pSessionBus,
- "com.canonical.AppMenu.Registrar",
- G_BUS_NAME_WATCHER_FLAGS_NONE,
- on_registrar_available,
- on_registrar_unavailable,
- this,
- nullptr );
+ if ( pSessionBus == nullptr )
+ return;
}
+
+ // Publish the menu only if AppMenu registrar is available.
+ m_nWatcherId = g_bus_watch_name_on_connection( pSessionBus,
+ "com.canonical.AppMenu.Registrar",
+ G_BUS_NAME_WATCHER_FLAGS_NONE,
+ on_registrar_available,
+ on_registrar_unavailable,
+ this,
+ nullptr );
}
void GtkSalFrame::InvalidateGraphics()
@@ -1307,82 +1307,82 @@ void GtkSalFrame::SetDefaultSize()
void GtkSalFrame::Show( bool bVisible, bool /*bNoActivate*/ )
{
- if( m_pWindow )
+ if( !m_pWindow )
+ return;
+
+ if( bVisible )
{
- if( bVisible )
- {
- getDisplay()->startupNotificationCompleted();
+ getDisplay()->startupNotificationCompleted();
- if( m_bDefaultPos )
- Center();
- if( m_bDefaultSize )
- SetDefaultSize();
- setMinMaxSize();
+ if( m_bDefaultPos )
+ Center();
+ if( m_bDefaultSize )
+ SetDefaultSize();
+ setMinMaxSize();
- if (isFloatGrabWindow() && !getDisplay()->GetCaptureFrame())
- {
- m_pParent->grabPointer(true, true, true);
- m_pParent->addGrabLevel();
- }
+ if (isFloatGrabWindow() && !getDisplay()->GetCaptureFrame())
+ {
+ m_pParent->grabPointer(true, true, true);
+ m_pParent->addGrabLevel();
+ }
#if defined(GDK_WINDOWING_WAYLAND)
- /*
- rhbz#1334915, gnome#779143, tdf#100158
- https://gitlab.gnome.org/GNOME/gtk/-/issues/767
-
- before gdk_wayland_window_set_application_id was available gtk
- under wayland lacked a way to change the app_id of a window, so
- brute force everything as a startcenter when initially shown to at
- least get the default LibreOffice icon and not the broken app icon
- */
- static bool bAppIdImmutable = DLSYM_GDK_IS_WAYLAND_DISPLAY(getGdkDisplay()) &&
- !dlsym(nullptr, "gdk_wayland_window_set_application_id");
- if (bAppIdImmutable)
- {
- OString sOrigName(g_get_prgname());
- g_set_prgname("libreoffice-startcenter");
- gtk_widget_show(m_pWindow);
- g_set_prgname(sOrigName.getStr());
- }
- else
- {
- gtk_widget_show(m_pWindow);
- }
-#else
+ /*
+ rhbz#1334915, gnome#779143, tdf#100158
+ https://gitlab.gnome.org/GNOME/gtk/-/issues/767
+
+ before gdk_wayland_window_set_application_id was available gtk
+ under wayland lacked a way to change the app_id of a window, so
+ brute force everything as a startcenter when initially shown to at
+ least get the default LibreOffice icon and not the broken app icon
+ */
+ static bool bAppIdImmutable = DLSYM_GDK_IS_WAYLAND_DISPLAY(getGdkDisplay()) &&
+ !dlsym(nullptr, "gdk_wayland_window_set_application_id");
+ if (bAppIdImmutable)
+ {
+ OString sOrigName(g_get_prgname());
+ g_set_prgname("libreoffice-startcenter");
+ gtk_widget_show(m_pWindow);
+ g_set_prgname(sOrigName.getStr());
+ }
+ else
+ {
gtk_widget_show(m_pWindow);
+ }
+#else
+ gtk_widget_show(m_pWindow);
#endif
- if( isFloatGrabWindow() )
+ if( isFloatGrabWindow() )
+ {
+ m_nFloats++;
+ if (!getDisplay()->GetCaptureFrame())
{
- m_nFloats++;
- if (!getDisplay()->GetCaptureFrame())
- {
- grabPointer(true, true, true);
- addGrabLevel();
- }
- // #i44068# reset parent's IM context
- if( m_pParent )
- m_pParent->EndExtTextInput(EndExtTextInputFlags::NONE);
+ grabPointer(true, true, true);
+ addGrabLevel();
}
+ // #i44068# reset parent's IM context
+ if( m_pParent )
+ m_pParent->EndExtTextInput(EndExtTextInputFlags::NONE);
}
- else
+ }
+ else
+ {
+ if( isFloatGrabWindow() )
{
- if( isFloatGrabWindow() )
+ m_nFloats--;
+ if (!getDisplay()->GetCaptureFrame())
{
- m_nFloats--;
- if (!getDisplay()->GetCaptureFrame())
- {
- removeGrabLevel();
- grabPointer(false, true, false);
- m_pParent->removeGrabLevel();
- bool bParentIsFloatGrabWindow = m_pParent->isFloatGrabWindow();
- m_pParent->grabPointer(bParentIsFloatGrabWindow, true, bParentIsFloatGrabWindow);
- }
+ removeGrabLevel();
+ grabPointer(false, true, false);
+ m_pParent->removeGrabLevel();
+ bool bParentIsFloatGrabWindow = m_pParent->isFloatGrabWindow();
+ m_pParent->grabPointer(bParentIsFloatGrabWindow, true, bParentIsFloatGrabWindow);
}
- gtk_widget_hide( m_pWindow );
- if( m_pIMHandler )
- m_pIMHandler->focusChanged( false );
}
+ gtk_widget_hide( m_pWindow );
+ if( m_pIMHandler )
+ m_pIMHandler->focusChanged( false );
}
}
@@ -1393,53 +1393,53 @@ void GtkSalFrame::setMinMaxSize()
* whether they should is undefined. So don't set the max size hint
* for a full screen window.
*/
- if( m_pWindow && ! isChild() )
+ if( !m_pWindow || isChild() )
+ return;
+
+ GdkGeometry aGeo;
+ int aHints = 0;
+ if( m_nStyle & SalFrameStyleFlags::SIZEABLE )
{
- GdkGeometry aGeo;
- int aHints = 0;
- if( m_nStyle & SalFrameStyleFlags::SIZEABLE )
+ if( m_aMinSize.Width() && m_aMinSize.Height() && ! m_bFullscreen )
{
- if( m_aMinSize.Width() && m_aMinSize.Height() && ! m_bFullscreen )
- {
- aGeo.min_width = m_aMinSize.Width();
- aGeo.min_height = m_aMinSize.Height();
- aHints |= GDK_HINT_MIN_SIZE;
- }
- if( m_aMaxSize.Width() && m_aMaxSize.Height() && ! m_bFullscreen )
- {
- aGeo.max_width = m_aMaxSize.Width();
- aGeo.max_height = m_aMaxSize.Height();
- aHints |= GDK_HINT_MAX_SIZE;
- }
+ aGeo.min_width = m_aMinSize.Width();
+ aGeo.min_height = m_aMinSize.Height();
+ aHints |= GDK_HINT_MIN_SIZE;
}
- else
+ if( m_aMaxSize.Width() && m_aMaxSize.Height() && ! m_bFullscreen )
{
- if (!m_bFullscreen && m_nWidthRequest && m_nHeightRequest)
- {
- aGeo.min_width = m_nWidthRequest;
- aGeo.min_height = m_nHeightRequest;
- aHints |= GDK_HINT_MIN_SIZE;
-
- aGeo.max_width = m_nWidthRequest;
- aGeo.max_height = m_nHeightRequest;
- aHints |= GDK_HINT_MAX_SIZE;
- }
- }
-
- if( m_bFullscreen && m_aMaxSize.Width() && m_aMaxSize.Height() )
- {
- aGeo.max_width = m_aMaxSize.Width();
+ aGeo.max_width = m_aMaxSize.Width();
aGeo.max_height = m_aMaxSize.Height();
aHints |= GDK_HINT_MAX_SIZE;
}
- if( aHints )
+ }
+ else
+ {
+ if (!m_bFullscreen && m_nWidthRequest && m_nHeightRequest)
{
- gtk_window_set_geometry_hints( GTK_WINDOW(m_pWindow),
- nullptr,
- &aGeo,
- GdkWindowHints( aHints ) );
+ aGeo.min_width = m_nWidthRequest;
+ aGeo.min_height = m_nHeightRequest;
+ aHints |= GDK_HINT_MIN_SIZE;
+
+ aGeo.max_width = m_nWidthRequest;
+ aGeo.max_height = m_nHeightRequest;
+ aHints |= GDK_HINT_MAX_SIZE;
}
}
+
+ if( m_bFullscreen && m_aMaxSize.Width() && m_aMaxSize.Height() )
+ {
+ aGeo.max_width = m_aMaxSize.Width();
+ aGeo.max_height = m_aMaxSize.Height();
+ aHints |= GDK_HINT_MAX_SIZE;
+ }
+ if( aHints )
+ {
+ gtk_window_set_geometry_hints( GTK_WINDOW(m_pWindow),
+ nullptr,
+ &aGeo,
+ GdkWindowHints( aHints ) );
+ }
}
void GtkSalFrame::SetMaxClientSize( long nWidth, long nHeight )
@@ -1466,29 +1466,29 @@ void GtkSalFrame::SetMinClientSize( long nWidth, long nHeight )
void GtkSalFrame::AllocateFrame()
{
basegfx::B2IVector aFrameSize( maGeometry.nWidth, maGeometry.nHeight );
- if (!m_pSurface || m_aFrameSize.getX() != aFrameSize.getX() ||
- m_aFrameSize.getY() != aFrameSize.getY() )
- {
- if( aFrameSize.getX() == 0 )
- aFrameSize.setX( 1 );
- if( aFrameSize.getY() == 0 )
- aFrameSize.setY( 1 );
+ if (m_pSurface && m_aFrameSize.getX() == aFrameSize.getX() &&
+ m_aFrameSize.getY() == aFrameSize.getY() )
+ return;
- if (m_pSurface)
- cairo_surface_destroy(m_pSurface);
+ if( aFrameSize.getX() == 0 )
+ aFrameSize.setX( 1 );
+ if( aFrameSize.getY() == 0 )
+ aFrameSize.setY( 1 );
+
+ if (m_pSurface)
+ cairo_surface_destroy(m_pSurface);
- m_pSurface = gdk_window_create_similar_surface(gtk_widget_get_window(m_pWindow),
- CAIRO_CONTENT_COLOR_ALPHA,
- aFrameSize.getX(),
- aFrameSize.getY());
- m_aFrameSize = aFrameSize;
+ m_pSurface = gdk_window_create_similar_surface(gtk_widget_get_window(m_pWindow),
+ CAIRO_CONTENT_COLOR_ALPHA,
+ aFrameSize.getX(),
+ aFrameSize.getY());
+ m_aFrameSize = aFrameSize;
- cairo_surface_set_user_data(m_pSurface, SvpSalGraphics::getDamageKey(), &m_aDamageHandler, nullptr);
- SAL_INFO("vcl.gtk3", "allocated Frame size of " << maGeometry.nWidth << " x " << maGeometry.nHeight);
+ cairo_surface_set_user_data(m_pSurface, SvpSalGraphics::getDamageKey(), &m_aDamageHandler, nullptr);
+ SAL_INFO("vcl.gtk3", "allocated Frame size of " << maGeometry.nWidth << " x " << maGeometry.nHeight);
- if (m_pGraphics)
- m_pGraphics->setSurface(m_pSurface, m_aFrameSize);
- }
+ if (m_pGraphics)
+ m_pGraphics->setSurface(m_pSurface, m_aFrameSize);
}
void GtkSalFrame::SetPosSize( long nX, long nY, long nWidth, long nHeight, sal_uInt16 nFlags )
@@ -1950,41 +1950,41 @@ void GtkSalFrame::UpdateLastInputEventTime(guint32 nUserInputTime)
void GtkSalFrame::ToTop( SalFrameToTop nFlags )
{
- if( m_pWindow )
+ if( !m_pWindow )
+ return;
+
+ if( isChild( false ) )
+ GrabFocus();
+ else if( gtk_widget_get_mapped( m_pWindow ) )
{
- if( isChild( false ) )
- GrabFocus();
- else if( gtk_widget_get_mapped( m_pWindow ) )
- {
- if (!(nFlags & SalFrameToTop::GrabFocusOnly))
- gtk_window_present_with_time(GTK_WINDOW(m_pWindow), GetLastInputEventTime());
- else
- gdk_window_focus(gtk_widget_get_window(m_pWindow), GetLastInputEventTime());
- GrabFocus();
- }
+ if (!(nFlags & SalFrameToTop::GrabFocusOnly))
+ gtk_window_present_with_time(GTK_WINDOW(m_pWindow), GetLastInputEventTime());
else
- {
- if( nFlags & SalFrameToTop::RestoreWhenMin )
- gtk_window_present( GTK_WINDOW(m_pWindow) );
- }
+ gdk_window_focus(gtk_widget_get_window(m_pWindow), GetLastInputEventTime());
+ GrabFocus();
+ }
+ else
+ {
+ if( nFlags & SalFrameToTop::RestoreWhenMin )
+ gtk_window_present( GTK_WINDOW(m_pWindow) );
}
}
void GtkSalFrame::SetPointer( PointerStyle ePointerStyle )
{
- if( m_pWindow && ePointerStyle != m_ePointerStyle )
- {
- m_ePointerStyle = ePointerStyle;
- GdkCursor *pCursor = getDisplay()->getCursor( ePointerStyle );
- gdk_window_set_cursor( gtk_widget_get_window(m_pWindow), pCursor );
- m_pCurrentCursor = pCursor;
+ if( !m_pWindow || ePointerStyle == m_ePointerStyle )
+ return;
- // #i80791# use grabPointer the same way as CaptureMouse, respective float grab
- if( getDisplay()->MouseCaptured( this ) )
- grabPointer( true, false, false );
- else if( m_nFloats > 0 )
- grabPointer( true, false, true );
- }
+ m_ePointerStyle = ePointerStyle;
+ GdkCursor *pCursor = getDisplay()->getCursor( ePointerStyle );
+ gdk_window_set_cursor( gtk_widget_get_window(m_pWindow), pCursor );
+ m_pCurrentCursor = pCursor;
+
+ // #i80791# use grabPointer the same way as CaptureMouse, respective float grab
+ if( getDisplay()->MouseCaptured( this ) )
+ grabPointer( true, false, false );
+ else if( m_nFloats > 0 )
+ grabPointer( true, false, true );
}
void GtkSalFrame::grabPointer( bool bGrab, bool bKeyboardAlso, bool bOwnerEvents )
@@ -2969,42 +2969,42 @@ void GtkSalFrame::signalRealize(GtkWidget*, gpointer frame)
static auto window_move_to_rect = reinterpret_cast<void (*) (GdkWindow*, const GdkRectangle*, GdkGravity,
GdkGravity, GdkAnchorHints, gint, gint)>(
dlsym(nullptr, "gdk_window_move_to_rect"));
- if (window_move_to_rect)
- {
- GdkGravity rect_anchor = GDK_GRAVITY_SOUTH_WEST, menu_anchor = GDK_GRAVITY_NORTH_WEST;
+ if (!window_move_to_rect)
+ return;
- if (pThis->m_nFloatFlags & FloatWinPopupFlags::Left)
- {
- rect_anchor = GDK_GRAVITY_NORTH_WEST;
- menu_anchor = GDK_GRAVITY_NORTH_EAST;
- }
- else if (pThis->m_nFloatFlags & FloatWinPopupFlags::Up)
- {
- rect_anchor = GDK_GRAVITY_NORTH_WEST;
- menu_anchor = GDK_GRAVITY_SOUTH_WEST;
- }
- else if (pThis->m_nFloatFlags & FloatWinPopupFlags::Right)
- {
- rect_anchor = GDK_GRAVITY_NORTH_EAST;
- }
+ GdkGravity rect_anchor = GDK_GRAVITY_SOUTH_WEST, menu_anchor = GDK_GRAVITY_NORTH_WEST;
- VclPtr<vcl::Window> pVclParent = pThis->GetWindow()->GetParent();
- if (pVclParent->HasMirroredGraphics() && pVclParent->IsRTLEnabled())
- {
- swapDirection(rect_anchor);
- swapDirection(menu_anchor);
- }
+ if (pThis->m_nFloatFlags & FloatWinPopupFlags::Left)
+ {
+ rect_anchor = GDK_GRAVITY_NORTH_WEST;
+ menu_anchor = GDK_GRAVITY_NORTH_EAST;
+ }
+ else if (pThis->m_nFloatFlags & FloatWinPopupFlags::Up)
+ {
+ rect_anchor = GDK_GRAVITY_NORTH_WEST;
+ menu_anchor = GDK_GRAVITY_SOUTH_WEST;
+ }
+ else if (pThis->m_nFloatFlags & FloatWinPopupFlags::Right)
+ {
+ rect_anchor = GDK_GRAVITY_NORTH_EAST;
+ }
- tools::Rectangle aFloatRect = FloatingWindow::ImplConvertToAbsPos(pVclParent, pThis->m_aFloatRect);
- if (gdk_window_get_window_type(gtk_widget_get_window(pThis->m_pParent->m_pWindow)) != GDK_WINDOW_TOPLEVEL)
- aFloatRect.Move(-pThis->m_pParent->maGeometry.nX, -pThis->m_pParent->maGeometry.nY);
+ VclPtr<vcl::Window> pVclParent = pThis->GetWindow()->GetParent();
+ if (pVclParent->HasMirroredGraphics() && pVclParent->IsRTLEnabled())
+ {
+ swapDirection(rect_anchor);
+ swapDirection(menu_anchor);
+ }
- GdkRectangle rect {static_cast<int>(aFloatRect.Left()), static_cast<int>(aFloatRect.Top()),
- static_cast<int>(aFloatRect.GetWidth()), static_cast<int>(aFloatRect.GetHeight())};
+ tools::Rectangle aFloatRect = FloatingWindow::ImplConvertToAbsPos(pVclParent, pThis->m_aFloatRect);
+ if (gdk_window_get_window_type(gtk_widget_get_window(pThis->m_pParent->m_pWindow)) != GDK_WINDOW_TOPLEVEL)
+ aFloatRect.Move(-pThis->m_pParent->maGeometry.nX, -pThis->m_pParent->maGeometry.nY);
- GdkWindow* gdkWindow = gtk_widget_get_window(pThis->m_pWindow);
- window_move_to_rect(gdkWindow, &rect, rect_anchor, menu_anchor, static_cast<GdkAnchorHints>(GDK_ANCHOR_FLIP | GDK_ANCHOR_SLIDE), 0, 0);
- }
+ GdkRectangle rect {static_cast<int>(aFloatRect.Left()), static_cast<int>(aFloatRect.Top()),
+ static_cast<int>(aFloatRect.GetWidth()), static_cast<int>(aFloatRect.GetHeight())};
+
+ GdkWindow* gdkWindow = gtk_widget_get_window(pThis->m_pWindow);
+ window_move_to_rect(gdkWindow, &rect, rect_anchor, menu_anchor, static_cast<GdkAnchorHints>(GDK_ANCHOR_FLIP | GDK_ANCHOR_SLIDE), 0, 0);
}
gboolean GtkSalFrame::signalConfigure(GtkWidget*, GdkEventConfigure* pEvent, gpointer frame)
@@ -3749,19 +3749,19 @@ void GtkDropTarget::signalDragLeave(GtkWidget* pWidget, GdkDragContext* /*contex
void GtkSalFrame::signalDestroy( GtkWidget* pObj, gpointer frame )
{
GtkSalFrame* pThis = static_cast<GtkSalFrame*>(frame);
- if( pObj == pThis->m_pWindow )
- {
- pThis->m_aDamageHandler.damaged = nullptr;
- pThis->m_aDamageHandler.handle = nullptr;
- if (pThis->m_pSurface)
- cairo_surface_set_user_data(pThis->m_pSurface, SvpSalGraphics::getDamageKey(), nullptr, nullptr);
- pThis->m_pFixedContainer = nullptr;
- pThis->m_pEventBox = nullptr;
- pThis->m_pTopLevelGrid = nullptr;
- pThis->m_pWindow = nullptr;
- pThis->m_xFrameWeld.reset();
- pThis->InvalidateGraphics();
- }
+ if( pObj != pThis->m_pWindow )
+ return;
+
+ pThis->m_aDamageHandler.damaged = nullptr;
+ pThis->m_aDamageHandler.handle = nullptr;
+ if (pThis->m_pSurface)
+ cairo_surface_set_user_data(pThis->m_pSurface, SvpSalGraphics::getDamageKey(), nullptr, nullptr);
+ pThis->m_pFixedContainer = nullptr;
+ pThis->m_pEventBox = nullptr;
+ pThis->m_pTopLevelGrid = nullptr;
+ pThis->m_pWindow = nullptr;
+ pThis->m_xFrameWeld.reset();
+ pThis->InvalidateGraphics();
}
// GtkSalFrame::IMHandler
@@ -3863,20 +3863,20 @@ void GtkSalFrame::IMHandler::endExtTextInput( EndExtTextInputFlags /*nFlags*/ )
{
gtk_im_context_reset ( m_pIMContext );
- if( m_aInputEvent.mpTextAttr )
+ if( !m_aInputEvent.mpTextAttr )
+ return;
+
+ vcl::DeletionListener aDel( m_pFrame );
+ // delete preedit in sal (commit an empty string)
+ sendEmptyCommit();
+ if( ! aDel.isDeleted() )
{
- vcl::DeletionListener aDel( m_pFrame );
- // delete preedit in sal (commit an empty string)
- sendEmptyCommit();
- if( ! aDel.isDeleted() )
+ // mark previous preedit state again (will e.g. be sent at focus gain)
+ m_aInputEvent.mpTextAttr = m_aInputFlags.data();
+ if( m_bFocused )
{
- // mark previous preedit state again (will e.g. be sent at focus gain)
- m_aInputEvent.mpTextAttr = m_aInputFlags.data();
- if( m_bFocused )
- {
- // begin preedit again
- GtkSalFrame::getDisplay()->SendInternalEvent( m_pFrame, &m_aInputEvent, SalEvent::ExtTextInput );
- }
+ // begin preedit again
+ GtkSalFrame::getDisplay()->SendInternalEvent( m_pFrame, &m_aInputEvent, SalEvent::ExtTextInput );
}
}
}
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 391999922f62..edd06fba3f29 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -5906,38 +5906,38 @@ public:
g_signal_handler_disconnect(m_pHAdjustment, m_nHAdjustChangedSignalId);
//put it back the way it was
- if (m_pOrigViewport)
- {
- GtkInstanceContainer::disable_notify_events();
-
- // force in new adjustment to drop the built-in handlers on value-changed
- // which are getting called eventually by the gtk_container_add call
- // and which access the scrolled window indicators which, in the case
- // of user-managed scrolling windows in toolbar popups during popdown
- // are nullptr causing crashes when the scrolling windows is not at its
- // initial 0,0 position
- GtkAdjustment *pVAdjustment = gtk_adjustment_new(0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
- gtk_scrolled_window_set_vadjustment(m_pScrolledWindow, pVAdjustment);
- GtkAdjustment *pHAdjustment = gtk_adjustment_new(0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
- gtk_scrolled_window_set_hadjustment(m_pScrolledWindow, pHAdjustment);
-
- GtkWidget *pViewport = gtk_bin_get_child(GTK_BIN(m_pScrolledWindow));
- assert(CRIPPLED_IS_VIEWPORT(pViewport));
- GtkWidget *pChild = gtk_bin_get_child(GTK_BIN(pViewport));
- g_object_ref(pChild);
- gtk_container_remove(GTK_CONTAINER(pViewport), pChild);
- g_object_ref(pViewport);
- gtk_container_remove(GTK_CONTAINER(m_pScrolledWindow), pViewport);
+ if (!m_pOrigViewport)
+ return;
- gtk_container_add(GTK_CONTAINER(m_pScrolledWindow), m_pOrigViewport);
- g_object_unref(m_pOrigViewport);
- gtk_container_add(GTK_CONTAINER(m_pOrigViewport), pChild);
- g_object_unref(pChild);
- gtk_widget_destroy(pViewport);
- g_object_unref(pViewport);
- m_pOrigViewport = nullptr;
- GtkInstanceContainer::enable_notify_events();
- }
+ GtkInstanceContainer::disable_notify_events();
+
+ // force in new adjustment to drop the built-in handlers on value-changed
+ // which are getting called eventually by the gtk_container_add call
+ // and which access the scrolled window indicators which, in the case
+ // of user-managed scrolling windows in toolbar popups during popdown
+ // are nullptr causing crashes when the scrolling windows is not at its
+ // initial 0,0 position
+ GtkAdjustment *pVAdjustment = gtk_adjustment_new(0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
+ gtk_scrolled_window_set_vadjustment(m_pScrolledWindow, pVAdjustment);
+ GtkAdjustment *pHAdjustment = gtk_adjustment_new(0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
+ gtk_scrolled_window_set_hadjustment(m_pScrolledWindow, pHAdjustment);
+
+ GtkWidget *pViewport = gtk_bin_get_child(GTK_BIN(m_pScrolledWindow));
+ assert(CRIPPLED_IS_VIEWPORT(pViewport));
+ GtkWidget *pChild = gtk_bin_get_child(GTK_BIN(pViewport));
+ g_object_ref(pChild);
+ gtk_container_remove(GTK_CONTAINER(pViewport), pChild);
+ g_object_ref(pViewport);
+ gtk_container_remove(GTK_CONTAINER(m_pScrolledWindow), pViewport);
+
+ gtk_container_add(GTK_CONTAINER(m_pScrolledWindow), m_pOrigViewport);
+ g_object_unref(m_pOrigViewport);
+ gtk_container_add(GTK_CONTAINER(m_pOrigViewport), pChild);
+ g_object_unref(pChild);
+ gtk_widget_destroy(pViewport);
+ g_object_unref(pViewport);
+ m_pOrigViewport = nullptr;
+ GtkInstanceContainer::enable_notify_events();
}
};
@@ -7549,21 +7549,21 @@ public:
break;
pTopLevelMenu = GTK_MENU(pParent);
}
- if (pTopLevelMenu != pMenu)
+ if (pTopLevelMenu == pMenu)
+ return;
+
+ // maybe the toplevel is a menubutton
+ GtkWidget* pAttached = gtk_menu_get_attach_widget(pTopLevelMenu);
+ if (pAttached && GTK_IS_MENU_BUTTON(pAttached))
{
- // maybe the toplevel is a menubutton
- GtkWidget* pAttached = gtk_menu_get_attach_widget(pTopLevelMenu);
- if (pAttached && GTK_IS_MENU_BUTTON(pAttached))
- {
- void* pData = g_object_get_data(G_OBJECT(pAttached), "g-lo-GtkInstanceButton");
- m_pTopLevelMenuHelper = dynamic_cast<GtkInstanceMenuButton*>(static_cast<GtkInstanceButton*>(pData));
- }
- // or maybe a menu
- if (!m_pTopLevelMenuHelper)
- {
- void* pData = g_object_get_data(G_OBJECT(pTopLevelMenu), "g-lo-GtkInstanceMenu");
- m_pTopLevelMenuHelper = static_cast<GtkInstanceMenu*>(pData);
- }
+ void* pData = g_object_get_data(G_OBJECT(pAttached), "g-lo-GtkInstanceButton");
+ m_pTopLevelMenuHelper = dynamic_cast<GtkInstanceMenuButton*>(static_cast<GtkInstanceButton*>(pData));
+ }
+ // or maybe a menu
+ if (!m_pTopLevelMenuHelper)
+ {
+ void* pData = g_object_get_data(G_OBJECT(pTopLevelMenu), "g-lo-GtkInstanceMenu");
+ m_pTopLevelMenuHelper = static_cast<GtkInstanceMenu*>(pData);
}
}
@@ -10531,28 +10531,28 @@ public:
GtkTreePath* start_path;
GtkTreePath* end_path;
- if (gtk_tree_view_get_visible_range(m_pTreeView, &start_path, &end_path))
- {
- GtkInstanceTreeIter aGtkIter(nullptr);
- GtkTreeModel *pModel = GTK_TREE_MODEL(m_pTreeStore);
- gtk_tree_model_get_iter(pModel, &aGtkIter.iter, start_path);
+ if (!gtk_tree_view_get_visible_range(m_pTreeView, &start_path, &end_path))
+ return;
- do
- {
- if (func(aGtkIter))
- break;
- GtkTreePath* path = gtk_tree_model_get_path(pModel, &aGtkIter.iter);
- bool bContinue = gtk_tree_path_compare(path, end_path) != 0;
- gtk_tree_path_free(path);
- if (!bContinue)
- break;
- if (!iter_next(aGtkIter))
- break;
- } while(true);
+ GtkInstanceTreeIter aGtkIter(nullptr);
+ GtkTreeModel *pModel = GTK_TREE_MODEL(m_pTreeStore);
+ gtk_tree_model_get_iter(pModel, &aGtkIter.iter, start_path);
- gtk_tree_path_free(start_path);
- gtk_tree_path_free(end_path);
- }
+ do
+ {
+ if (func(aGtkIter))
+ break;
+ GtkTreePath* path = gtk_tree_model_get_path(pModel, &aGtkIter.iter);
+ bool bContinue = gtk_tree_path_compare(path, end_path) != 0;
+ gtk_tree_path_free(path);
+ if (!bContinue)
+ break;
+ if (!iter_next(aGtkIter))
+ break;
+ } while(true);
+
+ gtk_tree_path_free(start_path);
+ gtk_tree_path_free(end_path);
}
virtual void connect_visible_range_changed(const Link<weld::TreeView&, void>& rLink) override
@@ -14166,19 +14166,19 @@ private:
void signal_overlay_button_crossing(bool bEnter)
{
m_bMouseInOverlayButton = bEnter;
- if (bEnter)
+ if (!bEnter)
+ return;
+
+ if (m_bHoverSelection)
{
- if (m_bHoverSelection)
- {
- // once toggled button is pressed, turn off hover selection until
- // mouse leaves the overlay button
- gtk_tree_view_set_hover_selection(m_pTreeView, false);
- m_bHoverSelection = false;
- }
- int nRow = find_id_including_mru(m_sMenuButtonRow, true);
- assert(nRow != -1);
- tree_view_set_cursor(nRow); // select the buttons row
+ // once toggled button is pressed, turn off hover selection until
+ // mouse leaves the overlay button
+ gtk_tree_view_set_hover_selection(m_pTreeView, false);
+ m_bHoverSelection = false;
}
+ int nRow = find_id_including_mru(m_sMenuButtonRow, true);
+ assert(nRow != -1);
+ tree_view_set_cursor(nRow); // select the buttons row
}
void signal_combo_mnemonic_activate()
@@ -16177,47 +16177,47 @@ void GtkInstanceWindow::help()
weld::Widget* pSource = xTemp ? xTemp.get() : this;
bool bRunNormalHelpRequest = !m_aHelpRequestHdl.IsSet() || m_aHelpRequestHdl.Call(*pSource);
Help* pHelp = bRunNormalHelpRequest ? Application::GetHelp() : nullptr;
- if (pHelp)
- {
- // tdf#126007, there's a nice fallback route for offline help where
- // the current page of a notebook will get checked when the help
- // button is pressed and there was no help for the dialog found.
- //
- // But for online help that route doesn't get taken, so bodge this here
- // by using the page help id if available and if the help button itself
- // was the original id
- if (m_pBuilder && sHelpId.endsWith("/help"))
- {
- OString sPageId = m_pBuilder->get_current_page_help_id();
- if (!sPageId.isEmpty())
- sHelpId = sPageId;
- else
+ if (!pHelp)
+ return;
+
+ // tdf#126007, there's a nice fallback route for offline help where
+ // the current page of a notebook will get checked when the help
+ // button is pressed and there was no help for the dialog found.
+ //
+ // But for online help that route doesn't get taken, so bodge this here
+ // by using the page help id if available and if the help button itself
+ // was the original id
+ if (m_pBuilder && sHelpId.endsWith("/help"))
+ {
+ OString sPageId = m_pBuilder->get_current_page_help_id();
+ if (!sPageId.isEmpty())
+ sHelpId = sPageId;
+ else
+ {
+ // tdf#129068 likewise the help for the wrapping dialog is less
+ // helpful than the help for the content area could be
+ GtkContainer* pContainer = nullptr;
+ if (GTK_IS_DIALOG(m_pWindow))
+ pContainer = GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(m_pWindow)));
+ else if (GTK_IS_ASSISTANT(m_pWindow))
{
- // tdf#129068 likewise the help for the wrapping dialog is less
- // helpful than the help for the content area could be
- GtkContainer* pContainer = nullptr;
- if (GTK_IS_DIALOG(m_pWindow))
- pContainer = GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(m_pWindow)));
- else if (GTK_IS_ASSISTANT(m_pWindow))
- {
- GtkAssistant* pAssistant = GTK_ASSISTANT(m_pWindow);
- pContainer = GTK_CONTAINER(gtk_assistant_get_nth_page(pAssistant, gtk_assistant_get_current_page(pAssistant)));
- }
- if (pContainer)
+ GtkAssistant* pAssistant = GTK_ASSISTANT(m_pWindow);
+ pContainer = GTK_CONTAINER(gtk_assistant_get_nth_page(pAssistant, gtk_assistant_get_current_page(pAssistant)));
+ }
+ if (pContainer)
+ {
+ GList* pChildren = gtk_container_get_children(pContainer);
+ GList* pChild = g_list_first(pChildren);
+ if (pChild)
{
- GList* pChildren = gtk_container_get_children(pContainer);
- GList* pChild = g_list_first(pChildren);
- if (pChild)
- {
- GtkWidget* pContentWidget = static_cast<GtkWidget*>(pChild->data);
- sHelpId = ::get_help_id(pContentWidget);
- }
- g_list_free(pChildren);
+ GtkWidget* pContentWidget = static_cast<GtkWidget*>(pChild->data);
+ sHelpId = ::get_help_id(pContentWidget);
}
+ g_list_free(pChildren);
}
}
- pHelp->Start(OStringToOUString(sHelpId, RTL_TEXTENCODING_UTF8), pSource);
}
+ pHelp->Start(OStringToOUString(sHelpId, RTL_TEXTENCODING_UTF8), pSource);
}
//iterate upwards through the hierarchy from this widgets through its parents
diff --git a/vcl/unx/gtk3/gtk3gtkobject.cxx b/vcl/unx/gtk3/gtk3gtkobject.cxx
index cb60406ec0e0..1a2cea0d71da 100644
--- a/vcl/unx/gtk3/gtk3gtkobject.cxx
+++ b/vcl/unx/gtk3/gtk3gtkobject.cxx
@@ -341,38 +341,38 @@ void GtkSalObjectWidgetClip::EndSetClipRegion()
void GtkSalObjectWidgetClip::ApplyClipRegion()
{
- if( m_pSocket )
- {
- GtkFixed* pContainer = GTK_FIXED(gtk_widget_get_parent(m_pScrolledWindow));
+ if( !m_pSocket )
+ return;
- GtkAllocation allocation;
- allocation.x = m_aRect.Left() + m_aClipRect.Left();
- allocation.y = m_aRect.Top() + m_aClipRect.Top();
- if (m_aClipRect.IsEmpty())
- {
- allocation.width = m_aRect.GetWidth();
- allocation.height = m_aRect.GetHeight();
- }
- else
- {
- allocation.width = m_aClipRect.GetWidth();
- allocation.height = m_aClipRect.GetHeight();
- }
-
- if (AllSettings::GetLayoutRTL())
- {
- GtkAllocation aParentAllocation;
- gtk_widget_get_allocation(GTK_WIDGET(pContainer), &aParentAllocation);
- gtk_fixed_move(pContainer, m_pScrolledWindow, aParentAllocation.width - allocation.width - 1 - allocation.x, allocation.y);
- }
- else
- gtk_fixed_move(pContainer, m_pScrolledWindow, allocation.x, allocation.y);
- gtk_widget_set_size_request(m_pScrolledWindow, allocation.width, allocation.height);
- gtk_widget_size_allocate(m_pScrolledWindow, &allocation);
+ GtkFixed* pContainer = GTK_FIXED(gtk_widget_get_parent(m_pScrolledWindow));
- gtk_adjustment_set_value(gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(m_pScrolledWindow)), m_aClipRect.Left());
- gtk_adjustment_set_value(gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(m_pScrolledWindow)), m_aClipRect.Top());
+ GtkAllocation allocation;
+ allocation.x = m_aRect.Left() + m_aClipRect.Left();
+ allocation.y = m_aRect.Top() + m_aClipRect.Top();
+ if (m_aClipRect.IsEmpty())
+ {
+ allocation.width = m_aRect.GetWidth();
+ allocation.height = m_aRect.GetHeight();
}
+ else
+ {
+ allocation.width = m_aClipRect.GetWidth();
+ allocation.height = m_aClipRect.GetHeight();
+ }
+
+ if (AllSettings::GetLayoutRTL())
+ {
+ GtkAllocation aParentAllocation;
+ gtk_widget_get_allocation(GTK_WIDGET(pContainer), &aParentAllocation);
+ gtk_fixed_move(pContainer, m_pScrolledWindow, aParentAllocation.width - allocation.width - 1 - allocation.x, allocation.y);
+ }
+ else
+ gtk_fixed_move(pContainer, m_pScrolledWindow, allocation.x, allocation.y);
+ gtk_widget_set_size_request(m_pScrolledWindow, allocation.width, allocation.height);
+ gtk_widget_size_allocate(m_pScrolledWindow, &allocation);
+
+ gtk_adjustment_set_value(gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(m_pScrolledWindow)), m_aClipRect.Left());
+ gtk_adjustment_set_value(gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(m_pScrolledWindow)), m_aClipRect.Top());
}
void GtkSalObjectWidgetClip::SetPosSize(long nX, long nY, long nWidth, long nHeight)
diff --git a/vcl/unx/gtk3/gtk3gtksalmenu.cxx b/vcl/unx/gtk3/gtk3gtksalmenu.cxx
index 13a7ef2d30ac..1ed0192de700 100644
--- a/vcl/unx/gtk3/gtk3gtksalmenu.cxx
+++ b/vcl/unx/gtk3/gtk3gtksalmenu.cxx
@@ -1344,32 +1344,32 @@ void GtkSalMenu::ShowItem( unsigned nPos, bool bShow )
void GtkSalMenu::SetItemText( unsigned nPos, SalMenuItem* pSalMenuItem, const OUString& rText )
{
SolarMutexGuard aGuard;
- if ( bUnityMode && !mbInActivateCallback && !mbNeedsUpdate && GetTopLevel()->mbMenuBar && ( nPos < maItems.size() ) )
- {
- gchar* pCommand = GetCommandForItem( static_cast< GtkSalMenuItem* >( pSalMenuItem ) );
+ if ( !bUnityMode || mbInActivateCallback || mbNeedsUpdate || !GetTopLevel()->mbMenuBar || ( nPos >= maItems.size() ) )
+ return;
- gint nSectionsCount = g_menu_model_get_n_items( mpMenuModel );
- for ( gint nSection = 0; nSection < nSectionsCount; ++nSection )
- {
- gint nItemsCount = g_lo_menu_get_n_items_from_section( G_LO_MENU( mpMenuModel ), nSection );
- for ( gint nItem = 0; nItem < nItemsCount; ++nItem )
- {
- gchar* pCommandFromModel = g_lo_menu_get_command_from_item_in_section( G_LO_MENU( mpMenuModel ), nSection, nItem );
+ gchar* pCommand = GetCommandForItem( static_cast< GtkSalMenuItem* >( pSalMenuItem ) );
- if ( !g_strcmp0( pCommandFromModel, pCommand ) )
- {
- NativeSetItemText( nSection, nItem, rText );
- g_free( pCommandFromModel );
- g_free( pCommand );
- return;
- }
+ gint nSectionsCount = g_menu_model_get_n_items( mpMenuModel );
+ for ( gint nSection = 0; nSection < nSectionsCount; ++nSection )
+ {
+ gint nItemsCount = g_lo_menu_get_n_items_from_section( G_LO_MENU( mpMenuModel ), nSection );
+ for ( gint nItem = 0; nItem < nItemsCount; ++nItem )
+ {
+ gchar* pCommandFromModel = g_lo_menu_get_command_from_item_in_section( G_LO_MENU( mpMenuModel ), nSection, nItem );
+ if ( !g_strcmp0( pCommandFromModel, pCommand ) )
+ {
+ NativeSetItemText( nSection, nItem, rText );
g_free( pCommandFromModel );
+ g_free( pCommand );
+ return;
}
- }
- g_free( pCommand );
+ g_free( pCommandFromModel );
+ }
}
+
+ g_free( pCommand );
}
void GtkSalMenu::SetItemImage( unsigned, SalMenuItem*, const Image& )
diff --git a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
index 5a853b436609..e7ec07754256 100644
--- a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
@@ -1049,31 +1049,31 @@ void GtkSalGraphics::PaintScrollbar(GtkStyleContext *context,
arrowRect.Left(), arrowRect.Top(),
MIN(arrowRect.GetWidth(), arrowRect.GetHeight()) );
}
- if ( has_forward )
- {
- stateFlags = NWConvertVCLStateToGTKState(rScrollbarVal.mnButton2State);
- if ( forwardButtonInsensitive )
- stateFlags = GTK_STATE_FLAG_INSENSITIVE;
+ if ( !has_forward )
+ return;
- GtkStyleContext* pScrollbarButtonStyle = scrollbarOrientation == GTK_ORIENTATION_VERTICAL ?
- mpVScrollbarButtonStyle : mpHScrollbarButtonStyle;
+ stateFlags = NWConvertVCLStateToGTKState(rScrollbarVal.mnButton2State);
+ if ( forwardButtonInsensitive )
+ stateFlags = GTK_STATE_FLAG_INSENSITIVE;
- gtk_style_context_set_state(pScrollbarButtonStyle, stateFlags);
+ GtkStyleContext* pScrollbarButtonStyle = scrollbarOrientation == GTK_ORIENTATION_VERTICAL ?
+ mpVScrollbarButtonStyle : mpHScrollbarButtonStyle;
- gtk_render_background(pScrollbarButtonStyle, cr,
- button22BoundRect.Left(), button22BoundRect.Top(),
- button22BoundRect.GetWidth(), button22BoundRect.GetHeight() );
- gtk_render_frame(pScrollbarButtonStyle, cr,
- button22BoundRect.Left(), button22BoundRect.Top(),
- button22BoundRect.GetWidth(), button22BoundRect.GetHeight() );
+ gtk_style_context_set_state(pScrollbarButtonStyle, stateFlags);
- // ----------------- ARROW 2
- NWCalcArrowRect( button22BoundRect, arrowRect );
- gtk_render_arrow(pScrollbarButtonStyle, cr,
- arrow2Angle,
- arrowRect.Left(), arrowRect.Top(),
- MIN(arrowRect.GetWidth(), arrowRect.GetHeight()) );
- }
+ gtk_render_background(pScrollbarButtonStyle, cr,
+ button22BoundRect.Left(), button22BoundRect.Top(),
+ button22BoundRect.GetWidth(), button22BoundRect.GetHeight() );
+ gtk_render_frame(pScrollbarButtonStyle, cr,
+ button22BoundRect.Left(), button22BoundRect.Top(),
+ button22BoundRect.GetWidth(), button22BoundRect.GetHeight() );
+
+ // ----------------- ARROW 2
+ NWCalcArrowRect( button22BoundRect, arrowRect );
+ gtk_render_arrow(pScrollbarButtonStyle, cr,
+ arrow2Angle,
+ arrowRect.Left(), arrowRect.Top(),
+ MIN(arrowRect.GetWidth(), arrowRect.GetHeight()) );
}
void GtkSalGraphics::PaintOneSpinButton( GtkStyleContext *context,
diff --git a/vcl/unx/gtk3/gtk3salprn-gtk.cxx b/vcl/unx/gtk3/gtk3salprn-gtk.cxx
index 62e88c919ee6..58fc5b21f100 100644
--- a/vcl/unx/gtk3/gtk3salprn-gtk.cxx
+++ b/vcl/unx/gtk3/gtk3salprn-gtk.cxx
@@ -707,33 +707,33 @@ GtkPrintDialog::impl_initPrintContent(uno::Sequence<sal_Bool> const& i_rDisabled
beans::PropertyValue* const pPrintContent(
m_rController.getValue(OUString("PrintContent")));
- if (pPrintContent)
+ if (!pPrintContent)
+ return;
+
+ sal_Int32 nSelectionType(0);
+ pPrintContent->Value >>= nSelectionType;
+ GtkPrintSettings* const pSettings(getSettings());
+ GtkPrintPages ePrintPages(GTK_PRINT_PAGES_ALL);
+ switch (nSelectionType)
{
- sal_Int32 nSelectionType(0);
- pPrintContent->Value >>= nSelectionType;
- GtkPrintSettings* const pSettings(getSettings());
- GtkPrintPages ePrintPages(GTK_PRINT_PAGES_ALL);
- switch (nSelectionType)
- {
- case 0:
- ePrintPages = GTK_PRINT_PAGES_ALL;
- break;
- case 1:
- ePrintPages = GTK_PRINT_PAGES_RANGES;
- break;
- case 2:
- if (m_xWrapper->supportsPrintSelection())
- ePrintPages = GTK_PRINT_PAGES_SELECTION;
- else
- SAL_INFO("vcl.gtk", "the application wants to print a selection, but the present gtk version does not support it");
- break;
- default:
- SAL_WARN("vcl.gtk", "unexpected selection type: " << nSelectionType);
- }
- m_xWrapper->print_settings_set_print_pages(pSettings, ePrintPages);
- m_xWrapper->print_unix_dialog_set_settings(pDialog, pSettings);
- g_object_unref(G_OBJECT(pSettings));
+ case 0:
+ ePrintPages = GTK_PRINT_PAGES_ALL;
+ break;
+ case 1:
+ ePrintPages = GTK_PRINT_PAGES_RANGES;
+ break;
+ case 2:
+ if (m_xWrapper->supportsPrintSelection())
+ ePrintPages = GTK_PRINT_PAGES_SELECTION;
+ else
+ SAL_INFO("vcl.gtk", "the application wants to print a selection, but the present gtk version does not support it");
+ break;
+ default:
+ SAL_WARN("vcl.gtk", "unexpected selection type: " << nSelectionType);
}
+ m_xWrapper->print_settings_set_print_pages(pSettings, ePrintPages);
+ m_xWrapper->print_unix_dialog_set_settings(pDialog, pSettings);
+ g_object_unref(G_OBJECT(pSettings));
}
void
@@ -778,18 +778,18 @@ GtkPrintDialog::impl_UIOption_CheckHdl(GtkWidget* const i_pWidget)
void
GtkPrintDialog::impl_UIOption_RadioHdl(GtkWidget* const i_pWidget)
{
- if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(i_pWidget)))
+ if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(i_pWidget)))
+ return;
+
+ beans::PropertyValue* const pVal = impl_queryPropertyValue(i_pWidget);
+ std::map<GtkWidget*, sal_Int32>::const_iterator it = m_aControlToNumValMap.find(i_pWidget);
+ if (pVal && it != m_aControlToNumValMap.end())
{
- beans::PropertyValue* const pVal = impl_queryPropertyValue(i_pWidget);
- std::map<GtkWidget*, sal_Int32>::const_iterator it = m_aControlToNumValMap.find(i_pWidget);
- if (pVal && it != m_aControlToNumValMap.end())
- {
- const sal_Int32 nVal = it->second;
- pVal->Value <<= nVal;
+ const sal_Int32 nVal = it->second;
+ pVal->Value <<= nVal;
- impl_checkOptionalControlDependencies();
- }
+ impl_checkOptionalControlDependencies();
}
}