~ubuntu-branches/ubuntu/lucid/openoffice.org-l10n/lucid

« back to all changes in this revision

Viewing changes to ooo-build/patches/dev300/vcl-guarding-display-dpi.diff

  • Committer: Bazaar Package Importer
  • Author(s): Chris Cheney
  • Date: 2010-01-19 16:00:00 UTC
  • mfrom: (1.1.28 upstream)
  • Revision ID: james.westby@ubuntu.com-20100119160000-freeu943fe1z3o76
Tags: 1:3.2.0~rc2-1ubuntu1
* Resynchronise with Debian (r1764). Remaining changes:
  - Add Launchpad integration support.
  - Add Launchpad translations support.
  - Add package openoffice.org-style-human.
  - Add some Ubuntu-specific bitmaps. Adjust broffice diversions for these.
  - Add support for compressing debs with lzma.
  - Add support for shared /usr/share/doc directories.
  - Add support to build l10n as a separate source.
  - Add support to turn off building on sparc.
  - Add Xb-Npp-xxx tags according to "firefox distro add-on suport" spec.
  - Use imagemagick instead of graphicsmagick.
  - openoffice.org-help switch to internal copy of lucene.
  - Disable gnome-vfs support since it is buggy.
  - Switch desktop files from %U to %F for gvfs fuse.
* Resynchronise with ooo-build-3-2 (454ea0d62d4321b54cd5ef870ac99d8d7929c459).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
--- vcl/unx/source/app/saldisp.cxx      (.../tags/DEV300_m46/vcl)       (Revision 271422)
2
 
+++ vcl/unx/source/app/saldisp.cxx      (.../cws/vcl101/vcl)    (Revision 271422)
3
 
@@ -831,24 +831,28 @@
4
 
     int nDisplayScreens = ScreenCount( pDisp_ );
5
 
     m_aScreens = std::vector<ScreenData>(nDisplayScreens);
6
 
 
7
 
-    const char *value;
8
 
+    mbExactResolution = false;
9
 
     /*  #i15507#
10
 
      *  Xft resolution should take precedence since
11
 
      *  it is what modern desktops use.
12
 
      */
13
 
-    if ((value = XGetDefault (pDisp_, "Xft", "dpi")))
14
 
+    const char* pValStr = XGetDefault( pDisp_, "Xft", "dpi" );
15
 
+    if( pValStr != NULL )
16
 
     {
17
 
-        rtl::OString str (value);
18
 
-        long dpi = (long) str.toDouble();
19
 
-        aResolution_ = Pair( dpi, dpi );
20
 
-        mbExactResolution = true;
21
 
+        const rtl::OString aValStr( pValStr );
22
 
+        const long nDPI = (long) aValStr.toDouble();
23
 
+        // guard against insane resolution
24
 
+        if( (nDPI >= 50) && (nDPI <= 500) )
25
 
+        {
26
 
+            aResolution_ = Pair( nDPI, nDPI );
27
 
+            mbExactResolution = true;
28
 
+        }
29
 
     }
30
 
-    else
31
 
+    if( mbExactResolution == false )
32
 
     {
33
 
         aResolution_     =
34
 
             Pair( DPI( WidthOfScreen( DefaultScreenOfDisplay( pDisp_ ) ), DisplayWidthMM ( pDisp_, m_nDefaultScreen ) ),
35
 
                   DPI( HeightOfScreen( DefaultScreenOfDisplay( pDisp_ ) ), DisplayHeightMM( pDisp_, m_nDefaultScreen ) ) );
36
 
-        mbExactResolution      = false;
37
 
     }
38
 
 
39
 
     nMaxRequestSize_    = XExtendedMaxRequestSize( pDisp_ ) * 4;