1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: dtint.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_vcl.hxx"
35 #include <sys/types.h>
41 #include <X11/Xatom.h>
47 #include <saldisp.hxx>
48 #include <saldata.hxx>
49 #include <wmadaptor.hxx>
51 #include <vcl/svapp.hxx>
52 #include <dtsetenum.hxx>
55 #include <osl/process.h>
56 #include <osl/security.h>
61 // NETBSD has no RTLD_GLOBAL
63 #define DLOPEN_MODE (RTLD_LAZY)
65 #define DLOPEN_MODE (RTLD_GLOBAL | RTLD_LAZY)
70 using namespace vcl_sal
;
72 String
DtIntegrator::aHomeDir
;
74 DtIntegrator::DtIntegrator() :
76 mnSystemLookCommandProcess( -1 )
78 mpSalDisplay
= GetX11SalData()->GetDisplay();
79 mpDisplay
= mpSalDisplay
->GetDisplay();
81 oslSecurity aCur
= osl_getCurrentSecurity();
84 osl_getHomeDir( aCur
, &aDir
.pData
);
85 osl_freeSecurityHandle( aCur
);
87 osl_getSystemPathFromFileURL( aDir
.pData
, &aSysDir
.pData
);
92 DtIntegrator::~DtIntegrator()
96 DtIntegrator
* DtIntegrator::CreateDtIntegrator()
99 * #i22061# override desktop detection
100 * if environment variable OOO_FORCE_DESKTOP is set
101 * to one of "cde" "kde" "gnome" then autodetection
104 static const char* pOverride
= getenv( "OOO_FORCE_DESKTOP" );
105 if( pOverride
&& *pOverride
)
107 OString
aOver( pOverride
);
110 if( aOver
.equalsIgnoreAsciiCase( "cde" ) )
111 return new CDEIntegrator();
113 if( aOver
.equalsIgnoreAsciiCase( "none" ) )
114 return new DtIntegrator();
118 void* pLibrary
= NULL
;
122 SalDisplay
* pSalDisplay
= GetX11SalData()->GetDisplay();
123 Display
* pDisplay
= pSalDisplay
->GetDisplay();
124 Atom nDtAtom
= XInternAtom( pDisplay
, "_DT_WM_READY", True
);
125 if( nDtAtom
&& ( pLibrary
= dlopen( "/usr/dt/lib/libDtSvc.so", DLOPEN_MODE
) ) )
128 return new CDEIntegrator();
132 // default: generic implementation
133 return new DtIntegrator();
136 void DtIntegrator::GetSystemLook( AllSettings
& rSettings
)
138 // #i48001# set a default blink rate
139 StyleSettings aStyleSettings
= rSettings
.GetStyleSettings();
140 aStyleSettings
.SetCursorBlinkTime( 500 );
141 rSettings
.SetStyleSettings( aStyleSettings
);