[Libreoffice-commits] .: Branch 'feature/gtk3' - 2 commits - canvas/source vcl/inc vcl/unx
Michael Meeks
michael at kemper.freedesktop.org
Thu Oct 20 13:49:24 PDT 2011
canvas/source/cairo/cairo_xlib_cairo.cxx | 3 +
vcl/inc/unx/gtk/gtkdata.hxx | 2
vcl/inc/unx/gtk/gtkframe.hxx | 1
vcl/unx/gtk/app/gtkdata.cxx | 11 ++---
vcl/unx/gtk/app/gtksys.cxx | 4 -
vcl/unx/gtk/window/gtkframe.cxx | 68 +++++++++++--------------------
6 files changed, 38 insertions(+), 51 deletions(-)
New commits:
commit 67a9f6ae97d5b80433328c1120b977ae381063b5
Author: Michael Meeks <michael.meeks at suse.com>
Date: Thu Oct 20 21:49:40 2011 +0100
gtk3: fix cairo canvas crash for non X (or svp) backend
diff --git a/canvas/source/cairo/cairo_xlib_cairo.cxx b/canvas/source/cairo/cairo_xlib_cairo.cxx
index a0569ab..8e9120d 100644
--- a/canvas/source/cairo/cairo_xlib_cairo.cxx
+++ b/canvas/source/cairo/cairo_xlib_cairo.cxx
@@ -55,6 +55,9 @@ namespace cairo
return false;
Display* pDisplay = (Display*)pOutDev->GetSystemGfxData().pDisplay;
+ if( !pDisplay )
+ return false;
+
int nDummy;
return XQueryExtension( pDisplay, "RENDER", &nDummy, &nDummy, &nDummy );
}
commit 8173d08f0a3e9f205d2078fe8299d1650a81eea3
Author: Michael Meeks <michael.meeks at suse.com>
Date: Thu Oct 20 21:12:39 2011 +0100
gtk3: cleanup fullscreen unpleasantness
diff --git a/vcl/inc/unx/gtk/gtkdata.hxx b/vcl/inc/unx/gtk/gtkdata.hxx
index 458dfdd..8b87eb2 100644
--- a/vcl/inc/unx/gtk/gtkdata.hxx
+++ b/vcl/inc/unx/gtk/gtkdata.hxx
@@ -130,6 +130,7 @@ class GtkSalDisplay : public SalDisplay
GdkDisplay* m_pGdkDisplay;
GdkCursor *m_aCursors[ POINTER_COUNT ];
bool m_bStartupCompleted;
+ bool m_bX11Display;
GdkCursor* getFromXBM( const unsigned char *pBitmap, const unsigned char *pMask,
int nWidth, int nHeight, int nXHot, int nYHot );
@@ -138,6 +139,7 @@ public:
virtual ~GtkSalDisplay();
GdkDisplay* GetGdkDisplay() const { return m_pGdkDisplay; }
+ bool IsX11Display() const { return m_bX11Display; }
virtual void deregisterFrame( SalFrame* pFrame );
GdkCursor *getCursor( PointerStyle ePointerStyle );
diff --git a/vcl/inc/unx/gtk/gtkframe.hxx b/vcl/inc/unx/gtk/gtkframe.hxx
index 4fa86d3..edd904e 100644
--- a/vcl/inc/unx/gtk/gtkframe.hxx
+++ b/vcl/inc/unx/gtk/gtkframe.hxx
@@ -177,7 +177,6 @@ class GtkSalFrame : public SalFrame, basebmp::BitmapDeviceDamageTracker
int m_nScreen;
GtkWidget* m_pWindow;
- guint m_nIdleFullScreen;
int m_nDuringRender;
GdkWindow* m_pForeignParent;
GdkNativeWindow m_aForeignParentWindow;
diff --git a/vcl/unx/gtk/app/gtkdata.cxx b/vcl/unx/gtk/app/gtkdata.cxx
index 27a2413..ad417f1 100644
--- a/vcl/unx/gtk/app/gtkdata.cxx
+++ b/vcl/unx/gtk/app/gtkdata.cxx
@@ -101,6 +101,12 @@ GtkSalDisplay::GtkSalDisplay( GdkDisplay* pDisplay ) :
if ( getenv( "SAL_IGNOREXERRORS" ) )
GetGenericData()->ErrorTrapPush(); // and leak the trap
+
+#if GTK_CHECK_VERSION(3,0,0)
+ m_bX11Display = GDK_IS_X11_DISPLAY( m_pGdkDisplay );
+#else
+ m_bX11Display = true;
+#endif
}
GtkSalDisplay::~GtkSalDisplay()
@@ -214,11 +220,6 @@ void GtkSalDisplay::monitorsChanged( GdkScreen* pScreen )
emitDisplayChanged();
}
-extern "C"
-{
- typedef gint(* screen_get_primary_monitor)(GdkScreen *screen);
-}
-
void GtkSalDisplay::initScreen( int nScreen ) const
{
#if GTK_CHECK_VERSION(3,0,0)
diff --git a/vcl/unx/gtk/app/gtksys.cxx b/vcl/unx/gtk/app/gtksys.cxx
index 6e09b6a..a80e68a 100644
--- a/vcl/unx/gtk/app/gtksys.cxx
+++ b/vcl/unx/gtk/app/gtksys.cxx
@@ -108,7 +108,7 @@ bool GtkSalSystem::IsMultiDisplay()
}
namespace {
-int _fallback_get_primary_monitor (GdkScreen *pScreen)
+static int _fallback_get_primary_monitor (GdkScreen *pScreen)
{
// Use monitor name as primacy heuristic
int ret = -1;
@@ -123,7 +123,7 @@ int _fallback_get_primary_monitor (GdkScreen *pScreen)
return 0;
}
-int _get_primary_monitor (GdkScreen *pScreen)
+static int _get_primary_monitor (GdkScreen *pScreen)
{
static int (*get_fn) (GdkScreen *) = NULL;
#if GTK_CHECK_VERSION(3,0,0)
diff --git a/vcl/unx/gtk/window/gtkframe.cxx b/vcl/unx/gtk/window/gtkframe.cxx
index 4a4db88..3ab7840 100644
--- a/vcl/unx/gtk/window/gtkframe.cxx
+++ b/vcl/unx/gtk/window/gtkframe.cxx
@@ -46,6 +46,7 @@
#include <tools/prex.h>
#include <X11/Xatom.h>
+#include <gdk/gdkx.h>
#include <tools/postx.h>
#include <dlfcn.h>
@@ -444,7 +445,6 @@ GtkSalFrame::GtkSalFrame( SalFrame* pParent, sal_uLong nStyle )
{
m_nScreen = getDisplay()->GetDefaultScreenNumber();
getDisplay()->registerFrame( this );
- m_nIdleFullScreen = 0;
m_nDuringRender = 0;
m_bDefaultPos = true;
m_bDefaultSize = ( (nStyle & SAL_FRAME_STYLE_SIZEABLE) && ! pParent );
@@ -460,14 +460,11 @@ GtkSalFrame::GtkSalFrame( SystemParentData* pSysData )
GetGenericData()->ErrorTrapPush();
m_bDefaultPos = true;
m_bDefaultSize = true;
- m_nIdleFullScreen = 0;
Init( pSysData );
}
GtkSalFrame::~GtkSalFrame()
{
- g_idle_remove_by_data (this);
-
for( unsigned int i = 0; i < SAL_N_ELEMENTS(m_aGraphics); ++i )
{
if( !m_aGraphics[i].pGraphics )
@@ -1844,8 +1841,10 @@ void GtkSalFrame::SetScreen( unsigned int nNewScreen, int eType, Rectangle *pSiz
gint nOldMonitor = gdk_screen_get_monitor_at_window(
pScreen, widget_get_window( m_pWindow ) );
+#if OSL_DEBUG_LEVEL > 1
if( nMonitor == nOldMonitor )
- g_warning( "FIXME: do we get a lot of pointless SetScreens ?" );
+ g_warning( "An apparently pointless SetScreen - should we elide it ?" );
+#endif
GdkRectangle aOldMonitor, aNewMonitor;
gdk_screen_get_monitor_geometry( pScreen, nOldMonitor, &aOldMonitor );
@@ -1992,7 +1991,7 @@ void GtkSalFrame::ShowFullScreen( sal_Bool bFullScreen, sal_Int32 nScreen )
void GtkSalFrame::setAutoLock( bool bLock )
{
- if( isChild() )
+ if( isChild() || !getDisplay()->IsX11Display() )
return;
GdkScreen *pScreen = gtk_window_get_screen( GTK_WINDOW(m_pWindow) );
@@ -2127,6 +2126,9 @@ void GtkSalFrame::StartPresentation( sal_Bool bStart )
{
setAutoLock( !bStart );
+ if( !getDisplay()->IsX11Display() )
+ return;
+
#if !GTK_CHECK_VERSION(3,0,0)
Display *pDisplay = GDK_DISPLAY_XDISPLAY( getGdkDisplay() );
@@ -3215,39 +3217,22 @@ gboolean GtkSalFrame::signalFocus( GtkWidget*, GdkEventFocus* pEvent, gpointer f
}
extern "C" {
-gboolean implDelayedFullScreenHdl (void *)
-{
- g_warning ("FIXME: nasty delayed full-screen hdl workaround !");
-#if 0
-#if !GTK_CHECK_VERSION(3,0,0)
- Atom nStateAtom = getDisplay()->getWMAdaptor()->getAtom(vcl_sal::WMAdaptor::NET_WM_STATE);
- Atom nFSAtom = getDisplay()->getWMAdaptor()->getAtom(vcl_sal::WMAdaptor::NET_WM_STATE_FULLSCREEN );
- if( nStateAtom && nFSAtom )
+gboolean implDelayedFullScreenHdl (void *pWindow)
+{
+ /* #i110881# workaround a gtk issue (see
+ https://bugzilla.redhat.com/show_bug.cgi?id=623191#c8)
+ gtk_window_fullscreen can fail due to a race condition,
+ request an additional status change to fullscreen to be
+ safe: if the window is now mapped ... and wasn't
+ previously, ie. the race; we'll end up doing a nice
+ gdk_wmspec_change_state here anyway.
+ */
+ if( pWindow )
{
- /* #i110881# workaround a gtk issue (see https://bugzilla.redhat.com/show_bug.cgi?id=623191#c8)
- gtk_window_fullscreen can fail due to a race condition, request an additional status change
- to fullscreen to be safe
- */
- XEvent aEvent;
- aEvent.type = ClientMessage;
- aEvent.xclient.display = getDisplay()->GetDisplay();
- aEvent.xclient.window = GDK_WINDOW_XWINDOW(widget_get_window(m_pWindow));
- aEvent.xclient.message_type = nStateAtom;
- aEvent.xclient.format = 32;
- aEvent.xclient.data.l[0] = 1;
- aEvent.xclient.data.l[1] = nFSAtom;
- aEvent.xclient.data.l[2] = 0;
- aEvent.xclient.data.l[3] = 0;
- aEvent.xclient.data.l[4] = 0;
- XSendEvent( getDisplay()->GetDisplay(),
- getDisplay()->GetRootWindow( m_nScreen ),
- False,
- SubstructureNotifyMask | SubstructureRedirectMask,
- &aEvent
- );
+ gdk_window_fullscreen( GDK_WINDOW( pWindow ) );
+ g_object_unref( pWindow );
}
-#endif
-#endif
+
return FALSE;
}
}
@@ -3259,12 +3244,9 @@ gboolean GtkSalFrame::signalMap( GtkWidget*, GdkEvent*, gpointer frame )
GTK_YIELD_GRAB();
if( pThis->m_bFullscreen )
- {
- /* #i110881# workaorund a gtk issue (see https://bugzilla.redhat.com/show_bug.cgi?id=623191#c8)
- gtk_window_fullscreen can run into a race condition with the window's showstate
- */
- g_idle_add_full( G_PRIORITY_HIGH, implDelayedFullScreenHdl, pThis, NULL );
- }
+ g_idle_add_full( G_PRIORITY_HIGH, implDelayedFullScreenHdl,
+ g_object_ref( widget_get_window( pThis->m_pWindow ) ),
+ NULL );
bool bSetFocus = pThis->m_bSetFocusOnMap;
pThis->m_bSetFocusOnMap = false;
More information about the Libreoffice-commits
mailing list