[Libreoffice-commits] .: 2 commits - vcl/unx
vcl/unx/generic/app/saldisp.cxx | 62 +--- 1 file changed, 52 insertions(+), 10 deletions(-) New commits: commit 0e93d1e91f2b6994e509e16de6989afb8fdf3207 Author: Thomas Arnhold tho...@arnhold.org Date: Mon Jan 30 22:52:19 2012 +0100 Revert vcl: BestVisuals strip This reverts commit 9c1a107696d032ec4e5e5ac0526c643d3a666c06. this is work is progress, not public... diff --git a/vcl/unx/generic/app/saldisp.cxx b/vcl/unx/generic/app/saldisp.cxx index 90cfe61..5269065 100644 --- a/vcl/unx/generic/app/saldisp.cxx +++ b/vcl/unx/generic/app/saldisp.cxx @@ -241,6 +241,13 @@ sal_Bool SalDisplay::BestVisual( Display *pDisplay, XVisualInfo rVI ) { VisualID nDefVID = XVisualIDFromVisual( DefaultVisual( pDisplay, nScreen ) ); +VisualIDnVID = 0; +char *pVID = getenv( SAL_VISUAL ); +if( pVID ) +sscanf( pVID, %li, nVID ); + +if( nVID sal_GetVisualInfo( pDisplay, nVID, rVI ) ) +return rVI.visualid == nDefVID; XVisualInfo aVI; aVI.screen = nScreen; @@ -248,9 +255,49 @@ sal_Bool SalDisplay::BestVisual( Display *pDisplay, int nVisuals; XVisualInfo* pVInfos = XGetVisualInfo( pDisplay, VisualScreenMask, aVI, nVisuals ); +// pVInfos should contain at least one visual, otherwise +// we're in trouble +int* pWeight = (int*)alloca( sizeof(int)*nVisuals ); +int i; +for( i = 0; i nVisuals; i++ ) +{ +sal_Bool bUsable = sal_False; +int nTrueColor = 1; + +if ( pVInfos[i].screen != nScreen ) +{ +bUsable = sal_False; +} +else +if( pVInfos[i].c_class == TrueColor ) +{ +nTrueColor = 2048; +if( pVInfos[i].depth == 24 ) +bUsable = sal_True; +} +else if( pVInfos[i].c_class == PseudoColor ) +{ +if( pVInfos[i].depth = 8 ) +bUsable = sal_True; +else if( pVInfos[i].depth == 12 ) +bUsable = sal_True; +} +pWeight[ i ] = bUsable ? nTrueColor*pVInfos[i].depth : -1024; +pWeight[ i ] -= pVInfos[ i ].visualid; +} + +int nBestVisual = 0; +int nBestWeight = -1024; +for( i = 0; i nVisuals; i++ ) +{ +if( pWeight[ i ] nBestWeight ) +{ +nBestWeight = pWeight[ i ]; +nBestVisual = i; +} +} -// HACK -rVI = pVInfos[ 0 ]; +rVI = pVInfos[ nBestVisual ]; XFree( pVInfos ); return rVI.visualid == nDefVID; commit e11cfa9225b05415e12cf3b3cecc05103e62398a Author: Thomas Arnhold tho...@arnhold.org Date: Mon Jan 30 22:52:10 2012 +0100 Revert vcl: stuff This reverts commit 3b90a3f1eaf9b98e52917d97b6991762d498c10d. diff --git a/vcl/unx/generic/app/saldisp.cxx b/vcl/unx/generic/app/saldisp.cxx index 4c10665..90cfe61 100644 --- a/vcl/unx/generic/app/saldisp.cxx +++ b/vcl/unx/generic/app/saldisp.cxx @@ -243,18 +243,14 @@ sal_Bool SalDisplay::BestVisual( Display *pDisplay, VisualID nDefVID = XVisualIDFromVisual( DefaultVisual( pDisplay, nScreen ) ); XVisualInfo aVI; -//aVI.visualid = nDefVID; aVI.screen = nScreen; // get all visuals int nVisuals; XVisualInfo* pVInfos = XGetVisualInfo( pDisplay, VisualScreenMask, aVI, nVisuals ); -if (!pVInfos) -return sal_False; - // HACK -rVI = *pVInfos; +rVI = pVInfos[ 0 ]; XFree( pVInfos ); return rVI.visualid == nDefVID; @@ -438,11 +434,10 @@ SalDisplay::initScreen( SalX11Screen nXScreen ) const if( SalDisplay::BestVisual( pDisp_, nXScreen.getXScreen(), aVI ) ) // DefaultVisual aColMap = DefaultColormap( pDisp_, nXScreen.getXScreen() ); else -fprintf( stderr, HACK: XCreateColormap would be called...\n ); -//aColMap = XCreateColormap( pDisp_, -// RootWindow( pDisp_, nXScreen.getXScreen() ), -// aVI.visual, -// AllocNone ); +aColMap = XCreateColormap( pDisp_, + RootWindow( pDisp_, nXScreen.getXScreen() ), + aVI.visual, + AllocNone ); Screen* pScreen = ScreenOfDisplay( pDisp_, nXScreen.getXScreen() ); ___ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: 2 commits - vcl/unx
vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx | 35 +++ 1 file changed, 27 insertions(+), 8 deletions(-) New commits: commit f8e53d7320aa3f1e7a543ee9f378a1ecd1a54490 Author: Khaled Hosny khaledho...@eglug.org Date: Fri Dec 2 22:27:05 2011 +0200 gtk: fix RTL list box rendering diff --git a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx index cdd388d..f9e5906 100644 --- a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx +++ b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx @@ -3240,7 +3240,10 @@ static Rectangle NWGetListBoxButtonRect( int nScreen, case PART_SUB_EDIT: aPartSize.Width() = aAreaRect.GetWidth() - nButtonAreaWidth - xthickness; -aPartPos.X() = aAreaRect.Left() + xthickness; +if( Application::GetSettings().GetLayoutRTL() ) +aPartPos.X() = aAreaRect.Left() + nButtonAreaWidth; +else +aPartPos.X() = aAreaRect.Left() + xthickness; break; default: @@ -3274,6 +3277,7 @@ static Rectangle NWGetListBoxIndicatorRect( int nScreen, gintwidth = 13;// GTK+ default gintheight = 13;// GTK+ default gintright = 5;// GTK+ default +gintx; NWEnsureGTKOptionMenu( nScreen ); @@ -3291,8 +3295,11 @@ static Rectangle NWGetListBoxIndicatorRect( int nScreen, right = pIndicatorSpacing-right; aIndicatorRect.SetSize( Size( width, height ) ); -aIndicatorRect.SetPos( Point( aAreaRect.Left() + aAreaRect.GetWidth() - width - right - gWidgetData[nScreen].gOptionMenuWidget-style-xthickness, - aAreaRect.Top() + ((aAreaRect.GetHeight() - height) / 2) ) ); +if( Application::GetSettings().GetLayoutRTL() ) +x = aAreaRect.Left() + right; +else +x = aAreaRect.Left() + aAreaRect.GetWidth() - width - right - gWidgetData[nScreen].gOptionMenuWidget-style-xthickness; +aIndicatorRect.SetPos( Point( x, aAreaRect.Top() + ((aAreaRect.GetHeight() - height) / 2) ) ); // If height is odd, move the indicator down 1 pixel if ( aIndicatorRect.GetHeight() % 2 ) commit d2028f970bd527880c73f237678291d1bdc7cc89 Author: Khaled Hosny khaledho...@eglug.org Date: Fri Dec 2 14:10:32 2011 +0200 gtk: fix RTL spin button rendering diff --git a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx index 6afba20..cdd388d 100644 --- a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx +++ b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx @@ -2026,8 +2026,11 @@ sal_Bool GtkSalGraphics::NWPaintGTKSpinBox( ControlType nType, ControlPart nPart { // Draw an edit field for SpinBoxes and ComboBoxes Rectangle aEditBoxRect( pixmapRect ); -aEditBoxRect.SetSize( Size( upBtnRect.Left() - pixmapRect.Left(), aEditBoxRect.GetHeight() ) ); -aEditBoxRect.setX( 0 ); +aEditBoxRect.SetSize( Size( pixmapRect.GetWidth() - upBtnRect.GetWidth(), aEditBoxRect.GetHeight() ) ); +if( Application::GetSettings().GetLayoutRTL() ) +aEditBoxRect.setX( upBtnRect.GetWidth() ); +else +aEditBoxRect.setX( 0 ); aEditBoxRect.setY( 0 ); NWPaintOneEditBox( m_nScreen, pixmap, NULL, nType, nPart, aEditBoxRect, nState, aValue, rCaption ); @@ -2080,7 +2083,10 @@ static Rectangle NWGetSpinButtonRect( int nScreen, buttonSize -= buttonSize % 2 - 1; /* force odd */ buttonRect.SetSize( Size( buttonSize + 2 * gWidgetData[nScreen].gSpinButtonWidget-style-xthickness, buttonRect.GetHeight() ) ); -buttonRect.setX( aAreaRect.Left() + (aAreaRect.GetWidth() - buttonRect.GetWidth()) ); +if( Application::GetSettings().GetLayoutRTL() ) +buttonRect.setX( aAreaRect.Left() ); +else +buttonRect.setX( aAreaRect.Left() + (aAreaRect.GetWidth() - buttonRect.GetWidth()) ); if ( nPart == PART_BUTTON_UP ) { buttonRect.setY( aAreaRect.Top() ); @@ -2093,8 +2099,14 @@ static Rectangle NWGetSpinButtonRect( int nScreen, } else { -buttonRect.Right() = buttonRect.Left()-1; -buttonRect.Left() = aAreaRect.Left(); +if( Application::GetSettings().GetLayoutRTL() ) { +buttonRect.Left() = buttonRect.Right()+1; +buttonRect.Right() = aAreaRect.Right(); +} else { +printf(%ld\n, buttonRect.GetWidth()); +buttonRect.Right() = buttonRect.Left()-1; +buttonRect.Left() = aAreaRect.Left(); +} buttonRect.Top()= aAreaRect.Top(); buttonRect.Bottom() = aAreaRect.Bottom(); } ___ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: 2 commits - vcl/unx
vcl/unx/gtk/app/gtkdata.cxx | 25 - 1 file changed, 16 insertions(+), 9 deletions(-) New commits: commit 76a0e6ee30cb7610bc0eb1d536476fc801f3a3bf Author: Caolán McNamara caol...@redhat.com Date: Mon Oct 10 17:09:12 2011 +0100 grab monitors on start also diff --git a/vcl/unx/gtk/app/gtkdata.cxx b/vcl/unx/gtk/app/gtkdata.cxx index 4e10809..904d22a 100644 --- a/vcl/unx/gtk/app/gtkdata.cxx +++ b/vcl/unx/gtk/app/gtkdata.cxx @@ -783,6 +783,9 @@ void GtkXLib::Init() GdkScreen *pScreen = gdk_display_get_screen( pGdkDisp, n ); if( pScreen ) { +m_pGtkSalDisplay-screenSizeChanged(pScreen); +m_pGtkSalDisplay-monitorsChanged(pScreen); + g_signal_connect( G_OBJECT(pScreen), size-changed, G_CALLBACK(signalScreenSizeChanged), m_pGtkSalDisplay ); if( ! gtk_check_version( 2, 14, 0 ) ) // monitors-changed came in with 2.14, avoid an assertion g_signal_connect( G_OBJECT(pScreen), monitors-changed, G_CALLBACK(signalMonitorsChanged), m_pGtkSalDisplay ); commit 1f88a2a00dfdcc29e805d23c1a88a82b69d59d24 Author: Caolán McNamara caol...@redhat.com Date: Mon Oct 10 17:08:37 2011 +0100 fix the fallback logic diff --git a/vcl/unx/gtk/app/gtkdata.cxx b/vcl/unx/gtk/app/gtkdata.cxx index 4cb161a..4e10809 100644 --- a/vcl/unx/gtk/app/gtkdata.cxx +++ b/vcl/unx/gtk/app/gtkdata.cxx @@ -259,20 +259,24 @@ int GtkSalDisplay::GetDefaultMonitorNumber() const (screen_get_primary_monitor)osl_getAsciiFunctionSymbol( GetSalData()-m_pPlugin, gdk_screen_get_primary_monitor ); if (sym_gdk_screen_get_primary_monitor) n = sym_gdk_screen_get_primary_monitor( pScreen ); -#if GTK_CHECK_VERSION(2,14,0) -//gdk_screen_get_primary_monitor unavailable, take the first laptop monitor -//as the default -gint nMonitors = gdk_screen_get_n_monitors(pScreen); -for (gint i = 0; i nMonitors; ++i) +else { -if (g_ascii_strncasecmp (gdk_screen_get_monitor_plug_name(pScreen, i), LVDS, 4) == 0) { -OSL_ASSERT( size_t(i) m_aXineramaScreenIndexMap.size() ); -return (size_t(i) m_aXineramaScreenIndexMap.size()) ? m_aXineramaScreenIndexMap[i] : 0; +#if GTK_CHECK_VERSION(2,14,0) +//gdk_screen_get_primary_monitor unavailable, take the first laptop monitor +//as the default +gint nMonitors = gdk_screen_get_n_monitors(pScreen); +for (gint i = 0; i nMonitors; ++i) +{ +if (g_ascii_strncasecmp (gdk_screen_get_monitor_plug_name(pScreen, i), LVDS, 4) == 0) +{ +n = i; +break; +} } } #endif -return 0; #endif + if( n = 0 size_t(n) m_aXineramaScreenIndexMap.size() ) n = m_aXineramaScreenIndexMap[n]; return n; ___ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits