xref: /aoo42x/main/vcl/unx/generic/app/randrwrapper.cxx (revision c82f2877)
1*c82f2877SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*c82f2877SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*c82f2877SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*c82f2877SAndrew Rist  * distributed with this work for additional information
6*c82f2877SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*c82f2877SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*c82f2877SAndrew Rist  * "License"); you may not use this file except in compliance
9*c82f2877SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*c82f2877SAndrew Rist  *
11*c82f2877SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*c82f2877SAndrew Rist  *
13*c82f2877SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*c82f2877SAndrew Rist  * software distributed under the License is distributed on an
15*c82f2877SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*c82f2877SAndrew Rist  * KIND, either express or implied.  See the License for the
17*c82f2877SAndrew Rist  * specific language governing permissions and limitations
18*c82f2877SAndrew Rist  * under the License.
19*c82f2877SAndrew Rist  *
20*c82f2877SAndrew Rist  *************************************************************/
21*c82f2877SAndrew Rist 
22*c82f2877SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifdef USE_RANDR
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #include <tools/prex.h>
27cdf0e10cSrcweir #include <X11/extensions/Xrandr.h>
28cdf0e10cSrcweir #include <tools/postx.h>
29cdf0e10cSrcweir 
30cdf0e10cSrcweir #include "osl/module.h"
31cdf0e10cSrcweir #include "rtl/ustring.hxx"
32cdf0e10cSrcweir 
33cdf0e10cSrcweir namespace
34cdf0e10cSrcweir {
35cdf0e10cSrcweir 
36cdf0e10cSrcweir # ifdef XRANDR_DLOPEN
37cdf0e10cSrcweir 
38cdf0e10cSrcweir class RandRWrapper
39cdf0e10cSrcweir {
40cdf0e10cSrcweir     oslModule m_pRandRLib;
41cdf0e10cSrcweir 
42cdf0e10cSrcweir     // function pointers
43cdf0e10cSrcweir     Bool(*m_pXRRQueryExtension)(Display*,int*,int*);
44cdf0e10cSrcweir     Status(*m_pXRRQueryVersion)(Display*,int*,int*);
45cdf0e10cSrcweir     XRRScreenConfiguration*(*m_pXRRGetScreenInfo)(Display*,Drawable);
46cdf0e10cSrcweir     void(*m_pXRRFreeScreenConfigInfo)(XRRScreenConfiguration*);
47cdf0e10cSrcweir     void(*m_pXRRSelectInput)(Display*,XLIB_Window,int);
48cdf0e10cSrcweir     int(*m_pXRRUpdateConfiguration)(XEvent*);
49cdf0e10cSrcweir     XRRScreenSize*(*m_pXRRSizes)(Display*,int,int*);
50cdf0e10cSrcweir     XRRScreenSize*(*m_pXRRConfigSizes)(XRRScreenConfiguration*,int*);
51cdf0e10cSrcweir     SizeID(*m_pXRRConfigCurrentConfiguration)(XRRScreenConfiguration*,Rotation*);
52cdf0e10cSrcweir     int(*m_pXRRRootToScreen)(Display*, XLIB_Window);
53cdf0e10cSrcweir 
54cdf0e10cSrcweir     bool m_bValid;
55cdf0e10cSrcweir 
56cdf0e10cSrcweir     void initFromModule();
57cdf0e10cSrcweir 
58cdf0e10cSrcweir     RandRWrapper(Display*);
59cdf0e10cSrcweir     ~RandRWrapper();
60cdf0e10cSrcweir public:
61cdf0e10cSrcweir     static RandRWrapper& get(Display*);
62cdf0e10cSrcweir     static void releaseWrapper();
63cdf0e10cSrcweir 
64cdf0e10cSrcweir     Bool XRRQueryExtension(Display* i_pDisp, int* o_event_base, int* o_error_base )
65cdf0e10cSrcweir     {
66cdf0e10cSrcweir         Bool bRet = False;
67cdf0e10cSrcweir         if( m_bValid )
68cdf0e10cSrcweir             bRet = m_pXRRQueryExtension( i_pDisp, o_event_base, o_error_base );
69cdf0e10cSrcweir         return bRet;
70cdf0e10cSrcweir     }
71cdf0e10cSrcweir     Status XRRQueryVersion( Display* i_pDisp, int* o_major, int* o_minor )
72cdf0e10cSrcweir     {
73cdf0e10cSrcweir         return m_bValid ? m_pXRRQueryVersion( i_pDisp, o_major, o_minor ) : 0;
74cdf0e10cSrcweir     }
75cdf0e10cSrcweir     XRRScreenConfiguration* XRRGetScreenInfo( Display* i_pDisp, Drawable i_aDrawable )
76cdf0e10cSrcweir     {
77cdf0e10cSrcweir         return m_bValid ? m_pXRRGetScreenInfo( i_pDisp, i_aDrawable ) : NULL;
78cdf0e10cSrcweir     }
79cdf0e10cSrcweir     void XRRFreeScreenConfigInfo( XRRScreenConfiguration* i_pConfig )
80cdf0e10cSrcweir     {
81cdf0e10cSrcweir         if( m_bValid )
82cdf0e10cSrcweir             m_pXRRFreeScreenConfigInfo( i_pConfig );
83cdf0e10cSrcweir     }
84cdf0e10cSrcweir     void XRRSelectInput( Display* i_pDisp, XLIB_Window i_window, int i_nMask )
85cdf0e10cSrcweir     {
86cdf0e10cSrcweir         if( m_bValid )
87cdf0e10cSrcweir             m_pXRRSelectInput( i_pDisp, i_window, i_nMask );
88cdf0e10cSrcweir     }
89cdf0e10cSrcweir     int XRRUpdateConfiguration( XEvent* i_pEvent )
90cdf0e10cSrcweir     {
91cdf0e10cSrcweir         return m_bValid ? m_pXRRUpdateConfiguration( i_pEvent ) : 0;
92cdf0e10cSrcweir     }
93cdf0e10cSrcweir     XRRScreenSize* XRRSizes( Display* i_pDisp, int i_screen, int* o_nscreens )
94cdf0e10cSrcweir     {
95cdf0e10cSrcweir         return m_bValid ? m_pXRRSizes( i_pDisp, i_screen, o_nscreens ) : NULL;
96cdf0e10cSrcweir     }
97cdf0e10cSrcweir     XRRScreenSize* XRRConfigSizes( XRRScreenConfiguration* i_pConfig, int* o_nSizes )
98cdf0e10cSrcweir     {
99cdf0e10cSrcweir         return m_bValid ? m_pXRRConfigSizes( i_pConfig, o_nSizes ) : NULL;
100cdf0e10cSrcweir     }
101cdf0e10cSrcweir     SizeID XRRConfigCurrentConfiguration( XRRScreenConfiguration* i_pConfig, Rotation* o_pRot )
102cdf0e10cSrcweir     {
103cdf0e10cSrcweir         return m_bValid ? m_pXRRConfigCurrentConfiguration( i_pConfig, o_pRot ) : 0;
104cdf0e10cSrcweir     }
105cdf0e10cSrcweir     int XRRRootToScreen( Display *dpy, XLIB_Window root )
106cdf0e10cSrcweir     {
107cdf0e10cSrcweir         return m_bValid ? m_pXRRRootToScreen( dpy, root ) : -1;
108cdf0e10cSrcweir     }
109cdf0e10cSrcweir };
110cdf0e10cSrcweir 
111cdf0e10cSrcweir void RandRWrapper::initFromModule()
112cdf0e10cSrcweir {
113cdf0e10cSrcweir     m_pXRRQueryExtension = (Bool(*)(Display*,int*,int*))osl_getAsciiFunctionSymbol( m_pRandRLib, "XRRQueryExtension" );
114cdf0e10cSrcweir     m_pXRRQueryVersion = (Status(*)(Display*,int*,int*))osl_getAsciiFunctionSymbol( m_pRandRLib, "XRRQueryVersion" );
115cdf0e10cSrcweir     m_pXRRGetScreenInfo = (XRRScreenConfiguration*(*)(Display*,Drawable))osl_getAsciiFunctionSymbol( m_pRandRLib, "XRRGetScreenInfo" );
116cdf0e10cSrcweir     m_pXRRFreeScreenConfigInfo = (void(*)(XRRScreenConfiguration*))osl_getAsciiFunctionSymbol( m_pRandRLib, "XRRFreeScreenConfigInfo" );
117cdf0e10cSrcweir     m_pXRRSelectInput = (void(*)(Display*,XLIB_Window,int))osl_getAsciiFunctionSymbol( m_pRandRLib, "XRRSelectInput" );
118cdf0e10cSrcweir     m_pXRRUpdateConfiguration = (int(*)(XEvent*))osl_getAsciiFunctionSymbol( m_pRandRLib, "XRRUpdateConfiguration" );
119cdf0e10cSrcweir     m_pXRRSizes = (XRRScreenSize*(*)(Display*,int,int*))osl_getAsciiFunctionSymbol( m_pRandRLib, "XRRSizes" );
120cdf0e10cSrcweir     m_pXRRConfigSizes = (XRRScreenSize*(*)(XRRScreenConfiguration*,int*))osl_getAsciiFunctionSymbol( m_pRandRLib, "XRRConfigSizes" );
121cdf0e10cSrcweir     m_pXRRConfigCurrentConfiguration = (SizeID(*)(XRRScreenConfiguration*,Rotation*))osl_getAsciiFunctionSymbol( m_pRandRLib, "XRRConfigCurrentConfiguration" );
122cdf0e10cSrcweir     m_pXRRRootToScreen = (int(*)(Display*,XLIB_Window))osl_getAsciiFunctionSymbol( m_pRandRLib, "XRRRootToScreen" );
123cdf0e10cSrcweir 
124cdf0e10cSrcweir     m_bValid = m_pXRRQueryExtension             &&
125cdf0e10cSrcweir                m_pXRRQueryVersion               &&
126cdf0e10cSrcweir                m_pXRRGetScreenInfo              &&
127cdf0e10cSrcweir                m_pXRRFreeScreenConfigInfo       &&
128cdf0e10cSrcweir                m_pXRRSelectInput                &&
129cdf0e10cSrcweir                m_pXRRUpdateConfiguration        &&
130cdf0e10cSrcweir                m_pXRRSizes                      &&
131cdf0e10cSrcweir                m_pXRRConfigSizes                &&
132cdf0e10cSrcweir                m_pXRRConfigCurrentConfiguration &&
133cdf0e10cSrcweir                m_pXRRRootToScreen
134cdf0e10cSrcweir                ;
135cdf0e10cSrcweir }
136cdf0e10cSrcweir 
137cdf0e10cSrcweir RandRWrapper::RandRWrapper( Display* pDisplay ) :
138cdf0e10cSrcweir         m_pRandRLib( NULL ),
139cdf0e10cSrcweir         m_pXRRQueryExtension( NULL ),
140cdf0e10cSrcweir         m_pXRRQueryVersion( NULL ),
141cdf0e10cSrcweir         m_pXRRGetScreenInfo( NULL ),
142cdf0e10cSrcweir         m_pXRRFreeScreenConfigInfo( NULL ),
143cdf0e10cSrcweir         m_pXRRSelectInput( NULL ),
144cdf0e10cSrcweir         m_pXRRUpdateConfiguration( NULL ),
145cdf0e10cSrcweir         m_pXRRSizes( NULL ),
146cdf0e10cSrcweir         m_pXRRConfigSizes( NULL ),
147cdf0e10cSrcweir         m_pXRRConfigCurrentConfiguration( NULL ),
148cdf0e10cSrcweir         m_pXRRRootToScreen( NULL ),
149cdf0e10cSrcweir         m_bValid( false )
150cdf0e10cSrcweir {
151cdf0e10cSrcweir     // first try in process space (e.g. gtk links that ?)
152cdf0e10cSrcweir     initFromModule();
153cdf0e10cSrcweir     if( ! m_bValid )
154cdf0e10cSrcweir     {
155cdf0e10cSrcweir         rtl::OUString aLibName( RTL_CONSTASCII_USTRINGPARAM( "libXrandr.so.2" ) );
156cdf0e10cSrcweir         // load and resolve dependencies immediately
157cdf0e10cSrcweir         // rationale: there are older distributions where libXrandr.so.2 is not linked
158cdf0e10cSrcweir         // with libXext.so, resulting in a missing symbol and terminating the office
159cdf0e10cSrcweir         // obviously they expected libXext to be linked in global symbolspace (that is
160cdf0e10cSrcweir         // linked by the application), which is not the case with us (because we want
161cdf0e10cSrcweir         // to be able to run in headless mode even without an installed X11 library)
162cdf0e10cSrcweir         m_pRandRLib = osl_loadModule( aLibName.pData, SAL_LOADMODULE_DEFAULT | SAL_LOADMODULE_NOW );
163cdf0e10cSrcweir         initFromModule();
164cdf0e10cSrcweir     }
165cdf0e10cSrcweir     if( m_bValid )
166cdf0e10cSrcweir     {
167cdf0e10cSrcweir         int nEventBase = 0, nErrorBase = 0;
168cdf0e10cSrcweir         if( ! m_pXRRQueryExtension( pDisplay, &nEventBase, &nErrorBase ) )
169cdf0e10cSrcweir             m_bValid = false;
170cdf0e10cSrcweir     }
171cdf0e10cSrcweir }
172cdf0e10cSrcweir 
173cdf0e10cSrcweir RandRWrapper::~RandRWrapper()
174cdf0e10cSrcweir {
175cdf0e10cSrcweir     if( m_pRandRLib )
176cdf0e10cSrcweir         osl_unloadModule( m_pRandRLib );
177cdf0e10cSrcweir }
178cdf0e10cSrcweir 
179cdf0e10cSrcweir static RandRWrapper* pWrapper = NULL;
180cdf0e10cSrcweir 
181cdf0e10cSrcweir RandRWrapper& RandRWrapper::get( Display* i_pDisplay )
182cdf0e10cSrcweir {
183cdf0e10cSrcweir     if( ! pWrapper )
184cdf0e10cSrcweir         pWrapper = new RandRWrapper( i_pDisplay );
185cdf0e10cSrcweir     return *pWrapper;
186cdf0e10cSrcweir }
187cdf0e10cSrcweir 
188cdf0e10cSrcweir void RandRWrapper::releaseWrapper()
189cdf0e10cSrcweir {
190cdf0e10cSrcweir     delete pWrapper;
191cdf0e10cSrcweir     pWrapper = NULL;
192cdf0e10cSrcweir }
193cdf0e10cSrcweir 
194cdf0e10cSrcweir # else
195cdf0e10cSrcweir 
196cdf0e10cSrcweir class RandRWrapper
197cdf0e10cSrcweir {
198cdf0e10cSrcweir     bool m_bValid;
199cdf0e10cSrcweir 
200cdf0e10cSrcweir     RandRWrapper(Display*);
201cdf0e10cSrcweir public:
202cdf0e10cSrcweir     static RandRWrapper& get(Display*);
203cdf0e10cSrcweir     static void releaseWrapper();
204cdf0e10cSrcweir 
205cdf0e10cSrcweir     Bool XRRQueryExtension(Display* i_pDisp, int* o_event_base, int* o_error_base )
206cdf0e10cSrcweir     {
207cdf0e10cSrcweir         Bool bRet = False;
208cdf0e10cSrcweir         if( m_bValid )
209cdf0e10cSrcweir             bRet = ::XRRQueryExtension( i_pDisp, o_event_base, o_error_base );
210cdf0e10cSrcweir         return bRet;
211cdf0e10cSrcweir     }
212cdf0e10cSrcweir     Status XRRQueryVersion( Display* i_pDisp, int* o_major, int* o_minor )
213cdf0e10cSrcweir     {
214cdf0e10cSrcweir         return m_bValid ? ::XRRQueryVersion( i_pDisp, o_major, o_minor ) : 0;
215cdf0e10cSrcweir     }
216cdf0e10cSrcweir     XRRScreenConfiguration* XRRGetScreenInfo( Display* i_pDisp, Drawable i_aDrawable )
217cdf0e10cSrcweir     {
218cdf0e10cSrcweir         return m_bValid ? ::XRRGetScreenInfo( i_pDisp, i_aDrawable ) : NULL;
219cdf0e10cSrcweir     }
220cdf0e10cSrcweir     void XRRFreeScreenConfigInfo( XRRScreenConfiguration* i_pConfig )
221cdf0e10cSrcweir     {
222cdf0e10cSrcweir         if( m_bValid )
223cdf0e10cSrcweir             ::XRRFreeScreenConfigInfo( i_pConfig );
224cdf0e10cSrcweir     }
225cdf0e10cSrcweir     void XRRSelectInput( Display* i_pDisp, XLIB_Window i_window, int i_nMask )
226cdf0e10cSrcweir     {
227cdf0e10cSrcweir         if( m_bValid )
228cdf0e10cSrcweir             ::XRRSelectInput( i_pDisp, i_window, i_nMask );
229cdf0e10cSrcweir     }
230cdf0e10cSrcweir     int XRRUpdateConfiguration( XEvent* i_pEvent )
231cdf0e10cSrcweir     {
232cdf0e10cSrcweir         return m_bValid ? ::XRRUpdateConfiguration( i_pEvent ) : 0;
233cdf0e10cSrcweir     }
234cdf0e10cSrcweir     XRRScreenSize* XRRSizes( Display* i_pDisp, int i_screen, int* o_nscreens )
235cdf0e10cSrcweir     {
236cdf0e10cSrcweir         return m_bValid ? ::XRRSizes( i_pDisp, i_screen, o_nscreens ) : NULL;
237cdf0e10cSrcweir     }
238cdf0e10cSrcweir     XRRScreenSize* XRRConfigSizes( XRRScreenConfiguration* i_pConfig, int* o_nSizes )
239cdf0e10cSrcweir     {
240cdf0e10cSrcweir         return m_bValid ? ::XRRConfigSizes( i_pConfig, o_nSizes ) : NULL;
241cdf0e10cSrcweir     }
242cdf0e10cSrcweir     SizeID XRRConfigCurrentConfiguration( XRRScreenConfiguration* i_pConfig, Rotation* o_pRot )
243cdf0e10cSrcweir     {
244cdf0e10cSrcweir         return m_bValid ? ::XRRConfigCurrentConfiguration( i_pConfig, o_pRot ) : 0;
245cdf0e10cSrcweir     }
246cdf0e10cSrcweir     int XRRRootToScreen( Display *dpy, XLIB_Window root )
247cdf0e10cSrcweir     {
248cdf0e10cSrcweir         return m_bValid ? ::XRRRootToScreen( dpy, root ) : -1;
249cdf0e10cSrcweir     }
250cdf0e10cSrcweir };
251cdf0e10cSrcweir 
252cdf0e10cSrcweir RandRWrapper::RandRWrapper( Display* pDisplay ) :
253cdf0e10cSrcweir     m_bValid( true )
254cdf0e10cSrcweir {
255cdf0e10cSrcweir     int nEventBase = 0, nErrorBase = 0;
256cdf0e10cSrcweir     if( !XRRQueryExtension( pDisplay, &nEventBase, &nErrorBase ) )
257cdf0e10cSrcweir         m_bValid = false;
258cdf0e10cSrcweir }
259cdf0e10cSrcweir 
260cdf0e10cSrcweir static RandRWrapper* pWrapper = NULL;
261cdf0e10cSrcweir 
262cdf0e10cSrcweir RandRWrapper& RandRWrapper::get( Display* i_pDisplay )
263cdf0e10cSrcweir {
264cdf0e10cSrcweir     if( ! pWrapper )
265cdf0e10cSrcweir         pWrapper = new RandRWrapper( i_pDisplay );
266cdf0e10cSrcweir     return *pWrapper;
267cdf0e10cSrcweir }
268cdf0e10cSrcweir 
269cdf0e10cSrcweir void RandRWrapper::releaseWrapper()
270cdf0e10cSrcweir {
271cdf0e10cSrcweir     delete pWrapper;
272cdf0e10cSrcweir     pWrapper = NULL;
273cdf0e10cSrcweir }
274cdf0e10cSrcweir 
275cdf0e10cSrcweir #endif
276cdf0e10cSrcweir 
277cdf0e10cSrcweir } // namespace
278cdf0e10cSrcweir 
279cdf0e10cSrcweir #endif
280cdf0e10cSrcweir 
281cdf0e10cSrcweir #include "unx/saldisp.hxx"
282cdf0e10cSrcweir #include "unx/salframe.h"
283cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 1
284cdf0e10cSrcweir #include <cstdio>
285cdf0e10cSrcweir #endif
286cdf0e10cSrcweir 
287cdf0e10cSrcweir void SalDisplay::InitRandR( XLIB_Window aRoot ) const
288cdf0e10cSrcweir {
289cdf0e10cSrcweir     #ifdef USE_RANDR
290cdf0e10cSrcweir     if( m_bUseRandRWrapper )
291cdf0e10cSrcweir         RandRWrapper::get( GetDisplay() ).XRRSelectInput( GetDisplay(), aRoot, RRScreenChangeNotifyMask );
292cdf0e10cSrcweir     #else
293cdf0e10cSrcweir     (void)aRoot;
294cdf0e10cSrcweir     #endif
295cdf0e10cSrcweir }
296cdf0e10cSrcweir 
297cdf0e10cSrcweir void SalDisplay::DeInitRandR()
298cdf0e10cSrcweir {
299cdf0e10cSrcweir     #ifdef USE_RANDR
300cdf0e10cSrcweir     if( m_bUseRandRWrapper )
301cdf0e10cSrcweir         RandRWrapper::releaseWrapper();
302cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 1
303cdf0e10cSrcweir     fprintf( stderr, "SalDisplay::DeInitRandR()\n" );
304cdf0e10cSrcweir #endif
305cdf0e10cSrcweir     #endif
306cdf0e10cSrcweir }
307cdf0e10cSrcweir 
308cdf0e10cSrcweir int SalDisplay::processRandREvent( XEvent* pEvent )
309cdf0e10cSrcweir {
310cdf0e10cSrcweir     int nRet = 0;
311cdf0e10cSrcweir     #ifdef USE_RANDR
312cdf0e10cSrcweir     XConfigureEvent* pCnfEvent=(XConfigureEvent*)pEvent;
313cdf0e10cSrcweir     if( m_bUseRandRWrapper && pWrapper && pWrapper->XRRRootToScreen(GetDisplay(),pCnfEvent->window) != -1 )
314cdf0e10cSrcweir     {
315cdf0e10cSrcweir         nRet = pWrapper->XRRUpdateConfiguration( pEvent );
316cdf0e10cSrcweir         if( nRet == 1 && pEvent->type != ConfigureNotify) // this should then be a XRRScreenChangeNotifyEvent
317cdf0e10cSrcweir         {
318cdf0e10cSrcweir             // update screens
319cdf0e10cSrcweir             bool bNotify = false;
320cdf0e10cSrcweir             for( size_t i = 0; i < m_aScreens.size(); i++ )
321cdf0e10cSrcweir             {
322cdf0e10cSrcweir                 if( m_aScreens[i].m_bInit )
323cdf0e10cSrcweir                 {
324cdf0e10cSrcweir                     XRRScreenConfiguration *pConfig = NULL;
325cdf0e10cSrcweir                     XRRScreenSize *pSizes = NULL;
326cdf0e10cSrcweir                     int nSizes = 0;
327cdf0e10cSrcweir                     Rotation nRot = 0;
328cdf0e10cSrcweir                     SizeID nId = 0;
329cdf0e10cSrcweir 
330cdf0e10cSrcweir                     pConfig = pWrapper->XRRGetScreenInfo( GetDisplay(), m_aScreens[i].m_aRoot );
331cdf0e10cSrcweir                     nId = pWrapper->XRRConfigCurrentConfiguration( pConfig, &nRot );
332cdf0e10cSrcweir                     pSizes = pWrapper->XRRConfigSizes( pConfig, &nSizes );
333cdf0e10cSrcweir                     XRRScreenSize *pTargetSize = pSizes + nId;
334cdf0e10cSrcweir 
335cdf0e10cSrcweir                     bNotify = bNotify ||
336cdf0e10cSrcweir                               m_aScreens[i].m_aSize.Width() != pTargetSize->width ||
337cdf0e10cSrcweir                               m_aScreens[i].m_aSize.Height() != pTargetSize->height;
338cdf0e10cSrcweir 
339cdf0e10cSrcweir                     m_aScreens[i].m_aSize = Size( pTargetSize->width, pTargetSize->height );
340cdf0e10cSrcweir 
341cdf0e10cSrcweir                     pWrapper->XRRFreeScreenConfigInfo( pConfig );
342cdf0e10cSrcweir 
343cdf0e10cSrcweir                     #if OSL_DEBUG_LEVEL > 1
344cdf0e10cSrcweir                     fprintf( stderr, "screen %d changed to size %dx%d\n", (int)i, (int)pTargetSize->width, (int)pTargetSize->height );
345cdf0e10cSrcweir                     #endif
346cdf0e10cSrcweir                 }
347cdf0e10cSrcweir             }
348cdf0e10cSrcweir             if( bNotify && ! m_aFrames.empty() )
349cdf0e10cSrcweir                 m_aFrames.front()->CallCallback( SALEVENT_DISPLAYCHANGED, 0 );
350cdf0e10cSrcweir         }
351cdf0e10cSrcweir     }
352cdf0e10cSrcweir     #else
353cdf0e10cSrcweir     (void)pEvent;
354cdf0e10cSrcweir     #endif
355cdf0e10cSrcweir     return nRet;
356cdf0e10cSrcweir }
357